nodepath.h revision b2b2d102f63f1f7eeb8353146d0b2bc75938acbc
#ifndef __SP_NODEPATH_H__
#define __SP_NODEPATH_H__
/** \file
* Path handler in node edit mode
*/
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* This code is in public domain
*/
//#include "knot.h"
//#include "sp-path.h"
//#include "desktop-handles.h"
#include "libnr/nr-path-code.h"
#include <gdk/gdkevents.h>
#include <list>
struct SPCanvasItem;
struct SPItem;
}
}
}
/**
* Radial objects are represented by an angle and a distance from
* 0,0. 0,0 is represented by a == big_num.
*/
/** Radius */
double r;
/** Amplitude */
double a;
Radial() {}
// Radial(NR::Point const &p); // Convert a point to radial coordinates
// operator NR::Point() const;
/**
* Construct Radial from NR::Point.
*/
{
if (r > 0) {
} else {
a = HUGE_VAL; //undefined
}
}
/**
* Cast Radial to cartesian NR::Point.
*/
{
if (a == HUGE_VAL) {
} else {
}
}
};
/**
* The entire nodepath, containing multiple subpaths
*/
/**
* A subpath is a continuous chain of linked nodes
*/
/**
* One side of a node, i.e. prev or next
*/
/**
* A node on a subpath
*/
/**
* This is the lowest list item, a simple list of nodes.
*/
/** The parent of this subpath */
/** Is this path closed (no endpoints) or not?*/
/** The nodes in this subpath. */
/** The last node of the subpath */
};
/**
* What kind of node is this? This is the value for the node->type
* field. NodeType indicates the degree of continuity required for
* the node. I think that the corresponding integer indicates which
* derivate is connected. (Thus 2 means that the node is continuous
* to the second derivative, i.e. has matching endpoints and tangents)
*/
typedef enum {
/** A normal node */
/** This node non-continuously joins two segments.*/
/** This node continuously joins two segments. */
/** This node is symmetric. */
} NodeType;
/**
* A NodeSide is a datarecord which may be on either side (n or p) of a node,
* which describes the segment going to the next node.
*/
/** Pointer to the next node, */
/** Position */
/** Origin (while dragging) in radial notation */
/** Origin (while dragging) in x/y notation */
/** Knots are Inkscape's way of providing draggable points. This
* Knot is the point on the curve representing the control point in a
* bezier curve.*/
/** What kind of rendering? */
SPCanvasItem * line;
};
/**
* A node along a NodePath
*/
/** The parent subpath of this node */
/** Type is selected from NodeType.*/
/** Code refers to which ArtCode is used to represent the segment
* (which segment?).*/
/** Boolean. Am I currently selected or not? */
/** */
/** */
/** Knots are Inkscape's way of providing draggable points. This
* Knot is the point on the curve representing the endpoint.*/
/** The NodeSide in the 'next' direction */
NodeSide n;
/** The NodeSide in the 'previous' direction */
NodeSide p;
/** The pointer to the nodeside which we are dragging out with Shift */
/** Boolean. Am I being dragged? */
};
/**
* This is a collection of subpaths which contain nodes
*
* In the following data model. Nodepaths are made up of subpaths which
* are comprised of nodes.
*
* Nodes are linked thus:
* \verbatim
n other
node -----> nodeside ------> node \endverbatim
*/
/** Pointer to the current desktop, for reporting purposes */
/** The parent path of this nodepath */
/** The parent livepatheffect of this nodepath, if applicable */
/** The context which created this nodepath. Important if this nodepath is deleted */
/** The subpaths which comprise this NodePath */
/** A list of nodes which are currently selected */
/** Transforms (userspace <---> virtual space? someone please describe )
njh: I'd be guessing that these are item <-> desktop transforms.*/
/** The DOM node which describes this NodePath */
//STL compliant method to get the selected nodes
/// draw a "sketch" of the path by using these variables
bool show_helperpath;
// the helperpaths provided by all LPEs (and their paramaters) of the current item
/// true if we changed repr, to tell this change from an external one such as from undo, simplify, or another desktop
unsigned int local_change;
/// true if we're showing selected nodes' handles
bool show_handles;
/// true if the path cannot contain curves, just straight lines
bool straight_path;
/// active_node points to the node that is currently mouseovered (= NULL if
/// there isn't any); we also consider the node mouseovered if it is covered
/// by one of its handles and the latter is mouseovered
static Node *active_node;
};
} // namespace NodePath
} // namespace Inkscape
enum {
};
// Do function documentation in nodepath.cpp
Inkscape::NodePath::Path * sp_nodepath_new (SPDesktop * desktop, SPObject *object, bool show_handles, const char * repr_key = NULL, SPItem *item = NULL);
void sp_nodepath_select_rect (Inkscape::NodePath::Path * nodepath, NR::Rect const &b, gboolean incremental);
void sp_nodepath_select_segment_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p, bool toggle);
/* possibly private functions */
void sp_node_selected_set_type (Inkscape::NodePath::Path *nodepath, Inkscape::NodePath::NodeType type);
void sp_node_selected_move_absolute (Inkscape::NodePath::Path *nodepath, NR::Coord val, NR::Dim2 axis);
NR::Maybe<NR::Coord> sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis);
//SPCanvasItem *sp_nodepath_generate_helperpath(SPDesktop *desktop, SPCurve *curve, const SPItem *item, guint32 color);
//SPCanvasItem *sp_nodepath_generate_helperpath(SPDesktop *desktop, SPPath *path);
void sp_nodepath_selected_nodes_rotate (Inkscape::NodePath::Path * nodepath, gdouble angle, int which, bool screen);
void sp_nodepath_selected_nodes_scale (Inkscape::NodePath::Path * nodepath, gdouble grow, int which);
void sp_nodepath_selected_nodes_scale_screen (Inkscape::NodePath::Path * nodepath, gdouble grow, int which);
void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, NR::Maybe<NR::Point> center);
#endif