1 /*****************************************************************************
5 ** Purpose: Header file for 3d graph view
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: Jan 2001
9 ** This is part of the CTSim program
10 ** Copyright (c) 1983-2001 Kevin Rosenberg
12 ** $Id: graph3dview.h,v 1.8 2001/03/21 21:45:31 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
29 #error Please set wxUSE_GLCANVAS to 1 in setup.h.
33 #include "wx/glcanvas.h"
39 class Graph3dFileCanvas;
40 class Graph3dFileView : public wxView
42 friend Graph3dFileCanvas;
45 DECLARE_DYNAMIC_CLASS(Graph3dFileView)
50 wxStatusBar* m_pStatusBar;
55 bool m_bUseVertexArrays;
62 DISPLAYLIST_COLOR = 1,
63 DISPLAYLIST_NO_COLOR = 2,
68 double m_dColorScaleMin;
69 double m_dColorScaleMax;
70 bool m_bColorScaleMinSet;
71 bool m_bColorScaleMaxSet;
75 void CreateDisplayList();
79 Graph3dFileCanvas* m_pCanvas;
80 Graph3dFileCanvas *CreateCanvas (wxFrame* parent);
83 wxDocMDIChildFrame* m_pFrame;
84 wxDocMDIChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
86 wxDocChildFrame* m_pFrame;
87 wxDocChildFrame* CreateChildFrame(wxDocument *doc, wxView *view);
90 wxWindow* getFrameForChild()
92 { return theApp->getMainFrame(); }
97 void intensityToColor (double dIntensity, GLfloat* vecColor);
101 virtual ~Graph3dFileView();
103 { m_pCanvas = NULL; m_pFrame = NULL; }
105 bool OnCreate(wxDocument *doc, long flags);
106 void OnDraw(wxDC* dc);
107 void OnUpdate(wxView *sender, wxObject *hint = NULL);
108 bool OnClose (bool deleteWindow = true);
109 void OnProperties (wxCommandEvent& event);
110 void OnLighting (wxCommandEvent& event);
111 void OnWireframe (wxCommandEvent& event);
112 void OnColor (wxCommandEvent& event);
113 void OnSmooth (wxCommandEvent& event);
114 void OnScaleSet (wxCommandEvent& event);
115 void OnScaleAuto (wxCommandEvent& event);
116 void OnScaleFull (wxCommandEvent& event);
119 wxDocMDIChildFrame* getFrame() { return m_pFrame; }
121 wxDocChildFrame* getFrame() { return m_pFrame; }
123 Graph3dFileCanvas* getCanvas() { return m_pCanvas; }
124 Graph3dFileDocument* GetDocument()
125 { return dynamic_cast<Graph3dFileDocument*>(wxView::GetDocument()); }
129 class Graph3dFileCanvas: public wxGLCanvas
132 DECLARE_EVENT_TABLE()
134 void Reshape (int width, int height);
135 Graph3dFileView* m_pView;
138 Graph3dFileCanvas (Graph3dFileView* view, wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
139 const wxSize& size = wxDefaultSize, long style = 0);
140 virtual ~Graph3dFileCanvas();
142 virtual void OnDraw(wxDC& dc);
143 void OnSize(wxSizeEvent& event);
144 void OnEraseBackground(wxEraseEvent& event);
145 void OnChar(wxKeyEvent& event);
146 void OnMouseEvent(wxMouseEvent& event);
147 void setView (Graph3dFileView* pView) { m_pView = pView; }