]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#816 In multi-rotation, be able to put the total angle or the step angle (Rotation...
authornds <nds@opencascade.com>
Mon, 9 Nov 2015 08:59:51 +0000 (11:59 +0300)
committernds <nds@opencascade.com>
Mon, 9 Nov 2015 08:59:51 +0000 (11:59 +0300)
Realization for Translation
Correction for right focus change after the end point in the create operation selection. Later, it could be corrected if there is an alternative method to validators->isCase() is implemented. It should answer which controls are visible. It is important here, where the same attributes can be used in both switch cases but we do not like to focus those, which are not currently being used.

src/SketchPlugin/SketchPlugin_MultiTranslation.cpp
src/SketchPlugin/SketchPlugin_MultiTranslation.h
src/SketchPlugin/plugin-Sketch.xml

index 9c7994384d813b9e88d1afd2211e7c53c0b99ed1..c94ae2dca77d3b18156a408b641293167339aa0b 100755 (executable)
@@ -31,6 +31,7 @@ void SketchPlugin_MultiTranslation::initAttributes()
   data()->addAttribute(VALUE_TYPE(),   ModelAPI_AttributeString::typeId());
 
   data()->addAttribute(START_POINT_ID(), GeomDataAPI_Point2D::typeId());
+  data()->addAttribute(START_FULL_POINT_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(END_POINT_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(END_FULL_POINT_ID(), GeomDataAPI_Point2D::typeId());
   data()->addAttribute(NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger::typeId());
@@ -272,6 +273,24 @@ void SketchPlugin_MultiTranslation::attributeChanged(const std::string& theID)
         data()->attribute(SketchPlugin_Constraint::ENTITY_B()))->clear();
     }
   }
+  else if (theID == START_POINT_ID() && !myBlockValue) {
+    myBlockValue = true;
+    std::shared_ptr<GeomDataAPI_Point2D> aStartPoint = 
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_POINT_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aStartFullPoint = 
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_FULL_POINT_ID()));
+    aStartFullPoint->setValue(aStartPoint->pnt());
+    myBlockValue = false;
+  }
+  else if (theID == START_FULL_POINT_ID() && !myBlockValue) {
+    myBlockValue = true;
+    std::shared_ptr<GeomDataAPI_Point2D> aStartPoint = 
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_POINT_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aStartFullPoint = 
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_FULL_POINT_ID()));
+    aStartPoint->setValue(aStartFullPoint->pnt());
+    myBlockValue = false;
+  }
   else if (theID == END_POINT_ID() && !myBlockValue) {
     int aNbCopies = integer(NUMBER_OF_OBJECTS_ID())->value() - 1;
     if (aNbCopies > 0) {
index ed9a8f878ff8e62880fcd8c74f7d53097e8490a6..b9d44214d7f980837841a29d2d67c69928de0600 100644 (file)
@@ -59,6 +59,13 @@ class SketchPlugin_MultiTranslation : public SketchPlugin_ConstraintBase
     static const std::string MY_START_POINT_ID("MultiTranslationStartPoint");
     return MY_START_POINT_ID;
   }
+  /// Start point of translation
+  inline static const std::string& START_FULL_POINT_ID()
+  {
+    static const std::string MY_START_FULL_POINT_ID("MultiTranslationFullStartPoint");
+    return MY_START_FULL_POINT_ID;
+  }
+
   /// End point of translation
   inline static const std::string& END_POINT_ID()
   {
index e728cf7cc7d982755e524c961e0aa119050888b5..a1986c159bced41d5679d563f392655c91257338 100644 (file)
           <box id="FullValue" title="Full value" icon=":icons/translate_full_32x32.png">
             <groupbox title="Direction">
               <sketch-2dpoint_selector
-                  id="MultiTranslationStartPoint"
+                  id="MultiTranslationFullStartPoint"
                   title="Start point"
                   tooltip="Start point of translation"/>
               <sketch-2dpoint_selector