コード例 #1
0
    // override
    // One-time initialization. This is called by osgEarth.
    Status initialize(const osgDB::Options* dbOptions)
    {
        _dbOptions = Registry::instance()->cloneOrCreateOptions(dbOptions);

        const Profile* profile = getProfile();
        if ( !profile )
        {
            profile = osgEarth::Registry::instance()->getGlobalGeodeticProfile();
            setProfile( profile );
        }

        // load the image layer:
        if ( _options.imageLayerOptions().isSet() )
        {
            _imageLayer = new ImageLayer( _options.imageLayerOptions().get() );
            _imageLayer->setTargetProfileHint( profile );
            // TODO: what about the cache?
        }

        // load the feature source:
        if ( _options.featureSourceOptions().isSet() )
        {
            _featureSource = FeatureSourceFactory::create( _options.featureSourceOptions().get() );
            _featureSource->initialize( _dbOptions.get() );
        }

        return STATUS_OK;
    }