]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
BUG: Set empty special symbol in lenght constraint
authornds <nds@opencascade.com>
Fri, 12 Feb 2016 12:51:25 +0000 (15:51 +0300)
committernds <nds@opencascade.com>
Fri, 12 Feb 2016 12:51:25 +0000 (15:51 +0300)
src/SketcherPrs/SketcherPrs_Angle.cpp
src/SketcherPrs/SketcherPrs_LengthDimension.cpp
src/SketcherPrs/SketcherPrs_Radius.cpp
src/SketcherPrs/SketcherPrs_Tools.cpp
src/SketcherPrs/SketcherPrs_Tools.h

index 6304a51bdcde54a7e51c6eb4204614fe83b3a3bf..6f5c379f3c6732c51fec2a1ed44035157aed1f15 100644 (file)
 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)
@@ -104,15 +100,7 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP
   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);
 }
index 34cae3a54cde252acae1a195cf3517f3ae1420be..eaf5ec0cd6819b875cbf09ed7b79b624b08bfcd6 100644 (file)
@@ -30,10 +30,6 @@ static const gp_Pnt MyDefStart(0,0,0);
 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);
 
@@ -89,11 +85,7 @@ void SketcherPrs_LengthDimension::Compute(const Handle(PrsMgr_PresentationManage
   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);
 }
index 56f9d7f0e252e12b4cef13725cff88cf535a0eb2..d6299a9050a39d449625d382cef9e5e27f056bd6 100644 (file)
@@ -25,9 +25,6 @@ static const gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1);
 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)
@@ -124,15 +121,7 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the
   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);
 }
index be093bc6907cb17a08113abc0e1609814fda819a..78b521957ba85a23359bbb5c29d62e09f7e75cd9 100644 (file)
 #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)
@@ -267,4 +274,16 @@ std::shared_ptr<GeomAPI_Pnt> getAnchorPoint(const ModelAPI_Feature* theConstrain
   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);
+  }
+}
+
 };
index 0daf047238c24e53990af7e73df539d5d5d00094..f490898f4c3018a16fc86e1a25b6f97f4a49fb53 100644 (file)
@@ -16,6 +16,7 @@
 #include <string>
 
 class GeomDataAPI_Point2D;
+class AIS_Dimension;
 
 //#define MyTextHeight 20
 
@@ -103,6 +104,12 @@ namespace SketcherPrs_Tools {
   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