18 #ifndef _GAZEBO_SVGLOADER_HH_
19 #define _GAZEBO_SVGLOADER_HH_
25 #include <ignition/math/Vector2.hh>
26 #include <ignition/math/Matrix3.hh>
39 class SVGLoaderPrivate;
46 public:
SvgError(
const std::string &_what);
78 std::vector< std::vector<SVGCommand> >
subpaths;
81 std::vector< std::vector<ignition::math::Vector2d> >
polylines;
98 public:
bool Parse(
const std::string &_filename,
99 std::vector<SVGPath> &_paths);
108 public:
static void PathsToClosedPolylines(
109 const std::vector<common::SVGPath> &_paths,
111 std::vector< std::vector<math::Vector2d> > &_closedPolys,
112 std::vector< std::vector<math::Vector2d> > &_openPolys)
120 public:
static void PathsToClosedPolylines(
121 const std::vector<common::SVGPath> &_paths,
123 std::vector< std::vector<ignition::math::Vector2d> > &_closedPolys,
124 std::vector< std::vector<ignition::math::Vector2d> > &_openPolys);
129 public:
void DumpPaths(
const std::vector<SVGPath> &_paths,
130 std::ostream &_out)
const;
135 private:
void GetPathCommands(
const std::vector<std::string> &_tokens,
141 private:
void GetPathAttribs(TiXmlElement *_pElement,
SVGPath &_path);
146 private:
void GetSvgPaths(TiXmlNode *_pParent,
147 std::vector<SVGPath> &_paths);
152 private:
void ExpandCommands(
153 const std::vector< std::vector<SVGCommand> > &_subpaths,
160 private:
void SplitSubpaths(
const std::vector<SVGCommand> &_cmds,
161 std::vector< std::vector<SVGCommand> > &_subpaths);
167 private:
void PathToPoints(
const SVGPath &_path,
169 std::vector< std::vector<ignition::math::Vector2d> > &_polys);
176 private: ignition::math::Vector2d SubpathToPolyline(
177 const std::vector<SVGCommand> &_subpath,
178 ignition::math::Vector2d _last,
179 std::vector<ignition::math::Vector2d> &_polyline);
SVG command data structure.
Definition: SVGLoader.hh:50
Handles errors during SVG parsing.
Definition: SVGLoader.hh:42
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
Definition: SVGLoaderPrivate.hh:33
#define GZ_COMMON_VISIBLE
Definition: system.hh:91
A loader for SVG files.
Definition: SVGLoader.hh:85
std::vector< std::vector< SVGCommand > > subpaths
A list of subpaths (as lists of commands)
Definition: SVGLoader.hh:78
SVGCommand()
Constructor.
Definition: SVGLoader.hh:53
std::vector< double > numbers
Coordinates for the command.
Definition: SVGLoader.hh:62
std::string transform
A 2D transform (or a list of transforms)
Definition: SVGLoader.hh:75
std::string style
The style (i.e. stroke style, color, thickness etc)
Definition: SVGLoader.hh:72
std::vector< std::vector< ignition::math::Vector2d > > polylines
The polylines described by the commands.
Definition: SVGLoader.hh:81
std::string id
An id or name.
Definition: SVGLoader.hh:69
char cmd
A letter that describe the segment.
Definition: SVGLoader.hh:59
An SVG path element data structure.
Definition: SVGLoader.hh:66