IvfWorkspaceWidget.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfWorkplaceWidget_h_
00026 #define _CIvfWorkplaceWidget_h_
00027 
00028 #include <ivfwidget/IvfWidgetBase.h>
00029 
00030 #include <ivf/IvfWorkspace.h>
00031 #include <ivf/IvfCamera.h>
00032 #include <ivf/IvfLight.h>
00033 #include <ivf/IvfMaterial.h>
00034 #include <ivf/IvfSphere.h>
00035 #include <ivf/IvfConstructionPlane.h>
00036 #include <ivf/IvfBufferSelection.h>
00037 
00038 #include <ivf3dui/IvfUIInteractiveBase.h>
00039 
00040 IvfSmartPointer(CIvfWorkspaceWidget);
00041 
00042 #define MODE_VIEW    0
00043 #define MODE_CREATE  1
00044 
00054 class IVFWIDGET_API CIvfWorkspaceWidget : public CIvfWidgetBase {
00055 public:
00056         enum TEditMode {
00057                 EM_VIEW,
00058                 EM_INTERACT,
00059                 EM_CREATE_POINT,
00060         EM_CREATE_LINE,
00061         EM_CREATE_POLY
00062         };
00063 private:
00064         CIvfCameraPtr           m_camera;
00065         CIvfWorkspacePtr        m_workspace;
00066         CIvfLightPtr            m_light;
00067     CIvfBufferSelectionPtr m_selection;
00068 
00069         CIvfShapePtr            m_lastOver;
00070 
00071         int m_currentPlaneIdx;
00072 
00073         double m_angleX;
00074         double m_angleY;
00075         double m_moveX;
00076         double m_moveY;
00077         double m_zoomX;
00078         double m_zoomY;
00079 
00080         int m_beginX;
00081         int m_beginY;
00082 
00083         TEditMode m_editMode;
00084 
00085         bool m_selectOver;
00086 
00087         CIvfUIInteractiveBasePtr queryUIShape(CIvfShape* shape);
00088 public:
00090         CIvfWorkspaceWidget();
00091 
00093         virtual ~CIvfWorkspaceWidget();
00094 
00095         IvfClassInfo("CIvfWorkspaceWidget", CIvfWidgetBase);
00096 
00104         void addChild(CIvfShape* shape);
00105 
00113         void setEditMode(TEditMode mode);
00114 
00116         TEditMode getEditMode();
00117 
00119         CIvfWorkspace* getWorkspace();
00120 
00122         CIvfCamera* getCamera();
00123 
00124         bool isShapeOverEnabled();
00125         void disableShapeOver();
00126         void enableShapeOver();
00127 
00128         virtual void doInit(int width, int height);
00129         virtual void doResize(int width, int height);
00130         virtual void doRender();
00131         virtual void doDestroy();
00132         virtual void doKeyboard(int key, int x, int y);
00133         virtual void doMouseDown(int x, int y);
00134         virtual void doMouseMove(int x, int y);
00135         virtual void doMouseUp(int x, int y);
00136 
00143         virtual void onCursor(double x, double y, double z);
00144 
00145         virtual void onShapeDown(CIvfShape* shape);
00146         virtual void onShapeClick(CIvfShape* shape);
00147         virtual void onShapeUp(CIvfShape* shape);
00148         virtual void onShapeOver(CIvfShape* shape);
00149         virtual void onShapeLeave(CIvfShape* shape);
00150         virtual void onShapeDrag(CIvfShape* shape);
00151 
00152         virtual void onControlOver(CIvfUIInteractiveBase* uiControl);
00153         virtual void onControlLeave(CIvfUIInteractiveBase* uiControl);
00154         virtual void onControlDrag(CIvfUIInteractiveBase* uiControl);
00155         virtual void onControlUp(CIvfUIInteractiveBase* uiControl);
00156         virtual void onControlClick(CIvfUIInteractiveBase* uiControl);
00157         virtual void onControlDown(CIvfUIInteractiveBase* uiControl);
00158 };
00159 
00160 #endif 

Generated on Fri Sep 1 15:36:48 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO