VPart/VSection Graphic Properties to Gui side

This commit is contained in:
WandererFan
2018-02-14 09:06:36 -05:00
parent cbca02f7f3
commit 02b64dca3a
11 changed files with 141 additions and 96 deletions

View File

@@ -40,6 +40,7 @@
#include <Mod/TechDraw/App/DrawViewMulti.h>
#include <Mod/TechDraw/App/DrawHatch.h>
#include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/LineGroup.h>
#include<Mod/TechDraw/App/DrawPage.h>
#include "ViewProviderViewPart.h"
@@ -54,6 +55,32 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderViewPart, TechDrawGui::ViewProviderDraw
ViewProviderViewPart::ViewProviderViewPart()
{
sPixmap = "TechDraw_Tree_View";
static const char *group = "Lines";
static const char *dgroup = "Decoration";
//default line weights
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
double weight = lg->getWeight("Thick");
ADD_PROPERTY_TYPE(LineWidth,(weight),group,App::Prop_None,"The thickness of visible lines");
weight = lg->getWeight("Thin");
ADD_PROPERTY_TYPE(HiddenWidth,(weight),group,App::Prop_None,"The thickness of hidden lines, if enabled");
weight = lg->getWeight("Graphic");
ADD_PROPERTY_TYPE(IsoWidth,(weight),group,App::Prop_None,"The thickness of isoparameter/center/section lines, if enabled");
weight = lg->getWeight("Extra");
ADD_PROPERTY_TYPE(ExtraWidth,(weight),group,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled");
//decorations
ADD_PROPERTY_TYPE(HorizCenterLine ,(false),dgroup,App::Prop_None,"Show a horizontal centerline through view");
ADD_PROPERTY_TYPE(VertCenterLine ,(false),dgroup,App::Prop_None,"Show a vertical centerline through view");
ADD_PROPERTY_TYPE(ArcCenterMarks ,(true),dgroup,App::Prop_None,"Center marks on/off");
ADD_PROPERTY_TYPE(CenterScale,(2.0),dgroup,App::Prop_None,"Center mark size adjustment, if enabled");
//properties that affect Section Line
ADD_PROPERTY_TYPE(ShowSectionLine ,(true) ,dgroup,App::Prop_None,"Show/hide section line if applicable");
}
ViewProviderViewPart::~ViewProviderViewPart()
@@ -63,13 +90,21 @@ ViewProviderViewPart::~ViewProviderViewPart()
void ViewProviderViewPart::updateData(const App::Property* prop)
{
if (prop == &(getViewObject()->LineWidth) ||
prop == &(getViewObject()->HiddenWidth) ||
prop == &(getViewObject()->ArcCenterMarks) ||
prop == &(getViewObject()->CenterScale) ||
prop == &(getViewObject()->ShowSectionLine) ||
prop == &(getViewObject()->HorizCenterLine) ||
prop == &(getViewObject()->VertCenterLine) ) {
ViewProviderDrawingView::updateData(prop);
}
void ViewProviderViewPart::onChanged(const App::Property* prop)
{
if (prop == &(LineWidth) ||
prop == &(HiddenWidth) ||
prop == &(IsoWidth) ||
prop == &(ExtraWidth) ||
prop == &(ArcCenterMarks) ||
prop == &(CenterScale) ||
prop == &(ShowSectionLine) ||
prop == &(HorizCenterLine) ||
prop == &(VertCenterLine) ) {
// redraw QGIVP
QGIView* qgiv = getQView();
if (qgiv) {
@@ -77,12 +112,6 @@ void ViewProviderViewPart::updateData(const App::Property* prop)
}
}
ViewProviderDrawingView::updateData(prop);
}
void ViewProviderViewPart::onChanged(const App::Property* prop)
{
ViewProviderDrawingView::onChanged(prop);
}
@@ -94,8 +123,6 @@ void ViewProviderViewPart::attach(App::DocumentObject *pcFeat)
sPixmap = "TechDraw_Tree_Multi";
}
// call parent attach method
// ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDrawingView::attach(pcFeat);
}