summaryrefslogtreecommitdiffstats
path: root/src/livarot/PathCutting.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-06-29 12:37:25 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-06-29 12:37:25 +0000
commit67c0acdc560a8efe9d7a0aa4d4e38cf4dfb03630 (patch)
tree2e1f1b68d890b972e362b2e341083fba2d82a3a9 /src/livarot/PathCutting.cpp
parentrecognize HLineSegment and VLineSegment in feeding paths to cairo (diff)
downloadinkscape-67c0acdc560a8efe9d7a0aa4d4e38cf4dfb03630.tar.gz
inkscape-67c0acdc560a8efe9d7a0aa4d4e38cf4dfb03630.zip
recognize HLineSegment and VLineSegment while looping through curves
(bzr r6087)
Diffstat (limited to '')
-rw-r--r--src/livarot/PathCutting.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp
index 2987536c3..718017851 100644
--- a/src/livarot/PathCutting.cpp
+++ b/src/livarot/PathCutting.cpp
@@ -16,7 +16,7 @@
#include <cstring>
#include <string>
#include <cstdio>
-
+#include <typeinfo>
#include "Path.h"
#include "style.h"
#include "livarot/path-description.h"
@@ -409,34 +409,37 @@ void* Path::MakeArtBPath(void)
return bpath;
}
-void Path::AddCurve(Geom::Curve const *c)
+void Path::AddCurve(Geom::Curve const &c)
{
- if(Geom::LineSegment const *line_segment = dynamic_cast<Geom::LineSegment const *>(c)) {
- LineTo( NR::Point((*line_segment)[1][0], (*line_segment)[1][1]) );
+ if( typeid(c) == typeid(Geom::LineSegment) ||
+ typeid(c) == typeid(Geom::HLineSegment) ||
+ typeid(c) == typeid(Geom::VLineSegment) )
+ {
+ LineTo( to_2geom(c.finalPoint()) );
}
/*
else if(Geom::QuadraticBezier const *quadratic_bezier = dynamic_cast<Geom::QuadraticBezier const *>(c)) {
...
}
*/
- else if(Geom::CubicBezier const *cubic_bezier = dynamic_cast<Geom::CubicBezier const *>(c)) {
+ else if(Geom::CubicBezier const *cubic_bezier = dynamic_cast<Geom::CubicBezier const *>(&c)) {
Geom::Point tmp = (*cubic_bezier)[3];
Geom::Point tms = 3 * ((*cubic_bezier)[1] - (*cubic_bezier)[0]);
Geom::Point tme = 3 * ((*cubic_bezier)[3] - (*cubic_bezier)[2]);
CubicTo (from_2geom(tmp), from_2geom(tms), from_2geom(tme));
}
- else if(Geom::EllipticalArc const *svg_elliptical_arc = dynamic_cast<Geom::EllipticalArc const *>(c)) {
+ else if(Geom::EllipticalArc const *svg_elliptical_arc = dynamic_cast<Geom::EllipticalArc const *>(&c)) {
ArcTo( from_2geom(svg_elliptical_arc->finalPoint()),
svg_elliptical_arc->ray(0), svg_elliptical_arc->ray(1),
svg_elliptical_arc->rotation_angle(),
svg_elliptical_arc->large_arc_flag(), svg_elliptical_arc->sweep_flag() );
} else {
//this case handles sbasis as well as all other curve types
- Geom::Path sbasis_path = Geom::path_from_sbasis(c->toSBasis(), 0.1);
+ Geom::Path sbasis_path = Geom::path_from_sbasis(c.toSBasis(), 0.1);
//recurse to convert the new path resulting from the sbasis to svgd
for(Geom::Path::iterator iter = sbasis_path.begin(); iter != sbasis_path.end(); ++iter) {
- AddCurve(&*iter);
+ AddCurve(*iter);
}
}
}
@@ -459,7 +462,7 @@ void Path::LoadPath(Geom::Path const &path, Geom::Matrix const &tr, bool doTran
MoveTo( from_2geom(pathtr.initialPoint()) );
for(Geom::Path::const_iterator cit = pathtr.begin(); cit != pathtr.end_open(); ++cit) {
- AddCurve(&*cit);
+ AddCurve(*cit);
}
if (pathtr.closed()) {