Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
lpe-knot.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
5/* Authors:
6 * Jean-Francois Barraud <jf.barraud@gmail.com>
7 * Johan Engelen <j.b.c.engelen@alumnus.utwente.nl>
8 *
9 * Copyright (C) Authors 2007-2012
10 *
11 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
12 */
13
14#ifndef INKSCAPE_LPE_KNOT_H
15#define INKSCAPE_LPE_KNOT_H
16
17
18#include "live_effects/effect.h"
23//#include "live_effects/parameter/path.h"
25#include <2geom/crossing.h>
26
27class SPLPEItem;
28
29namespace Inkscape {
30namespace LivePathEffect {
31
32class KnotHolderEntityCrossingSwitcher;
33
34// CrossingPoint, CrossingPoints:
35// "point oriented" storage of crossing data (needed to find crossing nearest to a click, etc...)
36//TODO: evaluate how lpeknot-specific that is? Should something like this exist in 2geom?
37namespace LPEKnotNS {//just in case...
40 int sign; //+/-1 = positive or neg crossing, 0 = flat.
41 unsigned i, j; //paths components meeting in this point.
42 unsigned ni, nj; //this crossing is the ni-th along i, nj-th along j.
43 double ti, tj; //time along paths.
44};
45
46class CrossingPoints : public std::vector<CrossingPoint>{
47public:
49 CrossingPoints(Geom::CrossingSet const &cs, Geom::PathVector const &path);//for self crossings only!
51 CrossingPoints(std::vector<double> const &input);
52 std::vector<double> to_vector();
53 CrossingPoint get(unsigned const i, unsigned const ni);
54 void inherit_signs(CrossingPoints const &from_other, int default_value = 1);
55};
56}
57
59public:
60 LPEKnot(LivePathEffectObject *lpeobject);
61 ~LPEKnot() override;
62
63 void doBeforeEffect (SPLPEItem const* lpeitem) override;
64 Geom::PathVector doEffect_path (Geom::PathVector const & input_path) override;
65
66 /* the knotholder entity classes must be declared friends */
68 void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) override;
69
70protected:
71 void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec) override;
72 Geom::PathVector supplied_path; //for knotholder business
73
74private:
75 void updateSwitcher();
76
81 // "add_stroke_width" and "add_other_stroke_width" parameters are not used since Inkscape 1.0,
82 // but changed from bool to hidden parameter to retain backward compatibility and dont show in the UI
86 ArrayParam<double> crossing_points_vector;//svg storage of crossing_points
87
88 LPEKnotNS::CrossingPoints crossing_points;//topology representation of the knot.
89
90 Geom::PathVector gpaths;//the collection of all the paths in the object or group.
91 std::vector<double> gstroke_widths;//the collection of all the stroke widths in the object or group.
92
93 //UI: please, someone, help me to improve this!!
94 unsigned selectedCrossing;//the selected crossing
95 Geom::Point switcher;//where to put the "switcher" helper
96
97 LPEKnot(const LPEKnot&) = delete;
98 LPEKnot& operator=(const LPEKnot&) = delete;
99
100};
101
102} //namespace LivePathEffect
103} //namespace Inkscape
104
105#endif
Sequence of subpaths.
Definition pathvector.h:122
Two-dimensional point that doubles as a vector.
Definition point.h:66
void inherit_signs(CrossingPoints const &from_other, int default_value=1)
Definition lpe-knot.cpp:305
CrossingPoint get(unsigned const i, unsigned const ni)
Definition lpe-knot.cpp:273
CrossingPoints(Geom::CrossingSet const &cs, Geom::PathVector const &path)
Geom::PathVector supplied_path
Definition lpe-knot.h:72
friend class KnotHolderEntityCrossingSwitcher
Definition lpe-knot.h:67
LPEKnotNS::CrossingPoints crossing_points
Definition lpe-knot.h:88
LPEKnot & operator=(const LPEKnot &)=delete
void doBeforeEffect(SPLPEItem const *lpeitem) override
Is performed each time before the effect is updated.
Definition lpe-knot.cpp:567
void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) override
Definition lpe-knot.cpp:653
void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector< Geom::PathVector > &hp_vec) override
Add possible canvas indicators (i.e., helperpaths other than the original path) to hp_vec This functi...
Definition lpe-knot.cpp:632
ArrayParam< double > crossing_points_vector
Definition lpe-knot.h:86
std::vector< double > gstroke_widths
Definition lpe-knot.h:91
LPEKnot(const LPEKnot &)=delete
Geom::PathVector doEffect_path(Geom::PathVector const &input_path) override
Definition lpe-knot.cpp:401
Base class for visual SVG elements.
Definition sp-item.h:109
Structure representing the intersection of two curves.
SPItem * item
vector< vector< Point > > paths
Definition metro.cpp:36
std::vector< Crossings > CrossingSet
Definition crossing.h:128
Helper class to stream background task notifications as a series of messages.
STL namespace.