Approx other curve types in SVG, hollow circles

This commit is contained in:
Thomas Krijnen
2017-11-25 13:08:34 +01:00
parent ce970792ba
commit cfd2b368f1
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -39,6 +39,9 @@
#include <ShapeAnalysis_FreeBounds.hxx> #include <ShapeAnalysis_FreeBounds.hxx>
#include <TopTools_HSequenceOfShape.hxx> #include <TopTools_HSequenceOfShape.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <Geom_Line.hxx> #include <Geom_Line.hxx>
#include <Geom_Circle.hxx> #include <Geom_Circle.hxx>
@@ -217,6 +220,19 @@ void SvgSerializer::write(path_object& p, const TopoDS_Wire& wire) {
xcoords.push_back(path.add(p2.X())); xcoords.push_back(path.add(p2.X()));
path.add(","); path.add(",");
ycoords.push_back(path.add(p2.Y())); ycoords.push_back(path.add(p2.Y()));
} else if (ty != STANDARD_TYPE(Geom_Line)) {
BRepAdaptor_Curve crv(edge);
GCPnts_QuasiUniformDeflection tessellater(crv, settings().deflection_tolerance());
// NB: Start at 2: 1-based and skip the first point, assume it coincides with p1.
for (int i = 2; i <= tessellater.NbPoints(); ++i) {
gp_Pnt p = tessellater.Value(i);
path.add(" L");
xcoords.push_back(path.add(p.X()));
path.add(",");
ycoords.push_back(path.add(p.Y()));
growBoundingBox(p.X(), p.Y());
}
} else { } else {
// Either a Geom_Line or something unimplemented, // Either a Geom_Line or something unimplemented,
// drawn as a straight line segment. // drawn as a straight line segment.
+2 -2
View File
@@ -60,7 +60,7 @@ DATA;
#53=IFCCARTESIANPOINT((0.,0.)); #53=IFCCARTESIANPOINT((0.,0.));
#54=IFCDIRECTION((1.,0.)); #54=IFCDIRECTION((1.,0.));
#55=IFCAXIS2PLACEMENT2D(#53,#54); #55=IFCAXIS2PLACEMENT2D(#53,#54);
#56=IFCCIRCLEPROFILEDEF(.AREA.,'Circle',#55,0.5); #56=IFCCIRCLEHOLLOWPROFILEDEF(.AREA.,'Circle',#55,0.5,0.1);
#57=IFCCARTESIANPOINT((0.,2.,0.)); #57=IFCCARTESIANPOINT((0.,2.,0.));
#58=IFCAXIS2PLACEMENT3D(#57,$,$); #58=IFCAXIS2PLACEMENT3D(#57,$,$);
#59=IFCDIRECTION((0.,0.,1.)); #59=IFCDIRECTION((0.,0.,1.));
@@ -76,7 +76,7 @@ DATA;
#69=IFCCARTESIANPOINT((0.,0.)); #69=IFCCARTESIANPOINT((0.,0.));
#70=IFCDIRECTION((1.,0.)); #70=IFCDIRECTION((1.,0.));
#71=IFCAXIS2PLACEMENT2D(#69,#70); #71=IFCAXIS2PLACEMENT2D(#69,#70);
#72=IFCCIRCLEPROFILEDEF(.AREA.,'Circle',#71,0.5); #72=IFCCIRCLEHOLLOWPROFILEDEF(.AREA.,'Circle',#71,0.5,0.1);
#73=IFCCARTESIANPOINT((2.,0.,0.)); #73=IFCCARTESIANPOINT((2.,0.,0.));
#74=IFCAXIS2PLACEMENT3D(#73,$,$); #74=IFCAXIS2PLACEMENT3D(#73,$,$);
#75=IFCDIRECTION((0.,0.,1.)); #75=IFCDIRECTION((0.,0.,1.));