[TD] add property for section line style

see https://forum.freecadweb.org/viewtopic.php?f=35&t=44320
This commit is contained in:
donovaly
2020-03-21 02:28:03 +01:00
committed by WandererFan
parent 6fa80d8cbf
commit c77b63d2bd
5 changed files with 23 additions and 0 deletions

View File

@@ -285,6 +285,12 @@ QColor QGISectionLine::getSectionColor()
}
//SectionLineStyle
void QGISectionLine::setSectionStyle(int style)
{
Qt::PenStyle sectStyle = static_cast<Qt::PenStyle> (style);
setStyle(sectStyle);
}
Qt::PenStyle QGISectionLine::getSectionStyle()
{
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->

View File

@@ -54,6 +54,7 @@ public:
void setDirection(double xDir,double yDir);
void setDirection(Base::Vector3d dir);
void setFont(QFont f, double fsize);
void setSectionStyle(int style);
virtual void draw();
protected:

View File

@@ -848,6 +848,7 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
QGISectionLine* sectionLine = new QGISectionLine();
addToGroup(sectionLine);
sectionLine->setSymbol(const_cast<char*>(viewSection->SectionSymbol.getValue()));
sectionLine->setSectionStyle(vp->SectionLineStyle.getValue());
//TODO: handle oblique section lines?
//find smallest internal angle(normalDir,get?Dir()) and use -1*get?Dir() +/- angle

View File

@@ -56,6 +56,14 @@ using namespace TechDrawGui;
PROPERTY_SOURCE(TechDrawGui::ViewProviderViewPart, TechDrawGui::ViewProviderDrawingView)
const char* ViewProviderViewPart::LineStyleEnums[] = { "NoLine",
"Continuous",
"Dash",
"Dot",
"DashDot",
"DashDotDot",
NULL };
//**************************************************************************
// Construction/Destruction
@@ -100,6 +108,9 @@ ViewProviderViewPart::ViewProviderViewPart()
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,dgroup,App::Prop_None,"Show/hide section line if applicable");
int defLineStyle = hGrp->GetFloat("SectionLine", 2);
SectionLineStyle.setEnums(LineStyleEnums);
ADD_PROPERTY_TYPE(SectionLineStyle, (defLineStyle), dgroup, App::Prop_None, "Show/hide section line if applicable");
//properties that affect Detail Highlights
ADD_PROPERTY_TYPE(HighlightAdjust,(0.0),hgroup,App::Prop_None,"Adjusts the rotation of the Detail highlight");
@@ -127,6 +138,7 @@ void ViewProviderViewPart::onChanged(const App::Property* prop)
prop == &(ArcCenterMarks) ||
prop == &(CenterScale) ||
prop == &(ShowSectionLine) ||
prop == &(SectionLineStyle) ||
prop == &(HorizCenterLine) ||
prop == &(VertCenterLine) ) {
// redraw QGIVP

View File

@@ -52,9 +52,12 @@ public:
App::PropertyBool HorizCenterLine;
App::PropertyBool VertCenterLine;
App::PropertyBool ShowSectionLine;
App::PropertyEnumeration SectionLineStyle;
App::PropertyFloat HighlightAdjust;
App::PropertyBool ShowAllEdges;
static const char* LineStyleEnums[];
virtual void attach(App::DocumentObject *);
virtual void setDisplayMode(const char* ModeName);
virtual bool useNewSelectionModel(void) const {return false;}