]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Visualize feature result in green when the create/edit operation for the feature...
authornds <nds@opencascade.com>
Tue, 1 Sep 2015 13:21:23 +0000 (16:21 +0300)
committernds <nds@opencascade.com>
Tue, 1 Sep 2015 13:21:47 +0000 (16:21 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_OperationPrs.h

index 39ace8d4c22a143288a7046eec3ed1b0725dc3c2..1e3a612d726e843498df2ed1db5a8aa455a63165 100755 (executable)
@@ -301,6 +301,15 @@ void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation)
     myCustomPrs->activate(aFOperation->feature());
 }
 
+void PartSet_Module::onOperationResumed(ModuleBase_Operation* theOperation)
+{
+  ModuleBase_IModule::onOperationResumed(theOperation);
+
+  ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+  if (aFOperation)
+    myCustomPrs->activate(aFOperation->feature());
+}
+
 void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
 {
   myCustomPrs->deactivate();
index 1fb0d38815d76979278b15c96ec1abda2c0dfb15..054e3160e91afe6257b51018640e449bd9fb4cef 100644 (file)
@@ -71,9 +71,15 @@ public:
 
   /// Realizes some functionality by an operation start
   /// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters
+  /// Activate the operation presentation
   /// \param theOperation a started operation
   virtual void onOperationStarted(ModuleBase_Operation* theOperation);
 
+  /// Realizes some functionality by an operation resume
+  /// Activate the operation presentation
+  /// \param theOperation a resumed operation
+  virtual void onOperationResumed(ModuleBase_Operation* theOperation);
+
   /// Realizes some functionality by an operation commit
   /// Restarts sketcher operation automatically of it is necessary
   /// \param theOperation a committed operation
index d20041e43aa7b97aca301a2f3868e09d78a65580..3eae8f9a32260496190a80e15c15290ad9526af5 100755 (executable)
@@ -65,12 +65,19 @@ void PartSet_OperationPrs::updateShapes()
 {
   myFeatureShapes.clear();
   getFeatureShapes(myFeatureShapes);
+
+  myFeatureResults.clear();
+  if (myFeature)
+    myFeatureResults = myFeature->results();
 }
 
 void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
                                    const Handle(Prs3d_Presentation)& thePresentation, 
                                    const Standard_Integer theMode)
 {
+  Quantity_Color aColor(1., 1., 0., Quantity_TOC_RGB); // yellow
+  SetColor(aColor);
+
   thePresentation->Clear();
   XGUI_Displayer* aDisplayer = workshop()->displayer();
 
@@ -94,6 +101,24 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
       StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
     }
   }
+
+  aColor = Quantity_Color(0., 1., 0., Quantity_TOC_RGB); // green
+  SetColor(aColor);
+
+  std::list<ResultPtr>::const_iterator aRIt = myFeatureResults.begin(),
+                                       aRLast = myFeatureResults.end();
+  for (; aRIt != aRLast; aRIt++) {
+    ResultPtr aResult = *aRIt;
+    if (!isVisible(aDisplayer, aResult))
+      continue;
+    GeomShapePtr aGeomShape = aResult->shape();
+    if (!aGeomShape.get())
+      continue;
+    TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
+    // change deviation coefficient to provide more precise circle
+    ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
+    StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
+  }
 }
 
 void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
index ea645140ce9f0f9810db282dd36088ffb186010e..935e4936d112f84a5002f0fc7241c13b763bd309 100755 (executable)
@@ -11,6 +11,7 @@
 
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
 #include <ModelAPI_Attribute.h>
 
 #include <ModuleBase_IWorkshop.h>
@@ -23,6 +24,8 @@
 #include <QMap>
 #include <QList>
 
+#include <list>
+
 DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
 
 class XGUI_Workshop;
@@ -93,7 +96,8 @@ private:
 private:
   ModuleBase_IWorkshop* myWorkshop;
   FeaturePtr myFeature; /// Reference to a feature object
-  QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes;
+  QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
+  std::list<ResultPtr> myFeatureResults; /// visualized feature results
 };