1 #ifndef OCCVIEWER_VIEWMODEL_H
2 #define OCCVIEWER_VIEWMODEL_H
8 #include "SUIT_ViewModel.h"
10 #include <V3d_View.hxx>
11 #include <AIS_Trihedron.hxx>
12 #include <AIS_ListOfInteractive.hxx>
13 #include <AIS_InteractiveContext.hxx>
15 class SUIT_ViewWindow;
37 typedef QValueList<viewAspect> viewAspectList;
40 #pragma warning( disable:4251 )
43 class OCCVIEWER_EXPORT OCCViewer_Viewer: public SUIT_ViewModel
48 static QString Type() { return "OCCViewer"; }
50 OCCViewer_Viewer( bool DisplayTrihedron = true );
51 virtual ~OCCViewer_Viewer();
55 virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
57 virtual void setViewManager(SUIT_ViewManager* theViewManager);
58 virtual QString getType() const { return Type(); }
60 virtual void contextMenuPopup(QPopupMenu*);
62 void getSelectedObjects(AIS_ListOfInteractive& theList);
63 void setObjectsSelected(const AIS_ListOfInteractive& theList);
64 void setSelected(const Handle(AIS_InteractiveObject)& theIO)
65 { myAISContext->SetSelected(theIO);}
67 void performSelectionChanged();
68 // emit signal selectionChanged
70 virtual const viewAspectList& getViewAspects();
71 virtual void appendViewAspect( const viewAspect& );
72 virtual void updateViewAspects( const viewAspectList& );
73 virtual void clearViewAspects();
75 //! returns true if 3d Trihedron in viewer was created
76 bool trihedronActivated() const { return !myTrihedron.IsNull(); }
77 virtual void toggleTrihedron();
80 void onClearViewAspects();
83 Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;}
84 Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; }
85 Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; }
86 Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; }
88 void enableSelection(bool isEnabled);
89 bool isSelectionEnabled() const
90 { return mySelectionEnabled; }
92 void enableMultiselection(bool isEnable);
93 bool isMultiSelectionEnabled() const
94 { return myMultiSelectionEnabled; }
96 int getSelectionCount() const
97 { return (!myAISContext.IsNull())? myAISContext->NbSelected():0; }
99 /* Selection management */
100 bool highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true );
101 bool unHighlightAll( bool=true );
102 bool isInViewer( const Handle(AIS_InteractiveObject)&, bool=false );
103 bool isVisible( const Handle(AIS_InteractiveObject)& );
105 void setColor( const Handle(AIS_InteractiveObject)&, const QColor&, bool=true );
106 void switchRepresentation( const Handle(AIS_InteractiveObject)&, int, bool=true );
107 void setTransparency( const Handle(AIS_InteractiveObject)&, float, bool=true );
110 void selectionChanged();
113 void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
114 void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
115 void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
118 void onShowToolbar();
119 void onChangeBgColor();
122 Handle(V3d_Viewer) myV3dViewer;
123 Handle(V3d_Viewer) myV3dCollector;
124 Handle(AIS_InteractiveContext) myAISContext;
125 Handle(AIS_Trihedron) myTrihedron;
127 viewAspectList myViewAspects;
129 bool mySelectionEnabled;
130 bool myMultiSelectionEnabled;
132 QPoint myStartPnt, myEndPnt;
136 #pragma warning( default:4251 )