@lbdudc/gp-gis-dsl 0.2.6 → 0.3.1

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.
@@ -1,30 +1,30 @@
1
- export default class WMSLayer {
2
- constructor(id, label) {
3
- this.name = id;
4
- this.type = "wms";
5
- this.label = label;
6
- this.list = null;
7
- this.layers = [];
8
- this.availableStyles = [];
9
- this.defaultStyles = [];
10
- }
11
-
12
- getId() {
13
- return this.name;
14
- }
15
-
16
- addSubLayer(entityId, style) {
17
- this.list = entityId;
18
- this.layers.push(entityId);
19
- if (style) this.availableStyles.push(style);
20
- this.defaultStyles = style;
21
- }
22
-
23
- toString() {
24
- return `WMSLayer(${this.name} as ${this.label}) - ${
25
- this.layers.length
26
- } sublayers for entities ${this.layers
27
- .map((sl) => sl.entityId)
28
- .join(", ")}`;
29
- }
30
- }
1
+ export default class WMSLayer {
2
+ constructor(id, label) {
3
+ this.name = id;
4
+ this.type = "wms";
5
+ this.label = label;
6
+ this.list = null;
7
+ this.layers = [];
8
+ this.availableStyles = [];
9
+ this.defaultStyles = [];
10
+ }
11
+
12
+ getId() {
13
+ return this.name;
14
+ }
15
+
16
+ addSubLayer(entityId, style) {
17
+ this.list = entityId;
18
+ this.layers.push(entityId);
19
+ if (style) this.availableStyles.push(style);
20
+ this.defaultStyles = style;
21
+ }
22
+
23
+ toString() {
24
+ return `WMSLayer(${this.name} as ${this.label}) - ${
25
+ this.layers.length
26
+ } sublayers for entities ${this.layers
27
+ .map((sl) => sl.entityId)
28
+ .join(", ")}`;
29
+ }
30
+ }
@@ -0,0 +1,40 @@
1
+ import WMSLayer from "./WMSLayer.js";
2
+
3
+ export default class WMSServiceLayer extends WMSLayer {
4
+ constructor({
5
+ id,
6
+ label,
7
+ url,
8
+ layerName,
9
+ format,
10
+ crs,
11
+ bbox,
12
+ styles = [],
13
+ queryable = false,
14
+ attribution = null,
15
+ version,
16
+ }) {
17
+ super(id, label);
18
+
19
+ this.type = "wms";
20
+ this.external = true;
21
+
22
+ this.url = url;
23
+ this.layerName = layerName;
24
+ this.format = format;
25
+ this.crs = crs;
26
+ this.bbox = bbox;
27
+ this.version = version;
28
+
29
+ this.styles = styles;
30
+ this.defaultStyles = styles?.[0] || null;
31
+ this.queryable = queryable;
32
+ this.attribution = attribution;
33
+
34
+ this.visible = true;
35
+ this.opacity = 1.0;
36
+
37
+ this.layers = [layerName];
38
+ this.availableStyles = styles;
39
+ }
40
+ }
@@ -1,13 +1,13 @@
1
- export default class WMSStyle {
2
- constructor(id, sldPath) {
3
- this.name = id;
4
- this.type = "WMSLayerSLDStyle";
5
- this.cached = true;
6
- this.sldPath = sldPath;
7
- this.sld = `@include:${sldPath}`;
8
- }
9
-
10
- getId() {
11
- return this.name;
12
- }
13
- }
1
+ export default class WMSStyle {
2
+ constructor(id, sldPath) {
3
+ this.name = id;
4
+ this.type = "WMSLayerSLDStyle";
5
+ this.cached = true;
6
+ this.sldPath = sldPath;
7
+ this.sld = `@include:${sldPath}`;
8
+ }
9
+
10
+ getId() {
11
+ return this.name;
12
+ }
13
+ }
@@ -1,22 +1,22 @@
1
- export default class WMSStyleCustom {
2
- constructor(
3
- id,
4
- geometryType,
5
- fillColor,
6
- strokeColor,
7
- fillOpacity,
8
- strokeOpacity,
9
- ) {
10
- this.name = id;
11
- this.type = "WMSLayerStyle";
12
- this.geometryType = geometryType;
13
- this.fillColor = fillColor;
14
- this.strokeColor = strokeColor;
15
- this.fillOpacity = fillOpacity;
16
- this.strokeOpacity = strokeOpacity;
17
- }
18
-
19
- getId() {
20
- return this.name;
21
- }
22
- }
1
+ export default class WMSStyleCustom {
2
+ constructor(
3
+ id,
4
+ geometryType,
5
+ fillColor,
6
+ strokeColor,
7
+ fillOpacity,
8
+ strokeOpacity,
9
+ ) {
10
+ this.name = id;
11
+ this.type = "WMSLayerStyle";
12
+ this.geometryType = geometryType;
13
+ this.fillColor = fillColor;
14
+ this.strokeColor = strokeColor;
15
+ this.fillOpacity = fillOpacity;
16
+ this.strokeOpacity = strokeOpacity;
17
+ }
18
+
19
+ getId() {
20
+ return this.name;
21
+ }
22
+ }
package/src/store.js CHANGED
@@ -1,74 +1,74 @@
1
- const store = {
2
- products: [],
3
- currentProduct: null,
4
- currentEntity: null,
5
- lastGeneratedProduct: null,
6
- };
7
-
8
- function getProducts() {
9
- return store.products;
10
- }
11
-
12
- function getCurrentProduct() {
13
- return store.currentProduct;
14
- }
15
-
16
- function setCurrentProduct(productName) {
17
- if (!productName) {
18
- store.currentProduct = null;
19
- } else {
20
- store.currentProduct = getProduct(productName);
21
- if (!store.currentProduct) {
22
- throw `GIS ${productName} does not exist!!!`;
23
- }
24
- }
25
- }
26
-
27
- function getCurrentEntity() {
28
- return store.currentEntity;
29
- }
30
-
31
- function setCurrentEntity(entityName) {
32
- if (!entityName) {
33
- store.currentEntity = null;
34
- } else {
35
- store.currentEntity = getCurrentProduct().getEntity(entityName);
36
- if (!store.currentEntity) {
37
- throw `Entity ${entityName} does not exist in current product!!!`;
38
- }
39
- }
40
- }
41
-
42
- function getProduct(name) {
43
- return store.products.find((e) => e.name == name);
44
- }
45
-
46
- function addProduct(id, product) {
47
- store.products.push(product);
48
- }
49
-
50
- function getLastGeneratedProduct() {
51
- return store.lastGeneratedProduct;
52
- }
53
-
54
- function setLastGeneratedProduct(generatedProduct) {
55
- store.lastGeneratedProduct = generatedProduct;
56
- }
57
-
58
- function reset() {
59
- store.products.splice(0, store.products.length);
60
- store.lastGeneratedProduct = null;
61
- }
62
-
63
- export default {
64
- getCurrentProduct,
65
- setCurrentProduct,
66
- getCurrentEntity,
67
- setCurrentEntity,
68
- getProducts,
69
- getProduct,
70
- addProduct,
71
- getLastGeneratedProduct,
72
- setLastGeneratedProduct,
73
- reset,
74
- };
1
+ const store = {
2
+ products: [],
3
+ currentProduct: null,
4
+ currentEntity: null,
5
+ lastGeneratedProduct: null,
6
+ };
7
+
8
+ function getProducts() {
9
+ return store.products;
10
+ }
11
+
12
+ function getCurrentProduct() {
13
+ return store.currentProduct;
14
+ }
15
+
16
+ function setCurrentProduct(productName) {
17
+ if (!productName) {
18
+ store.currentProduct = null;
19
+ } else {
20
+ store.currentProduct = getProduct(productName);
21
+ if (!store.currentProduct) {
22
+ throw `GIS ${productName} does not exist!!!`;
23
+ }
24
+ }
25
+ }
26
+
27
+ function getCurrentEntity() {
28
+ return store.currentEntity;
29
+ }
30
+
31
+ function setCurrentEntity(entityName) {
32
+ if (!entityName) {
33
+ store.currentEntity = null;
34
+ } else {
35
+ store.currentEntity = getCurrentProduct().getEntity(entityName);
36
+ if (!store.currentEntity) {
37
+ throw `Entity ${entityName} does not exist in current product!!!`;
38
+ }
39
+ }
40
+ }
41
+
42
+ function getProduct(name) {
43
+ return store.products.find((e) => e.name == name);
44
+ }
45
+
46
+ function addProduct(id, product) {
47
+ store.products.push(product);
48
+ }
49
+
50
+ function getLastGeneratedProduct() {
51
+ return store.lastGeneratedProduct;
52
+ }
53
+
54
+ function setLastGeneratedProduct(generatedProduct) {
55
+ store.lastGeneratedProduct = generatedProduct;
56
+ }
57
+
58
+ function reset() {
59
+ store.products.splice(0, store.products.length);
60
+ store.lastGeneratedProduct = null;
61
+ }
62
+
63
+ export default {
64
+ getCurrentProduct,
65
+ setCurrentProduct,
66
+ getCurrentEntity,
67
+ setCurrentEntity,
68
+ getProducts,
69
+ getProduct,
70
+ addProduct,
71
+ getLastGeneratedProduct,
72
+ setLastGeneratedProduct,
73
+ reset,
74
+ };