@wemap/geo 9.0.6 → 9.2.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/package.json +3 -3
- package/src/graph/Network.js +9 -3
- package/dist/wemap-geo.es.js +0 -3271
- package/dist/wemap-geo.es.js.map +0 -1
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"directory": "packages/geo"
|
|
14
14
|
},
|
|
15
15
|
"name": "@wemap/geo",
|
|
16
|
-
"version": "9.0
|
|
16
|
+
"version": "9.2.0",
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/wemap/wemap-modules-js/issues"
|
|
19
19
|
},
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@wemap/logger": "^9.
|
|
31
|
+
"@wemap/logger": "^9.2.0",
|
|
32
32
|
"@wemap/maths": "^9.0.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "9eee407fadd76fc5cbfbeeb13be0d74391ca5d9e"
|
|
35
35
|
}
|
package/src/graph/Network.js
CHANGED
|
@@ -161,8 +161,15 @@ class Network {
|
|
|
161
161
|
|
|
162
162
|
const network = new Network();
|
|
163
163
|
|
|
164
|
-
const getOrCreateNode = coords =>
|
|
165
|
-
network.nodes.find(
|
|
164
|
+
const getOrCreateNode = coords => {
|
|
165
|
+
const node = network.nodes.find(otherNode => otherNode.coords.equals(coords));
|
|
166
|
+
if (node) {
|
|
167
|
+
return node;
|
|
168
|
+
}
|
|
169
|
+
const newNode = new GraphNode(coords);
|
|
170
|
+
network.nodes.push(newNode);
|
|
171
|
+
return newNode;
|
|
172
|
+
};
|
|
166
173
|
|
|
167
174
|
|
|
168
175
|
const createEdgeFromNodes = (node1, node2) =>
|
|
@@ -179,7 +186,6 @@ class Network {
|
|
|
179
186
|
network.edges.push(edge);
|
|
180
187
|
}
|
|
181
188
|
|
|
182
|
-
network.nodes.push(currentNode);
|
|
183
189
|
previousNode = currentNode;
|
|
184
190
|
}
|
|
185
191
|
}
|