31#include <glibmm/i18n.h>
34namespace LivePathEffect {
40 ~KnotHolderEntityOffsetPoint()
override
73 unit(_(
"Unit"), _(
"Unit of measurement"),
"unit", &wr, this,
"mm"),
74 offset(_(
"Offset:"), _(
"Offset"),
"offset", &wr, this, 0.0),
75 linejoin_type(_(
"Join:"), _(
"Determines the shape of the path's corners"),
"linejoin_type",
JoinTypeConverter, &wr, this,
JOIN_MITER),
76 miter_limit(_(
"Miter limit:"), _(
"Maximum length of the miter join (in units of stroke width)"),
"miter_limit", &wr, this, 4.0),
77 attempt_force_join(_(
"Force miter"), _(
"Overrides the miter limit and forces a join."),
"attempt_force_join", &wr, this, false),
78 update_on_knot_move(_(
"Live update"), _(
"Update while moving handle"),
"update_on_knot_move", &wr, this, true)
112 if (version <
"1.3") {
137 if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG && obj) {
141 if (fr ==
"evenodd") {
153 std::optional< Geom::PathVectorTime > pathvectortime = pathv.
nearestTime(point);
154 if (pathvectortime) {
185 double ret_offset = 0;
188 if (pathvectortime) {
195 if (winding_value % 2 != 0) {
256 out = cast<SPShape>(
sp_lpe_item)->curve()->get_pathvector();
268 if (!
item || !document) {
285 if (fr ==
"evenodd") {
290 double tolerance = -1;
313 if (!prev_mix_pathv_all.
empty()) {
325 "LPEOffset", _(
"Offset point"));
335 using namespace Geom;
337 lpe->
offset_pt = snap_knot_position(p, state);
350 LPEOffset *lpe =
dynamic_cast<LPEOffset *
>(_effect);
352 using namespace Geom;
353 double offset = lpe->sp_get_offset();
354 lpe->offset.param_set_value(
offset);
355 lpe->makeUndoDone(_(
"Move handle"));
358Geom::Point KnotHolderEntityOffsetPoint::knot_get()
const
360 LPEOffset *lpe =
dynamic_cast<LPEOffset *
>(_effect);
364 if (!lpe->update_on_knot_move) {
365 return lpe->offset_pt;
368 lpe->offset_pt = lpe->get_default_point(lpe->pathvector_after_effect);
371 return lpe->offset_pt;
3x3 matrix representing an affine transformation.
Coord descrim() const
Calculate the descriminant.
bool isTranslation(Coord eps=EPSILON) const
Check whether this matrix represents a pure translation.
Affine inverse() const
Compute the inverse matrix.
Axis-aligned rectangle that can be empty.
int winding(Point const &p) const
Determine the winding number at the specified point.
Point pointAt(Coord t) const
OptRect boundsFast() const
void clear()
Remove all paths from the vector.
bool empty() const
Check whether the vector contains any paths.
iterator insert(iterator pos, Path const &p)
std::optional< PathVectorTime > nearestTime(Point const &p, Coord *dist=NULL) const
Sequence of contiguous curves, aka spline.
bool closed() const
Check whether the path is closed.
Point pointAt(Coord t) const
Get the point at the specified time value.
Two-dimensional point that doubles as a vector.
void registerParameter(Parameter *param)
bool apply_to_clippath_and_mask
bool _provides_knotholder_entities
void original_bbox(SPLPEItem const *lpeitem, bool absolute=false, bool clip_mask=false, Geom::Affine base_transform=Geom::identity())
void param_setValue(Glib::ustring newvalue, bool write=false)
Glib::ustring param_getSVGValue() const override
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...
BoolParam update_on_knot_move
void modified(SPObject *, guint flags)
friend class OfS::KnotHolderEntityOffsetPoint
LPEOffset(LivePathEffectObject *lpeobject)
void transform_multiply(Geom::Affine const &postmul, bool set) override
Overridden function to apply transforms for example to powerstroke, jointtype or tapperstroke.
Geom::Point get_default_point(Geom::PathVector pathv)
void doOnApply(SPLPEItem const *lpeitem) override
Is performed a single time when the effect is freshly applied to a path.
Geom::PathVector helper_path
void doAfterEffect(SPLPEItem const *, SPCurve *curve) override
Is performed at the end of the LPE only one time per "lpeitem" in paths/shapes is called in middle of...
void doBeforeEffect(SPLPEItem const *lpeitem) override
Is performed each time before the effect is updated.
sigc::connection modified_connection
Geom::PathVector mix_pathv_all
BoolParam attempt_force_join
Geom::PathVector doEffect_path(Geom::PathVector const &path_in) override
bool doOnOpen(SPLPEItem const *lpeitem) override
Is performed on load document or revert If the item is fixed legacy return true.
EnumParam< unsigned > linejoin_type
void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) override
void param_set_digits(unsigned digits)
void param_transform_multiply(Geom::Affine const &postmul, bool set) override
void param_set_undo(bool set_undo)
void param_set_increments(double step, double page)
void param_set_value(double val)
const gchar * get_abbreviation() const
Simplified management of enumerations of svg items with UI labels.
static double convert(double from_dist, Unit const *from, Unit const *to)
Convert distances.
KnotHolderEntity definition.
void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, Inkscape::CanvasItemCtrlType type=Inkscape::CANVAS_ITEM_CTRL_TYPE_DEFAULT, Glib::ustring const &name="unknown", char const *tip="", uint32_t color=0xffffff00)
std::list< KnotHolderEntity * > entity
void add(KnotHolderEntity *e)
Inkscape::LivePathEffect::Effect * _effect
Wrapper around a Geom::PathVector object.
Typed SVG document implementation.
Base class for visual SVG elements.
Geom::Affine i2doc_affine() const
Returns the accumulated transformation of the item and all its ancestors, including root's viewport.
void updateCtrl()
Update knot's control state.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
sigc::connection connectModified(sigc::slot< void(SPObject *, unsigned int)> slot)
Connects to the modification notification signal.
std::shared_ptr< Css const > css
constexpr Coord infinity()
Get a value representing infinity.
Specific geometry functions for Inkscape, not provided my lib2geom.
LPE <offset> implementation, see lpe-offset.cpp.
Various utility functions.
Angle distance(Angle const &a, Angle const &b)
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
Glib::ustring sp_get_fill_rule(SPObject *obj)
static const Util::EnumDataConverter< unsigned > JoinTypeConverter(JoinTypeData, sizeof(JoinTypeData)/sizeof(*JoinTypeData))
static const Util::EnumData< unsigned > JoinTypeData[]
Geom::Point get_nearest_point(Geom::PathVector pathv, Geom::Point point)
Helper class to stream background task notifications as a series of messages.
static Glib::ustring join(std::vector< Glib::ustring > const &accels, char const separator)
Geom::PathVector do_offset(Geom::PathVector const &path_in, double to_offset, double tolerance, double miter_limit, FillRule fillrule, Inkscape::LineJoinType join, Geom::Point point, Geom::PathVector &helper_path, Geom::PathVector &mix_pathv_all)
Create a user spected offset from a pathvector.
@ CANVAS_ITEM_CTRL_TYPE_LPE
void sp_repr_css_attr_unref(SPCSSAttr *css)
Unreferences an SPCSSAttr (will be garbage collected if no references remain).
SPCSSAttr * sp_repr_css_attr(Node const *repr, gchar const *attr)
Creates a new SPCSSAttr with one attribute (i.e.
char const * sp_repr_css_property(SPCSSAttr *css, gchar const *name, gchar const *defval)
Returns a character string of the value of a given style property or a default value if the attribute...
Geom::Affine sp_item_transform_repr(SPItem *item)
Find out the inverse of previous transform of an item (from its repr)
void sp_lpe_item_update_patheffect(SPLPEItem *lpeitem, bool wholetree, bool write, bool with_satellites)
Calls any registered handlers for the update_patheffect action.
Base class for live path effect items.
Generalized time value in the path.
size_type curve_index
Index of the curve in the path.
Coord t
Time value in the curve.
Simplified management of enumerations of svg items with UI labels.