Rename _ol_format_MVT_ to MVT

This commit is contained in:
Tim Schaub
2017-12-17 02:00:48 -07:00
parent e77ef118ea
commit cdf7b3276b
8 changed files with 60 additions and 60 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
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_MVT_ from '../src/ol/format/MVT.js'; import MVT from '../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../src/ol/proj.js'; import {get as getProjection} from '../src/ol/proj.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js';
@@ -37,7 +37,7 @@ var map = new _ol_Map_({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' + '© <a href="https://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>', 'OpenStreetMap contributors</a>',
format: new _ol_format_MVT_(), format: new MVT(),
tileGrid: new _ol_tilegrid_TileGrid_({ tileGrid: new _ol_tilegrid_TileGrid_({
extent: getProjection('EPSG:3857').getExtent(), extent: getProjection('EPSG:3857').getExtent(),
resolutions: resolutions, resolutions: resolutions,
+2 -2
View File
@@ -1,6 +1,6 @@
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_MVT_ from '../src/ol/format/MVT.js'; import MVT from '../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js';
import _ol_style_Fill_ from '../src/ol/style/Fill.js'; import _ol_style_Fill_ from '../src/ol/style/Fill.js';
@@ -20,7 +20,7 @@ var map = new _ol_Map_({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' + attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' + '© <a href="https://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>', 'OpenStreetMap contributors</a>',
format: new _ol_format_MVT_(), format: new MVT(),
url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
'{z}/{x}/{y}.vector.pbf?access_token=' + key '{z}/{x}/{y}.vector.pbf?access_token=' + key
}), }),
+2 -2
View File
@@ -1,6 +1,6 @@
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_MVT_ from '../src/ol/format/MVT.js'; import MVT from '../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../src/ol/layer/VectorTile.js';
import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../src/ol/source/VectorTile.js';
@@ -12,7 +12,7 @@ var map = new _ol_Map_({
}), }),
layers: [new _ol_layer_VectorTile_({ layers: [new _ol_layer_VectorTile_({
source: new _ol_source_VectorTile_({ source: new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf' url: 'https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf'
}) })
})] })]
+24 -24
View File
@@ -30,7 +30,7 @@ import _ol_render_Feature_ from '../render/Feature.js';
* @param {olx.format.MVTOptions=} opt_options Options. * @param {olx.format.MVTOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_format_MVT_ = function(opt_options) { var MVT = function(opt_options) {
FeatureFormat.call(this); FeatureFormat.call(this);
@@ -79,14 +79,14 @@ var _ol_format_MVT_ = function(opt_options) {
}; };
inherits(_ol_format_MVT_, FeatureFormat); inherits(MVT, FeatureFormat);
/** /**
* Reader callbacks for parsing the PBF. * Reader callbacks for parsing the PBF.
* @type {Object.<string, function(number, Object, ol.ext.PBF)>} * @type {Object.<string, function(number, Object, ol.ext.PBF)>}
*/ */
_ol_format_MVT_.pbfReaders_ = { MVT.pbfReaders_ = {
layers: function(tag, layers, pbf) { layers: function(tag, layers, pbf) {
if (tag === 3) { if (tag === 3) {
var layer = { var layer = {
@@ -95,7 +95,7 @@ _ol_format_MVT_.pbfReaders_ = {
features: [] features: []
}; };
var end = pbf.readVarint() + pbf.pos; var end = pbf.readVarint() + pbf.pos;
pbf.readFields(_ol_format_MVT_.pbfReaders_.layer, layer, end); pbf.readFields(MVT.pbfReaders_.layer, layer, end);
layer.length = layer.features.length; layer.length = layer.features.length;
if (layer.length) { if (layer.length) {
layers[layer.name] = layer; layers[layer.name] = layer;
@@ -157,7 +157,7 @@ _ol_format_MVT_.pbfReaders_ = {
* @param {number} i Index of the feature in the raw layer's `features` array. * @param {number} i Index of the feature in the raw layer's `features` array.
* @return {Object} Raw feature. * @return {Object} Raw feature.
*/ */
_ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) { MVT.readRawFeature_ = function(pbf, layer, i) {
pbf.pos = layer.features[i]; pbf.pos = layer.features[i];
var end = pbf.readVarint() + pbf.pos; var end = pbf.readVarint() + pbf.pos;
@@ -166,7 +166,7 @@ _ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) {
type: 0, type: 0,
properties: {} properties: {}
}; };
pbf.readFields(_ol_format_MVT_.pbfReaders_.feature, feature, end); pbf.readFields(MVT.pbfReaders_.feature, feature, end);
return feature; return feature;
}; };
@@ -181,7 +181,7 @@ _ol_format_MVT_.readRawFeature_ = function(pbf, layer, i) {
* @param {Array.<number>} flatCoordinates Array to store flat coordinates in. * @param {Array.<number>} flatCoordinates Array to store flat coordinates in.
* @param {Array.<number>} ends Array to store ends in. * @param {Array.<number>} ends Array to store ends in.
*/ */
_ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) { MVT.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
pbf.pos = feature.geometry; pbf.pos = feature.geometry;
var end = pbf.readVarint() + pbf.pos; var end = pbf.readVarint() + pbf.pos;
@@ -245,7 +245,7 @@ _ol_format_MVT_.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends)
* geometry. * geometry.
* @return {ol.geom.GeometryType} The geometry type. * @return {ol.geom.GeometryType} The geometry type.
*/ */
_ol_format_MVT_.getGeometryType_ = function(type, numEnds) { MVT.getGeometryType_ = function(type, numEnds) {
/** @type {ol.geom.GeometryType} */ /** @type {ol.geom.GeometryType} */
var geometryType; var geometryType;
if (type === 1) { if (type === 1) {
@@ -270,7 +270,7 @@ _ol_format_MVT_.getGeometryType_ = function(type, numEnds) {
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature|ol.render.Feature} Feature. * @return {ol.Feature|ol.render.Feature} Feature.
*/ */
_ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options) { MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
var type = rawFeature.type; var type = rawFeature.type;
if (type === 0) { if (type === 0) {
return null; return null;
@@ -283,9 +283,9 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
var flatCoordinates = []; var flatCoordinates = [];
var ends = []; var ends = [];
_ol_format_MVT_.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends); MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
var geometryType = _ol_format_MVT_.getGeometryType_(type, ends.length); var geometryType = MVT.getGeometryType_(type, ends.length);
if (this.featureClass_ === _ol_render_Feature_) { if (this.featureClass_ === _ol_render_Feature_) {
feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id); feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
@@ -336,7 +336,7 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_format_MVT_.prototype.getLastExtent = function() { MVT.prototype.getLastExtent = function() {
return this.extent_; return this.extent_;
}; };
@@ -344,7 +344,7 @@ _ol_format_MVT_.prototype.getLastExtent = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_format_MVT_.prototype.getType = function() { MVT.prototype.getType = function() {
return _ol_format_FormatType_.ARRAY_BUFFER; return _ol_format_FormatType_.ARRAY_BUFFER;
}; };
@@ -353,11 +353,11 @@ _ol_format_MVT_.prototype.getType = function() {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_format_MVT_.prototype.readFeatures = function(source, opt_options) { MVT.prototype.readFeatures = function(source, opt_options) {
var layers = this.layers_; var layers = this.layers_;
var pbf = new PBF(/** @type {ArrayBuffer} */ (source)); var pbf = new PBF(/** @type {ArrayBuffer} */ (source));
var pbfLayers = pbf.readFields(_ol_format_MVT_.pbfReaders_.layers, {}); var pbfLayers = pbf.readFields(MVT.pbfReaders_.layers, {});
/** @type {Array.<ol.Feature|ol.render.Feature>} */ /** @type {Array.<ol.Feature|ol.render.Feature>} */
var features = []; var features = [];
var pbfLayer; var pbfLayer;
@@ -369,7 +369,7 @@ _ol_format_MVT_.prototype.readFeatures = function(source, opt_options) {
var rawFeature; var rawFeature;
for (var i = 0, ii = pbfLayer.length; i < ii; ++i) { for (var i = 0, ii = pbfLayer.length; i < ii; ++i) {
rawFeature = _ol_format_MVT_.readRawFeature_(pbf, pbfLayer, i); rawFeature = MVT.readRawFeature_(pbf, pbfLayer, i);
features.push(this.createFeature_(pbf, rawFeature)); features.push(this.createFeature_(pbf, rawFeature));
} }
this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null; this.extent_ = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;
@@ -383,7 +383,7 @@ _ol_format_MVT_.prototype.readFeatures = function(source, opt_options) {
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
_ol_format_MVT_.prototype.readProjection = function(source) { MVT.prototype.readProjection = function(source) {
return this.defaultDataProjection; return this.defaultDataProjection;
}; };
@@ -393,7 +393,7 @@ _ol_format_MVT_.prototype.readProjection = function(source) {
* @param {Array.<string>} layers Layers. * @param {Array.<string>} layers Layers.
* @api * @api
*/ */
_ol_format_MVT_.prototype.setLayers = function(layers) { MVT.prototype.setLayers = function(layers) {
this.layers_ = layers; this.layers_ = layers;
}; };
@@ -402,33 +402,33 @@ _ol_format_MVT_.prototype.setLayers = function(layers) {
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.readFeature = function() {}; MVT.prototype.readFeature = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.readGeometry = function() {}; MVT.prototype.readGeometry = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.writeFeature = function() {}; MVT.prototype.writeFeature = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.writeGeometry = function() {}; MVT.prototype.writeGeometry = function() {};
/** /**
* Not implemented. * Not implemented.
* @override * @override
*/ */
_ol_format_MVT_.prototype.writeFeatures = function() {}; MVT.prototype.writeFeatures = function() {};
export default _ol_format_MVT_; export default MVT;
+2 -2
View File
@@ -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_MVT_ from '../../../../src/ol/format/MVT.js'; import MVT from '../../../../src/ol/format/MVT.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js'; import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
@@ -70,7 +70,7 @@ describe('ol.rendering.layer.VectorTile', function() {
beforeEach(function() { beforeEach(function() {
source = new _ol_source_VectorTile_({ source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
tileGrid: _ol_tilegrid_.createXYZ(), tileGrid: _ol_tilegrid_.createXYZ(),
url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf', url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf',
transition: 0 transition: 0
+23 -23
View File
@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import * as _ol_extent_ from '../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js';
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js'; import MVT from '../../../../src/ol/format/MVT.js';
import Point from '../../../../src/ol/geom/Point.js'; import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../src/ol/geom/Polygon.js';
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js'; import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
@@ -23,19 +23,19 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
describe('#readFeatures', function() { describe('#readFeatures', function() {
it('uses ol.render.Feature as feature class by default', function() { it('uses ol.render.Feature as feature class by default', function() {
var format = new _ol_format_MVT_({layers: ['water']}); var format = new MVT({layers: ['water']});
var features = format.readFeatures(data); var features = format.readFeatures(data);
expect(features[0]).to.be.a(_ol_render_Feature_); expect(features[0]).to.be.a(_ol_render_Feature_);
}); });
it('parses only specified layers', function() { it('parses only specified layers', function() {
var format = new _ol_format_MVT_({layers: ['water']}); var format = new MVT({layers: ['water']});
var features = format.readFeatures(data); var features = format.readFeatures(data);
expect(features.length).to.be(10); expect(features.length).to.be(10);
}); });
it('parses geometries correctly', function() { it('parses geometries correctly', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_, featureClass: _ol_Feature_,
layers: ['poi_label'] layers: ['poi_label']
}); });
@@ -60,14 +60,14 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
it('parses id property', function() { it('parses id property', function() {
// ol.Feature // ol.Feature
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_, featureClass: _ol_Feature_,
layers: ['building'] layers: ['building']
}); });
var features = format.readFeatures(data); var features = format.readFeatures(data);
expect(features[0].getId()).to.be(2); expect(features[0].getId()).to.be(2);
// ol.render.Feature // ol.render.Feature
format = new _ol_format_MVT_({ format = new MVT({
layers: ['building'] layers: ['building']
}); });
features = format.readFeatures(data); features = format.readFeatures(data);
@@ -75,7 +75,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
}); });
it('sets the extent of the last readFeatures call', function() { it('sets the extent of the last readFeatures call', function() {
var format = new _ol_format_MVT_(); var format = new MVT();
format.readFeatures(data); format.readFeatures(data);
var extent = format.getLastExtent(); var extent = format.getLastExtent();
expect(_ol_extent_.getWidth(extent)).to.be(4096); expect(_ol_extent_.getWidth(extent)).to.be(4096);
@@ -89,7 +89,7 @@ describe('ol.format.MVT', function() {
describe('#createFeature_', function() { describe('#createFeature_', function() {
it('accepts a geometryName', function() { it('accepts a geometryName', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_, featureClass: _ol_Feature_,
geometryName: 'myGeom' geometryName: 'myGeom'
}); });
@@ -103,13 +103,13 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
flatCoordinates.push(0, 0); flatCoordinates.push(0, 0);
ends.push(2); ends.push(2);
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.a(Point); expect(geometry).to.be.a(Point);
expect(feature.get('myGeom')).to.equal(geometry); expect(feature.get('myGeom')).to.equal(geometry);
@@ -117,7 +117,7 @@ describe('ol.format.MVT', function() {
}); });
it('detects a Polygon', function() { it('detects a Polygon', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_ featureClass: _ol_Feature_
}); });
var rawFeature = { var rawFeature = {
@@ -127,20 +127,20 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0); flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0);
flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1); flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1);
ends.push(10, 20); ends.push(10, 20);
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.a(Polygon); expect(geometry).to.be.a(Polygon);
}); });
it('detects a MultiPolygon', function() { it('detects a MultiPolygon', function() {
var format = new _ol_format_MVT_({ var format = new MVT({
featureClass: _ol_Feature_ featureClass: _ol_Feature_
}); });
var rawFeature = { var rawFeature = {
@@ -150,20 +150,20 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0); flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1); flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
ends.push(10, 20); ends.push(10, 20);
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
expect(geometry).to.be.a(MultiPolygon); expect(geometry).to.be.a(MultiPolygon);
}); });
it('creates ol.render.Feature instances', function() { it('creates ol.render.Feature instances', function() {
var format = new _ol_format_MVT_(); var format = new MVT();
var rawFeature = { var rawFeature = {
type: 3, type: 3,
properties: { properties: {
@@ -173,10 +173,10 @@ describe('ol.format.MVT', function() {
name: 'layer1' name: 'layer1'
} }
}; };
var readRawGeometry_ = _ol_format_MVT_.readRawGeometry_; var readRawGeometry_ = MVT.readRawGeometry_;
var createdFlatCoordinates; var createdFlatCoordinates;
var createdEnds; var createdEnds;
_ol_format_MVT_.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) { MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0); flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1); flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
createdFlatCoordinates = flatCoordinates; createdFlatCoordinates = flatCoordinates;
@@ -184,7 +184,7 @@ describe('ol.format.MVT', function() {
createdEnds = ends; createdEnds = ends;
}; };
var feature = format.createFeature_({}, rawFeature); var feature = format.createFeature_({}, rawFeature);
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_; MVT.readRawGeometry_ = readRawGeometry_;
expect(feature).to.be.a(_ol_render_Feature_); expect(feature).to.be.a(_ol_render_Feature_);
expect(feature.getType()).to.be('Polygon'); expect(feature.getType()).to.be('Polygon');
expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates); expect(feature.getFlatCoordinates()).to.equal(createdFlatCoordinates);
@@ -7,7 +7,7 @@ import _ol_VectorImageTile_ from '../../../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js'; import _ol_VectorTile_ from '../../../../../src/ol/VectorTile.js';
import _ol_View_ from '../../../../../src/ol/View.js'; import _ol_View_ from '../../../../../src/ol/View.js';
import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js';
import _ol_format_MVT_ from '../../../../../src/ol/format/MVT.js'; import MVT from '../../../../../src/ol/format/MVT.js';
import Point from '../../../../../src/ol/geom/Point.js'; import Point from '../../../../../src/ol/geom/Point.js';
import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../../../../../src/ol/layer/VectorTile.js';
import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js'; import {get as getProjection, fromLonLat} from '../../../../../src/ol/proj.js';
@@ -68,7 +68,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
}; };
inherits(TileClass, _ol_VectorTile_); inherits(TileClass, _ol_VectorTile_);
source = new _ol_source_VectorTile_({ source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
tileClass: TileClass, tileClass: TileClass,
tileGrid: _ol_tilegrid_.createXYZ() tileGrid: _ol_tilegrid_.createXYZ()
}); });
@@ -350,7 +350,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
document.body.appendChild(target); document.body.appendChild(target);
var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608]; var extent = [1824704.739223726, 6141868.096770482, 1827150.7241288517, 6144314.081675608];
var source = new _ol_source_VectorTile_({ var source = new _ol_source_VectorTile_({
format: new _ol_format_MVT_(), format: new MVT(),
url: 'spec/ol/data/14-8938-5680.vector.pbf', url: 'spec/ol/data/14-8938-5680.vector.pbf',
minZoom: 14, minZoom: 14,
maxZoom: 14 maxZoom: 14
+2 -2
View File
@@ -2,7 +2,7 @@ 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_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js'; import _ol_VectorImageTile_ from '../../../../src/ol/VectorImageTile.js';
import _ol_VectorTile_ from '../../../../src/ol/VectorTile.js'; import _ol_VectorTile_ from '../../../../src/ol/VectorTile.js';
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js'; import MVT from '../../../../src/ol/format/MVT.js';
import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js'; import _ol_layer_VectorTile_ from '../../../../src/ol/layer/VectorTile.js';
import {get as getProjection} from '../../../../src/ol/proj.js'; import {get as getProjection} from '../../../../src/ol/proj.js';
import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js'; import _ol_source_VectorTile_ from '../../../../src/ol/source/VectorTile.js';
@@ -11,7 +11,7 @@ import _ol_tilegrid_TileGrid_ from '../../../../src/ol/tilegrid/TileGrid.js';
describe('ol.source.VectorTile', function() { describe('ol.source.VectorTile', function() {
var format = new _ol_format_MVT_(); var format = new MVT();
var source = new _ol_source_VectorTile_({ var source = new _ol_source_VectorTile_({
format: format, format: format,
tilePixelRatio: 8, tilePixelRatio: 8,