8 #include <AIS_InteractiveContext.hxx>
9 #include <V3d_View.hxx>
14 //class COMMONSAMPLE_EXPORT View: public QWidget
15 class View: public QWidget
19 enum CurrentAction3d { CurAction3d_Nothing, CurAction3d_DynamicZooming,
20 CurAction3d_WindowZooming, CurAction3d_DynamicPanning,
21 CurAction3d_GlobalPanning, CurAction3d_DynamicRotation };
24 enum ViewAction { ViewFitAllId, ViewFitAreaId, ViewZoomId, ViewPanId, ViewGlobalPanId,
25 ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId, ViewRightId,
26 ViewAxoId, ViewRotationId, ViewResetId, ViewHlrOffId, ViewHlrOnId };
27 enum RaytraceAction { ToolRaytracingId, ToolShadowsId, ToolReflectionsId, ToolAntialiasingId };
29 View( Handle(AIS_InteractiveContext) theContext, QWidget* parent );
34 bool dump( Standard_CString theFile );
35 QList<QAction*>* getViewActions();
36 QList<QAction*>* getRaytraceActions();
37 void noActiveActions();
40 void EnableRaytracing();
41 void DisableRaytracing();
43 void SetRaytracedShadows (bool theState);
44 void SetRaytracedReflections (bool theState);
45 void SetRaytracedAntialiasing (bool theState);
47 bool IsRaytracingMode() const { return myIsRaytracing; }
48 bool IsShadowsEnabled() const { return myIsShadowsEnabled; }
49 bool IsReflectionsEnabled() const { return myIsReflectionsEnabled; }
50 bool IsAntialiasingEnabled() const { return myIsAntialiasingEnabled; }
52 static QString GetMessages( int type,TopAbs_ShapeEnum aSubShapeType,
53 TopAbs_ShapeEnum aShapeType );
54 static QString GetShapeType( TopAbs_ShapeEnum aShapeType );
56 Standard_EXPORT static void OnButtonuseraction( int ExerciceSTEP,
57 Handle(AIS_InteractiveContext)& );
58 Standard_EXPORT static void DoSelection( int Id,
59 Handle(AIS_InteractiveContext)& );
60 Standard_EXPORT static void OnSetSelectionMode( Handle(AIS_InteractiveContext)&,
62 TopAbs_ShapeEnum& SelectionMode,
64 virtual QPaintEngine* paintEngine() const;
66 void selectionChanged();
85 void updateToggled( bool );
87 void onEnvironmentMap();
88 void onRaytraceAction();
91 virtual void paintEvent( QPaintEvent* );
92 virtual void resizeEvent( QResizeEvent* );
93 virtual void mousePressEvent( QMouseEvent* );
94 virtual void mouseReleaseEvent(QMouseEvent* );
95 virtual void mouseMoveEvent( QMouseEvent* );
97 virtual void addItemInPopup( QMenu* );
99 Handle(V3d_View)& getView();
100 Handle(AIS_InteractiveContext)& getContext();
101 void activateCursor( const CurrentAction3d );
102 void Popup( const int x, const int y );
103 CurrentAction3d getCurrentMode();
105 virtual void onLButtonDown( const int nFlags, const QPoint point );
106 virtual void onMButtonDown( const int nFlags, const QPoint point );
107 virtual void onRButtonDown( const int nFlags, const QPoint point );
108 virtual void onLButtonUp( Qt::MouseButtons nFlags, const QPoint point );
109 virtual void onMButtonUp( Qt::MouseButtons nFlags, const QPoint point );
110 virtual void onRButtonUp( Qt::MouseButtons nFlags, const QPoint point );
111 virtual void onMouseMove( Qt::MouseButtons nFlags, const QPoint point );
115 void initViewActions();
116 void initRaytraceActions();
117 void DragEvent( const int x, const int y, const int TheState );
118 void InputEvent( const int x, const int y );
119 void MoveEvent( const int x, const int y );
120 void MultiMoveEvent( const int x, const int y );
121 void MultiDragEvent( const int x, const int y, const int TheState );
122 void MultiInputEvent( const int x, const int y );
123 void DrawRectangle( const int MinX, const int MinY,
124 const int MaxX, const int MaxY, const bool Draw );
128 bool myIsShadowsEnabled;
129 bool myIsReflectionsEnabled;
130 bool myIsAntialiasingEnabled;
132 bool myDrawRect; // set when a rect is used for selection or magnify
133 Handle(V3d_View) myView;
134 Handle(AIS_InteractiveContext) myContext;
135 CurrentAction3d myCurrentMode;
136 Standard_Integer myXmin;
137 Standard_Integer myYmin;
138 Standard_Integer myXmax;
139 Standard_Integer myYmax;
140 Standard_Real myCurZoom;
141 Standard_Boolean myHlrModeIsOn;
142 QList<QAction*>* myViewActions;
143 QList<QAction*>* myRaytraceActions;
145 QRubberBand* myRectBand; //!< selection rectangle rubber band