Code

add LPE extrude. it's not finished yet!
[inkscape.git] / src / sp-conn-end-pair.cpp
index 328f5a6962bf4b15d1f1f0d6bd883eee8e060b6f..4dc0230ff71c27ff4c7293f7e223dd351b09392f 100644 (file)
@@ -80,7 +80,7 @@ sp_conn_end_pair_build(SPObject *object)
 
 
 static void
-avoid_conn_move(NR::Matrix const */*mp*/, SPItem *moved_item)
+avoid_conn_move(Geom::Matrix const */*mp*/, SPItem *moved_item)
 {
     // Reroute connector
     SPPath *path = SP_PATH(moved_item);
@@ -160,28 +160,28 @@ SPConnEndPair::getAttachedItems(SPItem *h2attItem[2]) const {
 }
 
 void
-SPConnEndPair::getEndpoints(NR::Point endPts[]) const {
+SPConnEndPair::getEndpoints(Geom::Point endPts[]) const {
     SPCurve *curve = _path->curve;
     SPItem *h2attItem[2];
     getAttachedItems(h2attItem);
 
     for (unsigned h = 0; h < 2; ++h) {
         if ( h2attItem[h] ) {
-            boost::optional<NR::Rect> bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
+            Geom::OptRect bbox = h2attItem[h]->getBounds(sp_item_i2doc_affine(h2attItem[h]));
             if (bbox) {
                 endPts[h] = bbox->midpoint();
             } else {
                 // FIXME
-                endPts[h] = NR::Point(0, 0);
+                endPts[h] = Geom::Point(0, 0);
             }
         }
         else
         {
             if (h == 0) {
-                endPts[h] = curve->first_point();
+                endPts[h] = *(curve->first_point());
             }
             else {
-                endPts[h] = curve->last_point();
+                endPts[h] = *(curve->last_point());
             }
         }
     }
@@ -225,11 +225,11 @@ SPConnEndPair::update(void)
     if (_connType != SP_CONNECTOR_NOAVOID) {
         g_assert(_connRef != NULL);
         if (!(_connRef->isInitialised())) {
-            NR::Point endPt[2];
+            Geom::Point endPt[2];
             getEndpoints(endPt);
 
-            Avoid::Point src(endPt[0][NR::X], endPt[0][NR::Y]);
-            Avoid::Point dst(endPt[1][NR::X], endPt[1][NR::Y]);
+            Avoid::Point src(endPt[0][Geom::X], endPt[0][Geom::Y]);
+            Avoid::Point dst(endPt[1][Geom::X], endPt[1][Geom::Y]);
 
             _connRef->lateSetup(src, dst);
             _connRef->setCallback(&emitPathInvalidationNotification, _path);
@@ -288,11 +288,11 @@ SPConnEndPair::reroutePath(void)
 
     SPCurve *curve = _path->curve;
 
-    NR::Point endPt[2];
+    Geom::Point endPt[2];
     getEndpoints(endPt);
 
-    Avoid::Point src(endPt[0][NR::X], endPt[0][NR::Y]);
-    Avoid::Point dst(endPt[1][NR::X], endPt[1][NR::Y]);
+    Avoid::Point src(endPt[0][Geom::X], endPt[0][Geom::Y]);
+    Avoid::Point dst(endPt[1][Geom::X], endPt[1][Geom::Y]);
 
     _connRef->updateEndPoint(Avoid::VertID::src, src);
     _connRef->updateEndPoint(Avoid::VertID::tar, dst);
@@ -306,9 +306,12 @@ SPConnEndPair::reroutePath(void)
     curve->moveto(endPt[0]);
 
     for (int i = 1; i < route.pn; ++i) {
-        NR::Point p(route.ps[i].x, route.ps[i].y);
+        Geom::Point p(route.ps[i].x, route.ps[i].y);
         curve->lineto(p);
     }
+
+    Geom::Matrix doc2item = sp_item_i2doc_affine(SP_ITEM(_path)).inverse();
+    curve->transform(doc2item); 
 }
 
 /*