Changeset 187 for osgVisual/trunk/src/core
- Timestamp:
- Jan 8, 2011, 9:00:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/src/core/visual_core.cpp
r185 r187 97 97 98 98 // parse Configuration file 99 parseConfigFile(arguments); 99 xmlDoc* tmpDoc; 100 xmlNode* sceneryNode = util::getSceneryXMLConfig( "osgVisualConfig.xml", tmpDoc); 101 parseScenery(sceneryNode); 102 if(sceneryNode) 103 { 104 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 105 } 100 106 101 107 // All modules are initialized - now check arguments for any unused parameter. … … 267 273 } 268 274 269 void visual_core::parseConfigFile(osg::ArgumentParser& arguments_)270 {271 if( configFilename != "" )272 {273 xmlDoc *doc = NULL;274 xmlNode *root_element = NULL;275 276 doc = xmlReadFile(configFilename.c_str(), NULL, 0);277 if (doc == NULL)278 {279 OSG_ALWAYS << "visual_core::parseConfigFile() - ERROR: could not parse osgVisual config file" << configFilename << std::endl;280 }281 else282 {283 // Get the root element node284 root_element = xmlDocGetRootElement(doc);285 286 // Parse the XML document.287 checkXMLNode(root_element);288 289 // free the document290 xmlFreeDoc(doc);;291 }292 // Free the global variables that may have been allocated by the parser.293 xmlCleanupParser();294 295 } // IF configfile exists296 }297 298 void visual_core::checkXMLNode(xmlNode * a_node)299 {300 for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next)301 {302 std::string node_name=reinterpret_cast<const char*>(cur_node->name);303 if(cur_node->type == XML_ELEMENT_NODE && node_name == "osgvisualconfiguration")304 {305 OSG_DEBUG << "XML node osgvisualconfiguration found" << std::endl;306 307 // Iterate to the next nodes to configure modules and scenery.308 checkXMLNode(cur_node->children);309 }310 311 if (cur_node->type == XML_ELEMENT_NODE && node_name == "scenery")312 {313 OSG_DEBUG << "XML node scenery found" << std::endl;314 315 parseScenery(cur_node);316 317 //OSG_DEBUG << "node type=Element, name:" << cur_node->name << std::endl;318 //OSG_DEBUG << "Processing children at " << cur_node->children << std::endl;319 } // IF(scenery) END320 } // FOR END321 }322 323 275 void visual_core::parseScenery(xmlNode * a_node) 324 276 { 325 277 OSG_ALWAYS << "parseScenery()" << std::endl; 326 } 327 328 void visual_core::config(xmlNode * a_node) 329 { 330 // Currently no configuration options fpr the core module are available. 278 279 if (a_node) 280 OSG_ALWAYS << "gefunden!" << std::endl; 331 281 } 332 282
Note: See TracChangeset
for help on using the changeset viewer.