IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension);
-
-static const Standard_ExtCharacter MyEmptySymbol(' ');
-static const Standard_ExtCharacter MySummSymbol(0x03A3);
-
SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint), myPlane(thePlane)
myAspect->SetArrowTailSize(myAspect->ArrowAspect()->Length());
AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE());
- std::set<std::string> aParams = aValue->usedParameters();
- if (aParams.size() > 0) {
- SetSpecialSymbol(MySummSymbol);
- SetDisplaySpecialSymbol(AIS_DSS_Before);
- }
- else {
- SetSpecialSymbol(MyEmptySymbol);
- SetDisplaySpecialSymbol(AIS_DSS_Before);
- }
+ SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0);
AIS_AngleDimension::Compute(thePresentationManager, thePresentation, theMode);
}
static const gp_Pnt MyDefEnd(1,0,0);
static const gp_Pln MyDefPln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
-// it is not possible to use 0x2211 as summ symbol because it is not supported by
-// debian Linux platform
-static const Standard_ExtCharacter MySummSymbol(0x03A3);
-
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, AIS_LengthDimension);
myAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER);
AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE());
- std::set<std::string> aParams = aValue->usedParameters();
- if (aParams.size() > 0) {
- SetSpecialSymbol(MySummSymbol);
- SetDisplaySpecialSymbol(AIS_DSS_Before);
- }
+ SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0);
AIS_LengthDimension::Compute(thePresentationManager, thePresentation, theMode);
}
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
-static const Standard_ExtCharacter MyEmptySymbol(' ');
-static const Standard_ExtCharacter MySummSymbol(0x03A3);
-
SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), myPlane(thePlane)
myAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER);
AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE());
- std::set<std::string> aParams = aValue->usedParameters();
- if (aParams.size() > 0) {
- SetSpecialSymbol(MySummSymbol);
- SetDisplaySpecialSymbol(AIS_DSS_Before);
- }
- else {
- SetSpecialSymbol(MyEmptySymbol);
- SetDisplaySpecialSymbol(AIS_DSS_Before);
- }
+ SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0);
AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
}
#include <BRep_Tool.hxx>
#include <Precision.hxx>
+#include <AIS_Dimension.hxx>
+
+// it is not possible to use 0x2211 as summ symbol because it is not supported by
+// debian Linux platform
+static const Standard_ExtCharacter MyEmptySymbol(' ');
+static const Standard_ExtCharacter MySigmaSymbol(0x03A3);
+
namespace SketcherPrs_Tools {
ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName)
return thePlane->to3D(aFlyoutPnt->x(), aFlyoutPnt->y());
}
+void setDisplaySpecialSymbol(AIS_Dimension* theDimension, const bool& theToDisplay)
+{
+ if (theToDisplay) {
+ theDimension->SetSpecialSymbol(MySigmaSymbol);
+ theDimension->SetDisplaySpecialSymbol(AIS_DSS_Before);
+ }
+ else {
+ theDimension->SetSpecialSymbol(MyEmptySymbol);
+ theDimension->SetDisplaySpecialSymbol(AIS_DSS_No);
+ }
+}
+
};
#include <string>
class GeomDataAPI_Point2D;
+class AIS_Dimension;
//#define MyTextHeight 20
SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt> getAnchorPoint(
const ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+
+ /// Display/hide sigma symbol in the dimension presentation
+ /// \param theDimension a dimension constraint
+ /// \param theToDisplay a boolean value
+ SKETCHERPRS_EXPORT void setDisplaySpecialSymbol(AIS_Dimension* theDimension,
+ const bool& theToDisplay);
};
#endif