sparc-commons
Advanced tools
Comparing version 0.2.16 to 0.2.17
@@ -185,3 +185,3 @@ /*jshint multistr: true */ | ||
var diffLon = coordCur.lon - coordPrev.lon | ||
return [diffLon < 0, diffLat < 0] | ||
return [diffLon, diffLat] | ||
} | ||
@@ -193,16 +193,18 @@ | ||
if(currentTrend[0] && currentTrend[1]){ | ||
if((currentTrend[0] < 0) && (currentTrend[1] < 0)){ | ||
//quadrant 1 => lat ascendent, lon ascendent | ||
return trend => { | ||
return !trend[0] | ||
return currentTrend[0] < currentTrend[1]? !(trend[0] < 0) : !(trend[1] < 0) | ||
} | ||
} else if(currentTrend[0] && !currentTrend[1]){ | ||
} else if((currentTrend[0] < 0) && (!(currentTrend[1] < 0))){ | ||
//quadrant 2 => lat ascendent, lon descendent | ||
return trend => { | ||
return !trend[0] | ||
return currentTrend[0] < (currentTrend[1] * -1)? !(trend[0] < 0) : trend[1] < 0 | ||
//return !(trend[0] < 0) | ||
} | ||
} else if(!currentTrend[0] && !currentTrend[1]) { | ||
} else if((!(currentTrend[0] < 0)) && (!(currentTrend[1] < 0))) { | ||
//quadrant 3 => lat descendent, lon descendent | ||
return trend => { | ||
return trend[0] | ||
return currentTrend[0] > currentTrend[1]? trend[0] < 0 : trend[1] < 0 | ||
//return trend[0] < 0 | ||
} | ||
@@ -213,3 +215,4 @@ } | ||
return trend => { | ||
return trend[0] | ||
return (-1 * currentTrend[0]) < currentTrend[1]? trend[0] < 0 : !trend[1] < 0 | ||
//return trend[0] < 0 | ||
} | ||
@@ -216,0 +219,0 @@ } |
{ | ||
"name": "sparc-commons", | ||
"version": "0.2.16", | ||
"version": "0.2.17", | ||
"description": "Library with all small time common stuff used across the SPARC echosystem", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -281,2 +281,53 @@ var chai = require('chai') | ||
it('Test Latitudinal progression', () => { | ||
var segment = [ | ||
[4.91101741790771, 52.334631046701986], | ||
[4.910845756530762, 52.331562806577516], | ||
[4.911038875579834, 52.32855992106752], | ||
[4.911017417907715, 52.326042060824925], | ||
[4.9109530448913565, 52.32427160453835] | ||
] | ||
var waypoints = [ | ||
{ | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
4.91114616394043, | ||
52.32749771625308 | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ | ||
4.910931587219237, | ||
52.32555683170531 | ||
] | ||
} | ||
} | ||
] | ||
var expected = [ | ||
[4.91101741790771, 52.334631046701986], | ||
[4.910845756530762, 52.331562806577516], | ||
[4.911038875579834, 52.32855992106752], | ||
[4.91114616394043, 52.32749771625308], | ||
[4.911017417907715, 52.326042060824925], | ||
[4.910931587219237,52.32555683170531], | ||
[4.9109530448913565, 52.32427160453835] | ||
] | ||
var ordered = geo.spliceSegment(segment, waypoints, {transformation: 'lonlat'}) | ||
_.each(_.zip(expected, ordered), _.spread((exp, ord) => { | ||
expect(exp).to.deep.equal(ord) | ||
})) | ||
}) | ||
it.skip("Segment progression with Sequential:true", function(){ | ||
@@ -283,0 +334,0 @@ var segment = [ |
48787
1180