Applying tanderson's patch to replace invertY with (1,-1) scaling of SVG itself. Commented out invertY as no longer used.

This commit is contained in:
j-dowsett 2014-01-10 11:31:14 +00:00
parent 270d25658d
commit c1a2348e33
3 changed files with 43 additions and 29 deletions

View File

@ -194,7 +194,7 @@ App::DocumentObjectExecReturn *FeatureViewPart::execute(void)
bool smooth = ShowSmoothLines.getValue();
try {
ProjectionAlgos Alg(ProjectionAlgos::invertY(shape),Dir);
ProjectionAlgos Alg(shape,Dir);
result << "<g"
<< " id=\"" << ViewName << "\"" << endl
<< " transform=\"rotate("<< Rotation.getValue() << ","<< X.getValue()<<","<<Y.getValue()<<") translate("<< X.getValue()<<","<<Y.getValue()<<") scale("<< Scale.getValue()<<","<<Scale.getValue()<<")\"" << endl

View File

@ -100,6 +100,13 @@ ProjectionAlgos::~ProjectionAlgos()
{
}
/*
// no longer used, replaced invertY by adding
// << " transform=\"scale(1,-1)\"" << endl
// to getSVG(...) below.
// invertY, as here, wasn't right for intended purpose - always reflected in model Y direction rather
// than SVG projection Y direction. Also better to reflect about (0,0,0) rather than bbox centre
TopoDS_Shape ProjectionAlgos::invertY(const TopoDS_Shape& shape)
{
// make sure to have the y coordinates inverted
@ -113,6 +120,7 @@ TopoDS_Shape ProjectionAlgos::invertY(const TopoDS_Shape& shape)
BRepBuilderAPI_Transform mkTrf(shape, mat);
return mkTrf.Shape();
}
*/
void ProjectionAlgos::execute(void)
{
@ -162,6 +170,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< " stroke-linejoin=\"miter\"" << endl
<< " stroke-dasharray=\"0.2,0.1\"" << endl
<< " fill=\"none\"" << endl
<< " transform=\"scale(1,-1)\"" << endl
<< " >" << endl
<< output.exportEdges(H)
<< "</g>" << endl;
@ -177,6 +186,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< " stroke-linejoin=\"miter\"" << endl
<< " stroke-dasharray=\"0.02,0.1\"" << endl
<< " fill=\"none\"" << endl
<< " transform=\"scale(1,-1)\"" << endl
<< " >" << endl
<< output.exportEdges(HO)
<< "</g>" << endl;
@ -191,6 +201,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< " stroke-linecap=\"butt\"" << endl
<< " stroke-linejoin=\"miter\"" << endl
<< " fill=\"none\"" << endl
<< " transform=\"scale(1,-1)\"" << endl
<< " >" << endl
<< output.exportEdges(VO)
<< "</g>" << endl;
@ -205,6 +216,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< " stroke-linecap=\"butt\"" << endl
<< " stroke-linejoin=\"miter\"" << endl
<< " fill=\"none\"" << endl
<< " transform=\"scale(1,-1)\"" << endl
<< " >" << endl
<< output.exportEdges(V)
<< "</g>" << endl;
@ -219,6 +231,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< " stroke-linecap=\"butt\"" << endl
<< " stroke-linejoin=\"miter\"" << endl
<< " fill=\"none\"" << endl
<< " transform=\"scale(1,-1)\"" << endl
<< " >" << endl
<< output.exportEdges(V1)
<< "</g>" << endl;
@ -234,6 +247,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< " stroke-linejoin=\"miter\"" << endl
<< " stroke-dasharray=\"0.09,0.05\"" << endl
<< " fill=\"none\"" << endl
<< " transform=\"scale(1,-1)\"" << endl
<< " >" << endl
<< output.exportEdges(H1)
<< "</g>" << endl;

View File

@ -43,7 +43,7 @@ public:
virtual ~ProjectionAlgos();
void execute(void);
static TopoDS_Shape invertY(const TopoDS_Shape&);
// static TopoDS_Shape invertY(const TopoDS_Shape&);
enum ExtractionType {
Plain = 0,