Ignore:
Timestamp:
Nov 12, 2010, 9:13:14 AM (13 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/src/vista2D/visual_vista2D.cpp

    r155 r156  
    2626   // Create a Vista2D View
    2727   view = new Vista2D::VistaView();
     28
     29        vistaProjectfile = "";
     30        paintBackground = false;
     31        playanimation = false;
     32        position_x = 0;
     33        position_y = 0;
     34        zoom = 1;
    2835}
    2936
    3037visual_vista2D::~visual_vista2D(void)
    3138{
    32 }
    33 
    34 void visual_vista2D::startVista2D(std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom)
     39        view->stopView();
     40}
     41
     42void visual_vista2D::startVista2D()
    3543{
    3644    /***************
     
    3947        view->load( vistaProjectfile );
    4048    view->setBackgroundMode(paintBackground);   // don't paint background
    41         view->setPosition( posX, posY);
     49        view->setPosition( position_x, position_y);
    4250        view->setZoom( zoom );
    4351
     
    4654    self running datasource
    4755    ***************/
    48     view->startView (true);
    49 
    50 }
    51 
    52 bool visual_vista2D::processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom)
     56    view->startView (playanimation);
     57}
     58
     59bool visual_vista2D::processXMLConfiguration()
    5360{
    5461        // Init XML
     
    109116                                                std::stringstream sstr(attr_value);
    110117                                                sstr >> zoom;
     118                                        }
     119
     120                                        if( attr_name == "playanimation" )
     121                                        {
     122                                                playanimation = (attr_value == "yes") ? true : false;
    111123                                        }
    112124
     
    133145        OSG_NOTIFY (osg::ALWAYS ) << "visual_vista2D initialize..";  // The sentence is finished by the init result...
    134146
    135         std::string vistaProjectfile = "";
    136         bool paintBackground = false;
    137         int position_x = 0;
    138         int position_y = 0;
    139         float zoom = 1;
     147        this->configFileName = configFileName;
    140148
    141149        // Process XML configuration
    142         if(!processXMLConfiguration(configFileName, vistaProjectfile, paintBackground, position_x, position_y, zoom))
     150        if(!processXMLConfiguration())
    143151                return false;   // Abort vista2D initialization.
    144152
     
    184192
    185193        // Add Payload: Vista2D                 
    186         osg::ref_ptr<visual_vista2D> vista2D = new visual_vista2D();
    187         vista2D->startVista2D(vistaProjectfile, paintBackground, position_x, position_y, zoom);
    188 
    189         vista2D.get()->setUseDisplayList( false );
    190         vista2Dgeode->addDrawable( vista2D.get() );
     194        startVista2D();
     195
     196        // Add this class to the scene Graph
     197        this->setUseDisplayList( false );
     198        vista2Dgeode->addDrawable( this );
    191199
    192200        sceneGraphRoot_->addChild( vista2DProjectionMatrix );
Note: See TracChangeset for help on using the changeset viewer.