Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Location.hpp
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       // Triplet for UTM position
00036       double utm_x;
00037       double utm_y;
00038       double utm_z;
00039 
00040       // Location jauge about wapoint checking
00041       // Safe radius meters around that point
00042       // -1.0 means it is not set
00043       // else any value >= 0.0 is in meter around the waypoint.
00044       float safeRadius;
00045 
00046       // Default constructor
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       // (X,Y) constructor
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       // (X,Y,Z) constructor
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       // Setters
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         // using minus sign for pos_y since pos_y is negative to suite image frames.
00075         utm_y = utmYRoot + ((double)(pos_y)/2.0) * cellYRes;
00076         //utm_z = 0.0;
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 /* LGL_LOCATION_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:24 for Jafar by doxygen 1.7.6.1
LAAS-CNRS