main
Last change
on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago |
Pred finalna verzija
|
-
Property mode
set to
100644
|
File size:
774 bytes
|
Line | |
---|
1 | import Factory from "./Factory.js";
|
---|
2 | import shapeRegistry from "./ShapeRegistry.js";
|
---|
3 |
|
---|
4 | export default function parseMapData(data, predicate, rendered) {
|
---|
5 | if (data == null || data === "") return [];
|
---|
6 | const dsrData = JSON.parse(data);
|
---|
7 |
|
---|
8 | console.log("VLEZE use")
|
---|
9 |
|
---|
10 | let result = [];
|
---|
11 |
|
---|
12 | dsrData.filter(predicate)
|
---|
13 | .forEach(s => {
|
---|
14 | console.log(s.attrs, "Sattrs pls")
|
---|
15 | s.attrs.position = {x: s.attrs.x, y: s.attrs.y}
|
---|
16 | const shape = rendered ? Factory.createRenderedShape(s.className, s.attrs) : Factory.createShape(s.className, s.attrs);
|
---|
17 |
|
---|
18 | if (!rendered) {
|
---|
19 | shape.loadInfo(s.attrs);
|
---|
20 | shapeRegistry.add(shape)
|
---|
21 | }
|
---|
22 |
|
---|
23 | result.push(shape)
|
---|
24 |
|
---|
25 | })
|
---|
26 |
|
---|
27 | return result;
|
---|
28 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.