Commit 9396f137 authored by lm's avatar lm
Browse files

Added opmapcontrol

parent 2021535f
#include "src/mapwidget/opmapwidget.h"
######################################################################
# Automatically generated by qmake (2.01a) Sa. Mrz 19 17:12:54 2011
######################################################################
DEPENDPATH += src/core src/internals src/mapwidget src/internals/projections
INCLUDEPATH += src/core src/internals src/internals/projections src/mapwidget
# Input
HEADERS += opmapcontrol.h \
src/core/accessmode.h \
src/core/alllayersoftype.h \
src/core/cache.h \
src/core/cacheitemqueue.h \
src/core/debugheader.h \
src/core/diagnostics.h \
src/core/geodecoderstatus.h \
src/core/kibertilecache.h \
src/core/languagetype.h \
src/core/maptype.h \
src/core/memorycache.h \
src/core/opmaps.h \
src/core/placemark.h \
src/core/point.h \
src/core/providerstrings.h \
src/core/pureimage.h \
src/core/pureimagecache.h \
src/core/rawtile.h \
src/core/size.h \
src/core/tilecachequeue.h \
src/core/urlfactory.h \
src/internals/copyrightstrings.h \
src/internals/core.h \
src/internals/debugheader.h \
src/internals/loadtask.h \
src/internals/mousewheelzoomtype.h \
src/internals/pointlatlng.h \
src/internals/pureprojection.h \
src/internals/rectangle.h \
src/internals/rectlatlng.h \
src/internals/sizelatlng.h \
src/internals/tile.h \
src/internals/tilematrix.h \
src/mapwidget/configuration.h \
src/mapwidget/gpsitem.h \
src/mapwidget/homeitem.h \
src/mapwidget/mapgraphicitem.h \
src/mapwidget/mapripform.h \
src/mapwidget/mapripper.h \
src/mapwidget/opmapwidget.h \
src/mapwidget/trailitem.h \
src/mapwidget/uavitem.h \
src/mapwidget/uavmapfollowtype.h \
src/mapwidget/uavtrailtype.h \
src/mapwidget/waypointitem.h \
src/internals/projections/lks94projection.h \
src/internals/projections/mercatorprojection.h \
src/internals/projections/mercatorprojectionyandex.h \
src/internals/projections/platecarreeprojection.h \
src/internals/projections/platecarreeprojectionpergo.h
FORMS += src/mapwidget/mapripform.ui
SOURCES += src/core/alllayersoftype.cpp \
src/core/cache.cpp \
src/core/cacheitemqueue.cpp \
src/core/diagnostics.cpp \
src/core/kibertilecache.cpp \
src/core/languagetype.cpp \
src/core/memorycache.cpp \
src/core/opmaps.cpp \
src/core/placemark.cpp \
src/core/point.cpp \
src/core/providerstrings.cpp \
src/core/pureimage.cpp \
src/core/pureimagecache.cpp \
src/core/rawtile.cpp \
src/core/size.cpp \
src/core/tilecachequeue.cpp \
src/core/urlfactory.cpp \
src/internals/core.cpp \
src/internals/loadtask.cpp \
src/internals/MouseWheelZoomType.cpp \
src/internals/pointlatlng.cpp \
src/internals/pureprojection.cpp \
src/internals/rectangle.cpp \
src/internals/rectlatlng.cpp \
src/internals/sizelatlng.cpp \
src/internals/tile.cpp \
src/internals/tilematrix.cpp \
src/mapwidget/configuration.cpp \
src/mapwidget/gpsitem.cpp \
src/mapwidget/homeitem.cpp \
src/mapwidget/mapgraphicitem.cpp \
src/mapwidget/mapripform.cpp \
src/mapwidget/mapripper.cpp \
src/mapwidget/opmapwidget.cpp \
src/mapwidget/trailitem.cpp \
src/mapwidget/uavitem.cpp \
src/mapwidget/waypointitem.cpp \
src/internals/projections/lks94projection.cpp \
src/internals/projections/mercatorprojection.cpp \
src/internals/projections/mercatorprojectionyandex.cpp \
src/internals/projections/platecarreeprojection.cpp \
src/internals/projections/platecarreeprojectionpergo.cpp
RESOURCES += src/mapwidget/mapresources.qrc
DESTDIR = ../build
QT += network
QT += sql
CONFIG += staticlib
TEMPLATE = lib
UI_DIR = uics
MOC_DIR = mocs
OBJECTS_DIR = objs
/**
******************************************************************************
*
* @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"
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" + QDir::separator();
geoCache = cache + "GeocoderCache"+ QDir::separator();
placemarkCache = cache + "PlacemarkCache" + QDir::separator();
ImageCache.setGtileCache(value);
}
QString Cache::CacheLocation()
{
return cache;
}
Cache::Cache()
{
if(cache.isNull()|cache.isEmpty())
{
cache=QDir::currentPath()+QDir::separator()+"mapscache"+QDir::separator();
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
Supports Markdown
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