@lbdudc/gp-gis-dsl 0.2.1 → 0.2.2
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/grammar/GISGrammar.g4 +240 -230
- package/package.json +54 -54
- package/src/GISVisitor.js +368 -318
- package/src/GISVisitorHelper.js +93 -162
- package/src/cli.js +34 -34
- package/src/error/ErrorListener.js +26 -26
- package/src/features.js +72 -0
- package/src/index.js +26 -26
- package/src/lib/GISGrammar.interp +144 -140
- package/src/lib/GISGrammar.tokens +45 -44
- package/src/lib/GISGrammarLexer.interp +204 -201
- package/src/lib/GISGrammarLexer.js +287 -279
- package/src/lib/GISGrammarLexer.tokens +45 -44
- package/src/lib/GISGrammarListener.js +19 -1
- package/src/lib/GISGrammarParser.js +724 -365
- package/src/lib/GISGrammarVisitor.js +13 -1
- package/src/spl/GIS.js +234 -234
- package/src/spl/GeoJSONLayer.js +21 -21
- package/src/spl/GeoJSONLayerStyle.js +14 -14
- package/src/spl/Map.js +53 -44
- package/src/spl/TileLayer.js +16 -16
- package/src/spl/WMSLayer.js +30 -30
- package/src/spl/WMSStyle.js +13 -13
- package/src/spl/WMSStyleCustom.js +22 -0
- package/src/store.js +74 -74
package/src/spl/TileLayer.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export default class TileLayer {
|
|
2
|
-
constructor(id, label, url) {
|
|
3
|
-
this.name = id;
|
|
4
|
-
this.type = "tilelayer";
|
|
5
|
-
this.label = label;
|
|
6
|
-
this.url = url;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
getId() {
|
|
10
|
-
return this.name;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
toString() {
|
|
14
|
-
return `TileLayer(${this.name} as ${this.label}) with url ${this.url}`;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
export default class TileLayer {
|
|
2
|
+
constructor(id, label, url) {
|
|
3
|
+
this.name = id;
|
|
4
|
+
this.type = "tilelayer";
|
|
5
|
+
this.label = label;
|
|
6
|
+
this.url = url;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getId() {
|
|
10
|
+
return this.name;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
toString() {
|
|
14
|
+
return `TileLayer(${this.name} as ${this.label}) with url ${this.url}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/spl/WMSLayer.js
CHANGED
|
@@ -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
|
-
this.defaultStyles = style;
|
|
20
|
-
this.availableStyles.push(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
|
+
this.defaultStyles = style;
|
|
20
|
+
this.availableStyles.push(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
|
+
}
|
package/src/spl/WMSStyle.js
CHANGED
|
@@ -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
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
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
|
+
};
|