@kispace-io/gs-lib 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/bin/map-builder.js +132 -0
- package/dist/base-map-builder.d.ts +102 -0
- package/dist/base-map-builder.d.ts.map +1 -0
- package/dist/gs-gs2ol.d.ts +41 -0
- package/dist/gs-gs2ol.d.ts.map +1 -0
- package/dist/gs-lib.css +3724 -0
- package/dist/gs-lib.d.ts +16 -0
- package/dist/gs-lib.d.ts.map +1 -0
- package/dist/gs-litns.d.ts +32 -0
- package/dist/gs-litns.d.ts.map +1 -0
- package/dist/gs-model.d.ts +186 -0
- package/dist/gs-model.d.ts.map +1 -0
- package/dist/gs-ol-adapters.d.ts +23 -0
- package/dist/gs-ol-adapters.d.ts.map +1 -0
- package/dist/gs-ol2gs.d.ts +9 -0
- package/dist/gs-ol2gs.d.ts.map +1 -0
- package/dist/gs-olns.d.ts +22 -0
- package/dist/gs-olns.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.html +69 -0
- package/dist/index.js +104888 -0
- package/dist/index.js.map +1 -0
- package/dist/pwa/assets/icons/192x192.png +0 -0
- package/dist/pwa/assets/icons/24x24.png +0 -0
- package/dist/pwa/assets/icons/48x48.png +0 -0
- package/dist/pwa/assets/icons/512x512.png +0 -0
- package/dist/pwa/assets/icons/icon_192.png +0 -0
- package/dist/pwa/assets/icons/icon_24.png +0 -0
- package/dist/pwa/assets/icons/icon_48.png +0 -0
- package/dist/pwa/assets/icons/icon_512.png +0 -0
- package/dist/pwa/manifest.json +54 -0
- package/dist/pwa/staticwebapp.config.json +6 -0
- package/dist/pwa/sw.js +109 -0
- package/lib/node-map-builder.ts +200 -0
- package/package.json +51 -0
- package/public/index.html +69 -0
- package/public/pwa/assets/icons/192x192.png +0 -0
- package/public/pwa/assets/icons/24x24.png +0 -0
- package/public/pwa/assets/icons/48x48.png +0 -0
- package/public/pwa/assets/icons/512x512.png +0 -0
- package/public/pwa/assets/icons/icon_192.png +0 -0
- package/public/pwa/assets/icons/icon_24.png +0 -0
- package/public/pwa/assets/icons/icon_48.png +0 -0
- package/public/pwa/assets/icons/icon_512.png +0 -0
- package/public/pwa/manifest.json +54 -0
- package/public/pwa/staticwebapp.config.json +6 -0
- package/public/pwa/sw.js +109 -0
- package/src/base-map-builder.ts +414 -0
- package/src/gs-gs2ol.ts +626 -0
- package/src/gs-lib.ts +54 -0
- package/src/gs-litns.ts +213 -0
- package/src/gs-model.ts +393 -0
- package/src/gs-ol-adapters.ts +89 -0
- package/src/gs-ol2gs.ts +86 -0
- package/src/gs-olns.ts +30 -0
- package/src/index.ts +15 -0
- package/tsconfig.json +23 -0
package/src/gs-ol2gs.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {Feature} from "ol";
|
|
2
|
+
import * as olGeom from "ol/geom";
|
|
3
|
+
import {
|
|
4
|
+
GsFeature,
|
|
5
|
+
GsGeometry,
|
|
6
|
+
GsLayerType,
|
|
7
|
+
GsSourceType,
|
|
8
|
+
GsState,
|
|
9
|
+
KEY_STATE,
|
|
10
|
+
KEY_UUID
|
|
11
|
+
} from "./gs-model";
|
|
12
|
+
import BaseObject from "ol/Object";
|
|
13
|
+
|
|
14
|
+
export const toGsLayerType = (tag: string) => {
|
|
15
|
+
switch (tag?.toLowerCase()) {
|
|
16
|
+
case "osm":
|
|
17
|
+
case "bing":
|
|
18
|
+
case "google":
|
|
19
|
+
case "geotiff":
|
|
20
|
+
case "wms":
|
|
21
|
+
case "wmts":
|
|
22
|
+
case "xyz":
|
|
23
|
+
return GsLayerType.TILE
|
|
24
|
+
case "bm":
|
|
25
|
+
case "basemap.de":
|
|
26
|
+
return GsLayerType.GROUP
|
|
27
|
+
default:
|
|
28
|
+
return GsLayerType.VECTOR
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const toGsSourceType = (tag: string) => {
|
|
33
|
+
if (tag) {
|
|
34
|
+
tag = tag.toLowerCase()
|
|
35
|
+
const sourceTypes = Object.values(GsSourceType)
|
|
36
|
+
const hit = sourceTypes.find(t => tag === t.toLowerCase())
|
|
37
|
+
if (hit) {
|
|
38
|
+
return hit
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
throw new Error("Unsupported source type: " + tag)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const toSourceUrl = (sourceType: GsSourceType) => {
|
|
45
|
+
switch (sourceType) {
|
|
46
|
+
case GsSourceType.BM:
|
|
47
|
+
return "https://sgx.geodatenzentrum.de/gdz_basemapworld_vektor/styles/bm_web_wld_col.json"
|
|
48
|
+
}
|
|
49
|
+
return undefined
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const withGsState = <T extends GsState>(olObj: BaseObject, gsState: T): T => {
|
|
53
|
+
// Get state first (contains original domain model data including UUID)
|
|
54
|
+
const state = olObj.get(KEY_STATE)
|
|
55
|
+
gsState.state = state
|
|
56
|
+
|
|
57
|
+
// Preserve UUID if it exists (from domain model or previously assigned)
|
|
58
|
+
// Priority: 1) UUID from state (original from domain model), 2) KEY_UUID (synced during conversion)
|
|
59
|
+
// Do NOT generate UUIDs here - external features or unmanaged features should remain without UUIDs
|
|
60
|
+
if (state?.uuid) {
|
|
61
|
+
gsState.uuid = state.uuid
|
|
62
|
+
} else {
|
|
63
|
+
const uuid = olObj.get(KEY_UUID)
|
|
64
|
+
if (uuid) {
|
|
65
|
+
gsState.uuid = uuid
|
|
66
|
+
}
|
|
67
|
+
// If no UUID exists, leave it undefined (feature is external/unmanaged)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return gsState
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function toGsGeometry(geometry: olGeom.SimpleGeometry): GsGeometry {
|
|
74
|
+
return withGsState(geometry, {
|
|
75
|
+
type: geometry.getType(),
|
|
76
|
+
coordinates: geometry.getCoordinates()
|
|
77
|
+
} as GsGeometry)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function toGsFeature(feature: Feature) {
|
|
81
|
+
return withGsState(feature, {
|
|
82
|
+
geometry: toGsGeometry(feature.getGeometry() as olGeom.SimpleGeometry)
|
|
83
|
+
} as GsFeature)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
package/src/gs-olns.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenLayers library re-exports
|
|
3
|
+
* Centralized re-exports for OpenLayers to provide a single source of truth.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Re-export all OpenLayers core exports
|
|
7
|
+
export *from "ol";
|
|
8
|
+
export type { FeatureLike } from "ol/Feature";
|
|
9
|
+
|
|
10
|
+
// Re-export OpenLayers namespaces
|
|
11
|
+
export * as geom from "ol/geom";
|
|
12
|
+
export * as layer from "ol/layer";
|
|
13
|
+
export * as source from "ol/source";
|
|
14
|
+
export * as style from "ol/style";
|
|
15
|
+
export * as format from "ol/format";
|
|
16
|
+
export * as interaction from "ol/interaction";
|
|
17
|
+
export * as proj from "ol/proj";
|
|
18
|
+
export * as sphere from "ol/sphere";
|
|
19
|
+
export * as extent from "ol/extent";
|
|
20
|
+
export * as events from "ol/events";
|
|
21
|
+
export * as eventsCondition from "ol/events/condition";
|
|
22
|
+
|
|
23
|
+
export { default as BaseLayer } from "ol/layer/Base";
|
|
24
|
+
|
|
25
|
+
// Re-export ol-mapbox-style
|
|
26
|
+
export { apply as applyMapboxStyle } from "ol-mapbox-style";
|
|
27
|
+
|
|
28
|
+
// Re-export commonly used defaults
|
|
29
|
+
export { defaults as defaultControls } from "ol/control/defaults";
|
|
30
|
+
export { defaults as defaultInteractions } from "ol/interaction/defaults";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./gs-model"
|
|
2
|
+
export * from "./gs-gs2ol"
|
|
3
|
+
export * from "./gs-ol2gs"
|
|
4
|
+
export * from "./gs-ol-adapters"
|
|
5
|
+
export * from "./gs-lib"
|
|
6
|
+
// Re-export OpenLayers for convenience
|
|
7
|
+
export * from "./gs-olns"
|
|
8
|
+
// map-builder is only used by build service - export explicitly to avoid tree-shaking issues
|
|
9
|
+
export { buildMap, generateAppJs, processServiceWorker, processManifest, processHtml, bundleApp, type BuildOptions, type FileSystem, type GsLibFileCopier, type ProgressCallback } from "./base-map-builder"
|
|
10
|
+
|
|
11
|
+
export const rtUtils = {
|
|
12
|
+
async resolveUrl(url: string) {
|
|
13
|
+
return url
|
|
14
|
+
}
|
|
15
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["ES2022", "DOM"],
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationMap": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"experimentalDecorators": true,
|
|
14
|
+
"useDefineForClassFields": false,
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@kispace-io/appspace": ["../appspace/src"],
|
|
18
|
+
"@kispace-io/appspace/*": ["../appspace/src/*"]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"]
|
|
22
|
+
}
|
|
23
|
+
|