summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2014-07-17 12:08:30 +1000
committerAaron McCarthy <mccarthy.aaron@gmail.com>2014-07-21 02:12:30 +0200
commit4bdf3bc386d8ace566633ae56505b9875764b16a (patch)
tree9a13360f8960523f880ffdd8d8810f52582a4c52 /src
parentf2e3523e3fcec83845a0ec73ff682367202a84f6 (diff)
downloadqtlocation-4bdf3bc386d8ace566633ae56505b9875764b16a.tar.gz
Add night property to MapType.
Similar to the mobile property this property allows applications to determine if the tile set is optimized for night time use. Change-Id: Ibaaffe6f745d90817b5938f493742fb019be0312 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/qdeclarativegeomaptype.cpp12
-rw-r--r--src/imports/location/qdeclarativegeomaptype_p.h3
-rw-r--r--src/location/maps/qgeomaptype.cpp60
-rw-r--r--src/location/maps/qgeomaptype_p.h9
-rw-r--r--src/location/maps/qgeomaptype_p_p.h5
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp38
-rw-r--r--src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp4
7 files changed, 76 insertions, 55 deletions
diff --git a/src/imports/location/qdeclarativegeomaptype.cpp b/src/imports/location/qdeclarativegeomaptype.cpp
index 046c16d1..c5eb45c6 100644
--- a/src/imports/location/qdeclarativegeomaptype.cpp
+++ b/src/imports/location/qdeclarativegeomaptype.cpp
@@ -122,6 +122,18 @@ bool QDeclarativeGeoMapType::mobile() const
return mapType_.mobile();
}
+/*!
+ \qmlproperty bool MapType::night
+
+ \brief Whether the map type is optimized for use at night.
+
+ Map types suitable for use at night usually have a dark background.
+*/
+bool QDeclarativeGeoMapType::night() const
+{
+ return mapType_.night();
+}
+
#include "moc_qdeclarativegeomaptype_p.cpp"
QT_END_NAMESPACE
diff --git a/src/imports/location/qdeclarativegeomaptype_p.h b/src/imports/location/qdeclarativegeomaptype_p.h
index 974e00a0..d8e020dd 100644
--- a/src/imports/location/qdeclarativegeomaptype_p.h
+++ b/src/imports/location/qdeclarativegeomaptype_p.h
@@ -57,6 +57,7 @@ class QDeclarativeGeoMapType : public QObject
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(QString description READ description CONSTANT)
Q_PROPERTY(bool mobile READ mobile CONSTANT)
+ Q_PROPERTY(bool night READ night CONSTANT)
public:
enum MapStyle {
@@ -80,12 +81,12 @@ public:
QString name() const;
QString description() const;
bool mobile() const;
+ bool night() const;
const QGeoMapType mapType() { return mapType_; }
private:
QGeoMapType mapType_;
-
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomaptype.cpp b/src/location/maps/qgeomaptype.cpp
index 213b1b66..695287a8 100644
--- a/src/location/maps/qgeomaptype.cpp
+++ b/src/location/maps/qgeomaptype.cpp
@@ -50,8 +50,11 @@ QGeoMapType::QGeoMapType()
QGeoMapType::QGeoMapType(const QGeoMapType &other)
: d_ptr(other.d_ptr) {}
-QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId)
- : d_ptr(new QGeoMapTypePrivate(style, name, description, mobile, mapId)) {}
+QGeoMapType::QGeoMapType(QGeoMapType::MapStyle style, const QString &name,
+ const QString &description, bool mobile, bool night, int mapId)
+: d_ptr(new QGeoMapTypePrivate(style, name, description, mobile, night, mapId))
+{
+}
QGeoMapType::~QGeoMapType() {}
@@ -94,40 +97,43 @@ bool QGeoMapType::mobile() const
return d_ptr->mobile_;
}
+bool QGeoMapType::night() const
+{
+ return d_ptr->night_;
+}
+
int QGeoMapType::mapId() const
{
return d_ptr->mapId_;
}
QGeoMapTypePrivate::QGeoMapTypePrivate()
- : style_(QGeoMapType::NoMap),
- mobile_(false),
- mapId_(0) {}
+: style_(QGeoMapType::NoMap), mobile_(false), night_(false), mapId_(0)
+{
+}
QGeoMapTypePrivate::QGeoMapTypePrivate(const QGeoMapTypePrivate &other)
- : QSharedData(other),
- style_(other.style_),
- name_(other.name_),
- description_(other.description_),
- mobile_(other.mobile_),
- mapId_(other.mapId_) {}
-
-QGeoMapTypePrivate::QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId)
- : style_(style),
- name_(name),
- description_(description),
- mobile_(mobile),
- mapId_(mapId) {}
-
-QGeoMapTypePrivate::~QGeoMapTypePrivate() {}
-
-bool QGeoMapTypePrivate::operator == (const QGeoMapTypePrivate &other) const
+: QSharedData(other), style_(other.style_), name_(other.name_), description_(other.description_),
+ mobile_(other.mobile_), night_(other.night_), mapId_(other.mapId_)
+{
+}
+
+QGeoMapTypePrivate::QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name,
+ const QString &description, bool mobile, bool night,
+ int mapId)
+: style_(style), name_(name), description_(description), mobile_(mobile), night_(night),
+ mapId_(mapId)
+{
+}
+
+QGeoMapTypePrivate::~QGeoMapTypePrivate()
+{
+}
+
+bool QGeoMapTypePrivate::operator==(const QGeoMapTypePrivate &other) const
{
- return ((style_ == other.style_)
- && (name_ == other.name_)
- && (description_ == other.description_)
- && (mobile_ == other.mobile_)
- && (mapId_ == other.mapId_));
+ return style_ == other.style_ && name_ == other.name_ && description_ == other.description_ &&
+ mobile_ == other.mobile_ && night_ == other.night_ && mapId_ == other.mapId_;
}
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomaptype_p.h b/src/location/maps/qgeomaptype_p.h
index 7b1cc2c9..9472157c 100644
--- a/src/location/maps/qgeomaptype_p.h
+++ b/src/location/maps/qgeomaptype_p.h
@@ -53,9 +53,9 @@
// We mean it.
//
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
#include <QtLocation/qlocationglobal.h>
-#include <QString>
-#include <QSharedDataPointer>
QT_BEGIN_NAMESPACE
@@ -63,7 +63,6 @@ class QGeoMapTypePrivate;
class Q_LOCATION_EXPORT QGeoMapType
{
-
public:
enum MapStyle {
NoMap = 0,
@@ -81,7 +80,8 @@ public:
QGeoMapType();
QGeoMapType(const QGeoMapType &other);
- QGeoMapType(MapStyle style, const QString &name, const QString &description, bool mobile, int mapId);
+ QGeoMapType(MapStyle style, const QString &name, const QString &description, bool mobile,
+ bool night, int mapId);
~QGeoMapType();
QGeoMapType &operator = (const QGeoMapType &other);
@@ -93,6 +93,7 @@ public:
QString name() const;
QString description() const;
bool mobile() const;
+ bool night() const;
int mapId() const;
private:
diff --git a/src/location/maps/qgeomaptype_p_p.h b/src/location/maps/qgeomaptype_p_p.h
index f01a25b7..eff27bcc 100644
--- a/src/location/maps/qgeomaptype_p_p.h
+++ b/src/location/maps/qgeomaptype_p_p.h
@@ -38,6 +38,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef QGEOMAPTYPE_P_H
#define QGEOMAPTYPE_P_H
@@ -62,10 +63,9 @@ QT_BEGIN_NAMESPACE
class QGeoMapTypePrivate : public QSharedData
{
-
public:
QGeoMapTypePrivate();
- QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, int mapId);
+ QGeoMapTypePrivate(QGeoMapType::MapStyle style, const QString &name, const QString &description, bool mobile, bool night, int mapId);
QGeoMapTypePrivate(const QGeoMapTypePrivate &other);
~QGeoMapTypePrivate();
@@ -77,6 +77,7 @@ public:
QString name_;
QString description_;
bool mobile_;
+ bool night_;
int mapId_;
};
diff --git a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
index 6b453e63..1d8785bf 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
@@ -83,25 +83,25 @@ QGeoTiledMappingManagerEngineNokia::QGeoTiledMappingManagerEngineNokia(
setTileSize(QSize(512, 512));
QList<QGeoMapType> types;
- types << QGeoMapType(QGeoMapType::StreetMap, tr("Street Map"), tr("Normal map view in daylight mode"), false, 1);
- types << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite Map"), tr("Satellite map view in daylight mode"), false, 2);
- types << QGeoMapType(QGeoMapType::TerrainMap, tr("Terrain Map"), tr("Terrain map view in daylight mode"), false, 3);
- types << QGeoMapType(QGeoMapType::HybridMap, tr("Hybrid Map"), tr("Satellite map view with streets in daylight mode"), false, 4);
- types << QGeoMapType(QGeoMapType::TransitMap, tr("Transit Map"), tr("Color-reduced map view with public transport scheme in daylight mode"), false, 5);
- types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Gray Street Map"), tr("Color-reduced map view in daylight mode"), false, 6);
- types << QGeoMapType(QGeoMapType::StreetMap, tr("Mobile Street Map"), tr("Mobile normal map view in daylight mode"), true, 7);
- types << QGeoMapType(QGeoMapType::TerrainMap, tr("Mobile Terrain Map"), tr("Mobile terrain map view in daylight mode"), true, 8);
- types << QGeoMapType(QGeoMapType::HybridMap, tr("Mobile Hybrid Map"), tr("Mobile satellite map view with streets in daylight mode"), true, 9);
- types << QGeoMapType(QGeoMapType::TransitMap, tr("Mobile Transit Map"), tr("Mobile color-reduced map view with public transport scheme in daylight mode"), true, 10);
- types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Mobile Gray Street Map"), tr("Mobile color-reduced map view in daylight mode"), true, 11);
- types << QGeoMapType(QGeoMapType::StreetMap, tr("Custom Street Map"), tr("Normal map view in daylight mode"), false, 12);
- types << QGeoMapType(QGeoMapType::StreetMap, tr("Night Street Map"), tr("Normal map view in night mode"), false, 13);
- types << QGeoMapType(QGeoMapType::StreetMap, tr("Mobile Night Street Map"), tr("Mobile normal map view in night mode"), true, 14);
- types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Gray Night Street Map"), tr("Color-reduced map view in night mode (especially used for background maps)"), false, 15);
- types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Mobile Gray Night Street Map"), tr("Mobile color-reduced map view in night mode (especially used for background maps)"), true, 16);
- types << QGeoMapType(QGeoMapType::PedestrianMap, tr("Pedestrian Street Map"), tr("Pedestrian map view in daylight mode for mobile usage"), true, 17);
- types << QGeoMapType(QGeoMapType::PedestrianMap, tr("Pedestrian Night Street Map"), tr("Pedestrian map view in night mode for mobile usage"), true, 18);
- types << QGeoMapType(QGeoMapType::CarNavigationMap, tr("Car Navigation Map"), tr("Normal map view in daylight mode for car navigation"), false, 19);
+ types << QGeoMapType(QGeoMapType::StreetMap, tr("Street Map"), tr("Normal map view in daylight mode"), false, false, 1);
+ types << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite Map"), tr("Satellite map view in daylight mode"), false, false, 2);
+ types << QGeoMapType(QGeoMapType::TerrainMap, tr("Terrain Map"), tr("Terrain map view in daylight mode"), false, false, 3);
+ types << QGeoMapType(QGeoMapType::HybridMap, tr("Hybrid Map"), tr("Satellite map view with streets in daylight mode"), false, false, 4);
+ types << QGeoMapType(QGeoMapType::TransitMap, tr("Transit Map"), tr("Color-reduced map view with public transport scheme in daylight mode"), false, false, 5);
+ types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Gray Street Map"), tr("Color-reduced map view in daylight mode"), false, false, 6);
+ types << QGeoMapType(QGeoMapType::StreetMap, tr("Mobile Street Map"), tr("Mobile normal map view in daylight mode"), true, false, 7);
+ types << QGeoMapType(QGeoMapType::TerrainMap, tr("Mobile Terrain Map"), tr("Mobile terrain map view in daylight mode"), true, false, 8);
+ types << QGeoMapType(QGeoMapType::HybridMap, tr("Mobile Hybrid Map"), tr("Mobile satellite map view with streets in daylight mode"), true, false, 9);
+ types << QGeoMapType(QGeoMapType::TransitMap, tr("Mobile Transit Map"), tr("Mobile color-reduced map view with public transport scheme in daylight mode"), true, false, 10);
+ types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Mobile Gray Street Map"), tr("Mobile color-reduced map view in daylight mode"), true, false, 11);
+ types << QGeoMapType(QGeoMapType::StreetMap, tr("Custom Street Map"), tr("Normal map view in daylight mode"), false, false, 12);
+ types << QGeoMapType(QGeoMapType::StreetMap, tr("Night Street Map"), tr("Normal map view in night mode"), false, true, 13);
+ types << QGeoMapType(QGeoMapType::StreetMap, tr("Mobile Night Street Map"), tr("Mobile normal map view in night mode"), true, true, 14);
+ types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Gray Night Street Map"), tr("Color-reduced map view in night mode (especially used for background maps)"), false, true, 15);
+ types << QGeoMapType(QGeoMapType::GrayStreetMap, tr("Mobile Gray Night Street Map"), tr("Mobile color-reduced map view in night mode (especially used for background maps)"), true, true, 16);
+ types << QGeoMapType(QGeoMapType::PedestrianMap, tr("Pedestrian Street Map"), tr("Pedestrian map view in daylight mode for mobile usage"), true, false, 17);
+ types << QGeoMapType(QGeoMapType::PedestrianMap, tr("Pedestrian Night Street Map"), tr("Pedestrian map view in night mode for mobile usage"), true, true, 18);
+ types << QGeoMapType(QGeoMapType::CarNavigationMap, tr("Car Navigation Map"), tr("Normal map view in daylight mode for car navigation"), false, false, 19);
setSupportedMapTypes(types);
QGeoTileFetcherNokia *fetcher = new QGeoTileFetcherNokia(parameters, networkManager, this, tileSize());
diff --git a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
index f419fec1..edc03cf8 100644
--- a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
@@ -59,8 +59,8 @@ QGeoTiledMappingManagerEngineOsm::QGeoTiledMappingManagerEngineOsm(const QVarian
setTileSize(QSize(256, 256));
QList<QGeoMapType> mapTypes;
- mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("Street Map"), tr("OpenStreetMap street map"), false, 1);
- mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite Map"), tr("OpenStreetMap satellite map"), false, 2);
+ mapTypes << QGeoMapType(QGeoMapType::StreetMap, tr("Street Map"), tr("OpenStreetMap street map"), false, false, 1);
+ mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, tr("Satellite Map"), tr("OpenStreetMap satellite map"), false, false, 2);
setSupportedMapTypes(mapTypes);
QGeoTileFetcherOsm *tileFetcher = new QGeoTileFetcherOsm(this);