//#define DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop)
- : myWorkshop(theWorkshop), myIsActive(false), myFeature(FeaturePtr())
+ : myWorkshop(theWorkshop), myFeature(FeaturePtr())
{
initPresentation(ModuleBase_IModule::CustomizeArguments);
initPresentation(ModuleBase_IModule::CustomizeResults);
initPresentation(ModuleBase_IModule::CustomizeHighlightedObjects);
+
+ myIsActive[ModuleBase_IModule::CustomizeArguments] = false;
+ myIsActive[ModuleBase_IModule::CustomizeResults] = false;
+ myIsActive[ModuleBase_IModule::CustomizeHighlightedObjects] = false;
}
-bool PartSet_CustomPrs::isActive()
+bool PartSet_CustomPrs::isActive(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
{
- return myIsActive;
+ return myIsActive[theFlag];
}
-bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature, const bool theUpdateViewer)
+bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature,
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
#ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
return false;
#endif
- myIsActive = true;
+ myIsActive[theFlag] = true;
myFeature = theFeature;
bool isModified = false;
return isModified;
}
-bool PartSet_CustomPrs::deactivate(const bool theUpdateViewer)
+bool PartSet_CustomPrs::deactivate(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
- myIsActive = false;
+ myIsActive[theFlag] = false;
bool isModified = false;
erasePresentation(ModuleBase_IModule::CustomizeArguments, theUpdateViewer);
// update the AIS objects content
Handle(PartSet_OperationPrs) anOperationPrs = getPresentation(theFlag);
// do nothing if the feature can not be displayed [is moved from presentation, to be checked]
- if (!myFeature.get() || !myWorkshop->module()->canDisplayObject(myFeature))
+ if (!myFeature.get())
return isModified;
switch (theFlag) {
// redisplay AIS objects
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (!aContext.IsNull() && !aContext->IsDisplayed(anOperationPrs)) {
- if (anOperationPrs->hasShapes()) {
+ // when the feature can not be visualized in the module, the operation preview should not
+ // be visualized also
+ if (anOperationPrs->hasShapes() && myWorkshop->module()->canDisplayObject(myFeature)) {
// set color here because it can be changed in preferences
Quantity_Color aShapeColor = getShapeColor(theFlag);
anOperationPrs->setShapeColor(aShapeColor);
}
}
else {
- if (!anOperationPrs->hasShapes()) {
+ // when the feature can not be visualized in the module, the operation preview should not
+ // be visualized also
+ if (!anOperationPrs->hasShapes() || !myWorkshop->module()->canDisplayObject(myFeature)) {
erasePresentation(theFlag, theUpdateViewer);
isModified = true;
}