Skip to content

Commit

Permalink
Drawing: Added property to set hidden line width - fixes #606
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jan 1, 2014
1 parent 2bc15af commit eab159b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/Mod/Drawing/App/FeatureViewPart.cpp
Expand Up @@ -84,7 +84,8 @@ FeatureViewPart::FeatureViewPart(void)
ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"Shape to view");
ADD_PROPERTY_TYPE(ShowHiddenLines ,(false),group,App::Prop_None,"Control the appearance of the dashed hidden lines");
ADD_PROPERTY_TYPE(ShowSmoothLines ,(false),group,App::Prop_None,"Control the appearance of the smooth lines");
ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the resulting lines");
ADD_PROPERTY_TYPE(LineWidth,(0.35),vgroup,App::Prop_None,"The thickness of the viewed lines");
ADD_PROPERTY_TYPE(HiddenWidth,(0.15),vgroup,App::Prop_None,"The thickness of the hidden lines, if enabled");
ADD_PROPERTY_TYPE(Tolerance,(0.05),vgroup,App::Prop_None,"The tessellation tolerance");
Tolerance.setConstraints(&floatRange);
}
Expand Down Expand Up @@ -202,7 +203,7 @@ App::DocumentObjectExecReturn *FeatureViewPart::execute(void)
ProjectionAlgos::ExtractionType type = ProjectionAlgos::Plain;
if (hidden) type = (ProjectionAlgos::ExtractionType)(type|ProjectionAlgos::WithHidden);
if (smooth) type = (ProjectionAlgos::ExtractionType)(type|ProjectionAlgos::WithSmooth);
result << Alg.getSVG(type, this->LineWidth.getValue() / this->Scale.getValue(), this->Tolerance.getValue());
result << Alg.getSVG(type, this->LineWidth.getValue() / this->Scale.getValue(), this->Tolerance.getValue(), this->HiddenWidth.getValue() / this->Scale.getValue());

result << "</g>" << endl;

Expand Down
1 change: 1 addition & 0 deletions src/Mod/Drawing/App/FeatureViewPart.h
Expand Up @@ -53,6 +53,7 @@ class DrawingExport FeatureViewPart : public FeatureView
App::PropertyBool ShowHiddenLines;
App::PropertyBool ShowSmoothLines;
App::PropertyFloat LineWidth;
App::PropertyFloat HiddenWidth;
App::PropertyFloatConstraint Tolerance;


Expand Down
13 changes: 4 additions & 9 deletions src/Mod/Drawing/App/ProjectionAlgos.cpp
Expand Up @@ -146,14 +146,13 @@ void ProjectionAlgos::execute(void)

}

std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double tolerance)
std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double tolerance, double hiddenscale)
{
std::stringstream result;
SVGOutput output;
float hfactor = 0.5f; // hidden line size factor, was 0.15f / 0.35f;

if (!H.IsNull() && (type & WithHidden)) {
double width = hfactor * scale;
double width = hiddenscale;
BRepMesh::Mesh(H,tolerance);
result << "<g"
//<< " id=\"" << ViewName << "\"" << endl
Expand All @@ -168,7 +167,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< "</g>" << endl;
}
if (!HO.IsNull() && (type & WithHidden)) {
double width = hfactor * scale;
double width = hiddenscale;
BRepMesh::Mesh(HO,tolerance);
result << "<g"
//<< " id=\"" << ViewName << "\"" << endl
Expand Down Expand Up @@ -225,7 +224,7 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< "</g>" << endl;
}
if (!H1.IsNull() && (type & WithSmooth) && (type & WithHidden)) {
double width = hfactor * scale;
double width = hiddenscale;
BRepMesh::Mesh(H1,tolerance);
result << "<g"
//<< " id=\"" << ViewName << "\"" << endl
Expand All @@ -239,10 +238,6 @@ std::string ProjectionAlgos::getSVG(ExtractionType type, double scale, double to
<< output.exportEdges(H1)
<< "</g>" << endl;
}
/*result << "0" << endl
<< "SECTION" << endl
<< "2" << endl
<< "ENTITIES" << endl;*/
return result.str();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Drawing/App/ProjectionAlgos.h
Expand Up @@ -51,7 +51,7 @@ class DrawingExport ProjectionAlgos
WithSmooth = 2
};

std::string getSVG(ExtractionType type, double scale, double tolerance);
std::string getSVG(ExtractionType type, double scale=0.35, double tolerance=0.05, double hiddenscale=0.15);
std::string getDXF(ExtractionType type, double scale, double tolerance);//added by Dan Falck 2011/09/25


Expand Down

0 comments on commit eab159b

Please sign in to comment.