Changeset 208


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

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/bin/osgVisualConfig.xml

    r207 r208  
    5858        <updater>
    5959          <position lat="" lon="" alt=""></position>
    60           <attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude>
     60          <attitude rot_x="" rot_y="" rot_z=""></attitude>
    6161          <label text=""></label>
    6262        </updater>
  • osgVisual/trunk/src/object/visual_object.cpp

    r207 r208  
    8181        double geometry_scale_x=1.0, geometry_scale_y=1.0, geometry_scale_z=1.0;
    8282        osg::ref_ptr<osgVisual::object_updater> updater = NULL;
     83        std::string updater_lat="", updater_lon="", updater_alt="", updater_rot_x="", updater_rot_y="", updater_rot_z="", updater_label="";
    8384
    8485        // extract model properties
     
    155156                }
    156157
    157                 //if(cur_node->type == XML_ELEMENT_NODE && node_name == "updater")
    158                 //{
    159                 //      for (xmlNode *sub_cur_node = cur_node->children; sub_cur_node; sub_cur_node = sub_cur_node->next)
    160                 //      {
    161                 //              std::string sub_node_name=reinterpret_cast<const char*>(cur_node->children->name);
    162                 //              if(sub_cur_node->type == XML_ELEMENT_NODE && sub_node_name == "position")
    163                 //              {
    164                 //                      <position lat="" lon="" alt=""></position>
    165                 //              }
    166                 //              if(sub_cur_node->type == XML_ELEMENT_NODE && sub_node_name == "attitude")
    167                 //              {
    168                 //                      <attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude>
    169                 //              }
    170                 //              if(sub_cur_node->type == XML_ELEMENT_NODE && sub_node_name == "label")
    171                 //              {
    172                 //                      <label text=""></label>
    173                 //              }
    174                 //      }
    175                 //}
     158                if(cur_node->type == XML_ELEMENT_NODE && node_name == "updater")
     159                {
     160                        for (xmlNode *sub_cur_node = cur_node->children; sub_cur_node; sub_cur_node = sub_cur_node->next)
     161                        {
     162                                std::string sub_node_name=reinterpret_cast<const char*>(cur_node->children->name);
     163                                if(sub_cur_node->type == XML_ELEMENT_NODE && sub_node_name == "position")
     164                                {
     165                                        xmlAttr  *attr = sub_cur_node->properties;
     166                                        while ( attr )
     167                                        {
     168                                                std::string attr_name=reinterpret_cast<const char*>(attr->name);
     169                                                std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     170                                                if( attr_name == "lat" )
     171                                                        updater_lat = attr_value;
     172                                                if( attr_name == "lon" )
     173                                                        updater_lon = attr_value;
     174                                                if( attr_name == "alt" )
     175                                                        updater_alt = attr_value;
     176                                                attr = attr->next;
     177                                        }
     178                                }
     179                                if(sub_cur_node->type == XML_ELEMENT_NODE && sub_node_name == "attitude")
     180                                {
     181                                        xmlAttr  *attr = sub_cur_node->properties;
     182                                        while ( attr )
     183                                        {
     184                                                std::string attr_name=reinterpret_cast<const char*>(attr->name);
     185                                                std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     186                                                if( attr_name == "rot_x" )
     187                                                        updater_rot_x = attr_value;
     188                                                if( attr_name == "rot_y" )
     189                                                        updater_rot_y = attr_value;
     190                                                if( attr_name == "rot_z" )
     191                                                        updater_rot_z = attr_value;
     192                                                attr = attr->next;
     193                                        }
     194                                }
     195                                if(sub_cur_node->type == XML_ELEMENT_NODE && sub_node_name == "label")
     196                                {
     197                                        xmlAttr  *attr = sub_cur_node->properties;
     198                                        while ( attr )
     199                                        {
     200                                                std::string attr_name=reinterpret_cast<const char*>(attr->name);
     201                                                std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     202                                                if( attr_name == "text" )
     203                                                        updater_label = attr_value;
     204                                                attr = attr->next;
     205                                        }
     206                                }
     207                        }
     208                }
    176209
    177210                if(cur_node->type == XML_ELEMENT_NODE && node_name == "cameraoffset")
     
    319352        {
    320353                updater = new osgVisual::object_updater(object);
     354                object->addUpdater( updater );
    321355        }
    322356        object->setCameraOffset( cam_trans_x, cam_trans_y, cam_trans_z, cam_rot_x, cam_rot_y, cam_rot_z);
     
    328362        }
    329363
    330         if(updater.valid())
    331                 object->addUpdater( updater ); 
    332 
    333         /*
    334         - updater [optional]: Channels to use for position and attitude update
    335 
    336         <updater>
    337           <translation-slots>todo</translation-slots>
    338         </updater>
    339     */
    340 
     364        //if(updater.valid())
     365        //{
     366 //             object->addUpdater( updater ); 
     367        //      std::string updater_lat="", updater_lon="", updater_alt="", updater_rot_x="", updater_rot_y="", updater_rot_z="", updater_label="";
     368        //}
     369
     370
     371       
    341372        OSG_NOTIFY( osg::ALWAYS ) << "Done." << std::endl;
    342373        return object;
Note: See TracChangeset for help on using the changeset viewer.