1 #ifndef GUI_MAPWIDGET_HXX
2 #define GUI_MAPWIDGET_HXX
5 #include <simgear/compiler.h>
6 #include <simgear/math/SGMath.hxx>
7 #include <simgear/props/props.hxx>
11 #include "dialog.hxx" // for GUI_ID
23 class MapWidget : public puObject
26 MapWidget(int x, int y, int width, int height);
29 virtual void setSize(int width, int height);
30 virtual void doHit( int button, int updown, int x, int y ) ;
31 virtual void draw( int dx, int dy ) ;
32 virtual int checkKey(int key, int updown);
34 void setProperty(SGPropertyNode_ptr prop);
38 void handlePan(int x, int y);
40 void pan(const SGVec2d& delta);
44 void paintAircraftLocation(const SGGeod& aircraftPos);
47 void drawFlightHistory();
50 void drawNavRadio(SGPropertyNode_ptr radio);
51 void drawTunedLocalizer(SGPropertyNode_ptr radio);
53 void drawLatLonGrid();
54 SGVec2d gridPoint(int ix, int iy);
55 bool drawLineClipped(const SGVec2d& a, const SGVec2d& b);
58 void drawAirport(FGAirport* apt);
59 int scoreAirportRunways(FGAirport* apt);
60 void drawRunwayPre(FGRunway* rwy);
61 void drawRunway(FGRunway* rwy);
62 void drawHelipad(FGHelipad* hp);
63 void drawILS(bool tuned, FGRunway* rwy);
67 void drawNDB(bool tuned, FGNavRecord* nav);
68 void drawVOR(bool tuned, FGNavRecord* nav);
69 void drawFix(FGFix* fix);
71 void drawCountries(FGNavRecord* rec);
72 void drawCities(FGNavRecord* rec);
73 void drawTowns(FGNavRecord* rec);
76 void drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, double hdg);
77 void drawAIShip(const SGPropertyNode* model, const SGGeod& pos, double hdg);
80 bool validDataForKey(void* key);
81 MapData* getOrCreateDataForKey(void* key);
82 MapData* createDataForKey(void* key);
83 void setAnchorForKey(void* key, const SGVec2d& anchor);
86 SGVec2d project(const SGGeod& geod) const;
87 SGGeod unproject(const SGVec2d& p) const;
88 double currentScale() const;
90 int displayHeading(double trueHeading) const;
92 void circleAt(const SGVec2d& center, int nSides, double r);
93 void circleAtAlt(const SGVec2d& center, int nSides, double r, double r2);
94 void squareAt(const SGVec2d& center, double r);
95 void drawLine(const SGVec2d& p1, const SGVec2d& p2);
96 void drawLegendBox(const SGVec2d& pos, const std::string& t);
101 double _upHeading; // true heading corresponding to +ve y-axis
102 bool _magneticHeadings;
105 SGGeod _projectionCenter;
106 bool _orthoAzimuthProject;
109 SGVec2d _hitLocation;
111 SGPropertyNode_ptr _root;
112 SGPropertyNode_ptr _gps;
114 typedef std::map<void*, MapData*> KeyDataMap;
116 std::vector<MapData*> _dataQueue;
120 typedef std::map<int, SGVec2d> GridPointCache;
121 GridPointCache _gridCache;
126 #endif // of GUI_MAPWIDGET_HXX