@lbdudc/gp-gis-dsl 0.2.6 → 0.3.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/grammar/GISGrammar.g4 +75 -2
- package/package.json +1 -1
- package/src/GISVisitor.js +436 -371
- package/src/GISVisitorHelper.js +93 -93
- package/src/cli.js +34 -34
- package/src/error/ErrorListener.js +26 -26
- package/src/error/SyntaxGenericError.js +18 -18
- package/src/features.js +53 -53
- package/src/index.js +26 -26
- package/src/lib/GISGrammar.interp +182 -144
- package/src/lib/GISGrammar.tokens +40 -28
- package/src/lib/GISGrammarLexer.interp +241 -204
- package/src/lib/GISGrammarLexer.js +322 -265
- package/src/lib/GISGrammarLexer.tokens +40 -28
- package/src/lib/GISGrammarListener.js +126 -0
- package/src/lib/GISGrammarParser.js +2253 -964
- package/src/lib/GISGrammarVisitor.js +84 -0
- 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 +55 -53
- package/src/spl/TileLayer.js +16 -16
- package/src/spl/WMSLayer.js +30 -30
- package/src/spl/WMSServiceLayer.js +40 -0
- package/src/spl/WMSStyle.js +13 -13
- package/src/spl/WMSStyleCustom.js +22 -22
- package/src/store.js +74 -74
|
@@ -78,6 +78,90 @@ export default class GISGrammarVisitor extends antlr4.tree.ParseTreeVisitor {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
|
|
81
|
+
// Visit a parse tree produced by GISGrammarParser#wmsUrl.
|
|
82
|
+
visitWmsUrl(ctx) {
|
|
83
|
+
return this.visitChildren(ctx);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// Visit a parse tree produced by GISGrammarParser#wmsLayerName.
|
|
88
|
+
visitWmsLayerName(ctx) {
|
|
89
|
+
return this.visitChildren(ctx);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// Visit a parse tree produced by GISGrammarParser#wmsFormatName.
|
|
94
|
+
visitWmsFormatName(ctx) {
|
|
95
|
+
return this.visitChildren(ctx);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// Visit a parse tree produced by GISGrammarParser#wmsCrs.
|
|
100
|
+
visitWmsCrs(ctx) {
|
|
101
|
+
return this.visitChildren(ctx);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// Visit a parse tree produced by GISGrammarParser#wmsBboxCrs.
|
|
106
|
+
visitWmsBboxCrs(ctx) {
|
|
107
|
+
return this.visitChildren(ctx);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// Visit a parse tree produced by GISGrammarParser#wmsMinX.
|
|
112
|
+
visitWmsMinX(ctx) {
|
|
113
|
+
return this.visitChildren(ctx);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
// Visit a parse tree produced by GISGrammarParser#wmsMinY.
|
|
118
|
+
visitWmsMinY(ctx) {
|
|
119
|
+
return this.visitChildren(ctx);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
// Visit a parse tree produced by GISGrammarParser#wmsMaxX.
|
|
124
|
+
visitWmsMaxX(ctx) {
|
|
125
|
+
return this.visitChildren(ctx);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
// Visit a parse tree produced by GISGrammarParser#wmsMaxY.
|
|
130
|
+
visitWmsMaxY(ctx) {
|
|
131
|
+
return this.visitChildren(ctx);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
// Visit a parse tree produced by GISGrammarParser#wmsBboxGroup.
|
|
136
|
+
visitWmsBboxGroup(ctx) {
|
|
137
|
+
return this.visitChildren(ctx);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
// Visit a parse tree produced by GISGrammarParser#wmsStyles.
|
|
142
|
+
visitWmsStyles(ctx) {
|
|
143
|
+
return this.visitChildren(ctx);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
// Visit a parse tree produced by GISGrammarParser#wmsQueryable.
|
|
148
|
+
visitWmsQueryable(ctx) {
|
|
149
|
+
return this.visitChildren(ctx);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
// Visit a parse tree produced by GISGrammarParser#wmsAttribution.
|
|
154
|
+
visitWmsAttribution(ctx) {
|
|
155
|
+
return this.visitChildren(ctx);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
// Visit a parse tree produced by GISGrammarParser#wmsVersion.
|
|
160
|
+
visitWmsVersion(ctx) {
|
|
161
|
+
return this.visitChildren(ctx);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
81
165
|
// Visit a parse tree produced by GISGrammarParser#createSortableMap.
|
|
82
166
|
visitCreateSortableMap(ctx) {
|
|
83
167
|
return this.visitChildren(ctx);
|
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
|
+
}
|