Changeset 155 for osgVisual/src/vista2D
- Timestamp:
- Nov 12, 2010, 8:51:06 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/vista2D/visual_vista2D.cpp
r153 r155 22 22 visual_vista2D::visual_vista2D(void) 23 23 { 24 OSG_NOTIFY (osg::ALWAYS ) << "visual_vista2D instantiated." << std::endl; 25 24 26 // Create a Vista2D View 25 27 view = new Vista2D::VistaView(); 26 27 filename = "";28 paintBackground = false;;29 position_x = 600;30 position_y = 400;31 zoom = 0.5;32 28 } 33 29 … … 36 32 } 37 33 38 void visual_vista2D::startVista2D(std::string vista 2DFilename_)34 void visual_vista2D::startVista2D(std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom) 39 35 { 40 36 /*************** 41 37 load view 42 38 ***************/ 43 view->load( filename );39 view->load( vistaProjectfile ); 44 40 view->setBackgroundMode(paintBackground); // don't paint background 45 view->setPosition( pos ition_x,position_y);41 view->setPosition( posX, posY); 46 42 view->setZoom( zoom ); 47 43 … … 54 50 } 55 51 56 bool visual_vista2D::processXMLConfiguration( )52 bool visual_vista2D::processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom) 57 53 { 58 54 // Init XML 59 55 xmlDoc* tmpDoc; 60 56 bool disabled; 61 xmlNode* config = util::getModuleXMLConfig( configFileName, "vista2 D", tmpDoc, disabled );57 xmlNode* config = util::getModuleXMLConfig( configFileName, "vista2d", tmpDoc, disabled ); 62 58 63 59 if( disabled) … … 89 85 if( attr_name == "filename" ) 90 86 { 91 filename=attr_value87 vistaProjectfile=attr_value; 92 88 } 93 89 … … 137 133 OSG_NOTIFY (osg::ALWAYS ) << "visual_vista2D initialize.."; // The sentence is finished by the init result... 138 134 139 this->configFileName = configFileName; 140 141 // Analyse XML configuration file 142 // Process XML configuration 143 if(!processXMLConfiguration()) 135 std::string vistaProjectfile = ""; 136 bool paintBackground = false; 137 int position_x = 0; 138 int position_y = 0; 139 float zoom = 1; 140 141 // Process XML configuration 142 if(!processXMLConfiguration(configFileName, vistaProjectfile, paintBackground, position_x, position_y, zoom)) 144 143 return false; // Abort vista2D initialization. 145 144 146 // Check if Vista2D file exist147 if ( ! osgDB::fileExists( filename) )148 { 149 osg::notify( osg::WARN ) << "WARNING: visual_vista2D::createVistaOverlay - Could not find specified Vista2D projectfile. Skip adding Vista2D project." << std::endl;145 // Check if Vista2D project file exists 146 if ( !osgDB::fileExists(vistaProjectfile) ) 147 { 148 OSG_ALWAYS << "WARNING: visual_vista2D::init() - Specified vista2D projectfile '"<< vistaProjectfile <<"' does not exist! Skip using Vista2D!" << std::endl; 150 149 return false; 151 150 } … … 186 185 // Add Payload: Vista2D 187 186 osg::ref_ptr<visual_vista2D> vista2D = new visual_vista2D(); 188 vista2D->startVista2D( vista2DFilename_);187 vista2D->startVista2D(vistaProjectfile, paintBackground, position_x, position_y, zoom); 189 188 190 189 vista2D.get()->setUseDisplayList( false );
Note: See TracChangeset
for help on using the changeset viewer.