]> git.mxchange.org Git - flightgear.git/commitdiff
fgai: Use HLACartesianLocation instead of an own implementation.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Sun, 25 Nov 2012 21:25:27 +0000 (22:25 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Sat, 1 Dec 2012 07:05:43 +0000 (08:05 +0100)
utils/fgai/HLASceneObject.cxx
utils/fgai/HLASceneObject.hxx

index 83cd793f110eff983911d0c804fadbbc7d6d067f..30dd7ab7a22719f08f1f59d5853bb61eab828a00 100644 (file)
 
 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)
 {
@@ -104,7 +45,7 @@ HLASceneObject::createAttributeDataElements()
     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());
index aed2c10668406a76088d70e5e37ae22a78f80fdd..5b1e8a3b38333ba190dfe88830e660cd63ce3bd0 100644 (file)
@@ -36,8 +36,6 @@ public:
     void setLocation(const AIPhysics& physics);
 
 private:
-    /// Currently we have our own location. FIXME Extend Cartesian location at some point.
-    class Location;
     // The location of this object
     SGSharedPtr<simgear::HLAAbstractLocation> _location;
 };