sparc-commons
Advanced tools
Comparing version 0.2.22 to 0.2.23
@@ -228,4 +228,11 @@ /*jshint multistr: true */ | ||
return 0 | ||
} | ||
} else if(segment.length === 2) { | ||
segment.splice(1, 0, point) | ||
_.each(segment, (p, index) => { | ||
segment[index] = transform(p, transformation) | ||
}) | ||
return 1 | ||
} | ||
var convPoint = transform(point, transformation) | ||
@@ -232,0 +239,0 @@ |
{ | ||
"name": "sparc-commons", | ||
"version": "0.2.22", | ||
"version": "0.2.23", | ||
"description": "Library with all small time common stuff used across the SPARC echosystem", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -89,3 +89,26 @@ var chai = require('chai') | ||
describe("[INSERT INTO VECTOR]", function(){ | ||
it("Atomic segment insertion", () => { | ||
var segment = [ | ||
[4.90394075,52.37507482], | ||
[4.90389584,52.37501998] | ||
] | ||
var wpts = [{ | ||
"id":"1920", | ||
"x":4.9039407, | ||
"y":52.375076 | ||
}] | ||
var expected = [ | ||
[4.90394075,52.37507482], | ||
[4.9039407, 52.375076], | ||
[4.90389584,52.37501998] | ||
] | ||
var ordered = geo.spliceSegment(segment, wpts, {transformation: "lonlat"}) | ||
_.each(_.zip(ordered, expected), _.spread((p, e) => { | ||
expect(p).to.deep.equal(e) | ||
})) | ||
}) | ||
it("Small Segment insertion", () => { | ||
@@ -92,0 +115,0 @@ var segment = [ |
51107
1245