Skip to content

Commit 4da8db3

Browse files
committed
add export and example
1 parent 74b5509 commit 4da8db3

File tree

7 files changed

+35
-0
lines changed

7 files changed

+35
-0
lines changed

packages/clients/diplan/example/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export default {
8080
},
8181
],
8282
},
83+
export: {
84+
displayComponent: true,
85+
showJpg: false,
86+
showPdf: false,
87+
},
8388
gfi: {
8489
mode: 'bboxDot',
8590
layers: {

packages/clients/diplan/example/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ <h2>Informationen aus Kartenklient</h2>
3636
<td id="subscribed-zoom">uninitialized</td>
3737
<td>Zoomstufe der <a target="_blank" href="https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#getZoom">OpenLayers/View</a> als <code>Number</code></td>
3838
</tr>
39+
<tr>
40+
<td><code>plugin/export/exportedMap</code></td>
41+
<td><img onclick="window.open(this.src, '_blank');" id="subscribed-export" /></td>
42+
<td>Screenshot des aktuellen Kartenausschnitts. Produzierbar durch Klick auf den unteren linken "Export"-Button.</td>
43+
</tr>
3944
<tr>
4045
<td><code>plugin/gfi/featureInformation</code></td>
4146
<td id="subscribed-gfi">uninitialized</td>

packages/clients/diplan/example/prod-example.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ <h2>Informationen aus Kartenklient</h2>
3636
<td id="subscribed-zoom">uninitialized</td>
3737
<td>Zoomstufe der <a target="_blank" href="https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#getZoom">OpenLayers/View</a> als <code>Number</code></td>
3838
</tr>
39+
<tr>
40+
<td><code>plugin/export/exportedMap</code></td>
41+
<td><img onclick="window.open(this.src, '_blank');" id="subscribed-export" /></td>
42+
<td>Screenshot des aktuellen Kartenausschnitts. Produzierbar durch Klick auf den unteren linken "Export"-Button.</td>
43+
</tr>
3944
<tr>
4045
<td><code>plugin/gfi/featureInformation</code></td>
4146
<td id="subscribed-gfi">uninitialized</td>

packages/clients/diplan/example/setup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default (client, layerConf, config) => {
4242

4343
const htmlZoom = document.getElementById('subscribed-zoom')
4444
const htmlGfi = document.getElementById('subscribed-gfi')
45+
const htmlExport = document.getElementById('subscribed-export')
4546

4647
mapInstance.subscribe(
4748
'plugin/zoom/zoomLevel',
@@ -51,6 +52,9 @@ export default (client, layerConf, config) => {
5152
'plugin/gfi/featureInformation',
5253
(v) => (htmlGfi.innerHTML = JSON.stringify(v, null, 2))
5354
)
55+
mapInstance.subscribe('plugin/export/exportedMap', (screenshot) =>
56+
htmlExport.setAttribute('src', screenshot)
57+
)
5458

5559
window.mapInstance = mapInstance
5660
})

packages/clients/diplan/example/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ h2 {
6363
width: 100%;
6464
}
6565

66+
.styled-table img {
67+
cursor: pointer;
68+
width: 400px;
69+
height: auto;
70+
}
71+
6672
.styled-table thead tr {
6773
background-color: #2b3980;
6874
color: #ecf4ff;

packages/clients/diplan/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@polar/plugin-address-search": "^2.0.0",
3939
"@polar/plugin-attributions": "^1.3.0",
4040
"@polar/plugin-draw": "^2.0.0",
41+
"@polar/plugin-export": "^1.2.1",
4142
"@polar/plugin-gfi": "^2.1.0",
4243
"@polar/plugin-icon-menu": "^1.3.0",
4344
"@polar/plugin-layer-chooser": "^1.2.1",

packages/clients/diplan/src/polar-client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import polarCore, { setLayout, NineLayout, NineLayoutTag } from '@polar/core'
22
import AddressSearch from '@polar/plugin-address-search'
33
import Attributions from '@polar/plugin-attributions'
44
import Draw from '@polar/plugin-draw'
5+
import Export from '@polar/plugin-export'
56
import Gfi from '@polar/plugin-gfi'
67
import IconMenu from '@polar/plugin-icon-menu'
78
import LayerChooser from '@polar/plugin-layer-chooser'
@@ -91,6 +92,14 @@ polarCore.addPlugins([
9192
coordinateSources: [],
9293
layers: {},
9394
}),
95+
Export({
96+
layoutTag: NineLayoutTag.BOTTOM_LEFT,
97+
/*
98+
* icons: Currently not implemented, provided icon set has no fitting icon
99+
* atm. Suggestion: Searching for "picture" on icomoon yields nice results.
100+
* We should ask implementors of diplanung-style to add them eventually.
101+
*/
102+
}),
94103
Scale({
95104
displayComponent: true,
96105
layoutTag: NineLayoutTag.BOTTOM_RIGHT,

0 commit comments

Comments
 (0)