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();
76 void onClearViewAspects();
79 Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;}
80 Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; }
81 Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; }
82 Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; }
84 void enableSelection(bool isEnabled);
85 bool isSelectionEnabled() const
86 { return mySelectionEnabled; }
88 void enableMultiselection(bool isEnable);
89 bool isMultiSelectionEnabled() const
90 { return myMultiSelectionEnabled; }
92 int getSelectionCount() const
93 { return (!myAISContext.IsNull())? myAISContext->NbSelected():0; }
95 /* Selection management */
96 bool highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true );
97 bool unHighlightAll( bool=true );
98 bool isInViewer( const Handle(AIS_InteractiveObject)&, bool=false );
99 bool isVisible( const Handle(AIS_InteractiveObject)& );
101 void setColor( const Handle(AIS_InteractiveObject)&, const QColor&, bool=true );
102 void switchRepresentation( const Handle(AIS_InteractiveObject)&, int, bool=true );
103 void setTransparency( const Handle(AIS_InteractiveObject)&, float, bool=true );
106 void selectionChanged();
109 void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
110 void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
111 void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
114 void onShowToolbar();
115 void onChangeBgColor();
118 Handle(V3d_Viewer) myV3dViewer;
119 Handle(V3d_Viewer) myV3dCollector;
120 Handle(AIS_InteractiveContext) myAISContext;
121 Handle(AIS_Trihedron) myTrihedron;
123 viewAspectList myViewAspects;
125 bool mySelectionEnabled;
126 bool myMultiSelectionEnabled;
128 QPoint myStartPnt, myEndPnt;
132 #pragma warning( default:4251 )