@aapo-aapo @chennes [TD] Suggested minor improvements for DrawViewDimension.cpp and QGIViewDimension.cpp in Pull request review.
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
@@ -213,7 +213,6 @@ short DrawViewDimension::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn *DrawViewDimension::execute(void)
|
||||
{
|
||||
// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument());
|
||||
if (!keepUpdated()) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
@@ -685,14 +684,13 @@ std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
QStringList DrawViewDimension::getFormattedToleranceValues(int partial)
|
||||
std::pair<std::string, std::string> DrawViewDimension::getFormattedToleranceValues(int partial)
|
||||
{
|
||||
QString underFormatSpec = QString::fromUtf8(FormatSpecUnderTolerance.getStrValue().data());
|
||||
QString overFormatSpec = QString::fromUtf8(FormatSpecOverTolerance.getStrValue().data());
|
||||
QStringList tolerances;
|
||||
std::pair<std::string, std::string> tolerances;
|
||||
QString underTolerance, overTolerance;
|
||||
|
||||
if (ArbitraryTolerances.getValue()) {
|
||||
@@ -703,7 +701,8 @@ QStringList DrawViewDimension::getFormattedToleranceValues(int partial)
|
||||
overTolerance = QString::fromUtf8(formatValue(OverTolerance.getValue(), overFormatSpec, partial).c_str());
|
||||
}
|
||||
|
||||
tolerances << underTolerance << overTolerance;
|
||||
tolerances.first = underTolerance.toStdString();
|
||||
tolerances.second = overTolerance.toStdString();
|
||||
|
||||
return tolerances;
|
||||
}
|
||||
@@ -728,7 +727,7 @@ QStringList DrawViewDimension::getPrefixSuffixSpec(QString fSpec)
|
||||
QString formatSuffix;
|
||||
QString formatted;
|
||||
//find the %x.y tag in FormatSpec
|
||||
QRegExp rxFormat(QString::fromUtf8("%[+-]*[0-9]*\\.*[0-9]*[aefgAEFG]")); //printf double format spec
|
||||
QRegExp rxFormat(QString::fromUtf8("%[+-]?[0-9]*\\.*[0-9]*[aefgAEFG]")); //printf double format spec
|
||||
QString match;
|
||||
int pos = 0;
|
||||
if ((pos = rxFormat.indexIn(fSpec, 0)) != -1) {
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
//return PyObject as DrawViewDimensionPy
|
||||
virtual PyObject *getPyObject(void) override;
|
||||
|
||||
virtual QStringList getFormattedToleranceValues(int partial = 0);
|
||||
virtual std::pair<std::string, std::string> getFormattedToleranceValues(int partial = 0);
|
||||
virtual std::string getFormattedDimensionValue(int partial = 0);
|
||||
virtual std::string formatValue(qreal value, QString qFormatSpec, int partial = 0);
|
||||
|
||||
|
||||
@@ -333,23 +333,25 @@ void QGIDatumLabel::setTolString()
|
||||
tolSuffix = QString::fromUtf8(dim->getFormattedDimensionValue(2).c_str()); //just the unit
|
||||
}
|
||||
|
||||
QStringList labelTexts, unitTexts;
|
||||
std::pair<std::string, std::string> labelTexts, unitTexts;
|
||||
|
||||
if (dim->ArbitraryTolerances.getValue()) {
|
||||
labelTexts = dim->getFormattedToleranceValues(1); //just the number pref/spec/suf
|
||||
unitTexts << QString::fromLatin1("") << QString::fromLatin1("");
|
||||
unitTexts.first = "";
|
||||
unitTexts.second = "";
|
||||
} else {
|
||||
if (dim->isMultiValueSchema()) {
|
||||
labelTexts = dim->getFormattedToleranceValues(0); //don't format multis
|
||||
unitTexts << QString::fromLatin1("") << QString::fromLatin1("");
|
||||
unitTexts.first = "";
|
||||
unitTexts.second = "";
|
||||
} else {
|
||||
labelTexts = dim->getFormattedToleranceValues(1); //just the number pref/spec/suf
|
||||
unitTexts = dim->getFormattedToleranceValues(2); //just the unit
|
||||
}
|
||||
}
|
||||
|
||||
m_tolTextUnder->setPlainText(labelTexts[0] + unitTexts[0]);
|
||||
m_tolTextOver->setPlainText(labelTexts[1] + unitTexts[1]);
|
||||
m_tolTextUnder->setPlainText(QString::fromUtf8(labelTexts.first.c_str()) + QString::fromUtf8(unitTexts.first.c_str()));
|
||||
m_tolTextOver->setPlainText(QString::fromUtf8(labelTexts.second.c_str()) + QString::fromUtf8(unitTexts.second.c_str()));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user