Added LineWidth property to Part DrawingViews
Views of Part objects, when added to a DrawingPage, now have an adjustable LineWidth property, set to 0.35 by default.
This commit is contained in:
parent
2a76595863
commit
25c81962f8
|
@ -76,11 +76,13 @@ PROPERTY_SOURCE(Drawing::FeatureViewPart, Drawing::FeatureView)
|
|||
FeatureViewPart::FeatureViewPart(void)
|
||||
{
|
||||
static const char *group = "Shape view";
|
||||
static const char *vgroup = "Drawing view";
|
||||
|
||||
ADD_PROPERTY_TYPE(Direction ,(0,0,1.0),group,App::Prop_None,"Projection direction");
|
||||
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");
|
||||
}
|
||||
|
||||
FeatureViewPart::~FeatureViewPart()
|
||||
|
@ -196,7 +198,7 @@ App::DocumentObjectExecReturn *FeatureViewPart::execute(void)
|
|||
ProjectionAlgos::SvgExtractionType type = ProjectionAlgos::Plain;
|
||||
if (hidden) type = (ProjectionAlgos::SvgExtractionType)(type|ProjectionAlgos::WithHidden);
|
||||
if (smooth) type = (ProjectionAlgos::SvgExtractionType)(type|ProjectionAlgos::WithSmooth);
|
||||
result << Alg.getSVG(type, this->Scale.getValue());
|
||||
result << Alg.getSVG(type, this->LineWidth.getValue() / this->Scale.getValue());
|
||||
|
||||
result << "</g>" << endl;
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
App::PropertyVector Direction;
|
||||
App::PropertyBool ShowHiddenLines;
|
||||
App::PropertyBool ShowSmoothLines;
|
||||
App::PropertyFloat LineWidth;
|
||||
|
||||
|
||||
/** @name methods overide Feature */
|
||||
|
|
|
@ -153,8 +153,10 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
{
|
||||
std::stringstream result;
|
||||
SVGOutput output;
|
||||
float hfactor = 0.15f / 0.35f;
|
||||
|
||||
if (!H.IsNull() && (type & WithHidden)) {
|
||||
float width = 0.15f/scale;
|
||||
float width = hfactor * scale;
|
||||
BRepMesh::Mesh(H,0.1);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -162,14 +164,14 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
<< " stroke-width=\"" << width << "\"" << endl
|
||||
<< " stroke-linecap=\"butt\"" << endl
|
||||
<< " stroke-linejoin=\"miter\"" << endl
|
||||
<< " stroke-dasharray=\"5 3\"" << endl
|
||||
<< " stroke-dasharray=\"0.2,0.1\"" << endl
|
||||
<< " fill=\"none\"" << endl
|
||||
<< " >" << endl
|
||||
<< output.exportEdges(H)
|
||||
<< "</g>" << endl;
|
||||
}
|
||||
if (!HO.IsNull() && (type & WithHidden)) {
|
||||
float width = 0.15f/scale;
|
||||
float width = hfactor * scale;
|
||||
BRepMesh::Mesh(HO,0.1);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -177,14 +179,14 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
<< " stroke-width=\"" << width << "\"" << endl
|
||||
<< " stroke-linecap=\"butt\"" << endl
|
||||
<< " stroke-linejoin=\"miter\"" << endl
|
||||
<< " stroke-dasharray=\"5 3\"" << endl
|
||||
<< " stroke-dasharray=\"0.02,0.1\"" << endl
|
||||
<< " fill=\"none\"" << endl
|
||||
<< " >" << endl
|
||||
<< output.exportEdges(HO)
|
||||
<< "</g>" << endl;
|
||||
}
|
||||
if (!VO.IsNull()) {
|
||||
float width = 0.35f/scale;
|
||||
float width = scale;
|
||||
BRepMesh::Mesh(VO,0.1);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -198,7 +200,7 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!V.IsNull()) {
|
||||
float width = 0.35f/scale;
|
||||
float width = scale;
|
||||
BRepMesh::Mesh(V,0.1);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -212,7 +214,7 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!V1.IsNull() && (type & WithSmooth)) {
|
||||
float width = 0.35f/scale;
|
||||
float width = scale;
|
||||
BRepMesh::Mesh(V1,0.1);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -226,7 +228,7 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
<< "</g>" << endl;
|
||||
}
|
||||
if (!H1.IsNull() && (type & WithSmooth) && (type & WithHidden)) {
|
||||
float width = 0.15f/scale;
|
||||
float width = hfactor * scale;
|
||||
BRepMesh::Mesh(H1,0.1);
|
||||
result << "<g"
|
||||
//<< " id=\"" << ViewName << "\"" << endl
|
||||
|
@ -234,7 +236,7 @@ std::string ProjectionAlgos::getSVG(SvgExtractionType type, float scale)
|
|||
<< " stroke-width=\"" << width << "\"" << endl
|
||||
<< " stroke-linecap=\"butt\"" << endl
|
||||
<< " stroke-linejoin=\"miter\"" << endl
|
||||
<< " stroke-dasharray=\"5 3\"" << endl
|
||||
<< " stroke-dasharray=\"0.09,0.05\"" << endl
|
||||
<< " fill=\"none\"" << endl
|
||||
<< " >" << endl
|
||||
<< output.exportEdges(H1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user