Changeset 5598
- Timestamp:
- Aug 4, 2008, 9:07:10 AM (16 years ago)
- Location:
- anuga_work/development/anugavis/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anugavis/src/anugavis.cc
r5488 r5598 17 17 #include <SDL.h> 18 18 #include "anugavis.hh" 19 #include "height_quantity.hh" 19 20 20 21 using std::string; … … 28 29 AnugaVis::~AnugaVis(void){ 29 30 if(this->screen != NULL) SDL_Quit(); 31 } 32 33 void AnugaVis::add_HeightQuantity(HeightQuantity &height){ 34 height.set_dynamic(this->sww_file.nc_inq_varndims_by_name(height.get_name()) \ 35 == 2); 36 this->heights.push_back(height); 37 } 38 39 void AnugaVis::run(void){ 40 30 41 } 31 42 -
anuga_work/development/anugavis/src/anugavis.hh
r5488 r5598 4 4 /* The main controller object. */ 5 5 6 #include <list> 6 7 #include <string> 7 8 #include <SDL.h> 9 #include "height_quantity.hh" 8 10 #include "sww_file.hh" 9 11 12 using std::list; 10 13 using std::string; 11 14 … … 14 17 AnugaVis(const string &sww_file, int width, int height); 15 18 ~AnugaVis(void); 19 void add_HeightQuantity(HeightQuantity &height); 20 void run(void); 16 21 private: 17 22 void init_SDL(int width, int height); … … 19 24 SDL_Surface *screen; 20 25 SWWFile sww_file; 26 list<HeightQuantity> heights; 21 27 }; 22 28 -
anuga_work/development/anugavis/src/anugavis_simple_cxx.cc
r5487 r5598 19 19 try{ 20 20 AnugaVis anuga(argv[1], 640, 480); 21 HeightQuantity elevation("elevation", 0, 1, 0.5, 0.5, 0.5); 22 HeightQuantity stage("stage", 0, 1, 0, 0, 0.8); 23 anuga.add_HeightQuantity(elevation); 24 anuga.add_HeightQuantity(stage); 25 anuga.run(); 21 26 }catch(const char *str){ 22 27 output_string(string(str)); -
anuga_work/development/anugavis/src/height_quantity.cc
r5502 r5598 15 15 #endif 16 16 #include "height_quantity.hh" 17 #include "sww_file.hh"18 17 19 18 using std::string; 20 19 21 HeightQuantity::HeightQuantity(const SWWFile &sww, conststring &name,20 HeightQuantity::HeightQuantity(const string &name, 22 21 GLdouble offset, GLdouble scale, 23 22 GLfloat red, GLfloat green, GLfloat blue): 24 23 offset(offset), scale(scale), red(red), green(green), blue(blue), name(name), 25 frame_number(-1) , sww(sww){24 frame_number(-1){ 26 25 GLenum glerror; 27 this->dynamic = (sww.nc_inq_varndims_by_name(name) == 2);28 26 this->display_list = glGenLists(1); 29 27 if((glerror = glGetError()) != GL_NO_ERROR) throw gluErrorString(glerror); 30 31 28 } 32 29 … … 48 45 } 49 46 47 const string &HeightQuantity::get_name(void){ 48 return this->name; 49 } 50 51 void HeightQuantity::set_dynamic(bool dynamic){ 52 this->dynamic = dynamic; 53 } 54 50 55 void HeightQuantity::compile(int frame){ 51 56 -
anuga_work/development/anugavis/src/height_quantity.hh
r5502 r5598 15 15 # include <OpenGL/gl.h> 16 16 #endif 17 #include "sww_file.hh"18 17 19 18 using std::string; 20 19 20 /* HeightQuantity instances cannot be shared amongst different 21 AnugaVis instances. This shouldn't matter since AnugaVis' 22 initialisation does SDL initialisation and that should only happen 23 once. 24 */ 25 21 26 class HeightQuantity { 22 27 public: 23 HeightQuantity(const SWWFile &sww, conststring &name,28 HeightQuantity(const string &name, 24 29 const GLdouble offset, GLdouble scale, 25 30 GLfloat red, GLfloat green, GLfloat blue); 26 31 ~HeightQuantity(void); 27 32 void draw(int frame); 33 const string &get_name(void); 34 void set_dynamic(bool dynamic); 28 35 GLdouble offset; 29 36 GLdouble scale; … … 38 45 bool dynamic; 39 46 GLuint display_list; 40 const SWWFile &sww;41 47 }; 42 48 -
anuga_work/development/anugavis/src/sww_file.cc
r5502 r5598 38 38 } 39 39 40 41 40 int SWWFile::nc_inq_varndims_by_name(const string &name) const{ 42 41 int ncstatus; 43 42 int dimid; 44 43 int ndims; 45 if(((ncstatus = nc_inq_ dimid(this->netcdf_id,44 if(((ncstatus = nc_inq_varid(this->netcdf_id, 46 45 name.c_str(), &dimid)) != NC_NOERR) || 47 46 ((ncstatus = nc_inq_varndims(this->netcdf_id,
Note: See TracChangeset
for help on using the changeset viewer.