From f23037936a1a4bb249a8caf6b5a69e488afc5e35 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 23 Nov 2011 10:01:09 +0000 Subject: [PATCH] + fix ellipse problem in SVG output (j-dowsett) git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5159 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Drawing/App/DrawingExport.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Mod/Drawing/App/DrawingExport.cpp b/src/Mod/Drawing/App/DrawingExport.cpp index 88b3e7ec1f..266dd719ae 100644 --- a/src/Mod/Drawing/App/DrawingExport.cpp +++ b/src/Mod/Drawing/App/DrawingExport.cpp @@ -94,9 +94,9 @@ std::string SVGOutput::exportEdges(const TopoDS_Shape& input) if (adapt.GetType() == GeomAbs_Circle) { printCircle(adapt, result); } - //else if (adapt.GetType() == GeomAbs_Ellipse) { - // printEllipse(adapt, i, result); - //} + else if (adapt.GetType() == GeomAbs_Ellipse) { + printEllipse(adapt, i, result); + } else if (adapt.GetType() == GeomAbs_BSplineCurve) { printBSpline(adapt, i, result); } @@ -159,7 +159,7 @@ void SVGOutput::printEllipse(const BRepAdaptor_Curve& c, int id, std::ostream& o gp_Vec v2(m,e); gp_Vec v3(0,0,1); double a = v3.DotCross(v1,v2); - + // a full ellipse if (fabs(l-f) > 1.0 && s.SquareDistance(e) < 0.001) { out << "(angle); + angle2 = Base::toDegrees(angle2); + char las = (l-f > D_PI) ? '1' : '0'; // large-arc-flag char swp = (a < 0) ? '1' : '0'; // sweep-flag, i.e. clockwise (0) or counter-clockwise (1) + + if (angle2 > 90) { + angle = 180 - angle; + } + out << ""; + << e.X() << " " << e.Y() << "\" />" << endl; } }