From: James Turner Date: Sun, 20 Oct 2013 19:44:42 +0000 (+0100) Subject: Placement can contain multiple nodes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=49730cadeec1efaf6b2d51762d64f6aaa8947599;p=simgear.git Placement can contain multiple nodes. - Allow placement to have multiple children added. - Remove legacy position setting APIs, enforce use of SGGeod --- diff --git a/simgear/scene/model/placement.cxx b/simgear/scene/model/placement.cxx index 7b6a0b69..c1a7d83b 100644 --- a/simgear/scene/model/placement.cxx +++ b/simgear/scene/model/placement.cxx @@ -36,14 +36,22 @@ SGModelPlacement::~SGModelPlacement () void SGModelPlacement::init( osg::Node * model ) { - // remove previous model (in case of reinit) - _transform->removeChild(0,1); + // remove previous models (in case of reinit) + _transform->removeChild(0, _transform->getNumChildren()); if (model != 0) { _transform->addChild(model); } _selector->setValue(0, 1); } +void +SGModelPlacement::add( osg::Node* model ) +{ + if (model != 0) { + _transform->addChild(model); + } +} + void SGModelPlacement::clear() { _selector = NULL; @@ -80,30 +88,6 @@ SGModelPlacement::setVisible (bool visible) _selector->setValue(0, visible); } -void -SGModelPlacement::setLongitudeDeg (double lon_deg) -{ - _position.setLongitudeDeg(lon_deg); -} - -void -SGModelPlacement::setLatitudeDeg (double lat_deg) -{ - _position.setLatitudeDeg(lat_deg); -} - -void -SGModelPlacement::setElevationFt (double elev_ft) -{ - _position.setElevationFt(elev_ft); -} - -void -SGModelPlacement::setPosition (double lon_deg, double lat_deg, double elev_ft) -{ - _position = SGGeod::fromDegFt(lon_deg, lat_deg, elev_ft); -} - void SGModelPlacement::setPosition(const SGGeod& position) { diff --git a/simgear/scene/model/placement.hxx b/simgear/scene/model/placement.hxx index 84aecac2..ebcf67cf 100644 --- a/simgear/scene/model/placement.hxx +++ b/simgear/scene/model/placement.hxx @@ -43,6 +43,7 @@ public: virtual void init( osg::Node* model ); void clear(); + void add( osg::Node* model ); virtual void update(); @@ -51,14 +52,6 @@ public: virtual bool getVisible () const; virtual void setVisible (bool visible); - virtual double getLongitudeDeg () const { return _position.getLongitudeDeg(); } - virtual double getLatitudeDeg () const { return _position.getLatitudeDeg(); } - virtual double getElevationFt () const { return _position.getElevationFt(); } - - virtual void setLongitudeDeg (double lon_deg); - virtual void setLatitudeDeg (double lat_deg); - virtual void setElevationFt (double elev_ft); - virtual void setPosition (double lon_deg, double lat_deg, double elev_ft); void setPosition(const SGGeod& position); const SGGeod& getPosition() const { return _position; }