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 OCCViewer_ViewWidget(QWidget* parent);
37 ~OCCViewer_ViewWidget();
39 OCCViewer_ViewPort3d* getViewPort();
41 bool eventFilter(QObject* watched, QEvent* e);
44 void Display(const TopoDS_Shape shape, const bool theShaded,
45 const QColor& shapeColor);
58 enum OperationType{ NOTHING, FITALLVIEW, WINDOWFIT, ZOOMVIEW, PANVIEW, PANGLOBAL,
64 void activateWindowFit();
65 void activateRotation();
66 void activatePanning();
67 void activateGlPanning();
68 OperationType getButtonState(QMouseEvent* theEvent);
69 void viewerFitAll(const bool theUpdate = true);
71 void vpMousePressEvent (QMouseEvent* theEvent);
72 void vpMouseReleaseEvent(QMouseEvent* theEvent);
73 void vpMouseMoveEvent (QMouseEvent* theEvent);
77 bool transformRequested() { return myOperation != NOTHING; }
78 bool setTransformRequested (OperationType op);
79 void clearViewer(const bool theUpdate = true);
81 typedef enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, TrihId,
82 FrontId, BackId, TopId, BottomId, LeftId, RightId, None } ButtonsType;
83 typedef QMap<ButtonsType, QtxAction*> ActionsMap;
86 OCCViewer_ViewPort3d* myViewPort;
87 Handle(V3d_Viewer) myV3dViewer;
88 #if OCC_VERSION_LARGE <= 0x06060000
89 Handle(V3d_Viewer) myV3dCollector;
91 Handle(AIS_InteractiveContext) myAISContext;
92 Handle(AIS_Trihedron) myTrihedron;
94 QtxMultiAction *myZoomBtns, *myPanBtns, *myProjBtns;
96 OperationType myOperation;
109 OCCViewer_ViewWindow::RotationPointType myCurrPointType;
110 gp_Pnt mySelectedPoint;
111 bool myShowTrihedron;