Salome HOME
Issue #3108: Take into account current parameters style for new dimensions.
authorvsv <vsv@opencascade.com>
Thu, 12 Dec 2019 15:48:49 +0000 (18:48 +0300)
committervsv <vsv@opencascade.com>
Thu, 12 Dec 2019 15:49:02 +0000 (18:49 +0300)
14 files changed:
src/PartSet/PartSet_SketcherMgr.cpp
src/SketcherPrs/CMakeLists.txt
src/SketcherPrs/SketcherPrs_Angle.cpp
src/SketcherPrs/SketcherPrs_Angle.h
src/SketcherPrs/SketcherPrs_DimensionStyle.cpp [new file with mode: 0644]
src/SketcherPrs/SketcherPrs_DimensionStyle.h [new file with mode: 0644]
src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp [deleted file]
src/SketcherPrs/SketcherPrs_DimensionStyleListener.h [deleted file]
src/SketcherPrs/SketcherPrs_LengthDimension.cpp
src/SketcherPrs/SketcherPrs_LengthDimension.h
src/SketcherPrs/SketcherPrs_Radius.cpp
src/SketcherPrs/SketcherPrs_Radius.h
src/SketcherPrs/SketcherPrs_Tools.cpp
src/SketcherPrs/SketcherPrs_Tools.h

index e8257714569d0363873ca9a0db1b851984a35787..a0e1b7efa093573fc58fe96acd3ff8247af2e401 100644 (file)
@@ -2019,8 +2019,9 @@ void PartSet_SketcherMgr::updateBySketchParameters(
       if (aPrevState != theState) {
         /// call all sketch features redisplay, the expression state will be corrected in customize
         /// of distance presentation
-        SketcherPrs_Tools::
-          sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]);
+        SketcherPrs_Tools::ParameterStyle aStyle = myIsConstraintsShown[PartSet_Tools::Expressions] ?
+          SketcherPrs_Tools::ParameterText : SketcherPrs_Tools::ParameterValue;
+        SketcherPrs_Tools::setParameterStyle(aStyle);
         Events_ID anEventId = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
         PartSet_Tools::sendSubFeaturesEvent(myCurrentSketch, anEventId);
       }
index f84bb43220f1cee2fcf8334c8779f1ea818ca7f6..51a7b9f8be1b09954e5ed83fe2e5070ac06bc586 100644 (file)
@@ -26,7 +26,7 @@ SET(PROJECT_HEADERS
     SketcherPrs.h
     SketcherPrs_Coincident.h
     SketcherPrs_Collinear.h
-    SketcherPrs_DimensionStyleListener.h
+    SketcherPrs_DimensionStyle.h
     SketcherPrs_Factory.h
     SketcherPrs_Parallel.h
     SketcherPrs_Tools.h
@@ -49,7 +49,7 @@ SET(PROJECT_HEADERS
 SET(PROJECT_SOURCES
     SketcherPrs_Coincident.cpp
     SketcherPrs_Collinear.cpp
-    SketcherPrs_DimensionStyleListener.cpp
+    SketcherPrs_DimensionStyle.cpp
     SketcherPrs_Factory.cpp
     SketcherPrs_Parallel.cpp
     SketcherPrs_Tools.cpp
index 9edc95a76a81843548e39896e45f0f6571a3e0fb..f09c4a9331f45f430eda3efc2cf4151f8d24b85b 100644 (file)
@@ -18,7 +18,7 @@
 //
 
 #include "SketcherPrs_Angle.h"
-#include "SketcherPrs_DimensionStyleListener.h"
+#include "SketcherPrs_DimensionStyle.h"
 #include "SketcherPrs_Tools.h"
 
 #include <SketchPlugin_ConstraintAngle.h>
@@ -70,7 +70,7 @@ SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
 
   SetDimensionAspect(myAspect);
 
-  myStyleListener = new SketcherPrs_DimensionStyleListener();
+  myStyleListener = new SketcherPrs_DimensionStyle();
 }
 
 SketcherPrs_Angle::~SketcherPrs_Angle()
index 75d0c37d81888c8d869d1555128ace51335dedc0..009a482a8c353ff1b910b677f481a2c555ad78c9 100644 (file)
@@ -27,7 +27,7 @@
 #include <AIS_AngleDimension.hxx>
 #include <Standard_DefineHandle.hxx>
 
-#include <SketcherPrs_DimensionStyleListener.h>
+#include <SketcherPrs_DimensionStyle.h>
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension)
 
@@ -99,7 +99,7 @@ private:
   Handle(Prs3d_DimensionAspect) myAspect;
 
   /// Listener to update dimension visualization style
-  SketcherPrs_DimensionStyleListener* myStyleListener;
+  SketcherPrs_DimensionStyle* myStyleListener;
 
   /// container of values obtained from the constraint, which are necessary to fill the presentation
   gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry
@@ -107,7 +107,7 @@ private:
   gp_Pnt myCenterPoint; ///< the dimension center point for measured geometry
   gp_Pnt myFlyOutPoint;  ///< the dimension fly out point for measured geometry
 
-  SketcherPrs_DimensionStyleListener::DimensionValue myValue; /// the structure filled by constraint
+  SketcherPrs_DimensionStyle::DimensionValue myValue; /// the structure filled by constraint
 };
 
 
diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp b/src/SketcherPrs/SketcherPrs_DimensionStyle.cpp
new file mode 100644 (file)
index 0000000..fb82eb4
--- /dev/null
@@ -0,0 +1,117 @@
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SketcherPrs_DimensionStyle.h"
+#include <Prs3d_DimensionAspect.hxx>
+#include "SketcherPrs_Tools.h"
+
+#include <Events_Loop.h>
+
+#include <AIS_Dimension.hxx>
+#include <TCollection_ExtendedString.hxx>
+
+//#ifndef WNT
+//  #define COMPILATION_CORRECTION
+//#endif
+
+// 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); // using equal instead of sigma
+
+
+SketcherPrs_DimensionStyle::DimensionValue::DimensionValue(double theDoubleValue,
+                                     bool theHasParameters, const std::string& theTextValue)
+: myDoubleValue(theDoubleValue),
+  myHasParameters(theHasParameters),
+  myTextValue(theTextValue)
+{
+}
+
+void SketcherPrs_DimensionStyle::DimensionValue::init(
+                                                const AttributeDoublePtr& theAttributeValue)
+{
+  myDoubleValue = theAttributeValue->value();
+  myHasParameters = theAttributeValue->usedParameters().size() > 0;
+  myTextValue = theAttributeValue->text();
+}
+
+SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle()
+{
+}
+
+SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle()
+{
+}
+
+void SketcherPrs_DimensionStyle::updateDimensions(AIS_Dimension* theDimension,
+          const SketcherPrs_DimensionStyle::DimensionValue& theDimensionValue)
+{
+  if (!theDimension)
+    return;
+  updateDimensions(theDimension, theDimensionValue.myHasParameters,
+                   theDimensionValue.myTextValue, theDimensionValue.myDoubleValue);
+}
+
+void SketcherPrs_DimensionStyle::updateDimensions(AIS_Dimension* theDimension,
+                                                          const bool theHasParameters,
+                                                          const std::string& theTextValue,
+                                                          const double theDoubleValue)
+{
+  if (!theDimension)
+    return;
+
+  /// do not show special symbols of dimension:
+  ///   previous implementation did not allow to unite them
+  theDimension->SetSpecialSymbol(MyEmptySymbol);
+  theDimension->SetDisplaySpecialSymbol(AIS_DSS_No);
+
+  TCollection_ExtendedString aCustomValue;
+  if (theHasParameters) {
+    //bool isParameterTextStyle = myStyle == SketcherPrs_ParameterStyleMessage::ParameterText;
+    bool isParameterTextStyle =
+      SketcherPrs_Tools::parameterStyle() == SketcherPrs_Tools::ParameterText;
+
+    if (isParameterTextStyle)
+      aCustomValue = theTextValue.c_str();
+    else {
+      // format value string using "sprintf"
+      TCollection_AsciiString aFormatStr =
+        theDimension->Attributes()->DimensionAspect()->ValueStringFormat();
+      char aFmtBuffer[256];
+      sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue);
+      aCustomValue = TCollection_ExtendedString (aFmtBuffer);
+
+      aCustomValue.Insert (1, MySigmaSymbol);
+    }
+  }
+  else {
+    // format value string using "sprintf"
+    TCollection_AsciiString aFormatStr =
+      theDimension->Attributes()->DimensionAspect()->ValueStringFormat();
+    char aFmtBuffer[256];
+    sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue);
+    aCustomValue = TCollection_ExtendedString (aFmtBuffer);
+  }
+#ifdef COMPILATION_CORRECTION
+  theDimension->SetCustomValue(theDoubleValue);
+#else
+  theDimension->SetCustomValue(aCustomValue);
+#endif
+}
diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyle.h b/src/SketcherPrs/SketcherPrs_DimensionStyle.h
new file mode 100644 (file)
index 0000000..47be050
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SketcherPrs_DimensionStyleListener_H
+#define SketcherPrs_DimensionStyleListener_H
+
+//#include <Events_Listener.h>
+
+#include <ModelAPI_AttributeDouble.h>
+
+#include "SketcherPrs_Tools.h"
+
+#include <Standard.hxx>
+
+#include <string>
+
+/**
+* \class SketcherPrs_DimensionStyleListener
+* \ingroup GUI
+* A class for representation of linear dimension constraint.
+* It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
+*/
+class SketcherPrs_DimensionStyle
+{
+public:
+  class DimensionValue {
+  public:
+    DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue);
+    /// Fills internal fields by the given attribute
+    /// \param theAttributeValue a model attribute
+    void init(const AttributeDoublePtr& theAttributeValue);
+
+  public:
+    double myDoubleValue; ///< the angle value to be shown as custom value of presentation
+    bool myHasParameters; ///< true if the atrribute value has used parameters
+    std::string myTextValue; ///< the angle value depending on angle type
+  };
+
+public:
+  /// Constructor
+  Standard_EXPORT SketcherPrs_DimensionStyle();
+
+  /// Destructor
+  Standard_EXPORT ~SketcherPrs_DimensionStyle();
+
+  /// Visualizes the dimension text or dimension value depending on the has parameters state
+  /// \param theDimension a modified dimension
+  /// \param theDimensionValue container filled by the model double attribute
+  Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension,
+                                        const DimensionValue& theDimensionValue);
+
+private:
+  /// Visualizes the dimension text or dimension value depending on the has parameters state
+  /// \param theDimension a modified dimension
+  /// \param theHasParameters if true, the text is shown, else digit
+  /// \param theTextValue a dimension text value
+  /// \param theDoubleValue a dimension digit value
+  void updateDimensions(AIS_Dimension* theDimension,
+                        const bool theHasParameters,
+                        const std::string& theTextValue,
+                        const double theDoubleValue);
+};
+
+#endif
\ No newline at end of file
diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp b/src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp
deleted file mode 100644 (file)
index e00f81a..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include "SketcherPrs_DimensionStyleListener.h"
-#include <Prs3d_DimensionAspect.hxx>
-#include "SketcherPrs_Tools.h"
-
-#include <Events_Loop.h>
-
-#include <AIS_Dimension.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-//#ifndef WNT
-//  #define COMPILATION_CORRECTION
-//#endif
-
-// 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); // using equal instead of sigma
-
-SketcherPrs_DimensionStyleListener::DimensionValue::DimensionValue(double theDoubleValue,
-                                     bool theHasParameters, const std::string& theTextValue)
-: myDoubleValue(theDoubleValue),
-  myHasParameters(theHasParameters),
-  myTextValue(theTextValue)
-{
-}
-
-void SketcherPrs_DimensionStyleListener::DimensionValue::init(
-                                                const AttributeDoublePtr& theAttributeValue)
-{
-  myDoubleValue = theAttributeValue->value();
-  myHasParameters = theAttributeValue->usedParameters().size() > 0;
-  myTextValue = theAttributeValue->text();
-}
-
-SketcherPrs_DimensionStyleListener::SketcherPrs_DimensionStyleListener()
-{
-  Events_Loop* aLoop = Events_Loop::loop();
-  const Events_ID kDocCreatedEvent =
-                SketcherPrs_ParameterStyleMessage::eventId();
-  aLoop->registerListener(this, kDocCreatedEvent, NULL, false);
-}
-
-SketcherPrs_DimensionStyleListener::~SketcherPrs_DimensionStyleListener()
-{
-  Events_Loop* aLoop = Events_Loop::loop();
-  aLoop->removeListener(this);
-}
-
-void SketcherPrs_DimensionStyleListener::processEvent(
-  const std::shared_ptr<Events_Message>& theMessage)
-{
-  const Events_ID kParameterStyleEvent = SketcherPrs_ParameterStyleMessage::eventId();
-  if (theMessage->eventID() == kParameterStyleEvent) {
-    std::shared_ptr<SketcherPrs_ParameterStyleMessage> aMessage = std::dynamic_pointer_cast<
-                                            SketcherPrs_ParameterStyleMessage>(theMessage);
-    myStyle = aMessage->style();
-  }
-}
-
-void SketcherPrs_DimensionStyleListener::updateDimensions(AIS_Dimension* theDimension,
-          const SketcherPrs_DimensionStyleListener::DimensionValue& theDimensionValue)
-{
-  if (!theDimension)
-    return;
-  updateDimensions(theDimension, theDimensionValue.myHasParameters,
-                   theDimensionValue.myTextValue, theDimensionValue.myDoubleValue);
-}
-
-void SketcherPrs_DimensionStyleListener::updateDimensions(AIS_Dimension* theDimension,
-                                                          const bool theHasParameters,
-                                                          const std::string& theTextValue,
-                                                          const double theDoubleValue)
-{
-  if (!theDimension)
-    return;
-
-  /// do not show special symbols of dimension: previous implementation did not allow to unite them
-  theDimension->SetSpecialSymbol(MyEmptySymbol);
-  theDimension->SetDisplaySpecialSymbol(AIS_DSS_No);
-
-  TCollection_ExtendedString aCustomValue;
-  if (theHasParameters) {
-    bool isParameterTextStyle = myStyle == SketcherPrs_ParameterStyleMessage::ParameterText;
-
-    if (isParameterTextStyle)
-      aCustomValue = theTextValue.c_str();
-    else {
-      // format value string using "sprintf"
-      TCollection_AsciiString aFormatStr =
-        theDimension->Attributes()->DimensionAspect()->ValueStringFormat();
-      char aFmtBuffer[256];
-      sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue);
-      aCustomValue = TCollection_ExtendedString (aFmtBuffer);
-
-      aCustomValue.Insert (1, MySigmaSymbol);
-    }
-  }
-  else {
-    // format value string using "sprintf"
-    TCollection_AsciiString aFormatStr =
-      theDimension->Attributes()->DimensionAspect()->ValueStringFormat();
-    char aFmtBuffer[256];
-    sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue);
-    aCustomValue = TCollection_ExtendedString (aFmtBuffer);
-  }
-#ifdef COMPILATION_CORRECTION
-  theDimension->SetCustomValue(theDoubleValue);
-#else
-  theDimension->SetCustomValue(aCustomValue);
-#endif
-}
-
diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyleListener.h b/src/SketcherPrs/SketcherPrs_DimensionStyleListener.h
deleted file mode 100644 (file)
index 5e62399..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef SketcherPrs_DimensionStyleListener_H
-#define SketcherPrs_DimensionStyleListener_H
-
-#include <Events_Listener.h>
-
-#include <ModelAPI_AttributeDouble.h>
-
-#include "SketcherPrs_Tools.h"
-
-#include <Standard.hxx>
-
-#include <string>
-
-/**
-* \class SketcherPrs_DimensionStyleListener
-* \ingroup GUI
-* A class for representation of linear dimension constraint.
-* It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
-*/
-class SketcherPrs_DimensionStyleListener : public Events_Listener
-{
-public:
-  class DimensionValue {
-  public:
-    DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue);
-    /// Fills internal fields by the given attribute
-    /// \param theAttributeValue a model attribute
-    void init(const AttributeDoublePtr& theAttributeValue);
-
-  public:
-    double myDoubleValue; ///< the angle value to be shown as custom value of presentation
-    bool myHasParameters; ///< true if the atrribute value has used parameters
-    std::string myTextValue; ///< the angle value depending on angle type
-  };
-
-public:
-  /// Constructor
-  Standard_EXPORT SketcherPrs_DimensionStyleListener();
-
-  /// Destructor
-  Standard_EXPORT ~SketcherPrs_DimensionStyleListener();
-
-  /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
-  /// from the message with origin and planes
-  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
-
-  /// Visualizes the dimension text or dimension value depending on the has parameters state
-  /// \param theDimension a modified dimension
-  /// \param theDimensionValue container filled by the model double attribute
-  Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension,
-                                        const DimensionValue& theDimensionValue);
-
-private:
-  /// Visualizes the dimension text or dimension value depending on the has parameters state
-  /// \param theDimension a modified dimension
-  /// \param theHasParameters if true, the text is shown, else digit
-  /// \param theTextValue a dimension text value
-  /// \param theDoubleValue a dimension digit value
-  void updateDimensions(AIS_Dimension* theDimension,
-                        const bool theHasParameters,
-                        const std::string& theTextValue,
-                        const double theDoubleValue);
-private:
-  /// Style how the parameter of dimension should be visualized
-  SketcherPrs_ParameterStyleMessage::ParameterStyle myStyle;
-};
-
-#endif
\ No newline at end of file
index b15f0d05f0459ece2a964e17187769c4d103cbcb..de9d7e7520178e039c1b7e6605d0d9c400d320b3 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "SketcherPrs_LengthDimension.h"
 #include "SketcherPrs_Tools.h"
