1 /***************************************************************************
2 mapcanvas.h - K Desktop Planetarium
4 begin : Tue Apr 10 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
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 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
28 *Used in LocationDialog for displaying a map of the Earth.
29 *In addition, cities in the database are drawn as grey or white dots.
30 *Also, the widget processes mouse clicks, to trim the list of
31 *cities to those near the mouse click.
32 *@short Widget used in the LocationDialog for displaying the world map.
39 class MapCanvas
: public QWidget
{
42 /**Default constructor. Initialize the widget: create pixmaps, load the
43 *world map bitmap, set pointers to the main window and the
44 *LocationDialog parent.
46 MapCanvas(QWidget
*parent
=0, const char *name
=0);
52 /**Set the geometry of the map widget (overloaded from QWidget).
53 *Resizes the size of the map pixmap to match the widget, and resets
54 *the Origin QPoint so it remains at the center of the widget.
55 *@note this is called automatically by resize events.
56 *@p x the x-position of the widget
57 *@p y the y-position of the widget
58 *@p w the width of the widget
59 *@p h the height of the widget
61 virtual void setGeometry( int x
, int y
, int w
, int h
);
63 /**Set the geometry of the map widget (overloaded from QWidget).
64 *Resizes the size of the map pixmap to match the widget, and resets
65 *the Origin QPoint so it remains at the center of the widget.
66 *This function behaves just like the above function. It differs
67 *only in the data type of its argument.
68 *@note this is called automatically by resize events.
69 *@p r QRect describing geometry
71 virtual void setGeometry( const QRect
&r
);
74 /**Draw the map. Draw grey dots on the locations of all cities,
75 *and highlight the cities which match the current filters
76 *as white dits. Also draw a red crosshairs on the
77 *currently-selected city.
80 virtual void paintEvent( QPaintEvent
*e
);
82 /**Trim the list of cities so that only those within 2 degrees
83 *of the mouse click are shown in the list.
86 virtual void mousePressEvent( QMouseEvent
*e
);
89 QPixmap
*Canvas
, *bgImage
;