Go to the documentation of this file.00001
00013 #ifndef LGL_ENVIRONMENT_GRAPH_NODE_HPP
00014 #define LGL_ENVIRONMENT_GRAPH_NODE_HPP
00015
00016 #include <lgl/Location.hpp>
00017 #include <iostream>
00018
00019 namespace jafar {
00020 namespace lgl {
00021
00026 struct NavGNode {
00028
00029 NavLocation pos;
00030
00037 double grp;
00038
00040 bool hasPotential;
00041
00047 NavGNode(int _x=0, int _y=0):pos(_x,_y), grp(0.0), hasPotential(false)
00048 { }
00049
00050 NavGNode(const NavLocation& _loc):
00051 pos(_loc.pos_x,_loc.pos_y),
00052 grp(0.0),
00053 hasPotential(false)
00054 {
00055 pos.setUTMPos(_loc.utm_x, _loc.utm_y, _loc.utm_z);
00056 }
00057
00058 ~NavGNode() { }
00059
00061 void setPotential(double val) {
00062 if (hasPotential)
00063 {
00064 grp = grp + val;
00065 } else {
00066 grp = val;
00067 hasPotential = true;
00068 }
00069 }
00070
00072 bool operator==(const NavGNode &rhs) const
00073 {
00074 return ((pos.pos_x == rhs.pos.pos_x)
00075 && (pos.pos_y == rhs.pos.pos_y)
00076 && (pos.pos_z == rhs.pos.pos_z));
00077 }
00078
00080 bool operator< (const NavGNode &rhs) const
00081 {
00082 if ( pos.pos_x < rhs.pos.pos_x ) return (true );
00083 if ( pos.pos_x > rhs.pos.pos_x ) return (false);
00084 if ( pos.pos_y < rhs.pos.pos_y ) return (true );
00085 if ( pos.pos_y > rhs.pos.pos_y ) return (false);
00086 if ( pos.pos_y > rhs.pos.pos_y ) return (true );
00087 else return (false) ;
00088 }
00089
00092 bool operator> (const NavGNode &rhs) const
00093 {
00094 if ( pos.pos_x > rhs.pos.pos_x ) return (true );
00095 if ( pos.pos_x < rhs.pos.pos_x ) return (false);
00096 if ( pos.pos_y > rhs.pos.pos_y ) return (true );
00097 if ( pos.pos_y < rhs.pos.pos_y ) return (false);
00098 if ( pos.pos_y > rhs.pos.pos_y ) return (true );
00099 else return (false) ;
00100 }
00101
00102 };
00103
00104
00105
00106 std::ostream& operator<<(std::ostream& out, NavGNode const &rhs);
00107
00108 }
00109 }
00110
00111 #endif