Go to the documentation of this file.00001
00012
00013
00014 #ifdef HAVE_MODULE_QDISPLAY // lgl viewer is on if HAVE_MODULE_QDISPLAY is defined
00015
00016 #ifndef LGL_DISPLAY_HPP
00017 #define LGL_DISPLAY_HPP
00018
00019 #include <boost/graph/iteration_macros.hpp>
00020 #include <ostream>
00021 #include <limits>
00022
00023 #include <qdisplay/PolyLine.hpp>
00024 #include <qdisplay/Viewer.hpp>
00025 #include <qdisplay/ViewerManager.hpp>
00026 #include <qdisplay/ImageView.hpp>
00027 #include <qdisplay/Line.hpp>
00028 #include <qdisplay/Shape.hpp>
00029 #include <qdisplay/ImageView.hpp>
00030 #include <qdisplay/AbstractEventHandler.hpp>
00031 #include <qdisplay/Ellipsoid.hpp>
00032 #include <qdisplay/init.hpp>
00033 #include <qdisplay/Viewer.hpp>
00034
00035 #include <lgl/NavGraph.hpp>
00036 #include <lgl/VisibilityMap.hpp>
00037 #include <lgl/VisibleArea.hpp>
00038 #include <lgl/PursuitGraph.hpp>
00039
00040 namespace jafar {
00041 namespace lgl {
00042
00044 #define NMAX_PATHS 30
00045
00047 typedef enum {
00049 DRAW_NODE_OPEN=1,
00051 DRAW_NODE_VISITED,
00053 DRAW_NODE_PATH,
00055 DRAW_NODE_TRACK
00056 } DRAW_NODE_STATE;
00057
00058 class LGLViewer {
00059 public:
00060
00061 LGLViewer();
00062
00069 LGLViewer(Decomp* _decomp, NavGraph::NavGraphContainer* _graph, double sf=1.0);
00070
00078 LGLViewer(VisibilityMap *_visibility, Decomp* _decomp=NULL, NavGraph::NavGraphContainer* _graph=NULL, double sf=1.0);
00079
00080 ~LGLViewer();
00081
00082 jafar::qdisplay::Viewer* getQViewer();
00083
00085 void setImage(const std::string& filename, double xoffset=0.0, double yoffset=0.0);
00086
00088 bool displayDecomp();
00089
00091 bool displayGraph(bool show_edges=true, bool show_nodes=true);
00092
00094 bool displayVisibilityMap(const int x, const int y, bool show_viewlines=false, bool show_nodes=true, bool show_rays=false);
00095
00099 bool displayVisibleArea(const VisibleArea &myArea, bool show_viewlines=false, bool show_nodes=true, bool show_rays=false);
00100
00102 bool displayPGFront(const PursuitGraph & _PG);
00103
00105 bool displayPGRisk(const PursuitGraph & _PG);
00106
00108 bool displayPGraph(const PursuitGraph & _PG, bool showTarget = false);
00109
00111 bool displayGraphWithUTM(bool show_edges=true, bool show_nodes=true);
00112
00114 void drawEdge(const NavGNode& prevNode, const NavGNode& curNode, DRAW_NODE_STATE dstate);
00115
00117 void drawEdge(const NavLocation& prevPos, const NavLocation& curPos, DRAW_NODE_STATE dstate);
00118
00120 void displayPath(NavPath& dPath);
00121
00123 void displayFrontiers(std::list<NavGraph::frontierPoint> frontierList);
00124
00135 void displayHook(const NavGNode& u, DRAW_NODE_STATE dstate);
00136
00147 void displayHook(const NavLocation& pos, DRAW_NODE_STATE dstate);
00148
00160 void displayFrontierPoint(const NavGraph::frontierPoint& F, double normalizer1, double normalizer2);
00161
00162
00163 void setDecomp(Decomp*);
00164 void setGraph(NavGraph::NavGraphContainer*);
00165 void setScaleFactor(double);
00166
00167 private:
00168
00170 bool withUTM;
00171
00173 Decomp* decomp;
00174
00176 NavGraph::NavGraphContainer* graph;
00177
00181 double scaleFactor;
00182
00184 jafar::qdisplay::Viewer* viewer;
00185
00190 int n_path_drawn;
00191
00194 VisibilityMap *visibility;
00195
00197 int highcolor;
00198
00200 int lowcolor;
00201
00202 };
00203 }
00204 }
00205
00206 #endif // LGL_DISPLAY_HPP
00207 #endif // QDisplay enabled