diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index 77af27417517d6b9dadfce6a35b7d600f74a2a10..620782996417fb22dc96399dcde8572fc947c6cd 100644 (file)
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
}
}
+NRRect::NRRect(boost::optional<Geom::Rect> const &rect) {
+ if (rect) {
+ x0 = rect->min()[Geom::X];
+ y0 = rect->min()[Geom::Y];
+ x1 = rect->max()[Geom::X];
+ y1 = rect->max()[Geom::Y];
+ } else {
+ nr_rect_d_set_empty(this);
+ }
+}
+
boost::optional<NR::Rect> NRRect::upgrade() const {
if (nr_rect_d_test_empty_ptr(this)) {
return boost::optional<NR::Rect>();
}
}
+boost::optional<Geom::Rect> NRRect::upgrade_2geom() const {
+ if (nr_rect_d_test_empty_ptr(this)) {
+ return boost::optional<Geom::Rect>();
+ } else {
+ return Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1));
+ }
+}
+
/**
* \param r0 Rectangle.
* \param r1 Another rectangle.