From f5ddae43cdb88e20e6fe3e0efc7f1751a39f216c Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 1 Jul 2015 15:17:41 +0300 Subject: [PATCH] Issue #591 - Highlight of the first argument of constraints Crash fix in sketch manager when find a dected owner. --- src/PartSet/PartSet_CustomPrs.cpp | 11 +++++++---- src/PartSet/PartSet_CustomPrs.h | 10 +++++++--- src/PartSet/PartSet_Module.cpp | 4 ++-- src/PartSet/PartSet_Module.h | 4 ++-- src/PartSet/PartSet_OperationPrs.cpp | 20 ++++++++++++-------- src/PartSet/PartSet_OperationPrs.h | 8 +++++++- src/PartSet/PartSet_SketcherMgr.cpp | 2 +- 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index 3ae846074..2990969e9 100755 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -27,11 +27,14 @@ PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop) { + Handle(PartSet_OperationPrs) myOperationPrs = new PartSet_OperationPrs(); /// AIS presentation for the feature of operation } -void PartSet_CustomPrs::setCustomized(const ObjectPtr& theObject) +void PartSet_CustomPrs::setCustomized(const FeaturePtr& theFeature) { -/* QMap > aNewCustomized; + + myOperationPrs->setFeature(theFeature); + /* QMap > aNewCustomized; QList aShapeList; ResultPtr aResult = std::dynamic_pointer_cast(theObject); @@ -117,7 +120,7 @@ bool PartSet_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr std::shared_ptr theCustomPrs) { bool isDone = false; - if (myCustomized.contains(theResult)) { + /*if (myCustomized.contains(theResult)) { std::vector aColor = Config_PropManager::color("Visualization", "operation_parameter_color", OPERATION_PARAMETER_COLOR); isDone = thePrs->setColor(aColor[0], aColor[1], aColor[2]); @@ -136,7 +139,7 @@ bool PartSet_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr } } } - thePrs->setPointMarker(5, 5.); // Set point as a '+' symbol*/ + thePrs->setPointMarker(5, 5.); // Set point as a '+' symbol*+/ } /* std::vector aColor; diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index df17bea09..6d23847da 100755 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -8,9 +8,11 @@ #define PartSet_CustomPrs_H #include "PartSet.h" +#include "PartSet_OperationPrs.h" #include #include +#include #include #include @@ -31,15 +33,17 @@ public: PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop); PARTSET_EXPORT virtual ~PartSet_CustomPrs() {}; - void setCustomized(const ObjectPtr& theObject); + /// Set the feature is customized + /// \param theObject a feature object + void setCustomized(const FeaturePtr& theObject); /// Modifies the given presentation in the custom way. virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, std::shared_ptr theCustomPrs); private: ModuleBase_IWorkshop* myWorkshop; /// current workshop - - QMap > myCustomized; /// objects, which are customized + Handle(PartSet_OperationPrs) myOperationPrs; /// AIS presentation for the feature of operation + //QMap > myCustomized; /// objects, which are customized }; #endif diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index e6ee9c5b7..cc9afc0d8 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -720,12 +720,12 @@ void PartSet_Module::onViewTransformed(int theTrsfType) aDisplayer->updateViewer(); } -void PartSet_Module::setCustomized(const ObjectPtr& theObject) +void PartSet_Module::setCustomized(const FeaturePtr& theFeature) { std::shared_ptr aCustomPrs = std::dynamic_pointer_cast(myCustomPrs); if (aCustomPrs.get()) - aCustomPrs->setCustomized(theObject); + aCustomPrs->setCustomized(theFeature); } bool PartSet_Module::customizeObject(ObjectPtr theObject) diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 3f9dd010e..ee0595b13 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -145,8 +145,8 @@ public: virtual void processEvent(const std::shared_ptr& theMessage); /// Set the object with the object results are customized - /// \param theObject an object - void setCustomized(const ObjectPtr& theObject); + /// \param theFeature a feature + void setCustomized(const FeaturePtr& theFeature); /** Update the object presentable properties such as color, lines width and other * If the object is result with the color attribute value set, it is used, diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 6bcdb1c16..4539ebbd2 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -6,19 +6,23 @@ #include "PartSet_OperationPrs.h" -#include -#include -#include +//#include +//#include +//#include -#include -#include -#include +//#include +//#include +//#include IMPLEMENT_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape); IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape); -PartSet_OperationPrs::PartSet_OperationPrs(FeaturePtr theFeature) - : ViewerData_AISShape(TopoDS_Shape()), myFeature(theFeature) +PartSet_OperationPrs::PartSet_OperationPrs() + : ViewerData_AISShape(TopoDS_Shape()), myFeature(FeaturePtr()) +{ +} + +void PartSet_OperationPrs::setFeature(FeaturePtr theFeature) { /* std::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); std::shared_ptr aWirePtr = diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h index 9d2cc93b0..e15365101 100755 --- a/src/PartSet/PartSet_OperationPrs.h +++ b/src/PartSet/PartSet_OperationPrs.h @@ -27,9 +27,15 @@ class PartSet_OperationPrs : public ViewerData_AISShape public: /// Constructor /// \param theResult a result object - Standard_EXPORT PartSet_OperationPrs(FeaturePtr theFeature); + Standard_EXPORT PartSet_OperationPrs(); + + /// set the operation feature. It is used in Compute method to group the feature parameter shapes + /// theFeature a feature + void setFeature(FeaturePtr theFeature); + DEFINE_STANDARD_RTTI(PartSet_OperationPrs) + protected: /// Redefinition of virtual function Standard_EXPORT virtual void Compute( diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index cb21c0190..e0c1940c9 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -834,7 +834,7 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp) myIsMouseOverViewProcessed = true; operationMgr()->onValidateOperation(); - myModule->setCustomized(ObjectPtr()); + myModule->setCustomized(FeaturePtr()); } void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation) -- 2.39.2