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
22 class MapWidget : public puObject
25 MapWidget(int x, int y, int width, int height);
28 virtual void setSize(int width, int height);
29 virtual void doHit( int button, int updown, int x, int y ) ;
30 virtual void draw( int dx, int dy ) ;
31 virtual int checkKey(int key, int updown);
33 void setProperty(SGPropertyNode_ptr prop);
37 void handlePan(int x, int y);
39 void pan(const SGVec2d& delta);
43 void paintAircraftLocation(const SGGeod& aircraftPos);
48 void drawNavRadio(SGPropertyNode_ptr radio);
49 void drawTunedLocalizer(SGPropertyNode_ptr radio);
51 void drawLatLonGrid();
52 SGVec2d gridPoint(int ix, int iy);
53 bool drawLineClipped(const SGVec2d& a, const SGVec2d& b);
56 void drawAirport(FGAirport* apt);
57 int scoreAirportRunways(FGAirport* apt);
58 void drawRunwayPre(FGRunway* rwy);
59 void drawRunway(FGRunway* rwy);
60 void drawILS(bool tuned, FGRunway* rwy);
63 void drawNDB(bool tuned, FGNavRecord* nav);
64 void drawVOR(bool tuned, FGNavRecord* nav);
65 void drawFix(FGFix* fix);
68 void drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, double hdg);
69 void drawAIShip(const SGPropertyNode* model, const SGGeod& pos, double hdg);
72 bool validDataForKey(void* key);
73 MapData* getOrCreateDataForKey(void* key);
74 MapData* createDataForKey(void* key);
75 void setAnchorForKey(void* key, const SGVec2d& anchor);
77 SGVec2d project(const SGGeod& geod) const;
78 SGGeod unproject(const SGVec2d& p) const;
79 double currentScale() const;
81 void circleAt(const SGVec2d& center, int nSides, double r);
82 void circleAtAlt(const SGVec2d& center, int nSides, double r, double r2);
83 void drawLine(const SGVec2d& p1, const SGVec2d& p2);
84 void drawLegendBox(const SGVec2d& pos, const std::string& t);
89 double _upHeading; // true heading corresponding to +ve y-axis
90 bool _magneticHeadings;
93 SGGeod _projectionCenter;
98 SGPropertyNode_ptr _root;
99 SGPropertyNode_ptr _gps;
101 typedef std::map<void*, MapData*> KeyDataMap;
103 std::vector<MapData*> _dataQueue;
107 typedef std::map<int, SGVec2d> GridPointCache;
108 GridPointCache _gridCache;
113 #endif // of GUI_MAPWIDGET_HXX