Changeset 156 for osgVisual/src/vista2D
- Timestamp:
- Nov 12, 2010, 9:13:14 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/vista2D/visual_vista2D.cpp
r155 r156 26 26 // Create a Vista2D View 27 27 view = new Vista2D::VistaView(); 28 29 vistaProjectfile = ""; 30 paintBackground = false; 31 playanimation = false; 32 position_x = 0; 33 position_y = 0; 34 zoom = 1; 28 35 } 29 36 30 37 visual_vista2D::~visual_vista2D(void) 31 38 { 32 } 33 34 void visual_vista2D::startVista2D(std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom) 39 view->stopView(); 40 } 41 42 void visual_vista2D::startVista2D() 35 43 { 36 44 /*************** … … 39 47 view->load( vistaProjectfile ); 40 48 view->setBackgroundMode(paintBackground); // don't paint background 41 view->setPosition( pos X, posY);49 view->setPosition( position_x, position_y); 42 50 view->setZoom( zoom ); 43 51 … … 46 54 self running datasource 47 55 ***************/ 48 view->startView (true); 49 50 } 51 52 bool visual_vista2D::processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom) 56 view->startView (playanimation); 57 } 58 59 bool visual_vista2D::processXMLConfiguration() 53 60 { 54 61 // Init XML … … 109 116 std::stringstream sstr(attr_value); 110 117 sstr >> zoom; 118 } 119 120 if( attr_name == "playanimation" ) 121 { 122 playanimation = (attr_value == "yes") ? true : false; 111 123 } 112 124 … … 133 145 OSG_NOTIFY (osg::ALWAYS ) << "visual_vista2D initialize.."; // The sentence is finished by the init result... 134 146 135 std::string vistaProjectfile = ""; 136 bool paintBackground = false; 137 int position_x = 0; 138 int position_y = 0; 139 float zoom = 1; 147 this->configFileName = configFileName; 140 148 141 149 // Process XML configuration 142 if(!processXMLConfiguration( configFileName, vistaProjectfile, paintBackground, position_x, position_y, zoom))150 if(!processXMLConfiguration()) 143 151 return false; // Abort vista2D initialization. 144 152 … … 184 192 185 193 // Add Payload: Vista2D 186 osg::ref_ptr<visual_vista2D> vista2D = new visual_vista2D();187 vista2D->startVista2D(vistaProjectfile, paintBackground, position_x, position_y, zoom); 188 189 vista2D.get()->setUseDisplayList( false );190 vista2Dgeode->addDrawable( vista2D.get());194 startVista2D(); 195 196 // Add this class to the scene Graph 197 this->setUseDisplayList( false ); 198 vista2Dgeode->addDrawable( this ); 191 199 192 200 sceneGraphRoot_->addChild( vista2DProjectionMatrix );
Note: See TracChangeset
for help on using the changeset viewer.