- Timestamp:
- Nov 12, 2010, 8:51:06 AM (14 years ago)
- Location:
- osgVisual
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/bin/osgVisualConfig.xml
r154 r155 18 18 <module name="sky_silverlining" enabled="yes"></module> 19 19 <module name="vista2d" enabled="yes"> 20 <vista2d filename=" hud.view" paintBackground="no" position_x="800" position_y="450" zoom="0.5"></vista2d>20 <vista2d filename="D:\osgVisual\osgVisual\bin\hud.v" paintBackground="no" position_x="800" position_y="450" zoom="0.5"></vista2d> 21 21 </module> 22 22 <module name="dataio" enabled="yes"> -
osgVisual/include/vista2D/visual_vista2D.h
r153 r155 16 16 */ 17 17 18 // Vista 2D 18 19 #include "VistaView.h" 19 20 21 // C++ libraries 20 22 #include <string> 21 23 24 // XML Parser 25 #include <stdio.h> 26 #include <libxml/parser.h> 27 #include <libxml/tree.h> 28 29 // OSG Includes 22 30 #include <osg/Drawable> 23 31 #include <osg/Geode> … … 28 36 #include <osgDB/FileUtils> 29 37 38 // osgVisual Includes 39 #include <visual_util.h> 30 40 31 41 namespace osgVisual … … 91 101 private: 92 102 93 bool processXMLConfiguration();103 static bool processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom); 94 104 95 105 /** 96 106 * \brief This function initialized the visual_vista2D object after instantiation by createVistaOverlay() 97 107 */ 98 void startVista2D( );108 void startVista2D(std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom); 99 109 100 110 /** … … 113 123 Vista2D::VistaView* view; 114 124 115 / **116 * XML config filename117 */118 std::string configFileName;125 ///** 126 // * XML config filename 127 // */ 128 //std::string configFileName; 119 129 120 / **121 * Filename of the Vista2D project file.122 */123 std::string filename;130 ///** 131 // * Filename of the Vista2D project file. 132 // */ 133 //std::string filename; 124 134 125 / **126 * Should the background of the Vista2D project be painted?127 */128 bool paintBackground;135 ///** 136 // * Should the background of the Vista2D project be painted? 137 // */ 138 //bool paintBackground; 129 139 130 / **131 * X-Position to draw.132 */133 int position_x;140 ///** 141 // * X-Position to draw. 142 // */ 143 //int position_x; 134 144 135 / **136 * Y-Position to draw.137 */138 int position_y;145 ///** 146 // * Y-Position to draw. 147 // */ 148 //int position_y; 139 149 140 / **141 * Zoom factor to draw the project.142 */143 double zoom;150 ///** 151 // * Zoom factor to draw the project. 152 // */ 153 //double zoom; 144 154 }; 145 155 -
osgVisual/src/core/visual_core.cpp
r151 r155 512 512 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 } -
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.