- bool isDone = false;
- if (myCustomized.contains(theResult)) {
- std::vector<int> aColor = Config_PropManager::color("Visualization", "operation_parameter_color",
- OPERATION_PARAMETER_COLOR);
- isDone = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
- /*
- Handle(AIS_InteractiveObject) anAISIO = thePrs->impl<Handle(AIS_InteractiveObject)>();
-
- const Handle(Prs3d_Presentation)& aPresentation = anAISIO->Presentation();
- if (!aPresentation.IsNull()) {
- Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAISIO);
- if (!aShapeAIS.IsNull()) {
- TopExp_Explorer anExp(aShapeAIS->Shape(), TopAbs_VERTEX);
- Handle(Prs3d_Drawer) aDrawer = aShapeAIS->Attributes();
- for (; anExp.More(); anExp.Next()) {
- const TopoDS_Vertex& aVertex = (const TopoDS_Vertex&)anExp.Current();
- StdPrs_WFDeflectionShape::Add(aPresentation, aVertex, aDrawer);
- }
- }
- }
- thePrs->setPointMarker(5, 5.); // Set point as a '+' symbol*/
+ Handle(PartSet_OperationPrs) aPresentation;
+
+ AISObjectPtr anOperationPrs;
+ if (myPresentations.contains(theFlag))
+ anOperationPrs = myPresentations[theFlag];
+
+ if (!anOperationPrs.get() && theToCreate) {
+ initPresentation(theFlag);
+ anOperationPrs = myPresentations[theFlag];
+ }
+
+ return anOperationPrs;
+}
+
+bool PartSet_CustomPrs::redisplay(const ObjectPtr& theObject,
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
+{
+#ifdef DO_NOT_VISUALIZE_CUSTOM_PRESENTATION
+ return false;
+#endif
+ bool aRedisplayed = false;
+ if (myIsActive[theFlag])
+ aRedisplayed = displayPresentation(theFlag, theUpdateViewer);
+
+ return aRedisplayed;
+}
+
+void PartSet_CustomPrs::clearPrs()
+{
+ clearPresentation(ModuleBase_IModule::CustomizeArguments);
+ clearPresentation(ModuleBase_IModule::CustomizeResults);
+ clearPresentation(ModuleBase_IModule::CustomizeHighlightedObjects);
+}
+
+void PartSet_CustomPrs::processEvent(const std::shared_ptr<Events_Message>& theMessage)
+{
+ if (theMessage->eventID() == Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION))
+ myPresentationIsEmpty = true; /// store state to analize it after display/erase is finished
+}
+
+void PartSet_CustomPrs::initPresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
+{
+ AISObjectPtr anOperationPrs = AISObjectPtr(new GeomAPI_AISObject());
+ Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop);
+ anOperationPrs->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs));
+ if (theFlag == ModuleBase_IModule::CustomizeArguments ||
+ theFlag == ModuleBase_IModule::CustomizeResults) {
+ anOperationPrs->setPointMarker(5, 2.);
+ anOperationPrs->setWidth((theFlag == ModuleBase_IModule::CustomizeHighlightedObjects)? 2 : 1);