Skip to content

Commit

Permalink
Merge branch 'bgw-initial-client' of https://github.com/Dataport/polar
Browse files Browse the repository at this point in the history
…into bgw-initial-client
  • Loading branch information
jedi-of-the-sea committed Feb 12, 2025
2 parents 05dd68c + bc78093 commit 7d35e46
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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><a id="subscribed-export-a" download="polar_screenshot.png" href=""><img id="subscribed-export-img" /></a></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><a id="subscribed-export-a" download="polar_screenshot.png" href=""><img id="subscribed-export-img" /></a></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
13 changes: 13 additions & 0 deletions packages/clients/diplan/example/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default (client, layerConf, config) => {

const htmlZoom = document.getElementById('subscribed-zoom')
const htmlGfi = document.getElementById('subscribed-gfi')
const htmlExportA = document.getElementById('subscribed-export-a')
const htmlExportImg = document.getElementById('subscribed-export-img')

mapInstance.subscribe(
'plugin/zoom/zoomLevel',
Expand All @@ -51,6 +53,17 @@ export default (client, layerConf, config) => {
'plugin/gfi/featureInformation',
(v) => (htmlGfi.innerHTML = JSON.stringify(v, null, 2))
)
mapInstance.subscribe('plugin/export/exportedMap', (screenshot) => {
htmlExportImg.setAttribute('src', screenshot)
if (navigator.userAgent.toLowerCase().includes('firefox')) {
htmlExportImg.onclick = function () {
window.open(this.src, '_blank')
}
htmlExportA.onclick = () => false
} else {
htmlExportA.setAttribute('href', 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": "^3.0.0",
"@polar/plugin-attributions": "^1.4.0",
"@polar/plugin-draw": "^3.0.0",
"@polar/plugin-export": "^1.2.2",
"@polar/plugin-gfi": "^3.0.0",
"@polar/plugin-icon-menu": "^1.3.1",
"@polar/plugin-layer-chooser": "^2.0.0",
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 7d35e46

Please sign in to comment.