Diameter symbol & text orientation to standards.
This commit is contained in:
parent
3eb9037ada
commit
ef69519261
|
@ -198,7 +198,7 @@ App::DocumentObjectExecReturn *DrawViewDimension::execute(void)
|
|||
|
||||
std::string DrawViewDimension::getFormatedValue() const
|
||||
{
|
||||
QString str = QString::fromUtf8(FormatSpec.getStrValue().c_str());
|
||||
QString str = QString::fromUtf8(FormatSpec.getStrValue().data(),FormatSpec.getStrValue().size());
|
||||
double val = std::abs(getDimValue());
|
||||
|
||||
Base::Quantity qVal;
|
||||
|
@ -210,7 +210,7 @@ std::string DrawViewDimension::getFormatedValue() const
|
|||
}
|
||||
QString userStr = qVal.getUserString();
|
||||
|
||||
QRegExp rx(QString::fromAscii("%(\\w+)%")); //any word bracketed by %
|
||||
QRegExp rx(QString::fromUtf8("%(\\w+)%")); //any word bracketed by %
|
||||
QStringList list;
|
||||
int pos = 0;
|
||||
|
||||
|
@ -220,12 +220,12 @@ std::string DrawViewDimension::getFormatedValue() const
|
|||
}
|
||||
|
||||
for(QStringList::const_iterator it = list.begin(); it != list.end(); ++it) {
|
||||
if(*it == QString::fromAscii("%value%")){
|
||||
if(*it == QString::fromUtf8("%value%")){
|
||||
str.replace(*it,userStr);
|
||||
// } else { //insert additional placeholder replacement logic here
|
||||
}
|
||||
}
|
||||
return str.toStdString();
|
||||
return str.toUtf8().constData();
|
||||
}
|
||||
|
||||
double DrawViewDimension::getDimValue() const
|
||||
|
|
|
@ -237,7 +237,7 @@ void CmdTechDrawNewDimension::activated(int iMsg)
|
|||
|
||||
std::string contentStr;
|
||||
if (dimType == "Radius") {
|
||||
contentStr = "r%value%";
|
||||
contentStr = "R%value%";
|
||||
}
|
||||
doCommand(Doc,"App.activeDocument().%s.FormatSpec = '%s'",FeatName.c_str()
|
||||
,contentStr.c_str());
|
||||
|
@ -332,7 +332,7 @@ void CmdTechDrawNewRadiusDimension::activated(int iMsg)
|
|||
doCommand(Doc,"App.activeDocument().%s.CentreLines = False", FeatName.c_str());
|
||||
}
|
||||
|
||||
doCommand(Doc, "App.activeDocument().%s.FormatSpec = 'r%%value%%'", FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.FormatSpec = 'R%%value%%'", FeatName.c_str());
|
||||
|
||||
dim = dynamic_cast<TechDraw::DrawViewDimension *>(getDocument()->getObject(FeatName.c_str()));
|
||||
dim->References2D.setValues(objs, subs);
|
||||
|
@ -425,7 +425,7 @@ void CmdTechDrawNewDiameterDimension::activated(int iMsg)
|
|||
doCommand(Doc,"App.activeDocument().%s.CentreLines = False", FeatName.c_str());
|
||||
}
|
||||
|
||||
doCommand(Doc, "App.activeDocument().%s.FormatSpec = '\u00d8%%value%%'", FeatName.c_str()); // \u00d8 is Capital O with stroke
|
||||
doCommand(Doc, "App.activeDocument().%s.FormatSpec = '\u2300%%value%%'", FeatName.c_str());
|
||||
|
||||
dim = dynamic_cast<TechDraw::DrawViewDimension *>(getDocument()->getObject(FeatName.c_str()));
|
||||
dim->References2D.setValues(objs, subs);
|
||||
|
|
|
@ -240,11 +240,10 @@ void QGIViewDimension::updateDim()
|
|||
return;
|
||||
|
||||
const TechDraw::DrawViewDimension *dim = dynamic_cast<TechDraw::DrawViewDimension *>(getViewObject());
|
||||
QString labelText = QString::fromStdString(dim->getFormatedValue());
|
||||
|
||||
QString labelText = QString::fromUtf8(dim->getFormatedValue().data(),dim->getFormatedValue().size());
|
||||
QFont font = datumLabel->font();
|
||||
font.setPointSizeF(dim->Fontsize.getValue()); //scene units (mm), not points
|
||||
font.setFamily(QString::fromAscii(dim->Font.getValue()));
|
||||
font.setFamily(QString::fromUtf8(dim->Font.getValue()));
|
||||
|
||||
datumLabel->setPlainText(labelText);
|
||||
datumLabel->setFont(font);
|
||||
|
@ -411,7 +410,10 @@ void QGIViewDimension::draw()
|
|||
|
||||
// Get magnitude of angle between dir and horizontal
|
||||
float angle = atan2f(dir.y,dir.x);
|
||||
if (angle > M_PI_2+M_PI/12) {
|
||||
//Vertical text should be legible from the right
|
||||
if (std::abs(angle + M_PI/2.0) < FLT_EPSILON) {
|
||||
//noop
|
||||
} else if (angle > M_PI_2+M_PI/12) { //keeps some diagonal dims from turning upside down?
|
||||
angle -= (float)M_PI;
|
||||
} else if (angle <= -M_PI_2+M_PI/12) {
|
||||
angle += (float)M_PI;
|
||||
|
|
Loading…
Reference in New Issue
Block a user