@lbdudc/gp-gis-dsl 0.2.1 → 0.2.3
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 +11 -1
- package/package.json +1 -1
- package/src/GISVisitor.js +54 -4
- package/src/GISVisitorHelper.js +93 -162
- package/src/cli.js +34 -34
- package/src/error/ErrorListener.js +26 -26
- package/src/features.js +53 -0
- package/src/index.js +26 -26
- package/src/lib/GISGrammar.interp +5 -1
- package/src/lib/GISGrammar.tokens +45 -44
- package/src/lib/GISGrammarLexer.interp +4 -1
- 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 +10 -1
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from grammar/GISGrammar.g4 by ANTLR 4.13.
|
|
1
|
+
// Generated from grammar/GISGrammar.g4 by ANTLR 4.13.1
|
|
2
2
|
// jshint ignore: start
|
|
3
3
|
import antlr4 from 'antlr4';
|
|
4
4
|
|
|
@@ -54,6 +54,12 @@ export default class GISGrammarVisitor extends antlr4.tree.ParseTreeVisitor {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
// Visit a parse tree produced by GISGrammarParser#sldCustomBody.
|
|
58
|
+
visitSldCustomBody(ctx) {
|
|
59
|
+
return this.visitChildren(ctx);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
57
63
|
// Visit a parse tree produced by GISGrammarParser#createWmsStyle.
|
|
58
64
|
visitCreateWmsStyle(ctx) {
|
|
59
65
|
return this.visitChildren(ctx);
|
|
@@ -180,5 +186,11 @@ export default class GISGrammarVisitor extends antlr4.tree.ParseTreeVisitor {
|
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
|
|
189
|
+
// Visit a parse tree produced by GISGrammarParser#intNumber.
|
|
190
|
+
visitIntNumber(ctx) {
|
|
191
|
+
return this.visitChildren(ctx);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
183
195
|
|
|
184
196
|
}
|
package/src/spl/GIS.js
CHANGED
|
@@ -1,234 +1,234 @@
|
|
|
1
|
-
class GIS {
|
|
2
|
-
constructor(name, srid) {
|
|
3
|
-
this.name = name;
|
|
4
|
-
this.srid = parseInt(srid);
|
|
5
|
-
if (srid != 4326) {
|
|
6
|
-
console.warn("Only SRID 4326 supported!");
|
|
7
|
-
}
|
|
8
|
-
this.entities = [];
|
|
9
|
-
this.relationships = [];
|
|
10
|
-
this.enums = [];
|
|
11
|
-
this.layers = [];
|
|
12
|
-
this.styles = [];
|
|
13
|
-
this.maps = [];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
addEntity(name) {
|
|
17
|
-
if (this.getEntity(name)) {
|
|
18
|
-
throw `Entity ${name} already exists!!!`;
|
|
19
|
-
}
|
|
20
|
-
this.entities.push(new Entity(name));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getEntity(name) {
|
|
24
|
-
return this.entities.find((e) => e.name == name);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
addRelationship(source, target, sourceOpts, targetOpts) {
|
|
28
|
-
const existingRelationship = this.getRelationship(
|
|
29
|
-
source,
|
|
30
|
-
target,
|
|
31
|
-
sourceOpts.label,
|
|
32
|
-
);
|
|
33
|
-
if (existingRelationship) {
|
|
34
|
-
existingRelationship.update(sourceOpts, targetOpts);
|
|
35
|
-
} else {
|
|
36
|
-
this.relationships.push(
|
|
37
|
-
new Relationship(source, target, sourceOpts, targetOpts),
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getRelationship(source, target, sourceLabel) {
|
|
43
|
-
return this.relationships.find(
|
|
44
|
-
(e) =>
|
|
45
|
-
e.source == source &&
|
|
46
|
-
e.target == target &&
|
|
47
|
-
e.sourceOpts.label == sourceLabel,
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_entityExists(name) {
|
|
52
|
-
return this.getEntity(name) != null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Only for things that cannot be validated earlier
|
|
57
|
-
*/
|
|
58
|
-
validate() {
|
|
59
|
-
this.relationships.forEach((r) => {
|
|
60
|
-
if (!this._entityExists(r.source)) {
|
|
61
|
-
throw `ERROR: entity ${r.source} required by relationship does not exists!!`;
|
|
62
|
-
}
|
|
63
|
-
if (!this._entityExists(r.target)) {
|
|
64
|
-
throw `ERROR: entity ${r.target} required by relationship does not exists!!`;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
this.layers.forEach((layer) => {
|
|
69
|
-
if (layer.type == "GeoJSONLayer") {
|
|
70
|
-
if (!this._entityExists(layer.entityId)) {
|
|
71
|
-
throw `ERROR: entity ${layer.entityId} required by layer ${layer.id} does not exists!!`;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
getMaps() {
|
|
78
|
-
return this.maps;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getLayer(id) {
|
|
82
|
-
return this.layers.find((l) => l.getId() == id);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
addLayer(layer) {
|
|
86
|
-
this.layers.push(layer);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
getStyle(id) {
|
|
90
|
-
return this.styles.find((s) => s.getId() == id);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
addStyle(style) {
|
|
94
|
-
this.styles.push(style);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getMap(id) {
|
|
98
|
-
return this.maps.find((m) => m.id == id);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
addMap(id, map) {
|
|
102
|
-
this.maps.push(map);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
addDeploymentProperty(key, value) {
|
|
106
|
-
if (!this.extra) {
|
|
107
|
-
this.extra = {};
|
|
108
|
-
}
|
|
109
|
-
this.extra[key] = value;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
toString() {
|
|
113
|
-
return (
|
|
114
|
-
`\nGIS(${this.name} in ${this.srid}) - ${this.entities.length} entities, ${this.relationships.length} relationships:\n\t` +
|
|
115
|
-
`${this.entities.map((e) => e.toString()).join("\n\t")}\n\n\t` +
|
|
116
|
-
`${this.relationships.map((r) => r.toString()).join("\n\t")}` +
|
|
117
|
-
`${this.getMaps()
|
|
118
|
-
.map((m) => m.toString())
|
|
119
|
-
.join("\n\t")}`
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
class Entity {
|
|
125
|
-
constructor(name) {
|
|
126
|
-
this.name = name;
|
|
127
|
-
this.properties = [];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
addProperty(name, type, params) {
|
|
131
|
-
if (this.getProperty(name)) {
|
|
132
|
-
throw `Property ${name} already exists in entity ${this.name}!!!`;
|
|
133
|
-
}
|
|
134
|
-
this.properties.push(new Property(name, type, params));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
getProperty(name) {
|
|
138
|
-
return this.properties.find((p) => p.name == name);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
validate() {
|
|
142
|
-
let pk = false;
|
|
143
|
-
let displayString = false;
|
|
144
|
-
this.properties.forEach((prop) => {
|
|
145
|
-
if (prop.pk) {
|
|
146
|
-
if (pk) throw "ERROR: already has a primary key";
|
|
147
|
-
pk = true;
|
|
148
|
-
}
|
|
149
|
-
if (prop.displayString) {
|
|
150
|
-
if (displayString) throw "ERROR: already has a displayString";
|
|
151
|
-
this.displayString = "$" + prop.name;
|
|
152
|
-
delete prop.displayString;
|
|
153
|
-
displayString = true;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
toString() {
|
|
159
|
-
return `Entity ${this.name}: ${this.properties
|
|
160
|
-
.map((e) => e.toString())
|
|
161
|
-
.join(", ")}`;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
class Property {
|
|
166
|
-
constructor(name, type, params) {
|
|
167
|
-
this.name = name;
|
|
168
|
-
this.class = type;
|
|
169
|
-
if (params) {
|
|
170
|
-
if (params.pk) {
|
|
171
|
-
this.pk = true;
|
|
172
|
-
this.required = true;
|
|
173
|
-
this.unique = true;
|
|
174
|
-
if (this.class == "Long") {
|
|
175
|
-
this.class = "Long (autoinc)";
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (params.required) {
|
|
179
|
-
this.required = true;
|
|
180
|
-
}
|
|
181
|
-
if (params.unique) {
|
|
182
|
-
this.unique = true;
|
|
183
|
-
}
|
|
184
|
-
if (params.displayString) {
|
|
185
|
-
this.displayString = true;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
toString() {
|
|
191
|
-
return (
|
|
192
|
-
this.name +
|
|
193
|
-
":" +
|
|
194
|
-
this.class +
|
|
195
|
-
(this.params ? "(" + Object.keys(this.params).join(", ") + ")" : "")
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
class Relationship {
|
|
201
|
-
constructor(source, target, sourceOpts, targetOpts) {
|
|
202
|
-
this.source = source;
|
|
203
|
-
this.target = target;
|
|
204
|
-
this.sourceOpts = sourceOpts;
|
|
205
|
-
this.targetOpts = targetOpts;
|
|
206
|
-
if (!this.targetOpts.label) {
|
|
207
|
-
this.targetOpts.label = this.source.toLowerCase();
|
|
208
|
-
if (this.targetOpts.multiplicity.indexOf("*") != -1) {
|
|
209
|
-
this.targetOpts.label += "s";
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
update(sourceOpts, targetOpts) {
|
|
215
|
-
if (targetOpts.label) {
|
|
216
|
-
this.targetOpts.label = targetOpts.label;
|
|
217
|
-
}
|
|
218
|
-
if (targetOpts.multiplicity) {
|
|
219
|
-
this.targetOpts.multiplicity = targetOpts.multiplicity;
|
|
220
|
-
}
|
|
221
|
-
if (sourceOpts.multiplicity) {
|
|
222
|
-
this.sourceOpts.multiplicity = sourceOpts.multiplicity;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
toString() {
|
|
227
|
-
return (
|
|
228
|
-
`${this.source}.${this.sourceOpts.label}(${this.sourceOpts.multiplicity})` +
|
|
229
|
-
` -> ${this.target}.${this.targetOpts.label}(${this.targetOpts.multiplicity})`
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export default GIS;
|
|
1
|
+
class GIS {
|
|
2
|
+
constructor(name, srid) {
|
|
3
|
+
this.name = name;
|
|
4
|
+
this.srid = parseInt(srid);
|
|
5
|
+
if (srid != 4326) {
|
|
6
|
+
console.warn("Only SRID 4326 supported!");
|
|
7
|
+
}
|
|
8
|
+
this.entities = [];
|
|
9
|
+
this.relationships = [];
|
|
10
|
+
this.enums = [];
|
|
11
|
+
this.layers = [];
|
|
12
|
+
this.styles = [];
|
|
13
|
+
this.maps = [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
addEntity(name) {
|
|
17
|
+
if (this.getEntity(name)) {
|
|
18
|
+
throw `Entity ${name} already exists!!!`;
|
|
19
|
+
}
|
|
20
|
+
this.entities.push(new Entity(name));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getEntity(name) {
|
|
24
|
+
return this.entities.find((e) => e.name == name);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
addRelationship(source, target, sourceOpts, targetOpts) {
|
|
28
|
+
const existingRelationship = this.getRelationship(
|
|
29
|
+
source,
|
|
30
|
+
target,
|
|
31
|
+
sourceOpts.label,
|
|
32
|
+
);
|
|
33
|
+
if (existingRelationship) {
|
|
34
|
+
existingRelationship.update(sourceOpts, targetOpts);
|
|
35
|
+
} else {
|
|
36
|
+
this.relationships.push(
|
|
37
|
+
new Relationship(source, target, sourceOpts, targetOpts),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getRelationship(source, target, sourceLabel) {
|
|
43
|
+
return this.relationships.find(
|
|
44
|
+
(e) =>
|
|
45
|
+
e.source == source &&
|
|
46
|
+
e.target == target &&
|
|
47
|
+
e.sourceOpts.label == sourceLabel,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_entityExists(name) {
|
|
52
|
+
return this.getEntity(name) != null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Only for things that cannot be validated earlier
|
|
57
|
+
*/
|
|
58
|
+
validate() {
|
|
59
|
+
this.relationships.forEach((r) => {
|
|
60
|
+
if (!this._entityExists(r.source)) {
|
|
61
|
+
throw `ERROR: entity ${r.source} required by relationship does not exists!!`;
|
|
62
|
+
}
|
|
63
|
+
if (!this._entityExists(r.target)) {
|
|
64
|
+
throw `ERROR: entity ${r.target} required by relationship does not exists!!`;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
this.layers.forEach((layer) => {
|
|
69
|
+
if (layer.type == "GeoJSONLayer") {
|
|
70
|
+
if (!this._entityExists(layer.entityId)) {
|
|
71
|
+
throw `ERROR: entity ${layer.entityId} required by layer ${layer.id} does not exists!!`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getMaps() {
|
|
78
|
+
return this.maps;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getLayer(id) {
|
|
82
|
+
return this.layers.find((l) => l.getId() == id);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
addLayer(layer) {
|
|
86
|
+
this.layers.push(layer);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
getStyle(id) {
|
|
90
|
+
return this.styles.find((s) => s.getId() == id);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
addStyle(style) {
|
|
94
|
+
this.styles.push(style);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getMap(id) {
|
|
98
|
+
return this.maps.find((m) => m.id == id);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
addMap(id, map) {
|
|
102
|
+
this.maps.push(map);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
addDeploymentProperty(key, value) {
|
|
106
|
+
if (!this.extra) {
|
|
107
|
+
this.extra = {};
|
|
108
|
+
}
|
|
109
|
+
this.extra[key] = value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
toString() {
|
|
113
|
+
return (
|
|
114
|
+
`\nGIS(${this.name} in ${this.srid}) - ${this.entities.length} entities, ${this.relationships.length} relationships:\n\t` +
|
|
115
|
+
`${this.entities.map((e) => e.toString()).join("\n\t")}\n\n\t` +
|
|
116
|
+
`${this.relationships.map((r) => r.toString()).join("\n\t")}` +
|
|
117
|
+
`${this.getMaps()
|
|
118
|
+
.map((m) => m.toString())
|
|
119
|
+
.join("\n\t")}`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class Entity {
|
|
125
|
+
constructor(name) {
|
|
126
|
+
this.name = name;
|
|
127
|
+
this.properties = [];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
addProperty(name, type, params) {
|
|
131
|
+
if (this.getProperty(name)) {
|
|
132
|
+
throw `Property ${name} already exists in entity ${this.name}!!!`;
|
|
133
|
+
}
|
|
134
|
+
this.properties.push(new Property(name, type, params));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
getProperty(name) {
|
|
138
|
+
return this.properties.find((p) => p.name == name);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
validate() {
|
|
142
|
+
let pk = false;
|
|
143
|
+
let displayString = false;
|
|
144
|
+
this.properties.forEach((prop) => {
|
|
145
|
+
if (prop.pk) {
|
|
146
|
+
if (pk) throw "ERROR: already has a primary key";
|
|
147
|
+
pk = true;
|
|
148
|
+
}
|
|
149
|
+
if (prop.displayString) {
|
|
150
|
+
if (displayString) throw "ERROR: already has a displayString";
|
|
151
|
+
this.displayString = "$" + prop.name;
|
|
152
|
+
delete prop.displayString;
|
|
153
|
+
displayString = true;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
toString() {
|
|
159
|
+
return `Entity ${this.name}: ${this.properties
|
|
160
|
+
.map((e) => e.toString())
|
|
161
|
+
.join(", ")}`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
class Property {
|
|
166
|
+
constructor(name, type, params) {
|
|
167
|
+
this.name = name;
|
|
168
|
+
this.class = type;
|
|
169
|
+
if (params) {
|
|
170
|
+
if (params.pk) {
|
|
171
|
+
this.pk = true;
|
|
172
|
+
this.required = true;
|
|
173
|
+
this.unique = true;
|
|
174
|
+
if (this.class == "Long") {
|
|
175
|
+
this.class = "Long (autoinc)";
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (params.required) {
|
|
179
|
+
this.required = true;
|
|
180
|
+
}
|
|
181
|
+
if (params.unique) {
|
|
182
|
+
this.unique = true;
|
|
183
|
+
}
|
|
184
|
+
if (params.displayString) {
|
|
185
|
+
this.displayString = true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
toString() {
|
|
191
|
+
return (
|
|
192
|
+
this.name +
|
|
193
|
+
":" +
|
|
194
|
+
this.class +
|
|
195
|
+
(this.params ? "(" + Object.keys(this.params).join(", ") + ")" : "")
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
class Relationship {
|
|
201
|
+
constructor(source, target, sourceOpts, targetOpts) {
|
|
202
|
+
this.source = source;
|
|
203
|
+
this.target = target;
|
|
204
|
+
this.sourceOpts = sourceOpts;
|
|
205
|
+
this.targetOpts = targetOpts;
|
|
206
|
+
if (!this.targetOpts.label) {
|
|
207
|
+
this.targetOpts.label = this.source.toLowerCase();
|
|
208
|
+
if (this.targetOpts.multiplicity.indexOf("*") != -1) {
|
|
209
|
+
this.targetOpts.label += "s";
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
update(sourceOpts, targetOpts) {
|
|
215
|
+
if (targetOpts.label) {
|
|
216
|
+
this.targetOpts.label = targetOpts.label;
|
|
217
|
+
}
|
|
218
|
+
if (targetOpts.multiplicity) {
|
|
219
|
+
this.targetOpts.multiplicity = targetOpts.multiplicity;
|
|
220
|
+
}
|
|
221
|
+
if (sourceOpts.multiplicity) {
|
|
222
|
+
this.sourceOpts.multiplicity = sourceOpts.multiplicity;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
toString() {
|
|
227
|
+
return (
|
|
228
|
+
`${this.source}.${this.sourceOpts.label}(${this.sourceOpts.multiplicity})` +
|
|
229
|
+
` -> ${this.target}.${this.targetOpts.label}(${this.targetOpts.multiplicity})`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export default GIS;
|
package/src/spl/GeoJSONLayer.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
export default class GeoJSONLayer {
|
|
2
|
-
constructor(id, label, entityId, editable, style) {
|
|
3
|
-
this.name = id;
|
|
4
|
-
this.type = "geojson";
|
|
5
|
-
this.label = label;
|
|
6
|
-
this.entityName = entityId;
|
|
7
|
-
this.editable = editable;
|
|
8
|
-
this.defaultStyle = style;
|
|
9
|
-
this.availableStyles = [style];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
getId() {
|
|
13
|
-
return this.name;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
toString() {
|
|
17
|
-
return `GeoJSONLayer(${this.name} as ${this.label}) for entity ${
|
|
18
|
-
this.entityName
|
|
19
|
-
} ${this.editable ? "(editable)" : ""}`;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
export default class GeoJSONLayer {
|
|
2
|
+
constructor(id, label, entityId, editable, style) {
|
|
3
|
+
this.name = id;
|
|
4
|
+
this.type = "geojson";
|
|
5
|
+
this.label = label;
|
|
6
|
+
this.entityName = entityId;
|
|
7
|
+
this.editable = editable;
|
|
8
|
+
this.defaultStyle = style;
|
|
9
|
+
this.availableStyles = [style];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getId() {
|
|
13
|
+
return this.name;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
toString() {
|
|
17
|
+
return `GeoJSONLayer(${this.name} as ${this.label}) for entity ${
|
|
18
|
+
this.entityName
|
|
19
|
+
} ${this.editable ? "(editable)" : ""}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export default class GeoJSONLayerStyle {
|
|
2
|
-
constructor(id, fillColor, strokeColor, fillOpacity, strokeOpacity) {
|
|
3
|
-
this.name = id;
|
|
4
|
-
this.type = "GeoJSONLayerStyle";
|
|
5
|
-
this.fillColor = fillColor;
|
|
6
|
-
this.strokeColor = strokeColor;
|
|
7
|
-
this.fillOpacity = fillOpacity;
|
|
8
|
-
this.strokeOpacity = strokeOpacity;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
getId() {
|
|
12
|
-
return this.name;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
export default class GeoJSONLayerStyle {
|
|
2
|
+
constructor(id, fillColor, strokeColor, fillOpacity, strokeOpacity) {
|
|
3
|
+
this.name = id;
|
|
4
|
+
this.type = "GeoJSONLayerStyle";
|
|
5
|
+
this.fillColor = fillColor;
|
|
6
|
+
this.strokeColor = strokeColor;
|
|
7
|
+
this.fillOpacity = fillOpacity;
|
|
8
|
+
this.strokeOpacity = strokeOpacity;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
getId() {
|
|
12
|
+
return this.name;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/spl/Map.js
CHANGED
|
@@ -3,6 +3,7 @@ import WMSLayer from "./WMSLayer.js";
|
|
|
3
3
|
import WMSStyle from "./WMSStyle.js";
|
|
4
4
|
import GeoJSONLayer from "./GeoJSONLayer.js";
|
|
5
5
|
import GeoJSONLayerStyle from "./GeoJSONLayerStyle.js";
|
|
6
|
+
import WMSStyleCustom from "./WMSStyleCustom.js";
|
|
6
7
|
|
|
7
8
|
class Map {
|
|
8
9
|
constructor(id, label, sortable = false) {
|
|
@@ -41,4 +42,12 @@ class Map {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
export {
|
|
45
|
+
export {
|
|
46
|
+
GeoJSONLayer,
|
|
47
|
+
TileLayer,
|
|
48
|
+
WMSStyle,
|
|
49
|
+
WMSStyleCustom,
|
|
50
|
+
WMSLayer,
|
|
51
|
+
Map,
|
|
52
|
+
GeoJSONLayerStyle,
|
|
53
|
+
};
|
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
|
+
}
|