13#ifndef INKSCAPE_UI_TOOL_NODE_H
14#define INKSCAPE_UI_TOOL_NODE_H
22#include <boost/noncopyable.hpp>
35class MultiPathManipulator;
41template <
typename>
class NodeIterator;
67 inline double length()
const;
286 :
public boost::bidirectional_iterator_helper<NodeIterator<N>, N, std::ptrdiff_t, N*, N&>
305 inline operator bool()
const;
391 template <
class InputIterator>
393 for (; first != last; ++first)
insert(pos, *first);
408 while (first != last) ret =
erase(first++);
486 return _node &&
static_cast<ListNode*
>(_node->ln_list) != _node;
491 if (G_UNLIKELY(!*
this) && _node->ln_list->closed()) ++(*this);
497 if (G_UNLIKELY(!*
this) && _node->ln_list->closed()) --(*this);
305 inline operator bool()
const; {
…}
Cartesian point / 2D vector and related operations.
std::unique_ptr< T, CanvasItemUnlinkDeleter > CanvasItemPtr
Smart pointer used to hold CanvasItems, like std::unique_ptr.
3x3 matrix representing an affine transformation.
Two-dimensional point that doubles as a vector.
Coord length() const
Compute the distance from origin.
Axis aligned, non-empty rectangle.
Class to store data for points which are snap candidates, either as a source or as a target.
Group of selected control points.
Draggable point, the workhorse of on-canvas editing.
Geom::Point const & position() const
Current position of the control point.
State
Enumeration representing the possible states of the control point, used to determine its appearance.
Geom::Point relativePos() const
bool _hasDragTips() const override
bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, CanvasEvent const &event) override
bool clicked(ButtonReleaseEvent const &event) override
Called when the control point is clicked, at mouse button release.
void _update_bspline_handles()
void setDirection(Geom::Point const &from, Geom::Point const &to)
void setRelativePos(Geom::Point const &p)
static double _saved_length
static Geom::Point _saved_dir
Glib::ustring _getDragTip(MotionEvent const &event) const override
static Geom::Point _saved_other_pos
Control point of a cubic Bezier curve in a path.
bool isDegenerate() const
virtual void handle_2button_press()
bool grabbed(MotionEvent const &event) override
Called when the user moves the point beyond the drag tolerance with the first button held down.
void ungrabbed(ButtonReleaseEvent const *event) override
Called when the control point finishes a drag.
void dragged(Geom::Point &new_pos, MotionEvent const &event) override
Called while dragging, but before moving the knot to new position.
void setVisible(bool) override
Set the visibility of the control point.
void setLength(double len)
void setPosition(Geom::Point const &p) override
Relocate the control point without side effects.
Glib::ustring _getTip(unsigned state) const override
static char const * handle_type_to_localized_string(NodeType type)
See also: Node::node_type_to_localized_string(NodeType type)
void move(Geom::Point const &p) override
Move the control point to new position with side effects.
CanvasItemPtr< CanvasItemCurve > _handle_line
Iterator for editable nodes.
NodeIterator(ListNode const *n)
N * get_pointer() const
Get a pointer to the underlying node. Equivalent to &*i.
bool operator==(self const &other) const
const_iterator before(Geom::PathTime const &pvp) const
NodeIterator< value_type > iterator
static const_iterator get_iterator(Node const *n)
Node const * const_pointer
static NodeList & get(Node *n)
NodeIterator< value_type const > const_iterator
const_iterator begin() const
iterator erase(iterator first, iterator last)
iterator insert(iterator pos, Node *x)
insert a node before pos.
static iterator get_iterator(Node *n)
bool degenerate() const
A subpath is degenerate if it has no segments - either one node in an open path or no nodes in a clos...
const_iterator before(double t, double *fracpart=nullptr) const
SubpathList const & subpathList() const
const_iterator end() const
void insert(iterator pos, InputIterator first, InputIterator last)
void splice(iterator pos, NodeList &list)
SubpathList & subpathList()
Node const & const_reference
iterator before(double t, double *fracpart=nullptr)
iterator erase(iterator pos)
Node * nodeAwayFrom(Handle *h)
Gets the node in the direction opposite to the given handle.
static NodeType parse_nodetype(char x)
Node * nodeToward(Handle *h)
Gets the node in the direction of the given handle.
Handle * handleAwayFrom(Node *to)
Gets the handle that goes in the direction opposite to the given adjacent node.
Glib::ustring _getTip(unsigned state) const override
void fixNeighbors() override
Affine transforms keep handle invariants for smooth and symmetric nodes, but smooth nodes at ends of ...
Glib::ustring _getDragTip(MotionEvent const &event) const override
void _linearGrow(int dir)
Select or deselect a node in this node's subpath based on its path distance from this node.
void move(Geom::Point const &p) override
Move the control point to new position with side effects.
Geom::Rect bounds() const override
bool _eventHandler(Inkscape::UI::Tools::ToolBase *event_context, CanvasEvent const &event) override
Customized event handler to catch scroll events needed for selection grow/shrink.
bool clicked(ButtonReleaseEvent const &event) override
Called when the control point is clicked, at mouse button release.
void setType(NodeType type, bool update_handles=true)
Sets the node type and optionally restores the invariants associated with the given type.
static bool _is_line_segment(Node *first, Node *second)
Determine whether two nodes are joined by a linear segment.
Node(Node const &)=delete
bool isDegenerate() const
std::optional< Geom::Point > _unfixed_pos
bool grabbed(MotionEvent const &event) override
Called when the user moves the point beyond the drag tolerance with the first button held down.
void dragged(Geom::Point &new_pos, MotionEvent const &event) override
Called while dragging, but before moving the knot to new position.
Handle _front
Node handle in the backward direction of the path.
void sink()
Move the node to the bottom of its canvas group.
static char const * node_type_to_localized_string(NodeType type)
See also: Handle::handle_type_to_localized_string(NodeType type)
Handle _back
Node handle in the forward direction of the path.
void pickBestType()
Pick the best type for this node, based on the position of its handles.
NodeType _type
Type of node - cusp, smooth...
void _updateAutoHandles()
Inkscape::SnapTargetType _snapTargetType() const
void transform(Geom::Affine const &m) override
Apply an arbitrary affine transformation to a control point.
bool _hasDragTips() const override
Handle * handleToward(Node *to)
Gets the handle that faces the given adjacent node.
void _setState(State state) override
Change the state of the knot.
NodeList & nodeList() const
Inkscape::SnapCandidatePoint snapCandidatePoint()
Inkscape::SnapSourceType _snapSourceType() const
Manipulator that edits a single path using nodes with handles.
Desktop-bound selectable control object.
SubpathList(PathManipulator &pm)
std::list< std::shared_ptr< NodeList > > list_type
PathManipulator & _path_manipulator
PathManipulator const & pm() const
To do: update description of desktop.
std::ostream & operator<<(std::ostream &os, const Bezier &b)
NodeType
Types of nodes supported in the node tool.
Helper class to stream background task notifications as a series of messages.
SnapSourceType
enumerations of snap source types and snap target types.
Node types and other small enums.
Some utility classes to store various kinds of snap candidates.
Generalized time value in the path.
Abstract base class for events.
Movement of the mouse pointer.
Inkscape::CanvasItemGroup * node_group
Inkscape::CanvasItemGroup * handle_group
Inkscape::CanvasItemGroup * handle_line_group
ControlPointSelection * selection