a correction in customize object. There was a regression when saving the customized boolean result value.
* If the object is result with the color attribute value set, it is used,\r
* otherwise the customize is applyed to the object's feature if it is a custom prs\r
* \param theObject an object instance\r
- * \return the true state if there is changes and the presentation is customized\r
*/\r
- virtual bool customizeObject(ObjectPtr theObject) { return false; }\r
+ virtual void customizeObject(ObjectPtr theObject) {}\r
\r
/// This method is called on object browser creation for customisation of module specific features\r
/// \param theObjectBrowser a pinter on Object Browser widget\r
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<GeomAPI_ICustomPrs> theCustomPrs)
-{
- return false;
}
* 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);
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<GeomAPI_ICustomPrs> theCustomPrs);
private:
/// Returns the AIS presentation
Handle(PartSet_OperationPrs) getPresentation() const;
SLOT(onViewTransformed(int)));
myMenuMgr = new PartSet_MenuMgr(this);
- myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new PartSet_CustomPrs(theWshop));
+ myCustomPrs = new PartSet_CustomPrs(theWshop);
Events_Loop* aLoop = Events_Loop::loop();
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
mySketchMgr->startNestedSketch(theOperation);
}
- std::shared_ptr<PartSet_CustomPrs> aCustomPrs =
- std::dynamic_pointer_cast<PartSet_CustomPrs>(myCustomPrs);
- aCustomPrs->activate(theOperation->feature());
+ myCustomPrs->activate(theOperation->feature());
}
void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
aViewer->RemoveZLayer(myVisualLayerId);
myVisualLayerId = 0;
- std::shared_ptr<PartSet_CustomPrs> aCustomPrs =
- std::dynamic_pointer_cast<PartSet_CustomPrs>(myCustomPrs);
- aCustomPrs->deactivate();
+ myCustomPrs->deactivate();
}
ModuleBase_Operation* PartSet_Module::currentOperation() const
aDisplayer->updateViewer();
}
-bool PartSet_Module::customizeObject(ObjectPtr theObject)
+void PartSet_Module::customizeObject(ObjectPtr theObject)
{
- std::shared_ptr<PartSet_CustomPrs> aCustomPrs =
- std::dynamic_pointer_cast<PartSet_CustomPrs>(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)
#include <ModelAPI_Attribute.h>
#include <ModelAPI_CompositeFeature.h>
-#include <GeomAPI_ICustomPrs.h>
-
#include <Events_Listener.h>
//#include <StdSelect_FaceFilter.hxx>
* 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
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;
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
// Customization of presentation
- bool isPresentable = false;
GeomCustomPrsPtr aCustomPrs;
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get() != NULL) {
aCustomPrs = aCustPrs;
}
if (aCustomPrs.get() == NULL) {
- // we ignore presentable not customized objects
GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(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;
}