@lbdudc/gp-gis-dsl 0.2.3 → 0.2.5
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/package.json +54 -54
- package/src/GISVisitorHelper.js +93 -93
- package/src/cli.js +34 -34
- package/src/error/ErrorListener.js +26 -26
- package/src/features.js +53 -53
- package/src/index.js +26 -26
- package/src/spl/GIS.js +234 -234
- package/src/spl/GeoJSONLayer.js +21 -21
- package/src/spl/GeoJSONLayerStyle.js +14 -14
- package/src/spl/TileLayer.js +16 -16
- package/src/spl/WMSLayer.js +30 -30
- package/src/spl/WMSStyle.js +13 -13
- package/src/store.js +74 -74
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lbdudc/gp-gis-dsl",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"homepage": "https://github.com/lbdudc/gis-dsl#readme",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/lbdudc/gis-dsl.git"
|
|
8
|
-
},
|
|
9
|
-
"description": "A library that parses a DSL instance and generates the spec for the web-based GIS SPL.",
|
|
10
|
-
"bin": {
|
|
11
|
-
"gis-dsl": "src/cli.js"
|
|
12
|
-
},
|
|
13
|
-
"main": "src/index.js",
|
|
14
|
-
"type": "module",
|
|
15
|
-
"author": "Álex Cortiñas",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"antlr4": "^4.13.0",
|
|
18
|
-
"meow": "^12.0.1",
|
|
19
|
-
"mocha": "^10.2.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"eslint": "^8.54.0",
|
|
23
|
-
"eslint-config-prettier": "^9.0.0",
|
|
24
|
-
"eslint-plugin-prettier": "^5.0.1",
|
|
25
|
-
"husky": "^8.0.3",
|
|
26
|
-
"lint-staged": "^15.1.0",
|
|
27
|
-
"npm-run-all": "^4.1.5",
|
|
28
|
-
"prettier": "^3.1.0",
|
|
29
|
-
"strip-bom": "^5.0.0"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [
|
|
32
|
-
"gis",
|
|
33
|
-
"dsl"
|
|
34
|
-
],
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"lint-staged": {
|
|
37
|
-
"*.{json,md,yml}": "prettier --write",
|
|
38
|
-
"*.{js}": [
|
|
39
|
-
"eslint --fix",
|
|
40
|
-
"prettier --write"
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build-grammar": "antlr -Dlanguage=JavaScript -lib grammar -o src/lib -visitor -Xexact-output-dir grammar/GISGrammar.g4",
|
|
45
|
-
"eslint": "eslint --ext js src",
|
|
46
|
-
"eslint:fix": "eslint --ext js --fix src",
|
|
47
|
-
"lint": "npm-run-all eslint prettier",
|
|
48
|
-
"lint:fix": "npm-run-all eslint:fix prettier:fix",
|
|
49
|
-
"prettier": "prettier --check --ignore-unknown src",
|
|
50
|
-
"prettier:fix": "prettier --write --ignore-unknown src",
|
|
51
|
-
"prepare": "husky install",
|
|
52
|
-
"test": "mocha --ui qunit"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@lbdudc/gp-gis-dsl",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"homepage": "https://github.com/lbdudc/gis-dsl#readme",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/lbdudc/gis-dsl.git"
|
|
8
|
+
},
|
|
9
|
+
"description": "A library that parses a DSL instance and generates the spec for the web-based GIS SPL.",
|
|
10
|
+
"bin": {
|
|
11
|
+
"gis-dsl": "src/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"main": "src/index.js",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"author": "Álex Cortiñas",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"antlr4": "^4.13.0",
|
|
18
|
+
"meow": "^12.0.1",
|
|
19
|
+
"mocha": "^10.2.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"eslint": "^8.54.0",
|
|
23
|
+
"eslint-config-prettier": "^9.0.0",
|
|
24
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
25
|
+
"husky": "^8.0.3",
|
|
26
|
+
"lint-staged": "^15.1.0",
|
|
27
|
+
"npm-run-all": "^4.1.5",
|
|
28
|
+
"prettier": "^3.1.0",
|
|
29
|
+
"strip-bom": "^5.0.0"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"gis",
|
|
33
|
+
"dsl"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"lint-staged": {
|
|
37
|
+
"*.{json,md,yml}": "prettier --write",
|
|
38
|
+
"*.{js}": [
|
|
39
|
+
"eslint --fix",
|
|
40
|
+
"prettier --write"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build-grammar": "antlr -Dlanguage=JavaScript -lib grammar -o src/lib -visitor -Xexact-output-dir grammar/GISGrammar.g4",
|
|
45
|
+
"eslint": "eslint --ext js src",
|
|
46
|
+
"eslint:fix": "eslint --ext js --fix src",
|
|
47
|
+
"lint": "npm-run-all eslint prettier",
|
|
48
|
+
"lint:fix": "npm-run-all eslint:fix prettier:fix",
|
|
49
|
+
"prettier": "prettier --check --ignore-unknown src",
|
|
50
|
+
"prettier:fix": "prettier --write --ignore-unknown src",
|
|
51
|
+
"prepare": "husky install",
|
|
52
|
+
"test": "mocha --ui qunit"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/GISVisitorHelper.js
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import features from "./features.js";
|
|
2
|
-
|
|
3
|
-
function transformation(spec) {
|
|
4
|
-
_relationships(spec);
|
|
5
|
-
const newSpec = {
|
|
6
|
-
features: features,
|
|
7
|
-
basicData: {
|
|
8
|
-
name: spec.name,
|
|
9
|
-
},
|
|
10
|
-
data: {
|
|
11
|
-
dataModel: {
|
|
12
|
-
entities: spec.entities,
|
|
13
|
-
enums: [],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
mapViewer: {
|
|
17
|
-
maps: spec.maps,
|
|
18
|
-
layers: spec.layers,
|
|
19
|
-
styles: spec.styles,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
if (spec.extra) {
|
|
24
|
-
newSpec.basicData.extra = spec.extra;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return newSpec;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function _relationships(spec) {
|
|
31
|
-
let source, target;
|
|
32
|
-
|
|
33
|
-
spec.relationships.forEach((r) => {
|
|
34
|
-
source = spec.getEntity(r.source);
|
|
35
|
-
target = spec.getEntity(r.target);
|
|
36
|
-
let sourceOwner = false;
|
|
37
|
-
let targetOwner = false;
|
|
38
|
-
let sourceMultiple = _multiple(r.sourceOpts.multiplicity);
|
|
39
|
-
let targetMultiple = _multiple(r.targetOpts.multiplicity);
|
|
40
|
-
if (sourceMultiple && !targetMultiple) {
|
|
41
|
-
targetOwner = true;
|
|
42
|
-
} else {
|
|
43
|
-
sourceOwner = true;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
source.properties.push({
|
|
47
|
-
name: r.sourceOpts.label,
|
|
48
|
-
class: target.name,
|
|
49
|
-
owner: sourceOwner,
|
|
50
|
-
bidirectional: r.targetOpts.label,
|
|
51
|
-
multiple: sourceMultiple,
|
|
52
|
-
required: _required(r.sourceOpts.multiplicity),
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
target.properties.push({
|
|
56
|
-
name: r.targetOpts.label,
|
|
57
|
-
class: source.name,
|
|
58
|
-
owner: targetOwner,
|
|
59
|
-
bidirectional: r.sourceOpts.label,
|
|
60
|
-
multiple: targetMultiple,
|
|
61
|
-
required: _required(r.targetOpts.multiplicity),
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _multiple(multiplicity) {
|
|
67
|
-
return ["1..1", "0..1"].find((a) => a == multiplicity) == null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function _required(multiplicity) {
|
|
71
|
-
return ["1..1", "1..*"].find((a) => a == multiplicity) != null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function getPropertyParams(symbols) {
|
|
75
|
-
if (!symbols.length) return null;
|
|
76
|
-
|
|
77
|
-
const ret = {};
|
|
78
|
-
if (symbols.includes("identifier")) {
|
|
79
|
-
ret.pk = true;
|
|
80
|
-
}
|
|
81
|
-
if (symbols.includes("required")) {
|
|
82
|
-
ret.required = true;
|
|
83
|
-
}
|
|
84
|
-
if (symbols.includes("unique")) {
|
|
85
|
-
ret.unique = true;
|
|
86
|
-
}
|
|
87
|
-
if (symbols.includes("display_string")) {
|
|
88
|
-
ret.displayString = true;
|
|
89
|
-
}
|
|
90
|
-
return ret;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export { transformation, getPropertyParams };
|
|
1
|
+
import features from "./features.js";
|
|
2
|
+
|
|
3
|
+
function transformation(spec) {
|
|
4
|
+
_relationships(spec);
|
|
5
|
+
const newSpec = {
|
|
6
|
+
features: features,
|
|
7
|
+
basicData: {
|
|
8
|
+
name: spec.name,
|
|
9
|
+
},
|
|
10
|
+
data: {
|
|
11
|
+
dataModel: {
|
|
12
|
+
entities: spec.entities,
|
|
13
|
+
enums: [],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
mapViewer: {
|
|
17
|
+
maps: spec.maps,
|
|
18
|
+
layers: spec.layers,
|
|
19
|
+
styles: spec.styles,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
if (spec.extra) {
|
|
24
|
+
newSpec.basicData.extra = spec.extra;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return newSpec;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function _relationships(spec) {
|
|
31
|
+
let source, target;
|
|
32
|
+
|
|
33
|
+
spec.relationships.forEach((r) => {
|
|
34
|
+
source = spec.getEntity(r.source);
|
|
35
|
+
target = spec.getEntity(r.target);
|
|
36
|
+
let sourceOwner = false;
|
|
37
|
+
let targetOwner = false;
|
|
38
|
+
let sourceMultiple = _multiple(r.sourceOpts.multiplicity);
|
|
39
|
+
let targetMultiple = _multiple(r.targetOpts.multiplicity);
|
|
40
|
+
if (sourceMultiple && !targetMultiple) {
|
|
41
|
+
targetOwner = true;
|
|
42
|
+
} else {
|
|
43
|
+
sourceOwner = true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
source.properties.push({
|
|
47
|
+
name: r.sourceOpts.label,
|
|
48
|
+
class: target.name,
|
|
49
|
+
owner: sourceOwner,
|
|
50
|
+
bidirectional: r.targetOpts.label,
|
|
51
|
+
multiple: sourceMultiple,
|
|
52
|
+
required: _required(r.sourceOpts.multiplicity),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
target.properties.push({
|
|
56
|
+
name: r.targetOpts.label,
|
|
57
|
+
class: source.name,
|
|
58
|
+
owner: targetOwner,
|
|
59
|
+
bidirectional: r.sourceOpts.label,
|
|
60
|
+
multiple: targetMultiple,
|
|
61
|
+
required: _required(r.targetOpts.multiplicity),
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function _multiple(multiplicity) {
|
|
67
|
+
return ["1..1", "0..1"].find((a) => a == multiplicity) == null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _required(multiplicity) {
|
|
71
|
+
return ["1..1", "1..*"].find((a) => a == multiplicity) != null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getPropertyParams(symbols) {
|
|
75
|
+
if (!symbols.length) return null;
|
|
76
|
+
|
|
77
|
+
const ret = {};
|
|
78
|
+
if (symbols.includes("identifier")) {
|
|
79
|
+
ret.pk = true;
|
|
80
|
+
}
|
|
81
|
+
if (symbols.includes("required")) {
|
|
82
|
+
ret.required = true;
|
|
83
|
+
}
|
|
84
|
+
if (symbols.includes("unique")) {
|
|
85
|
+
ret.unique = true;
|
|
86
|
+
}
|
|
87
|
+
if (symbols.includes("display_string")) {
|
|
88
|
+
ret.displayString = true;
|
|
89
|
+
}
|
|
90
|
+
return ret;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { transformation, getPropertyParams };
|
package/src/cli.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import meow from "meow";
|
|
4
|
-
import fs from "fs";
|
|
5
|
-
import gisdslParser from "./index.js";
|
|
6
|
-
import path from "path";
|
|
7
|
-
|
|
8
|
-
const usage = "Usage: gisdsl input output";
|
|
9
|
-
|
|
10
|
-
const cli = meow(usage, {
|
|
11
|
-
importMeta: import.meta,
|
|
12
|
-
flags: {
|
|
13
|
-
debug: {
|
|
14
|
-
type: "boolean",
|
|
15
|
-
default: false,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (cli.input.length < 2) {
|
|
21
|
-
cli.showHelp();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const inputPath = path.resolve(process.cwd(), cli.input.at(0));
|
|
25
|
-
const input = fs.readFileSync(inputPath, {
|
|
26
|
-
encoding: "utf-8",
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const spec = gisdslParser(input, cli.flags.debug);
|
|
30
|
-
|
|
31
|
-
const outputPath = path.resolve(process.cwd(), cli.input.at(1));
|
|
32
|
-
fs.writeFileSync(outputPath, JSON.stringify(spec, null, 2), "utf8");
|
|
33
|
-
|
|
34
|
-
console.log(`File ${cli.input.at(1)} generated`);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import meow from "meow";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import gisdslParser from "./index.js";
|
|
6
|
+
import path from "path";
|
|
7
|
+
|
|
8
|
+
const usage = "Usage: gisdsl input output";
|
|
9
|
+
|
|
10
|
+
const cli = meow(usage, {
|
|
11
|
+
importMeta: import.meta,
|
|
12
|
+
flags: {
|
|
13
|
+
debug: {
|
|
14
|
+
type: "boolean",
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (cli.input.length < 2) {
|
|
21
|
+
cli.showHelp();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const inputPath = path.resolve(process.cwd(), cli.input.at(0));
|
|
25
|
+
const input = fs.readFileSync(inputPath, {
|
|
26
|
+
encoding: "utf-8",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const spec = gisdslParser(input, cli.flags.debug);
|
|
30
|
+
|
|
31
|
+
const outputPath = path.resolve(process.cwd(), cli.input.at(1));
|
|
32
|
+
fs.writeFileSync(outputPath, JSON.stringify(spec, null, 2), "utf8");
|
|
33
|
+
|
|
34
|
+
console.log(`File ${cli.input.at(1)} generated`);
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import antlr4 from "antlr4";
|
|
2
|
-
|
|
3
|
-
import SyntaxGenericError from "./SyntaxGenericError.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom Error Listener
|
|
7
|
-
*
|
|
8
|
-
* @returns {object}
|
|
9
|
-
*/
|
|
10
|
-
class ErrorListener extends antlr4.error.ErrorListener {
|
|
11
|
-
/**
|
|
12
|
-
* Checks syntax error
|
|
13
|
-
*
|
|
14
|
-
* @param {object} recognizer The parsing support code essentially. Most of it is error recovery stuff
|
|
15
|
-
* @param {object} symbol Offending symbol
|
|
16
|
-
* @param {int} line Line of offending symbol
|
|
17
|
-
* @param {int} column Position in line of offending symbol
|
|
18
|
-
* @param {string} message Error message
|
|
19
|
-
* @param {string} payload Stack trace
|
|
20
|
-
*/
|
|
21
|
-
syntaxError(recognizer, symbol, line, column, message) {
|
|
22
|
-
throw new SyntaxGenericError({ line, column, message });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default ErrorListener;
|
|
1
|
+
import antlr4 from "antlr4";
|
|
2
|
+
|
|
3
|
+
import SyntaxGenericError from "./SyntaxGenericError.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Custom Error Listener
|
|
7
|
+
*
|
|
8
|
+
* @returns {object}
|
|
9
|
+
*/
|
|
10
|
+
class ErrorListener extends antlr4.error.ErrorListener {
|
|
11
|
+
/**
|
|
12
|
+
* Checks syntax error
|
|
13
|
+
*
|
|
14
|
+
* @param {object} recognizer The parsing support code essentially. Most of it is error recovery stuff
|
|
15
|
+
* @param {object} symbol Offending symbol
|
|
16
|
+
* @param {int} line Line of offending symbol
|
|
17
|
+
* @param {int} column Position in line of offending symbol
|
|
18
|
+
* @param {string} message Error message
|
|
19
|
+
* @param {string} payload Stack trace
|
|
20
|
+
*/
|
|
21
|
+
syntaxError(recognizer, symbol, line, column, message) {
|
|
22
|
+
throw new SyntaxGenericError({ line, column, message });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default ErrorListener;
|
package/src/features.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
export default [
|
|
2
|
-
"MapViewer",
|
|
3
|
-
"Tools",
|
|
4
|
-
"DM_SpatialDatabase",
|
|
5
|
-
"DM_GenerationType",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"DM_DataInput",
|
|
46
|
-
"DM_DI_DataFeeding",
|
|
47
|
-
"DM_DI_DF_Shapefile",
|
|
48
|
-
"T_GIS",
|
|
49
|
-
"T_EntitiesInformation",
|
|
50
|
-
"D_C_Postgres",
|
|
51
|
-
"D_C_Geoserver",
|
|
52
|
-
"D_C_Nginx",
|
|
53
|
-
];
|
|
1
|
+
export default [
|
|
2
|
+
"MapViewer",
|
|
3
|
+
"Tools",
|
|
4
|
+
"DM_SpatialDatabase",
|
|
5
|
+
"DM_GenerationType",
|
|
6
|
+
"MV_MapServer",
|
|
7
|
+
"MV_Tools",
|
|
8
|
+
"MV_MapManagement",
|
|
9
|
+
"DM_SD_PostGIS",
|
|
10
|
+
"DM_GT_Sequence",
|
|
11
|
+
"MV_MM_MultipleMapViewer",
|
|
12
|
+
"MV_MM_MMV_MapSelectorInMapViewer",
|
|
13
|
+
"MV_MM_MMV_MapSelectorInMenuElement",
|
|
14
|
+
"MV_MS_GeoServer",
|
|
15
|
+
"GUI_Lists",
|
|
16
|
+
"GUI_L_FormLink",
|
|
17
|
+
"GUI_L_F_BasicSearch",
|
|
18
|
+
"GUI_L_Filterable",
|
|
19
|
+
"GUI_L_Sortable",
|
|
20
|
+
"GUI_L_LocateInMap",
|
|
21
|
+
"GUI_L_ViewListAsMap",
|
|
22
|
+
"MV_ContextInformation",
|
|
23
|
+
"MV_CI_Scale",
|
|
24
|
+
"MV_CI_Map",
|
|
25
|
+
"MV_CI_CenterCoordinates",
|
|
26
|
+
"MV_CI_Dimensions",
|
|
27
|
+
"MV_DetailOnClick",
|
|
28
|
+
"MV_LayerManagement",
|
|
29
|
+
"MV_LM_CenterViewOnLayer",
|
|
30
|
+
"MV_LM_Order",
|
|
31
|
+
"MV_LM_Opacity",
|
|
32
|
+
"MV_LM_HideLayer",
|
|
33
|
+
"MV_LM_Style",
|
|
34
|
+
"MV_LM_ExternalLayer",
|
|
35
|
+
"MV_LM_StylePreview",
|
|
36
|
+
"MV_T_E_Type",
|
|
37
|
+
"MV_T_E_F_URL",
|
|
38
|
+
"MV_T_E_F_PDF",
|
|
39
|
+
"MV_T_E_SetScale",
|
|
40
|
+
"MV_T_E_ShowLegend",
|
|
41
|
+
"MV_T_InformationMode",
|
|
42
|
+
"MV_T_MeasureControl",
|
|
43
|
+
"MV_T_ZoomWindow",
|
|
44
|
+
"MV_T_ViewMapAsList",
|
|
45
|
+
"DM_DataInput",
|
|
46
|
+
"DM_DI_DataFeeding",
|
|
47
|
+
"DM_DI_DF_Shapefile",
|
|
48
|
+
"T_GIS",
|
|
49
|
+
"T_EntitiesInformation",
|
|
50
|
+
"D_C_Postgres",
|
|
51
|
+
"D_C_Geoserver",
|
|
52
|
+
"D_C_Nginx",
|
|
53
|
+
];
|
package/src/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import antlr4 from "antlr4";
|
|
2
|
-
import GISGrammarLexer from "./lib/GISGrammarLexer.js";
|
|
3
|
-
import GISGrammarParser from "./lib/GISGrammarParser.js";
|
|
4
|
-
import ErrorListener from "./error/ErrorListener.js";
|
|
5
|
-
import GISVisitor from "./GISVisitor.js";
|
|
6
|
-
import store from "./store.js";
|
|
7
|
-
|
|
8
|
-
export default function parse(inputStr, debug = false) {
|
|
9
|
-
const chars = new antlr4.InputStream(inputStr);
|
|
10
|
-
const lexer = new GISGrammarLexer(chars);
|
|
11
|
-
lexer.strictMode = false; // do not use js strictMode
|
|
12
|
-
|
|
13
|
-
const tokens = new antlr4.CommonTokenStream(lexer);
|
|
14
|
-
const parser = new GISGrammarParser(tokens);
|
|
15
|
-
|
|
16
|
-
const errorListener = new ErrorListener();
|
|
17
|
-
// Do this after creating the parser and before running it
|
|
18
|
-
parser.removeErrorListeners(); // Remove default ConsoleErrorListener
|
|
19
|
-
parser.addErrorListener(errorListener); // Add custom error listener
|
|
20
|
-
|
|
21
|
-
const visitor = new GISVisitor(store, debug);
|
|
22
|
-
const tree = parser.parse();
|
|
23
|
-
visitor.start(tree);
|
|
24
|
-
|
|
25
|
-
return store.getLastGeneratedProduct();
|
|
26
|
-
}
|
|
1
|
+
import antlr4 from "antlr4";
|
|
2
|
+
import GISGrammarLexer from "./lib/GISGrammarLexer.js";
|
|
3
|
+
import GISGrammarParser from "./lib/GISGrammarParser.js";
|
|
4
|
+
import ErrorListener from "./error/ErrorListener.js";
|
|
5
|
+
import GISVisitor from "./GISVisitor.js";
|
|
6
|
+
import store from "./store.js";
|
|
7
|
+
|
|
8
|
+
export default function parse(inputStr, debug = false) {
|
|
9
|
+
const chars = new antlr4.InputStream(inputStr);
|
|
10
|
+
const lexer = new GISGrammarLexer(chars);
|
|
11
|
+
lexer.strictMode = false; // do not use js strictMode
|
|
12
|
+
|
|
13
|
+
const tokens = new antlr4.CommonTokenStream(lexer);
|
|
14
|
+
const parser = new GISGrammarParser(tokens);
|
|
15
|
+
|
|
16
|
+
const errorListener = new ErrorListener();
|
|
17
|
+
// Do this after creating the parser and before running it
|
|
18
|
+
parser.removeErrorListeners(); // Remove default ConsoleErrorListener
|
|
19
|
+
parser.addErrorListener(errorListener); // Add custom error listener
|
|
20
|
+
|
|
21
|
+
const visitor = new GISVisitor(store, debug);
|
|
22
|
+
const tree = parser.parse();
|
|
23
|
+
visitor.start(tree);
|
|
24
|
+
|
|
25
|
+
return store.getLastGeneratedProduct();
|
|
26
|
+
}
|