00001
00013 #ifndef LGL_LOCATION_HPP
00014 #define LGL_LOCATION_HPP
00015
00016 #include <iostream>
00017
00018
00019 namespace jafar {
00020 namespace lgl {
00021
00022 struct NavLocation {
00023
00031 int pos_x;
00032 int pos_y;
00033 int pos_z;
00034
00035
00036 double utm_x;
00037 double utm_y;
00038 double utm_z;
00039
00040
00041
00042
00043
00044 float safeRadius;
00045
00046
00047 NavLocation():pos_x(0),pos_y(0),pos_z(0),utm_x(0.0),utm_y(0.0),utm_z(0.0),safeRadius(-1.0) {}
00048
00049 NavLocation(int in_xxx, int in_yyy):
00050 pos_x(in_xxx),pos_y(in_yyy),pos_z(0),utm_x(0.0),utm_y(0.0),utm_z(0.0),safeRadius(-1.0) {}
00051
00052 NavLocation(int in_xxx, int in_yyy, int in_zzz):
00053 pos_x(in_xxx),pos_y(in_yyy),pos_z(in_zzz),utm_x(0.0),utm_y(0.0),utm_z(0.0),safeRadius(-1.0) {}
00054
00055
00056 void setSafeRadius(float sr) { safeRadius = sr; }
00057 void setPos(int in_xxx, int in_yyy) {pos_x=in_xxx;pos_y=in_yyy;}
00058 void setUTMPos(double in_xxx, double in_yyy, double _z) {
00059 utm_x = in_xxx;
00060 utm_y = in_yyy;
00061 utm_z = _z;
00062 }
00063
00066 void updateUTMPos(
00067 double utmXRoot,
00068 double utmYRoot,
00069 double cellXRes,
00070 double cellYRes
00071 )
00072 {
00073 utm_x = utmXRoot + ((double)(pos_x)/2.0) * cellXRes;
00074
00075 utm_y = utmYRoot + ((double)(pos_y)/2.0) * cellYRes;
00076
00077 }
00078
00079 int x() const {return pos_x;}
00080 int y() const {return pos_y;}
00081
00082 bool operator==(const NavLocation &rhs) const
00083 {
00084 return (pos_x == rhs.pos_x) && (pos_y == rhs.pos_y);
00085 }
00086
00087 bool operator!=(const NavLocation &rhs) const
00088 {
00089 return (pos_x != rhs.pos_x) || (pos_y != rhs.pos_y);
00090 }
00091
00092 NavLocation& operator=(const NavLocation& loc) {
00093 pos_x=loc.pos_x;
00094 pos_y=loc.pos_y;
00095 utm_x = loc.utm_x;
00096 utm_y = loc.utm_y;
00097 utm_z = loc.utm_z;
00098 safeRadius = loc.safeRadius;
00099 return *this;
00100 }
00101
00102 };
00103
00104 std::ostream& operator<<(std::ostream& out, const NavLocation &loc);
00105
00106 }
00107 }
00108
00109 #endif