Changeset 187 for osgVisual


Ignore:
Timestamp:
Jan 8, 2011, 9:00:55 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
osgVisual/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/include/core/visual_core.h

    r184 r187  
    106106
    107107        void addManipulators();
    108         void parseConfigFile(osg::ArgumentParser& arguments_);
    109         void checkXMLNode(xmlNode * a_node);
    110108        void parseScenery(xmlNode * a_node);
    111         void config(xmlNode * a_node);
    112109        bool loadTerrain(osg::ArgumentParser& arguments_);
    113110        bool checkCommandlineArgumentsForFinalErrors();
  • osgVisual/trunk/src/core/visual_core.cpp

    r185 r187  
    9797
    9898        // 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        }
    100106
    101107        // All modules are initialized - now check arguments for any unused parameter.
     
    267273}
    268274
    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                 else
    282                 {
    283                         //  Get the root element node
    284                         root_element = xmlDocGetRootElement(doc);
    285 
    286                         // Parse the XML document.
    287                         checkXMLNode(root_element);
    288 
    289                         // free the document
    290                         xmlFreeDoc(doc);;
    291                 }
    292                 // Free the global variables that may have been allocated by the parser.
    293                 xmlCleanupParser();
    294 
    295         }       // IF configfile exists
    296 }
    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) END
    320     }   // FOR END
    321 }
    322 
    323275void visual_core::parseScenery(xmlNode * a_node)
    324276{
    325277        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;
    331281}
    332282
Note: See TracChangeset for help on using the changeset viewer.