-#include "SketcherPrs_DimensionStyleListener.h"
+#include "SketcherPrs_DimensionStyle.h"
 
 #include <SketchPlugin_Constraint.h>
 #include <SketchPlugin_ConstraintLength.h>
@@ -120,7 +120,7 @@ SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theCo
   myValue(0., false, "")
 {
   SetDimensionAspect(createDimensionAspect());
-  myStyleListener = new SketcherPrs_DimensionStyleListener();
+  myStyleListener = new SketcherPrs_DimensionStyle();
 
   setDirection(theConstraint, plane());
 }
index 43a27c71787e7f746145e5b38af1c86f395a7048..b737488fa566497d95df49b744fd62d7f9278c3c 100644 (file)
@@ -30,7 +30,7 @@
 #include <gp_Pln.hxx>
 #include <string>
 
-#include <SketcherPrs_DimensionStyleListener.h>
+#include <SketcherPrs_DimensionStyle.h>
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
 
@@ -96,7 +96,7 @@ private:
   //Handle(Prs3d_DimensionAspect) myAspect;
 
   /// Listener to update dimension visualization style
-  SketcherPrs_DimensionStyleListener* myStyleListener;
+  SketcherPrs_DimensionStyle* myStyleListener;
 
   /// container of values obtained from the constraint, which are necessary
   /// to fill the presentation
