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);
27 #pragma warning ( disable:4251 )
30 // ---------------- OCC view widget --------
31 class CURVECREATOR_EXPORT OCCViewer_ViewWidget : public QFrame
36 typedef enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, TrihId,
37 FrontId, BackId, TopId, BottomId, LeftId, RightId, None } ButtonsType;
39 OCCViewer_ViewWidget(QWidget* parent, const bool isUseMultiAction = true);
40 ~OCCViewer_ViewWidget();
42 OCCViewer_ViewPort3d* getViewPort();
44 bool eventFilter(QObject* watched, QEvent* e);
47 void Display(const TopoDS_Shape shape, const bool theShaded,
48 const QColor& shapeColor);
50 enum Mode2dType { No2dMode, XYPlane, XZPlane, YZPlane};
52 void set2dMode( Mode2dType );
53 Mode2dType get2dMode() const { return my2dMode; }
55 QAction* action( const ButtonsType& theId );
68 enum OperationType{ NOTHING, FITALLVIEW, WINDOWFIT, ZOOMVIEW, PANVIEW, PANGLOBAL,
74 void activateWindowFit();
75 void activateRotation();
76 void activatePanning();
77 void activateGlPanning();
78 OperationType getButtonState(QMouseEvent* theEvent);
79 void viewerFitAll(const bool theUpdate = true);
81 void vpMousePressEvent (QMouseEvent* theEvent);
82 void vpMouseReleaseEvent(QMouseEvent* theEvent);
83 void vpMouseMoveEvent (QMouseEvent* theEvent);
87 bool transformRequested() { return myOperation != NOTHING; }
88 bool setTransformRequested (OperationType op);
89 void clearViewer(const bool theUpdate = true);
91 typedef QMap<ButtonsType, QtxAction*> ActionsMap;
94 OCCViewer_ViewPort3d* myViewPort;
95 Handle(V3d_Viewer) myV3dViewer;
96 #if OCC_VERSION_LARGE <= 0x06060000
97 Handle(V3d_Viewer) myV3dCollector;
99 Handle(AIS_InteractiveContext) myAISContext;
100 Handle(AIS_Trihedron) myTrihedron;
102 QtxMultiAction *myZoomBtns, *myPanBtns, *myProjBtns;
104 OperationType myOperation;
106 ActionsMap myButsMap;
117 OCCViewer_ViewWindow::RotationPointType myCurrPointType;
118 gp_Pnt mySelectedPoint;
119 bool myShowTrihedron;
122 bool myUseMultiAction;