/*
5 * Authors: see git history
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
25 , _changed_connection()
26 , _delete_connection()
27 , _transformed_connection()
34 for (
unsigned i = 0; i < 2; ++i) {
35 if ( objs[i] !=
nullptr ) {
44 const Geom::Affine& item_transform,
double& intersect_pos)
46 double initial_pos = intersect_pos;
48 if (is<SPGroup>(
item)) {
49 auto group = cast<SPGroup>(
item);
52 double child_pos = 0.0;
53 std::vector<SPItem*> g = group->item_list();
54 for (
auto child_item : g) {
56 item_transform * child_item->transform, child_pos);
57 if (intersect_pos < child_pos)
58 intersect_pos = child_pos;
60 return intersect_pos != initial_pos;
64 auto shape = cast<SPShape>(
item);
69 if (!shape->curve())
return false;
72 auto const curve_pv = *shape->curve() * item_transform;
77 for (
const auto & cr : cross) {
78 for (
const auto & cr_pt : cr) {
79 if ( intersect_pos < cr_pt.ta)
80 intersect_pos = cr_pt.ta;
84 return intersect_pos != initial_pos;
94 const bool at_start,
double& intersect_pos)
97 auto conn_pv = *conn->
curve() * conn_transform;
102 conn_pv[0] = conn_pv[0].reversed();
118 intersect_pos = conn_pv[0].size() - intersect_pos;
133 SPItem *h2attItem[2] = {
nullptr};
142 double endPos[2] = { 0.0,
static_cast<double>(conn_pv[0].
size()) };
144 for (
unsigned h = 0; h < 2; ++h) {
149 (h == 0), endPos[h]);
153 if (updatePathRepr) {
194 if (endPos[0] > endPos[1]) {
202 path->
setCurve(std::move(new_path_vector));
207 char const *
const attrs[] = {
208 "inkscape:connection-start",
"inkscape:connection-end"};
211 char const *
const point_attrs[] = {
212 "inkscape:connection-start-point",
"inkscape:connection-end-point"};
224 if (g_strcmp0(value,
href) != 0) {
226 href = g_strdup(value);
238 if (g_strcmp0(value,
sub_href) != 0) {
250 if (!connEnd)
return;
3x3 matrix representing an affine transformation.
size_type size() const
Get the number of paths in the vector.
void push_back(Path const &path)
Append a path at the end.
Sequence of contiguous curves, aka spline.
Path portion(Coord f, Coord t) const
bool try_attach(char const *uri)
Try to attach to a URI.
void tellLibavoidNewEndpoints(bool const processTransaction=false)
bool isAutoRoutingConn() const
bool reroutePathFromLibavoid()
void getAttachedItems(SPItem *[2]) const
sigc::connection _transformed_connection
A sigc connection for transformed signal, used to do move compensation.
void setAttacherSubHref(char const *value)
SPConnEnd(SPObject *owner)
void setAttacherHref(char const *value)
sigc::connection _delete_connection
Called when the attached object gets deleted.
Base class for visual SVG elements.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
void removeAttribute(char const *key)
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
SPObject const * nearestCommonAncestor(SPObject const *object) const
Returns youngest object being parent to this and object.
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
SVG <path> implementation.
SPConnEndPair connEndPair
void setCurve(Geom::PathVector const *)
Geom::PathVector const * curve() const
Return a borrowed pointer to the curve (if any exists) or NULL if there is no curve.
SPItem * getObject() const
std::vector< Crossings > CrossingSet
void sp_conn_reroute_path(SPPath *const path)
static void sp_conn_get_route_and_redraw(SPPath *const path, const bool updatePathRepr=true)
static bool try_get_intersect_point_with_item(SPPath *conn, SPItem *item, const Geom::Affine &item_transform, const Geom::Affine &conn_transform, const bool at_start, double &intersect_pos)
void sp_conn_reroute_path_immediate(SPPath *const path)
void sp_conn_end_href_changed(SPObject *, SPObject *, SPConnEnd *connEnd, SPPath *path, unsigned handle_ix)
static void sp_conn_end_deleted(SPObject *, SPObject *const owner, unsigned const handle_ix)
static void change_endpts(SPPath *path, double endPos[2])
void sp_conn_end_detach(SPObject *const owner, unsigned const handle_ix)
static void sp_conn_end_shape_modified(SPPath *path)
static bool try_get_intersect_point_with_item_recursive(Geom::PathVector &conn_pv, SPItem *item, const Geom::Affine &item_transform, double &intersect_pos)
void sp_conn_redraw_path(SPPath *const path)
static SPObject const * get_nearest_common_ancestor(SPObject const *const obj, SPItem const *const objs[2])
TODO: insert short description here.
Geom::Affine i2anc_affine(SPObject const *object, SPObject const *ancestor)