forked from maplibre/maplibre-native-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete initial reference documentation (maplibre#152)
* Add widgets documentation * Add basic location / QML documentation * Specify header files * Install doxyqml in the CI * Minor tweaks to the added QML files
- Loading branch information
Showing
19 changed files
with
371 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.user | ||
compile_commands.json | ||
docs/output | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import QtQuick 2.15 | ||
import QtLocation 6.5 | ||
import QtPositioning 6.5 | ||
|
||
import MapLibre 3.0 | ||
|
||
Item { | ||
width: 512 | ||
height: 512 | ||
|
||
Plugin { | ||
id: mapPlugin | ||
name: "maplibre" | ||
|
||
PluginParameter { | ||
name: "maplibre.map.styles" | ||
value: "https://demotiles.maplibre.org/style.json" | ||
} | ||
} | ||
|
||
MapView { | ||
id: mapView | ||
anchors.fill: parent | ||
map.plugin: mapPlugin | ||
|
||
map.zoomLevel: 5 | ||
map.center: QtPositioning.coordinate(41.874, -75.789) | ||
|
||
MapLibre.style: Style { | ||
id: style | ||
|
||
SourceParameter { | ||
id: radarSourceParam | ||
styleId: "radar" | ||
type: "image" | ||
property string url: "https://maplibre.org/maplibre-gl-js/docs/assets/radar1.gif" | ||
property var coordinates: [ | ||
[-80.425, 46.437], | ||
[-71.516, 46.437], | ||
[-71.516, 37.936], | ||
[-80.425, 37.936] | ||
] | ||
} | ||
|
||
LayerParameter { | ||
id: radarLayerParam | ||
styleId: "radar-layer" | ||
type: "raster" | ||
property string source: "radar" | ||
|
||
paint: { | ||
"raster-opacity": 0.9 | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! [Map plugin] | ||
Plugin { | ||
id: mapPlugin | ||
name: "maplibre" | ||
|
||
PluginParameter { | ||
name: "maplibre.map.styles" | ||
value: "https://demotiles.maplibre.org/style.json" | ||
} | ||
} | ||
//! [Map plugin] | ||
|
||
//! [Style attachment] | ||
MapView { | ||
id: mapView | ||
anchors.fill: parent | ||
map.plugin: mapPlugin | ||
|
||
map.zoomLevel: 5 | ||
map.center: QtPositioning.coordinate(41.874, -75.789) | ||
|
||
MapLibre.style: Style { | ||
id: style | ||
} | ||
} | ||
//! [Style attachment] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//! [Attaching a Style] | ||
MapLibre.style: Style { | ||
id: style | ||
|
||
SourceParameter { | ||
id: radarSourceParam | ||
styleId: "radar" | ||
type: "image" | ||
property string url: "https://maplibre.org/maplibre-gl-js/docs/assets/radar1.gif" | ||
property var coordinates: [ | ||
[-80.425, 46.437], | ||
[-71.516, 46.437], | ||
[-71.516, 37.936], | ||
[-80.425, 37.936] | ||
] | ||
} | ||
|
||
LayerParameter { | ||
id: radarLayerParam | ||
styleId: "radar-layer" | ||
type: "raster" | ||
property string source: "radar" | ||
|
||
paint: { | ||
"raster-opacity": 0.9 | ||
} | ||
} | ||
} | ||
//! [Attaching a Style] | ||
|
||
//! [Adding a parameter to a style] | ||
let layerParam = Qt.createQmlObject(` | ||
import MapLibre 3.0 | ||
LayerParameter { | ||
styleId: "tileLayer" | ||
type: "raster" | ||
property string source: "tileSource" | ||
} | ||
`, | ||
style, | ||
"layerParamSnippet") | ||
style.addParameter(layerParam) | ||
//! [Adding a parameter to a style] | ||
|
||
//! [Source parameter] | ||
SourceParameter { | ||
id: radarSourceParam | ||
styleId: "radar" | ||
type: "image" | ||
property string url: "https://maplibre.org/maplibre-gl-js/docs/assets/radar1.gif" | ||
property var coordinates: [ | ||
[-80.425, 46.437], | ||
[-71.516, 46.437], | ||
[-71.516, 37.936], | ||
[-80.425, 37.936] | ||
] | ||
} | ||
//! [Source parameter] | ||
|
||
//! [Layer parameter] | ||
LayerParameter { | ||
id: radarLayerParam | ||
styleId: "radar-layer" | ||
type: "raster" | ||
property string source: "radar" | ||
|
||
paint: { | ||
"raster-opacity": 0.9 | ||
} | ||
} | ||
//! [Layer parameter] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2024 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
/*! | ||
\class LayerParameter | ||
\brief A QML type for setting parameters of a layer. Generated from \ref QMapLibre::LayerParameter and should be nested in a \ref Style. | ||
\ingroup QMapLibreLocation | ||
Additional layer-specific properties can be set directly as QML properties | ||
to the instance of the LayerParameter. | ||
\snippet{trimleft} snippets_Style.qml Layer parameter | ||
*/ | ||
|
||
SourceParameter { | ||
property string type //!< layer type | ||
property object layout //!< layout properties as a dictionary | ||
property object paint //!< paint properties as a dictionary | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*! | ||
\defgroup QMapLibreLocation QMapLibre Location | ||
\brief Qt Location plugin for MapLibre with the ID \c maplibre. | ||
|
||
The Qt Location QML plugin can be set with the \c Plugin instance. | ||
|
||
\snippet{trimleft} snippets_Map.qml Map plugin | ||
|
||
Additional style properties can be attached to the map. | ||
For that <tt>import MapLibre 3.0</tt> is needed. | ||
See \ref Style for more details. | ||
|
||
\snippet{trimleft} snippets_Map.qml Style attachment | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2024 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
/*! | ||
\class SourceParameter | ||
\brief A QML type for setting parameters of a source. Generated from \ref QMapLibre::SourceParameter and should be nested in a \ref Style. | ||
\ingroup QMapLibreLocation | ||
Additional source-specific properties can be set directly as QML properties | ||
to the instance of the SourceParameter. | ||
\snippet{trimleft} snippets_Style.qml Source parameter | ||
*/ | ||
|
||
Item { | ||
property string m_type //!< source type | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (C) 2024 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
/*! | ||
\class Style | ||
\brief A QML helper item to be attached to a \c MapView using \c MapLibre.style property. | ||
\ingroup QMapLibreLocation | ||
This item does not have any properties and expect to have \ref StyleParameter | ||
implementations as children. See also \ref SourceParameter and \ref LayerParameter. | ||
\snippet{trimleft} snippets_Style.qml Attaching a Style | ||
Parameters can also be manipulated programatically using \ref addParameter, | ||
\ref removeParameter and \ref clearParameters functions. | ||
\snippet{trimleft} snippets_Style.qml Adding a parameter to a style | ||
\example example_Style.qml | ||
This is an example of how to use the Style item. | ||
*/ | ||
|
||
Item { | ||
/*! | ||
\brief Add a parameter programatically | ||
\param type:StyleParameter parameter The parameter to be added | ||
*/ | ||
function addParameter(parameter) {} | ||
|
||
/*! | ||
\brief Remove a parameter programatically | ||
\param type:StyleParameter parameter The parameter to be removed | ||
*/ | ||
function removeParameter(parameter) {} | ||
|
||
/*! | ||
\brief Clear all parameters programatically | ||
*/ | ||
function clearParameters() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2024 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
/*! | ||
\class StyleParameter | ||
\brief A base QML type for style parameters and is not intended to be used directly. | ||
\ingroup QMapLibreLocation | ||
See also \ref SourceParameter and \ref LayerParameter. | ||
*/ | ||
|
||
Item { | ||
property string styleId //!< style id to be references inside MapLibre | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.