20 #ifndef XGUI_Displayer_H
21 #define XGUI_Displayer_H
25 #include <GeomAPI_AISObject.h>
26 #include <GeomAPI_Pln.h>
28 #include <ModelAPI_Result.h>
30 #include <ModuleBase_Definitions.h>
32 #include <AIS_InteractiveObject.hxx>
33 #include <AIS_InteractiveContext.hxx>
34 #include <NCollection_Map.hxx>
35 #include <NCollection_DataMap.hxx>
36 #include <SelectMgr_AndFilter.hxx>
37 #include <TopoDS_Shape.hxx>
52 class VInspectorAPI_CallBack;
65 bool add(
const ObjectPtr& theObj,
const AISObjectPtr& theAIS)
67 if (myResultToAISMap.contains(theObj))
70 myResultToAISMap[theObj] = anAIS;
71 myAIStoResultMap[anAIS] = theObj;
79 if (!myResultToAISMap.contains(theObj))
82 myResultToAISMap.remove(theObj);
83 myAIStoResultMap.remove(aAIS);
89 bool remove(
const AISObjectPtr& theAIS)
92 if (!myAIStoResultMap.contains(anAIS))
94 ObjectPtr aObj = myAIStoResultMap[anAIS];
95 myResultToAISMap.remove(aObj);
96 myAIStoResultMap.remove(anAIS);
103 myResultToAISMap.clear();
104 myAIStoResultMap.clear();
109 AISObjectPtr
value(
const ObjectPtr& theObj)
const
111 if (myResultToAISMap.contains(theObj)) {
117 return AISObjectPtr();
122 ObjectPtr
value(
const AISObjectPtr& theAIS)
const
125 if (myAIStoResultMap.contains(anAIS))
126 return myAIStoResultMap[anAIS];
134 if (myAIStoResultMap.contains(theAIS))
135 return myAIStoResultMap[theAIS];
140 int size()
const {
return myResultToAISMap.size(); }
143 QObjectPtrList
objects()
const {
return myResultToAISMap.keys(); }
150 bool contains(
const ObjectPtr& theObj)
const {
return myResultToAISMap.contains(theObj); }
157 return myAIStoResultMap.contains(anAIS);
191 bool isVisible(ObjectPtr theObject)
const;
197 bool display(ObjectPtr theObject,
bool theUpdateViewer =
true);
209 bool displayAIS(AISObjectPtr theAIS,
const bool toActivateInSelectionModes,
210 const Standard_Integer theDisplayMode = 0,
bool theUpdateViewer =
true);
216 bool redisplay(ObjectPtr theObject,
bool theUpdateViewer =
true);
219 void redisplayObjects();
226 void setSelected(
const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
227 bool theUpdateViewer =
true);
232 void clearSelected(
const bool theUpdateViewer =
true);
238 bool erase(ObjectPtr theObject,
const bool theUpdateViewer =
true);
244 bool eraseAIS(AISObjectPtr theAIS,
const bool theUpdateViewer =
true);
249 bool eraseAll(
const bool theUpdateViewer =
true);
253 void deactivateSelectionFilters(
const bool theAddFilterOnly =
true);
268 void removeFilters();
276 bool enableUpdateViewer(
const bool isEnabled);
281 return myViewerBlockedRecursiveCount == 0;
285 void updateViewer()
const;
290 AISObjectPtr getAISObject(ObjectPtr theObject)
const;
295 ObjectPtr getObject(
const AISObjectPtr& theIO)
const;
305 void deactivateObjects(
const QObjectPtrList& theObjList,
306 const bool theUpdateViewer =
true);
309 void setDisplayMode(ObjectPtr theObject, DisplayMode theMode,
bool theUpdateViewer =
true);
314 DisplayMode displayMode(ObjectPtr theObject)
const;
318 void showOnly(
const QObjectPtrList& theList);
326 return myResult2AISObjectMap.objects();
328 return myResult2AISObjectMap.keys();
336 return myResult2AISObjectMap.presentations();
339 QList<AISObjectPtr> displayedPresentations()
const
341 return myResult2AISObjectMap.values();
347 bool canBeShaded(ObjectPtr theObject)
const;
354 QColor setObjectColor(ObjectPtr theObject,
const QColor& theColor,
bool theUpdateViewer =
true);
358 void displayTrihedron(
bool theToDisplay)
const;
361 void setCallBack(
const Handle(VInspectorAPI_CallBack)& theCallBack)
362 { myVCallBack = theCallBack; }
363 Handle(VInspectorAPI_CallBack) getCallBack()
const {
return myVCallBack; }
371 static bool isVisible(
XGUI_Displayer* theDisplayer,
const ObjectPtr& theObject);
375 GeomPlanePtr getScreenPlane()
const;
378 double getViewScale()
const;
382 void setSelectionColor(
const std::vector<int>& theColor);
385 std::vector<int> selectionColor()
const;
404 Handle(SelectMgr_AndFilter) GetFilter();
412 bool display(ObjectPtr theObject, AISObjectPtr theAIS,
bool isShading,
413 bool theUpdateViewer =
true);
421 bool customizeObject(ObjectPtr theObject);
426 void appendResultObject(ObjectPtr theObject, AISObjectPtr theAIS);
431 std::string getResult2AISObjectMapInfo()
const;
438 void getPresentations(
const ObjectPtr& theObject,
449 const NCollection_DataMap<TopoDS_Shape,
458 Handle(VInspectorAPI_CallBack) myVCallBack;
460 Handle(SelectMgr_AndFilter) myAndFilter;
466 typedef QMap<ObjectPtr, AISObjectPtr> ResultToAISMap;
467 ResultToAISMap myResult2AISObjectMap;
471 int myViewerBlockedRecursiveCount;
473 mutable void* myContextId;
474 mutable bool myNeedUpdate;
Interface for AIS_InteractiveObject.
Definition: GeomAPI_AISObject.h:39
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
Displayer.
Definition: XGUI_Displayer.h:172
bool isUpdateEnabled() const
Returns true if the viewer update is not blocked.
Definition: XGUI_Displayer.h:279
QList< Handle > displayedPresentations() const
Returns list of displayed objects.
Definition: XGUI_Displayer.h:334
void beforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS)
Signal on before object erase.
int objectsCount() const
Returns number of displayed objects.
Definition: XGUI_Displayer.h:321
DisplayMode
display mode
Definition: XGUI_Displayer.h:176
@ Wireframe
Wireframe display mode.
Definition: XGUI_Displayer.h:178
void objectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
Signal on object display.
QObjectPtrList displayedObjects() const
Returns list of displayed objects.
Definition: XGUI_Displayer.h:324
A class which implements activation/deactivate selection modes and using selection filters.
Definition: XGUI_SelectionActivate.h:41
Definition: XGUI_Displayer.h:58
ObjectPtr value(const AISObjectPtr &theAIS) const
Returns object by presentation.
Definition: XGUI_Displayer.h:122
bool remove(const ObjectPtr &theObj)
Removes values by object.
Definition: XGUI_Displayer.h:77
QObjectPtrList objects() const
Returns list of objects.
Definition: XGUI_Displayer.h:143
AISObjectPtr value(const ObjectPtr &theObj) const
Returns presentation by object.
Definition: XGUI_Displayer.h:109
bool remove(const AISObjectPtr &theAIS)
Removes values by presentation.
Definition: XGUI_Displayer.h:89
bool add(const ObjectPtr &theObj, const AISObjectPtr &theAIS)
Add new values pair to the map.
Definition: XGUI_Displayer.h:65
int size() const
Returns number of values.
Definition: XGUI_Displayer.h:140
bool contains(const ObjectPtr &theObj) const
Returns true if the Map contains the object.
Definition: XGUI_Displayer.h:150
bool contains(const AISObjectPtr &theAIS) const
Returns true if the Map contains the presentation.
Definition: XGUI_Displayer.h:154
ObjectPtr value(const Handle &&theAIS) const
Returns object by presentation.
Definition: XGUI_Displayer.h:132
void clear()
Removes all values.
Definition: XGUI_Displayer.h:101
QList< Handle > presentations() const
returns list of presentations
Definition: XGUI_Displayer.h:146
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:82