From 5b323897f69612c12beaf976e24e541dadff7951 Mon Sep 17 00:00:00 2001 From: zedamota Date: Tue, 15 Jun 2010 19:37:45 +0000 Subject: [PATCH] OP-37 GCS/MapPlugin New map library-Fully qualified some classes instead of using "using namespace" to avoid ambiguities with other classes and namespaces already in use. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@778 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../opmapcontrol/src/core/cacheitemqueue.h | 10 +- .../src/libs/opmapcontrol/src/core/opmaps.h | 2 +- ground/src/libs/opmapcontrol/src/core/point.h | 4 +- .../opmapcontrol/src/core/pureimagecache.h | 4 +- .../src/libs/opmapcontrol/src/core/rawtile.h | 8 +- ground/src/libs/opmapcontrol/src/core/size.h | 1 - .../libs/opmapcontrol/src/core/urlfactory.cpp | 16 +- .../libs/opmapcontrol/src/core/urlfactory.h | 18 +- .../libs/opmapcontrol/src/internals/core.h | 72 ++-- .../opmapcontrol/src/internals/loadtask.h | 4 +- .../internals/projections/lks94projection.cpp | 4 +- .../internals/projections/lks94projection.h | 5 +- .../projections/mercatorprojection.cpp | 4 +- .../projections/mercatorprojection.h | 5 +- .../projections/mercatorprojectionyandex.cpp | 4 +- .../projections/mercatorprojectionyandex.h | 7 +- .../projections/platecarreeprojection.cpp | 4 +- .../projections/platecarreeprojection.h | 7 +- .../platecarreeprojectionpergo.cpp | 4 +- .../projections/platecarreeprojectionpergo.h | 7 +- .../src/internals/pureprojection.h | 10 +- .../opmapcontrol/src/internals/rectangle.h | 12 +- .../libs/opmapcontrol/src/internals/tile.h | 8 +- .../opmapcontrol/src/internals/tilematrix.h | 10 +- .../src/mapwidget/mapgraphicitem.cpp | 23 +- .../src/mapwidget/mapgraphicitem.h | 22 +- .../src/mapwidget/mapresources.qrc | 1 - .../opmapcontrol/src/mapwidget/mapwidget.pro | 10 +- .../src/mapwidget/opmapcontrol.cpp | 366 ------------------ .../opmapcontrol/src/mapwidget/opmapcontrol.h | 94 ----- .../src/mapwidget/opmapwidget.cpp | 2 +- .../opmapcontrol/src/mapwidget/opmapwidget.h | 16 +- ground/src/libs/opmapcontrol/src/src.pro | 1 + 33 files changed, 148 insertions(+), 617 deletions(-) delete mode 100644 ground/src/libs/opmapcontrol/src/mapwidget/mapresources.qrc delete mode 100644 ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.cpp delete mode 100644 ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.h diff --git a/ground/src/libs/opmapcontrol/src/core/cacheitemqueue.h b/ground/src/libs/opmapcontrol/src/core/cacheitemqueue.h index 1588f7c55..fbf9163f0 100644 --- a/ground/src/libs/opmapcontrol/src/core/cacheitemqueue.h +++ b/ground/src/libs/opmapcontrol/src/core/cacheitemqueue.h @@ -29,7 +29,7 @@ #define CACHEITEMQUEUE_H #include "maptype.h" -#include "point.h" +#include "Point.h" #include @@ -38,7 +38,7 @@ namespace core { class CacheItemQueue { public: - CacheItemQueue(const MapType::Types &Type,const Point &Pos,const QByteArray &Img,const int &Zoom); + CacheItemQueue(const MapType::Types &Type,const core::Point &Pos,const QByteArray &Img,const int &Zoom); CacheItemQueue(){}; CacheItemQueue(const CacheItemQueue &cSource) { @@ -50,10 +50,10 @@ namespace core { CacheItemQueue& operator= (const CacheItemQueue &cSource); bool operator== (const CacheItemQueue &cSource); void SetMapType(const MapType::Types &value); - void SetPosition(const Point &value); + void SetPosition(const core::Point &value); void SetImg(const QByteArray &value); MapType::Types GetMapType(); - Point GetPosition(); + core::Point GetPosition(); QByteArray GetImg(); int GetZoom(){return zoom;}; void SetZoom(const int &value) {zoom=value;}; @@ -61,7 +61,7 @@ namespace core { MapType::Types type; - Point pos; + core::Point pos; QByteArray img; int zoom; }; diff --git a/ground/src/libs/opmapcontrol/src/core/opmaps.h b/ground/src/libs/opmapcontrol/src/core/opmaps.h index e1723eaa6..f0a288971 100644 --- a/ground/src/libs/opmapcontrol/src/core/opmaps.h +++ b/ground/src/libs/opmapcontrol/src/core/opmaps.h @@ -60,7 +60,7 @@ namespace core { /// - QByteArray GetImageFrom(const MapType::Types &type,const Point &pos,const int &zoom); + QByteArray GetImageFrom(const MapType::Types &type,const core::Point &pos,const int &zoom); bool UseMemoryCache();//TODO void setUseMemoryCache(const bool& value){useMemoryCache=value;} void setLanguage(const LanguageType::Types& language);//TODO diff --git a/ground/src/libs/opmapcontrol/src/core/point.h b/ground/src/libs/opmapcontrol/src/core/point.h index c9d3aeeb2..e3886938e 100644 --- a/ground/src/libs/opmapcontrol/src/core/point.h +++ b/ground/src/libs/opmapcontrol/src/core/point.h @@ -25,8 +25,8 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef POINT_H -#define POINT_H +#ifndef OPOINT_H +#define OPOINT_H #include diff --git a/ground/src/libs/opmapcontrol/src/core/pureimagecache.h b/ground/src/libs/opmapcontrol/src/core/pureimagecache.h index 12e94e180..b80bc1605 100644 --- a/ground/src/libs/opmapcontrol/src/core/pureimagecache.h +++ b/ground/src/libs/opmapcontrol/src/core/pureimagecache.h @@ -50,8 +50,8 @@ namespace core { public: PureImageCache(); static bool CreateEmptyDB(const QString &file); - bool PutImageToCache(const QByteArray &tile,const MapType::Types &type,const Point &pos, const int &zoom); - QByteArray GetImageFromCache(MapType::Types type, Point pos, int zoom); + bool PutImageToCache(const QByteArray &tile,const MapType::Types &type,const core::Point &pos, const int &zoom); + QByteArray GetImageFromCache(MapType::Types type, core::Point pos, int zoom); QString GtileCache(); void setGtileCache(const QString &value); static bool ExportMapDataToDB(QString sourceFile, QString destFile); diff --git a/ground/src/libs/opmapcontrol/src/core/rawtile.h b/ground/src/libs/opmapcontrol/src/core/rawtile.h index 3b14007ad..ce282b6ee 100644 --- a/ground/src/libs/opmapcontrol/src/core/rawtile.h +++ b/ground/src/libs/opmapcontrol/src/core/rawtile.h @@ -40,17 +40,17 @@ namespace core { friend bool operator==(RawTile const& lhs,RawTile const& rhs); public: - RawTile(const MapType::Types &Type,const Point &Pos,const int &Zoom); + RawTile(const MapType::Types &Type,const core::Point &Pos,const int &Zoom); QString ToString(void); MapType::Types Type(); - Point Pos(); + core::Point Pos(); int Zoom(); void setType(const MapType::Types &value); - void setPos(const Point &value); + void setPos(const core::Point &value); void setZoom(const int &value); private: MapType::Types type; - Point pos; + core::Point pos; int zoom; }; } diff --git a/ground/src/libs/opmapcontrol/src/core/size.h b/ground/src/libs/opmapcontrol/src/core/size.h index 241d09fea..7b9a16067 100644 --- a/ground/src/libs/opmapcontrol/src/core/size.h +++ b/ground/src/libs/opmapcontrol/src/core/size.h @@ -54,7 +54,6 @@ namespace core { private: int width; int height; - Point p; }; } #endif // SIZE_H diff --git a/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp index 39cdc12c8..898694c1d 100644 --- a/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -560,23 +560,23 @@ QString UrlFactory::MakeGeocoderUrl(QString keywords) QString key = keywords.replace(' ', '+'); return QString("http://maps.google.com/maps/geo?q=%1&output=csv&key=%2").arg(key).arg(GoogleMapsAPIKey); } -QString UrlFactory::MakeReverseGeocoderUrl(PointLatLng &pt,const QString &language) +QString UrlFactory::MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language) { return QString("http://maps.google.com/maps/geo?hl=%1&ll=%2,%3&output=csv&key=%4").arg(language).arg(QString::number(pt.Lat())).arg(QString::number(pt.Lng())).arg(GoogleMapsAPIKey); } -PointLatLng UrlFactory::GetLatLngFromGeodecoder(const QString &keywords, GeoCoderStatusCode::Types &status) +internals::PointLatLng UrlFactory::GetLatLngFromGeodecoder(const QString &keywords, GeoCoderStatusCode::Types &status) { return GetLatLngFromGeocoderUrl(MakeGeocoderUrl(keywords),UseGeocoderCache,status); } -PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, const bool &useCache, GeoCoderStatusCode::Types &status) +internals::PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, const bool &useCache, GeoCoderStatusCode::Types &status) { #ifdef DEBUG_URLFACTORY qDebug()<<"Entered GetLatLngFromGeocoderUrl:"; #endif //DEBUG_URLFACTORY status = GeoCoderStatusCode::Unknow; - PointLatLng ret(0,0); + internals::PointLatLng ret(0,0); QString urlEnd = url.right(url.indexOf("geo?q=")); urlEnd.replace( QRegExp( "[^" @@ -616,7 +616,7 @@ PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, const bool #ifdef DEBUG_URLFACTORY qDebug()<<"GetLatLngFromGeocoderUrl::Network error"; #endif //DEBUG_URLFACTORY - return PointLatLng(0,0); + return internals::PointLatLng(0,0); } { #ifdef DEBUG_URLFACTORY @@ -648,7 +648,7 @@ PointLatLng UrlFactory::GetLatLngFromGeocoderUrl(const QString &url, const bool double lat = QString(values[2]).toDouble(); double lng = QString(values[3]).toDouble(); - ret = PointLatLng(lat, lng); + ret = internals::PointLatLng(lat, lng); #ifdef DEBUG_URLFACTORY qDebug()<<"Lat="< tileDrawingList; + QList tileDrawingList; PureProjection* Projection() { @@ -131,7 +133,7 @@ public: void SetProjection(PureProjection* value) { projection=value; - tileRect=Rectangle(Point(0,0),value->TileSize()); + tileRect=Rectangle(core::Point(0,0),value->TileSize()); } bool IsDragging()const{return isDragging;} @@ -164,7 +166,7 @@ public: int GetMaxZoomToFitRect(RectLatLng const& rect); - void BeginDrag(Point const& pt); + void BeginDrag(core::Point const& pt); void EndDrag(); @@ -174,13 +176,13 @@ public: bool MouseWheelZooming; - void DragOffset(Point const& offset); + void DragOffset(core::Point const& offset); - void Drag(Point const& pt); + void Drag(core::Point const& pt); void CancelAsyncTasks(); - void FindTilesAround(QList &list); + void FindTilesAround(QList &list); void UpdateGroundResolution(); @@ -196,24 +198,24 @@ signals: void OnMapDrag(); void OnMapZoomChanged(); void OnMapTypeChanged(MapType::Types type); - void OnEmptyTileError(int zoom, Point pos); + void OnEmptyTileError(int zoom, core::Point pos); void OnNeedInvalidation(); private: PointLatLng currentPosition; - Point currentPositionPixel; - Point renderOffset; - Point centerTileXYLocation; - Point centerTileXYLocationLast; - Point dragPoint; + core::Point currentPositionPixel; + core::Point renderOffset; + core::Point centerTileXYLocation; + core::Point centerTileXYLocationLast; + core::Point dragPoint; Rectangle tileRect; - Point mouseDown; + core::Point mouseDown; bool CanDragMap; - Point mouseCurrent; + core::Point mouseCurrent; PointLatLng LastLocationInBounds; - Point mouseLastZoom; + core::Point mouseLastZoom; MouseWheelZoomType::Types mousewheelzoomtype; @@ -224,7 +226,7 @@ private: - Point tilePoint; + core::Point tilePoint; Rectangle CurrentRegion; @@ -265,7 +267,7 @@ protected: int pxRes100km; // 100km int pxRes1000km; // 1000km int pxRes5000km; // 5000km - void SetCurrentPositionGPixel(Point const& value){currentPositionPixel = value;} + void SetCurrentPositionGPixel(core::Point const& value){currentPositionPixel = value;} void GoToCurrentPositionOnZoom(); }; diff --git a/ground/src/libs/opmapcontrol/src/internals/loadtask.h b/ground/src/libs/opmapcontrol/src/internals/loadtask.h index 7a09a565c..82f05b27d 100644 --- a/ground/src/libs/opmapcontrol/src/internals/loadtask.h +++ b/ground/src/libs/opmapcontrol/src/internals/loadtask.h @@ -38,7 +38,7 @@ struct LoadTask { friend bool operator==(LoadTask const& lhs,LoadTask const& rhs); public: - Point Pos; + core::Point Pos; int Zoom; @@ -49,7 +49,7 @@ struct LoadTask } LoadTask() { - Pos=Point(-1,-1); + Pos=core::Point(-1,-1); Zoom=-1; } bool HasValue() diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp b/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp index a15e94cb6..4b1f60719 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp +++ b/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.cpp @@ -71,9 +71,9 @@ Point LKS94Projection::FromLatLngToPixel(double lat, double lng, int const& zoo return ret; } -PointLatLng LKS94Projection::FromPixelToLatLng(int const& x, int const& y, int const& zoom) +internals::PointLatLng LKS94Projection::FromPixelToLatLng(int const& x, int const& y, int const& zoom) { - PointLatLng ret;// = PointLatLng::Empty; + internals::PointLatLng ret;// = internals::PointLatLng::Empty; double res = GetTileMatrixResolution(zoom); diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.h b/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.h index 155b8d2e5..91efeb2a0 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.h +++ b/ground/src/libs/opmapcontrol/src/internals/projections/lks94projection.h @@ -31,7 +31,6 @@ #include "cmath" #include "../pureprojection.h" -using namespace internals; namespace projections { class LKS94Projection:public internals::PureProjection @@ -43,8 +42,8 @@ public: virtual Size TileSize() const; virtual double Axis() const; virtual double Flattening() const; - virtual Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual PointLatLng FromPixelToLatLng(int const& x, int const& y, int const& zoom); + virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); + virtual internals::PointLatLng FromPixelToLatLng(int const& x, int const& y, int const& zoom); virtual double GetGroundResolution(int const& zoom, double const& latitude); virtual Size GetTileMatrixMinXY(int const& zoom); virtual Size GetTileMatrixMaxXY(int const& zoom); diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.cpp b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.cpp index e7d8d56ee..8778a8d6e 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.cpp +++ b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.cpp @@ -53,9 +53,9 @@ Point MercatorProjection::FromLatLngToPixel(double lat, double lng, const int &z return ret; } -PointLatLng MercatorProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom) +internals::PointLatLng MercatorProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom) { - PointLatLng ret;// = PointLatLng.Empty; + internals::PointLatLng ret;// = internals::PointLatLng.Empty; Size s = GetTileMatrixSizePixel(zoom); double mapSizeX = s.Width(); diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.h b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.h index ce4c83a65..e0693a60b 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.h +++ b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojection.h @@ -29,7 +29,6 @@ #define MERCATORPROJECTION_H #include "../pureprojection.h" -using namespace internals; namespace projections { class MercatorProjection:public internals::PureProjection @@ -40,8 +39,8 @@ public: virtual Size TileSize() const; virtual double Axis() const; virtual double Flattening()const; - virtual Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); + virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); + virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); virtual Size GetTileMatrixMinXY(const int &zoom); virtual Size GetTileMatrixMaxXY(const int &zoom); private: diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp index cb11bb657..a33fcb9bb 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp +++ b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.cpp @@ -58,7 +58,7 @@ Point MercatorProjectionYandex::FromLatLngToPixel(double lat, double lng, const return ret; } -PointLatLng MercatorProjectionYandex::FromPixelToLatLng(const int &x, const int &y, const int &zoom) +internals::PointLatLng MercatorProjectionYandex::FromPixelToLatLng(const int &x, const int &y, const int &zoom) { Size s = GetTileMatrixSizePixel(zoom); @@ -77,7 +77,7 @@ PointLatLng MercatorProjectionYandex::FromPixelToLatLng(const int &x, const int double g = M_PI /2 - 2 *atan(1 / exp(mercY /a)); double z = g + c1 * sin(2 * g) + c2 * sin(4 * g) + c3 * sin(6 * g) + c4 * sin(8 * g); - PointLatLng ret;// = PointLatLng.Empty; + internals::PointLatLng ret;// = internals::PointLatLng.Empty; ret.SetLat(z * RAD_DEG); ret.SetLng (mercX / a * RAD_DEG); diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h index 606f1e65b..bda043b3a 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h +++ b/ground/src/libs/opmapcontrol/src/internals/projections/mercatorprojectionyandex.h @@ -30,10 +30,9 @@ #include "../pureprojection.h" -using namespace internals; namespace projections { -class MercatorProjectionYandex:public PureProjection + class MercatorProjectionYandex:public internals::PureProjection { public: MercatorProjectionYandex(); @@ -41,8 +40,8 @@ public: virtual Size TileSize() const; virtual double Axis() const; virtual double Flattening()const; - virtual Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); + virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); + virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); virtual Size GetTileMatrixMinXY(const int &zoom); virtual Size GetTileMatrixMaxXY(const int &zoom); private: diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.cpp b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.cpp index a5b56e16e..894e924c6 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.cpp +++ b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.cpp @@ -53,9 +53,9 @@ Point PlateCarreeProjection::FromLatLngToPixel(double lat, double lng, const int return ret; } -PointLatLng PlateCarreeProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom) +internals::PointLatLng PlateCarreeProjection::FromPixelToLatLng(const int &x, const int &y, const int &zoom) { - PointLatLng ret;// = PointLatLng.Empty; + internals::PointLatLng ret;// = internals::PointLatLng.Empty; Size s = GetTileMatrixSizePixel(zoom); double mapSizeX = s.Width(); diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.h b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.h index 61cb05cd4..6debb49fd 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.h +++ b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojection.h @@ -30,10 +30,9 @@ #include "../pureprojection.h" -using namespace internals; namespace projections { -class PlateCarreeProjection:public PureProjection +class PlateCarreeProjection:public internals::PureProjection { public: PlateCarreeProjection(); @@ -41,8 +40,8 @@ public: virtual Size TileSize() const; virtual double Axis() const; virtual double Flattening()const; - virtual Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); + virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); + virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); virtual Size GetTileMatrixMinXY(const int &zoom); virtual Size GetTileMatrixMaxXY(const int &zoom); private: diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp index c4cec539a..9c3a3065e 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp +++ b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.cpp @@ -51,9 +51,9 @@ Point PlateCarreeProjectionPergo::FromLatLngToPixel(double lat, double lng, cons return ret; } -PointLatLng PlateCarreeProjectionPergo::FromPixelToLatLng(const int &x, const int &y, const int &zoom) +internals::PointLatLng PlateCarreeProjectionPergo::FromPixelToLatLng(const int &x, const int &y, const int &zoom) { - PointLatLng ret;// = PointLatLng.Empty; + internals::PointLatLng ret;// = internals::PointLatLng.Empty; Size s = GetTileMatrixSizePixel(zoom); double mapSizeX = s.Width(); diff --git a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h index d808551cf..9e96ff9da 100644 --- a/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h +++ b/ground/src/libs/opmapcontrol/src/internals/projections/platecarreeprojectionpergo.h @@ -30,10 +30,9 @@ #include "../pureprojection.h" -using namespace internals; namespace projections { -class PlateCarreeProjectionPergo:public PureProjection +class PlateCarreeProjectionPergo:public internals::PureProjection { public: PlateCarreeProjectionPergo(); @@ -41,8 +40,8 @@ public: virtual Size TileSize() const; virtual double Axis() const; virtual double Flattening()const; - virtual Point FromLatLngToPixel(double lat, double lng, int const& zoom); - virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); + virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom); + virtual internals::PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom); virtual Size GetTileMatrixMinXY(const int &zoom); virtual Size GetTileMatrixMaxXY(const int &zoom); private: diff --git a/ground/src/libs/opmapcontrol/src/internals/pureprojection.h b/ground/src/libs/opmapcontrol/src/internals/pureprojection.h index 073e8b052..97337c8e5 100644 --- a/ground/src/libs/opmapcontrol/src/internals/pureprojection.h +++ b/ground/src/libs/opmapcontrol/src/internals/pureprojection.h @@ -51,22 +51,22 @@ public: virtual double Flattening()const=0; - virtual Point FromLatLngToPixel(double lat, double lng, int const& zoom)=0; + virtual core::Point FromLatLngToPixel(double lat, double lng, int const& zoom)=0; virtual PointLatLng FromPixelToLatLng(const int &x,const int &y,const int &zoom)=0; virtual QString Type(){return "PureProjection";} - Point FromLatLngToPixel(const PointLatLng &p,const int &zoom); + core::Point FromLatLngToPixel(const PointLatLng &p,const int &zoom); PointLatLng FromPixelToLatLng(const Point &p,const int &zoom); - virtual Point FromPixelToTileXY(const Point &p); - virtual Point FromTileXYToPixel(const Point &p); + virtual core::Point FromPixelToTileXY(const core::Point &p); + virtual core::Point FromTileXYToPixel(const core::Point &p); virtual Size GetTileMatrixMinXY(const int &zoom)=0; virtual Size GetTileMatrixMaxXY(const int &zoom)=0; virtual Size GetTileMatrixSizeXY(const int &zoom); int GetTileMatrixItemCount(const int &zoom); virtual Size GetTileMatrixSizePixel(const int &zoom); - QList GetAreaTileList(const RectLatLng &rect,const int &zoom,const int &padding); + QList GetAreaTileList(const RectLatLng &rect,const int &zoom,const int &padding); virtual double GetGroundResolution(const int &zoom,const double &latitude); double DegreesToRadians(const double °)const diff --git a/ground/src/libs/opmapcontrol/src/internals/rectangle.h b/ground/src/libs/opmapcontrol/src/internals/rectangle.h index 9ebdaafcb..dac0bc9e9 100644 --- a/ground/src/libs/opmapcontrol/src/internals/rectangle.h +++ b/ground/src/libs/opmapcontrol/src/internals/rectangle.h @@ -49,17 +49,17 @@ public: this->width = width; this->height = height; } - Rectangle(Point location, Size size) + Rectangle(core::Point location, core::Size size) { this->x = location.X(); this->y = location.Y(); this->width = size.Width(); this->height = size.Height(); } - Point GetLocation() { - return Point(x, y); + core::Point GetLocation() { + return core::Point(x, y); } - void SetLocation(const Point &value) + void SetLocation(const core::Point &value) { x = value.X(); y = value.Y(); @@ -88,7 +88,7 @@ public: { return this->x<=x && xx+this->width && this->y<=y && yy+this->height; } - bool Contains(const Point &pt) + bool Contains(const core::Point &pt) { return Contains(pt.X(),pt.Y()); } @@ -133,7 +133,7 @@ public: (this->y < rect.y + rect.height); } static Rectangle Union(const Rectangle &a,const Rectangle &b); - void Offset(const Point &pos) + void Offset(const core::Point &pos) { Offset(pos.X(), pos.Y()); } diff --git a/ground/src/libs/opmapcontrol/src/internals/tile.h b/ground/src/libs/opmapcontrol/src/internals/tile.h index ffe83cf09..28c27a3b0 100644 --- a/ground/src/libs/opmapcontrol/src/internals/tile.h +++ b/ground/src/libs/opmapcontrol/src/internals/tile.h @@ -40,13 +40,13 @@ namespace internals class Tile { public: - Tile(int zoom,Point pos); + Tile(int zoom,core::Point pos); Tile(); void Clear(); int GetZoom(){return zoom;} - Point GetPos(){return pos;} + core::Point GetPos(){return pos;} void SetZoom(const int &value){zoom=value;} - void SetPos(const Point &value){pos=value;} + void SetPos(const core::Point &value){pos=value;} Tile& operator= (const Tile &cSource); Tile(const Tile &cSource) { @@ -60,7 +60,7 @@ protected: QMutex mutex; private: int zoom; - Point pos; + core::Point pos; }; diff --git a/ground/src/libs/opmapcontrol/src/internals/tilematrix.h b/ground/src/libs/opmapcontrol/src/internals/tilematrix.h index a35d8636e..045231e95 100644 --- a/ground/src/libs/opmapcontrol/src/internals/tilematrix.h +++ b/ground/src/libs/opmapcontrol/src/internals/tilematrix.h @@ -39,13 +39,13 @@ class TileMatrix public: TileMatrix(); void Clear(); - void ClearPointsNotIn(QList list); - Tile* TileAt(const Point &p); - void SetTileAt(const Point &p,Tile* tile); + void ClearPointsNotIn(QList list); + Tile* TileAt(const core::Point &p); + void SetTileAt(const core::Point &p,Tile* tile); int count()const{return matrix.count();} protected: - QHash matrix; - QList removals; + QHash matrix; + QList removals; QMutex mutex; }; diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp index 36a146b85..db17024c8 100644 --- a/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ b/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp @@ -1,7 +1,7 @@ #include "mapgraphicitem.h" namespace mapcontrol { - MapGraphicItem::MapGraphicItem(Core *core):core(core),MapRenderTransform(1), maxZoom(17),minZoom(2),zoomReal(0),isSelected(false),rotation(0) + MapGraphicItem::MapGraphicItem(internals::Core *core):core(core),MapRenderTransform(1), maxZoom(17),minZoom(2),zoomReal(0),isSelected(false),rotation(0) { EmptytileBrush = Qt::cyan; MissingDataFont =QFont ("Times",10,QFont::Bold); @@ -14,10 +14,9 @@ namespace mapcontrol DragButton = Qt::RightButton; isMouseOverMarker=false; maprect=QRectF(0,0,1022,680); - core->SetCurrentRegion(Rectangle(0, 0, maprect.width(), maprect.height())); + core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); core->SetMapType(MapType::GoogleHybrid); this->SetZoom(2); - connect(core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation())); @@ -39,7 +38,7 @@ namespace mapcontrol } core->OnMapSizeChanged(maprect.width(),maprect.height()); - core->SetCurrentRegion(Rectangle(0, 0, maprect.width(), maprect.height())); + core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); if(isVisible()) { core->GoToCurrentPosition(); @@ -106,8 +105,8 @@ namespace mapcontrol else if(!isSelected) { isSelected = true; - SetSelectedArea (RectLatLng::Empty); - selectionEnd = PointLatLng::Empty; + SetSelectedArea (internals::RectLatLng::Empty); + selectionEnd = internals::PointLatLng::Empty; selectionStart = FromLocalToLatLng(event->pos().x(), event->pos().y()); } } @@ -150,15 +149,15 @@ namespace mapcontrol { if(core->GetmouseLastZoom().X() != event->pos().x() && core->mouseLastZoom.Y() != event->pos().y()) { - if(GetMouseWheelZoomType() == MouseWheelZoomType::MousePositionAndCenter) + if(GetMouseWheelZoomType() == internals::MouseWheelZoomType::MousePositionAndCenter) { core->SetCurrentPosition(FromLocalToLatLng(event->pos().x(), event->pos().y())); } - else if(GetMouseWheelZoomType() == MouseWheelZoomType::ViewCenter) + else if(GetMouseWheelZoomType() == internals::MouseWheelZoomType::ViewCenter) { core->SetCurrentPosition(FromLocalToLatLng((int) maprect.width()/2, (int) maprect.height()/2)); } - else if(GetMouseWheelZoomType() == MouseWheelZoomType::MousePositionWithoutCenter) + else if(GetMouseWheelZoomType() == internals::MouseWheelZoomType::MousePositionWithoutCenter) { core->SetCurrentPosition(FromLocalToLatLng(event->pos().x(), event->pos().y())); @@ -169,7 +168,7 @@ namespace mapcontrol } // set mouse position to map center - if(GetMouseWheelZoomType() != MouseWheelZoomType::MousePositionWithoutCenter) + if(GetMouseWheelZoomType() != internals::MouseWheelZoomType::MousePositionWithoutCenter) { { // System.Drawing.Point p = PointToScreen(new System.Drawing.Point(Width/2, Height/2)); @@ -205,7 +204,7 @@ namespace mapcontrol { - Tile* t = core->Matrix.TileAt(core->GettilePoint()); + internals::Tile* t = core->Matrix.TileAt(core->GettilePoint()); //qDebug()<<"OPMapControl::DrawMap2D tile:"<GetPos().ToString()<<" as "<Overlays.count()<<" overlays"; //Tile t = core->Matrix[tileToDraw]; if(t!=0) @@ -270,7 +269,7 @@ namespace mapcontrol } } } - PointLatLng MapGraphicItem::FromLocalToLatLng(int x, int y) + internals::PointLatLng MapGraphicItem::FromLocalToLatLng(int x, int y) { if(MapRenderTransform!=-1) { diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h b/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h index cb68df353..33d1df587 100644 --- a/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h +++ b/ground/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h @@ -11,13 +11,13 @@ #include namespace mapcontrol { - class OPMapWidget; +class OPMapWidget; class MapGraphicItem:public QObject,public QGraphicsItem { friend class mapcontrol::OPMapWidget; Q_OBJECT public: - MapGraphicItem(Core *core); + MapGraphicItem(internals::Core *core); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); @@ -36,22 +36,22 @@ protected: void SetZoomStep(int const& value); private: - Core *core; + internals::Core *core; bool showTileGridLines; qreal MapRenderTransform; void DrawMap2D(QPainter *painter); QFont MissingDataFont; int maxZoom; int minZoom; - RectLatLng selectedArea; - PointLatLng selectionStart; - PointLatLng selectionEnd; + internals::RectLatLng selectedArea; + internals::PointLatLng selectionStart; + internals::PointLatLng selectionEnd; double zoomReal; QRectF maprect; bool isSelected; bool isMouseOverMarker; void SetIsMouseOverMarker(bool const& value){isMouseOverMarker = value;} - PointLatLng FromLocalToLatLng(int x, int y); + internals::PointLatLng FromLocalToLatLng(int x, int y); qreal rotation; QRectF boundingBox(QRectF const& rect, qreal const& angle); @@ -62,12 +62,12 @@ private: QPen SelectionPen; int MaxZoom()const{return maxZoom;} int MinZoom()const{return minZoom;} - MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();} - QString GetMouseWheelZoomTypeStr(){return MouseWheelZoomType::TypesStrList().at((int)core->GetMouseWheelZoomType());} + internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();} + QString GetMouseWheelZoomTypeStr(){return internals::MouseWheelZoomType::TypesStrList().at((int)core->GetMouseWheelZoomType());} bool MapScaleInfoEnabled; Qt::MouseButton DragButton; - void SetSelectedArea(RectLatLng const& value){selectedArea = value;this->update();} - RectLatLng BoundsOfMap; + void SetSelectedArea(internals::RectLatLng const& value){selectedArea = value;this->update();} + internals::RectLatLng BoundsOfMap; void Offset(int const& x, int const& y); bool CanDragMap()const{return core->CanDragMap;} void SetCanDragMap(bool const& value){core->CanDragMap = value;} diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/mapresources.qrc b/ground/src/libs/opmapcontrol/src/mapwidget/mapresources.qrc deleted file mode 100644 index 7646d2b36..000000000 --- a/ground/src/libs/opmapcontrol/src/mapwidget/mapresources.qrc +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/mapwidget.pro b/ground/src/libs/opmapcontrol/src/mapwidget/mapwidget.pro index a30f1ec6a..1546eb3e8 100644 --- a/ground/src/libs/opmapcontrol/src/mapwidget/mapwidget.pro +++ b/ground/src/libs/opmapcontrol/src/mapwidget/mapwidget.pro @@ -1,16 +1,14 @@ TEMPLATE = lib -TARGET = OPMapWidget +TARGET = opmapwidget DEFINES += OPMAPWIDGET_LIBRARY include(../../../../openpilotgcslibrary.pri) - -SOURCES += opmapcontrol.cpp \ - mapgraphicitem.cpp \ +#DESTDIR = ../build +SOURCES += mapgraphicitem.cpp \ opmapwidget.cpp LIBS += -L../build -lcore -linternals -lcore -HEADERS += opmapcontrol.h \ - mapgraphicitem.h \ +HEADERS += mapgraphicitem.h \ opmapwidget.h QT += opengl diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.cpp b/ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.cpp deleted file mode 100644 index 6cce9716c..000000000 --- a/ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.cpp +++ /dev/null @@ -1,366 +0,0 @@ -#include "opmapcontrol.h" -#include -namespace mapcontrol -{ -OPMapControl::OPMapControl(QWidget *parent):QWidget(parent),MapRenderTransform(1), maxZoom(17),minZoom(2),zoomReal(0),isSelected(false) -{ - EmptytileBrush = Qt::cyan; - MissingDataFont =QFont ("Times",10,QFont::Bold); - EmptyTileText = "We are sorry, but we don't\nhave imagery at this zoom\nlevel for this region."; - EmptyTileBorders = QPen(Qt::white); - ScalePen = QPen(Qt::blue); - SelectionPen = QPen(Qt::blue); - MapScaleInfoEnabled = true; - showTileGridLines=true; - DragButton = Qt::RightButton; - isMouseOverMarker=false; - core.SetCurrentRegion(Rectangle(-50, -50, this->width()+100, this->height()+100)); - core.SetMapType(MapType::GoogleHybrid); - core.SetZoom(3); - - connect(&core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation())); - - -} -void OPMapControl::showEvent(QShowEvent *event) -{ - QWidget::showEvent(event); - core.StartSystem(); - resize(); -} - -void OPMapControl::Core_OnNeedInvalidation() -{ - this->repaint(); -} - -void OPMapControl::paintEvent(QPaintEvent* evnt) -{ - QWidget::paintEvent(evnt); - QPainter painter(this); - // painter.setBrush(palette().foreground().color()); - // painter.fillRect(this->rect(),painter.background()); - if(MapRenderTransform!=1) - { - QTransform transform; - transform.scale(MapRenderTransform,MapRenderTransform); - painter.setWorldTransform(transform); - { - DrawMap2D(painter); - } - painter.resetTransform(); - } - else - { - DrawMap2D(painter); - } - // painter.drawText(10,10,"TESTE"); -} - -void OPMapControl::DrawMap2D(QPainter &painter) -{ - // qDebug()<GetPos().ToString()<<" as "<Overlays.count()<<" overlays"; - //Tile t = Core.Matrix[tileToDraw]; - if(t!=0) - { - //qDebug()<< "opmapcontrol:draw2d TileHasValue:"<GetPos().ToString(); - core.tileRect.SetX(core.GettilePoint().X()*core.tileRect.Width()); - core.tileRect.SetY(core.GettilePoint().Y()*core.tileRect.Height()); - core.tileRect.Offset(core.GetrenderOffset()); - - if(core.GetCurrentRegion().IntersectsWith(core.tileRect)) - { - bool found = false; - - // render tile - //lock(t.Overlays) - { - foreach(QByteArray img,t->Overlays) - { - if(img.count()!=0) - { - if(!found) - found = true; - { - painter.drawImage(QRectF(core.tileRect.X(), core.tileRect.Y(), core.tileRect.Width(), core.tileRect.Height()),QImage::fromData(img)); - - } - } - } - } - - if(showTileGridLines) - { - painter.setPen(EmptyTileBorders); - painter.drawRect(core.tileRect.X(), core.tileRect.Y(), core.tileRect.Width(), core.tileRect.Height()); - { - painter.setFont(MissingDataFont); - painter.setPen(Qt::red); - painter.drawText(QRectF(core.tileRect.X(), core.tileRect.Y(), core.tileRect.Width(), core.tileRect.Height()),Qt::AlignCenter,(core.GettilePoint() == core.GetcenterTileXYLocation()? "CENTER: " :"TILE: ")+core.GettilePoint().ToString()); - //qDebug()<<"ShowTileGridLine:"<button() == DragButton && core.CanDragMap) - { - core.mouseDown.SetX(evnt->x()); - core.mouseDown.SetY(evnt->y()); - - - this->setCursor(Qt::SizeAllCursor); - - core.BeginDrag(core.mouseDown); - this->repaint(); - - } - else if(!isSelected) - { - isSelected = true; - SetSelectedArea (RectLatLng::Empty); - selectionEnd = PointLatLng::Empty; - selectionStart = FromLocalToLatLng(evnt->x(), evnt->y()); - } - } - - QWidget::mousePressEvent(evnt); -} -PointLatLng OPMapControl::FromLocalToLatLng(int x, int y) -{ - if(MapRenderTransform!=-1) - { - x = (int) (x * MapRenderTransform); - y = (int) (y * MapRenderTransform); - } - return core.FromLocalToLatLng(x, y); -} -void OPMapControl::mouseReleaseEvent ( QMouseEvent* evnt ) -{ - QWidget::mouseReleaseEvent(evnt); - - if(isSelected) - { - isSelected = false; - } - - if(core.IsDragging()) - { - core.EndDrag(); - - this->setCursor(Qt::ArrowCursor); - if(!BoundsOfMap.IsEmpty() && !BoundsOfMap.Contains(core.CurrentPosition())) - { - if(!core.LastLocationInBounds.IsEmpty()) - { - core.SetCurrentPosition(core.LastLocationInBounds); - } - } - } - else - { - if(!selectionEnd.IsEmpty() && !selectionStart.IsEmpty()) - { - if(!selectedArea.IsEmpty() && evnt->modifiers() == Qt::ShiftModifier) - { - // SetZoomToFitRect(SelectedArea());TODO - } - } - - } - -} - -void OPMapControl::mouseMoveEvent ( QMouseEvent* evnt ) -{ - if(core.IsDragging()) - { - core.mouseCurrent.SetX(evnt->x()); - core.mouseCurrent.SetY(evnt->y()); - - { - core.Drag(core.mouseCurrent); - } - - } -} -void OPMapControl::resizeEvent ( QResizeEvent * event ) -{ - QWidget::resizeEvent(event); - resize(); -} -void OPMapControl::resize() -{ - - core.OnMapSizeChanged(this->width(),this->height()); - core.SetCurrentRegion(Rectangle(-50, -50, this->width()+100, this->height()+100)); - if(isVisible()) - { - core.GoToCurrentPosition(); - } -} -void OPMapControl::wheelEvent(QWheelEvent *event) -{ - QWidget::wheelEvent(event); - - if(!IsMouseOverMarker() && !IsDragging()) - { - if(core.GetmouseLastZoom().X() != event->pos().x() && core.mouseLastZoom.Y() != event->pos().y()) - { - if(GetMouseWheelZoomType() == MouseWheelZoomType::MousePositionAndCenter) - { - core.SetCurrentPosition(FromLocalToLatLng(event->pos().x(), event->pos().y())); - } - else if(GetMouseWheelZoomType() == MouseWheelZoomType::ViewCenter) - { - core.SetCurrentPosition(FromLocalToLatLng((int) width()/2, (int) height()/2)); - } - else if(GetMouseWheelZoomType() == MouseWheelZoomType::MousePositionWithoutCenter) - { - core.SetCurrentPosition(FromLocalToLatLng(event->pos().x(), event->pos().y())); - - } - - core.mouseLastZoom.SetX((event->pos().x())); - core.mouseLastZoom.SetY((event->pos().y())); - } - - // set mouse position to map center - if(GetMouseWheelZoomType() != MouseWheelZoomType::MousePositionWithoutCenter) - { - { -// System.Drawing.Point p = PointToScreen(new System.Drawing.Point(Width/2, Height/2)); -// Stuff.SetCursorPos((int) p.X, (int) p.Y); - } - } - - core.MouseWheelZooming = true; - - if(event->delta() > 0) - { - SetZoom(Zoom()+1); - } - else if(event->delta() < 0) - { - SetZoom(Zoom()-1); - } - - core.MouseWheelZooming = false; - } -} -double OPMapControl::Zoom() -{ - - - return zoomReal; -} -void OPMapControl::SetZoom(double const& value) -{ - if(zoomReal != value) - { - if(value > MaxZoom()) - { - zoomReal = MaxZoom(); - } - else - if(value < MinZoom()) - { - zoomReal = MinZoom(); - } - else - { - zoomReal = value; - } - - float remainder = (float)std::fmod((float) value, (float) 1); - if(remainder != 0) - { - float scaleValue = remainder + 1; - { - MapRenderTransform = scaleValue; - } - - SetZoomStep((qint32)(value - remainder)); - - this->repaint(); - - } - else - { - - MapRenderTransform = 1; - - SetZoomStep ((qint32)(value)); - zoomReal = ZoomStep(); - this->repaint(); - } - } -} -int OPMapControl::ZoomStep()const -{ - return core.Zoom(); -} -void OPMapControl::SetZoomStep(int const& value) -{ - if(value > MaxZoom()) - { - core.SetZoom(MaxZoom()); - } - else if(value < MinZoom()) - { - core.SetZoom(MinZoom()); - } - else - { - core.SetZoom(value); - } -} - -void OPMapControl::Offset(int const& x, int const& y) -{ - core.DragOffset(Point(x, y)); -} -void OPMapControl::closeEvent(QCloseEvent *event) -{ - core.OnMapClose(); - event->accept(); -} -} diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.h b/ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.h deleted file mode 100644 index c5923d20a..000000000 --- a/ground/src/libs/opmapcontrol/src/mapwidget/opmapcontrol.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef OPMAPCONTROL_H -#define OPMAPCONTROL_H - -#include "../internals/core.h" -#include -#include -#include -#include -#include - -namespace mapcontrol -{ - -using namespace core; -//using namespace internals; - -class internals::Core; - -class OPMapControl:public QWidget -{ - - Q_OBJECT - -// Q_PROPERTY(int MaxZoom READ MaxZoom WRITE SetMaxZoom) -// Q_PROPERTY(int MinZoom READ MinZoom WRITE SetMinZoom) -// Q_PROPERTY(internals::MouseWheelZoomType::Types MouseWheelZoom READ GetMouseWheelZoomType WRITE SetMouseWheelZoomType) -// Q_PROPERTY(QString MouseWheelZoomStr READ GetMouseWheelZoomTypeStr WRITE SetMouseWheelZoomTypeByStr) -// Q_PROPERTY(bool ShowTileGridLines READ ShowTileGridLines WRITE SetShowTileGridLines) -// Q_PROPERTY(double Zoom READ Zoom WRITE SetZoom) -public: - OPMapControl(QWidget *parent=0); - -protected: - void paintEvent ( QPaintEvent* evnt ); - void mousePressEvent ( QMouseEvent* evnt ); - void mouseReleaseEvent ( QMouseEvent* evnt ); - void mouseMoveEvent ( QMouseEvent* evnt ); - void resizeEvent ( QResizeEvent * event ); - void showEvent ( QShowEvent * event ); - void closeEvent ( QCloseEvent * event ); - bool IsDragging()const{return core.IsDragging();} - bool IsMouseOverMarker()const{return isMouseOverMarker;} - void wheelEvent ( QWheelEvent * event ); - int ZoomStep()const; - void SetZoomStep(int const& value); -private: - QBrush EmptytileBrush; - QString EmptyTileText; - QPen EmptyTileBorders; - QPen ScalePen; - QPen SelectionPen; -// bool ShowTileGridLines()const {return showTileGridLines;} -// void SetShowTileGridLines(bool const& value){showTileGridLines=value;this->repaint();} - int MaxZoom()const{return maxZoom;} -// void SetMaxZoom(int const& value){maxZoom = value;} - int MinZoom()const{return minZoom;} -// void SetMinZoom(int const& value){minZoom = value;} - MouseWheelZoomType::Types GetMouseWheelZoomType(){return core.GetMouseWheelZoomType();} -// void SetMouseWheelZoomType(MouseWheelZoomType::Types const& value){core.SetMouseWheelZoomType(value);} -// void SetMouseWheelZoomTypeByStr(const QString &value){core.SetMouseWheelZoomType(MouseWheelZoomType::TypeByStr(value));} - QString GetMouseWheelZoomTypeStr(){return MouseWheelZoomType::TypesStrList().at((int)core.GetMouseWheelZoomType());} - bool MapScaleInfoEnabled; - Qt::MouseButton DragButton; -// RectLatLng SelectedArea()const{return selectedArea;} - void SetSelectedArea(RectLatLng const& value){selectedArea = value;this->update();} - RectLatLng BoundsOfMap; - void Offset(int const& x, int const& y); - bool CanDragMap()const{return core.CanDragMap;} - void SetCanDragMap(bool const& value){core.CanDragMap = value;} -// PointLatLng CurrentPosition()const{return core.CurrentPosition();} -// void SetCurrentPosition(PointLatLng const& value){core.SetCurrentPosition(value);} - double Zoom(); - void SetZoom(double const& value); - bool showTileGridLines; - Core core; - qreal MapRenderTransform; - void DrawMap2D(QPainter &painter); - QFont MissingDataFont; - void resize(); - int maxZoom; - int minZoom; - RectLatLng selectedArea; - PointLatLng selectionStart; - PointLatLng selectionEnd; - double zoomReal; - bool isSelected; - bool isMouseOverMarker; - void SetIsMouseOverMarker(bool const& value){isMouseOverMarker = value;} - PointLatLng FromLocalToLatLng(int x, int y); -private slots: - void Core_OnNeedInvalidation(); -}; -} -#endif // OPMAPCONTROL_H diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp b/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp index ab1655a99..d400fe196 100644 --- a/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp +++ b/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.cpp @@ -7,7 +7,7 @@ namespace mapcontrol { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - core=new Core; + core=new internals::Core; map=new MapGraphicItem(core); //text.setZValue(20); //QGraphicsTextItem *t=new QGraphicsTextItem(map); diff --git a/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h b/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h index cfc24604e..40142794d 100644 --- a/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h +++ b/ground/src/libs/opmapcontrol/src/mapwidget/opmapwidget.h @@ -44,16 +44,16 @@ namespace mapcontrol void SetMaxZoom(int const& value){map->maxZoom = value;} int MinZoom()const{return map->minZoom;} void SetMinZoom(int const& value){map->minZoom = value;} - MouseWheelZoomType::Types GetMouseWheelZoomType(){return map->core->GetMouseWheelZoomType();} - void SetMouseWheelZoomType(MouseWheelZoomType::Types const& value){map->core->SetMouseWheelZoomType(value);} - void SetMouseWheelZoomTypeByStr(const QString &value){map->core->SetMouseWheelZoomType(MouseWheelZoomType::TypeByStr(value));} + internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return map->core->GetMouseWheelZoomType();} + void SetMouseWheelZoomType(internals::MouseWheelZoomType::Types const& value){map->core->SetMouseWheelZoomType(value);} + void SetMouseWheelZoomTypeByStr(const QString &value){map->core->SetMouseWheelZoomType(internals::MouseWheelZoomType::TypeByStr(value));} QString GetMouseWheelZoomTypeStr(){return map->GetMouseWheelZoomTypeStr();} - RectLatLng SelectedArea()const{return map->selectedArea;} - void SetSelectedArea(RectLatLng const& value){ map->selectedArea = value;this->update();} + internals::RectLatLng SelectedArea()const{return map->selectedArea;} + void SetSelectedArea(internals::RectLatLng const& value){ map->selectedArea = value;this->update();} bool CanDragMap()const{return map->CanDragMap();} void SetCanDragMap(bool const& value){map->SetCanDragMap(value);} - PointLatLng CurrentPosition()const{return map->core->CurrentPosition();} - void SetCurrentPosition(PointLatLng const& value){map->core->SetCurrentPosition(value);} + internals::PointLatLng CurrentPosition()const{return map->core->CurrentPosition();} + void SetCurrentPosition(internals::PointLatLng const& value){map->core->SetCurrentPosition(value);} double Zoom(){return map->Zoom();} void SetZoom(double const& value){map->SetZoom(value);} qreal Rotate(){return map->rotation;} @@ -67,7 +67,7 @@ namespace mapcontrol bool isStarted(){return map->core->isStarted();} void X(){map->core->GoToCurrentPosition();} private: - Core *core; + internals::Core *core; MapGraphicItem *map; QGraphicsScene mscene; bool useOpenGL; diff --git a/ground/src/libs/opmapcontrol/src/src.pro b/ground/src/libs/opmapcontrol/src/src.pro index 4c8670129..b676d74dc 100644 --- a/ground/src/libs/opmapcontrol/src/src.pro +++ b/ground/src/libs/opmapcontrol/src/src.pro @@ -3,3 +3,4 @@ CONFIG += ordered SUBDIRS = core SUBDIRS += internals SUBDIRS += mapwidget +#SUBDIRS +=finaltest