QMapControl
0.9.7.4
|
A geometric point to draw objects into maps. More...
#include <point.h>
Public Types | |
enum | Alignment { TopLeft, TopRight, TopMiddle, BottomLeft, BottomRight, BottomMiddle, Middle } |
sets where the point should be aligned More... | |
Signals | |
void | geometryClicked (Geometry *geometry, QPoint point) |
This signal is emitted when a Geometry is clicked. More... | |
void | positionChanged (Geometry *geom) |
A Geometry emits this signal, when its position gets changed. More... | |
Public Member Functions | |
virtual QRectF | boundingBox () |
returns the bounding box of the point More... | |
QPointF | coordinate () const |
returns the coordinate of the point More... | |
bool | Equals (Geometry *geom) |
bool | isVisible () const |
returns true if this Geometry is visible More... | |
qreal | latitude () const |
returns the latitude of the point More... | |
qreal | longitude () const |
returns the longitude of the point More... | |
QString | name () const |
returns the name of this Geometry More... | |
Geometry * | parentGeometry () const |
returns the parent Geometry of this Geometry More... | |
QPen * | pen () const |
returns the QPen which is used on drawing More... | |
QPixmap | pixmap () |
returns the pixmap of the point More... | |
Point (qreal x, qreal y, QString name=QString(), enum Alignment alignment=Middle) | |
Copy Constructor. More... | |
Point (qreal x, qreal y, QWidget *widget, QString name=QString(), enum Alignment alignment=Middle) | |
Constructor. More... | |
Point (qreal x, qreal y, QPixmap pixmap, QString name=QString(), enum Alignment alignment=Middle) | |
Constructor. More... | |
void | setBaselevel (int zoomlevel) |
Sets the zoom level on which the points pixmap gets displayed on full size. More... | |
void | setMaxsize (QSize maxsize) |
sets a maximal size for the pixmap More... | |
void | setMinsize (QSize minsize) |
sets a minimal size for the pixmap More... | |
void | setName (QString name) |
sets the name of the geometry More... | |
QString | toString () |
returns a String representation of this Geometry More... | |
QWidget * | widget () |
returns the widget of the point More... | |
Protected Member Functions | |
virtual bool | Touches (Point *click, const MapAdapter *mapadapter) |
returns true if the given Point touches this Point More... | |
A geometric point to draw objects into maps.
This class can be used to draw your custom QPixmap or other QWidgets into maps. You can instantiate a Point with any Pixmap you want. The objects cares about collision detection (for clickable objects)
When drawing a pixmap, take care you are adding the point to a GeometryLayer. You can also add a point to a MapLayer, but this should only be done, if the point is not changing its position or color etc. (GeometryLayers are assured to be repainted on any changes at the point. MapLayers only gets repainted, if a new offscreenImage is painter. This is a performance issue.)
Points emit click events, if the containing layer receives clickevents (the default)
You can also add a widget into maps. But keep in mind, that widgets always are drawn on top of all layers. You also have to handle click events yourself.
To create "zoomable objects" (objects that increases size on zooming), a base level have to be set. The base level is the zoom level on which the point´s pixmap gets displayed on full size. On lower zoom levels it gets displayed smaller and on higher zoom levels larger. A minimal size can be set as well as a maximum size.
enum Alignment |
Copy Constructor.
This constructor creates a Point with no image or widget.
x | longitude |
y | latitude |
name | name of the point |
alignment | alignment of the point (Middle or TopLeft) |
Point | ( | qreal | x, |
qreal | y, | ||
QWidget * | widget, | ||
QString | name = QString() , |
||
enum Alignment | alignment = Middle |
||
) |
Constructor.
This constructor creates a point which will display the given widget. You can set an alignment on which corner the widget should be aligned to the coordinate. You have to set the size of the widget, before adding it to IMPORTANT: You have to set the QMapControl as parent for the widget!
x | longitude |
y | latitude |
widget | the widget which should be displayed by this point |
name | name of the point |
alignment | allignment of the point (Middle or TopLeft) |
Point | ( | qreal | x, |
qreal | y, | ||
QPixmap | pixmap, | ||
QString | name = QString() , |
||
enum Alignment | alignment = Middle |
||
) |
Constructor.
This constructor creates a point which will display the give pixmap. You can set an alignment on which corner the pixmap should be aligned to the coordinate.
x | longitude |
y | latitude |
pixmap | the pixmap which should be displayed by this point |
name | name of the point |
alignment | allignment of the point (Middle or TopLeft) |
|
virtual |
returns the bounding box of the point
The Bounding contains the coordinate of the point and its size. The size is set, if the point contains a pixmap or a widget
Implements Geometry.
References Point::latitude(), and Point::longitude().
QPointF coordinate | ( | ) | const |
returns the coordinate of the point
The x component of the returned QPointF is the longitude value, the y component the latitude
Referenced by MapControl::setView(), and Point::Touches().
|
inherited |
|
signalinherited |
This signal is emitted when a Geometry is clicked.
A Geometry is clickable, if the containing layer is clickable. The objects emits a signal if it gets clicked
geometry | The clicked Geometry |
point | -unused- |
Referenced by Point::Touches().
|
inherited |
returns true if this Geometry is visible
Referenced by Point::Touches().
qreal latitude | ( | ) | const |
returns the latitude of the point
Referenced by LineString::boundingBox(), and Point::boundingBox().
qreal longitude | ( | ) | const |
returns the longitude of the point
Referenced by LineString::boundingBox(), and Point::boundingBox().
|
inherited |
returns the name of this Geometry
Referenced by Geometry::setName().
|
inherited |
returns the parent Geometry of this Geometry
A LineString is a composition of many Points. This methods returns the parent (the LineString) of a Point
|
inherited |
returns the QPen which is used on drawing
The pen is set depending on the Geometry. A CirclePoint for example takes one with the constructor.
Referenced by ArrowPoint::ArrowPoint(), CirclePoint::CirclePoint(), LineString::LineString(), ArrowPoint::setPen(), and CirclePoint::setPen().
QPixmap pixmap | ( | ) |
returns the pixmap of the point
Referenced by FixedImageOverlay::FixedImageOverlay(), and ImagePoint::ImagePoint().
|
signalinherited |
void setBaselevel | ( | int | zoomlevel | ) |
Sets the zoom level on which the points pixmap gets displayed on full size.
Use this method to set a zoom level on which the pixmap gets displayed with its real size. On zoomlevels below it will be displayed smaller, and on zoom levels thereover it will be displayed larger
zoomlevel | the zoomlevel on which the point will be displayed on full size |
void setMaxsize | ( | QSize | maxsize | ) |
sets a maximal size for the pixmap
When the point´s pixmap should change its size on zooming, this method sets the maximal size.
maxsize | the maximal size which the pixmap should have |
void setMinsize | ( | QSize | minsize | ) |
sets a minimal size for the pixmap
When the point's pixmap should change its size on zooming, this method sets the minimal size.
minsize | the minimal size which the pixmap should have |
|
inherited |
sets the name of the geometry
name | the new name of the geometry |
References Geometry::name().
|
inherited |
|
protectedvirtual |
returns true if the given Point touches this Point
The collision detection checks for the bounding rectangulars.
geom | the other point which should be tested on collision |
mapadapter | the mapadapter which is used for calculations |
Implements Geometry.
References Point::coordinate(), MapAdapter::coordinateToDisplay(), Geometry::geometryClicked(), and Geometry::isVisible().
QWidget * widget | ( | ) |
returns the widget of the point