namespace fgai {
-class HLASceneObject::Location : public simgear::HLAAbstractLocation {
-public:
- Location() :
- _position(SGVec3d::zeros()),
- _imag(SGVec3d::zeros()),
- _angularVelocity(SGVec3d::zeros()),
- _linearVelocity(SGVec3d::zeros())
- { }
-
- virtual SGLocationd getLocation() const
- { return SGLocationd(_position, SGQuatd::fromPositiveRealImag(_imag)); }
- virtual void setLocation(const SGLocationd& location)
- {
- _position = location.getPosition();
- _imag = location.getOrientation().getPositiveRealImag();
- }
-
- virtual SGVec3d getCartPosition() const
- { return _position; }
- virtual void setCartPosition(const SGVec3d& position)
- { _position = position; }
-
- virtual SGQuatd getCartOrientation() const
- { return SGQuatd::fromPositiveRealImag(_imag); }
- virtual void setCartOrientation(const SGQuatd& orientation)
- { _imag = orientation.getPositiveRealImag(); }
-
- virtual SGVec3d getAngularBodyVelocity() const
- { return _angularVelocity; }
- virtual void setAngularBodyVelocity(const SGVec3d& angularVelocity)
- { _angularVelocity = angularVelocity; }
-
- virtual SGVec3d getLinearBodyVelocity() const
- { return _linearVelocity; }
- virtual void setLinearBodyVelocity(const SGVec3d& linearVelocity)
- { _linearVelocity = linearVelocity; }
-
- virtual double getTimeDifference(const SGTimeStamp& timeStamp) const
- { return _position.getDataElement()->getTimeDifference(timeStamp); }
-
- simgear::HLADataElement* getPositionDataElement()
- { return _position.getDataElement(); }
- simgear::HLADataElement* getOrientationDataElement()
- { return _imag.getDataElement(); }
-
- simgear::HLADataElement* getAngularVelocityDataElement()
- { return _angularVelocity.getDataElement(); }
- simgear::HLADataElement* getLinearVelocityDataElement()
- { return _linearVelocity.getDataElement(); }
-
-private:
- simgear::HLAVec3dData _position;
- simgear::HLAVec3dData _imag;
-
- simgear::HLAVec3dData _angularVelocity;
- simgear::HLAVec3dData _linearVelocity;
-};
-
-
HLASceneObject::HLASceneObject(HLASceneObjectClass* objectClass) :
HLAObjectInstance(objectClass)
{
assert(dynamic_cast<HLASceneObjectClass*>(getObjectClass().get()));
HLASceneObjectClass& objectClass = static_cast<HLASceneObjectClass&>(*getObjectClass());
- Location* location = new Location;
+ simgear::HLACartesianLocation* location = new simgear::HLACartesianLocation;
setAttributeDataElement(objectClass.getPositionIndex(), location->getPositionDataElement());
setAttributeDataElement(objectClass.getOrientationIndex(), location->getOrientationDataElement());
setAttributeDataElement(objectClass.getAngularVelocityIndex(), location->getAngularVelocityDataElement());