1 #ifndef OCCVIEWER_VIEWWIDGET_H
2 #define OCCVIEWER_VIEWWIDGET_H
4 #include "CurveCreator_Macro.hxx"
5 #include <Basics_OCCTVersion.hxx>
7 #include <OCCViewer_ViewWindow.h>
9 #include <QtxMultiAction.h>
11 #include <V3d_Viewer.hxx>
12 #include <AIS_InteractiveContext.hxx>
13 #include <AIS_Trihedron.hxx>
14 #include <TopoDS_Shape.hxx>
20 class OCCViewer_ViewPort3d;
24 class Handle(V3d_Viewer);
25 class Handle(AIS_InteractiveContext);
28 #pragma warning ( disable:4251 )
31 // ---------------- OCC view widget --------
32 class CURVECREATOR_EXPORT OCCViewer_ViewWidget : public QFrame
37 typedef enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, TrihId,
38 FrontId, BackId, TopId, BottomId, LeftId, RightId, None } ButtonsType;
40 OCCViewer_ViewWidget(QWidget* parent, const bool isUseMultiAction = true);
41 ~OCCViewer_ViewWidget();
43 OCCViewer_ViewPort3d* getViewPort();
44 Handle(AIS_InteractiveContext) getAISContext() { return myAISContext; }
46 bool eventFilter(QObject* watched, QEvent* e);
49 void Display(const TopoDS_Shape shape, const bool theShaded,
50 const QColor& shapeColor);
52 enum Mode2dType { No2dMode, XYPlane, XZPlane, YZPlane};
54 void set2dMode( Mode2dType );
55 Mode2dType get2dMode() const { return my2dMode; }
57 QAction* action( const ButtonsType& theId );
70 void mouseMoving( QMouseEvent* theEvent );
71 void mousePressed( QMouseEvent* theEvent );
72 void mouseReleased( QMouseEvent* theEvent );
75 enum OperationType{ NOTHING, FITALLVIEW, WINDOWFIT, ZOOMVIEW, PANVIEW, PANGLOBAL,
81 void activateWindowFit();
82 void activateRotation();
83 void activatePanning();
84 void activateGlPanning();
85 OperationType getButtonState(QMouseEvent* theEvent);
86 void viewerFitAll(const bool theUpdate = true);
88 void vpMousePressEvent (QMouseEvent* theEvent);
89 void vpMouseReleaseEvent(QMouseEvent* theEvent);
90 void vpMouseMoveEvent (QMouseEvent* theEvent);
94 bool transformRequested() { return myOperation != NOTHING; }
95 bool setTransformRequested (OperationType op);
96 void clearViewer(const bool theUpdate = true);
98 typedef QMap<ButtonsType, QtxAction*> ActionsMap;
101 OCCViewer_ViewPort3d* myViewPort;
102 Handle(V3d_Viewer) myV3dViewer;
103 #if OCC_VERSION_LARGE <= 0x06060000
104 Handle(V3d_Viewer) myV3dCollector;
106 Handle(AIS_InteractiveContext) myAISContext;
107 Handle(AIS_Trihedron) myTrihedron;
109 QtxMultiAction *myZoomBtns, *myPanBtns, *myProjBtns;
111 OperationType myOperation;
113 ActionsMap myButsMap;
124 OCCViewer_ViewWindow::RotationPointType myCurrPointType;
125 gp_Pnt mySelectedPoint;
126 bool myShowTrihedron;
129 bool myUseMultiAction;