Commit 812ee272 authored by Don Gagne's avatar Don Gagne

Cut over 100% to new Map/Mission code

- Delete all old map code
parent 782af62d
......@@ -166,23 +166,8 @@ FORMS += \
src/ui/Linechart.ui \
src/ui/LogReplayLinkConfigurationWidget.ui \
src/ui/MainWindow.ui \
src/ui/map/QGCMapTool.ui \
src/ui/map/QGCMapToolBar.ui \
src/ui/mavlink/QGCMAVLinkMessageSender.ui \
src/ui/MAVLinkSettingsWidget.ui \
src/ui/mission/QGCMissionConditionDelay.ui \
src/ui/mission/QGCMissionDoFinishSearch.ui \
src/ui/mission/QGCMissionDoJump.ui \
src/ui/mission/QGCMissionDoStartSearch.ui \
src/ui/mission/QGCMissionNavLand.ui \
src/ui/mission/QGCMissionNavLoiterTime.ui \
src/ui/mission/QGCMissionNavLoiterTurns.ui \
src/ui/mission/QGCMissionNavLoiterUnlim.ui \
src/ui/mission/QGCMissionNavReturnToLaunch.ui \
src/ui/mission/QGCMissionNavSweep.ui \
src/ui/mission/QGCMissionNavTakeoff.ui \
src/ui/mission/QGCMissionNavWaypoint.ui \
src/ui/mission/QGCMissionOther.ui \
src/ui/QGCCommConfiguration.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCLinkConfiguration.ui \
......@@ -195,7 +180,6 @@ FORMS += \
src/ui/QGCUASFileView.ui \
src/ui/QGCUASFileViewMulti.ui \
src/ui/QGCUDPLinkConfiguration.ui \
src/ui/QGCWaypointListMulti.ui \
src/ui/SettingsDialog.ui \
src/ui/uas/QGCUnconnectedInfoWidget.ui \
src/ui/uas/UASMessageView.ui \
......@@ -203,9 +187,6 @@ FORMS += \
src/ui/uas/UASQuickViewItemSelect.ui \
src/ui/UASInfo.ui \
src/ui/UASRawStatusView.ui \
src/ui/WaypointEditableView.ui \
src/ui/WaypointList.ui \
src/ui/WaypointViewOnlyView.ui \
!iOSBuild {
FORMS += \
......@@ -272,7 +253,6 @@ HEADERS += \
src/uas/UAS.h \
src/uas/UASInterface.h \
src/uas/UASMessageHandler.h \
src/uas/UASWaypointManager.h \
src/ui/linechart/ChartPlot.h \
src/ui/linechart/IncrementalPlot.h \
src/ui/linechart/LinechartPlot.h \
......@@ -283,27 +263,9 @@ HEADERS += \
src/ui/LogReplayLinkConfigurationWidget.h \
src/ui/MainWindow.h \
src/ui/map/MAV2DIcon.h \
src/ui/map/QGCMapTool.h \
src/ui/map/QGCMapToolBar.h \
src/ui/map/QGCMapWidget.h \
src/ui/map/Waypoint2DIcon.h \
src/ui/mapdisplay/QGCMapDisplay.h \
src/ui/mavlink/QGCMAVLinkMessageSender.h \
src/ui/MAVLinkDecoder.h \
src/ui/MAVLinkSettingsWidget.h \
src/ui/mission/QGCMissionConditionDelay.h \
src/ui/mission/QGCMissionDoFinishSearch.h \
src/ui/mission/QGCMissionDoJump.h \
src/ui/mission/QGCMissionDoStartSearch.h \
src/ui/mission/QGCMissionNavLand.h \
src/ui/mission/QGCMissionNavLoiterTime.h \
src/ui/mission/QGCMissionNavLoiterTurns.h \
src/ui/mission/QGCMissionNavLoiterUnlim.h \
src/ui/mission/QGCMissionNavReturnToLaunch.h \
src/ui/mission/QGCMissionNavSweep.h \
src/ui/mission/QGCMissionNavTakeoff.h \
src/ui/mission/QGCMissionNavWaypoint.h \
src/ui/mission/QGCMissionOther.h \
src/ui/QGCCommConfiguration.h \
src/ui/QGCDataPlot2D.h \
src/ui/QGCLinkConfiguration.h \
......@@ -317,7 +279,6 @@ HEADERS += \
src/ui/QGCUASFileView.h \
src/ui/QGCUASFileViewMulti.h \
src/ui/QGCUDPLinkConfiguration.h \
src/ui/QGCWaypointListMulti.h \
src/ui/SettingsDialog.h \
src/ui/toolbar/MainToolBar.h \
src/ui/uas/QGCUnconnectedInfoWidget.h \
......@@ -329,9 +290,6 @@ HEADERS += \
src/ui/uas/UASQuickViewItemSelect.h \
src/ui/uas/UASQuickViewTextItem.h \
src/ui/UASRawStatusView.h \
src/ui/WaypointEditableView.h \
src/ui/WaypointList.h \
src/ui/WaypointViewOnlyView.h \
src/ViewWidgets/CustomCommandWidget.h \
src/ViewWidgets/CustomCommandWidgetController.h \
src/ViewWidgets/ViewWidgetController.h \
......@@ -401,7 +359,6 @@ SOURCES += \
src/uas/FileManager.cc \
src/uas/UAS.cc \
src/uas/UASMessageHandler.cc \
src/uas/UASWaypointManager.cc \
src/ui/linechart/ChartPlot.cc \
src/ui/linechart/IncrementalPlot.cc \
src/ui/linechart/LinechartPlot.cc \
......@@ -411,28 +368,9 @@ SOURCES += \
src/ui/linechart/ScrollZoomer.cc \
src/ui/LogReplayLinkConfigurationWidget.cc \
src/ui/MainWindow.cc \
src/ui/map/MAV2DIcon.cc \
src/ui/map/QGCMapTool.cc \
src/ui/map/QGCMapToolBar.cc \
src/ui/map/QGCMapWidget.cc \
src/ui/map/Waypoint2DIcon.cc \
src/ui/mapdisplay/QGCMapDisplay.cc \
src/ui/mavlink/QGCMAVLinkMessageSender.cc \
src/ui/MAVLinkDecoder.cc \
src/ui/MAVLinkSettingsWidget.cc \
src/ui/mission/QGCMissionConditionDelay.cc \
src/ui/mission/QGCMissionDoFinishSearch.cc \
src/ui/mission/QGCMissionDoJump.cc \
src/ui/mission/QGCMissionDoStartSearch.cc \
src/ui/mission/QGCMissionNavLand.cc \
src/ui/mission/QGCMissionNavLoiterTime.cc \
src/ui/mission/QGCMissionNavLoiterTurns.cc \
src/ui/mission/QGCMissionNavLoiterUnlim.cc \
src/ui/mission/QGCMissionNavReturnToLaunch.cc \
src/ui/mission/QGCMissionNavSweep.cc \
src/ui/mission/QGCMissionNavTakeoff.cc \
src/ui/mission/QGCMissionNavWaypoint.cc \
src/ui/mission/QGCMissionOther.cc \
src/ui/QGCCommConfiguration.cc \
src/ui/QGCDataPlot2D.cc \
src/ui/QGCLinkConfiguration.cc \
......@@ -446,7 +384,6 @@ SOURCES += \
src/ui/QGCUASFileView.cc \
src/ui/QGCUASFileViewMulti.cc \
src/ui/QGCUDPLinkConfiguration.cc \
src/ui/QGCWaypointListMulti.cc \
src/ui/SettingsDialog.cc \
src/ui/toolbar/MainToolBar.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc \
......@@ -458,9 +395,6 @@ SOURCES += \
src/ui/uas/UASQuickViewItemSelect.cc \
src/ui/uas/UASQuickViewTextItem.cc \
src/ui/UASRawStatusView.cpp \
src/ui/WaypointEditableView.cc \
src/ui/WaypointList.cc \
src/ui/WaypointViewOnlyView.cc \
src/ViewWidgets/CustomCommandWidget.cc \
src/ViewWidgets/CustomCommandWidgetController.cc \
src/ViewWidgets/ViewWidgetController.cc \
......
......@@ -61,16 +61,6 @@ exists($$MAVLINKPATH/common) {
INCLUDEPATH += libs/eigen
DEFINES += NOMINMAX
#
# [REQUIRED] OPMapControl library from OpenPilot. Provides 2D mapping functionality.
#
include(libs/opmapcontrol/opmapcontrol_external.pri)
INCLUDEPATH += \
libs/utils \
libs \
libs/opmapcontrol
#
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
#
......
#include "src/mapwidget/opmapwidget.h"
LIBS *= -l$$qtLibraryTarget(opmapwidget)
TEMPLATE = subdirs
SUBDIRS = src \
######################################################################
# Automatically generated by qmake (2.01a) Sa. Mrz 19 17:12:54 2011
######################################################################
# HACK! BIG TIME!
DEFINES += EXTERNAL_USE
DEPENDPATH += $$PWD/src/core $$PWD/src/internals $$PWD/src/mapwidget $$PWD/src/internals/projections
INCLUDEPATH += $$PWD/src/core $$PWD/src/internals $$PWD/src/internals/projections $$PWD/src/mapwidget
# Input
HEADERS += $$PWD/opmapcontrol.h \
$$PWD/src/core/accessmode.h \
$$PWD/src/core/alllayersoftype.h \
$$PWD/src/core/cache.h \
$$PWD/src/core/cacheitemqueue.h \
$$PWD/src/core/debugheader.h \
$$PWD/src/core/diagnostics.h \
$$PWD/src/core/geodecoderstatus.h \
$$PWD/src/core/kibertilecache.h \
$$PWD/src/core/languagetype.h \
$$PWD/src/core/maptype.h \
$$PWD/src/core/memorycache.h \
$$PWD/src/core/opmaps.h \
$$PWD/src/core/placemark.h \
$$PWD/src/core/point.h \
$$PWD/src/core/providerstrings.h \
$$PWD/src/core/pureimage.h \
$$PWD/src/core/pureimagecache.h \
$$PWD/src/core/rawtile.h \
$$PWD/src/core/size.h \
$$PWD/src/core/tilecachequeue.h \
$$PWD/src/core/urlfactory.h \
$$PWD/src/internals/copyrightstrings.h \
$$PWD/src/internals/core.h \
$$PWD/src/internals/debugheader.h \
$$PWD/src/internals/loadtask.h \
$$PWD/src/internals/mousewheelzoomtype.h \
$$PWD/src/internals/pointlatlng.h \
$$PWD/src/internals/pureprojection.h \
$$PWD/src/internals/rectangle.h \
$$PWD/src/internals/rectlatlng.h \
$$PWD/src/internals/sizelatlng.h \
$$PWD/src/internals/tile.h \
$$PWD/src/internals/tilematrix.h \
$$PWD/src/mapwidget/configuration.h \
$$PWD/src/mapwidget/gpsitem.h \
$$PWD/src/mapwidget/homeitem.h \
$$PWD/src/mapwidget/mapgraphicitem.h \
$$PWD/src/mapwidget/mapripform.h \
$$PWD/src/mapwidget/mapripper.h \
$$PWD/src/mapwidget/opmapwidget.h \
$$PWD/src/mapwidget/trailitem.h \
$$PWD/src/mapwidget/traillineitem.h \
$$PWD/src/mapwidget/uavitem.h \
$$PWD/src/mapwidget/uavmapfollowtype.h \
$$PWD/src/mapwidget/uavtrailtype.h \
$$PWD/src/mapwidget/waypointitem.h \
$$PWD/src/internals/projections/lks94projection.h \
$$PWD/src/internals/projections/mercatorprojection.h \
$$PWD/src/internals/projections/mercatorprojectionyandex.h \
$$PWD/src/internals/projections/platecarreeprojection.h \
$$PWD/src/internals/projections/platecarreeprojectionpergo.h \
$$PWD/src/mapwidget/waypointlineitem.h
FORMS += $$PWD/src/mapwidget/mapripform.ui
SOURCES += $$PWD/src/core/alllayersoftype.cpp \
$$PWD/src/core/cache.cpp \
$$PWD/src/core/cacheitemqueue.cpp \
$$PWD/src/core/diagnostics.cpp \
$$PWD/src/core/kibertilecache.cpp \
$$PWD/src/core/languagetype.cpp \
$$PWD/src/core/memorycache.cpp \
$$PWD/src/core/opmaps.cpp \
$$PWD/src/core/placemark.cpp \
$$PWD/src/core/point.cpp \
$$PWD/src/core/providerstrings.cpp \
$$PWD/src/core/pureimage.cpp \
$$PWD/src/core/pureimagecache.cpp \
$$PWD/src/core/rawtile.cpp \
$$PWD/src/core/size.cpp \
$$PWD/src/core/tilecachequeue.cpp \
$$PWD/src/core/urlfactory.cpp \
$$PWD/src/internals/core.cpp \
$$PWD/src/internals/loadtask.cpp \
$$PWD/src/internals/MouseWheelZoomType.cpp \
$$PWD/src/internals/pointlatlng.cpp \
$$PWD/src/internals/pureprojection.cpp \
$$PWD/src/internals/rectangle.cpp \
$$PWD/src/internals/rectlatlng.cpp \
$$PWD/src/internals/sizelatlng.cpp \
$$PWD/src/internals/tile.cpp \
$$PWD/src/internals/tilematrix.cpp \
$$PWD/src/mapwidget/configuration.cpp \
$$PWD/src/mapwidget/gpsitem.cpp \
$$PWD/src/mapwidget/homeitem.cpp \
$$PWD/src/mapwidget/mapgraphicitem.cpp \
$$PWD/src/mapwidget/mapripform.cpp \
$$PWD/src/mapwidget/mapripper.cpp \
$$PWD/src/mapwidget/opmapwidget.cpp \
$$PWD/src/mapwidget/trailitem.cpp \
$$PWD/src/mapwidget/traillineitem.cpp \
$$PWD/src/mapwidget/uavitem.cpp \
$$PWD/src/mapwidget/waypointitem.cpp \
$$PWD/src/internals/projections/lks94projection.cpp \
$$PWD/src/internals/projections/mercatorprojection.cpp \
$$PWD/src/internals/projections/mercatorprojectionyandex.cpp \
$$PWD/src/internals/projections/platecarreeprojection.cpp \
$$PWD/src/internals/projections/platecarreeprojectionpergo.cpp \
$$PWD/src/mapwidget/waypointlineitem.cpp
RESOURCES += $$PWD/src/mapwidget/mapresources.qrc
DESTDIR = ../build
QT += network
QT += sql
CONFIG += staticlib
TEMPLATE = lib
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
INCLUDEPATH +=../../../../libs/
/**
******************************************************************************
*
* @file accessmode.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ACCESSMODE_H
#define ACCESSMODE_H
#include "debugheader.h"
#include <QObject>
#include <QMetaObject>
#include <QMetaEnum>
#include <QStringList>
namespace core {
class AccessMode:public QObject
{
Q_OBJECT
Q_ENUMS(Types)
public:
enum Types
{
/// <summary>
/// access only server
/// </summary>
ServerOnly,
/// <summary>
/// access first server and caches localy
/// </summary>
ServerAndCache,
/// <summary>
/// access only cache
/// </summary>
CacheOnly
};
static QString StrByType(Types const& value)
{
QMetaObject metaObject = AccessMode().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
QString s=metaEnum.valueToKey(value);
return s;
}
static Types TypeByStr(QString const& value)
{
QMetaObject metaObject = AccessMode().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
Types s=(Types)metaEnum.keyToValue(value.toLatin1());
return s;
}
static QStringList TypesList()
{
QStringList ret;
QMetaObject metaObject = AccessMode().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
for(int x=0;x<metaEnum.keyCount();++x)
{
ret.append(metaEnum.key(x));
}
return ret;
}
};
}
#endif // ACCESSMODE_H
/**
******************************************************************************
*
* @file alllayersoftype.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "alllayersoftype.h"
namespace core {
AllLayersOfType::AllLayersOfType()
{
}
QVector<MapType::Types> AllLayersOfType::GetAllLayersOfType(const MapType::Types &type)
{
QVector<MapType::Types> types;
{
switch(type)
{
case MapType::GoogleHybrid:
{
types.append(MapType::GoogleSatellite);
types.append(MapType::GoogleLabels);
}
break;
case MapType::GoogleHybridChina:
{
types.append(MapType::GoogleSatelliteChina);
types.append(MapType::GoogleLabelsChina);
}
break;
case MapType::GoogleHybridKorea:
{
types.append(MapType::GoogleSatelliteKorea);
types.append(MapType::GoogleLabelsKorea);
}
break;
case MapType::YahooHybrid:
{
types.append(MapType::YahooSatellite);
types.append(MapType::YahooLabels);
}
break;
case MapType::ArcGIS_MapsLT_Map_Hybrid:
{
types.append(MapType::ArcGIS_MapsLT_OrtoFoto);
types.append(MapType::ArcGIS_MapsLT_Map_Labels);
}
break;
default:
{
types.append(type);
}
break;
}
}
return types;
}
}
/**
******************************************************************************
*
* @file alllayersoftype.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ALLLAYERSOFTYPE_H
#define ALLLAYERSOFTYPE_H
#include "maptype.h"
#include <QList>
#include <QVector>
namespace core {
class AllLayersOfType
{
public:
AllLayersOfType();
QVector<MapType::Types> GetAllLayersOfType(const MapType::Types &type);
};
}
#endif // ALLLAYERSOFTYPE_H
/**
******************************************************************************
*
* @file cache.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "cache.h"
#include <QSettings>
namespace core {
Cache* Cache::m_pInstance=0;
Cache* Cache::Instance()
{
if(!m_pInstance)
m_pInstance=new Cache;
return m_pInstance;
}
void Cache::setCacheLocation(const QString& value)
{
cache=value;
routeCache = cache + "RouteCache/";
geoCache = cache + "GeocoderCache/";
placemarkCache = cache + "PlacemarkCache/";
ImageCache.setGtileCache(value);
}
QString Cache::CacheLocation()
{
return cache;
}
Cache::Cache()
{
if(cache.isNull()|cache.isEmpty())
{
cache = QDir::homePath() + "/mapscache/";
setCacheLocation(cache);
}
}
QString Cache::GetGeocoderFromCache(const QString &urlEnd)
{
#ifdef DEBUG_GetGeocoderFromCache
qDebug()<<"Entered GetGeocoderFromCache";
#endif
QString ret=QString::null;
QString filename=geoCache+QString(urlEnd)+".geo";
#ifdef DEBUG_GetGeocoderFromCache
qDebug()<<"GetGeocoderFromCache: Does file exist?:"<<filename;
#endif
QFileInfo File(filename);
if (File .exists())
{
#ifdef DEBUG_GetGeocoderFromCache
qDebug()<<"GetGeocoderFromCache:File exists!!";
#endif
QFile file(filename);
if (file.open(QIODevice::ReadOnly))
{
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream>>ret;
}
}
#ifdef DEBUG_GetGeocoderFromCache
qDebug()<<"GetGeocoderFromCache:Returning:"<<ret;
#endif
return ret;
}
void Cache::CacheGeocoder(const QString &urlEnd, const QString &content)
{
QString ret=QString::null;
QString filename=geoCache+QString(urlEnd)+".geo";
#ifdef DEBUG_CACHE
qDebug()<<"CacheGeocoder: Filename:"<<filename;
#endif //DEBUG_CACHE
QFileInfo File(filename);;
QDir dir=File.absoluteDir();
QString path=dir.absolutePath();
#ifdef DEBUG_CACHE
qDebug()<<"CacheGeocoder: Path:"<<path;
#endif //DEBUG_CACHE
if(!dir.exists())
{
#ifdef DEBUG_CACHE
qDebug()<<"CacheGeocoder: Cache path doesn't exist, try to create";
#endif //DEBUG_CACHE
if(!dir.mkpath(path))
{
#ifdef DEBUG_CACHE
qDebug()<<"GetGeocoderFromCache: Could not create path";
#endif //DEBUG_CACHE
}
}
#ifdef DEBUG_CACHE
qDebug()<<"CacheGeocoder: OpenFile:"<<filename;
#endif //DEBUG_CACHE
QFile file(filename);
if (file.open(QIODevice::WriteOnly))
{
#ifdef DEBUG_CACHE
qDebug()<<"CacheGeocoder: File Opened!!!:"<<filename;
#endif //DEBUG_CACHE
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream<<content;
}
}
QString Cache::GetPlacemarkFromCache(const QString &urlEnd)
{
#ifdef DEBUG_CACHE
qDebug()<<"Entered GetPlacemarkFromCache";
#endif //DEBUG_CACHE
QString ret=QString::null;
QString filename=placemarkCache+QString(urlEnd)+".plc";
#ifdef DEBUG_CACHE
qDebug()<<"GetPlacemarkFromCache: Does file exist?:"<<filename;
#endif //DEBUG_CACHE
QFileInfo File(filename);
if (File .exists())
{
#ifdef DEBUG_CACHE
qDebug()<<"GetPlacemarkFromCache:File exists!!";
#endif //DEBUG_CACHE
QFile file(filename);
if (file.open(QIODevice::ReadOnly))
{
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream>>ret;
}
}
#ifdef DEBUG_CACHE
qDebug()<<"GetPlacemarkFromCache:Returning:"<<ret;
#endif //DEBUG_CACHE
return ret;
}
void Cache::CachePlacemark(const QString &urlEnd, const QString &content)
{
QString ret=QString::null;
QString filename=placemarkCache+QString(urlEnd)+".plc";
#ifdef DEBUG_CACHE
qDebug()<<"CachePlacemark: Filename:"<<filename;
#endif //DEBUG_CACHE
QFileInfo File(filename);;
QDir dir=File.absoluteDir();
QString path=dir.absolutePath();
#ifdef DEBUG_CACHE
qDebug()<<"CachePlacemark: Path:"<<path;
#endif //DEBUG_CACHE
if(!dir.exists())
{
#ifdef DEBUG_CACHE
qDebug()<<"CachePlacemark: Cache path doesn't exist, try to create";
#endif //DEBUG_CACHE
if(!dir.mkpath(path))
{
#ifdef DEBUG_CACHE
qDebug()<<"CachePlacemark: Could not create path";
#endif //DEBUG_CACHE
}
}
#ifdef DEBUG_CACHE
qDebug()<<"CachePlacemark: OpenFile:"<<filename;
#endif //DEBUG_CACHE
QFile file(filename);
if (file.open(QIODevice::WriteOnly))
{
#ifdef DEBUG_CACHE
qDebug()<<"CachePlacemark: File Opened!!!:"<<filename;
#endif //DEBUG_CACHE
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream<<content;
}
}
}
/**
******************************************************************************
*
* @file cache.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CACHE_H
#define CACHE_H
#include "pureimagecache.h"
#include "debugheader.h"
namespace core {
class Cache
{
public:
static Cache* Instance();
PureImageCache ImageCache;
QString CacheLocation();
void setCacheLocation(const QString& value);
void CacheGeocoder(const QString &urlEnd,const QString &content);
QString GetGeocoderFromCache(const QString &urlEnd);
void CachePlacemark(const QString &urlEnd,const QString &content);
QString GetPlacemarkFromCache(const QString &urlEnd);
void CacheRoute(const QString &urlEnd,const QString &content);
QString GetRouteFromCache(const QString &urlEnd);
private:
Cache();
Cache(Cache const&){}
Cache& operator=(Cache const&){ return *this; }
static Cache* m_pInstance;
QString cache;
QString routeCache;
QString geoCache;
QString placemarkCache;
};
}
#endif // CACHE_H
/**
******************************************************************************
*
* @file cacheitemqueue.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "cacheitemqueue.h"
namespace core {
CacheItemQueue::CacheItemQueue(const MapType::Types &Type, const Point &Pos, const QByteArray &Img, const int &Zoom)
{
type=Type;
pos=Pos;
img=Img;
zoom=Zoom;
}
QByteArray CacheItemQueue::GetImg()
{
return img;
}
MapType::Types CacheItemQueue::GetMapType()
{
return type;
}
Point CacheItemQueue::GetPosition()
{
return pos;
}
void CacheItemQueue::SetImg(const QByteArray &value)
{
img=value;
}
void CacheItemQueue::SetMapType(const MapType::Types &value)
{
type=value;
}
void CacheItemQueue::SetPosition(const Point &value)
{
pos=value;
}
CacheItemQueue& CacheItemQueue::operator =(const CacheItemQueue &cSource)
{
img=cSource.img;
pos=cSource.pos;
type=cSource.type;
zoom=cSource.zoom;
return *this;
}
bool CacheItemQueue::operator ==(const CacheItemQueue &cSource)
{
bool b=(img==cSource.img)&& (pos==cSource.pos) && (type==cSource.type) && (zoom==cSource.zoom);
return b;
}
}
/**
******************************************************************************
*
* @file cacheitemqueue.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CACHEITEMQUEUE_H
#define CACHEITEMQUEUE_H
#include "maptype.h"
#include "point.h"
#include <QByteArray>
namespace core {
class CacheItemQueue
{
public:
CacheItemQueue(const MapType::Types &Type,const core::Point &Pos,const QByteArray &Img,const int &Zoom);
CacheItemQueue(){};
CacheItemQueue(const CacheItemQueue &cSource)
{
img=cSource.img;
pos=cSource.pos;
type=cSource.type;
zoom=cSource.zoom;
}
CacheItemQueue& operator= (const CacheItemQueue &cSource);
bool operator== (const CacheItemQueue &cSource);
void SetMapType(const MapType::Types &value);
void SetPosition(const core::Point &value);
void SetImg(const QByteArray &value);
MapType::Types GetMapType();
core::Point GetPosition();
QByteArray GetImg();
int GetZoom(){return zoom;};
void SetZoom(const int &value) {zoom=value;};
private:
MapType::Types type;
core::Point pos;
QByteArray img;
int zoom;
};
}
#endif // CACHEITEMQUEUE_H
include (../common.pri)
SOURCES += opmaps.cpp \
pureimagecache.cpp \
pureimage.cpp \
rawtile.cpp \
memorycache.cpp \
cache.cpp \
languagetype.cpp \
providerstrings.cpp \
cacheitemqueue.cpp \
tilecachequeue.cpp \
alllayersoftype.cpp \
urlfactory.cpp \
placemark.cpp \
point.cpp \
size.cpp \
kibertilecache.cpp \
diagnostics.cpp
HEADERS += opmaps.h \
size.h \
maptype.h \
pureimagecache.h \
pureimage.h \
rawtile.h \
memorycache.h \
cache.h \
accessmode.h \
languagetype.h \
providerstrings.h \
cacheitemqueue.h \
tilecachequeue.h \
alllayersoftype.h \
urlfactory.h \
geodecoderstatus.h \
placemark.h \
point.h \
kibertilecache.h \
debugheader.h \
diagnostics.h
#ifndef DEBUGHEADER_H
#define DEBUGHEADER_H
//#define DEBUG_MEMORY_CACHE
//#define DEBUG_CACHE
//#define DEBUG_GMAPS
//#define DEBUG_PUREIMAGECACHE
//#define DEBUG_TILECACHEQUEUE
//#define DEBUG_URLFACTORY
//#define DEBUG_MEMORY_CACHE
//#define DEBUG_GetGeocoderFromCache
#endif // DEBUGHEADER_H
/**
******************************************************************************
*
* @file diagnostics.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "diagnostics.h"
diagnostics::diagnostics():networkerrors(0),emptytiles(0),timeouts(0),runningThreads(0),tilesFromMem(0),tilesFromNet(0),tilesFromDB(0)
{
}
/**
******************************************************************************
*
* @file diagnostics.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DIAGNOSTICS_H
#define DIAGNOSTICS_H
#include <QString>
struct diagnostics
{
diagnostics();
int networkerrors;
int emptytiles;
int timeouts;
int runningThreads;
int tilesFromMem;
int tilesFromNet;
int tilesFromDB;
QString toString()
{
return QString("Network errors:%1\nEmpty Tiles:%2\nTimeOuts:%3\nRunningThreads:%4\nTilesFromMem:%5\nTilesFromNet:%6\nTilesFromDB:%7").arg(networkerrors).arg(emptytiles).arg(timeouts).arg(runningThreads).arg(tilesFromMem).arg(tilesFromNet).arg(tilesFromDB);
;
}
};
#endif // DIAGNOSTICS_H
/**
******************************************************************************
*
* @file geodecoderstatus.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef GEODECODERSTATUS_H
#define GEODECODERSTATUS_H
#include <QObject>
#include <QMetaObject>
#include <QMetaEnum>
#include <QStringList>
namespace core {
class GeoCoderStatusCode:public QObject
{
Q_OBJECT
Q_ENUMS(Types)
public:
enum Types
{
/// <summary>
/// unknow response
/// </summary>
Unknow = -1,
/// <summary>
/// No errors occurred; the address was successfully parsed and its geocode has been returned.
/// </summary>
G_GEO_SUCCESS=200,
/// <summary>
/// A directions request could not be successfully parsed.
/// For example, the request may have been rejected if it contained more than the maximum number of waypoints allowed.
/// </summary>
G_GEO_BAD_REQUEST=400,
/// <summary>
/// A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.
/// </summary>
G_GEO_SERVER_ERROR=500,
/// <summary>
/// The HTTP q parameter was either missing or had no value.
/// For geocoding requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.
/// </summary>
G_GEO_MISSING_QUERY=601,
/// <summary>
/// Synonym for G_GEO_MISSING_QUERY.
/// </summary>
G_GEO_MISSING_ADDRESS=601,
/// <summary>
/// No corresponding geographic location could be found for the specified address.
/// This may be due to the fact that the address is relatively new, or it may be incorrect.
/// </summary>
G_GEO_UNKNOWN_ADDRESS=602,
/// <summary>
/// The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.
/// </summary>
G_GEO_UNAVAILABLE_ADDRESS=603,
/// <summary>
/// The GDirections object could not compute directions between the points mentioned in the query.
/// This is usually because there is no route available between the two points, or because we do not have data for routing in that region.
/// </summary>
G_GEO_UNKNOWN_DIRECTIONS=604,
/// <summary>
/// The given key is either invalid or does not match the domain for which it was given.
/// </summary>
G_GEO_BAD_KEY=610,
/// <summary>
/// The given key has gone over the requests limit in the 24 hour period or has submitted too many requests in too short a period of time.
/// If you're sending multiple requests in parallel or in a tight loop, use a timer or pause in your code to make sure you don't send the requests too quickly.
/// </summary>
G_GEO_TOO_MANY_QUERIES=620
};
static QString StrByType(Types const& value)
{
QMetaObject metaObject = GeoCoderStatusCode().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
QString s=metaEnum.valueToKey(value);
return s;
}
static Types TypeByStr(QString const& value)
{
QMetaObject metaObject = GeoCoderStatusCode().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
Types s=(Types)metaEnum.keyToValue(value.toLatin1());
return s;
}
static QStringList TypesList()
{
QStringList ret;
QMetaObject metaObject = GeoCoderStatusCode().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
for(int x=0;x<metaEnum.keyCount();++x)
{
ret.append(metaEnum.key(x));
}
return ret;
}
};
}
#endif // GEODECODERSTATUS_H
/**
******************************************************************************
*
* @file kibertilecache.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "kibertilecache.h"
//TODO add readwrite lock
namespace core {
KiberTileCache::KiberTileCache()
{
memoryCacheSize = 0;
_MemoryCacheCapacity = 22;
}
void KiberTileCache::setMemoryCacheCapacity(const int &value)
{
kiberCacheLock.lockForWrite();
_MemoryCacheCapacity=value;
kiberCacheLock.unlock();
}
int KiberTileCache::MemoryCacheCapacity()
{
kiberCacheLock.lockForRead();
return _MemoryCacheCapacity;
kiberCacheLock.unlock();
}
void KiberTileCache::RemoveMemoryOverload()
{
while(MemoryCacheSize()>MemoryCacheCapacity())
{
if(cachequeue.count()>0 && list.count()>0)
{
#ifdef DEBUG_MEMORY_CACHE
qDebug()<<"Cleaning Memory cache="<<" started with "<<cachequeue.count()<<" tile "<<"ocupying "<<memoryCacheSize<<" bytes";
#endif
RawTile first=list.dequeue();
memoryCacheSize-=cachequeue.value(first).size();
cachequeue.remove(first);
}
}
#ifdef DEBUG_MEMORY_CACHE
qDebug()<<"Cleaning Memory cache="<<" ended with "<<cachequeue.count()<<" tile "<<"ocupying "<<memoryCacheSize<<" bytes";
#endif
}
}
/**
******************************************************************************
*
* @file kibertilecache.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef KIBERTILECACHE_H
#define KIBERTILECACHE_H
#include "rawtile.h"
#include <QMutex>
#include <QReadWriteLock>
#include <QQueue>
#include <QDebug>
#include "debugheader.h"
namespace core {
class KiberTileCache
{
public:
KiberTileCache();
void setMemoryCacheCapacity(const int &value);
int MemoryCacheCapacity();
double MemoryCacheSize(){return memoryCacheSize/1048576.0;}
void RemoveMemoryOverload();
QReadWriteLock kiberCacheLock;
QHash <RawTile,QByteArray> cachequeue;
QQueue <RawTile> list;
long memoryCacheSize;
private:
int _MemoryCacheCapacity;
};
}
#endif // KIBERTILECACHE_H
/**
******************************************************************************
*
* @file languagetype.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "languagetype.h"
namespace core {
LanguageType::LanguageType()
{
list
<<"ar"
<<"bg"
<<"bn"
<<"ca"
<<"cs"
<<"da"
<<"de"
<<"el"
<<"en"
<<"en-AU"
<<"en-GB"
<<"es"
<<"eu"
<<"fi"
<<"fil"
<<"fr"
<<"gl"
<<"gu"
<<"hi"
<<"hr"
<<"hu"
<<"id"
<<"it"
<<"iw"
<<"ja"
<<"kn"
<<"ko"
<<"lt"
<<"lv"
<<"ml"
<<"mr"
<<"nl"
<<"nn"
<<"no"
<<"or"
<<"pl"
<<"pt"
<<"pt-BR"
<<"pt-PT"
<<"rm"
<<"ro"
<<"ru"
<<"sk"
<<"sl"
<<"sr"
<<"sv"
<<"ta"
<<"te"
<<"th"
<<"tr"
<<"uk"
<<"vi"
<<"zh-CN"
<<"zh-TW";
}
QString LanguageType::toShortString(Types type)
{
return list[type];
}
LanguageType::~LanguageType()
{
list.clear();
}
}
/**
******************************************************************************
*
* @file languagetype.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LANGUAGETYPE_H
#define LANGUAGETYPE_H
#include <QString>
#include <QMetaObject>
#include <QMetaEnum>
#include <QStringList>
namespace core {
class LanguageType:public QObject
{
Q_OBJECT
Q_ENUMS(Types)
public:
enum Types
{
Arabic,
Bulgarian,
Bengali,
Catalan,
Czech,
Danish,
German,
Greek,
English,
EnglishAustralian,
EnglishGreatBritain,
Spanish,
Basque,
Finnish,
Filipino,
French,
Galician,
Gujarati,
Hindi,
Croatian,
Hungarian,
Indonesian,
Italian,
Hebrew,
Japanese,
Kannada,
Korean,
Lithuanian,
Latvian,
Malayalam,
Marathi,
Dutch,
NorwegianNynorsk,
Norwegian,
Oriya,
Polish,
Portuguese,
PortugueseBrazil,
PortuguesePortugal,
Romansch,
Romanian,
Russian,
Slovak,
Slovenian,
Serbian,
Swedish,
Tamil,
Telugu,
Thai,
Turkish,
Ukrainian,
Vietnamese,
ChineseSimplified,
ChineseTraditional
};
static QString StrByType(Types const& value)
{
QMetaObject metaObject = LanguageType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
QString s=metaEnum.valueToKey(value);
return s;
}
static Types TypeByStr(QString const& value)
{
QMetaObject metaObject = LanguageType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
Types s=(Types)metaEnum.keyToValue(value.toLatin1());
return s;
}
static QStringList TypesList()
{
QStringList ret;
QMetaObject metaObject = LanguageType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
for(int x=0;x<metaEnum.keyCount();++x)
{
ret.append(metaEnum.key(x));
}
return ret;
}
QString toShortString(Types type);
LanguageType();
~LanguageType();
private:
QStringList list;
};
}
#endif // LANGUAGETYPE_H
/**
******************************************************************************
*
* @file maptype.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MAPTYPE_H
#define MAPTYPE_H
#include <QMetaObject>
#include <QMetaEnum>
#include <QStringList>
namespace core {
class MapType:public QObject
{
Q_OBJECT
Q_ENUMS(Types)
public:
enum Types
{
GoogleMap=1,
GoogleSatellite=4,
GoogleLabels=8,
GoogleTerrain=16,
GoogleHybrid=20,
GoogleMapChina=22,
GoogleSatelliteChina=24,
GoogleLabelsChina=26,
GoogleTerrainChina=28,
GoogleHybridChina=29,
OpenStreetMap=32,
OpenStreetOsm=33,
OpenStreetMapSurfer=34,
OpenStreetMapSurferTerrain=35,
YahooMap=64,
YahooSatellite=128,
YahooLabels=256,
YahooHybrid=333,
BingMap=444,
BingSatellite=555,
BingHybrid=666,
ArcGIS_Map=777,
ArcGIS_Satellite=788,
ArcGIS_ShadedRelief=799,
ArcGIS_Terrain=811,
// use these numbers to clean up old stuff
//ArcGIS_MapsLT_Map_Old= 877,
//ArcGIS_MapsLT_OrtoFoto_Old = 888,
//ArcGIS_MapsLT_Map_Labels_Old = 890,
//ArcGIS_MapsLT_Map_Hybrid_Old = 899,
//ArcGIS_MapsLT_Map=977,
//ArcGIS_MapsLT_OrtoFoto=988,
//ArcGIS_MapsLT_Map_Labels=990,
//ArcGIS_MapsLT_Map_Hybrid=999,
//ArcGIS_MapsLT_Map=978,
//ArcGIS_MapsLT_OrtoFoto=989,
//ArcGIS_MapsLT_Map_Labels=991,
//ArcGIS_MapsLT_Map_Hybrid=998,
ArcGIS_MapsLT_Map=1000,
ArcGIS_MapsLT_OrtoFoto=1001,
ArcGIS_MapsLT_Map_Labels=1002,
ArcGIS_MapsLT_Map_Hybrid=1003,
PergoTurkeyMap = 2001,
SigPacSpainMap = 3001,
GoogleMapKorea=4001,
GoogleSatelliteKorea=4002,
GoogleLabelsKorea=4003,
GoogleHybridKorea=4005,
YandexMapRu = 5000
};
static QString StrByType(Types const& value)
{
QMetaObject metaObject = MapType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
QString s=metaEnum.valueToKey(value);
return s;
}
static Types TypeByStr(QString const& value)
{
QMetaObject metaObject = MapType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
Types s=(Types)metaEnum.keyToValue(value.toLatin1());
return s;
}
static QStringList TypesList()
{
QStringList ret;
QMetaObject metaObject = MapType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
for(int x=0;x<metaEnum.keyCount();++x)
{
ret.append(metaEnum.key(x));
}
return ret;
}
};
}
#endif // MAPTYPE_H
/**
******************************************************************************
*
* @file memorycache.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "memorycache.h"
//TODO add readwrite lock
namespace core {
MemoryCache::MemoryCache()
{
}
QByteArray MemoryCache::GetTileFromMemoryCache(const RawTile &tile)
{
kiberCacheLock.lockForRead();
QByteArray pic;
pic=TilesInMemory.cachequeue.value(tile);
// TilesInMemory.find(key,&pic);
kiberCacheLock.unlock();
return pic;
}
void MemoryCache::AddTileToMemoryCache(const RawTile &tile, const QByteArray &pic)
{
kiberCacheLock.lockForWrite();
// QPixmapCache::Key key=TilesInMemory.insert(pic);
TilesInMemory.memoryCacheSize +=pic.size();
#ifdef DEBUG_MEMORY_CACHE
qDebug()<<"Current memory="<<TilesInMemory.memoryCacheSize<<" in "<<TilesInMemory.cachequeue.count()<<" tiles";
#endif
TilesInMemory.cachequeue.insert(tile,pic);
TilesInMemory.list.enqueue(tile);
kiberCacheLock.unlock();
}
}
/**
******************************************************************************
*
* @file memorycache.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MEMORYCACHE_H
#define MEMORYCACHE_H
#include "rawtile.h"
#include <QMutex>
#include <QReadWriteLock>
#include <QQueue>
#include "kibertilecache.h"
#include <QDebug>
#include "debugheader.h"
namespace core {
class MemoryCache
{
public:
MemoryCache();
KiberTileCache TilesInMemory;
QByteArray GetTileFromMemoryCache(const RawTile &tile);
void AddTileToMemoryCache(const RawTile &tile, const QByteArray &pic);
QReadWriteLock kiberCacheLock;
};
}
#endif // MEMORYCACHE_H
/**
******************************************************************************
*
* @file OPMaps.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "opmaps.h"
namespace core {
OPMaps* OPMaps::m_pInstance=0;
OPMaps* OPMaps::Instance()
{
if(!m_pInstance)
m_pInstance=new OPMaps;
return m_pInstance;
}
OPMaps::OPMaps():RetryLoadTile(2),useMemoryCache(true)
{
accessmode=AccessMode::ServerAndCache;
Language=LanguageType::PortuguesePortugal;
LanguageStr=LanguageType().toShortString(Language);
Cache::Instance();
}
OPMaps::~OPMaps()
{
TileDBcacheQueue.wait();
}
QByteArray OPMaps::GetImageFrom(const MapType::Types &type,const Point &pos,const int &zoom)
{
#ifdef DEBUG_TIMINGS
QTime time;
time.restart();
#endif
#ifdef DEBUG_GMAPS
qDebug()<<"Entered GetImageFrom";
#endif //DEBUG_GMAPS
QByteArray ret;
if(useMemoryCache)
{
#ifdef DEBUG_GMAPS
qDebug()<<"Try Tile from memory:Size="<<TilesInMemory.MemoryCacheSize();
#endif //DEBUG_GMAPS
ret=GetTileFromMemoryCache(RawTile(type,pos,zoom));
if(!ret.isEmpty())
{
errorvars.lock();
++diag.tilesFromMem;
errorvars.unlock();
}
}
if(ret.isEmpty())
{
#ifdef DEBUG_GMAPS
qDebug()<<"Tile not in memory";
#endif //DEBUG_GMAPS
if(accessmode != (AccessMode::ServerOnly))
{
#ifdef DEBUG_GMAPS
qDebug()<<"Try tile from DataBase";
#endif //DEBUG_GMAPS
ret=Cache::Instance()->ImageCache.GetImageFromCache(type,pos,zoom);
if(!ret.isEmpty())
{
errorvars.lock();
++diag.tilesFromDB;
errorvars.unlock();
#ifdef DEBUG_GMAPS
qDebug()<<"Tile found in Database";
#endif //DEBUG_GMAPS
if(useMemoryCache)
{
#ifdef DEBUG_GMAPS
qDebug()<<"Add Tile to memory";
#endif //DEBUG_GMAPS
AddTileToMemoryCache(RawTile(type,pos,zoom),ret);
}
return ret;
}
}
if(accessmode!=AccessMode::CacheOnly)
{
QEventLoop q;
QNetworkReply *reply;
QNetworkRequest qheader;
QNetworkAccessManager network;
QTimer tT;
tT.setSingleShot(true);
connect(&network, SIGNAL(finished(QNetworkReply*)),
&q, SLOT(quit()));
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
network.setProxy(Proxy);
#ifdef DEBUG_GMAPS
qDebug()<<"Try Tile from the Internet";
#endif //DEBUG_GMAPS
#ifdef DEBUG_TIMINGS
qDebug()<<"opmaps before make image url"<<time.elapsed();
#endif
QString url=MakeImageUrl(type,pos,zoom,LanguageStr);
#ifdef DEBUG_TIMINGS
qDebug()<<"opmaps after make image url"<<time.elapsed();
#endif //url "http://vec02.maps.yandex.ru/tiles?l=map&v=2.10.2&x=7&y=5&z=3" string
//"http://map3.pergo.com.tr/tile/02/000/000/007/000/000/002.png"
qheader.setUrl(QUrl(url));
qheader.setRawHeader("User-Agent",UserAgent);
qheader.setRawHeader("Accept","*/*");
switch(type)
{
case MapType::GoogleMap:
case MapType::GoogleSatellite:
case MapType::GoogleLabels:
case MapType::GoogleTerrain:
case MapType::GoogleHybrid:
{
qheader.setRawHeader("Referrer", "http://maps.google.com/");
}
break;
case MapType::GoogleMapChina:
case MapType::GoogleSatelliteChina:
case MapType::GoogleLabelsChina:
case MapType::GoogleTerrainChina:
case MapType::GoogleHybridChina:
{
qheader.setRawHeader("Referrer", "http://ditu.google.cn/");
}
break;
case MapType::BingHybrid:
case MapType::BingMap:
case MapType::BingSatellite:
{
qheader.setRawHeader("Referrer", "http://www.bing.com/maps/");
}
break;
case MapType::YahooHybrid:
case MapType::YahooLabels:
case MapType::YahooMap:
case MapType::YahooSatellite:
{
qheader.setRawHeader("Referrer", "http://maps.yahoo.com/");
}
break;
case MapType::ArcGIS_MapsLT_Map_Labels:
case MapType::ArcGIS_MapsLT_Map:
case MapType::ArcGIS_MapsLT_OrtoFoto:
case MapType::ArcGIS_MapsLT_Map_Hybrid:
{
qheader.setRawHeader("Referrer", "http://www.maps.lt/map_beta/");
}
break;
case MapType::OpenStreetMapSurfer:
case MapType::OpenStreetMapSurferTerrain:
{
qheader.setRawHeader("Referrer", "http://www.mapsurfer.net/");
}
break;
case MapType::OpenStreetMap:
case MapType::OpenStreetOsm:
{
qheader.setRawHeader("Referrer", "http://www.openstreetmap.org/");
}
break;
case MapType::YandexMapRu:
{
qheader.setRawHeader("Referrer", "http://maps.yandex.ru/");
}
break;
default:
break;
}
reply=network.get(qheader);
tT.start(Timeout);
q.exec();
if(!tT.isActive()){
errorvars.lock();
++diag.timeouts;
errorvars.unlock();
return ret;
}
tT.stop();
if( (reply->error()!=QNetworkReply::NoError))
{
errorvars.lock();
++diag.networkerrors;
errorvars.unlock();
reply->deleteLater();
return ret;
}
ret=reply->readAll();
reply->deleteLater();//TODO can't this be global??
if(ret.isEmpty())
{
#ifdef DEBUG_GMAPS
qDebug()<<"Invalid Tile";
#endif //DEBUG_GMAPS
errorvars.lock();
++diag.emptytiles;
errorvars.unlock();
return ret;
}
#ifdef DEBUG_GMAPS
qDebug()<<"Received Tile from the Internet";
#endif //DEBUG_GMAPS
errorvars.lock();
++diag.tilesFromNet;
errorvars.unlock();
if (useMemoryCache)
{
#ifdef DEBUG_GMAPS
qDebug()<<"Add Tile to memory cache";
#endif //DEBUG_GMAPS
AddTileToMemoryCache(RawTile(type,pos,zoom),ret);
}
if(accessmode!=AccessMode::ServerOnly)
{
#ifdef DEBUG_GMAPS
qDebug()<<"Add tile to DataBase";
#endif //DEBUG_GMAPS
CacheItemQueue * item=new CacheItemQueue(type,pos,ret,zoom);
TileDBcacheQueue.EnqueueCacheTask(item);
}
}
}
#ifdef DEBUG_GMAPS
qDebug()<<"Entered GetImageFrom";
#endif //DEBUG_GMAPS
return ret;
}
bool OPMaps::ExportToGMDB(const QString &file)
{
return Cache::Instance()->ImageCache.ExportMapDataToDB(Cache::Instance()->ImageCache.GtileCache()+QDir::separator()+"Data.qmdb",file);
}
bool OPMaps::ImportFromGMDB(const QString &file)
{
return Cache::Instance()->ImageCache.ExportMapDataToDB(file,Cache::Instance()->ImageCache.GtileCache()+QDir::separator()+"Data.qmdb");
}
diagnostics OPMaps::GetDiagnostics()
{
diagnostics i;
errorvars.lock();
i=diag;
errorvars.unlock();
return i;
}
}
/**
******************************************************************************
*
* @file OPMaps.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OPMaps_H
#define OPMaps_H
#include "debugheader.h"
#include "memorycache.h"
#include "rawtile.h"
#include "cache.h"
#include "accessmode.h"
#include "languagetype.h"
#include "cacheitemqueue.h"
#include "tilecachequeue.h"
#include "pureimagecache.h"
#include "alllayersoftype.h"
#include "urlfactory.h"
#include "diagnostics.h"
//#include "point.h"
namespace core {
class OPMaps: public MemoryCache,public AllLayersOfType,public UrlFactory
{
public:
~OPMaps();
static OPMaps* Instance();
bool ImportFromGMDB(const QString &file);
bool ExportToGMDB(const QString &file);
/// <summary>
/// timeout for map connections
/// </summary>
QByteArray GetImageFrom(const MapType::Types &type,const core::Point &pos,const int &zoom);
bool UseMemoryCache(){return useMemoryCache;}//TODO
void setUseMemoryCache(const bool& value){useMemoryCache=value;}
void setLanguage(const LanguageType::Types& language){Language=language;}//TODO
LanguageType::Types GetLanguage(){return Language;}//TODO
AccessMode::Types GetAccessMode()const{return accessmode;}
void setAccessMode(const AccessMode::Types& mode){accessmode=mode;}
int RetryLoadTile;
diagnostics GetDiagnostics();
private:
bool useMemoryCache;
LanguageType::Types Language;
AccessMode::Types accessmode;
// PureImageCache ImageCacheLocal;//TODO Criar acesso Get Set
TileCacheQueue TileDBcacheQueue;
OPMaps();
//OPMaps(OPMaps const&){}
OPMaps& operator=(OPMaps const&){ return *this; }
static OPMaps* m_pInstance;
diagnostics diag;
QMutex errorvars;
protected:
// MemoryCache TilesInMemory;
};
}
#endif // OPMaps_H
/**
******************************************************************************
*
* @file placemark.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "placemark.h"
/**
******************************************************************************
*
* @file placemark.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PLACEMARK_H
#define PLACEMARK_H
#include <QString>
namespace core {
class Placemark
{
public:
Placemark(const QString &address)
{
this->address = address;
}
QString Address(){return address;}
int Accuracy(){return accuracy;}
void SetAddress(const QString &adr){address=adr;}
void SetAccuracy(const int &value){accuracy=value;}
private:
QString address;
int accuracy;
protected:
};
}
#endif // PLACEMARK_H
/**
******************************************************************************
*
* @file point.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "point.h"
#include "size.h"
namespace core {
Point::Point(int dw)
{
this->x=(short)Point::loWord(dw);
this->y=(short)Point::hiWord(dw);
empty=false;
}
Point::Point(Size sz)
{
this->x=sz.Width();
this->y=sz.Height();
empty=false;
}
Point::Point(int x, int y)
{
this->x=x;
this->y=y;
empty=false;
}
Point::Point():x(0),y(0),empty(true)
{}
uint qHash(Point const& point)
{
return point.x^point.y;
}
bool operator==(Point const &lhs,Point const &rhs)
{
return (lhs.x==rhs.x && lhs.y==rhs.y);
}
bool operator!=(Point const &lhs,Point const &rhs)
{
return !(lhs==rhs);
}
Point Point::Empty=Point();
}
/**
******************************************************************************
*
* @file point.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OPOINT_H
#define OPOINT_H
#include <QString>
namespace core {
struct Size;
struct Point
{
friend uint qHash(Point const& point);
friend bool operator==(Point const& lhs,Point const& rhs);
friend bool operator!=(Point const& lhs,Point const& rhs);
public:
Point();
Point(int x,int y);
Point(Size sz);
Point(int dw);
bool IsEmpty(){return empty;}
int X()const{return this->x;}
int Y()const{return this->y;}
void SetX(const int &value){x=value;empty=false;}
void SetY(const int &value){y=value;empty=false;}
QString ToString()const{return "{"+QString::number(x)+","+QString::number(y)+"}";}
static Point Empty;
void Offset(const int &dx,const int &dy)
{
x += dx;
y += dy;
}
void Offset(Point p)
{
Offset(p.x, p.y);
}
static int hiWord(int n)
{
return (n >> 16) & 0xffff;
}
static int loWord(int n)
{
return n & 0xffff;
}
private:
int x;
int y;
bool empty;
};
}
#endif // POINT_H
/**
******************************************************************************
*
* @file providerstrings.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "providerstrings.h"
namespace core {
const QString ProviderStrings::levelsForSigPacSpainMap[] = {"0", "1", "2", "3", "4",
"MTNSIGPAC",
"MTN2000", "MTN2000", "MTN2000", "MTN2000", "MTN2000",
"MTN200", "MTN200", "MTN200",
"MTN25", "MTN25",
"ORTOFOTOS","ORTOFOTOS","ORTOFOTOS","ORTOFOTOS"};
ProviderStrings::ProviderStrings()
{
// VersionGoogleMap = "m@132";
// VersionGoogleSatellite = "71";
// VersionGoogleLabels = "h@132";
// VersionGoogleTerrain = "t@125,r@132";
// Google version strings
VersionGoogleMap = "m@132";
VersionGoogleSatellite = "71";
VersionGoogleLabels = "h@132";
VersionGoogleTerrain = "t@125,r@132";
SecGoogleWord = "Galileo";
// Google (China) version strings
VersionGoogleMapChina = "m@132";
VersionGoogleSatelliteChina = "s@71";
VersionGoogleLabelsChina = "h@132";
VersionGoogleTerrainChina = "t@125,r@132";
// Google (Korea) version strings
VersionGoogleMapKorea = "kr1.12";
VersionGoogleSatelliteKorea = "66";
VersionGoogleLabelsKorea = "kr1t.12";
/// <summary>
/// Google Maps API generated using http://greatmaps.codeplex.com/
/// from http://code.google.com/intl/en-us/apis/maps/signup.html
/// </summary>
GoogleMapsAPIKey = "ABQIAAAA5Q6wxQ6lxKS8haLVdUJaqhSjosg_0jiTTs2iXtkDVG0n0If1mBRHzhWw5VqBZX-j4NuzoVpU-UaHVg";
// Yahoo version strings
VersionYahooMap = "4.3";
VersionYahooSatellite = "1.9";
VersionYahooLabels = "4.3";
// BingMaps
VersionBingMaps = "563";
// YandexMap
VersionYandexMap = "2.16.0";
//VersionYandexSatellite = "1.19.0";
////////////////////
/// <summary>
/// Bing Maps Customer Identification, more info here
/// http://msdn.microsoft.com/en-us/library/bb924353.aspx
/// </summary>
BingMapsClientToken = "";
}
}
/**
******************************************************************************
*
* @file providerstrings.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PROVIDERSTRINGS_H
#define PROVIDERSTRINGS_H
#include <QString>
namespace core {
class ProviderStrings
{
public:
ProviderStrings();
static const QString levelsForSigPacSpainMap[];
QString GoogleMapsAPIKey;
// Google version strings
QString VersionGoogleMap;
QString VersionGoogleSatellite;
QString VersionGoogleLabels;
QString VersionGoogleTerrain;
QString SecGoogleWord;
// Google (China) version strings
QString VersionGoogleMapChina;
QString VersionGoogleSatelliteChina;
QString VersionGoogleLabelsChina;
QString VersionGoogleTerrainChina;
// Google (Korea) version strings
QString VersionGoogleMapKorea;
QString VersionGoogleSatelliteKorea;
QString VersionGoogleLabelsKorea;
/// <summary>
/// Google Maps API generated using http://greatmaps.codeplex.com/
/// from http://code.google.com/intl/en-us/apis/maps/signup.html
/// </summary>
// Yahoo version strings
QString VersionYahooMap;
QString VersionYahooSatellite;
QString VersionYahooLabels;
// BingMaps
QString VersionBingMaps;
// YandexMap
QString VersionYandexMap;
/// <summary>
/// Bing Maps Customer Identification, more info here
/// http://msdn.microsoft.com/en-us/library/bb924353.aspx
/// </summary>
QString BingMapsClientToken;
};
}
#endif // PROVIDERSTRINGS_H
/**
******************************************************************************
*
* @file pureimage.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pureimage.h"
namespace core {
PureImageProxy::PureImageProxy()
{
}
QPixmap PureImageProxy::FromStream(const QByteArray &array)
{
return QPixmap::fromImage(QImage::fromData(array));
}
bool PureImageProxy::Save(const QByteArray &array, QPixmap &pic)
{
pic=QPixmap::fromImage(QImage::fromData(array));
return true;
}
}
/**
******************************************************************************
*
* @file pureimage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PUREIMAGE_H
#define PUREIMAGE_H
#include <QPixmap>
#include <QByteArray>
namespace core {
class PureImageProxy
{
public:
PureImageProxy();
static QPixmap FromStream(const QByteArray &array);
static bool Save(const QByteArray &array,QPixmap &pic);
};
}
#endif // PUREIMAGE_H
This diff is collapsed.
/**
******************************************************************************
*
* @file pureimagecache.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PUREIMAGECACHE_H
#define PUREIMAGECACHE_H
#include <QtSql/QSqlDatabase>
#include <QString>
#include <QDir>
#include <QDebug>
#include <QFileInfo>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QBuffer>
#include "maptype.h"
#include "point.h"
#include <QVariant>
#include "pureimage.h"
#include <QList>
#include <QMutex>
#include <QReadWriteLock>
namespace core {
class PureImageCache
{
public:
PureImageCache();
static bool CreateEmptyDB(const QString &file);
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);
void deleteOlderTiles(int const& days);
private:
QString gtilecache;
QMutex Mcounter;
QReadWriteLock lock;
static qlonglong ConnCounter;
};
}
#endif // PUREIMAGECACHE_H
/**
******************************************************************************
*
* @file rawtile.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "rawtile.h"
namespace core {
RawTile::RawTile(const MapType::Types &Type, const Point &Pos, const int &Zoom)
{
zoom=Zoom;
type=Type;
pos=Pos;
}
QString RawTile::ToString()
{
return QString("%1 at zoom %2, pos:%3,%4").arg(type).arg(zoom).arg(pos.X()).arg(pos.Y());
}
Point RawTile::Pos()
{
return pos;
}
MapType::Types RawTile::Type()
{
return type;
}
int RawTile::Zoom()
{
return zoom;
}
void RawTile::setType(const MapType::Types &value)
{
type=value;
}
void RawTile::setPos(const Point &value)
{
pos=value;
}
void RawTile::setZoom(const int &value)
{
zoom=value;
}
uint qHash(RawTile const& tile)
{
// RawTile tile=tilee;
quint64 tmp=(((quint64)(tile.zoom))<<54)+(((quint64)(tile.type))<<36)+(((quint64)(tile.pos.X()))<<18)+(((quint64)(tile.pos.Y())));
// quint64 tmp5=tmp+tmp2+tmp3+tmp4;
return ::qHash(tmp);
}
bool operator==(RawTile const &lhs,RawTile const &rhs)
{
return (lhs.pos==rhs.pos && lhs.zoom==rhs.zoom && lhs.type==rhs.type);
}
}
/**
******************************************************************************
*
* @file rawtile.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef RAWTILE_H
#define RAWTILE_H
#include "maptype.h"
#include "point.h"
#include <QString>
#include <QHash>
namespace core {
class RawTile
{
friend uint qHash(RawTile const& tile);
friend bool operator==(RawTile const& lhs,RawTile const& rhs);
public:
RawTile(const MapType::Types &Type,const core::Point &Pos,const int &Zoom);
QString ToString(void);
MapType::Types Type();
core::Point Pos();
int Zoom();
void setType(const MapType::Types &value);
void setPos(const core::Point &value);
void setZoom(const int &value);
private:
MapType::Types type;
core::Point pos;
int zoom;
};
}
#endif // RAWTILE_H
/**
******************************************************************************
*
* @file size.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "size.h"
namespace core {
Size::Size():width(0),height(0)
{}
}
/**
******************************************************************************
*
* @file size.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SIZE_H
#define SIZE_H
#include "point.h"
#include <QString>
#include <QHash>
namespace core {
struct Size
{
Size();
Size(Point pt){width=pt.X(); height=pt.Y();};
Size(int Width,int Height){width=Width; height=Height;};
friend uint qHash(Size const& size);
// friend bool operator==(Size const& lhs,Size const& rhs);
Size operator-(const Size &sz1){return Size(width-sz1.width,height-sz1.height);}
Size operator+(const Size &sz1){return Size(sz1.width+width,sz1.height+height);}
int GetHashCode(){return width^height;}
uint qHash(Size const& /*rect*/){return width^height;}
QString ToString(){return "With="+QString::number(width)+" ,Height="+QString::number(height);}
int Width()const {return width;}
int Height()const {return height;}
void SetWidth(int const& value){width=value;}
void SetHeight(int const& value){height=value;}
private:
int width;
int height;
};
}
#endif // SIZE_H
/**
******************************************************************************
*
* @file tilecachequeue.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "tilecachequeue.h"
//#define DEBUG_TILECACHEQUEUE
#ifndef DEBUG_TILECACHEQUEUE
#undef qDebug
#define qDebug QT_NO_QDEBUG_MACRO
#endif
namespace core {
TileCacheQueue::TileCacheQueue()
{
}
TileCacheQueue::~TileCacheQueue()
{
quit();
_waitc.wakeAll();
wait();
this->deleteLater();
}
void TileCacheQueue::EnqueueCacheTask(CacheItemQueue *task)
{
qDebug()<<"DB Do I EnqueueCacheTask"<<task->GetPosition().X()<<","<<task->GetPosition().Y();
if(!_tileCacheQueue.contains(task)) {
qDebug()<<"EnqueueCacheTask"<<task->GetPosition().X()<<","<<task->GetPosition().Y();
_mutex.lock();
_tileCacheQueue.enqueue(task);
_mutex.unlock();
if(this->isRunning()) {
qDebug()<<"Wake Thread";
_waitc.wakeAll();
} else {
qDebug()<<"Start Thread";
this->start(QThread::NormalPriority);
}
}
}
void TileCacheQueue::run()
{
qDebug()<<"Cache Engine Start";
while(true) {
CacheItemQueue *task = NULL;
qDebug() << "Cache";
if(_tileCacheQueue.count() > 0) {
_mutex.lock();
task = _tileCacheQueue.dequeue();
_mutex.unlock();
Q_ASSERT(task);
qDebug() << "Cache engine Put:" << task->GetPosition().X() << "," << task->GetPosition().Y();
Cache* cache = Cache::Instance();
if(cache) {
cache->ImageCache.PutImageToCache(task->GetImg(), task->GetMapType(), task->GetPosition(), task->GetZoom());
}
usleep(44);
delete task;
} else {
qDebug() << "Cache engine BEGIN WAIT";
_waitmutex.lock();
_waitc.wait(&_waitmutex);
qDebug() << "Cache engine WOKE UP";
if(!this->isRunning()) {
_waitmutex.unlock();
break;
}
_waitmutex.unlock();
}
}
qDebug() << "Cache Engine Stopped";
}
}
/**
******************************************************************************
*
* @file tilecachequeue.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TILECACHEQUEUE_H
#define TILECACHEQUEUE_H
#include <QQueue>
#include "cacheitemqueue.h"
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QObject>
#include <QMutexLocker>
#include "pureimagecache.h"
#include "cache.h"
namespace core {
class TileCacheQueue:public QThread
{
Q_OBJECT
public:
TileCacheQueue();
~TileCacheQueue();
void EnqueueCacheTask(CacheItemQueue *task);
private:
void run();
QMutex _mutex;
QMutex _waitmutex;
QWaitCondition _waitc;
QQueue<CacheItemQueue*> _tileCacheQueue;
};
}
#endif // TILECACHEQUEUE_H
This diff is collapsed.
/**
******************************************************************************
*
* @file urlfactory.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef URLFACTORY_H
#define URLFACTORY_H
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkAccessManager>
#include <QUrl>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkReply>
#include <QTimer>
#include <QCoreApplication>
#include "providerstrings.h"
#include "pureimagecache.h"
#include "../internals/pointlatlng.h"
#include "geodecoderstatus.h"
#include <QTime>
#include "cache.h"
#include "placemark.h"
#include <QTextCodec>
#include "cmath"
namespace core {
class UrlFactory: public QObject,public ProviderStrings
{
Q_OBJECT
public:
/// <summary>
/// Gets or sets the value of the User-agent HTTP header.
/// </summary>
QByteArray UserAgent;
QNetworkProxy Proxy;
UrlFactory();
~UrlFactory();
QString MakeImageUrl(const MapType::Types &type,const core::Point &pos,const int &zoom,const QString &language);
internals::PointLatLng GetLatLngFromGeodecoder(const QString &keywords,GeoCoderStatusCode::Types &status);
Placemark GetPlacemarkFromGeocoder(internals::PointLatLng location);
int Timeout;
private:
int Random(int low, int high);
void GetSecGoogleWords(const core::Point &pos, QString &sec1, QString &sec2);
int GetServerNum(const core::Point &pos,const int &max) const;
void TryCorrectGoogleVersions();
bool isCorrectedGoogleVersions;
QString TileXYToQuadKey(const int &tileX,const int &tileY,const int &levelOfDetail) const;
bool CorrectGoogleVersions;
bool UseGeocoderCache; //TODO GetSet
bool UsePlacemarkCache;//TODO GetSet
static const double EarthRadiusKm;
double GetDistance(internals::PointLatLng p1,internals::PointLatLng p2);
QMutex mutex;
protected:
static short timelapse;
QString LanguageStr;
bool IsCorrectGoogleVersions();
void setIsCorrectGoogleVersions(bool value);
QString MakeGeocoderUrl(QString keywords);
QString MakeReverseGeocoderUrl(internals::PointLatLng &pt,const QString &language);
internals::PointLatLng GetLatLngFromGeocoderUrl(const QString &url,const bool &useCache, GeoCoderStatusCode::Types &status);
Placemark GetPlacemarkFromReverseGeocoderUrl(const QString &url,const bool &useCache);
};
}
#endif // URLFACTORY_H
/**
******************************************************************************
*
* @file MouseWheelZoomType.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mousewheelzoomtype.h"
namespace internals {
}
/**
******************************************************************************
*
* @file copyrightstrings.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COPYRIGHTSTRINGS_H
#define COPYRIGHTSTRINGS_H
#include <QString>
#include <QDateTime>
namespace internals {
static const QString googleCopyright = QString("(c)%1 Google - Map data (c)%1 Tele Atlas, Imagery (c)%1 TerraMetrics").arg(QDate::currentDate().year());
static const QString openStreetMapCopyright = QString("(c) OpenStreetMap - Map data (c)%1 OpenStreetMap").arg(QDate::currentDate().year());
static const QString yahooMapCopyright = QString("(c) Yahoo! Inc. - Map data & Imagery (c)%1 NAVTEQ").arg(QDate::currentDate().year());
static const QString virtualEarthCopyright = QString("(c)%1 Microsoft Corporation, (c)%1 NAVTEQ, (c)%1 Image courtesy of NASA").arg(QDate::currentDate().year());
static const QString arcGisCopyright = QString("(c)%1 ESRI - Map data (c)%1 ArcGIS").arg(QDate::currentDate().year());
}
#endif // COPYRIGHTSTRINGS_H
This diff is collapsed.
/**
******************************************************************************
*
* @file core.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CORE_H
#define CORE_H
#include "debugheader.h"
#include "../internals/pointlatlng.h"
#include "mousewheelzoomtype.h"
#include "../core/size.h"
#include "../core/point.h"
#include "../core/maptype.h"
#include "rectangle.h"
#include "QThreadPool"
#include "tilematrix.h"
#include <QQueue>
#include "loadtask.h"
#include "copyrightstrings.h"
#include "rectlatlng.h"
#include "../internals/projections/lks94projection.h"
#include "../internals/projections/mercatorprojection.h"
#include "../internals/projections/mercatorprojectionyandex.h"
#include "../internals/projections/platecarreeprojection.h"
#include "../internals/projections/platecarreeprojectionpergo.h"
#include "../core/geodecoderstatus.h"
#include "../core/opmaps.h"
#include "../core/diagnostics.h"
#include <QSemaphore>
#include <QThread>
#include <QDateTime>
#include <QObject>
namespace mapcontrol
{
class OPMapControl;
class MapGraphicItem;
}
namespace internals {
class Core:public QObject,public QRunnable
{
Q_OBJECT
friend class mapcontrol::OPMapControl;
friend class mapcontrol::MapGraphicItem;
public:
Core();
~Core();
void run();
PointLatLng CurrentPosition()const{return currentPosition;}
void SetCurrentPosition(const PointLatLng &value);
core::Point GetcurrentPositionGPixel(){return currentPositionPixel;}
void SetcurrentPositionGPixel(const core::Point &value){currentPositionPixel=value;}
core::Point GetrenderOffset(){return renderOffset;}
void SetrenderOffset(const core::Point &value){renderOffset=value;}
core::Point GetcenterTileXYLocation(){return centerTileXYLocation;}
void SetcenterTileXYLocation(const core::Point &value){centerTileXYLocation=value;}
core::Point GetcenterTileXYLocationLast(){return centerTileXYLocationLast;}
void SetcenterTileXYLocationLast(const core::Point &value){centerTileXYLocationLast=value;}
core::Point GetdragPoint(){return dragPoint;}
void SetdragPoint(const core::Point &value){dragPoint=value;}
core::Point GetmouseDown(){return mouseDown;}
void SetmouseDown(const core::Point &value){mouseDown=value;}
core::Point GetmouseCurrent(){return mouseCurrent;}
void SetmouseCurrent(const core::Point &value){mouseCurrent=value;}
core::Point GetmouseLastZoom(){return mouseLastZoom;}
void SetmouseLastZoom(const core::Point &value){mouseLastZoom=value;}
MouseWheelZoomType::Types GetMouseWheelZoomType(){return mousewheelzoomtype;}
void SetMouseWheelZoomType(const MouseWheelZoomType::Types &value){mousewheelzoomtype=value;}
PointLatLng GetLastLocationInBounds(){return LastLocationInBounds;}
void SetLastLocationInBounds(const PointLatLng &value){LastLocationInBounds=value;}
Size GetsizeOfMapArea(){return sizeOfMapArea;}
void SetsizeOfMapArea(const Size &value){sizeOfMapArea=value;}
Size GetminOfTiles(){return minOfTiles;}
void SetminOfTiles(const Size &value){minOfTiles=value;}
Size GetmaxOfTiles(){return maxOfTiles;}
void SetmaxOfTiles(const Size &value){maxOfTiles=value;}
Rectangle GettileRect(){return tileRect;}
void SettileRect(const Rectangle &value){tileRect=value;}
core::Point GettilePoint(){return tilePoint;}
void SettilePoint(const core::Point &value){tilePoint=value;}
Rectangle GetCurrentRegion(){return CurrentRegion;}
void SetCurrentRegion(const Rectangle &value){CurrentRegion=value;}
QList<core::Point> tileDrawingList;
PureProjection* Projection()
{
return projection;
}
void SetProjection(PureProjection* value)
{
if (projection) {
delete projection;
}
projection=value;
tileRect=Rectangle(core::Point(0,0),value->TileSize());
}
bool IsDragging()const{return isDragging;}
int Zoom()const{return zoom;}
void SetZoom(int const& value);
int MaxZoom()const{return maxzoom;}
void UpdateBounds();
MapType::Types GetMapType(){return mapType;}
void SetMapType(MapType::Types const& value);
void StartSystem();
void UpdateCenterTileXYLocation();
void OnMapSizeChanged(int const& width, int const& height);//TODO had as slot
void OnMapClose();//TODO had as slot
GeoCoderStatusCode::Types SetCurrentPositionByKeywords(QString const& keys);
RectLatLng CurrentViewArea();
PointLatLng FromLocalToLatLng(int const& x, int const& y);
Point FromLatLngToLocal(PointLatLng const& latlng);
int GetMaxZoomToFitRect(RectLatLng const& rect);
void BeginDrag(core::Point const& pt);
void EndDrag();
void ReloadMap();
void GoToCurrentPosition();
bool MouseWheelZooming;
void DragOffset(core::Point const& offset);
void Drag(core::Point const& pt);
void CancelAsyncTasks();
void FindTilesAround(QList<core::Point> &list);
void UpdateGroundResolution();
TileMatrix Matrix;
bool isStarted(){return started;}
diagnostics GetDiagnostics();
signals:
void OnCurrentPositionChanged(internals::PointLatLng point);
void OnTileLoadComplete();
void OnTilesStillToLoad(int number);
void OnTileLoadStart();
void OnMapDrag();
void OnMapZoomChanged();
void OnMapTypeChanged(MapType::Types type);
void OnEmptyTileError(int zoom, core::Point pos);
void OnNeedInvalidation();
private:
PointLatLng currentPosition;
core::Point currentPositionPixel;
core::Point renderOffset;
core::Point centerTileXYLocation;
core::Point centerTileXYLocationLast;
core::Point dragPoint;
Rectangle tileRect;
core::Point mouseDown;
bool CanDragMap;
core::Point mouseCurrent;
PointLatLng LastLocationInBounds;
core::Point mouseLastZoom;
MouseWheelZoomType::Types mousewheelzoomtype;
Size sizeOfMapArea;
Size minOfTiles;
Size maxOfTiles;
core::Point tilePoint;
Rectangle CurrentRegion;
QQueue<LoadTask> tileLoadQueue;
int zoom;
PureProjection* projection;
bool isDragging;
QMutex MtileLoadQueue;
QMutex Moverlays;
QMutex MtileDrawingList;
#ifdef DEBUG_CORE
QMutex Mdebug;
static qlonglong debugcounter;
#endif
Size TooltipTextPadding;
MapType::Types mapType;
QSemaphore loaderLimit;
QThreadPool ProcessLoadTaskCallback;
QMutex MtileToload;
int tilesToload;
int maxzoom;
QMutex MrunningThreads;
int runningThreads;
diagnostics diag;
protected:
bool started;
int Width;
int Height;
int pxRes100m; // 100 meters
int pxRes1000m; // 1km
int pxRes10km; // 10km
int pxRes100km; // 100km
int pxRes1000km; // 1000km
int pxRes5000km; // 5000km
void SetCurrentPositionGPixel(core::Point const& value){currentPositionPixel = value;}
void GoToCurrentPositionOnZoom();
};
}
#endif // CORE_H
#ifndef DEBUGHEADER_H
#define DEBUGHEADER_H
//#define DEBUG_CORE
//#define DEBUG_TILE
//#define DEBUG_TILEMATRIX
#endif // DEBUGHEADER_H
include (../common.pri)
HEADERS += core.h \
mousewheelzoomtype.h \
rectangle.h \
tile.h \
tilematrix.h \
loadtask.h \
copyrightstrings.h \
pureprojection.h \
pointlatlng.h \
rectlatlng.h \
sizelatlng.h \
debugheader.h
SOURCES += core.cpp \
rectangle.cpp \
tile.cpp \
tilematrix.cpp \
pureprojection.cpp \
rectlatlng.cpp \
sizelatlng.cpp \
pointlatlng.cpp \
loadtask.cpp \
mousewheelzoomtype.cpp
HEADERS += ./projections/lks94projection.h \
./projections/mercatorprojection.h \
./projections/mercatorprojectionyandex.h \
./projections/platecarreeprojection.h \
./projections/platecarreeprojectionpergo.h
SOURCES += ./projections/lks94projection.cpp \
./projections/mercatorprojection.cpp \
./projections/mercatorprojectionyandex.cpp \
./projections/platecarreeprojection.cpp \
./projections/platecarreeprojectionpergo.cpp
LIBS += -L../build \
-lcore
/**
******************************************************************************
*
* @file loadtask.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "loadtask.h"
namespace internals {
bool operator==(LoadTask const& lhs,LoadTask const& rhs)
{
return ((lhs.Pos==rhs.Pos)&&(lhs.Zoom==rhs.Zoom));
}
}
/**
******************************************************************************
*
* @file loadtask.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LOADTASK_H
#define LOADTASK_H
#include <QString>
#include "../core/point.h"
using namespace core;
namespace internals
{
struct LoadTask
{
friend bool operator==(LoadTask const& lhs,LoadTask const& rhs);
public:
core::Point Pos;
int Zoom;
LoadTask(Point pos, int zoom)
{
Pos = pos;
Zoom = zoom;
}
LoadTask()
{
Pos=core::Point(-1,-1);
Zoom=-1;
}
bool HasValue()
{
return !(Zoom==-1);
}
QString ToString()const
{
return QString::number(Zoom) + " - " + Pos.ToString();
}
};
}
#endif // LOADTASK_H
/**
******************************************************************************
*
* @file mousewheelzoomtype.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MOUSEWHEELZOOMTYPE_H
#define MOUSEWHEELZOOMTYPE_H
#include <QObject>
#include <QStringList>
#include <QMetaType>
#include <QMetaObject>
#include <QMetaEnum>
namespace internals {
class MouseWheelZoomType:public QObject
{
Q_OBJECT
Q_ENUMS(Types)
public:
enum Types
{
/// <summary>
/// zooms map to current mouse position and makes it map center
/// </summary>
MousePositionAndCenter,
/// <summary>
/// zooms to current mouse position, but doesn't make it map center,
/// google/bing style ;}
/// </summary>
MousePositionWithoutCenter,
/// <summary>
/// zooms map to current view center
/// </summary>
ViewCenter
};
static QString StrByType(Types const& value)
{
QMetaObject metaObject = MouseWheelZoomType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
QString s=metaEnum.valueToKey(value);
return s;
}
static Types TypeByStr(QString const& value)
{
QMetaObject metaObject = MouseWheelZoomType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
Types s=(Types)metaEnum.keyToValue(value.toLatin1());
return s;
}
static QStringList TypesList()
{
QStringList ret;
QMetaObject metaObject = MouseWheelZoomType().staticMetaObject;
QMetaEnum metaEnum= metaObject.enumerator( metaObject.indexOfEnumerator("Types"));
for(int x=0;x<metaEnum.keyCount();++x)
{
ret.append(metaEnum.key(x));
}
return ret;
}
};
}
Q_DECLARE_METATYPE(internals::MouseWheelZoomType::Types)
#endif // MOUSEWHEELZOOMTYPE_H
/**
******************************************************************************
*
* @file pointlatlng.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pointlatlng.h"
namespace internals {
PointLatLng PointLatLng::Empty=PointLatLng();
PointLatLng::PointLatLng():lat(0),lng(0),empty(true)
{
}
bool operator==(PointLatLng const& lhs,PointLatLng const& rhs)
{
return ((lhs.Lng() == rhs.Lng()) && (lhs.Lat() == rhs.Lat()));
}
bool operator!=(PointLatLng const& left, PointLatLng const& right)
{
return !(left == right);
}
PointLatLng operator+(PointLatLng pt, SizeLatLng sz)
{
return PointLatLng::Add(pt, sz);
}
PointLatLng operator-(PointLatLng pt, SizeLatLng sz)
{
return PointLatLng::Subtract(pt, sz);
}
}
This diff is collapsed.
/**
******************************************************************************
*
* @file lks94projection.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup OPMapWidget
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LKS94PROJECTION_H
#define LKS94PROJECTION_H
#include <QVector>
#include "cmath"
#include "../pureprojection.h"
namespace projections {
class LKS94Projection:public internals::PureProjection
{
public:
LKS94Projection();
double GetTileMatrixResolution(int const& zoom);
virtual QString Type(){return "LKS94Projection";}
virtual Size TileSize() const;
virtual double Axis() const;
virtual double Flattening() const;
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);
private:
const double MinLatitude;
const double MaxLatitude;
const double MinLongitude;
const double MaxLongitude;
const double orignX;
const double orignY;
Size tileSize;
QVector <double> DTM10(const QVector <double>& lonlat);
QVector <double> MTD10(QVector <double>& pnt);
QVector <double> DTM00(QVector <double>& lonlat);
QVector <double> DTM01(QVector <double>& lonlat);
QVector <double> MTD01(QVector <double>& pnt);
QVector <double> MTD11(QVector <double>& p);
double Clip(double const& n, double const& minValue, double const& maxValue);
};
}
#endif // LKS94PROJECTION_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment