diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 8fbdfb6739a97e491fbd77f27f7cdcddaa098566..5de222adef48e3f4945536e02d63c6f67d88655f 100644 (file)
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
#include "conn-avoid-ref.h"
#include "libnr/nr-rect-ops.h"
#include "libavoid/polyutil.h"
-#include "libavoid/incremental.h"
+#include "libavoid/router.h"
#include "libavoid/connector.h"
#include "xml/simple-node.cpp"
#include "document.h"
#include "inkscape.h"
+using Avoid::Router;
+
static Avoid::Polygn avoid_item_poly(SPItem const *item);
{
_transformed_connection.disconnect();
if (shapeRef) {
+ Router *router = shapeRef->router();
// shapeRef is finalised by delShape,
// so no memory is lost here.
- Avoid::delShape(shapeRef);
+ router->delShape(shapeRef);
shapeRef = NULL;
}
}
if (desktop == NULL) {
return;
}
+
+ Router *router = item->document->router;
if (new_setting == setting) {
// Don't need to make any changes
// Get a unique ID for the item.
GQuark itemID = g_quark_from_string(id);
- shapeRef = new Avoid::ShapeRef(itemID, poly);
+ shapeRef = new Avoid::ShapeRef(router, itemID, poly);
Avoid::freePoly(poly);
- Avoid::addShape(shapeRef);
+ router->addShape(shapeRef);
}
}
else
// shapeRef is finalised by delShape,
// so no memory is lost here.
- Avoid::delShape(shapeRef);
+ router->delShape(shapeRef);
shapeRef = NULL;
}
setting = new_setting;
}
+GSList *SPAvoidRef::getAttachedShapes(const unsigned int type)
+{
+ GSList *list = NULL;
+
+ Avoid::IntList shapes;
+ GQuark shapeId = g_quark_from_string(item->id);
+ item->document->router->attachedShapes(shapes, shapeId, type);
+
+ Avoid::IntList::iterator finish = shapes.end();
+ for (Avoid::IntList::iterator i = shapes.begin(); i != finish; ++i) {
+ const gchar *connId = g_quark_to_string(*i);
+ SPObject *obj = item->document->getObjectById(connId);
+ if (obj == NULL) {
+ g_warning("getAttachedShapes: Object with id=\"%s\" is not "
+ "found. Skipping.", connId);
+ continue;
+ }
+ SPItem *shapeItem = SP_ITEM(obj);
+ list = g_slist_prepend(list, shapeItem);
+ }
+ return list;
+}
+
+
GSList *SPAvoidRef::getAttachedConnectors(const unsigned int type)
{
GSList *list = NULL;
Avoid::IntList conns;
GQuark shapeId = g_quark_from_string(item->id);
- Avoid::attachedToShape(conns, shapeId, type);
+ item->document->router->attachedConns(conns, shapeId, type);
Avoid::IntList::iterator finish = conns.end();
for (Avoid::IntList::iterator i = conns.begin(); i != finish; ++i) {
const gchar *connId = g_quark_to_string(*i);
- SPItem *item = SP_ITEM(item->document->getObjectById(connId));
- g_assert(item != NULL);
- list = g_slist_prepend(list, item);
+ SPObject *obj = item->document->getObjectById(connId);
+ if (obj == NULL) {
+ g_warning("getAttachedConnectors: Object with id=\"%s\" is not "
+ "found. Skipping.", connId);
+ continue;
+ }
+ SPItem *connItem = SP_ITEM(obj);
+ list = g_slist_prepend(list, connItem);
}
return list;
}
Avoid::ShapeRef *shapeRef = moved_item->avoidRef->shapeRef;
g_assert(shapeRef);
+ Router *router = moved_item->document->router;
Avoid::Polygn poly = avoid_item_poly(moved_item);
if (poly.pn > 0) {
- // moveShape actually destroys the old shapeRef and returns a new one.
- moved_item->avoidRef->shapeRef = Avoid::moveShape(shapeRef, &poly);
+ router->moveShape(shapeRef, &poly);
Avoid::freePoly(poly);
}
}