Skip to content

Commit

Permalink
Merge pull request #251 from Dataport/refactor/multiple-diplan-clients
Browse files Browse the repository at this point in the history
prepare diplan example folder for multiple prod instances
  • Loading branch information
warm-coolguy authored Feb 27, 2025
2 parents 0531076 + 5686fce commit f620323
Show file tree
Hide file tree
Showing 12 changed files with 385 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"bgw:dev": "nx dev @polar/client-bgw",
"generic:build": "nx build @polar/client-generic",
"diplan:build": "nx build @polar/client-diplan",
"diplan:build:serve": "http-server ./packages/clients/diplan -o /example/prod-example.html",
"diplan:build:serve": "http-server ./packages/clients/diplan -o /example/overview.html",
"diplan:dev": "nx dev @polar/client-diplan",
"dish:build": "nx build @polar/client-dish",
"dish:build:serve": "http-server ./packages/clients/dish -o /dist/index.html",
Expand Down
2 changes: 1 addition & 1 deletion packages/clients/diplan/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This document describes the `@polar/client-diplan`-specific configuration option

For all additional details, check the [full documentation](https://dataport.github.io/polar/docs/diplan/client-diplan.html) that is also delivered as part of the package within the `./docs` folder.

For our example client, [see here](./example/prod-example.html).
For our example clients, [see here](./example/overview.html).

## Configuration

Expand Down
13 changes: 13 additions & 0 deletions packages/clients/diplan/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Example structure

## `.`

The root folder holds files used in all clients. Modify with care. If you need wildly different files for an example, create new files in the relevant example folder.

## `dev`

This folder holds the development example used during development time. You may put anything in here as long as it serves the testing purposes. The client is not required to look good, but is a technical playground.

## all others

All other folders are examples used in the documentation deployed on the [GitHub page](https://dataport.github.io/polar/docs/diplan/example/overview.html). They are supposed to display usage variants and should be understandable/clean. These are supposed to be viewn both by the customer and integrators alike so that they can easily lift from the usage scenarios. They're also useful for testing PRs in build mode.
178 changes: 178 additions & 0 deletions packages/clients/diplan/example/dev/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// service id map to avoid typos, ease renames
const basemap = 'basemapde_farbe'
const xplanwms = 'xplanwms'
const xplanwfs = 'xplanwfs'
const flurstuecke = 'flurstuecke'
const bstgasleitung = 'bst_gasleitung'

export default {
startResolution: 264.583190458,
startCenter: [561210, 5932600],
extent: [
248651.73157077, 5227198.20287631, 928366.12236557, 6118661.62507136,
],
locales: [
{
type: 'de',
resources: {
diplan: {
layers: {
[basemap]: 'BasemapDE',
[xplanwms]: 'XPlanWMS',
[xplanwfs]: 'XPlanSynWFS',
[flurstuecke]: 'Flurstücke',
[bstgasleitung]: 'BST Gasleitung',
},
attributions: {
[basemap]: `$t(diplan.layers.${basemap}) © GeoBasis-DE / BKG <YEAR> CC BY 4.0`,
[xplanwms]: `$t(diplan.layers.${xplanwms}) © ???`,
[xplanwfs]: `$t(diplan.layers.${xplanwfs}) © ???`,
[flurstuecke]: `$t(diplan.layers.${flurstuecke}) © ???`,
[bstgasleitung]: `$t(diplan.layers.${bstgasleitung}) © ???`,
},
},
},
},
],
addressSearch: {
displayComponent: true,
searchMethods: [
{
queryParameters: {
searchAddress: true,
searchStreets: true,
searchHouseNumbers: true,
},
type: 'mpapi',
url: 'https://geodienste.hamburg.de/HH_WFS_GAGES?service=WFS&request=GetFeature&version=2.0.0',
},
],
minLength: 3,
waitMs: 300,
},
layers: [
{
id: basemap,
visibility: true,
type: 'background',
name: `diplan.layers.${basemap}`,
},
{
id: xplanwms,
visibility: true,
type: 'mask',
name: `diplan.layers.${xplanwms}`,
},
{
id: xplanwfs,
visibility: false,
type: 'mask',
name: `diplan.layers.${xplanwfs}`,
},
{
id: flurstuecke,
visibility: false,
// TODO available from 7, but only starts loading from 8 - bug or skill issue?
minZoom: 7,
type: 'mask',
name: `diplan.layers.${flurstuecke}`,
},
{
id: bstgasleitung,
visibility: false,
type: 'mask',
name: `diplan.layers.${bstgasleitung}`,
},
],
attributions: {
layerAttributions: [
{
id: basemap,
title: `diplan.attributions.${basemap}`,
},
{
id: xplanwms,
title: `diplan.attributions.${xplanwms}`,
},
{
id: xplanwfs,
title: `diplan.attributions.${xplanwfs}`,
},
{
id: flurstuecke,
title: `diplan.attributions.${flurstuecke}`,
},
{
id: bstgasleitung,
title: `diplan.attributions.${bstgasleitung}`,
},
],
},
draw: {
enableOptions: true,
lassos: [
{
id: flurstuecke,
},
{
id: xplanwfs,
},
],
measureOptions: {
metres: true,
kilometres: true,
hectares: true,
},
selectableDrawModes: ['Point', 'LineString', 'Circle', 'Text', 'Polygon'],
snapTo: [xplanwfs, flurstuecke],
textStyle: {
font: {
size: [10, 20, 30],
family: 'Arial',
},
},
style: {
fill: { color: 'rgb(51 117 212 / 50%)' },
stroke: {
color: '#3375d4',
width: 2,
},
circle: {
radius: 7,
fillColor: 'rgb(51 117 212 / 50%)',
},
},
},
export: {
displayComponent: true,
showJpg: false,
showPdf: false,
},
gfi: {
mode: 'bboxDot',
layers: {
[xplanwms]: {
geometry: true,
window: true,
properties: ['xpPlanName'],
},
[xplanwfs]: {
geometry: true,
window: true,
properties: ['name'],
},
},
coordinateSources: [
'plugin/pins/transformedCoordinate',
'plugin/pins/coordinatesAfterDrag',
],
},
pins: {
toZoomLevel: 9,
movable: 'drag',
appearOnClick: {
show: true,
atZoomLevel: 0,
},
},
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html>
<!-- test page -->
<!-- test page used during development -->
<head>
<meta charset="utf-8" />
<title>@polar/client-diplan</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="../style.css">
</head>
<body>
<nav></nav>
Expand Down Expand Up @@ -102,8 +102,8 @@ <h2>Informationen aus Kartenklient</h2>
</main>
<footer>At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles.</footer>
<script type="module">
import client from '../src/polar-client.ts'
import services from './services.js'
import client from '../../src/polar-client.ts'
import services from '../services.js'
import config from './config.js'

import setup from './setup.js'
Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions packages/clients/diplan/example/overview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<!-- test page -->
<head>
<meta charset="utf-8" />
<title>@polar/client-diplan – Übersicht</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<nav></nav>
<header>
<h1>Testseite @polar/client-diplan – Übersicht</h1>
</header>
<div id="somethingnice"></div>
<main>
<section>
<h2 class="padded-x">Beispielübersicht</h2>
<div class="padded-x">
<li><a href="./polar-ui">POLAR UI test client</a></li>
<li>DiPlan UI test client <span class="todo">TODO</span></li>
<li>Login test client <span class="todo">TODO</span></li>
<li>Data source test client <span class="todo">TODO</span></li>
</div>
</section>
</main>
<footer>At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles.</footer>
</body>
</html>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<head>
<meta charset="utf-8" />
<title>@polar/client-diplan</title>
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="../style.css">
</head>
<body>
<nav></nav>
<header>
<h1>Testseite <code>@polar/client-diplan</code> (build)</h1>
<h1>Testseite <code>@polar/client-diplan</code> (POLAR UI)</h1>
</header>
<div id="somethingnice"></div>
<main>
Expand Down Expand Up @@ -102,14 +102,14 @@ <h2>Informationen aus Kartenklient</h2>
</main>
<footer>At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles.</footer>
<!-- Example without build tools. Most frameworks will allow importing this. (Try "* as PolarClientDiPlan".) -->
<script src="../dist/polar-client.js"></script>
<script src="../../dist/polar-client.js"></script>
<!-- → window.PolarClientDiPlan is now available. -->
<link rel="stylesheet" src="../dist/polar-client.css">
<link rel="stylesheet" src="../../dist/polar-client.css">
<script type="module">
import services from './services.js'
import services from '../services.js'
import config from './config.js'

import setup from './setup.js'

setup(PolarClientDiPlan, services, config)
</script>
</body>
Expand Down
Loading

0 comments on commit f620323

Please sign in to comment.