homog2d library
|
Private functions related to the SVG import code. More...
Classes | |
struct | SvgPathCommand |
Holds the current SVG "path" command, and the number of required numerical values. More... | |
struct | SvgValuesBuffer |
This will hold the values read from the SVG Path parsing code, before they are converted to points. More... | |
Enumerations | |
enum | PathMode { PathMode::Absolute, PathMode::Relative } |
Functions | |
Point2d_< double > | generateNewPoint (SvgPathCommand mode, Point2d_< double > prevPt, const std::vector< double > &val) |
Generate new point from current mode and previous point, handles absolute/relative coordinates. More... | |
const char * | getAttribString (const char *attribName, const tinyxml2::XMLElement &e) |
Helper function for SVG import. More... | |
double | getAttribValue (const tinyxml2::XMLElement &e, const char *str, std::string e_name) |
Fetch attribute from XML element. Tag e_name is there just in case of trouble. More... | |
SvgPathCommand | getCommand (char c) |
std::pair< Point2d_< HOMOG2D_INUMTYPE >, HOMOG2D_INUMTYPE > | getEllipseRotateAttr (const char *rot_str) |
Importing rotated ellipse from SVG data. More... | |
std::string | getNextElem (const std::string &str, std::string::const_iterator &it) |
Get next element in svg path string. More... | |
std::vector< Point2d > | importSvgPoints (const tinyxml2::XMLElement &e) |
Helper function called by Visitor::VisitExit() to process Polyline/Polygons. More... | |
bool | isDigit (char c) |
std::map< char, int > & | numberValues () |
Returns nb of expected values for a given SVG path command. Ref: https://www.w3.org/TR/SVG2/paths.html. More... | |
auto | parsePath (const char *s) |
Parse a SVG "path" string and convert it to a vector holding a set (vector) of points. More... | |
std::vector< Point2d > | parsePoints (const char *pts) |
Svg import: Basic parsing of points that are in the format "10,20 30,40 50,60". More... | |
template<typename FPT > | |
std::vector< Point2d_< FPT > > | purgeSetDupes (const std::vector< Point2d_< FPT >> &pts) |
Removes dupes in set of points. Needed when importing SVG files using a "path" command, because sometimes they hold duplicates points, and that can't be in polylines. More... | |
bool | svgPathCommandIsAllowed (char c) |
std::vector< std::string > | tokenize (const std::string &s, char delim) |
General string tokenizer, taken from http://stackoverflow.com/a/236803/193789. More... | |
Private functions related to the SVG import code.
|
strong |
|
inline |
Generate new point from current mode and previous point, handles absolute/relative coordinates.
mode | SVG path command |
prevPt | previous point, is needed if relative mode |
val | numerical values that have been stored |
|
inline |
Helper function for SVG import.
|
inline |
Fetch attribute from XML element. Tag e_name
is there just in case of trouble.
|
inline |
|
inline |
Importing rotated ellipse from SVG data.
|
inline |
Get next element in svg path string.
|
inline |
Helper function called by Visitor::VisitExit() to process Polyline/Polygons.
|
inline |
|
inline |
Returns nb of expected values for a given SVG path command. Ref: https://www.w3.org/TR/SVG2/paths.html.
|
inline |
Parse a SVG "path" string and convert it to a vector holding a set (vector) of points.
Input string example:
m 261.68497,138.79393 2.57,3.15 -0.72,1.27 2.18,1.94 -0.7,4.93 1.88,0.9
The return value holds as 'second' a bool value, will be true if closed polyline
|
inline |
Svg import: Basic parsing of points that are in the format "10,20 30,40 50,60".
std::vector<Point2d_<FPT> > h2d::svg::svgp::purgeSetDupes | ( | const std::vector< Point2d_< FPT >> & | pts | ) |
Removes dupes in set of points. Needed when importing SVG files using a "path" command, because sometimes they hold duplicates points, and that can't be in polylines.
|
inline |
|
inline |
General string tokenizer, taken from http://stackoverflow.com/a/236803/193789.