| 1 |
var tape = require("tape"), |
| 2 |
topojson = require("../"); |
| 3 |
|
| 4 |
require("./inDelta"); |
| 5 |
|
| 6 |
tape("mesh stitches together two connected line strings", function(test) { |
| 7 |
var topology = topojson.topology({collection: {type: "FeatureCollection", features: [ |
| 8 |
{type: "Feature", id: "foo", geometry: {type: "LineString", coordinates: [[1, 0], [2, 0]]}}, |
| 9 |
{type: "Feature", id: "foo", geometry: {type: "LineString", coordinates: [[0, 0], [1, 0]]}} |
| 10 |
]}}, { |
| 11 |
quantization: 0 |
| 12 |
}); |
| 13 |
test.inDelta(topojson.mesh(topology, topology.objects.collection), { |
| 14 |
type: "MultiLineString", |
| 15 |
coordinates: [[[0, 0], [1, 0], [2, 0]]] |
| 16 |
}); |
| 17 |
test.end(); |
| 18 |
}); |
| 19 |
|
| 20 |
tape("mesh does not stitch together two disconnected line strings", function(test) { |
| 21 |
var topology = topojson.topology({collection: {type: "FeatureCollection", features: [ |
| 22 |
{type: "Feature", id: "foo", geometry: {type: "LineString", coordinates: [[2, 0], [3, 0]]}}, |
| 23 |
{type: "Feature", id: "foo", geometry: {type: "LineString", coordinates: [[0, 0], [1, 0]]}} |
| 24 |
]}}); |
| 25 |
test.inDelta(topojson.mesh(topology, topology.objects.collection), { |
| 26 |
type: "MultiLineString", |
| 27 |
coordinates: [[[2, 0], [3, 0]], [[0, 0], [1, 0]]] |
| 28 |
}); |
| 29 |
test.end(); |
| 30 |
}); |