1 #ifndef GUI_MAPWIDGET_HXX
2 #define GUI_MAPWIDGET_HXX
4 #include <simgear/compiler.h>
5 #include <simgear/math/SGMath.hxx>
6 #include <simgear/props/props.hxx>
10 #include "dialog.hxx" // for GUI_ID
21 class MapWidget : public puObject
24 MapWidget(int x, int y, int width, int height);
27 virtual void setSize(int width, int height);
28 virtual void doHit( int button, int updown, int x, int y ) ;
29 virtual void draw( int dx, int dy ) ;
30 virtual int checkKey(int key, int updown);
32 void setProperty(SGPropertyNode_ptr prop);
34 void handlePan(int x, int y);
36 void pan(const SGVec2d& delta);
40 void paintAircraftLocation(const SGGeod& aircraftPos);
45 void drawNavRadio(SGPropertyNode_ptr radio);
46 void drawTunedLocalizer(SGPropertyNode_ptr radio);
48 void drawLatLonGrid();
49 SGVec2d gridPoint(int ix, int iy);
50 bool drawLineClipped(const SGVec2d& a, const SGVec2d& b);
53 void drawAirport(FGAirport* apt);
54 int scoreAirportRunways(FGAirport* apt);
55 void drawRunwayPre(FGRunway* rwy);
56 void drawRunway(FGRunway* rwy);
57 void drawILS(bool tuned, FGRunway* rwy);
60 void drawNDB(bool tuned, FGNavRecord* nav);
61 void drawVOR(bool tuned, FGNavRecord* nav);
62 void drawFix(FGFix* fix);
65 void drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, double hdg);
66 void drawAIShip(const SGPropertyNode* model, const SGGeod& pos, double hdg);
69 bool validDataForKey(void* key);
70 MapData* getOrCreateDataForKey(void* key);
71 MapData* createDataForKey(void* key);
72 void setAnchorForKey(void* key, const SGVec2d& anchor);
74 SGVec2d project(const SGGeod& geod) const;
75 SGGeod unproject(const SGVec2d& p) const;
76 double currentScale() const;
78 void circleAt(const SGVec2d& center, int nSides, double r);
79 void circleAtAlt(const SGVec2d& center, int nSides, double r, double r2);
80 void drawLine(const SGVec2d& p1, const SGVec2d& p2);
81 void drawLegendBox(const SGVec2d& pos, const std::string& t);
86 double _upHeading; // true heading corresponding to +ve y-axis
87 bool _magneticHeadings;
89 SGGeod _projectionCenter;
94 SGPropertyNode_ptr _root;
95 SGPropertyNode_ptr _gps;
97 typedef std::map<void*, MapData*> KeyDataMap;
99 std::vector<MapData*> _dataQueue;
103 typedef std::map<int, SGVec2d> GridPointCache;
104 GridPointCache _gridCache;
109 #endif // of GUI_MAPWIDGET_HXX