Code

Added missing translation.
[inkscape.git] / src / libnr / nr-rect.cpp
index 77af27417517d6b9dadfce6a35b7d600f74a2a10..1e1f3610443513441fea885abae7ebd4bf600d0c 100644 (file)
@@ -28,6 +28,17 @@ NRRect::NRRect(boost::optional<NR::Rect> const &rect) {
     }
 }
 
+NRRect::NRRect(Geom::OptRect 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>();
@@ -36,6 +47,14 @@ boost::optional<NR::Rect> NRRect::upgrade() const {
     }
 }
 
+Geom::OptRect NRRect::upgrade_2geom() const {
+    if (nr_rect_d_test_empty_ptr(this)) {
+        return Geom::OptRect();
+    } else {
+        return Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1));
+    }
+}
+
 /**
  *    \param r0 Rectangle.
  *    \param r1 Another rectangle.