Skip to content

Commit adbca17

Browse files
committed
Add geometry highlighter example
1 parent cfe2072 commit adbca17

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

documentation/reference/plugins.en.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ QField ships with a number of utilities objects to manipulate features and geome
5353

5454
To familiarize yourself with these, visit QField’s source code’s [utilities directory](https://github.com/opengisch/QField/tree/master/src/core/utils) where .h\[eader\] files will provide documentation for all invokable functions.
5555

56-
## Search bar integration
56+
## Plugin code snippets
57+
58+
### Search bar integration
5759

5860
The plugin framework empowers you to integrate custom searches into the QField search bar through the `QFieldLocatorFilter` item which can be added into a plugin's root item:
5961

@@ -119,7 +121,7 @@ Item {
119121

120122
This [QField OpenStreetMap Nomination plugin](https://github.com/opengisch/qfield-nominatim-locator) is a good example to learn more about search bar integration.
121123

122-
## Configuration button within the plugin manager
124+
### Configuration button within the plugin manager
123125

124126
For plugins requiring user configuration, QField allows for these to add a configuration button within its plugin manager.
125127

@@ -148,3 +150,27 @@ Item {
148150
}
149151
}
150152
```
153+
154+
### Geometry highlighter canvas overlay
155+
156+
Plugins can make use of QField's geometry highlighter item to flash created or fetched geometries through the following code:
157+
158+
```
159+
import QtQuick
160+
import org.qfield
161+
162+
Item {
163+
// ...
164+
165+
property var geometryHighlighter: iface.findItemByObjectName('geometryHighlighter')
166+
167+
function demo() {
168+
// Flash Null Island geometry
169+
let geom = GeometryUtils.createGeometryFromWkt("POINT(0 0)")
170+
let crs = CoordinateReferenceSystemUtils.fromDescription("EPSG:4326")
171+
172+
geometryHighlighter.geometryWrapper.qgsGeometry = geometry
173+
geometryHighlighter.geometryWrapper.crs = crs;
174+
}
175+
}
176+
```

0 commit comments

Comments
 (0)