Changeset 190 for osgVisual/trunk
- Timestamp:
- Jan 11, 2011, 9:53:43 AM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/include/util/visual_util.h
r152 r190 253 253 static xmlNode* getSceneryXMLConfig(std::string configFilename, xmlDoc*& doc); 254 254 255 static std::string getTerrainFromXMLConfig(std::string configFilename); 256 257 static std::string getAnimationPathFromXMLConfig(std::string configFilename); 258 255 259 private: 256 260 /** -
osgVisual/trunk/src/util/visual_util.cpp
r152 r190 463 463 return true; 464 464 } 465 466 std::string util::getTerrainFromXMLConfig(std::string configFilename) 467 { 468 xmlDoc* tmpDoc; 469 xmlNode* sceneryNode = util::getSceneryXMLConfig(configFilename, tmpDoc); 470 std::string filename = ""; 471 472 // Iterate through nodes and search for terrian entry 473 for (xmlNode *cur_node = sceneryNode->children; cur_node; cur_node = cur_node->next) 474 { 475 std::string node_name=reinterpret_cast<const char*>(cur_node->name); 476 477 if(cur_node->type == XML_ELEMENT_NODE && node_name == "terrain") 478 { 479 xmlAttr *attr = cur_node->properties; 480 while ( attr ) 481 { 482 std::string attr_name=reinterpret_cast<const char*>(attr->name); 483 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 484 if( attr_name == "filename" ) 485 { 486 filename = attr_value; 487 } 488 attr = attr->next; 489 } 490 } 491 492 if(cur_node->type == XML_ELEMENT_NODE && node_name == "animationpath") 493 { 494 //<animationpath filename="salzburgerEcke.path"></animationpath> 495 } 496 }// FOR all nodes END 497 498 // Cleanup 499 if(sceneryNode) 500 { 501 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 502 } 503 504 return filename; 505 } 506 507 std::string util::getAnimationPathFromXMLConfig(std::string configFilename) 508 { 509 xmlDoc* tmpDoc; 510 xmlNode* sceneryNode = util::getSceneryXMLConfig(configFilename, tmpDoc); 511 std::string animationpath = ""; 512 513 // Iterate through nodes and search for terrian entry 514 for (xmlNode *cur_node = sceneryNode->children; cur_node; cur_node = cur_node->next) 515 { 516 std::string node_name=reinterpret_cast<const char*>(cur_node->name); 517 518 if(cur_node->type == XML_ELEMENT_NODE && node_name == "animationpath") 519 { 520 xmlAttr *attr = cur_node->properties; 521 while ( attr ) 522 { 523 std::string attr_name=reinterpret_cast<const char*>(attr->name); 524 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 525 if( attr_name == "filename" ) 526 { 527 animationpath = attr_value; 528 } 529 attr = attr->next; 530 } 531 } 532 533 534 }// FOR all nodes END 535 536 // Cleanup 537 if(sceneryNode) 538 { 539 xmlFreeDoc(tmpDoc); xmlCleanupParser(); 540 } 541 542 return animationpath; 543 }
Note: See TracChangeset
for help on using the changeset viewer.