Rename _ol_format_Polyline_ to Polyline
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||||
import _ol_Map_ from '../src/ol/Map.js';
|
import _ol_Map_ from '../src/ol/Map.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import _ol_format_Polyline_ from '../src/ol/format/Polyline.js';
|
import Polyline from '../src/ol/format/Polyline.js';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||||
@@ -57,7 +57,7 @@ var polyline = [
|
|||||||
'~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL'
|
'~@ym@yjA??a@cFd@kBrCgDbAUnAcBhAyAdk@et@??kF}D??OL'
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
var route = /** @type {ol.geom.LineString} */ (new _ol_format_Polyline_({
|
var route = /** @type {ol.geom.LineString} */ (new Polyline({
|
||||||
factor: 1e6
|
factor: 1e6
|
||||||
}).readGeometry(polyline, {
|
}).readGeometry(polyline, {
|
||||||
dataProjection: 'EPSG:4326',
|
dataProjection: 'EPSG:4326',
|
||||||
|
|||||||
+32
-32
@@ -24,7 +24,7 @@ import {get as getProjection} from '../proj.js';
|
|||||||
* Optional configuration object.
|
* Optional configuration object.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_format_Polyline_ = function(opt_options) {
|
var Polyline = function(opt_options) {
|
||||||
|
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ var _ol_format_Polyline_ = function(opt_options) {
|
|||||||
options.geometryLayout : GeometryLayout.XY;
|
options.geometryLayout : GeometryLayout.XY;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_format_Polyline_, _ol_format_TextFeature_);
|
inherits(Polyline, _ol_format_TextFeature_);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +65,7 @@ inherits(_ol_format_Polyline_, _ol_format_TextFeature_);
|
|||||||
* @return {string} The encoded string.
|
* @return {string} The encoded string.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) {
|
Polyline.encodeDeltas = function(numbers, stride, opt_factor) {
|
||||||
var factor = opt_factor ? opt_factor : 1e5;
|
var factor = opt_factor ? opt_factor : 1e5;
|
||||||
var d;
|
var d;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ _ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ol_format_Polyline_.encodeFloats(numbers, factor);
|
return Polyline.encodeFloats(numbers, factor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ _ol_format_Polyline_.encodeDeltas = function(numbers, stride, opt_factor) {
|
|||||||
* @return {Array.<number>} A list of n-dimensional points.
|
* @return {Array.<number>} A list of n-dimensional points.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) {
|
Polyline.decodeDeltas = function(encoded, stride, opt_factor) {
|
||||||
var factor = opt_factor ? opt_factor : 1e5;
|
var factor = opt_factor ? opt_factor : 1e5;
|
||||||
var d;
|
var d;
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ _ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) {
|
|||||||
lastNumbers[d] = 0;
|
lastNumbers[d] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var numbers = _ol_format_Polyline_.decodeFloats(encoded, factor);
|
var numbers = Polyline.decodeFloats(encoded, factor);
|
||||||
|
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = numbers.length; i < ii;) {
|
for (i = 0, ii = numbers.length; i < ii;) {
|
||||||
@@ -137,14 +137,14 @@ _ol_format_Polyline_.decodeDeltas = function(encoded, stride, opt_factor) {
|
|||||||
* @return {string} The encoded string.
|
* @return {string} The encoded string.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) {
|
Polyline.encodeFloats = function(numbers, opt_factor) {
|
||||||
var factor = opt_factor ? opt_factor : 1e5;
|
var factor = opt_factor ? opt_factor : 1e5;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
||||||
numbers[i] = Math.round(numbers[i] * factor);
|
numbers[i] = Math.round(numbers[i] * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _ol_format_Polyline_.encodeSignedIntegers(numbers);
|
return Polyline.encodeSignedIntegers(numbers);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -157,9 +157,9 @@ _ol_format_Polyline_.encodeFloats = function(numbers, opt_factor) {
|
|||||||
* @return {Array.<number>} A list of floating point numbers.
|
* @return {Array.<number>} A list of floating point numbers.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) {
|
Polyline.decodeFloats = function(encoded, opt_factor) {
|
||||||
var factor = opt_factor ? opt_factor : 1e5;
|
var factor = opt_factor ? opt_factor : 1e5;
|
||||||
var numbers = _ol_format_Polyline_.decodeSignedIntegers(encoded);
|
var numbers = Polyline.decodeSignedIntegers(encoded);
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
||||||
numbers[i] /= factor;
|
numbers[i] /= factor;
|
||||||
@@ -176,13 +176,13 @@ _ol_format_Polyline_.decodeFloats = function(encoded, opt_factor) {
|
|||||||
* @param {Array.<number>} numbers A list of signed integers.
|
* @param {Array.<number>} numbers A list of signed integers.
|
||||||
* @return {string} The encoded string.
|
* @return {string} The encoded string.
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.encodeSignedIntegers = function(numbers) {
|
Polyline.encodeSignedIntegers = function(numbers) {
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
||||||
var num = numbers[i];
|
var num = numbers[i];
|
||||||
numbers[i] = (num < 0) ? ~(num << 1) : (num << 1);
|
numbers[i] = (num < 0) ? ~(num << 1) : (num << 1);
|
||||||
}
|
}
|
||||||
return _ol_format_Polyline_.encodeUnsignedIntegers(numbers);
|
return Polyline.encodeUnsignedIntegers(numbers);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -192,8 +192,8 @@ _ol_format_Polyline_.encodeSignedIntegers = function(numbers) {
|
|||||||
* @param {string} encoded An encoded string.
|
* @param {string} encoded An encoded string.
|
||||||
* @return {Array.<number>} A list of signed integers.
|
* @return {Array.<number>} A list of signed integers.
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.decodeSignedIntegers = function(encoded) {
|
Polyline.decodeSignedIntegers = function(encoded) {
|
||||||
var numbers = _ol_format_Polyline_.decodeUnsignedIntegers(encoded);
|
var numbers = Polyline.decodeUnsignedIntegers(encoded);
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
||||||
var num = numbers[i];
|
var num = numbers[i];
|
||||||
@@ -209,11 +209,11 @@ _ol_format_Polyline_.decodeSignedIntegers = function(encoded) {
|
|||||||
* @param {Array.<number>} numbers A list of unsigned integers.
|
* @param {Array.<number>} numbers A list of unsigned integers.
|
||||||
* @return {string} The encoded string.
|
* @return {string} The encoded string.
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) {
|
Polyline.encodeUnsignedIntegers = function(numbers) {
|
||||||
var encoded = '';
|
var encoded = '';
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
for (i = 0, ii = numbers.length; i < ii; ++i) {
|
||||||
encoded += _ol_format_Polyline_.encodeUnsignedInteger(numbers[i]);
|
encoded += Polyline.encodeUnsignedInteger(numbers[i]);
|
||||||
}
|
}
|
||||||
return encoded;
|
return encoded;
|
||||||
};
|
};
|
||||||
@@ -225,7 +225,7 @@ _ol_format_Polyline_.encodeUnsignedIntegers = function(numbers) {
|
|||||||
* @param {string} encoded An encoded string.
|
* @param {string} encoded An encoded string.
|
||||||
* @return {Array.<number>} A list of unsigned integers.
|
* @return {Array.<number>} A list of unsigned integers.
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) {
|
Polyline.decodeUnsignedIntegers = function(encoded) {
|
||||||
var numbers = [];
|
var numbers = [];
|
||||||
var current = 0;
|
var current = 0;
|
||||||
var shift = 0;
|
var shift = 0;
|
||||||
@@ -251,7 +251,7 @@ _ol_format_Polyline_.decodeUnsignedIntegers = function(encoded) {
|
|||||||
* @param {number} num Unsigned integer that should be encoded.
|
* @param {number} num Unsigned integer that should be encoded.
|
||||||
* @return {string} The encoded string.
|
* @return {string} The encoded string.
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.encodeUnsignedInteger = function(num) {
|
Polyline.encodeUnsignedInteger = function(num) {
|
||||||
var value, encoded = '';
|
var value, encoded = '';
|
||||||
while (num >= 0x20) {
|
while (num >= 0x20) {
|
||||||
value = (0x20 | (num & 0x1f)) + 63;
|
value = (0x20 | (num & 0x1f)) + 63;
|
||||||
@@ -274,13 +274,13 @@ _ol_format_Polyline_.encodeUnsignedInteger = function(num) {
|
|||||||
* @return {ol.Feature} Feature.
|
* @return {ol.Feature} Feature.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readFeature;
|
Polyline.prototype.readFeature;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options) {
|
Polyline.prototype.readFeatureFromText = function(text, opt_options) {
|
||||||
var geometry = this.readGeometryFromText(text, opt_options);
|
var geometry = this.readGeometryFromText(text, opt_options);
|
||||||
return new _ol_Feature_(geometry);
|
return new _ol_Feature_(geometry);
|
||||||
};
|
};
|
||||||
@@ -296,13 +296,13 @@ _ol_format_Polyline_.prototype.readFeatureFromText = function(text, opt_options)
|
|||||||
* @return {Array.<ol.Feature>} Features.
|
* @return {Array.<ol.Feature>} Features.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readFeatures;
|
Polyline.prototype.readFeatures;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options) {
|
Polyline.prototype.readFeaturesFromText = function(text, opt_options) {
|
||||||
var feature = this.readFeatureFromText(text, opt_options);
|
var feature = this.readFeatureFromText(text, opt_options);
|
||||||
return [feature];
|
return [feature];
|
||||||
};
|
};
|
||||||
@@ -317,15 +317,15 @@ _ol_format_Polyline_.prototype.readFeaturesFromText = function(text, opt_options
|
|||||||
* @return {ol.geom.Geometry} Geometry.
|
* @return {ol.geom.Geometry} Geometry.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readGeometry;
|
Polyline.prototype.readGeometry;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options) {
|
Polyline.prototype.readGeometryFromText = function(text, opt_options) {
|
||||||
var stride = SimpleGeometry.getStrideForLayout(this.geometryLayout_);
|
var stride = SimpleGeometry.getStrideForLayout(this.geometryLayout_);
|
||||||
var flatCoordinates = _ol_format_Polyline_.decodeDeltas(
|
var flatCoordinates = Polyline.decodeDeltas(
|
||||||
text, stride, this.factor_);
|
text, stride, this.factor_);
|
||||||
_ol_geom_flat_flip_.flipXY(
|
_ol_geom_flat_flip_.flipXY(
|
||||||
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
|
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
|
||||||
@@ -348,13 +348,13 @@ _ol_format_Polyline_.prototype.readGeometryFromText = function(text, opt_options
|
|||||||
* @return {ol.proj.Projection} Projection.
|
* @return {ol.proj.Projection} Projection.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.readProjection;
|
Polyline.prototype.readProjection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options) {
|
Polyline.prototype.writeFeatureText = function(feature, opt_options) {
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
return this.writeGeometryText(geometry, opt_options);
|
return this.writeGeometryText(geometry, opt_options);
|
||||||
@@ -368,7 +368,7 @@ _ol_format_Polyline_.prototype.writeFeatureText = function(feature, opt_options)
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_options) {
|
Polyline.prototype.writeFeaturesText = function(features, opt_options) {
|
||||||
return this.writeFeatureText(features[0], opt_options);
|
return this.writeFeatureText(features[0], opt_options);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -382,13 +382,13 @@ _ol_format_Polyline_.prototype.writeFeaturesText = function(features, opt_option
|
|||||||
* @return {string} Geometry.
|
* @return {string} Geometry.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.writeGeometry;
|
Polyline.prototype.writeGeometry;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_Polyline_.prototype.writeGeometryText = function(geometry, opt_options) {
|
Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
|
||||||
geometry = /** @type {ol.geom.LineString} */
|
geometry = /** @type {ol.geom.LineString} */
|
||||||
(FeatureFormat.transformWithOptions(
|
(FeatureFormat.transformWithOptions(
|
||||||
geometry, true, this.adaptOptions(opt_options)));
|
geometry, true, this.adaptOptions(opt_options)));
|
||||||
@@ -396,6 +396,6 @@ _ol_format_Polyline_.prototype.writeGeometryText = function(geometry, opt_option
|
|||||||
var stride = geometry.getStride();
|
var stride = geometry.getStride();
|
||||||
_ol_geom_flat_flip_.flipXY(
|
_ol_geom_flat_flip_.flipXY(
|
||||||
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
|
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
|
||||||
return _ol_format_Polyline_.encodeDeltas(flatCoordinates, stride, this.factor_);
|
return Polyline.encodeDeltas(flatCoordinates, stride, this.factor_);
|
||||||
};
|
};
|
||||||
export default _ol_format_Polyline_;
|
export default Polyline;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||||
import _ol_format_Polyline_ from '../../../../src/ol/format/Polyline.js';
|
import Polyline from '../../../../src/ol/format/Polyline.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
var points3857;
|
var points3857;
|
||||||
|
|
||||||
function resetTestingData() {
|
function resetTestingData() {
|
||||||
format = new _ol_format_Polyline_();
|
format = new Polyline();
|
||||||
points = [
|
points = [
|
||||||
[-120.20000, 38.50000],
|
[-120.20000, 38.50000],
|
||||||
[-120.95000, 40.70000],
|
[-120.95000, 40.70000],
|
||||||
@@ -60,7 +60,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeDeltas', function() {
|
describe('encodeDeltas', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeDeltas = _ol_format_Polyline_.encodeDeltas;
|
var encodeDeltas = Polyline.encodeDeltas;
|
||||||
|
|
||||||
expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints);
|
expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints);
|
||||||
});
|
});
|
||||||
@@ -68,7 +68,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeDeltas', function() {
|
describe('decodeDeltas', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeDeltas = _ol_format_Polyline_.decodeDeltas;
|
var decodeDeltas = Polyline.decodeDeltas;
|
||||||
|
|
||||||
expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints);
|
expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints);
|
||||||
});
|
});
|
||||||
@@ -77,7 +77,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeFloats', function() {
|
describe('encodeFloats', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeFloats = _ol_format_Polyline_.encodeFloats;
|
var encodeFloats = Polyline.encodeFloats;
|
||||||
|
|
||||||
expect(encodeFloats(smallFloats)).to.eql(encodedFloats);
|
expect(encodeFloats(smallFloats)).to.eql(encodedFloats);
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeFloats', function() {
|
describe('decodeFloats', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeFloats = _ol_format_Polyline_.decodeFloats;
|
var decodeFloats = Polyline.decodeFloats;
|
||||||
|
|
||||||
expect(decodeFloats(encodedFloats)).to.eql(smallFloats);
|
expect(decodeFloats(encodedFloats)).to.eql(smallFloats);
|
||||||
expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats);
|
expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats);
|
||||||
@@ -101,7 +101,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeSignedIntegers', function() {
|
describe('encodeSignedIntegers', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers;
|
var encodeSignedIntegers = Polyline.encodeSignedIntegers;
|
||||||
|
|
||||||
expect(encodeSignedIntegers(
|
expect(encodeSignedIntegers(
|
||||||
signedIntegers)).to.eql(encodedSignedIntegers);
|
signedIntegers)).to.eql(encodedSignedIntegers);
|
||||||
@@ -110,7 +110,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeSignedIntegers', function() {
|
describe('decodeSignedIntegers', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers;
|
var decodeSignedIntegers = Polyline.decodeSignedIntegers;
|
||||||
|
|
||||||
expect(decodeSignedIntegers(
|
expect(decodeSignedIntegers(
|
||||||
encodedSignedIntegers)).to.eql(signedIntegers);
|
encodedSignedIntegers)).to.eql(signedIntegers);
|
||||||
@@ -120,7 +120,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeUnsignedIntegers', function() {
|
describe('encodeUnsignedIntegers', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeUnsignedIntegers = _ol_format_Polyline_.encodeUnsignedIntegers;
|
var encodeUnsignedIntegers = Polyline.encodeUnsignedIntegers;
|
||||||
|
|
||||||
expect(encodeUnsignedIntegers(
|
expect(encodeUnsignedIntegers(
|
||||||
unsignedIntegers)).to.eql(encodedUnsignedIntegers);
|
unsignedIntegers)).to.eql(encodedUnsignedIntegers);
|
||||||
@@ -129,7 +129,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeUnsignedIntegers', function() {
|
describe('decodeUnsignedIntegers', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers;
|
var decodeUnsignedIntegers = Polyline.decodeUnsignedIntegers;
|
||||||
|
|
||||||
expect(decodeUnsignedIntegers(
|
expect(decodeUnsignedIntegers(
|
||||||
encodedUnsignedIntegers)).to.eql(unsignedIntegers);
|
encodedUnsignedIntegers)).to.eql(unsignedIntegers);
|
||||||
@@ -139,7 +139,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeFloat', function() {
|
describe('encodeFloat', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeFloats = _ol_format_Polyline_.encodeFloats;
|
var encodeFloats = Polyline.encodeFloats;
|
||||||
|
|
||||||
expect(encodeFloats([0.00000])).to.eql('?');
|
expect(encodeFloats([0.00000])).to.eql('?');
|
||||||
expect(encodeFloats([-0.00001])).to.eql('@');
|
expect(encodeFloats([-0.00001])).to.eql('@');
|
||||||
@@ -162,7 +162,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeFloat', function() {
|
describe('decodeFloat', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeFloats = _ol_format_Polyline_.decodeFloats;
|
var decodeFloats = Polyline.decodeFloats;
|
||||||
|
|
||||||
expect(decodeFloats('?')).to.eql([0.00000]);
|
expect(decodeFloats('?')).to.eql([0.00000]);
|
||||||
expect(decodeFloats('@')).to.eql([-0.00001]);
|
expect(decodeFloats('@')).to.eql([-0.00001]);
|
||||||
@@ -186,7 +186,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeSignedInteger', function() {
|
describe('encodeSignedInteger', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeSignedIntegers = _ol_format_Polyline_.encodeSignedIntegers;
|
var encodeSignedIntegers = Polyline.encodeSignedIntegers;
|
||||||
|
|
||||||
expect(encodeSignedIntegers([0])).to.eql('?');
|
expect(encodeSignedIntegers([0])).to.eql('?');
|
||||||
expect(encodeSignedIntegers([-1])).to.eql('@');
|
expect(encodeSignedIntegers([-1])).to.eql('@');
|
||||||
@@ -204,7 +204,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeSignedInteger', function() {
|
describe('decodeSignedInteger', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeSignedIntegers = _ol_format_Polyline_.decodeSignedIntegers;
|
var decodeSignedIntegers = Polyline.decodeSignedIntegers;
|
||||||
|
|
||||||
expect(decodeSignedIntegers('?')).to.eql([0]);
|
expect(decodeSignedIntegers('?')).to.eql([0]);
|
||||||
expect(decodeSignedIntegers('@')).to.eql([-1]);
|
expect(decodeSignedIntegers('@')).to.eql([-1]);
|
||||||
@@ -223,7 +223,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('encodeUnsignedInteger', function() {
|
describe('encodeUnsignedInteger', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var encodeUnsignedInteger = _ol_format_Polyline_.encodeUnsignedInteger;
|
var encodeUnsignedInteger = Polyline.encodeUnsignedInteger;
|
||||||
|
|
||||||
expect(encodeUnsignedInteger(0)).to.eql('?');
|
expect(encodeUnsignedInteger(0)).to.eql('?');
|
||||||
expect(encodeUnsignedInteger(1)).to.eql('@');
|
expect(encodeUnsignedInteger(1)).to.eql('@');
|
||||||
@@ -243,7 +243,7 @@ describe('ol.format.Polyline', function() {
|
|||||||
|
|
||||||
describe('decodeUnsignedInteger', function() {
|
describe('decodeUnsignedInteger', function() {
|
||||||
it('returns expected value', function() {
|
it('returns expected value', function() {
|
||||||
var decodeUnsignedIntegers = _ol_format_Polyline_.decodeUnsignedIntegers;
|
var decodeUnsignedIntegers = Polyline.decodeUnsignedIntegers;
|
||||||
|
|
||||||
expect(decodeUnsignedIntegers('?')).to.eql([0]);
|
expect(decodeUnsignedIntegers('?')).to.eql([0]);
|
||||||
expect(decodeUnsignedIntegers('@')).to.eql([1]);
|
expect(decodeUnsignedIntegers('@')).to.eql([1]);
|
||||||
@@ -320,12 +320,12 @@ describe('ol.format.Polyline', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('parses XYZ linestring', function() {
|
it('parses XYZ linestring', function() {
|
||||||
var xyz = _ol_format_Polyline_.encodeDeltas([
|
var xyz = Polyline.encodeDeltas([
|
||||||
38.500, -120.200, 100,
|
38.500, -120.200, 100,
|
||||||
40.700, -120.950, 200,
|
40.700, -120.950, 200,
|
||||||
43.252, -126.453, 20
|
43.252, -126.453, 20
|
||||||
], 3);
|
], 3);
|
||||||
var format = new _ol_format_Polyline_({
|
var format = new Polyline({
|
||||||
geometryLayout: 'XYZ'
|
geometryLayout: 'XYZ'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user