22#include <glibmm/i18n.h>
46namespace LivePathEffect {
52 ~KnotHolderEntityWidthBendPath()
override
55 lpe->_knotholder =
nullptr;
65 bend_path(_(
"Bend path:"), _(
"Path along which to bend the original path"),
"bendpath", &wr, this,
"M0,0 L1,0"),
67 prop_scale(_(
"_Width:"), _(
"Width of the path"),
"prop_scale", &wr, this, 1.0),
68 scale_y_rel(_(
"W_idth in units of length"), _(
"Scale the width of the path in units of its length"),
"scale_y_rel", &wr, this, false),
69 vertical_pattern(_(
"_Original path is vertical"), _(
"Rotates the original 90 degrees, before bending it along the bend path"),
"vertical", &wr, this, false),
70 hide_knot(_(
"Hide width knot"), _(
"Hide width knot"),
"hide_knot", &wr, this, false)
131 if (SP_ACTIVE_DESKTOP) {
132 selection = SP_ACTIVE_DESKTOP->getSelection();
156 using namespace Geom;
183 x-= bboxHorizontal.
min() + 0.1;
184 y-= bboxVertical.
middle();
188 if (scaling != 1.0) {
233 _(
"Change the width"));
250 Geom::Point const s = snap_knot_position(p, state);
258 ray.setPoints(ptA, (*cubic)[1]);
260 ray.setAngle(ray.angle() + Geom::rad_from_deg(90));
262 Geom::Coord nearest_to_ray = ray.nearestTime(knot_pos);
263 if(nearest_to_ray == 0){
278KnotHolderEntityWidthBendPath::knot_get()
const
280 LPEBendPath *lpe =
dynamic_cast<LPEBendPath *
> (_effect);
291 ray.setPoints(ptA, (*cubic)[1]);
293 ray.setAngle(ray.angle() + Geom::rad_from_deg(90));
295 lpe->helper_path.clear();
296 if (!lpe->hide_knot) {
299 lpe->helper_path.push_back(hp);
3x3 matrix representing an affine transformation.
Affine inverse() const
Compute the inverse matrix.
Abstract continuous curve on a plane defined on [0,1].
Adaptor that creates 2D functions from 1D ones.
constexpr C extent() const
constexpr C middle() const
Range of real numbers that is never empty.
void clear()
Remove all paths from the vector.
Path & pathAt(Coord t, Coord *rest=NULL)
Sequence of contiguous curves, aka spline.
Piecewise< D2< SBasis > > toPwSb() const
Point pointAt(Coord t) const
Get the point at the specified time value.
Curve const & curveAt(Coord t, Coord *rest=NULL) const
Get the curve at the specified time value.
void appendNew(Args &&... args)
Append a new curve to the path.
void start(Point const &p)
Function defined as discrete pieces.
std::vector< double > cuts
Two-dimensional point that doubles as a vector.
static Point polar(Coord angle, Coord radius)
Construct a point from its polar coordinates.
Straight ray from a specific point to infinity.
void registerParameter(Parameter *param)
virtual void resetDefaults(SPItem const *item)
Sets all parameters to their default values and writes them to SVG.
bool apply_to_clippath_and_mask
bool _provides_knotholder_entities
bool concatenate_before_pwd2
void original_bbox(SPLPEItem const *lpeitem, bool absolute=false, bool clip_mask=false, Geom::Affine base_transform=Geom::identity())
Geom::Interval boundingbox_Y
Geom::Interval boundingbox_X
friend class BeP::KnotHolderEntityWidthBendPath
void resetDefaults(SPItem const *item) override
Sets all parameters to their default values and writes them to SVG.
LPEBendPath(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::PathVector helper_path
Geom::Piecewise< Geom::D2< Geom::SBasis > > uskeleton
Geom::Piecewise< Geom::D2< Geom::SBasis > > n
void doBeforeEffect(SPLPEItem const *lpeitem) override
Is performed each time before the effect is updated.
bool doOnOpen(SPLPEItem const *lpeitem) override
Is performed on load document or revert If the item is fixed legacy return true.
Geom::Piecewise< Geom::D2< Geom::SBasis > > doEffect_pwd2(Geom::Piecewise< Geom::D2< Geom::SBasis > > const &pwd2_in) override
void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item) override
BoolParam vertical_pattern
void addCanvasIndicators(SPLPEItem const *, std::vector< Geom::PathVector > &hp_vec) override
Add possible canvas indicators (i.e., helperpaths other than the original path) to hp_vec This functi...
Geom::PathVector const & get_pathvector() const
Geom::Piecewise< Geom::D2< Geom::SBasis > > const & get_pwd2()
void set_new_value(Geom::PathVector const &newpath, bool write_to_svg)
void param_transform_multiply(Geom::Affine const &postmul, bool set) override
Geom::Affine get_relative_affine()
void param_set_digits(unsigned digits)
void param_set_increments(double step, double page)
void param_set_value(double val)
Preference storage class.
static Preferences * get()
Access the singleton Preferences object.
void setDouble(Glib::ustring const &pref_path, double value)
Set a floating point value.
The set of selected SPObjects for a given document and layer model.
bool includes(XML::Node *repr, bool anyAncestor=false)
Returns true if the given item is selected.
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)
virtual void update_knot()
std::list< KnotHolderEntity * > entity
void add(KnotHolderEntity *e)
Inkscape::LivePathEffect::Effect * _effect
Base class for visual SVG elements.
Geom::Affine i2dt_affine() const
Returns the transformation from item to desktop coords.
void hide()
Hide knot on its canvas.
bool pathEffectsEnabled() const
bool optimizeTransforms()
returns false when LPE write unoptimiced
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
double Coord
Floating point type used to store coordinates.
Various utility functions.
D2< Piecewise< SBasis > > make_cuts_independent(Piecewise< D2< SBasis > > const &a)
Angle distance(Angle const &a, Angle const &b)
D2< T > compose(D2< T > const &a, T const &b)
Bezier derivative(Bezier const &a)
Piecewise< D2< SBasis > > arc_length_parametrization(D2< SBasis > const &M, unsigned order=3, double tol=.01)
Piecewise< D2< SBasis > > force_continuity(Piecewise< D2< SBasis > > const &f, double tol=0, bool closed=false)
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
D2< T > rot90(D2< T > const &a)
Helper class to stream background task notifications as a series of messages.
@ CANVAS_ITEM_CTRL_TYPE_LPE
Singleton class to access the preferences file in a convenient way.
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.
Generalized time value in the path vector.