]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for selection of translation and rotation constraints
authordbv <dbv@opencascade.com>
Tue, 16 Jun 2015 20:47:45 +0000 (23:47 +0300)
committerdbv <dbv@opencascade.com>
Tue, 16 Jun 2015 20:47:45 +0000 (23:47 +0300)
src/SketcherPrs/SketcherPrs_Transformation.cpp

index 47f32f7b550213e411718ed771ad3de8e7a5f604..02a326bfe1a61fe308f865b538bdf661c2226355 100644 (file)
@@ -9,6 +9,9 @@
 #include "SketcherPrs_PositionMgr.h"
 
 #include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_MultiRotation.h>
+#include <SketchPlugin_MultiTranslation.h>
+#include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeRefList.h>
 
 #include <Graphic3d_AspectLine3d.hxx>
@@ -26,6 +29,14 @@ SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theCons
                                            bool isTranslation) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation)
 {
+  int aPointsNb = 0;
+  if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
+    aPointsNb = theConstraint->integer(SketchPlugin_MultiTranslation::NUMBER_OF_COPIES_ID())->value();
+  } else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
+    aPointsNb = theConstraint->integer(SketchPlugin_MultiRotation::NUMBER_OF_COPIES_ID())->value();
+  }
+  aPointsNb == 0 ? aPointsNb = 2 : aPointsNb++; // by default we have 2 points for symbols
+  myPntArray = new Graphic3d_ArrayOfPoints(aPointsNb);
 }  
 
 bool SketcherPrs_Transformation::updatePoints(double theStep) const 
@@ -40,7 +51,6 @@ bool SketcherPrs_Transformation::updatePoints(double theStep) const
     return false;
 
   SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
-  myPntArray = new Graphic3d_ArrayOfPoints(aNbB);
 
   int i;
   ObjectPtr aObj;