00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef QOCCCONTROLLER_H
00027 #define QOCCCONTROLLER_H
00028
00029 #include <QtCore/QObject>
00030 #include "qocc.h"
00031 #include "qoccdocument.h"
00032
00033 #include <TopAbs_ShapeEnum.hxx>
00034
00035 class QoccCommand;
00036 class Qocc3dWidget;
00037 class QMouseEvent;
00038
00039 class QOCC_DECLSPEC QoccController : public QObject
00040 {
00041
00042 Q_OBJECT
00043
00044 public:
00045
00046 QoccController();
00047 QoccController( QoccDocument* qDoc );
00048 ~QoccController();
00049
00050 Handle(V3d_Viewer)& getViewer( void ) { return myViewer; }
00051 Handle(AIS_InteractiveContext)& getContext( void ) { return myContext; }
00052 QoccDocument* getDocument( void ){ return myDocument; }
00053 int id( void ) { return myDocument->id(); }
00054
00055 Handle(V3d_Viewer) createViewer( const Standard_CString aDisplay,
00056 const Standard_ExtString aName,
00057 const Standard_CString aDomain,
00058 const Standard_Real ViewSize );
00059
00060 TopAbs_ShapeEnum localContext() { return myLcType; }
00061 void setLocalContext( TopAbs_ShapeEnum lcType );
00062 void clearLocalContext( void );
00063 void clearAllLocalContexts( void );
00064 bool hasLocalContext( void );
00065
00066 void deleteAllObjects( void );
00067
00068 void setGridOffset ( Quantity_Length offset );
00069
00070 bool isCommandActive( void ) { return !(myCommand == NULL); }
00071 bool isDrawing( void );
00072
00073 QoccCommand* getCommand( void ) { return myCommand; }
00074 void setCommand ( QoccCommand* command );
00075 void clearCommand ( void );
00076
00077 void undo( void );
00078 void redo( void );
00079
00080 void update( void );
00081
00082 public slots:
00083
00084 void gridXY ( void );
00085 void gridXZ ( void );
00086 void gridYZ ( void );
00087 void gridOn ( void );
00088 void gridOff ( void );
00089 void gridRect ( void );
00090 void gridCirc ( void );
00091
00092 void clickEvent(Qocc3dWidget* widget, QMouseEvent* e);
00093 void moveEvent (Qocc3dWidget* widget, QMouseEvent* e);
00094
00095
00096 signals:
00097
00098 void error (int errorCode, QString& errorDescription);
00099
00100 private:
00101
00102 Handle(V3d_Viewer) myViewer;
00103 Handle(AIS_InteractiveContext) myContext;
00104 Aspect_GridType myGridType;
00105 Aspect_GridDrawMode myGridMode;
00106 Quantity_NameOfColor myGridColor;
00107 Quantity_NameOfColor myGridTenthColor;
00108 QoccCommand* myCommand;
00109 QoccDocument* myDocument;
00110 bool myIsDrawing;
00111 TopAbs_ShapeEnum myLcType;
00112
00113 };
00114
00115 #endif // QOCCCONTROLLER_H