19#include <glibmm/stringutils.h>
38 , _transformed_connection()
40 for (
unsigned handle_ix = 0; handle_ix <= 1; ++handle_ix) {
45 this->
_connEnd[handle_ix], owner, handle_ix));
51 for (
auto & handle_ix : this->
_connEnd) {
59 for (
auto & handle_ix : this->
_connEnd) {
60 handle_ix->_changed_connection.disconnect();
61 handle_ix->_delete_connection.disconnect();
62 handle_ix->_transformed_connection.disconnect();
63 g_free(handle_ix->href);
64 handle_ix->href =
nullptr;
65 handle_ix->ref.detach();
72 if (
_connRef && routerInstanceExists) {
93 auto path = cast<SPPath>(moved_item);
94 if (path->connEndPair.isAutoRoutingConn()) {
95 path->connEndPair.tellLibavoidNewEndpoints();
104 if (value && (strcmp(value,
"polyline") == 0 || strcmp(value,
"orthogonal") == 0)) {
156 char const *
const attrs[] = {
157 "inkscape:connection-start",
"inkscape:connection-end"};
158 char const *
const point_attrs[] = {
159 "inkscape:connection-start-point",
"inkscape:connection-end-point"};
160 for (
unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) {
179 for (
unsigned h = 0; h < 2; ++h) {
186 auto use = cast<SPUse>(obj);
188 auto root = use->root();
191 if(!g_strcmp0(
child.getAttribute(
"id"), sub_obj->getId())) {
197 g_warning(
"Couldn't find sub connector point!");
210 if (
auto group = cast<SPGroup>(h2attItem[h])) {
211 if (group->getItemCount() == 0) {
214 h2attItem[h] =
nullptr;
223 SPItem *h2attItem[2] = {
nullptr};
227 for (
unsigned h = 0; h < 2; ++h) {
230 }
else if (!
curve->is_empty()) {
232 endPts[h] = *(
curve->first_point()) * i2d;
234 endPts[h] = *(
curve->last_point()) * i2d;
258 auto path =
static_cast<SPPath *
>(ptr);
259 if (path->document ==
nullptr) {
312 g_assert(connRef !=
nullptr);
323 int pn = route.
size();
324 for (
int i = 1; i < pn; ++i) {
329 switch (route.
ts[i]) {
337 g_assert(i + 2 < pn);
358 if (processTransaction) {
374 curve.transform(doc2item);
Lookup dictionary for attributes/properties.
The ConnRef class represents a connector object.
void makePathInvalid(void)
void setCallback(void(*cb)(void *), void *ptr)
Sets a callback function that will called to indicate that the connector needs rerouting.
bool isInitialised(void) const
PolyLine & displayRoute(void)
Returns a reference to the current display version of the route for the connector.
Router * router(void) const
Returns a pointer to the router scene this connector is in.
void setRoutingType(ConnType type)
Sets the type of routing to be performed for this connector.
void setEndpoints(const ConnEnd &srcPoint, const ConnEnd &dstPoint)
Sets both a new source and destination endpoint for this connector.
The Point class defines a point in the plane.
A dynamic Polygon, to which points can be easily added and removed.
size_t size(void) const
Returns the number of points in this polygon.
Polygon curvedPolyline(const double curve_amount, const bool closed=false) const
Returns a curved approximation of this multi-segment PolyLine, with the corners replaced by smooth Be...
std::vector< char > ts
If used, denotes whether the corresponding point in ps is a move-to operation or a Bezier curve-to.
std::vector< Point > ps
A vector of the points that make up the Polygon.
The Router class represents a libavoid router instance.
void deleteConnector(ConnRef *connector)
Remove a connector from the router scene.
bool processTransaction(void)
Finishes the current transaction and processes all the queued object changes efficiently.
3x3 matrix representing an affine transformation.
Affine inverse() const
Compute the inverse matrix.
Two-dimensional point that doubles as a vector.
URI const * getURI() const
Returns a pointer to a URI containing the currently attached URI, or NULL if no URI is currently atta...
sigc::signal< void(SPObject *, SPObject *)> changedSignal()
Accessor for the referrent change notification signal; this signal is emitted whenever the URIReferen...
Represents an URI as per RFC 2396.
std::string str(char const *baseuri=nullptr) const
Return the string representation of this URI.
Interface for refcounted XML nodes.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
Geom::Point getConnectionPointPos()
Avoid::ConnRef * _connRef
void writeRepr(Inkscape::XML::Node *const repr) const
void setAttr(const SPAttr key, char const *const value)
void getEndpoints(Geom::Point endPts[]) const
sigc::connection _transformed_connection
bool isOrthogonal() const
void tellLibavoidNewEndpoints(bool const processTransaction=false)
SPConnEnd ** getConnEnds()
static SPCurve createCurve(Avoid::ConnRef *connRef, double curvature)
void rerouteFromManipulation()
bool isAutoRoutingConn() const
bool reroutePathFromLibavoid()
double getCurvature() const
void getAttachedItems(SPItem *[2]) const
sigc::connection _changed_connection
Change of href string (not a modification of the attributes of the referrent).
void setAttacherSubHref(char const *value)
void setAttacherHref(char const *value)
Wrapper around a Geom::PathVector object.
Avoid::Router * getRouter() const
Base class for visual SVG elements.
sigc::connection connectTransformed(sigc::slot< void(Geom::Affine const *, SPItem *)> slot)
SPAvoidRef & getAvoidRef()
Geom::Affine i2doc_affine() const
Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
SVG <path> implementation.
SPCurve const * curveForEdit() const
Return a borrowed pointer of the curve for edit.
void setCurve(SPCurve const *)
SPItem * getObject() const
@ ConnType_Orthogonal
The connector path will be a shortest-path orthogonal poly-line (only vertical and horizontal line se...
@ ConnType_PolyLine
The connector path will be a shortest-path poly-line that routes around obstacles.
static cairo_user_data_key_t key
Contains the interface for the Router class.
double curvature(Point const &a, Point const &b, Point const &c)
static void avoid_conn_transformed(Geom::Affine const *, SPItem *moved_item)
static void redrawConnectorCallback(void *ptr)
void sp_conn_end_pair_build(SPObject *object)
@ SP_CONNECTOR_ORTHOGONAL
void sp_conn_reroute_path(SPPath *const path)
void sp_conn_reroute_path_immediate(SPPath *const path)
void sp_conn_end_href_changed(SPObject *, SPObject *, SPConnEnd *connEnd, SPPath *path, unsigned handle_ix)
void sp_conn_end_detach(SPObject *const owner, unsigned const handle_ix)
void sp_conn_redraw_path(SPPath *const path)
TODO: insert short description here.