Skip to content

Commit

Permalink
add export and example
Browse files Browse the repository at this point in the history
  • Loading branch information
warm-coolguy committed Feb 4, 2025
1 parent 74b5509 commit 4da8db3
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/clients/diplan/example/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ export default {
},
],
},
export: {
displayComponent: true,
showJpg: false,
showPdf: false,
},
gfi: {
mode: 'bboxDot',
layers: {
Expand Down
5 changes: 5 additions & 0 deletions packages/clients/diplan/example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ <h2>Informationen aus Kartenklient</h2>
<td id="subscribed-zoom">uninitialized</td>
<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>
</tr>
<tr>
<td><code>plugin/export/exportedMap</code></td>
<td><img onclick="window.open(this.src, '_blank');" id="subscribed-export" /></td>
<td>Screenshot des aktuellen Kartenausschnitts. Produzierbar durch Klick auf den unteren linken "Export"-Button.</td>
</tr>
<tr>
<td><code>plugin/gfi/featureInformation</code></td>
<td id="subscribed-gfi">uninitialized</td>
Expand Down
5 changes: 5 additions & 0 deletions packages/clients/diplan/example/prod-example.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ <h2>Informationen aus Kartenklient</h2>
<td id="subscribed-zoom">uninitialized</td>
<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>
</tr>
<tr>
<td><code>plugin/export/exportedMap</code></td>
<td><img onclick="window.open(this.src, '_blank');" id="subscribed-export" /></td>
<td>Screenshot des aktuellen Kartenausschnitts. Produzierbar durch Klick auf den unteren linken "Export"-Button.</td>
</tr>
<tr>
<td><code>plugin/gfi/featureInformation</code></td>
<td id="subscribed-gfi">uninitialized</td>
Expand Down
4 changes: 4 additions & 0 deletions packages/clients/diplan/example/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default (client, layerConf, config) => {

const htmlZoom = document.getElementById('subscribed-zoom')
const htmlGfi = document.getElementById('subscribed-gfi')
const htmlExport = document.getElementById('subscribed-export')

mapInstance.subscribe(
'plugin/zoom/zoomLevel',
Expand All @@ -51,6 +52,9 @@ export default (client, layerConf, config) => {
'plugin/gfi/featureInformation',
(v) => (htmlGfi.innerHTML = JSON.stringify(v, null, 2))
)
mapInstance.subscribe('plugin/export/exportedMap', (screenshot) =>
htmlExport.setAttribute('src', screenshot)
)

window.mapInstance = mapInstance
})
Expand Down
6 changes: 6 additions & 0 deletions packages/clients/diplan/example/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ h2 {
width: 100%;
}

.styled-table img {
cursor: pointer;
width: 400px;
height: auto;
}

.styled-table thead tr {
background-color: #2b3980;
color: #ecf4ff;
Expand Down
1 change: 1 addition & 0 deletions packages/clients/diplan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@polar/plugin-address-search": "^2.0.0",
"@polar/plugin-attributions": "^1.3.0",
"@polar/plugin-draw": "^2.0.0",
"@polar/plugin-export": "^1.2.1",
"@polar/plugin-gfi": "^2.1.0",
"@polar/plugin-icon-menu": "^1.3.0",
"@polar/plugin-layer-chooser": "^1.2.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/clients/diplan/src/polar-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import polarCore, { setLayout, NineLayout, NineLayoutTag } from '@polar/core'
import AddressSearch from '@polar/plugin-address-search'
import Attributions from '@polar/plugin-attributions'
import Draw from '@polar/plugin-draw'
import Export from '@polar/plugin-export'
import Gfi from '@polar/plugin-gfi'
import IconMenu from '@polar/plugin-icon-menu'
import LayerChooser from '@polar/plugin-layer-chooser'
Expand Down Expand Up @@ -91,6 +92,14 @@ polarCore.addPlugins([
coordinateSources: [],
layers: {},
}),
Export({
layoutTag: NineLayoutTag.BOTTOM_LEFT,
/*
* icons: Currently not implemented, provided icon set has no fitting icon
* atm. Suggestion: Searching for "picture" on icomoon yields nice results.
* We should ask implementors of diplanung-style to add them eventually.
*/
}),
Scale({
displayComponent: true,
layoutTag: NineLayoutTag.BOTTOM_RIGHT,
Expand Down

0 comments on commit 4da8db3

Please sign in to comment.