osgEarth 2.1.1
|
00001 /* -*-c++-*- */ 00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 00003 * Copyright 2008-2011 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 OSGEARTH_DRAPEABLE_NODE_H 00021 #define OSGEARTH_DRAPEABLE_NODE_H 1 00022 00023 #include <osgEarth/Common> 00024 #include <osgEarth/MapNode> 00025 00026 namespace osgEarth 00027 { 00032 class OSGEARTH_EXPORT DrapeableNode : public osg::Group 00033 { 00034 public: 00035 DrapeableNode( MapNode* mapNode =0L, bool draped =true ); 00036 00040 void setNode( osg::Node* node ); 00041 osg::Node* getNode() const { return _node.get(); } 00042 00046 void setDraped( bool value ); 00047 bool getDraped() const { return _draped; } 00048 00049 public: 00050 virtual void traverse( osg::NodeVisitor& nv ); 00051 00052 protected: 00053 osg::observer_ptr<MapNode> _mapNode; 00054 00055 private: 00056 bool _draped; 00057 osg::ref_ptr<osg::Node> _node; 00058 osg::ref_ptr<osg::Group> _nodeContainer; 00059 00060 int _dirty; 00061 bool _newDraped; 00062 osg::ref_ptr<osg::Node> _newNode; 00063 00064 void applyChanges(); 00065 void setNodeImpl( osg::Node* ); 00066 void setDrapedImpl( bool ); 00067 }; 00068 00069 } // namespace osgEarth 00070 00071 #endif // OSGEARTH_DRAPEABLE_NODE_H