@@ -106,7 +106,7 @@ private:
   double myDistance; ///< the flyout distance
 
   /// the structure filled by constraint
-  SketcherPrs_DimensionStyleListener::DimensionValue myValue;
+  SketcherPrs_DimensionStyle::DimensionValue myValue;
 };
 
 #endif
\ No newline at end of file
index bd10874fcd469eca67559649a633c3767eaea594..5b94a63de3db61aafd2a09326ef0baa3468c4c2b 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "SketcherPrs_Radius.h"
 #include "SketcherPrs_Tools.h"
-#include "SketcherPrs_DimensionStyleListener.h"
+#include "SketcherPrs_DimensionStyle.h"
 
 #include <SketchPlugin_ConstraintRadius.h>
 #include <SketchPlugin_Constraint.h>
@@ -59,7 +59,7 @@ SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
   myValue(1, false, "")
 {
   SetDimensionAspect(createDimensionAspect());
-  myStyleListener = new SketcherPrs_DimensionStyleListener();
+  myStyleListener = new SketcherPrs_DimensionStyle();
 }
 
 SketcherPrs_Radius::~SketcherPrs_Radius()
index a6fbe75e9227e91fac4e1954c7c8eafe368661e4..e675e24e0a3836ace77b5cea6d513282928395a6 100644 (file)
@@ -27,7 +27,7 @@
 #include <AIS_RadiusDimension.hxx>
 #include <Standard_DefineHandle.hxx>
 
-#include <SketcherPrs_DimensionStyleListener.h>
+#include <SketcherPrs_DimensionStyle.h>
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension)
 
@@ -91,13 +91,13 @@ private:
   SketchPlugin_Sketch* mySketcher;
 
   /// Listener to update dimension visualization style
-  SketcherPrs_DimensionStyleListener* myStyleListener;
+  SketcherPrs_DimensionStyle* myStyleListener;
 
   /// container of values obtained from the constraint, which are necessary to fill the presentation
   gp_Circ myCircle; ///< the radius circle
   gp_Pnt myAnchorPoint; ///< an ancor for the radius value visualization
 
-  SketcherPrs_DimensionStyleListener::DimensionValue myValue; /// the structure filled by constraint
+  SketcherPrs_DimensionStyle::DimensionValue myValue; /// the structure filled by constraint
 };
 
 #endif
\ No newline at end of file
index 8b32e6944878444f03ae9722d5a7931c91f30645..2de9b6c82617b8f9785a69587131f0a18484e5fd 100644 (file)
 
 namespace SketcherPrs_Tools {
 
+static ParameterStyle MyStyle = ParameterValue;
+
+void setParameterStyle(ParameterStyle theStyle)
+{
+  MyStyle = theStyle;
+}
+
+ParameterStyle parameterStyle()
+{
+  return MyStyle;
+}
+
 AttributePtr getAttribute(ModelAPI_Feature* theFeature, const std::string& theAttrName)
 {
   AttributePtr anAttribute;
@@ -369,17 +381,6 @@ std::shared_ptr<GeomAPI_Pnt> getAnchorPoint(const ModelAPI_Feature* theConstrain
   return thePlane->to3D(aFlyoutPnt->x(), aFlyoutPnt->y());
 }
 
-void sendExpressionShownEvent(const bool& theState)
-{
-  static Events_ID anId = SketcherPrs_ParameterStyleMessage::eventId();
-  std::shared_ptr<SketcherPrs_ParameterStyleMessage> aMessage = std::shared_ptr
-    <SketcherPrs_ParameterStyleMessage>(new SketcherPrs_ParameterStyleMessage(anId, 0));
-  aMessage->setStyle(theState ? SketcherPrs_ParameterStyleMessage::ParameterText
-                              : SketcherPrs_ParameterStyleMessage::ParameterValue);
-  Events_Loop::loop()->send(aMessage);
-  Events_Loop::loop()->flush(anId);
-}
-
 void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError)
 {
   Events_InfoMessage("SketcherPrs_Tools",
index 5a719646c22e8c46447befffb461f15fbf6ab329..0b075f581b59bbba9440bd6ceaaed46080dce185 100644 (file)
 class GeomDataAPI_Point2D;
 class AIS_Dimension;
 
-//#define MyTextHeight 20
+namespace SketcherPrs_Tools {
 
-/// Message that style of visualization of parameter is changed.
-/// It will be shown as expression or value
-class SketcherPrs_ParameterStyleMessage : public Events_Message
-{
-public:
   /// \enum ParameterStyle lists styles of parameter
   enum ParameterStyle {
     ParameterValue, ///< using symbol with the parameter value
     ParameterText ///< using parameter text
   };
 
-public:
-  /// Creates an empty message
-  SKETCHERPRS_EXPORT SketcherPrs_ParameterStyleMessage(const Events_ID theID,
-                                                    const void* theSender = 0)
-  : Events_Message(theID, theSender) {}
-  /// The virtual destructor
-  SKETCHERPRS_EXPORT virtual ~SketcherPrs_ParameterStyleMessage() {}
-  /// Static. Returns EventID of the message.
-  SKETCHERPRS_EXPORT static Events_ID eventId()
-  {
-    static const char * MY_EVENT_PARAMETER_STYLE_ID("ParameterStyle");
-    return Events_Loop::eventByName(MY_EVENT_PARAMETER_STYLE_ID);
-  }
-  /// Returns a document stored in the message
-  SKETCHERPRS_EXPORT ParameterStyle style() const { return myStyle; }
-  /// Sets a document to the message
-  SKETCHERPRS_EXPORT void setStyle(ParameterStyle theStyle) { myStyle = theStyle; }
-private:
-  ParameterStyle myStyle; /// style of the parameter visualization
-};
+  /// Set dimensions parameters style
+  /// \param theStyle new style
+  SKETCHERPRS_EXPORT void setParameterStyle(ParameterStyle theStyle);
 
-namespace SketcherPrs_Tools {
+  /// Return dimensions parameters style
+  SKETCHERPRS_EXPORT ParameterStyle parameterStyle();
 
   /// Enumeration with modes for activation of selection custom presentations
   enum SelectionModes {
@@ -196,11 +175,6 @@ namespace SketcherPrs_Tools {
                                               const ModelAPI_Feature* theConstraint,
                                               const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
-  /// Sends event about expression visualization type is changed for dimension presentations
-  /// Sends event to redisplay all sub-features of composite feature
-  /// \param theState a new state
-  SKETCHERPRS_EXPORT void sendExpressionShownEvent(const bool& theState);
-
   /// Throws an exception(in debug mode) and sends a signal about necessity to hide the object
   /// \param theFeature a feature where AIS presentation is empty
   /// \param theError a debug error information