ProxyNode
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_ProxyNode
#define OSG_ProxyNode 1
#include <osg/Group>
namespace osg {
class OSG_EXPORT ProxyNode : public Group
{
public :
ProxyNode();
ProxyNode(const ProxyNode&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, ProxyNode);
typedef osg::BoundingSphere::vec_type vec_type;
typedef osg::BoundingSphere::value_type value_type;
virtual void traverse(NodeVisitor& nv);
using osg::Group::addChild;
virtual bool addChild(Node *child);
virtual bool addChild(Node *child, const std::string& filename);
template<class T> bool addChild( const ref_ptr<T>& child, const std::string& filename) { return addChild(child.get(), filename); }
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
void setDatabaseOptions(osg::Referenced* options) { _databaseOptions = options; }
osg::Referenced* getDatabaseOptions() { return _databaseOptions.get(); }
const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); }
void setDatabasePath(const std::string& path);
inline const std::string& getDatabasePath() const { return _databasePath; }
void setFileName(unsigned int childNo, const std::string& filename) { expandFileNameListTo(childNo); _filenameList[childNo].first=filename; }
const std::string& getFileName(unsigned int childNo) const { return _filenameList[childNo].first; }
unsigned int getNumFileNames() const { return _filenameList.size(); }
osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) { return _filenameList[childNo].second; }
const osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) const { return _filenameList[childNo].second; }
enum CenterMode
{
USE_BOUNDING_SPHERE_CENTER,
USER_DEFINED_CENTER,
UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
};
void setCenterMode(CenterMode mode) { _centerMode=mode; }
CenterMode getCenterMode() const { return _centerMode; }
enum LoadingExternalReferenceMode
{
LOAD_IMMEDIATELY,
DEFER_LOADING_TO_DATABASE_PAGER,
NO_AUTOMATIC_LOADING
};
void setLoadingExternalReferenceMode(LoadingExternalReferenceMode mode) { _loadingExtReference=mode; }
LoadingExternalReferenceMode getLoadingExternalReferenceMode() const { return _loadingExtReference; }
inline void setCenter(const vec_type& center) { if (_centerMode!=UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED) { _centerMode=USER_DEFINED_CENTER; } _userDefinedCenter = center; }
inline const vec_type& getCenter() const { if ((_centerMode==USER_DEFINED_CENTER)||(_centerMode==UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED)) return _userDefinedCenter; else return getBound().center(); }
inline void setRadius(value_type radius) { _radius = radius; }
inline value_type getRadius() const { return _radius; }
virtual BoundingSphere computeBound() const;
protected :
virtual ~ProxyNode() {}
void expandFileNameListTo(unsigned int pos);
typedef std::pair< std::string, osg::ref_ptr<osg::Referenced> > FileNameDatabaseRequestPair;
typedef std::vector<FileNameDatabaseRequestPair> FileNameDatabaseRequestList;
FileNameDatabaseRequestList _filenameList;
ref_ptr<Referenced> _databaseOptions;
std::string _databasePath;
LoadingExternalReferenceMode _loadingExtReference;
CenterMode _centerMode;
vec_type _userDefinedCenter;
value_type _radius;
};
}
#endif
Group
osg::BoundingSphereImpl< Vec3d >::vec_type
Vec3d vec_type
Definition BoundingSphere:37
osg::BoundingSphereImpl< Vec3d >::value_type
Vec3d::value_type value_type
Definition BoundingSphere:38
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Group::addChild
virtual bool addChild(Node *child)
osg::Group::Group
Group()
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node
Definition Node:72
osg::Node::getBound
const BoundingSphere & getBound() const
Definition Node:425
osg::ProxyNode::addChild
bool addChild(const ref_ptr< T > &child, const std::string &filename)
Definition ProxyNode:45
osg::ProxyNode::getFileName
const std::string & getFileName(unsigned int childNo) const
Definition ProxyNode:66
osg::ProxyNode::_userDefinedCenter
vec_type _userDefinedCenter
Definition ProxyNode:140
osg::ProxyNode::LoadingExternalReferenceMode
LoadingExternalReferenceMode
Definition ProxyNode:95
osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER
@ DEFER_LOADING_TO_DATABASE_PAGER
Definition ProxyNode:97
osg::ProxyNode::LOAD_IMMEDIATELY
@ LOAD_IMMEDIATELY
Definition ProxyNode:96
osg::ProxyNode::NO_AUTOMATIC_LOADING
@ NO_AUTOMATIC_LOADING
Definition ProxyNode:98
osg::ProxyNode::traverse
virtual void traverse(NodeVisitor &nv)
osg::ProxyNode::setLoadingExternalReferenceMode
void setLoadingExternalReferenceMode(LoadingExternalReferenceMode mode)
Definition ProxyNode:102
osg::ProxyNode::_centerMode
CenterMode _centerMode
Definition ProxyNode:139
osg::ProxyNode::getCenter
const vec_type & getCenter() const
Definition ProxyNode:112
osg::ProxyNode::getNumFileNames
unsigned int getNumFileNames() const
Definition ProxyNode:67
osg::ProxyNode::ProxyNode
ProxyNode(const ProxyNode &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::ProxyNode::setCenter
void setCenter(const vec_type &center)
Definition ProxyNode:109
osg::ProxyNode::_radius
value_type _radius
Definition ProxyNode:141
osg::ProxyNode::computeBound
virtual BoundingSphere computeBound() const
osg::ProxyNode::setDatabaseOptions
void setDatabaseOptions(osg::Referenced *options)
Definition ProxyNode:51
osg::ProxyNode::expandFileNameListTo
void expandFileNameListTo(unsigned int pos)
osg::ProxyNode::setDatabasePath
void setDatabasePath(const std::string &path)
osg::ProxyNode::vec_type
osg::BoundingSphere::vec_type vec_type
Definition ProxyNode:34
osg::ProxyNode::getCenterMode
CenterMode getCenterMode() const
Definition ProxyNode:91
osg::ProxyNode::getDatabasePath
const std::string & getDatabasePath() const
Definition ProxyNode:63
osg::ProxyNode::~ProxyNode
virtual ~ProxyNode()
Definition ProxyNode:126
osg::ProxyNode::addChild
virtual bool addChild(Node *child)
osg::ProxyNode::getLoadingExternalReferenceMode
LoadingExternalReferenceMode getLoadingExternalReferenceMode() const
Definition ProxyNode:105
osg::ProxyNode::_filenameList
FileNameDatabaseRequestList _filenameList
Definition ProxyNode:133
osg::ProxyNode::_databaseOptions
ref_ptr< Referenced > _databaseOptions
Definition ProxyNode:134
osg::ProxyNode::getDatabaseRequest
osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo)
Definition ProxyNode:73
osg::ProxyNode::removeChildren
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove)
osg::ProxyNode::addChild
virtual bool addChild(Node *child, const std::string &filename)
osg::ProxyNode::getDatabaseOptions
const osg::Referenced * getDatabaseOptions() const
Definition ProxyNode:57
osg::ProxyNode::FileNameDatabaseRequestPair
std::pair< std::string, osg::ref_ptr< osg::Referenced > > FileNameDatabaseRequestPair
Definition ProxyNode:130
osg::ProxyNode::ProxyNode
ProxyNode()
osg::ProxyNode::CenterMode
CenterMode
Definition ProxyNode:81
osg::ProxyNode::USE_BOUNDING_SPHERE_CENTER
@ USE_BOUNDING_SPHERE_CENTER
Definition ProxyNode:82
osg::ProxyNode::USER_DEFINED_CENTER
@ USER_DEFINED_CENTER
Definition ProxyNode:83
osg::ProxyNode::UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
@ UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
Definition ProxyNode:84
osg::ProxyNode::_loadingExtReference
LoadingExternalReferenceMode _loadingExtReference
Definition ProxyNode:137
osg::ProxyNode::getDatabaseOptions
osg::Referenced * getDatabaseOptions()
Definition ProxyNode:54
osg::ProxyNode::setFileName
void setFileName(unsigned int childNo, const std::string &filename)
Definition ProxyNode:65
osg::ProxyNode::getDatabaseRequest
const osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo) const
Definition ProxyNode:76
osg::ProxyNode::META_Node
META_Node(osg, ProxyNode)
osg::ProxyNode::setCenterMode
void setCenterMode(CenterMode mode)
Definition ProxyNode:88
osg::ProxyNode::getRadius
value_type getRadius() const
Definition ProxyNode:120
osg::ProxyNode::_databasePath
std::string _databasePath
Definition ProxyNode:135
osg::ProxyNode::setRadius
void setRadius(value_type radius)
Definition ProxyNode:117
osg::ProxyNode::value_type
osg::BoundingSphere::value_type value_type
Definition ProxyNode:35
osg::ProxyNode::FileNameDatabaseRequestList
std::vector< FileNameDatabaseRequestPair > FileNameDatabaseRequestList
Definition ProxyNode:131
osg::Referenced
Definition Referenced:44
osg::ref_ptr
Definition ref_ptr:32
osg::ref_ptr::get
T * get() const
Definition ref_ptr:117
osg
Definition AlphaFunc:19
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39