osgEarth 2.1.1
|
00001 /* -*-c++-*- */ 00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 00003 * Copyright 2008-2009 Pelican Ventures, Inc. 00004 * http://osgearth.org 00005 * 00006 * osgEarth is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/> 00018 */ 00019 #include <osgEarthFeatures/FeatureRasterizer> 00020 #include <osgDB/ReadFile> 00021 00022 using namespace osgEarth; 00023 using namespace osgEarth::Features; 00024 00025 FeatureRasterizer::FeatureRasterizer( const osgDB::ReaderWriter::Options* options ) : 00026 _options( options ) 00027 { 00028 //NOP 00029 } 00030 00031 00032 FeatureRasterizer* 00033 FeatureRasterizerFactory::create(const std::string& driver, 00034 const Config& driverConf, 00035 const osgDB::ReaderWriter::Options* globalOptions ) 00036 { 00037 osg::ref_ptr<PluginOptions> pluginOptions = globalOptions? 00038 new PluginOptions( *globalOptions ) : 00039 new PluginOptions(); 00040 00041 // Setup the plugin options for the source 00042 pluginOptions->config() = driverConf; 00043 00044 //Load the source from the a plugin. The "." prefix causes OSG to select the correct plugin. 00045 //For instance, the WMS plugin can be loaded by using ".osgearth_wms" as the filename 00046 osg::ref_ptr<FeatureRasterizer> rasterizer = dynamic_cast<FeatureRasterizer*>( 00047 osgDB::readObjectFile( ".osgearth_rasterizer_" + driver, pluginOptions.get())); 00048 00049 if ( !rasterizer.valid() ) 00050 { 00051 osg::notify(osg::NOTICE) << "[osgEarth] Warning: Could not load Rasterizer for driver " << driver << std::endl; 00052 } 00053 00054 return rasterizer.release(); 00055 } 00056