osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthFeatures/FeatureModelGraph

Go to the documentation of this file.
00001 /* --*-c++-*-- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003  * Copyright 2008-2010 Pelican Mapping
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 
00020 #ifndef OSGEARTHFEATURES_FEATURE_MODEL_GRAPH_H
00021 #define OSGEARTHFEATURES_FEATURE_MODEL_GRAPH_H 1
00022 
00023 #include <osgEarthFeatures/Common>
00024 #include <osgEarthFeatures/FeatureModelSource>
00025 #include <osgEarthFeatures/Session>
00026 #include <osgEarthSymbology/Style>
00027 #include <osgEarth/ThreadingUtils>
00028 #include <osg/Node>
00029 #include <set>
00030 
00031 namespace osgEarth { namespace Features
00032 {
00033     using namespace osgEarth;
00034     using namespace osgEarth::Symbology;
00035 
00043     class OSGEARTHFEATURES_EXPORT FeatureModelGraph : public osg::Group
00044     {
00045     public:
00058         FeatureModelGraph( 
00059             FeatureSource*                   source,
00060             const FeatureModelSourceOptions& options,
00061             FeatureNodeFactory*              factory,
00062             Session*                         session );
00063 
00067         osg::Node* load( unsigned lod, unsigned tileX, unsigned tileY, const std::string& uri );
00068 
00069         StyleSheet* getStyles() { return _session->styles(); }
00070 
00071         void setStyles( StyleSheet* styles );
00072 
00073         void dirty();
00074 
00075 
00076         virtual void traverse(osg::NodeVisitor& nv);
00077 
00078     protected:
00079         virtual ~FeatureModelGraph();
00080 
00081         void setupPaging();
00082 
00083         osg::Group* build( const FeatureLevel& level, const GeoExtent& extent, const TileKey* key);
00084 
00085         osg::Group* build( const Style& baseStyle, const Query& baseQuery, const GeoExtent& extent );
00086 
00087     private:
00088         
00089         osg::Group* createNodeForStyle(const Style& style, const Query& query);
00090        
00091         osg::BoundingSphered getBoundInWorldCoords( const GeoExtent& extent, const MapFrame* mapf ) const;
00092 
00093         void buildSubTilePagedLODs(
00094             unsigned lod, unsigned tileX, unsigned tileY,
00095             const MapFrame* mapFrame, osg::Group* parent);
00096 
00097         void redraw();
00098 
00099     private:
00100         FeatureModelSourceOptions        _options;
00101         osg::ref_ptr<FeatureSource>      _source;
00102         osg::ref_ptr<FeatureNodeFactory> _factory;
00103         osg::ref_ptr<Session>            _session;
00104         UID                              _uid;
00105         std::set<std::string>            _blacklist;
00106         Threading::ReadWriteMutex        _blacklistMutex;
00107         GeoExtent                        _usableFeatureExtent;
00108         bool                             _featureExtentClamped;
00109         GeoExtent                        _usableMapExtent;
00110         osg::BoundingSphered             _fullWorldBound;
00111         bool                             _useTiledSource;
00112         osgEarth::Revision               _revision;
00113         bool                             _dirty;
00114         std::vector<const FeatureLevel*> _lodmap;
00115     };
00116 
00117 } } // namespace osgEarth::Features
00118 
00119 #endif // OSGEARTHFEATURES_FEATURE_MODEL_GRAPH_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines