Changeset 156
- Timestamp:
- Nov 12, 2010, 9:13:14 AM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/bin/osgVisualConfig.xml
r155 r156 18 18 <module name="sky_silverlining" enabled="yes"></module> 19 19 <module name="vista2d" enabled="yes"> 20 <vista2d filename="D:\osgVisual\osgVisual\bin\ hud.v" paintBackground="no" position_x="800" position_y="450" zoom="0.5"></vista2d>20 <vista2d filename="D:\osgVisual\osgVisual\bin\altimeterSimple.v" paintBackground="no" position_x="1" position_y="1" zoom="1.0" playanimation="yes"></vista2d> 21 21 </module> 22 22 <module name="dataio" enabled="yes"> -
osgVisual/include/vista2D/visual_vista2D.h
r155 r156 82 82 * @return : True if successful. 83 83 */ 84 staticbool init( osg::CoordinateSystemNode *sceneGraphRoot_, std::string configFileName );84 bool init( osg::CoordinateSystemNode *sceneGraphRoot_, std::string configFileName ); 85 85 86 86 /** … … 101 101 private: 102 102 103 static bool processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom);103 bool processXMLConfiguration(); 104 104 105 105 /** 106 106 * \brief This function initialized the visual_vista2D object after instantiation by createVistaOverlay() 107 107 */ 108 void startVista2D( std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom);108 void startVista2D(); 109 109 110 110 /** 111 111 * \brief This function implements the pure OpenGL draw by calling Vista2D's draw funtion. 112 112 * 113 * Because Vis rta2D manipulates OpenGLs stateset, this function saves the113 * Because Vista2D manipulates OpenGLs stateset, this function saves the 114 114 * OSG statset at the beginning and restores it after the drawing of Vista2D 115 115 * … … 123 123 Vista2D::VistaView* view; 124 124 125 / //**126 //* XML config filename127 //*/128 //std::string configFileName;125 /** 126 * XML config filename 127 */ 128 std::string configFileName; 129 129 130 / //**131 //* Filename of the Vista2D project file.132 //*/133 //std::string filename;130 /** 131 * Filename of the Vista2D project file. 132 */ 133 std::string vistaProjectfile; 134 134 135 / //**136 //* Should the background of the Vista2D project be painted?137 //*/138 //bool paintBackground;135 /** 136 * Should the background of the Vista2D project be painted? 137 */ 138 bool paintBackground; 139 139 140 / //**141 //* X-Position to draw.142 //*/143 //int position_x;140 /** 141 * X-Position to draw. 142 */ 143 int position_x; 144 144 145 / //**146 //* Y-Position to draw.147 //*/148 //int position_y;145 /** 146 * Y-Position to draw. 147 */ 148 int position_y; 149 149 150 ///** 151 // * Zoom factor to draw the project. 152 // */ 153 //double zoom; 150 /** 151 * Zoom factor to draw the project. 152 */ 153 double zoom; 154 155 /** 156 * Flag if Vista2D should animate the project according to it's data sources. 157 */ 158 bool playanimation; 154 159 }; 155 160 -
osgVisual/src/core/visual_core.cpp
r155 r156 513 513 visual_dataIO::getInstance()->setSlotData("TestSlot1", osgVisual::dataIO_slot::TO_OBJ, 0.12345); 514 514 515 516 // Vista2D Test: 517 visual_vista2D::init(rootNode, configFilename ); 518 } 515 } -
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.