Reorganised the Group::removeChild and Geode::removeDrawable methods so
that removeChild(Node*), removeChild(uint) and equivilant Geode methods are now inline methods, not designed to be overriden, and seperated out the multiple remove method to be called removeChildren(uint, uint) which is now the only virtual method. There removeChildren is now the method to override in subclasses. This reorganisation requires some call code to be rename removeChild usage to removeChildren.
This commit is contained in:
@@ -65,7 +65,7 @@ class OSG_EXPORT Geode : public Node
|
||||
* @return \c true if at least one \c Drawable was removed. \c false
|
||||
* otherwise.
|
||||
*/
|
||||
virtual bool removeDrawable(unsigned int i,unsigned int numDrawablesToRemove=1);
|
||||
virtual bool removeDrawables(unsigned int i,unsigned int numDrawablesToRemove=1);
|
||||
|
||||
/** Replace specified Drawable with another Drawable.
|
||||
* Equivalent to <tt>setDrawable(getDrawableIndex(origDraw),newDraw)</tt>,
|
||||
|
||||
@@ -63,10 +63,32 @@ class OSG_EXPORT Group : public Node
|
||||
* bounding sphere to force it to recompute on next getBound() and
|
||||
* return true for success. If Node is not found then return false
|
||||
* and do not change the reference count of the Node.
|
||||
* Note, do not override, only override removeChildren(,) is required.
|
||||
*/
|
||||
virtual bool removeChild( Node *child );
|
||||
inline bool removeChild( Node *child )
|
||||
{
|
||||
unsigned int pos = getChildIndex(child);
|
||||
if (pos<_children.size()) return removeChildren(pos,1);
|
||||
else return false;
|
||||
}
|
||||
|
||||
virtual bool removeChild(unsigned int pos,unsigned int numChildrenToRemove=1);
|
||||
/** Remove Node from Group.
|
||||
* If Node is contained in Group then remove it from the child
|
||||
* list, decrement its reference count, and dirty the
|
||||
* bounding sphere to force it to recompute on next getBound() and
|
||||
* return true for success. If Node is not found then return false
|
||||
* and do not change the reference count of the Node.
|
||||
* Note, do not override, only override removeChildren(,) is required.
|
||||
*/
|
||||
inline bool removeChild( unsigned int pos )
|
||||
{
|
||||
if (pos<_children.size()) return removeChildren(pos,1);
|
||||
else return false;
|
||||
}
|
||||
|
||||
/** Remove children from Group.
|
||||
* Note, must be override by subclasses of Group which add per child attributes.*/
|
||||
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
|
||||
|
||||
/** Replace specified Node with another Node.
|
||||
* Equivalent to setChild(getChildIndex(orignChild),node)
|
||||
|
||||
@@ -49,8 +49,7 @@ class OSG_EXPORT LOD : public Group
|
||||
|
||||
virtual bool addChild(Node *child, float min, float max);
|
||||
|
||||
virtual bool removeChild(Node *child);
|
||||
|
||||
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1);
|
||||
|
||||
typedef std::pair<float,float> MinMaxPair;
|
||||
typedef std::vector<MinMaxPair> RangeList;
|
||||
@@ -124,12 +123,6 @@ class OSG_EXPORT LOD : public Group
|
||||
protected :
|
||||
virtual ~LOD() {}
|
||||
|
||||
virtual void childRemoved(unsigned int pos, unsigned int numChildrenToRemove);
|
||||
virtual void childInserted(unsigned int pos);
|
||||
|
||||
virtual void rangeRemoved(unsigned int /*pos*/, unsigned int /*numChildrenToRemove*/) {}
|
||||
virtual void rangeInserted(unsigned int /*pos*/) {}
|
||||
|
||||
CenterMode _centerMode;
|
||||
Vec3 _userDefinedCenter;
|
||||
float _radius;
|
||||
|
||||
@@ -41,11 +41,10 @@ class OSG_EXPORT PagedLOD : public LOD
|
||||
|
||||
virtual bool addChild(Node *child, float min, float max,const std::string& filename, float priorityOffset=0.0f, float priorityScale=1.0f);
|
||||
|
||||
virtual bool removeChild(Node *child);
|
||||
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1);
|
||||
|
||||
|
||||
|
||||
|
||||
/** Set the database path to prepend to children's filenames.*/
|
||||
void setDatabasePath(const std::string& path);
|
||||
|
||||
@@ -112,12 +111,6 @@ class OSG_EXPORT PagedLOD : public LOD
|
||||
protected :
|
||||
|
||||
virtual ~PagedLOD() {}
|
||||
|
||||
virtual void childRemoved(unsigned int pos, unsigned int numChildrenToRemove);
|
||||
virtual void childInserted(unsigned int pos);
|
||||
|
||||
virtual void rangeRemoved(unsigned int pos, unsigned int numChildrenToRemove);
|
||||
virtual void rangeInserted(unsigned int pos);
|
||||
|
||||
void expandPerRangeDataTo(unsigned int pos);
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ class OSG_EXPORT ProxyNode : public Group
|
||||
|
||||
virtual bool addChild(Node *child);
|
||||
virtual bool addChild(Node *child, const std::string& filename);
|
||||
virtual bool removeChild(Node *child);
|
||||
|
||||
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
|
||||
|
||||
/** Set the database path to prepend to children's filenames.*/
|
||||
void setDatabasePath(const std::string& path);
|
||||
|
||||
@@ -49,9 +49,7 @@ class OSG_EXPORT Switch : public Group
|
||||
|
||||
virtual bool insertChild( unsigned int index, Node *child, bool value );
|
||||
|
||||
virtual bool removeChild( Node *child );
|
||||
|
||||
virtual bool removeChild(unsigned int pos,unsigned int numChildrenToRemove=1);
|
||||
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
|
||||
|
||||
|
||||
void setValue(unsigned int pos,bool value);
|
||||
|
||||
Reference in New Issue
Block a user