ProjectionAlgos: Make the style of the lines in the SVG file configurable.
* getSVG provides new style parameters for every kind of line: V, V0, V1, H, H0, H1. * Old line width parameters are removed. The style parameters can be used instead. * A style is a map container for svg attribute keys and values (string, string). * The Python interface is updated to offer the new style parameters accordingly as a dict. * Because there are many parameters on the function call now, the Python interface supports keyword parameters. * Update ArchSectionPlane to take advantage of the new style parameters. This simplifies the code. String replacements could be removed (done in a later commit). * FeatureViewPy.cpp is – to my knowledge – the only function that used the old line width parameters. I rewrote it to use the new style parameters.
This commit is contained in:
@@ -120,7 +120,13 @@ 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(), this->HiddenWidth.getValue() / this->Scale.getValue());
|
||||
ProjectionAlgos::XmlAttributes visible_style = {
|
||||
{"stroke_width", to_string(this->LineWidth.getValue() / this->Scale.getValue())}
|
||||
};
|
||||
ProjectionAlgos::XmlAttributes hidden_style = {
|
||||
{"stroke_width", to_string(this->HiddenWidth.getValue() / this->Scale.getValue()) }
|
||||
};
|
||||
result << Alg.getSVG(type, this->Tolerance.getValue(), visible_style, visible_style, visible_style, hidden_style, hidden_style, hidden_style);
|
||||
|
||||
result << "</g>" << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user