childChanged(child);
}
+ //----------------------------------------------------------------------------
+ bool Element::setStyle(const SGPropertyNode* child)
+ {
+ StyleSetters::const_iterator setter =
+ _style_setters.find(child->getNameString());
+ if( setter == _style_setters.end() )
+ return false;
+
+ setter->second(child);
+ return true;
+ }
+
//----------------------------------------------------------------------------
void Element::setBoundingBox(const osg::BoundingBox& bb)
{
setStyle(style.second);
}
- //----------------------------------------------------------------------------
- bool Element::setStyle(const SGPropertyNode* child)
- {
- StyleSetters::const_iterator setter =
- _style_setters.find(child->getNameString());
- if( setter == _style_setters.end() )
- return false;
-
- setter->second(child);
- return true;
- }
-
} // namespace canvas
} // namespace simgear
SGPropertyNode * child );
virtual void valueChanged(SGPropertyNode * child);
+ virtual bool setStyle(const SGPropertyNode* child);
+
/**
* Write the given bounding box to the property tree
*/
void setDrawable(osg::Drawable* drawable);
void setupStyle();
- bool setStyle(const SGPropertyNode* child);
private:
return false;
}
+ //----------------------------------------------------------------------------
+ bool Group::setStyle(const SGPropertyNode* style)
+ {
+ if( style->getParent() != _node
+ && _style.find(style->getNameString()) != _style.end() )
+ return false;
+
+ bool handled = false;
+ BOOST_FOREACH( ChildList::value_type child, _children )
+ {
+ if( child.second->setStyle(style) )
+ handled = true;
+ }
+
+ return handled;
+ }
+
//----------------------------------------------------------------------------
osg::BoundingBox Group::getTransformedBounds(const osg::Matrix& m) const
{
}
_style[ child->getNameString() ] = child;
+ setStyle(child);
}
//----------------------------------------------------------------------------
virtual bool traverse(EventVisitor& visitor);
+ virtual bool setStyle(const SGPropertyNode* child);
+
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const;
protected: