1 // $Id: xxGlobe.hh 3636 2010-04-06 23:59:23Z flaterco $ 2 3 /* xxGlobe Location chooser using Orthographic Projection. 4 5 There is some duplicated code between xxGlobe and xxMap. However, 6 they are sufficiently different that I think complete 7 encapsulation is the cleanest approach. -- DWF 8 9 Copyright (C) 1998 David Flater. 10 11 This program is free software: you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation, either version 3 of the License, or 14 (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25 class xxGlobe: public xxWindow { 26 public: 27 xxGlobe (const xxWidget &shell); 28 ~xxGlobe (); 29 30 void listAll(); 31 void zoomOut(); 32 void keyboard (KeySym key); 33 void mouseMove (const XMotionEvent *xme); 34 void mouseButton (const XButtonEvent *xbe); 35 void globalRedraw(); 36 37 protected: 38 Pixmap globePixmap; 39 const StationIndex &stationIndex; 40 std::auto_ptr<xxWidget> picture, dismissButton, listAllButton, helpButton, 41 zoomOutButton, latitudeLabel, longitudeLabel, 42 flatButton; 43 std::auto_ptr<xxLocationList> locationList; 44 unsigned long size; 45 long xOrigin, yOrigin, xBlast, yBlast, xLast, yLast; 46 bool blastFlag; 47 Dimension internalHeight, internalWidth; 48 double centerLongitude, centerLatitude; // center of viewable area 49 Coordinates currentPosition; // from GPS 50 51 // projectCoordinates does an orthographic projection of size size 52 // (declared above). 53 // Returns: 54 // true = the point is on this side; results valid. 55 // false = the point is on the other side; ignore results. 56 const bool projectCoordinates (const Coordinates &coordinates, 57 long &x_out, 58 long &y_out); 59 const bool projectCoordinates (double lat, 60 double lng, 61 long &x_out, 62 long &y_out); 63 64 // translateCoordinates calls projectCoordinates then further cooks the 65 // result to map it into the current viewport. 66 // Returns: 67 // true = the point may be visible; draw it. 68 // false = the point is invisible; ignore results. 69 const bool translateCoordinates (const Coordinates &coordinates, 70 long &x_out, 71 long &y_out); 72 const bool translateCoordinates (double lat, 73 double lng, 74 long &x_out, 75 long &y_out); 76 77 // Returns: 78 // true = the point is on the globe somewhere; lat and lng valid. 79 // false = you missed; ignore lat and lng. 80 const bool untranslateCoordinates (long x, 81 long y, 82 double &lat_out, 83 double &lng_out); 84 85 void updatePosition (long x, long y); 86 void blast (long x, long y); 87 void redrawGlobe(); 88 void drawCoastlines(); 89 void drawGridlines(); 90 void drawCurrentPosition(); 91 }; 92 93 // Cleanup2006 Done 94