[TD] add property for section line style
see https://forum.freecadweb.org/viewtopic.php?f=35&t=44320
This commit is contained in:
@@ -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")->
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;}
|
||||
|
||||
Reference in New Issue
Block a user