dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
mapgraphicitem.h
Go to the documentation of this file.
1 
13 /*
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, see <http://www.gnu.org/licenses/>
26 */
27 #ifndef MAPGRAPHICITEM_H
28 #define MAPGRAPHICITEM_H
29 
30 #include <QGraphicsItem>
31 #include "../internals/core.h"
32 #include "../core/diagnostics.h"
33 #include "configuration.h"
34 #include <QtGui>
35 #include <QTransform>
36 #include <QWidget>
37 #include <QBrush>
38 #include <QFont>
39 #include <QObject>
40 #include "../core/corecommon.h"
41 
42 namespace mapcontrol
43 {
44  class WayPointItem;
45  class TLMapWidget;
51  class TLMAPWIDGET_EXPORT MapGraphicItem:public QObject,public QGraphicsItem
52  {
54  Q_OBJECT
55  Q_INTERFACES(QGraphicsItem)
56  public:
57 
58 
66  MapGraphicItem(internals::Core *core,Configuration *configuration);
67  QRectF boundingRect() const;
68  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
69  QWidget *widget);
70 
71  QSize sizeHint()const;
78  core::Point FromLatLngToLocal(internals::PointLatLng const& point);
86  internals::PointLatLng FromLocalToLatLng(qint64 x, qint64 y);
92  bool IsDragging()const{return core->IsDragging();}
93 
94  QImage lastimage;
95  core::Point lastimagepoint;
96  void paintImage(QPainter* painter);
97  void ConstructLastImage(int const& zoomdiff);
98  internals::PureProjection* Projection()const{return core->Projection();}
99  double Zoom();
100  double ZoomDigi();
101  double ZoomTotal();
102  void setOverlayOpacity(qreal value);
103  protected:
104  void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
105  void mousePressEvent ( QGraphicsSceneMouseEvent * event );
106  void wheelEvent ( QGraphicsSceneWheelEvent * event );
107  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
108  bool IsMouseOverMarker()const{return isMouseOverMarker;}
109  void keyPressEvent ( QKeyEvent * event );
110  void keyReleaseEvent ( QKeyEvent * event );
111 
117  int ZoomStep()const;
123  void SetZoomStep(qint32 const& value);
124  private:
125  bool SetZoomToFitRect(internals::RectLatLng const& rect);
126  internals::Core *core;
127  Configuration *config;
128  bool showTileGridLines;
129  qreal MapRenderTransform;
130  void DrawMap2D(QPainter *painter);
136  int maxZoom;
142  int minZoom;
143  internals::RectLatLng selectedArea;
144  internals::PointLatLng selectionStart;
145  internals::PointLatLng selectionEnd;
146  double zoomReal;
147  double zoomDigi;
148  QRectF maprect;
149  bool isSelected;
150  bool isMouseOverMarker;
151  QPixmap dragons;
152  void SetIsMouseOverMarker(bool const& value){isMouseOverMarker = value;}
153 
154  qreal rotation;
163  QRectF boundingBox(QRectF const& rect, qreal const& angle);
169  int MaxZoom()const{return core->MaxZoom();}
175  int MinZoom()const{return minZoom;}
176  internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();}
177  void SetSelectedArea(internals::RectLatLng const& value){selectedArea = value;this->update();}
178  internals::RectLatLng SelectedArea()const{return selectedArea;}
179  internals::RectLatLng BoundsOfMap;
180  void Offset(qint64 const& x, qint64 const& y);
181  bool CanDragMap()const{return core->CanDragMap;}
182  void SetCanDragMap(bool const& value){core->CanDragMap = value;}
183 
184  void SetZoom(double const& value);
185  void mapRotate ( qreal angle );
186  void start();
187  void ReloadMap(){core->ReloadMap();}
188  GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys){return core->SetCurrentPositionByKeywords(keys);}
189  MapType::Types GetMapType(){return core->GetMapType();}
190  void SetMapType(MapType::Types const& value){core->SetMapType(value);}
191 
192  private slots:
193  void Core_OnNeedInvalidation();
194  void childPosRefresh();
195  public slots:
201  void resize ( QRectF const &rect=QRectF() );
202  signals:
208  void wpdoubleclicked(WayPointItem * wp);
209  void zoomChanged(double zoomtotal,double zoomreal,double zoomdigi);
210  void childRefreshPosition();
211  void childSetOpacity(qreal value);
212  };
213 }
214 #endif // MAPGRAPHICITEM_H
void SetZoom(double const &value)
Definition: tlmapwidget.h:230
Configuration * configuration
Definition: tlmapwidget.h:247
MapType::Types GetMapType()
Definition: tlmapwidget.h:239
int MaxZoom() const
Returns the maximum zoom for the map.
Definition: tlmapwidget.h:197
bool CanDragMap() const
Definition: tlmapwidget.h:221
void zoomChanged(double zoomt, double zoom, double zoomd)
A class that centralizes most of the mapcontrol configurations.
void SetMapType(MapType::Types const &value)
Definition: tlmapwidget.h:240
internals::RectLatLng SelectedArea() const
Definition: tlmapwidget.h:218
A class that centralizes most of the mapcontrol configurations.
Definition: configuration.h:48
The main graphicsItem used on the widget, contains the map and map logic.
internals::MouseWheelZoomType::Types GetMouseWheelZoomType()
Definition: tlmapwidget.h:213
void mouseMoveEvent(QMouseEvent *event)
void SetSelectedArea(internals::RectLatLng const &value)
Definition: tlmapwidget.h:219
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const &keys)
Definition: tlmapwidget.h:237
void SetCanDragMap(bool const &value)
Definition: tlmapwidget.h:222
x
Definition: OPPlots.m:100
void setOverlayOpacity(qreal value)
y
Definition: OPPlots.m:101