[TechDraw] Simplify return logic

This commit is contained in:
Benjamin Bræstrup Sayoc
2023-04-09 16:34:23 +02:00
committed by WandererFan
parent 5d05acc87e
commit 3794897699
14 changed files with 20 additions and 42 deletions

View File

@@ -96,8 +96,7 @@ App::Color LineFormat::getDefEdgeColor()
int LineFormat::getDefEdgeStyle()
{
int style = Preferences::getPreferenceGroup("Decorations")->GetInt("CosmoCLStyle", 2); //dashed
return style;
return Preferences::getPreferenceGroup("Decorations")->GetInt("CosmoCLStyle", 2); //dashed
}
//******************************************

View File

@@ -571,20 +571,18 @@ void DrawView::setScaleAttribute()
int DrawView::prefScaleType()
{
int result = Preferences::getPreferenceGroup("General")->GetInt("DefaultScaleType", 0);
return result;
return Preferences::getPreferenceGroup("General")->GetInt("DefaultScaleType", 0);
}
double DrawView::prefScale()
{
double result = Preferences::getPreferenceGroup("General")->GetFloat("DefaultViewScale", 1.0);
if (ScaleType.isValue("Page")) {
auto page = findParentPage();
if (page) {
result = page->Scale.getValue();
return page->Scale.getValue();
}
}
return result;
return Preferences::getPreferenceGroup("General")->GetFloat("DefaultViewScale", 1.0);
}
void DrawView::requestPaint()

View File

@@ -1192,7 +1192,7 @@ int DrawViewSection::prefCutSurface(void) const
bool DrawViewSection::showSectionEdges(void)
{
return (Preferences::getPreferenceGroup("General")->GetBool("ShowSectionEdges", true));
return Preferences::getPreferenceGroup("General")->GetBool("ShowSectionEdges", true);
}
bool DrawViewSection::trimAfterCut() const { return TrimAfterCut.getValue(); }

View File

@@ -425,7 +425,6 @@ Base::Vector3d ShapeExtractor::getLocation3dFromFeat(App::DocumentObject* obj)
bool ShapeExtractor::prefAdd2d()
{
bool result = Preferences::getPreferenceGroup("General")->GetBool("ShowLoose2d", false);
return result;
return Preferences::getPreferenceGroup("General")->GetBool("ShowLoose2d", false);
}

View File

@@ -101,7 +101,6 @@ QPainterPath QGICMark::shape() const
double QGICMark::getMarkFuzz() const
{
double result = Preferences::getPreferenceGroup("General")->GetFloat("MarkFuzz", 5.0);
return result;
return Preferences::getPreferenceGroup("General")->GetFloat("MarkFuzz", 5.0);
}

View File

@@ -487,8 +487,7 @@ Qt::PenStyle QGISectionLine::getSectionStyle()
//ASME("traditional") vs ISO("reference arrow method") arrows
int QGISectionLine::getPrefSectionStandard()
{
int format = Preferences::getPreferenceGroup("Standards")->GetInt("SectionLineStandard", ISOSTANDARD);
return format;
return Preferences::getPreferenceGroup("Standards")->GetInt("SectionLineStandard", ISOSTANDARD);
}

View File

@@ -351,9 +351,8 @@ double QGITile::getSymbolHeight() const
//make symbols larger or smaller than standard
double QGITile::getSymbolFactor() const
{
double s = Preferences::getPreferenceGroup("Decorations")->GetFloat("SymbolFactor", 1.25);
// double s = 1.25;
return s;
// return 1.25;
return Preferences::getPreferenceGroup("Decorations")->GetFloat("SymbolFactor", 1.25);
}
double QGITile::prefFontSize() const

View File

@@ -942,8 +942,7 @@ int QGIViewBalloon::prefDefaultArrow() const { return Preferences::balloonArrow(
//when would you want a crooked pyramid?
bool QGIViewBalloon::prefOrthoPyramid() const
{
bool ortho = Preferences::getPreferenceGroup("Decorations")->GetBool("PyramidOrtho", true);
return ortho;
return Preferences::getPreferenceGroup("Decorations")->GetBool("PyramidOrtho", true);
}
DrawView* QGIViewBalloon::getSourceView() const

View File

@@ -400,23 +400,15 @@ void QGIDatumLabel::setUnitString(QString text)
int QGIDatumLabel::getPrecision()
{
int precision;
bool global = false;
global = Preferences::useGlobalDecimals();
if (global) {
precision = Base::UnitsApi::getDecimals();
if (Preferences::useGlobalDecimals()) {
return Base::UnitsApi::getDecimals();
}
else {
precision = Preferences::getPreferenceGroup("Dimensions")->GetInt("AltDecimals", 2);
}
return precision;
return Preferences::getPreferenceGroup("Dimensions")->GetInt("AltDecimals", 2);
}
double QGIDatumLabel::getTolAdjust()
{
double adjust;
adjust = Preferences::getPreferenceGroup("Dimensions")->GetFloat("TolSizeAdjust", 0.50);
return adjust;
return Preferences::getPreferenceGroup("Dimensions")->GetFloat("TolSizeAdjust", 0.50);
}

View File

@@ -475,10 +475,8 @@ void QGTracker::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QColor QGTracker::getTrackerColor()
{
QColor result;
App::Color trackColor = App::Color((uint32_t) Preferences::getPreferenceGroup("Tracker")->GetUnsigned("TrackerColor", 0xFF000000));
result = PreferencesGui::getAccessibleQColor(trackColor.asValue<QColor>());
return result;
return PreferencesGui::getAccessibleQColor(trackColor.asValue<QColor>());
}
double QGTracker::getTrackerWeight()

View File

@@ -123,7 +123,6 @@ QSize Rez::appSize(QSize s)
double Rez::getParameter()
{
double rezFactor = Preferences::getPreferenceGroup("Rez")->GetFloat("Resolution", 10.0);
return rezFactor;
return Preferences::getPreferenceGroup("Rez")->GetFloat("Resolution", 10.0);
}

View File

@@ -428,8 +428,7 @@ QColor TaskCenterLine::getCenterColor()
double TaskCenterLine::getExtendBy()
{
double ext = Preferences::getPreferenceGroup("Decorations")->GetFloat("CosmoCLExtend", 3.0);
return ext;
return Preferences::getPreferenceGroup("Decorations")->GetFloat("CosmoCLExtend", 3.0);
}
//******************************************************************************

View File

@@ -244,8 +244,7 @@ double ViewProviderDimension::prefWeight() const
int ViewProviderDimension::prefStandardAndStyle() const
{
int standardStyle = Preferences::getPreferenceGroup("Dimensions")->GetInt("StandardAndStyle", STD_STYLE_ISO_ORIENTED);
return standardStyle;
return Preferences::getPreferenceGroup("Dimensions")->GetInt("StandardAndStyle", STD_STYLE_ISO_ORIENTED);
}
void ViewProviderDimension::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)

View File

@@ -126,8 +126,7 @@ double ViewProviderWeld::prefFontSize()
double ViewProviderWeld::prefTileTextAdjust()
{
double adjust = Preferences::getPreferenceGroup("Dimensions")->GetFloat("TileTextAdjust", 0.75);
return adjust;
return Preferences::getPreferenceGroup("Dimensions")->GetFloat("TileTextAdjust", 0.75);
}
bool ViewProviderWeld::onDelete(const std::vector<std::string> &)