EncodedPolyline: Added write() method
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
basePoints[2][0] * 1e-5)
|
||||
];
|
||||
|
||||
var singlePoint = new OpenLayers.Feature.Vector(points[0]);
|
||||
|
||||
var linestring = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.LineString(points)
|
||||
);
|
||||
@@ -91,6 +93,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
function test_Format_EncodedPolyline_write(t) {
|
||||
t.plan(5);
|
||||
|
||||
var format = new OpenLayers.Format.EncodedPolyline();
|
||||
|
||||
t.eq(format.write(linestring), encoded,
|
||||
"format correctly writes encoded polyline");
|
||||
|
||||
t.eq(format.write(multipoint), encoded,
|
||||
"format correctly writes encoded multipoint");
|
||||
|
||||
// Different output than encoded,
|
||||
// because polygon closing point is included
|
||||
t.eq(format.write(linearring),
|
||||
"_p~iF~ps|U_ulLnnqC_mqNvxq`@~b_\\ghde@",
|
||||
"format correctly writes encoded linearring");
|
||||
|
||||
t.eq(format.write(polygon),
|
||||
"_p~iF~ps|U_ulLnnqC_mqNvxq`@~b_\\ghde@",
|
||||
"format correctly writes encoded polygon");
|
||||
|
||||
t.eq(format.write(singlePoint), "_p~iF~ps|U",
|
||||
"format correctly writes encoded point");
|
||||
}
|
||||
|
||||
function test_Format_EncodedPolyline_encode(t) {
|
||||
t.plan(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user