/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\page location-plugin-here.html
\title Qt Location HERE Plugin
\ingroup QtLocation-plugins

\brief Uses the relevant services provided by HERE.

\section1 Overview

Included with Qt Location is a geo services plugin which accesses the relevant HERE services
provided by HERE/Nokia.  The use of these services is governed by the terms and conditions
available at \l {https://developer.here.com/terms-conditions}.

Note that accepting the terms and conditions only applies those terms and conditions to the use of
the HERE geo services plugin and does not limit the use of the other geo services plugins that may
be included with Qt.

The HERE geo services plugin can be loaded by using the plugin key "here".

The online plugin uses the tiled map classes, which caches tile data in heap memory and texture
memory.

\section1 Parameters

\section2 Mandatory parameters
The following table lists mandatory parameters that \e must be passed to the HERE plugin.
\table
\header
    \li Parameter
    \li Description
\row
    \li here.app_id
    \li Client \e app_id part of the app_id/token pair used for authentication by all managers.
\row
    \li here.token
    \li Client \e token part of the app_id/token pair for the service used for authentication by all managers.
\endtable

The HERE geo services plugin requires an application id and token pair to authenticate the
application with the HERE services.  To obtain an application id and token pair visit
\l{https://developer.here.com/}

\section2 Optional parameters
The following table lists optional parameters that can be passed to the HERE plugin.

\note Since Qt 5.5 all parameters below must be prefixed with \c here. Previous versions did not require
a prefix.

\table
\header
    \li Parameter
    \li Description
\row
    \li here.proxy
    \li Proxy server URL used by all managers. For usage of the system proxy just pass "system" as value.

    \note See the notes in \l{QNetworkProxyFactory::systemProxyForQuery()} for further information.
\row
    \li here.mapping.host
    \li Base map tile service URL used by mapping manager.
\row
    \li here.mapping.host.aerial
    \li Aerial map tile service URL used by mapping manager. For all satellite, hybrid and terrain schemes.
\row
    \li here.mapping.cache.directory
    \li Absolute path to map tile cache directory used as network disk cache.

    The default place for the cache is the \c{QtLocation/here} subdirectory in the location returned by
    QStandardPaths::writableLocation(), called with QStandardPaths::GenericCacheLocation  as a parameter.
    On systems that have no concept of a shared cache, the application-specific \l{QStandardPaths::CacheLocation} is used instead.

\row
    \li here.mapping.cache.disk.cost_strategy
    \li The cost strategy to use to cache map tiles on disk.
    Valid values are \b bytesize and \b unitary.
    Using \b bytesize, the related size parameter (\b here.mapping.cache.disk.size) will
    be interpreted as bytes.
    Using \b unitary, they will be interpreted as number of tiles.
    The default value for this parameter is \b bytesize.
\row
    \li here.mapping.cache.disk.size
    \li Disk cache size for map tiles. The default size of the cache is 50 MiB when \b bytesize is the cost
    strategy for this cache, or 1000 tiles, when \b unitary is the cost strategy.
\row
    \li here.mapping.cache.memory.cost_strategy
    \li The cost strategy to use to cache map tiles in memory.
    Valid values are \b bytesize and \b unitary.
    Using \b bytesize, the related size parameter (\b here.mapping.cache.memory.size) will
    be interpreted as bytes.
    Using \b unitary, they will be interpreted as number of tiles.
    The default value for this parameter is \b bytesize.
\row
    \li here.mapping.cache.memory.size
    \li Memory cache size for map tiles. The default size of the cache is 3 MiB when \b bytesize is the cost
    strategy for this cache, or 100 tiles, when \b unitary is the cost strategy.
\row
    \li here.mapping.cache.texture.cost_strategy
    \li The cost strategy to use to cache decompressed map tiles in memory.
    Valid values are \b bytesize and \b unitary.
    Using \b bytesize, the related size parameter (\b here.mapping.cache.texture.size) will
    be interpreted as bytes.
    Using \b unitary, they will be interpreted as number of tiles.
    The default value for this parameter is \b bytesize.
\row
    \li here.mapping.cache.texture.size
    \li Texture cache size for map tiles. The default size of the cache is 6 MiB when \b bytesize is the cost
    strategy for this cache, or 30 tiles, when \b unitary is the cost strategy.
    Note that the texture cache has a hard minimum size which depends on the size of the map viewport
    (it must contain enough data to display the tiles currently visible on the display).
    This value is the amount of cache to be used in addition to the bare minimum.
\row
    \li here.mapping.prefetching_style
    \li This parameter allows to provide a hint how tile prefetching is to be performed by the engine. The default value,
    \tt{TwoNeighbourLayers}, makes the engine prefetch tiles for the layer above and the one below the current tile
    layer, providing ready tiles when zooming in or out from the current zoom level.
    \tt{OneNeighbourLayer} only prefetches the one layer closest to the current zoom level.
    Finally, \tt{NoPrefetching} allows to disable the prefetching, so only tiles that are visible will be fetched.
    Note that, depending on the active map type, this hint might be ignored.
\row
    \li here.mapping.highdpi_tiles
    \li Whether or not to request high dpi tiles. Valid values are \b true and \b false. The default value is \b false.
\row
    \li here.geocoding.host
    \li Geocoding service URL used by geocoding manager.
\row
    \li here.routing.host
    \li Routing service URL used by routing manager.
\row
    \li here.places.host
    \li Search service URL used by search manager.
\row
    \li here.places.api_version
    \li Version of the REST API used by the places manager.  Currently versions 1 and 2 are
       supported. The version 1 is deprecated and will not be part of the final Qt release.  The default is version 2.
\endtable

\section1 Parameter Usage Example

The following two examples show how to create a HERE plugin instance with
parameters supplied for an application id and token, which is required for
authentication.

\section2 QML

\code
Plugin {
    name: "here"
    PluginParameter { name: "here.app_id"; value: "myapp" }
    PluginParameter { name: "here.token"; value: "abcdefg12345" }
}
\endcode

\section2 C++

\code
QMap<QString,QVariant> params;
params["here.app_id"] = "myapp";
params["here.token"] = "abcdefg12345";

QGeoServiceProvider *gsp = new QGeoServiceProvider("here", params);
\endcode

\section1 Places
The HERE provider remotely accesses places (read-only) from a REST based server.  The specific capabilities
and behaviours are outlined below:

\section2 Capabilities
\table
    \row
        \li Storage
        \li remote
    \row
        \li Read/Write
        \li read-only
    \row
        \li Icons
        \li yes
    \row
        \li Search term suggestions
        \li yes
    \row
        \li Recommendations
        \li yes
    \row
        \li Category structure
        \li Hierarchical
    \row
        \li (Rich) Content images
        \li yes
    \row
        \li (Rich) Content reviews
        \li yes
    \row
        \li (Rich) Content editorials
        \li yes
    \row
        \li All details fetched during search
        \li no
    \row
        \li Paging offset index
        \li no
    \row
        \li Paging limit
        \li yes
    \row
        \li Distance relevance hint
        \li no
    \row
        \li Lexical name relevance hint
        \li no
    \row
        \li Extended Attributes
        \li yes
    \row
        \li Notifications for added/removed places/categories
        \li no
    \row
        \li visibility scopes
        \li public
    \row
        \li favorites matching/(usable as favoritesPlugin)
        \li no
\endtable

\section2 Plugin Specific Behaviors and Limitations.
\section3 Search
The following list shows what core place data is returned during a place search:
\list
\li name
\li location
\li contact information
\li attribution
\li categories
\li rating
\li visibility
\endlist

The following list shows further details that may be retrieved
via QPlaceManager::getDetails()
\list
\li supplier
\li extended attributes
\endlist

\section3 Searching for Places
\section4 Search Term and Categories
The HERE plugin supports searching with a \e {search term} and \e {category or categories}, however
both are not supported simultaneously.

\list
    \li Valid usage: \e {search term} + \e {search center}
    \li Valid usage: \e {category} + \e {search center}
    \li Invalid usage: \e {search term} + \e {category} + \e {search center}
\endlist

This limitation applies when using the HERE plugin with \l PlaceSearchModel and QPlaceManager::search().

\section4 Search Area
The HERE plugin only supports provision of a \e {search center} when searching for places via \l PlaceSearchModel
and QPlaceManager::search().  A search center can be provided via a bounding circle, however the
radius should be kept at the default value of -1.  Typically a developer should not have to set the radius at all.
If a developer sets a radius, it is ignored by the plugin and the boundaries are not honored.

In a similar manner only the center of a bounding box is taken into consideration when searching.  The boundaries
of the box are not honored.

A search center \e {must} be provided for all searches.

\section4 Relevancy Hints
The HERE plugin does not support relevancy hints.  Any relevancy hints supplied to
a search request are consequently ignored.

\section3 Search Term suggestions
Only a partial \e {search term} and \e {search center} is supported when retrieving suggestions.
This limitation applies when using the HERE plugin with the \l PlaceSearchSuggestionModel and QPlaceManager::searchSuggestions().

Both search term and search center \e {must} be provided when retrieving search term suggestions.

\section3 Recommendations
Only a given \e {place identifier} is supported as a parameter for a recommendations.  No other parameters
such as limit, offset, and  search area are supported.  This limitation applies when using the
HERE plugin with \l PlaceSearchModel and QPlaceManager::search().

\section3 Extended Attributes
The supported set of attributes provided by the HERE plugin are not fixed and
may grow over time.  Also the attributes provided may vary according to a place
by place basis, e.g one place may provide opening hours while another does not.
At the time of writing, it is known that some places provide \c openingHours
(QPlaceAttribute::OpeningHours) and \c payment (QPlaceAttribute::Payment)
methods but other attributes may be made available by the backend server.  All
places provided by the plugin will have the \c x_provider
(QPlaceAttribute::Provider)  attribute set to \c here.

\section3 Restrictions of Usage - ExtendedAttributes and Content
The extended attributes  and rich content of places are not permitted
to be saved.  For QML this is related to \l Place::extendedAttributes, \l ImageModel,
\l ReviewModel, and \l EditorialModel.  For C++ this relates to QPlace::extendedAttribute(),
QPlace::content() and QPlaceManager::getPlaceContent().

(Note that the HERE plugin is a read-only source of places and
does not support saving functionality at all.)
*/
