00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _GEOCOORD_H_
00033 #define _GEOCOORD_H_
00034
00035 #include <simgear/compiler.h>
00036
00037
00038 #include <math.h>
00039 #include <vector>
00040
00041 #include <simgear/constants.h>
00042
00043 class SGGeoCoord
00044 {
00045 protected:
00046 float lat;
00047 float lon;
00048
00049 public:
00050 SGGeoCoord() { lat = 0.0; lon = 0.0;};
00051 SGGeoCoord(float la, float lo) { lat = la; lon = lo;};
00052 SGGeoCoord(const SGGeoCoord& other);
00053 virtual ~SGGeoCoord() {};
00054
00055 void set(float la, float lo) { lat = la; lon = lo; };
00056 float getLat() const { return lat; };
00057 float getLon() const { return lon; };
00058 float getX() const { return cos(SGD_DEGREES_TO_RADIANS*lat) * cos(SGD_DEGREES_TO_RADIANS*lon); };
00059 float getY() const { return cos(SGD_DEGREES_TO_RADIANS*lat) * sin(SGD_DEGREES_TO_RADIANS*lon); };
00060 float getZ() const { return sin(SGD_DEGREES_TO_RADIANS*lat); };
00061
00062
00063 virtual const char * getDescription() {return 0;};
00064 };
00065
00066 typedef std::vector<SGGeoCoord*> SGGeoCoordVector;
00067 typedef std::vector<SGGeoCoord*>::iterator SGGeoCoordVectorIterator;
00068 typedef std::vector<SGGeoCoord*>::const_iterator SGGeoCoordVectorConstIterator;
00069
00070
00071
00072
00073
00074
00075
00076 class SGGeoCoordContainer
00077 {
00078 protected:
00079 SGGeoCoordVector data;
00080
00081 public:
00082 SGGeoCoordContainer() {};
00083 virtual ~SGGeoCoordContainer();
00084
00085 const SGGeoCoordVector& getData() const { return data; };
00086 SGGeoCoord* getNearest(const SGGeoCoord& ref) const;
00087 };
00088
00089
00090 #endif // _GEO_COORD_H_