Changeset 209 for osgVisual/trunk


Ignore:
Timestamp:
Jan 27, 2011, 9:31:58 PM (14 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
osgVisual/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/include/object/object_updater.h

    r88 r209  
    9292        void addUpdater( object_updater* updater_ );
    9393
     94        /**
     95         * \brief This function defines the slots to use for updating the object.
     96         *
     97         * If a lot is empty, the objectname will be used with a suffix describing the channel. For details look for the implementation.
     98         *
     99         * @param lat_
     100         * @param lon_
     101         * @param alt_
     102         * @param rot_x_
     103         * @param rot_y_
     104         * @param rot_z_
     105         * @param label_
     106         */
     107        void setUpdaterSlotNames( osgVisual::visual_object* object_, std::string lat_, std::string lon_, std::string alt_, std::string rot_x_, std::string rot_y_, std::string rot_z_, std::string label_);
     108
     109
    94110protected:
    95111        /**
     
    98114        osg::ref_ptr<object_updater> updater;
    99115
     116        /**
     117         * Names of the Slots the updater should use
     118         */
     119        std::string updater_lat, updater_lon, updater_alt, updater_rot_x, updater_rot_y, updater_rot_z, updater_label;
     120
    100121};
    101122
  • osgVisual/trunk/src/object/object_updater.cpp

    r88 r209  
    3535
    3636       
    37         object_->lat = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_POS_LAT", osgVisual::dataIO_slot::TO_OBJ ));
    38         object_->lon = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_POS_LON", osgVisual::dataIO_slot::TO_OBJ ));
    39         object_->alt = osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_POS_ALT", osgVisual::dataIO_slot::TO_OBJ );
    40         object_->azimuthAngle_psi = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_ROT_Z", osgVisual::dataIO_slot::TO_OBJ ));
    41         object_->pitchAngle_theta = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_ROT_Y", osgVisual::dataIO_slot::TO_OBJ ));
    42         object_->bankAngle_phi = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(object_->getName()+"_ROT_X", osgVisual::dataIO_slot::TO_OBJ ));
     37        object_->lat = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(updater_lat, osgVisual::dataIO_slot::TO_OBJ ));
     38        object_->lon = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(updater_lon, osgVisual::dataIO_slot::TO_OBJ ));
     39        object_->alt = osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(updater_alt, osgVisual::dataIO_slot::TO_OBJ );
     40        object_->azimuthAngle_psi = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(updater_rot_z, osgVisual::dataIO_slot::TO_OBJ ));
     41        object_->pitchAngle_theta = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(updater_rot_y, osgVisual::dataIO_slot::TO_OBJ ));
     42        object_->bankAngle_phi = osg::DegreesToRadians(osgVisual::visual_dataIO::getInstance()->getSlotDataAsDouble(updater_rot_x, osgVisual::dataIO_slot::TO_OBJ ));
    4343
    4444        //object_->setCameraOffsetTranslation(0.0, -150.0, 50.0);       // Trans: (rechts davon, longitudinal, vertikal)
     
    4646        object_->setCameraOffsetRotation( osg::DegreesToRadians(0.0), osg::DegreesToRadians(-15.0), osg::DegreesToRadians(-90.0) );
    4747       
    48 
     48std::string updater_label;
    4949
    5050        // Finally execute nested PreUpdater
     
    6969                updater = updater_;
    7070}
     71
     72void object_updater::setUpdaterSlotNames( osgVisual::visual_object* object_, std::string lat_, std::string lon_, std::string alt_, std::string rot_x_, std::string rot_y_, std::string rot_z_, std::string label_)
     73{
     74        if(lat_!="")
     75                updater_lat = lat_;
     76        else
     77                updater_lat = object_->getName()+"_POS_LAT";
     78
     79        if(lon_!="")
     80                updater_lon = lon_;
     81        else
     82                updater_lon = object_->getName()+"_POS_LON";
     83
     84        if(alt_!="")
     85                updater_alt = alt_;
     86        else
     87                updater_alt = object_->getName()+"_POS_ALT";
     88
     89        if(rot_x_!="")
     90                updater_rot_x = rot_x_;
     91        else
     92                updater_rot_x = object_->getName()+"_ROT_X";
     93
     94        if(rot_y_!="")
     95                updater_rot_y = rot_y_;
     96        else
     97                updater_rot_y = object_->getName()+"_ROT_Y";
     98
     99        if(rot_z_!="")
     100                updater_rot_z = rot_z_;
     101        else
     102                updater_rot_z = object_->getName()+"_ROT_Z";
     103
     104        if(label_!="")
     105                updater_label = label_;
     106        else
     107                updater_label = object_->getName()+"_LABEL";
     108}
  • osgVisual/trunk/src/object/visual_object.cpp

    r208 r209  
    362362        }
    363363
    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        
     364        if(updater.valid())
     365        {
     366                updater->setUpdaterSlotNames( object, updater_lat, updater_lon, updater_alt, updater_rot_x, updater_rot_y, updater_rot_z, updater_label);
     367        }
     368
    372369        OSG_NOTIFY( osg::ALWAYS ) << "Done." << std::endl;
    373370        return object;
Note: See TracChangeset for help on using the changeset viewer.