53 , _transformed_connection()
78 if (value && (strcmp(value,
"true") == 0)) {
111 if (poly.
size() > 0) {
116 g_assert(
id !=
nullptr);
119 GQuark itemID = g_quark_from_string(
id);
134 std::vector<SPItem *> list;
140 for (
auto const shape: shapes) {
141 auto const connId = g_quark_to_string(shape);
143 if (obj ==
nullptr) {
144 g_warning(
"getAttachedShapes: Object with id=\"%s\" is not "
145 "found. Skipping.", connId);
148 auto shapeItem = cast<SPItem>(obj);
149 list.push_back(shapeItem);
157 std::vector<SPItem *> list;
163 for (
auto const conn: conns) {
164 auto const connId = g_quark_to_string(conn);
166 if (obj ==
nullptr) {
167 g_warning(
"getAttachedConnectors: Object with id=\"%s\" is not "
168 "found. Skipping.", connId);
171 auto connItem = cast<SPItem>(obj);
172 list.push_back(connItem);
183 return (bbox) ? bbox->midpoint() :
Geom::Point(0, 0);
189 constexpr unsigned NUM_SEGS = 4;
192 std::vector<Geom::Point> poly_points;
196 double seg_size = 1.0 / NUM_SEGS;
200 while (pit != curve_pv.
end())
203 while (cit != pit->end())
205 if (cit == pit->begin())
207 poly_points.push_back(cit->initialPoint());
214 poly_points.push_back(cit->pointAt(at));
223 poly_points.push_back(cit->finalPoint());
234 auto item_mutable =
const_cast<SPItem *
>(
item);
236 if (
auto group = cast<SPGroup>(item_mutable)) {
237 std::vector<Geom::Point> poly_points;
239 std::vector<SPItem*> itemlist = group->item_list();
240 for (
auto child_item : itemlist) {
241 std::vector<Geom::Point> child_points =
approxItemWithPoints(child_item, item_transform * child_item->transform);
242 poly_points.insert(poly_points.end(), child_points.begin(), child_points.end());
245 }
else if (
auto shape = cast<SPShape>(item_mutable)) {
248 if (shape->curve()) {
249 auto item_pathv = *shape->curve();
251 item_pathv *= item_transform;
272 std::vector<Geom::Point> hull_points;
290 std::size_t
const hull_size =
hull.size();
291 for (std::size_t i = 0; i < hull_size; ++i)
293 if (i + 1 == hull_size) {
309 poly.
ps.push_back(avoid_pt);
312 std::cerr<<
"conn-avoid-ref.cpp: avoid_item_poly: Geom:intersection failed."<<std::endl;
316 g_message(
"conn-avoid-ref.cpp: trying to get crossings of identical lines");
319 prev_parallel_hull_edge = parallel_hull_edge;
329 std::vector<SPItem *> list;
337 if (is<SPItem>(&
child) &&
339 !cast_unsafe<SPItem>(&
child)->isLocked() &&
341 (!initialised || cast<SPItem>(&
child)->getAvoidRef().shapeRef)
344 list.push_back(cast<SPItem>(&
child));
372 DocumentUndo::ScopedInsensitive _no_undo(document);
374 bool initialised =
false;
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.
bool empty(void) const
Returns true if this polygon is empty.
std::vector< Point > ps
A vector of the points that make up the Polygon.
The Router class represents a libavoid router instance.
void deleteShape(ShapeRef *shape)
Delete a shape from the router scene.
void moveShape(ShapeRef *shape, const Polygon &newPoly, const bool first_move=false)
Move or resize an existing shape within the router scene.
void attachedShapes(IntList &shapes, const unsigned int shapeId, const unsigned int type)
void attachedConns(IntList &conns, const unsigned int shapeId, const unsigned int type)
The ShapeRef class represents a shape object.
3x3 matrix representing an affine transformation.
Bezier curve with compile-time specified order.
Convex hull based on the Andrew's monotone chain algorithm.
Infinite line on a plane.
void setOrigin(Point const &p)
Set the point at zero time.
Point origin() const
Get the line's origin point.
void setPoints(Point const &a, Point const &b)
Set a line based on two points it should pass through.
void setVector(Point const &v)
Set the speed of the line.
Point versor() const
Get the line's normalized direction vector.
Axis-aligned rectangle that can be empty.
Sequence::const_iterator const_iterator
Sequence of contiguous curves, aka spline.
Two-dimensional point that doubles as a vector.
constexpr Point ccw() const
Return a point like this point but rotated -90 degrees.
SPGroup * currentRoot() const
Returns current root (=bottom) layer.
bool isLayer(SPObject *object) const
True if object is a layer.
std::vector< SPItem * > getAttachedShapes(const unsigned int type)
Geom::Point getConnectionPointPos()
Avoid::ShapeRef * shapeRef
SPAvoidRef(SPItem *spitem)
void handleSettingChange()
void setAvoid(char const *value)
std::vector< SPItem * > getAttachedConnectors(const unsigned int type)
sigc::connection _transformed_connection
To do: update description of desktop.
SPDocument * getDocument() const
bool itemIsHidden(SPItem const *item) const
SPNamedView * getNamedView() const
Inkscape::LayerManager & layerManager()
Typed SVG document implementation.
Avoid::Router * getRouter() const
SPObject * getObjectById(std::string const &id) const
Base class for visual SVG elements.
Geom::OptRect documentVisualBounds() const
Get item's visual bbox in document coordinate system.
Geom::OptRect documentPreferredBounds() const
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.
char const * getId() const
Returns the objects current ID string.
char const * getAttribute(char const *name) const
static std::vector< Geom::Point > approxItemWithPoints(SPItem const *item, const Geom::Affine &item_transform)
void init_avoided_shape_geometry(SPDesktop *desktop)
static void get_avoided_items_rec(std::vector< SPItem * > &list, SPObject *from, SPDesktop *desktop, bool initialised)
void avoid_item_move(Geom::Affine const *, SPItem *moved_item)
std::vector< SPItem * > get_avoided_items(SPObject *from, SPDesktop *desktop, bool initialised)
static std::vector< Geom::Point > approxCurveWithPoints(Geom::PathVector const &curve_pv)
static Avoid::Polygon avoid_item_poly(SPItem const *item)
A class for handling shape interaction with libavoid.
void avoid_item_move(Geom::Affine const *mp, SPItem *moved_item)
Convex hull data structures.
Editable view implementation.
TODO: insert short description here.
std::list< unsigned int > IntList
std::optional< Crossing > OptCrossing
OptCrossing intersection(Ray const &r1, Line const &l2)
Contains the interface for the Router class.
Contains the interface for the ShapeRef class.
TODO: insert short description here.