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