From: nds Date: Mon, 6 Jul 2015 10:47:42 +0000 (+0300) Subject: Issue #710 fillet is wrong X-Git-Tag: V_1.3.0~102 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6e73ccbe5ba45c2f6c1c7513ea20b502b245e2c8;p=modules%2Fshaper.git Issue #710 fillet is wrong a correction in customize object. There was a regression when saving the customized boolean result value. --- diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index f3e47d855..f77d5674a 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -148,9 +148,8 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject * If the object is result with the color attribute value set, it is used, * otherwise the customize is applyed to the object's feature if it is a custom prs * \param theObject an object instance - * \return the true state if there is changes and the presentation is customized */ - virtual bool customizeObject(ObjectPtr theObject) { return false; } + virtual void customizeObject(ObjectPtr theObject) {} /// This method is called on object browser creation for customisation of module specific features /// \param theObjectBrowser a pinter on Object Browser widget diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index a90b634ac..aedc188b5 100755 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -98,26 +98,18 @@ Handle(PartSet_OperationPrs) PartSet_CustomPrs::getPresentation() const return Handle(PartSet_OperationPrs)::DownCast(anAISIO); } -bool PartSet_CustomPrs::customize(const ObjectPtr& theObject) +void PartSet_CustomPrs::customize(const ObjectPtr& theObject) { // the presentation should be recomputed if the previous AIS depend on the result // [it should be hiddend] or the new AIS depend on it [it should be visualized] Handle(PartSet_OperationPrs) anOperationPrs = getPresentation(); Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (aContext->IsDisplayed(anOperationPrs)) { - bool aChanged = anOperationPrs->dependOn(theObject); - + // if there are performance poblems, to improve them, the necessity of redisplay can be checked + //bool aChanged = anOperationPrs->dependOn(theObject); anOperationPrs->updateShapes(); - aChanged = aChanged || anOperationPrs->dependOn(theObject); - + //aChanged = aChanged || anOperationPrs->dependOn(theObject); //if (aChanged) anOperationPrs->Redisplay(); } - return false; -} - -bool PartSet_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - std::shared_ptr theCustomPrs) -{ - return false; } diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index 6a34fbb2a..b5fec271c 100755 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -25,7 +25,7 @@ class ModuleBase_IWorkshop; * Interface of a class which can provide specific customization of * object presentation */ -class PartSet_CustomPrs : public GeomAPI_ICustomPrs +class PartSet_CustomPrs { public: PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop); @@ -40,11 +40,8 @@ public: void deactivate(); /// Modifies the given presentation in the custom way. - bool customize(const ObjectPtr& theObject); + void customize(const ObjectPtr& theObject); - /// Modifies the given presentation in the custom way. - virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, - std::shared_ptr theCustomPrs); private: /// Returns the AIS presentation Handle(PartSet_OperationPrs) getPresentation() const; diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 938731a81..e43057089 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -133,7 +133,7 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) SLOT(onViewTransformed(int))); myMenuMgr = new PartSet_MenuMgr(this); - myCustomPrs = std::shared_ptr(new PartSet_CustomPrs(theWshop)); + myCustomPrs = new PartSet_CustomPrs(theWshop); Events_Loop* aLoop = Events_Loop::loop(); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)); @@ -280,9 +280,7 @@ void PartSet_Module::onOperationStarted(ModuleBase_Operation* theOperation) mySketchMgr->startNestedSketch(theOperation); } - std::shared_ptr aCustomPrs = - std::dynamic_pointer_cast(myCustomPrs); - aCustomPrs->activate(theOperation->feature()); + myCustomPrs->activate(theOperation->feature()); } void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) @@ -296,9 +294,7 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer(); aViewer->RemoveZLayer(myVisualLayerId); myVisualLayerId = 0; - std::shared_ptr aCustomPrs = - std::dynamic_pointer_cast(myCustomPrs); - aCustomPrs->deactivate(); + myCustomPrs->deactivate(); } ModuleBase_Operation* PartSet_Module::currentOperation() const @@ -730,14 +726,10 @@ void PartSet_Module::onViewTransformed(int theTrsfType) aDisplayer->updateViewer(); } -bool PartSet_Module::customizeObject(ObjectPtr theObject) +void PartSet_Module::customizeObject(ObjectPtr theObject) { - std::shared_ptr aCustomPrs = - std::dynamic_pointer_cast(myCustomPrs); - bool isCustomized = false; - if (aCustomPrs->isActive()) - isCustomized = aCustomPrs->customize(theObject); - return isCustomized; + if (myCustomPrs->isActive()) + myCustomPrs->customize(theObject); } void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser) diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index eb64c79e4..5520d0d2c 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -12,8 +12,6 @@ #include #include -#include - #include //#include @@ -153,9 +151,8 @@ public: * If the object is result with the color attribute value set, it is used, * otherwise the customize is applyed to the object's feature if it is a custom prs * \param theObject an object instance - * \return the true state if there is changes and the presentation is customized */ - virtual bool customizeObject(ObjectPtr theObject); + virtual void customizeObject(ObjectPtr theObject); /// This method is called on object browser creation for customisation of module specific features /// \param theObjectBrowser a pinter on Object Browser widget @@ -238,8 +235,7 @@ protected slots: PartSet_SketcherMgr* mySketchMgr; PartSet_MenuMgr* myMenuMgr; /// A default custom presentation, which is used for references objects of started operation - GeomCustomPrsPtr myCustomPrs; - + PartSet_CustomPrs* myCustomPrs; int myVisualLayerId; PartSet_DocumentDataModel* myDataModel; diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index c202b4f6d..98cea3cff 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -861,7 +861,6 @@ bool XGUI_Displayer::customizeObject(ObjectPtr theObject) ResultPtr aResult = std::dynamic_pointer_cast(theObject); // Customization of presentation - bool isPresentable = false; GeomCustomPrsPtr aCustomPrs; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get() != NULL) { @@ -870,15 +869,14 @@ bool XGUI_Displayer::customizeObject(ObjectPtr theObject) aCustomPrs = aCustPrs; } if (aCustomPrs.get() == NULL) { - // we ignore presentable not customized objects GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); - isPresentable = aPrs.get() != NULL; - aCustomPrs = myCustomPrs; + // we ignore presentable not customized objects + if (aPrs.get() == NULL) + aCustomPrs = myCustomPrs; } - bool isCustomized = false; - if (!isPresentable) - aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs); - isCustomized = myWorkshop->module()->customizeObject(theObject) || isCustomized; + bool isCustomized = aCustomPrs.get() && + aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs); + myWorkshop->module()->customizeObject(theObject); return isCustomized; }