/*
5 * Authors: see git history
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
15#include <glibmm/i18n.h>
32static std::unique_ptr<Shape>
shape_union(std::unique_ptr<Shape> base_shape, std::unique_ptr<Shape> add_shape);
55 unsigned childflags = flags;
56 if (flags & SP_OBJECT_MODIFIED_FLAG) {
57 childflags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
59 childflags &= SP_OBJECT_MODIFIED_CASCADE;
61 std::vector<SPObject*>l;
69 g_assert(
child !=
nullptr);
72 if (childflags || (
child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
77 child->updateDisplay((
SPCtx *)&cctx, childflags);
79 child->updateDisplay(ctx, childflags);
102 if (flags & SP_OBJECT_MODIFIED_FLAG) {
103 flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
106 flags &= SP_OBJECT_MODIFIED_CASCADE;
108 std::vector<SPObject *>l;
116 g_assert(
child !=
nullptr);
118 if (flags || (
child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
119 child->emitModified(flags);
127 if (flags & SP_OBJECT_WRITE_BUILD) {
128 if (
repr ==
nullptr ) {
132 std::vector<Inkscape::XML::Node *> l;
134 if (!is<SPTitle>(&
child) && !is<SPDesc>(&
child)) {
143 for (
auto i = l.rbegin(); i != l.rend(); ++i) {
149 if (!is<SPTitle>(&
child) && !is<SPDesc>(&
child)) {
150 child.updateRepr(flags);
168 return _(
"Flow Region");
192 if (flags & SP_OBJECT_MODIFIED_FLAG) {
193 flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
196 flags &= SP_OBJECT_MODIFIED_CASCADE;
198 std::vector<SPObject *> l;
206 g_assert(
child !=
nullptr);
208 if (flags || (
child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
216 child->updateDisplay(ctx, flags);
237 if (flags & SP_OBJECT_MODIFIED_FLAG) {
238 flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
241 flags &= SP_OBJECT_MODIFIED_CASCADE;
243 std::vector<SPObject*> l;
251 g_assert(
child !=
nullptr);
253 if (flags || (
child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
254 child->emitModified(flags);
262 if (flags & SP_OBJECT_WRITE_BUILD) {
263 if (
repr ==
nullptr ) {
267 std::vector<Inkscape::XML::Node *> l;
277 for (
auto i = l.rbegin(); i != l.rend(); ++i) {
284 child.updateRepr(flags);
302 return _(
"Flow Excluded Region");
305static std::unique_ptr<Shape>
shape_union(std::unique_ptr<Shape> base_shape, std::unique_ptr<Shape> add_shape)
308 base_shape = std::make_unique<Shape>();
310 if (!base_shape->hasEdges()) {
311 base_shape->Copy(add_shape.get());
312 }
else if (add_shape && add_shape->hasEdges()) {
313 auto temp = std::make_unique<Shape>();
314 temp->Booleen(add_shape.get(), base_shape.get(),
bool_op_union);
315 base_shape = std::move(temp);
323 auto *shape_source =
item;
324 if (
auto use = cast<SPUse>(
item)) {
325 shape_source = use->child;
326 tr_mat = use->getRelativeTransform(
item->
parent);
331 std::optional<Geom::PathVector>
curve;
332 if (
auto shape = cast<SPShape>(shape_source)) {
333 if (!shape->curve()) {
337 }
else if (
auto text = cast<SPText>(shape_source)) {
338 curve = text->getNormalizedBpath();
349 temp.
Fill(&n_shp, 0);
351 auto result = std::make_unique<Shape>();
353 result->ConvertToShape(&n_shp,
TODO: insert short description here.
TODO: insert short description here.
3x3 matrix representing an affine transformation.
Interface for refcounted XML nodes.
virtual void addChild(Node *child, Node *after)=0
Insert another node as a child of this node.
Path and its polyline approximation.
void Fill(Shape *dest, int pathID=-1, bool justAdd=false, bool closeIfNeeded=true, bool invert=false)
Fills the shape with the polyline approximation stored in this object.
void LoadPathVector(Geom::PathVector const &pv, Geom::Affine const &tr, bool doTransformation)
Load a lib2geom Geom::PathVector in this path object.
void Convert(double treshhold)
Creates a polyline approximation of the path.
std::unique_ptr< Shape > _computed
const char * typeName() const override
The item's type name, not node tag name.
const char * displayName() const override
The item's type name as a translated human string.
void remove_child(Inkscape::XML::Node *child) override
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
void update(SPCtx *ctx, unsigned int flags) override
void modified(guint flags) override
void modified(guint flags) override
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
std::vector< std::unique_ptr< Shape > > computed
const char * typeName() const override
The item's type name, not node tag name.
const char * displayName() const override
The item's type name as a translated human string.
void remove_child(Inkscape::XML::Node *child) override
void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override
void update(SPCtx *ctx, unsigned int flags) override
Base class for visual SVG elements.
void update(SPCtx *ctx, unsigned int flags) override
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
Inkscape::XML::Node * repr
void requestModified(unsigned int flags)
Requests that a modification notification signal be emitted later (e.g.
virtual void remove_child(Inkscape::XML::Node *child)
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
virtual void child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
T< SPAttr::FILL_RULE, SPIEnum< SPWindRule > > fill_rule
fill-rule: 0 nonzero, 1 evenodd
A class to store/manipulate directed graphs.
auto ptr_to_opt(T const &p)
Create a std::optional<T> from a (generalised) pointer to T.
static R & release(R &r)
Decrements the reference count of a anchored object.
static std::unique_ptr< Shape > shape_union(std::unique_ptr< Shape > base_shape, std::unique_ptr< Shape > add_shape)
static std::unique_ptr< Shape > extract_shape(SPItem *item)
TODO: insert short description here.
SPObject * sp_object_unref(SPObject *object, SPObject *owner)
Decrease reference count of object, with possible debugging and finalization.
SPObject * sp_object_ref(SPObject *object, SPObject *owner)
Increase reference count of object, with possible debugging.
Interface for XML documents.
virtual Node * createElement(char const *name)=0
Contains transformations to document/viewport and the viewport size.
Geom::Affine i2doc
Item to document transformation.
Geom::Affine i2vp
Item to viewport transformation.
SPStyle - a style object for SPItem objects.
Interface for XML documents.