From: nds Date: Tue, 1 Sep 2015 13:21:23 +0000 (+0300) Subject: Visualize feature result in green when the create/edit operation for the feature... X-Git-Tag: V_1.4.0_beta4~169 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c1a412473622b7fe884ec5c4476f2ce9c012d88;p=modules%2Fshaper.git Visualize feature result in green when the create/edit operation for the feature is started. --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 39ace8d4c..1e3a612d7 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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(theOperation); + if (aFOperation) + myCustomPrs->activate(aFOperation->feature()); +} + void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) { myCustomPrs->deactivate(); diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 1fb0d3881..054e3160e 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -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 diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index d20041e43..3eae8f9a3 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -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::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(); + // 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, diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h index ea645140c..935e4936d 100755 --- a/src/PartSet/PartSet_OperationPrs.h +++ b/src/PartSet/PartSet_OperationPrs.h @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -23,6 +24,8 @@ #include #include +#include + 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 > myFeatureShapes; + QMap > myFeatureShapes; /// visualized shapes + std::list myFeatureResults; /// visualized feature results };