sgp4/libsgp4/Observer.h

110 lines
2.4 KiB
C
Raw Normal View History

2013-04-01 10:33:34 +00:00
/*
* Copyright 2013 Daniel Warner <contact@danrw.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2011-12-16 23:38:28 +00:00
#ifndef OBSERVER_H_
#define OBSERVER_H_
#include "CoordGeodetic.h"
#include "Eci.h"
2012-10-11 18:52:51 +00:00
class DateTime;
2014-07-06 09:37:24 +00:00
struct CoordTopocentric;
2012-10-11 18:52:51 +00:00
/**
* @brief Stores an observers location in Eci coordinates.
*/
2011-12-16 23:38:28 +00:00
class Observer
{
public:
2012-10-11 18:52:51 +00:00
/**
* Constructor
* @param[in] latitude observers latitude in degrees
* @param[in] longitude observers longitude in degrees
* @param[in] altitude observers altitude in kilometers
*/
Observer(const double latitude,
const double longitude,
const double altitude)
: m_geo(latitude, longitude, altitude),
m_eci(DateTime(), m_geo)
2011-12-16 23:38:28 +00:00
{
}
2012-10-11 18:52:51 +00:00
/**
* Constructor
* @param[in] geo the observers position
*/
Observer(const CoordGeodetic &geo)
: m_geo(geo),
m_eci(DateTime(), geo)
2011-12-16 23:38:28 +00:00
{
}
2012-10-11 18:52:51 +00:00
/**
* Destructor
*/
2011-12-16 23:38:28 +00:00
virtual ~Observer()
{
}
2012-10-11 18:52:51 +00:00
/**
* Set the observers location
* @param[in] geo the observers position
*/
void SetLocation(const CoordGeodetic& geo)
2011-12-16 23:38:28 +00:00
{
2012-10-11 18:52:51 +00:00
m_geo = geo;
m_eci.Update(m_eci.GetDateTime(), m_geo);
2011-12-16 23:38:28 +00:00
}
2012-10-11 18:52:51 +00:00
/**
* Get the observers location
* @returns the observers position
*/
2011-12-16 23:38:28 +00:00
CoordGeodetic GetLocation() const
{
2012-10-11 18:52:51 +00:00
return m_geo;
2011-12-16 23:38:28 +00:00
}
2012-10-11 18:52:51 +00:00
/**
* Get the look angle for the observers position to the object
* @param[in] eci the object to find the look angle to
* @returns the lookup angle
*/
CoordTopocentric GetLookAngle(const Eci &eci);
2011-12-16 23:38:28 +00:00
private:
2012-10-11 18:52:51 +00:00
/**
* @param[in] dt the date to update the observers position for
*/
void Update(const DateTime &dt)
2011-12-16 23:38:28 +00:00
{
2012-10-11 18:52:51 +00:00
if (m_eci != dt)
2011-12-16 23:38:28 +00:00
{
2012-10-11 18:52:51 +00:00
m_eci.Update(dt, m_geo);
2011-12-16 23:38:28 +00:00
}
}
2012-10-11 18:52:51 +00:00
/** the observers position */
CoordGeodetic m_geo;
/** the observers Eci for a particular time */
Eci m_eci;
2011-12-16 23:38:28 +00:00
};
#endif