]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Debug modification for translation/rotate argument visualization, not completed.
authornds <nds@opencascade.com>
Thu, 18 Feb 2016 13:34:19 +0000 (16:34 +0300)
committernds <nds@opencascade.com>
Thu, 18 Feb 2016 13:34:19 +0000 (16:34 +0300)
1. Hide translate/rotate presentation if point is deselected.
2. Do not show copied feature as an argument
Todo: hide copied lines in case 1.

src/PartSet/PartSet_OperationPrs.cpp
src/SketcherPrs/SketcherPrs_Transformation.cpp

index 1b4491e6d59a870e7dc7847279ab360faa75b33d..99e5e1624e134f24be3dc736784b9b27bd436a39 100755 (executable)
 
 static const int AIS_DEFAULT_WIDTH = 2;
 
+//#define DEBUG_HIDE_COPY_ATTRIBUTE
+
+#ifdef DEBUG_HIDE_COPY_ATTRIBUTE
+#include <ModelAPI_AttributeBoolean.h>
+#include <SketchPlugin_SketchEntity.h>
+#endif
+
 IMPLEMENT_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape);
 IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape);
 
@@ -180,9 +187,21 @@ void addValue(const ObjectPtr& theObject, const GeomShapePtr& theShape,
         }
         return;
       }
+#ifdef DEBUG_HIDE_COPY_ATTRIBUTE
+      else {
+        FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+        if (aFeature.get()) {
+          AttributeBooleanPtr aCopyAttr = aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID());
+          if (aCopyAttr.get()) {
+            bool isCopy = aCopyAttr->value();
+            if (isCopy)
+              return;
+          }
+        }
+      }
+#endif
     }
 
-
     GeomShapePtr aShape = theShape;
     if (!aShape.get()) {
       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
index 347f8c3578b9358717c1c6b8baaa365613acd689..d9dc0ab7fe38d05ef68343014733d17bfa721ee8 100644 (file)
@@ -48,6 +48,24 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain
 
   int aNbB = anAttrB->size();
   aReadyToDisplay = aNbB > 0;
+
+#ifdef DEBUG_HIDE_COPY_ATTRIBUTE
+  // additional check
+  if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
+    // If it is translation
+    AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData,
+                                            SketchPlugin_MultiTranslation::START_POINT_ID());
+    AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData,
+                                            SketchPlugin_MultiTranslation::END_POINT_ID());
+
+    aReadyToDisplay = aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized();
+  }
+  else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
+    // if it is rotation
+    AttributePoint2DPtr aCenter = GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID());
+    aReadyToDisplay = aCenter.get() && aCenter->isInitialized();
+  }
+#endif
   return aReadyToDisplay;
 }