[TechDraw] Simplify code getting default line weights
This commit is contained in:
committed by
WandererFan
parent
750fa24b2e
commit
86dfd0a862
@@ -426,17 +426,12 @@ void TaskCenterLine::enableTaskButtons(bool b)
|
||||
|
||||
double TaskCenterLine::getCenterWidth()
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
|
||||
double width = lg->getWeight("Graphic");
|
||||
delete lg;
|
||||
Gui::ViewProvider* vp = QGIView::getViewProvider(m_partFeat);
|
||||
auto partVP = dynamic_cast<ViewProviderViewPart*>(vp);
|
||||
if (partVP) {
|
||||
width = partVP->IsoWidth.getValue();
|
||||
if (!partVP) {
|
||||
return TechDraw::LineGroup::getDefaultWidth("Graphic");
|
||||
}
|
||||
return width;
|
||||
return partVP->IsoWidth.getValue();
|
||||
}
|
||||
|
||||
Qt::PenStyle TaskCenterLine::getCenterStyle()
|
||||
|
||||
@@ -778,11 +778,7 @@ int TaskLeaderLine::getPrefArrowStyle()
|
||||
|
||||
double TaskLeaderLine::prefWeight() const
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double weight = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
return weight;
|
||||
return TechDraw::LineGroup::getDefaultWidth("Thin");
|
||||
}
|
||||
|
||||
App::Color TaskLeaderLine::prefLineColor(void)
|
||||
|
||||
@@ -319,11 +319,7 @@ void TaskRichAnno::onEditorExit(void)
|
||||
|
||||
double TaskRichAnno::prefWeight() const
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double weight = lg->getWeight("Graphic");
|
||||
delete lg; //Coverity CID 174670
|
||||
return weight;
|
||||
return TechDraw::LineGroup::getDefaultWidth("Graphic");
|
||||
}
|
||||
|
||||
App::Color TaskRichAnno::prefLineColor(void)
|
||||
|
||||
@@ -60,10 +60,7 @@ ViewProviderBalloon::ViewProviderBalloon()
|
||||
ADD_PROPERTY_TYPE(Font, (Preferences::labelFont().c_str()), group, App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Fontsize, (Preferences::dimFontSizeMM()),
|
||||
group, (App::PropertyType)(App::Prop_None), "Balloon text size in units");
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double weight = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
double weight = TechDraw::LineGroup::getDefaultWidth("Thin");
|
||||
ADD_PROPERTY_TYPE(LineWidth, (weight), group, (App::PropertyType)(App::Prop_None), "Leader line width");
|
||||
ADD_PROPERTY_TYPE(LineVisible, (true), group, (App::PropertyType)(App::Prop_None), "Balloon line visible or hidden");
|
||||
ADD_PROPERTY_TYPE(Color, (PreferencesGui::dimColor()), group, App::Prop_None, "Color of the balloon");
|
||||
|
||||
@@ -240,11 +240,7 @@ double ViewProviderDimension::prefFontSize() const
|
||||
|
||||
double ViewProviderDimension::prefWeight() const
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double weight = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
return weight;
|
||||
return TechDraw::LineGroup::getDefaultWidth("Thin");
|
||||
}
|
||||
|
||||
int ViewProviderDimension::prefStandardAndStyle() const
|
||||
|
||||
@@ -178,10 +178,7 @@ void ViewProviderGeomHatch::updateGraphic(void)
|
||||
|
||||
void ViewProviderGeomHatch::getParameters(void)
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double weight = lg->getWeight("Graphic");
|
||||
delete lg; //Coverity CID 174667
|
||||
double weight = TechDraw::LineGroup::getDefaultWidth("Graphic");
|
||||
WeightPattern.setValue(weight);
|
||||
}
|
||||
|
||||
|
||||
@@ -181,11 +181,7 @@ TechDraw::DrawLeaderLine* ViewProviderLeader::getFeature() const
|
||||
|
||||
double ViewProviderLeader::getDefLineWeight(void)
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double result = lg->getWeight("Thin");
|
||||
delete lg; //Coverity CID 174670
|
||||
return result;
|
||||
return TechDraw::LineGroup::getDefaultWidth("Thin");
|
||||
}
|
||||
|
||||
App::Color ViewProviderLeader::getDefLineColor(void)
|
||||
|
||||
@@ -168,11 +168,7 @@ double ViewProviderRichAnno::getDefFontSize()
|
||||
|
||||
double ViewProviderRichAnno::getDefLineWeight(void)
|
||||
{
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
double result = lg->getWeight("Graphics");
|
||||
delete lg;
|
||||
return result;
|
||||
return TechDraw::LineGroup::getDefaultWidth("Graphics");
|
||||
}
|
||||
|
||||
void ViewProviderRichAnno::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
|
||||
@@ -78,21 +78,18 @@ ViewProviderViewPart::ViewProviderViewPart()
|
||||
static const char *hgroup = "Highlight";
|
||||
|
||||
//default line weights
|
||||
int lgNumber = Preferences::lineGroup();
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgNumber);
|
||||
|
||||
double weight = lg->getWeight("Thick");
|
||||
double weight = TechDraw::LineGroup::getDefaultWidth("Thick");
|
||||
ADD_PROPERTY_TYPE(LineWidth,(weight),group,App::Prop_None,"The thickness of visible lines (line groups xx.2");
|
||||
|
||||
weight = lg->getWeight("Thin");
|
||||
weight = TechDraw::LineGroup::getDefaultWidth("Thin");
|
||||
ADD_PROPERTY_TYPE(HiddenWidth,(weight),group,App::Prop_None,"The thickness of hidden lines, if enabled (line groups xx.1)");
|
||||
|
||||
weight = lg->getWeight("Graphic");
|
||||
weight = TechDraw::LineGroup::getDefaultWidth("Graphic");
|
||||
ADD_PROPERTY_TYPE(IsoWidth,(weight),group,App::Prop_None,"The thickness of isoparameter lines, if enabled");
|
||||
|
||||
weight = lg->getWeight("Extra");
|
||||
weight = TechDraw::LineGroup::getDefaultWidth("Extra");
|
||||
ADD_PROPERTY_TYPE(ExtraWidth,(weight),group,App::Prop_None,"The thickness of LineGroup Extra lines, if enabled");
|
||||
delete lg; //Coverity CID 174664
|
||||
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
|
||||
Reference in New Issue
Block a user