From a73556c7a37297a3269a9056000bff0561b71cb2 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 26 Jul 2016 02:36:42 -0400 Subject: [PATCH] how walk should progress --- tests/s2-node-hilbert.js | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/tests/s2-node-hilbert.js b/tests/s2-node-hilbert.js index c89f2f8..d41aaa3 100644 --- a/tests/s2-node-hilbert.js +++ b/tests/s2-node-hilbert.js @@ -13,21 +13,37 @@ var next = cellId; var prev = cellId; var i; -cell = new S2.S2Cell(cellId); -console.log(cell.face(), cellId.id(), cellId.toString(), cellId.toLatLng().toString(), cellId.level()); for (i = 0; i < 10; i += 1) { - next = next.next(); prev = prev.prev(); - walk.push(next); - walk.push(prev); + walk.unshift([ -(i + 1), prev ]); - cell = new S2.S2Cell(next); - console.log(cell.face(), next.id(), next.toString(), next.toLatLng().toString(), next.level()); - cell = new S2.S2Cell(prev); - console.log(cell.face(), prev.id(), prev.toString(), prev.toLatLng().toString(), prev.level()); + //cell = new S2.S2Cell(prev); + //console.log(cell.face(), prev.id(), prev.toString(), prev.toLatLng().toString(), prev.level()); } +walk.push([ 0, cellId ]); +//cell = new S2.S2Cell(cellId); +//console.log(0, cell.face(), cellId.id(), cellId.toString(), cellId.toLatLng().toString(), cellId.level()); + +for (i = 0; i < 10; i += 1) { + next = next.next(); + + walk.push([ i + 1, next ]); + + //cell = new S2.S2Cell(next); + //console.log(cell.face(), next.id(), next.toString(), next.toLatLng().toString(), next.level()); +} + +walk.forEach(function (parts) { + var i = parts[0]; + var cellId = parts[1]; + + cell = new S2.S2Cell(cellId); + console.log(i, cell.face(), cellId.id(), cellId.toString(), cellId.toLatLng().toString(), cellId.level()); +}); +//console.log(0, cell.face(), cellId.id(), cellId.toString(), cellId.toLatLng().toString(), cellId.level()); + /* console.log(cell.id().toString()); var latlng = cell.toLatLng();