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

Legend:

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

    r153 r155  
    2222visual_vista2D::visual_vista2D(void)
    2323{
     24        OSG_NOTIFY (osg::ALWAYS ) << "visual_vista2D instantiated." << std::endl;
     25
    2426   // Create a Vista2D View
    2527   view = new Vista2D::VistaView();
    26 
    27         filename = "";
    28         paintBackground = false;;
    29         position_x = 600;
    30         position_y = 400;
    31         zoom = 0.5;
    3228}
    3329
     
    3632}
    3733
    38 void visual_vista2D::startVista2D(std::string vista2DFilename_)
     34void visual_vista2D::startVista2D(std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom)
    3935{
    4036    /***************
    4137    load view
    4238    ***************/
    43         view->load( filename );
     39        view->load( vistaProjectfile );
    4440    view->setBackgroundMode(paintBackground);   // don't paint background
    45         view->setPosition( position_x,position_y);
     41        view->setPosition( posX, posY);
    4642        view->setZoom( zoom );
    4743
     
    5450}
    5551
    56 bool visual_vista2D::processXMLConfiguration()
     52bool visual_vista2D::processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom)
    5753{
    5854        // Init XML
    5955        xmlDoc* tmpDoc;
    6056        bool disabled;
    61         xmlNode* config = util::getModuleXMLConfig( configFileName, "vista2D", tmpDoc, disabled );
     57        xmlNode* config = util::getModuleXMLConfig( configFileName, "vista2d", tmpDoc, disabled );
    6258
    6359        if( disabled)
     
    8985                                        if( attr_name == "filename" )
    9086                                        {
    91                                                 filename=attr_value
     87                                                vistaProjectfile=attr_value;
    9288                                        }
    9389
     
    137133        OSG_NOTIFY (osg::ALWAYS ) << "visual_vista2D initialize..";  // The sentence is finished by the init result...
    138134
    139         this->configFileName = configFileName;
    140 
    141         // Analyse XML configuration file
    142                 // Process XML configuration
    143         if(!processXMLConfiguration())
     135        std::string vistaProjectfile = "";
     136        bool paintBackground = false;
     137        int position_x = 0;
     138        int position_y = 0;
     139        float zoom = 1;
     140
     141        // Process XML configuration
     142        if(!processXMLConfiguration(configFileName, vistaProjectfile, paintBackground, position_x, position_y, zoom))
    144143                return false;   // Abort vista2D initialization.
    145144
    146         // Check if Vista2D file exist
    147         if (! osgDB::fileExists( filename ) )
    148         {
    149                 osg::notify( osg::WARN ) << "WARNING: visual_vista2D::createVistaOverlay - Could not find specified Vista2D projectfile. Skip adding Vista2D project." << std::endl;
     145        // Check if Vista2D project file exists
     146        if ( !osgDB::fileExists(vistaProjectfile) )
     147        {
     148                OSG_ALWAYS << "WARNING: visual_vista2D::init() - Specified vista2D projectfile '"<< vistaProjectfile <<"' does not exist! Skip using Vista2D!" << std::endl;
    150149                return false;
    151150        }
     
    186185        // Add Payload: Vista2D                 
    187186        osg::ref_ptr<visual_vista2D> vista2D = new visual_vista2D();
    188         vista2D->startVista2D( vista2DFilename_ );
     187        vista2D->startVista2D(vistaProjectfile, paintBackground, position_x, position_y, zoom);
    189188
    190189        vista2D.get()->setUseDisplayList( false );
Note: See TracChangeset for help on using the changeset viewer.