Rename _ol_Feature_ to Feature
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -16,7 +16,7 @@ import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
// features form the corners of an equilateral triangle and their styles overlap
|
||||
var redLayer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [new _ol_Feature_(new Point([0, 0]))]
|
||||
features: [new Feature(new Point([0, 0]))]
|
||||
}),
|
||||
style: new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
@@ -34,7 +34,7 @@ var redLayer = new _ol_layer_Vector_({
|
||||
var greenLayer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
// 433.013 is roughly 250 * Math.sqrt(3)
|
||||
features: [new _ol_Feature_(new Point([250, 433.013]))]
|
||||
features: [new Feature(new Point([250, 433.013]))]
|
||||
}),
|
||||
style: new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
@@ -51,7 +51,7 @@ var greenLayer = new _ol_layer_Vector_({
|
||||
});
|
||||
var blueLayer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [new _ol_Feature_(new Point([500, 0]))]
|
||||
features: [new Feature(new Point([500, 0]))]
|
||||
}),
|
||||
style: new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -21,7 +21,7 @@ var features = new Array(count);
|
||||
var e = 4500000;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e];
|
||||
features[i] = new _ol_Feature_(new Point(coordinates));
|
||||
features[i] = new Feature(new Point(coordinates));
|
||||
}
|
||||
|
||||
var source = new _ol_source_Vector_({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {inherits} from '../src/ol/index.js';
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import LineString from '../src/ol/geom/LineString.js';
|
||||
@@ -134,12 +134,12 @@ app.Drag.prototype.handleUpEvent = function() {
|
||||
};
|
||||
|
||||
|
||||
var pointFeature = new _ol_Feature_(new Point([0, 0]));
|
||||
var pointFeature = new Feature(new Point([0, 0]));
|
||||
|
||||
var lineFeature = new _ol_Feature_(
|
||||
var lineFeature = new Feature(
|
||||
new LineString([[-1e7, 1e6], [-1e6, 3e6]]));
|
||||
|
||||
var polygonFeature = new _ol_Feature_(
|
||||
var polygonFeature = new Feature(
|
||||
new Polygon([[[-3e6, -1e6], [-3e6, 1e6],
|
||||
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_Observable_ from '../src/ol/Observable.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
@@ -47,7 +47,7 @@ function addRandomFeature() {
|
||||
var x = Math.random() * 360 - 180;
|
||||
var y = Math.random() * 180 - 90;
|
||||
var geom = new Point(fromLonLat([x, y]));
|
||||
var feature = new _ol_Feature_(geom);
|
||||
var feature = new Feature(geom);
|
||||
source.addFeature(feature);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Polyline from '../src/ol/format/Polyline.js';
|
||||
@@ -67,19 +67,19 @@ var route = /** @type {ol.geom.LineString} */ (new Polyline({
|
||||
var routeCoords = route.getCoordinates();
|
||||
var routeLength = routeCoords.length;
|
||||
|
||||
var routeFeature = new _ol_Feature_({
|
||||
var routeFeature = new Feature({
|
||||
type: 'route',
|
||||
geometry: route
|
||||
});
|
||||
var geoMarker = new _ol_Feature_({
|
||||
var geoMarker = new Feature({
|
||||
type: 'geoMarker',
|
||||
geometry: new Point(routeCoords[0])
|
||||
});
|
||||
var startMarker = new _ol_Feature_({
|
||||
var startMarker = new Feature({
|
||||
type: 'icon',
|
||||
geometry: new Point(routeCoords[0])
|
||||
});
|
||||
var endMarker = new _ol_Feature_({
|
||||
var endMarker = new Feature({
|
||||
type: 'icon',
|
||||
geometry: new Point(routeCoords[routeLength - 1])
|
||||
});
|
||||
@@ -163,7 +163,7 @@ var moveFeature = function(event) {
|
||||
}
|
||||
|
||||
var currentPoint = new Point(routeCoords[index]);
|
||||
var feature = new _ol_Feature_(currentPoint);
|
||||
var feature = new Feature(currentPoint);
|
||||
vectorContext.drawFeature(feature, styles.geoMarker);
|
||||
}
|
||||
// tell OpenLayers to continue the postcompose animation
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// NOCOMPILE
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import LineString from '../src/ol/geom/LineString.js';
|
||||
@@ -95,7 +95,7 @@ flightsSource = new _ol_source_Vector_({
|
||||
var line = new LineString(arcLine.geometries[0].coords);
|
||||
line.transform('EPSG:4326', 'EPSG:3857');
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: line,
|
||||
finished: false
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import LineString from '../src/ol/geom/LineString.js';
|
||||
@@ -15,7 +15,7 @@ var triangle = new LineString([
|
||||
[0, radius], [run, -rise], [-run, -rise], [0, radius]
|
||||
]);
|
||||
|
||||
var feature = new _ol_Feature_(triangle);
|
||||
var feature = new Feature(triangle);
|
||||
|
||||
var layer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
@@ -164,7 +164,7 @@ var vectorSource = new _ol_source_Vector_({
|
||||
features: (new GeoJSON()).readFeatures(geojsonObject)
|
||||
});
|
||||
|
||||
vectorSource.addFeature(new _ol_Feature_(new Circle([5e6, 7e6], 1e6)));
|
||||
vectorSource.addFeature(new Feature(new Circle([5e6, 7e6], 1e6)));
|
||||
|
||||
var vectorLayer = new _ol_layer_Vector_({
|
||||
source: vectorSource,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Geolocation from '../src/ol/Geolocation.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
@@ -61,12 +61,12 @@ geolocation.on('error', function(error) {
|
||||
info.style.display = '';
|
||||
});
|
||||
|
||||
var accuracyFeature = new _ol_Feature_();
|
||||
var accuracyFeature = new Feature();
|
||||
geolocation.on('change:accuracyGeometry', function() {
|
||||
accuracyFeature.setGeometry(geolocation.getAccuracyGeometry());
|
||||
});
|
||||
|
||||
var positionFeature = new _ol_Feature_();
|
||||
var positionFeature = new Feature();
|
||||
positionFeature.setStyle(new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: 6,
|
||||
|
||||
@@ -4,7 +4,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||
import _ol_source_Vector_ from '../src/ol/source/Vector.js';
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import LineString from '../src/ol/geom/LineString.js';
|
||||
import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
import _ol_style_Stroke_ from '../src/ol/style/Stroke.js';
|
||||
@@ -20,7 +20,7 @@ var style = new _ol_style_Style_({
|
||||
})
|
||||
});
|
||||
|
||||
var feature = new _ol_Feature_(new LineString([[-4000000, 0], [4000000, 0]]));
|
||||
var feature = new Feature(new LineString([[-4000000, 0], [4000000, 0]]));
|
||||
|
||||
var vector = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -11,15 +11,15 @@ import _ol_style_Icon_ from '../src/ol/style/Icon.js';
|
||||
import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
|
||||
|
||||
var rome = new _ol_Feature_({
|
||||
var rome = new Feature({
|
||||
geometry: new Point(fromLonLat([12.5, 41.9]))
|
||||
});
|
||||
|
||||
var london = new _ol_Feature_({
|
||||
var london = new Feature({
|
||||
geometry: new Point(fromLonLat([-0.12755, 51.507222]))
|
||||
});
|
||||
|
||||
var madrid = new _ol_Feature_({
|
||||
var madrid = new Feature({
|
||||
geometry: new Point(fromLonLat([-3.683333, 40.4]))
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -23,7 +23,7 @@ function createStyle(src, img) {
|
||||
});
|
||||
}
|
||||
|
||||
var iconFeature = new _ol_Feature_(new Point([0, 0]));
|
||||
var iconFeature = new Feature(new Point([0, 0]));
|
||||
iconFeature.set('style', createStyle('data/icon.png', undefined));
|
||||
|
||||
var map = new Map({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -63,7 +63,7 @@ var e = 25000000;
|
||||
for (i = 0; i < featureCount; ++i) {
|
||||
geometry = new Point(
|
||||
[2 * e * Math.random() - e, 2 * e * Math.random() - e]);
|
||||
feature = new _ol_Feature_(geometry);
|
||||
feature = new Feature(geometry);
|
||||
feature.setStyle(
|
||||
new _ol_style_Style_({
|
||||
image: icons[i % (iconCount - 1)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_Overlay_ from '../src/ol/Overlay.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
@@ -11,7 +11,7 @@ import _ol_style_Icon_ from '../src/ol/style/Icon.js';
|
||||
import _ol_style_Style_ from '../src/ol/style/Style.js';
|
||||
|
||||
|
||||
var iconFeature = new _ol_Feature_({
|
||||
var iconFeature = new Feature({
|
||||
geometry: new Point([0, 0]),
|
||||
name: 'Null Island',
|
||||
population: 4000,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
@@ -196,7 +196,7 @@ document.getElementById('time').addEventListener('input', function() {
|
||||
var coordinate = geometry.getCoordinateAtM(m, true);
|
||||
var highlight = feature.get('highlight');
|
||||
if (highlight === undefined) {
|
||||
highlight = new _ol_Feature_(new Point(coordinate));
|
||||
highlight = new Feature(new Point(coordinate));
|
||||
feature.set('highlight', highlight);
|
||||
featureOverlay.getSource().addFeature(highlight);
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -46,7 +46,7 @@ var styles = {
|
||||
|
||||
|
||||
function createLayer(coordinates, style, zIndex) {
|
||||
var feature = new _ol_Feature_(new Point(coordinates));
|
||||
var feature = new Feature(new Point(coordinates));
|
||||
feature.setStyle(style);
|
||||
|
||||
var source = new _ol_source_Vector_({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -72,7 +72,7 @@ var features = new Array(count);
|
||||
var e = 4500000;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e];
|
||||
features[i] = new _ol_Feature_(new Point(coordinates));
|
||||
features[i] = new Feature(new Point(coordinates));
|
||||
features[i].setStyle(styles[styleKeys[Math.floor(Math.random() * 5)]]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -90,7 +90,7 @@ var e = 25000000;
|
||||
for (i = 0; i < featureCount; ++i) {
|
||||
geometry = new Point(
|
||||
[2 * e * Math.random() - e, 2 * e * Math.random() - e]);
|
||||
feature = new _ol_Feature_(geometry);
|
||||
feature = new Feature(geometry);
|
||||
feature.setStyle(
|
||||
new _ol_style_Style_({
|
||||
image: symbols[i % symbolCount]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import LineString from '../src/ol/geom/LineString.js';
|
||||
@@ -30,7 +30,7 @@ for (i = 0; i < count; ++i) {
|
||||
deltaX = delta * signX;
|
||||
deltaY = delta * signY;
|
||||
endPoint = [startPoint[0] + deltaX, startPoint[1] + deltaY];
|
||||
features[i] = new _ol_Feature_({
|
||||
features[i] = new Feature({
|
||||
'geometry': new LineString([startPoint, endPoint])
|
||||
});
|
||||
startPoint = endPoint;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import LineString from '../src/ol/geom/LineString.js';
|
||||
@@ -15,7 +15,7 @@ var count = 20000;
|
||||
var features = new Array(count);
|
||||
var e = 18000000;
|
||||
for (var i = 0; i < count; ++i) {
|
||||
features[i] = new _ol_Feature_({
|
||||
features[i] = new Feature({
|
||||
'geometry': new Point(
|
||||
[2 * e * Math.random() - e, 2 * e * Math.random() - e]),
|
||||
'i': i,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import {circular as circularPolygon} from '../src/ol/geom/Polygon.js';
|
||||
@@ -62,7 +62,7 @@ for (x = -180; x < 180; x += 30) {
|
||||
for (y = -90; y < 90; y += 30) {
|
||||
var circle4326 = circularPolygon([x, y], radius, 64);
|
||||
var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
|
||||
vectorLayer4326.getSource().addFeature(new _ol_Feature_(circle4326));
|
||||
vectorLayer3857.getSource().addFeature(new _ol_Feature_(circle3857));
|
||||
vectorLayer4326.getSource().addFeature(new Feature(circle4326));
|
||||
vectorLayer3857.getSource().addFeature(new Feature(circle3857));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// NOCOMPILE
|
||||
// this example uses topolis and toastr for which we don't have an externs file.
|
||||
|
||||
import _ol_Feature_ from '../src/ol/Feature.js';
|
||||
import Feature from '../src/ol/Feature.js';
|
||||
import Map from '../src/ol/Map.js';
|
||||
import _ol_View_ from '../src/ol/View.js';
|
||||
import Point from '../src/ol/geom/Point.js';
|
||||
@@ -129,7 +129,7 @@ function removeElementFeature(source, element) {
|
||||
}
|
||||
|
||||
function nodeToFeature(node) {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Point(node.coordinate),
|
||||
node: node
|
||||
});
|
||||
@@ -138,7 +138,7 @@ function nodeToFeature(node) {
|
||||
}
|
||||
|
||||
function edgeToFeature(edge) {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new LineString(edge.coordinates),
|
||||
edge: edge
|
||||
});
|
||||
@@ -148,7 +148,7 @@ function edgeToFeature(edge) {
|
||||
|
||||
function faceToFeature(face) {
|
||||
var coordinates = topo.getFaceGeometry(face);
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Polygon(coordinates),
|
||||
face: face
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ import _ol_style_Style_ from './style/Style.js';
|
||||
* include a Geometry associated with a `geometry` key.
|
||||
* @api
|
||||
*/
|
||||
var _ol_Feature_ = function(opt_geometryOrProperties) {
|
||||
var Feature = function(opt_geometryOrProperties) {
|
||||
|
||||
_ol_Object_.call(this);
|
||||
|
||||
@@ -107,7 +107,7 @@ var _ol_Feature_ = function(opt_geometryOrProperties) {
|
||||
}
|
||||
};
|
||||
|
||||
inherits(_ol_Feature_, _ol_Object_);
|
||||
inherits(Feature, _ol_Object_);
|
||||
|
||||
|
||||
/**
|
||||
@@ -116,8 +116,8 @@ inherits(_ol_Feature_, _ol_Object_);
|
||||
* @return {ol.Feature} The clone.
|
||||
* @api
|
||||
*/
|
||||
_ol_Feature_.prototype.clone = function() {
|
||||
var clone = new _ol_Feature_(this.getProperties());
|
||||
Feature.prototype.clone = function() {
|
||||
var clone = new Feature(this.getProperties());
|
||||
clone.setGeometryName(this.getGeometryName());
|
||||
var geometry = this.getGeometry();
|
||||
if (geometry) {
|
||||
@@ -139,7 +139,7 @@ _ol_Feature_.prototype.clone = function() {
|
||||
* @api
|
||||
* @observable
|
||||
*/
|
||||
_ol_Feature_.prototype.getGeometry = function() {
|
||||
Feature.prototype.getGeometry = function() {
|
||||
return /** @type {ol.geom.Geometry|undefined} */ (
|
||||
this.get(this.geometryName_));
|
||||
};
|
||||
@@ -152,7 +152,7 @@ _ol_Feature_.prototype.getGeometry = function() {
|
||||
* @return {number|string|undefined} Id.
|
||||
* @api
|
||||
*/
|
||||
_ol_Feature_.prototype.getId = function() {
|
||||
Feature.prototype.getId = function() {
|
||||
return this.id_;
|
||||
};
|
||||
|
||||
@@ -164,7 +164,7 @@ _ol_Feature_.prototype.getId = function() {
|
||||
* for this feature.
|
||||
* @api
|
||||
*/
|
||||
_ol_Feature_.prototype.getGeometryName = function() {
|
||||
Feature.prototype.getGeometryName = function() {
|
||||
return this.geometryName_;
|
||||
};
|
||||
|
||||
@@ -176,7 +176,7 @@ _ol_Feature_.prototype.getGeometryName = function() {
|
||||
* ol.FeatureStyleFunction|ol.StyleFunction} The feature style.
|
||||
* @api
|
||||
*/
|
||||
_ol_Feature_.prototype.getStyle = function() {
|
||||
Feature.prototype.getStyle = function() {
|
||||
return this.style_;
|
||||
};
|
||||
|
||||
@@ -187,7 +187,7 @@ _ol_Feature_.prototype.getStyle = function() {
|
||||
* representing the current style of this feature.
|
||||
* @api
|
||||
*/
|
||||
_ol_Feature_.prototype.getStyleFunction = function() {
|
||||
Feature.prototype.getStyleFunction = function() {
|
||||
return this.styleFunction_;
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ _ol_Feature_.prototype.getStyleFunction = function() {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_Feature_.prototype.handleGeometryChange_ = function() {
|
||||
Feature.prototype.handleGeometryChange_ = function() {
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -203,7 +203,7 @@ _ol_Feature_.prototype.handleGeometryChange_ = function() {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_ol_Feature_.prototype.handleGeometryChanged_ = function() {
|
||||
Feature.prototype.handleGeometryChanged_ = function() {
|
||||
if (this.geometryChangeKey_) {
|
||||
_ol_events_.unlistenByKey(this.geometryChangeKey_);
|
||||
this.geometryChangeKey_ = null;
|
||||
@@ -224,7 +224,7 @@ _ol_Feature_.prototype.handleGeometryChanged_ = function() {
|
||||
* @api
|
||||
* @observable
|
||||
*/
|
||||
_ol_Feature_.prototype.setGeometry = function(geometry) {
|
||||
Feature.prototype.setGeometry = function(geometry) {
|
||||
this.set(this.geometryName_, geometry);
|
||||
};
|
||||
|
||||
@@ -238,10 +238,10 @@ _ol_Feature_.prototype.setGeometry = function(geometry) {
|
||||
* @api
|
||||
* @fires ol.events.Event#event:change
|
||||
*/
|
||||
_ol_Feature_.prototype.setStyle = function(style) {
|
||||
Feature.prototype.setStyle = function(style) {
|
||||
this.style_ = style;
|
||||
this.styleFunction_ = !style ?
|
||||
undefined : _ol_Feature_.createStyleFunction(style);
|
||||
undefined : Feature.createStyleFunction(style);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -255,7 +255,7 @@ _ol_Feature_.prototype.setStyle = function(style) {
|
||||
* @api
|
||||
* @fires ol.events.Event#event:change
|
||||
*/
|
||||
_ol_Feature_.prototype.setId = function(id) {
|
||||
Feature.prototype.setId = function(id) {
|
||||
this.id_ = id;
|
||||
this.changed();
|
||||
};
|
||||
@@ -268,7 +268,7 @@ _ol_Feature_.prototype.setId = function(id) {
|
||||
* @param {string} name The property name of the default geometry.
|
||||
* @api
|
||||
*/
|
||||
_ol_Feature_.prototype.setGeometryName = function(name) {
|
||||
Feature.prototype.setGeometryName = function(name) {
|
||||
_ol_events_.unlisten(
|
||||
this, _ol_Object_.getChangeEventType(this.geometryName_),
|
||||
this.handleGeometryChanged_, this);
|
||||
@@ -288,7 +288,7 @@ _ol_Feature_.prototype.setGeometryName = function(name) {
|
||||
* A feature style function, a single style, or an array of styles.
|
||||
* @return {ol.FeatureStyleFunction} A style function.
|
||||
*/
|
||||
_ol_Feature_.createStyleFunction = function(obj) {
|
||||
Feature.createStyleFunction = function(obj) {
|
||||
var styleFunction;
|
||||
|
||||
if (typeof obj === 'function') {
|
||||
@@ -317,4 +317,4 @@ _ol_Feature_.createStyleFunction = function(obj) {
|
||||
}
|
||||
return styleFunction;
|
||||
};
|
||||
export default _ol_Feature_;
|
||||
export default Feature;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/EsriJSON
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {containsExtent} from '../extent.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
@@ -464,7 +464,7 @@ EsriJSON.prototype.readFeatureFromObject = function(
|
||||
var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
|
||||
var geometry = EsriJSON.readGeometry_(esriJSONFeature.geometry,
|
||||
opt_options);
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
if (this.geometryName_) {
|
||||
feature.setGeometryName(this.geometryName_);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// envelopes/extents, only geometries!
|
||||
import {inherits} from '../index.js';
|
||||
import {extend} from '../array.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import XMLFeature from '../format/XMLFeature.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
@@ -244,7 +244,7 @@ GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
values[localName] = this.readGeometryElement(n, objectStack);
|
||||
}
|
||||
}
|
||||
var feature = new _ol_Feature_(values);
|
||||
var feature = new Feature(values);
|
||||
if (geometryName) {
|
||||
feature.setGeometryName(geometryName);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/GPX
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {includes} from '../array.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import XMLFeature from '../format/XMLFeature.js';
|
||||
@@ -542,7 +542,7 @@ function readRte(node, objectStack) {
|
||||
var geometry = new LineString(null);
|
||||
geometry.setFlatCoordinates(layout, flatCoordinates);
|
||||
transformWithOptions(geometry, false, options);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
feature.setProperties(values);
|
||||
return feature;
|
||||
}
|
||||
@@ -574,7 +574,7 @@ function readTrk(node, objectStack) {
|
||||
var geometry = new MultiLineString(null);
|
||||
geometry.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||
transformWithOptions(geometry, false, options);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
feature.setProperties(values);
|
||||
return feature;
|
||||
}
|
||||
@@ -596,7 +596,7 @@ function readWpt(node, objectStack) {
|
||||
var layout = GPX.applyLayoutOptions_(layoutOptions, coordinates);
|
||||
var geometry = new Point(coordinates, layout);
|
||||
transformWithOptions(geometry, false, options);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
feature.setProperties(values);
|
||||
return feature;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import {inherits} from '../index.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import JSONFeature from '../format/JSONFeature.js';
|
||||
import GeometryCollection from '../geom/GeometryCollection.js';
|
||||
@@ -360,7 +360,7 @@ GeoJSON.prototype.readFeatureFromObject = function(object, opt_options) {
|
||||
}
|
||||
|
||||
var geometry = readGeometry(geoJSONFeature.geometry, opt_options);
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
if (this.geometryName_) {
|
||||
feature.setGeometryName(this.geometryName_);
|
||||
} else if (this.extractGeometryName_ && geoJSONFeature.geometry_name !== undefined) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/IGC
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import TextFeature from '../format/TextFeature.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
@@ -163,7 +163,7 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) {
|
||||
var lineString = new LineString(null);
|
||||
var layout = altitudeMode == IGCZ.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM;
|
||||
lineString.setFlatCoordinates(layout, flatCoordinates);
|
||||
var feature = new _ol_Feature_(transformWithOptions(lineString, false, opt_options));
|
||||
var feature = new Feature(transformWithOptions(lineString, false, opt_options));
|
||||
feature.setProperties(properties);
|
||||
return feature;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/KML
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {extend, includes} from '../array.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {asArray} from '../color.js';
|
||||
@@ -1700,7 +1700,7 @@ KML.prototype.readPlacemark_ = function(node, objectStack) {
|
||||
if (!object) {
|
||||
return undefined;
|
||||
}
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
var id = node.getAttribute('id');
|
||||
if (id !== null) {
|
||||
feature.setId(id);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// FIXME add typedef for stack state objects
|
||||
import {inherits} from '../index.js';
|
||||
import {extend} from '../array.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import XMLFeature from '../format/XMLFeature.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
@@ -58,7 +58,7 @@ OSMXML.readNode_ = function(node, objectStack) {
|
||||
if (!_ol_obj_.isEmpty(values.tags)) {
|
||||
var geometry = new Point(coordinates);
|
||||
transformWithOptions(geometry, false, options);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
feature.setId(id);
|
||||
feature.setProperties(values.tags);
|
||||
state.features.push(feature);
|
||||
@@ -193,7 +193,7 @@ OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
||||
}
|
||||
transformWithOptions(geometry, false, options);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
feature.setId(values.id);
|
||||
feature.setProperties(values.tags);
|
||||
state.features.push(feature);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import TextFeature from '../format/TextFeature.js';
|
||||
import GeometryLayout from '../geom/GeometryLayout.js';
|
||||
@@ -282,7 +282,7 @@ Polyline.prototype.readFeature;
|
||||
*/
|
||||
Polyline.prototype.readFeatureFromText = function(text, opt_options) {
|
||||
var geometry = this.readGeometryFromText(text, opt_options);
|
||||
return new _ol_Feature_(geometry);
|
||||
return new Feature(geometry);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/TopoJSON
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import JSONFeature from '../format/JSONFeature.js';
|
||||
import LineString from '../geom/LineString.js';
|
||||
@@ -260,7 +260,7 @@ function readFeatureFromGeometry(object, arcs, scale, translate, property, name,
|
||||
} else {
|
||||
geometry = geometryReader(object, arcs);
|
||||
}
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
|
||||
transformWithOptions(geometry, false, opt_options)));
|
||||
if (object.id !== undefined) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/format/WKT
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import {transformWithOptions} from '../format/Feature.js';
|
||||
import TextFeature from '../format/TextFeature.js';
|
||||
import GeometryCollection from '../geom/GeometryCollection.js';
|
||||
@@ -269,7 +269,7 @@ WKT.prototype.readFeature;
|
||||
WKT.prototype.readFeatureFromText = function(text, opt_options) {
|
||||
var geom = this.readGeometryFromText(text, opt_options);
|
||||
if (geom) {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(geom);
|
||||
return feature;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ WKT.prototype.readFeaturesFromText = function(text, opt_options) {
|
||||
}
|
||||
var feature, features = [];
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
feature = new _ol_Feature_();
|
||||
feature = new Feature();
|
||||
feature.setGeometry(geometries[i]);
|
||||
features.push(feature);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/interaction/Draw
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import _ol_Object_ from '../Object.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
@@ -481,7 +481,7 @@ Draw.prototype.atFinish_ = function(event) {
|
||||
Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
|
||||
var coordinates = event.coordinate.slice();
|
||||
if (!this.sketchPoint_) {
|
||||
this.sketchPoint_ = new _ol_Feature_(new Point(coordinates));
|
||||
this.sketchPoint_ = new Feature(new Point(coordinates));
|
||||
this.updateSketchFeatures_();
|
||||
} else {
|
||||
var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry());
|
||||
@@ -510,11 +510,11 @@ Draw.prototype.startDrawing_ = function(event) {
|
||||
}
|
||||
}
|
||||
if (this.sketchLineCoords_) {
|
||||
this.sketchLine_ = new _ol_Feature_(
|
||||
this.sketchLine_ = new Feature(
|
||||
new LineString(this.sketchLineCoords_));
|
||||
}
|
||||
var geometry = this.geometryFunction_(this.sketchCoords_);
|
||||
this.sketchFeature_ = new _ol_Feature_();
|
||||
this.sketchFeature_ = new Feature();
|
||||
if (this.geometryName_) {
|
||||
this.sketchFeature_.setGeometryName(this.geometryName_);
|
||||
}
|
||||
@@ -557,7 +557,7 @@ Draw.prototype.modifyDrawing_ = function(event) {
|
||||
if (geometry instanceof Polygon &&
|
||||
this.mode_ !== Draw.Mode_.POLYGON) {
|
||||
if (!this.sketchLine_) {
|
||||
this.sketchLine_ = new _ol_Feature_(new LineString(null));
|
||||
this.sketchLine_ = new Feature(new LineString(null));
|
||||
}
|
||||
var ring = geometry.getLinearRing(0);
|
||||
sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/interaction/Extent
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
@@ -374,9 +374,9 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
|
||||
|
||||
if (!extentFeature) {
|
||||
if (!extent) {
|
||||
extentFeature = new _ol_Feature_({});
|
||||
extentFeature = new Feature({});
|
||||
} else {
|
||||
extentFeature = new _ol_Feature_(polygonFromExtent(extent));
|
||||
extentFeature = new Feature(polygonFromExtent(extent));
|
||||
}
|
||||
this.extentFeature_ = extentFeature;
|
||||
this.extentOverlay_.getSource().addFeature(extentFeature);
|
||||
@@ -399,7 +399,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
|
||||
_ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(vertex) {
|
||||
var vertexFeature = this.vertexFeature_;
|
||||
if (!vertexFeature) {
|
||||
vertexFeature = new _ol_Feature_(new Point(vertex));
|
||||
vertexFeature = new Feature(new Point(vertex));
|
||||
this.vertexFeature_ = vertexFeature;
|
||||
this.vertexOverlay_.getSource().addFeature(vertexFeature);
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_Collection_ from '../Collection.js';
|
||||
import CollectionEventType from '../CollectionEventType.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import {equals} from '../array.js';
|
||||
@@ -579,7 +579,7 @@ _ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(fe
|
||||
_ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordinates) {
|
||||
var vertexFeature = this.vertexFeature_;
|
||||
if (!vertexFeature) {
|
||||
vertexFeature = new _ol_Feature_(new Point(coordinates));
|
||||
vertexFeature = new Feature(new Point(coordinates));
|
||||
this.vertexFeature_ = vertexFeature;
|
||||
this.overlay_.getSource().addFeature(vertexFeature);
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import _ol_Feature_ from '../Feature.js';
|
||||
import Feature from '../Feature.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
|
||||
@@ -191,7 +191,7 @@ _ol_source_Cluster_.prototype.createCluster = function(features) {
|
||||
}
|
||||
_ol_coordinate_.scale(centroid, 1 / features.length);
|
||||
|
||||
var cluster = new _ol_Feature_(new Point(centroid));
|
||||
var cluster = new Feature(new Point(centroid));
|
||||
cluster.set('features', features);
|
||||
return cluster;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
|
||||
@@ -42,11 +42,11 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
var source;
|
||||
|
||||
function addCircle(r) {
|
||||
source.addFeature(new _ol_Feature_(new Circle(center, r)));
|
||||
source.addFeature(new Feature(new Circle(center, r)));
|
||||
}
|
||||
|
||||
function addPolygon(r) {
|
||||
source.addFeature(new _ol_Feature_(new Polygon([
|
||||
source.addFeature(new Feature(new Polygon([
|
||||
[
|
||||
[center[0] - r, center[1] - r],
|
||||
[center[0] + r, center[1] - r],
|
||||
@@ -58,7 +58,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
}
|
||||
|
||||
function addLineString(r) {
|
||||
source.addFeature(new _ol_Feature_(new LineString([
|
||||
source.addFeature(new Feature(new LineString([
|
||||
[center[0] - r, center[1] - r],
|
||||
[center[0] + r, center[1] - r],
|
||||
[center[0] + r, center[1] + r],
|
||||
@@ -75,7 +75,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
|
||||
it('renders opacity correctly with the canvas renderer', function(done) {
|
||||
createMap('canvas');
|
||||
var smallLine = new _ol_Feature_(new LineString([
|
||||
var smallLine = new Feature(new LineString([
|
||||
[center[0], center[1] - 1],
|
||||
[center[0], center[1] + 1]
|
||||
]));
|
||||
@@ -101,7 +101,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
|
||||
it('renders opacity correctly with renderMode: \'image\'', function(done) {
|
||||
createMap('canvas');
|
||||
var smallLine = new _ol_Feature_(new LineString([
|
||||
var smallLine = new Feature(new LineString([
|
||||
[center[0], center[1] - 1],
|
||||
[center[0], center[1] + 1]
|
||||
]));
|
||||
@@ -128,7 +128,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
|
||||
it('renders transparent layers correctly with the canvas renderer', function(done) {
|
||||
createMap('canvas');
|
||||
var smallLine = new _ol_Feature_(new LineString([
|
||||
var smallLine = new Feature(new LineString([
|
||||
[center[0], center[1] - 1],
|
||||
[center[0], center[1] + 1]
|
||||
]));
|
||||
@@ -141,7 +141,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
})
|
||||
]);
|
||||
source.addFeature(smallLine);
|
||||
var smallLine2 = new _ol_Feature_(new LineString([
|
||||
var smallLine2 = new Feature(new LineString([
|
||||
[center[0], center[1] - 1000],
|
||||
[center[0], center[1] + 1000]
|
||||
]));
|
||||
@@ -167,7 +167,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
|
||||
it('renders transparent layers correctly with renderMode: \'image\'', function(done) {
|
||||
createMap('canvas');
|
||||
var smallLine = new _ol_Feature_(new LineString([
|
||||
var smallLine = new Feature(new LineString([
|
||||
[center[0], center[1] - 1],
|
||||
[center[0], center[1] + 1]
|
||||
]));
|
||||
@@ -180,7 +180,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
})
|
||||
]);
|
||||
source.addFeature(smallLine);
|
||||
var smallLine2 = new _ol_Feature_(new LineString([
|
||||
var smallLine2 = new Feature(new LineString([
|
||||
[center[0], center[1] - 1000],
|
||||
[center[0], center[1] + 1000]
|
||||
]));
|
||||
@@ -494,14 +494,14 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
beforeEach(function() {
|
||||
var src = new _ol_source_Vector_({
|
||||
features: [
|
||||
new _ol_Feature_(new Polygon([[
|
||||
new Feature(new Polygon([[
|
||||
[-22, 58],
|
||||
[-22, 78],
|
||||
[-9, 78],
|
||||
[-9, 58],
|
||||
[-22, 58]
|
||||
]])),
|
||||
new _ol_Feature_(new Polygon([[
|
||||
new Feature(new Polygon([[
|
||||
[-9, 58],
|
||||
[-9, 78],
|
||||
[4, 78],
|
||||
@@ -589,16 +589,16 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var centerFeature = new _ol_Feature_({
|
||||
var centerFeature = new Feature({
|
||||
geometry: new Point(center),
|
||||
text: 'center'
|
||||
});
|
||||
source.addFeature(centerFeature);
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]]),
|
||||
text: 'west'
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]]),
|
||||
text: 'east'
|
||||
}));
|
||||
@@ -630,16 +630,16 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var centerFeature = new _ol_Feature_({
|
||||
var centerFeature = new Feature({
|
||||
geometry: new Point(center),
|
||||
text: 'center'
|
||||
});
|
||||
source.addFeature(centerFeature);
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]]),
|
||||
text: 'west'
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]]),
|
||||
text: 'east'
|
||||
}));
|
||||
@@ -670,17 +670,17 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point(center),
|
||||
text: 'center',
|
||||
zIndex: 2
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]]),
|
||||
text: 'west',
|
||||
zIndex: 3
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]]),
|
||||
text: 'east',
|
||||
zIndex: 1
|
||||
@@ -710,14 +710,14 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var centerFeature = new _ol_Feature_({
|
||||
var centerFeature = new Feature({
|
||||
geometry: new Point(center)
|
||||
});
|
||||
source.addFeature(centerFeature);
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]])
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]])
|
||||
}));
|
||||
|
||||
@@ -750,14 +750,14 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var centerFeature = new _ol_Feature_({
|
||||
var centerFeature = new Feature({
|
||||
geometry: new Point(center)
|
||||
});
|
||||
source.addFeature(centerFeature);
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]])
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]])
|
||||
}));
|
||||
|
||||
@@ -789,15 +789,15 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point(center),
|
||||
zIndex: 2
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]]),
|
||||
zIndex: 3
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]]),
|
||||
zIndex: 1
|
||||
}));
|
||||
@@ -828,15 +828,15 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point(center),
|
||||
text: 'center'
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] - 540, center[1]]),
|
||||
text: 'west'
|
||||
}));
|
||||
source.addFeature(new _ol_Feature_({
|
||||
source.addFeature(new Feature({
|
||||
geometry: new Point([center[0] + 540, center[1]]),
|
||||
text: 'east'
|
||||
}));
|
||||
@@ -872,7 +872,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var point = new _ol_Feature_(new Point(center));
|
||||
var point = new Feature(new Point(center));
|
||||
point.setStyle(new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: 8,
|
||||
@@ -881,7 +881,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
})
|
||||
})
|
||||
}));
|
||||
var line = new _ol_Feature_(new LineString([
|
||||
var line = new Feature(new LineString([
|
||||
[center[0] - 650, center[1] - 200],
|
||||
[center[0] + 650, center[1] - 200]
|
||||
]));
|
||||
@@ -915,7 +915,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var point = new _ol_Feature_(new Point(center));
|
||||
var point = new Feature(new Point(center));
|
||||
point.setStyle(new _ol_style_Style_({
|
||||
image: new _ol_style_Circle_({
|
||||
radius: 8,
|
||||
@@ -924,7 +924,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
})
|
||||
})
|
||||
}));
|
||||
var line = new _ol_Feature_(new LineString([
|
||||
var line = new Feature(new LineString([
|
||||
[center[0] - 650, center[1] - 200],
|
||||
[center[0] + 650, center[1] - 200]
|
||||
]));
|
||||
@@ -958,7 +958,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var point = new _ol_Feature_(new Point(center));
|
||||
var point = new Feature(new Point(center));
|
||||
point.setStyle(new _ol_style_Style_({
|
||||
zIndex: 2,
|
||||
image: new _ol_style_Circle_({
|
||||
@@ -968,7 +968,7 @@ describe('ol.rendering.layer.Vector', function() {
|
||||
})
|
||||
})
|
||||
}));
|
||||
var line = new _ol_Feature_(new LineString([
|
||||
var line = new Feature(new LineString([
|
||||
[center[0] - 650, center[1] - 200],
|
||||
[center[0] + 650, center[1] - 200]
|
||||
]));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import MVT from '../../../../src/ol/format/MVT.js';
|
||||
@@ -98,7 +98,7 @@ describe('ol.rendering.layer.VectorTile', function() {
|
||||
createMap('canvas');
|
||||
var vectorSource = new _ol_source_Vector_({
|
||||
features: [
|
||||
new _ol_Feature_(new Point([1825727.7316762917, 6143091.089223046]))
|
||||
new Feature(new Point([1825727.7316762917, 6143091.089223046]))
|
||||
]
|
||||
});
|
||||
map.addLayer(new _ol_layer_Vector_({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
||||
import Feature from '../../../src/ol/Feature.js';
|
||||
import Point from '../../../src/ol/geom/Point.js';
|
||||
import Map from '../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../src/ol/View.js';
|
||||
@@ -12,7 +12,7 @@ describe('ol.rendering.Map', function() {
|
||||
function createMap(renderer) {
|
||||
var vectorLayer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [new _ol_Feature_({
|
||||
features: [new Feature({
|
||||
geometry: new Point([0, 0])
|
||||
})]
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
@@ -45,7 +45,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
|
||||
function createFeatures(multi) {
|
||||
var feature;
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[-20, 18]]) : new Point([-20, 18])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -58,7 +58,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[-10, 18]]) : new Point([-10, 18])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -71,7 +71,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[4, 18]]) : new Point([4, 18])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -84,7 +84,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[-20, 3]]) : new Point([-20, 3])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -101,7 +101,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[-10, 3]]) : new Point([-10, 3])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -118,7 +118,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[4, 3]]) : new Point([4, 3])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -135,7 +135,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[-20, -15]]) : new Point([-20, -15])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -149,7 +149,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[-10, -15]]) : new Point([-10, -15])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -166,7 +166,7 @@ describe('ol.rendering.style.Circle', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: multi ? new MultiPoint([[4, -15]]) : new Point([4, -15])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -51,7 +51,7 @@ describe('ol.rendering.style.Icon', function() {
|
||||
|
||||
function createFeatures(src, imgInfo, callback) {
|
||||
var feature;
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([0, 0])
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -43,7 +43,7 @@ describe('ol.rendering.style.LineString', function() {
|
||||
function createFeatures() {
|
||||
var feature;
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[-20, 20], [15, 20]]
|
||||
)
|
||||
@@ -53,7 +53,7 @@ describe('ol.rendering.style.LineString', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[-20, 15], [15, 15]]
|
||||
)
|
||||
@@ -63,7 +63,7 @@ describe('ol.rendering.style.LineString', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[-20, 10], [15, 10]]
|
||||
)
|
||||
@@ -75,7 +75,7 @@ describe('ol.rendering.style.LineString', function() {
|
||||
})]);
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[-20, -20], [-2, 0], [15, -20]]
|
||||
)
|
||||
@@ -91,7 +91,7 @@ describe('ol.rendering.style.LineString', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[-20, -15], [-2, 5], [15, -15]]
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -48,7 +48,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
|
||||
var feature;
|
||||
// rectangle
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
||||
])
|
||||
@@ -59,7 +59,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with 1 hole
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]],
|
||||
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
|
||||
@@ -72,7 +72,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with 2 holes
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]],
|
||||
[[-18, -18], [-12, -18], [-12, -12], [-18, -12], [-18, -18]],
|
||||
@@ -113,7 +113,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
|
||||
var feature;
|
||||
// rectangle
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
||||
])
|
||||
@@ -124,7 +124,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with 1 hole
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[0, 10], [0, 20], [20, 20], [20, 10], [0, 10]],
|
||||
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
|
||||
@@ -137,7 +137,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with 2 holes
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, -20], [-20, 5], [20, 5], [20, -20], [-20, -20]],
|
||||
[[-12, -3], [-12, -12], [-8, -12], [-8, -3], [-12, -3]],
|
||||
@@ -173,7 +173,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
function createFeatures() {
|
||||
var feature;
|
||||
// rectangle with z-index 2
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]]
|
||||
])
|
||||
@@ -185,7 +185,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with z-index 3
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]]
|
||||
])
|
||||
@@ -197,7 +197,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with z-index 1
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]]
|
||||
])
|
||||
@@ -230,7 +230,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
function createFeatures() {
|
||||
var feature;
|
||||
// rectangle
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
||||
])
|
||||
@@ -242,7 +242,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with 1 hole
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]]
|
||||
])
|
||||
@@ -254,7 +254,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
// rectangle with 2 holes
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]]
|
||||
])
|
||||
@@ -316,7 +316,7 @@ describe('ol.rendering.style.Polygon', function() {
|
||||
}
|
||||
|
||||
function createFeatures() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Polygon([
|
||||
[[-20, -20], [-20, 20], [18, 20], [-20, -20]]
|
||||
])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -42,7 +42,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
||||
|
||||
function createFeatures(stroke, fill) {
|
||||
var feature;
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([-15, 15])
|
||||
});
|
||||
// square
|
||||
@@ -57,7 +57,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([8, 15])
|
||||
});
|
||||
// triangle
|
||||
@@ -73,7 +73,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([-10, -8])
|
||||
});
|
||||
// star
|
||||
@@ -89,7 +89,7 @@ describe('ol.rendering.style.RegularShape', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([12, -8])
|
||||
});
|
||||
// cross
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
@@ -49,7 +49,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
function createFeatures(opt_scale) {
|
||||
var scale = opt_scale || 1;
|
||||
var feature;
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([-20, 18])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -61,7 +61,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([-10, 0])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -80,7 +80,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
feature = new _ol_Feature_({
|
||||
feature = new Feature({
|
||||
geometry: new Point([20, 10])
|
||||
});
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
@@ -124,13 +124,13 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_(geom);
|
||||
var feature = new Feature(geom);
|
||||
feature.setStyle(style);
|
||||
vectorSource.addFeature(feature);
|
||||
|
||||
geom = geom.clone();
|
||||
geom.translate(0, 5);
|
||||
feature = new _ol_Feature_(geom);
|
||||
feature = new Feature(geom);
|
||||
style = style.clone();
|
||||
style.getText().setTextBaseline('top');
|
||||
feature.setStyle(style);
|
||||
@@ -138,7 +138,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
|
||||
geom = geom.clone();
|
||||
geom.translate(0, -10);
|
||||
feature = new _ol_Feature_(geom);
|
||||
feature = new Feature(geom);
|
||||
style = style.clone();
|
||||
style.getText().setTextBaseline('bottom');
|
||||
feature.setStyle(style);
|
||||
@@ -175,7 +175,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
it('renders multiline text with alignment options', function(done) {
|
||||
createMap('canvas');
|
||||
var feature;
|
||||
feature = new _ol_Feature_(new Point([25, 0]));
|
||||
feature = new Feature(new Point([25, 0]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world\nleft',
|
||||
@@ -184,7 +184,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new _ol_Feature_(new Point([-25, 0]));
|
||||
feature = new Feature(new Point([-25, 0]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world\nright',
|
||||
@@ -193,7 +193,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new _ol_Feature_(new Point([0, 25]));
|
||||
feature = new Feature(new Point([0, 25]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world\nbottom',
|
||||
@@ -202,7 +202,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new _ol_Feature_(new Point([0, -25]));
|
||||
feature = new Feature(new Point([0, -25]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'top\nHello world',
|
||||
@@ -217,7 +217,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
it('renders multiline text with positioning options', function(done) {
|
||||
createMap('canvas');
|
||||
var feature;
|
||||
feature = new _ol_Feature_(new Point([0, 0]));
|
||||
feature = new Feature(new Point([0, 0]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world\nleft',
|
||||
@@ -227,7 +227,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new _ol_Feature_(new Point([0, 0]));
|
||||
feature = new Feature(new Point([0, 0]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world\nright',
|
||||
@@ -237,7 +237,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new _ol_Feature_(new Point([0, 0]));
|
||||
feature = new Feature(new Point([0, 0]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world\nbottom',
|
||||
@@ -247,7 +247,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
})
|
||||
}));
|
||||
vectorSource.addFeature(feature);
|
||||
feature = new _ol_Feature_(new Point([0, 0]));
|
||||
feature = new Feature(new Point([0, 0]));
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'top\nHello world',
|
||||
@@ -272,7 +272,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
line = line.clone();
|
||||
line.translate(0, -100);
|
||||
geom.appendLineString(line);
|
||||
var feature = new _ol_Feature_(geom);
|
||||
var feature = new Feature(geom);
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world',
|
||||
@@ -289,7 +289,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
createMap('canvas');
|
||||
var geom = new Polygon(null);
|
||||
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
||||
var feature = new _ol_Feature_(geom);
|
||||
var feature = new Feature(geom);
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world',
|
||||
@@ -315,7 +315,7 @@ describe('ol.rendering.style.Text', function() {
|
||||
geom = geom.clone();
|
||||
geom.translate(0, -60);
|
||||
multiPolygon.appendPolygon(geom);
|
||||
var feature = new _ol_Feature_(multiPolygon);
|
||||
var feature = new Feature(multiPolygon);
|
||||
feature.setStyle(new _ol_style_Style_({
|
||||
text: new _ol_style_Text_({
|
||||
text: 'Hello world',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
||||
import Feature from '../../../src/ol/Feature.js';
|
||||
import Point from '../../../src/ol/geom/Point.js';
|
||||
import _ol_obj_ from '../../../src/ol/obj.js';
|
||||
import _ol_style_Style_ from '../../../src/ol/style/Style.js';
|
||||
@@ -9,25 +9,25 @@ describe('ol.Feature', function() {
|
||||
describe('constructor', function() {
|
||||
|
||||
it('creates a new feature', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
expect(feature).to.be.a(_ol_Feature_);
|
||||
var feature = new Feature();
|
||||
expect(feature).to.be.a(Feature);
|
||||
});
|
||||
|
||||
it('takes properties', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
foo: 'bar'
|
||||
});
|
||||
expect(feature.get('foo')).to.be('bar');
|
||||
});
|
||||
|
||||
it('can store the feature\'s commonly used id', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
expect(feature.getId()).to.be('foo');
|
||||
});
|
||||
|
||||
it('will set the default geometry', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Point([10, 20]),
|
||||
foo: 'bar'
|
||||
});
|
||||
@@ -41,7 +41,7 @@ describe('ol.Feature', function() {
|
||||
describe('#get()', function() {
|
||||
|
||||
it('returns values set at construction', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
a: 'first',
|
||||
b: 'second'
|
||||
});
|
||||
@@ -50,12 +50,12 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('returns undefined for unset attributes', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
expect(feature.get('a')).to.be(undefined);
|
||||
});
|
||||
|
||||
it('returns values set by set', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('a', 'b');
|
||||
expect(feature.get('a')).to.be('b');
|
||||
});
|
||||
@@ -66,7 +66,7 @@ describe('ol.Feature', function() {
|
||||
|
||||
it('returns an object with all attributes', function() {
|
||||
var point = new Point([15, 30]);
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
foo: 'bar',
|
||||
ten: 10,
|
||||
geometry: point
|
||||
@@ -83,7 +83,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('is empty by default', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
var properties = feature.getProperties();
|
||||
expect(_ol_obj_.isEmpty(properties)).to.be(true);
|
||||
});
|
||||
@@ -96,30 +96,30 @@ describe('ol.Feature', function() {
|
||||
var point = new Point([15, 30]);
|
||||
|
||||
it('returns undefined for unset geometry', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
expect(feature.getGeometry()).to.be(undefined);
|
||||
});
|
||||
|
||||
it('returns null for null geometry (constructor)', function() {
|
||||
var feature = new _ol_Feature_(null);
|
||||
var feature = new Feature(null);
|
||||
expect(feature.getGeometry()).to.be(null);
|
||||
});
|
||||
|
||||
it('returns null for null geometry (setGeometry())', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(null);
|
||||
expect(feature.getGeometry()).to.be(null);
|
||||
});
|
||||
|
||||
it('gets the geometry set at construction', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: point
|
||||
});
|
||||
expect(feature.getGeometry()).to.be(point);
|
||||
});
|
||||
|
||||
it('gets any geometry set by setGeometry', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(point);
|
||||
expect(feature.getGeometry()).to.be(point);
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('ol.Feature', function() {
|
||||
describe('#set()', function() {
|
||||
|
||||
it('sets values', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
a: 'first',
|
||||
b: 'second'
|
||||
});
|
||||
@@ -143,7 +143,7 @@ describe('ol.Feature', function() {
|
||||
|
||||
it('can be used to set the geometry', function() {
|
||||
var point = new Point([3, 4]);
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Point([1, 2])
|
||||
});
|
||||
feature.set('geometry', point);
|
||||
@@ -153,7 +153,7 @@ describe('ol.Feature', function() {
|
||||
|
||||
it('can be used to set attributes with arbitrary names', function() {
|
||||
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
|
||||
feature.set('toString', 'string');
|
||||
expect(feature.get('toString')).to.be('string');
|
||||
@@ -174,13 +174,13 @@ describe('ol.Feature', function() {
|
||||
var point = new Point([15, 30]);
|
||||
|
||||
it('sets the default geometry', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(point);
|
||||
expect(feature.get('geometry')).to.be(point);
|
||||
});
|
||||
|
||||
it('replaces previous default geometry', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: point
|
||||
});
|
||||
expect(feature.getGeometry()).to.be(point);
|
||||
@@ -197,7 +197,7 @@ describe('ol.Feature', function() {
|
||||
var point = new Point([15, 30]);
|
||||
|
||||
it('sets property where to to look at geometry', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(point);
|
||||
expect(feature.getGeometry()).to.be(point);
|
||||
|
||||
@@ -214,7 +214,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('changes property listener', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometry(point);
|
||||
var point2 = new Point([1, 2]);
|
||||
feature.set('altGeometry', point2);
|
||||
@@ -227,7 +227,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('can use a different geometry name', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setGeometryName('foo');
|
||||
var point = new Point([10, 20]);
|
||||
feature.setGeometry(point);
|
||||
@@ -239,14 +239,14 @@ describe('ol.Feature', function() {
|
||||
describe('#setId()', function() {
|
||||
|
||||
it('sets the feature identifier', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
expect(feature.getId()).to.be(undefined);
|
||||
feature.setId('foo');
|
||||
expect(feature.getId()).to.be('foo');
|
||||
});
|
||||
|
||||
it('accepts a string or number', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
expect(feature.getId()).to.be('foo');
|
||||
feature.setId(2);
|
||||
@@ -254,7 +254,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('dispatches the "change" event', function(done) {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.on('change', function() {
|
||||
expect(feature.getId()).to.be('foo');
|
||||
done();
|
||||
@@ -271,24 +271,24 @@ describe('ol.Feature', function() {
|
||||
};
|
||||
|
||||
it('returns undefined after construction', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
expect(feature.getStyleFunction()).to.be(undefined);
|
||||
});
|
||||
|
||||
it('returns the function passed to setStyle', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle(styleFunction);
|
||||
expect(feature.getStyleFunction()).to.be(styleFunction);
|
||||
});
|
||||
|
||||
it('does not get confused with user "styleFunction" property', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('styleFunction', 'foo');
|
||||
expect(feature.getStyleFunction()).to.be(undefined);
|
||||
});
|
||||
|
||||
it('does not get confused with "styleFunction" option', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
styleFunction: 'foo'
|
||||
});
|
||||
expect(feature.getStyleFunction()).to.be(undefined);
|
||||
@@ -305,21 +305,21 @@ describe('ol.Feature', function() {
|
||||
};
|
||||
|
||||
it('accepts a single style', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle(style);
|
||||
var func = feature.getStyleFunction();
|
||||
expect(func()).to.eql([style]);
|
||||
});
|
||||
|
||||
it('accepts an array of styles', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var func = feature.getStyleFunction();
|
||||
expect(func()).to.eql([style]);
|
||||
});
|
||||
|
||||
it('accepts a style function', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
function featureStyleFunction(resolution) {
|
||||
return styleFunction(this, resolution);
|
||||
}
|
||||
@@ -329,14 +329,14 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('accepts a layer style function', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle(styleFunction);
|
||||
expect(feature.getStyleFunction()).to.not.be(styleFunction);
|
||||
expect(feature.getStyleFunction()(42)).to.be(42);
|
||||
});
|
||||
|
||||
it('accepts null', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle(style);
|
||||
feature.setStyle(null);
|
||||
expect(feature.getStyle()).to.be(null);
|
||||
@@ -344,7 +344,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('dispatches a change event', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
var spy = sinon.spy();
|
||||
feature.on('change', spy);
|
||||
feature.setStyle(style);
|
||||
@@ -362,7 +362,7 @@ describe('ol.Feature', function() {
|
||||
};
|
||||
|
||||
it('returns what is passed to setStyle', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
|
||||
expect(feature.getStyle()).to.be(null);
|
||||
|
||||
@@ -378,7 +378,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('does not get confused with "style" option to constructor', function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
style: 'foo'
|
||||
});
|
||||
|
||||
@@ -386,7 +386,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('does not get confused with user set "style" property', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('style', 'foo');
|
||||
|
||||
expect(feature.getStyle()).to.be(null);
|
||||
@@ -397,7 +397,7 @@ describe('ol.Feature', function() {
|
||||
describe('#clone', function() {
|
||||
|
||||
it('correctly clones features', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setProperties({'fookey': 'fooval'});
|
||||
feature.setId(1);
|
||||
feature.setGeometryName('geom');
|
||||
@@ -421,7 +421,7 @@ describe('ol.Feature', function() {
|
||||
});
|
||||
|
||||
it('correctly clones features with no geometry and no style', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('fookey', 'fooval');
|
||||
|
||||
var clone = feature.clone();
|
||||
@@ -435,7 +435,7 @@ describe('ol.Feature', function() {
|
||||
|
||||
it('dispatches a change event when geometry is set to null',
|
||||
function() {
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Point([0, 0])
|
||||
});
|
||||
var spy = sinon.spy();
|
||||
@@ -451,12 +451,12 @@ describe('ol.Feature.createStyleFunction()', function() {
|
||||
var style = new _ol_style_Style_();
|
||||
|
||||
it('creates a feature style function from a single style', function() {
|
||||
var styleFunction = _ol_Feature_.createStyleFunction(style);
|
||||
var styleFunction = Feature.createStyleFunction(style);
|
||||
expect(styleFunction()).to.eql([style]);
|
||||
});
|
||||
|
||||
it('creates a feature style function from an array of styles', function() {
|
||||
var styleFunction = _ol_Feature_.createStyleFunction([style]);
|
||||
var styleFunction = Feature.createStyleFunction([style]);
|
||||
expect(styleFunction()).to.eql([style]);
|
||||
});
|
||||
|
||||
@@ -464,13 +464,13 @@ describe('ol.Feature.createStyleFunction()', function() {
|
||||
var original = function() {
|
||||
return [style];
|
||||
};
|
||||
var styleFunction = _ol_Feature_.createStyleFunction(original);
|
||||
var styleFunction = Feature.createStyleFunction(original);
|
||||
expect(styleFunction).to.be(original);
|
||||
});
|
||||
|
||||
it('throws on (some) unexpected input', function() {
|
||||
expect(function() {
|
||||
_ol_Feature_.createStyleFunction({bogus: 'input'});
|
||||
Feature.createStyleFunction({bogus: 'input'});
|
||||
}).to.throwException();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import EsriJSON from '../../../../src/ol/format/EsriJSON.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
@@ -161,7 +161,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a single point feature', function() {
|
||||
var feature = format.readFeature(pointEsriJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Point);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
@@ -170,7 +170,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a single multipoint feature', function() {
|
||||
var feature = format.readFeature(multiPointEsriJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(MultiPoint);
|
||||
expect(geometry.getCoordinates()).to.eql([[102.0, 0.0], [103.0, 1.0]]);
|
||||
@@ -179,7 +179,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a single line string feature', function() {
|
||||
var feature = format.readFeature(lineStringEsriJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(
|
||||
@@ -190,7 +190,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a multi line string feature', function() {
|
||||
var feature = format.readFeature(multiLineStringEsriJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(MultiLineString);
|
||||
expect(geometry.getCoordinates()).to.eql([
|
||||
@@ -203,7 +203,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a single polygon feature', function() {
|
||||
var feature = format.readFeature(polygonEsriJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Polygon);
|
||||
expect(geometry.getCoordinates()).to.eql([[
|
||||
@@ -215,7 +215,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('can read a multi polygon feature', function() {
|
||||
var feature = format.readFeature(multiPolygonEsriJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(MultiPolygon);
|
||||
expect(geometry.getCoordinates()).to.eql([
|
||||
@@ -282,13 +282,13 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(array.length).to.be(2);
|
||||
|
||||
var first = array[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('LINK_ID')).to.be(573730499);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(LineString);
|
||||
|
||||
var second = array[1];
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
|
||||
var secondGeom = second.getGeometry();
|
||||
expect(secondGeom).to.be.a(LineString);
|
||||
@@ -300,7 +300,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(result.length).to.be(9);
|
||||
|
||||
var first = result[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('field_name')).to.be('EUDORA');
|
||||
expect(first.getId()).to.be(6406);
|
||||
var firstGeom = first.getGeometry();
|
||||
@@ -311,7 +311,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
])).to.be(true);
|
||||
|
||||
var last = result[8];
|
||||
expect(last).to.be.a(_ol_Feature_);
|
||||
expect(last).to.be.a(Feature);
|
||||
expect(last.get('field_name')).to.be('FEAGINS');
|
||||
expect(last.getId()).to.be(6030);
|
||||
var lastGeom = last.getGeometry();
|
||||
@@ -744,12 +744,12 @@ describe('ol.format.EsriJSON', function() {
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(Point);
|
||||
|
||||
var second = features[1];
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(LineString);
|
||||
|
||||
@@ -1048,7 +1048,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
|
||||
it('writes out a feature with a different geometryName correctly',
|
||||
function() {
|
||||
var feature = new _ol_Feature_({'foo': 'bar'});
|
||||
var feature = new Feature({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new Point([5, 10]));
|
||||
var esrijson = format.writeFeaturesObject([feature]);
|
||||
@@ -1056,7 +1056,7 @@ describe('ol.format.EsriJSON', function() {
|
||||
});
|
||||
|
||||
it('writes out a feature without properties correctly', function() {
|
||||
var feature = new _ol_Feature_(new Point([5, 10]));
|
||||
var feature = new Feature(new Point([5, 10]));
|
||||
var esrijson = format.writeFeatureObject(feature);
|
||||
expect(esrijson.attributes).to.eql({});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
|
||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||
@@ -145,7 +145,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a single point feature', function() {
|
||||
var feature = format.readFeature(pointGeoJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Point);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
@@ -154,7 +154,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a single point geometry as a feature', function() {
|
||||
var feature = format.readFeature(pointGeoJSON.geometry);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Point);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
@@ -162,7 +162,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a single line string feature', function() {
|
||||
var feature = format.readFeature(lineStringGeoJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(
|
||||
@@ -173,7 +173,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a single polygon feature', function() {
|
||||
var feature = format.readFeature(polygonGeoJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Polygon);
|
||||
expect(geometry.getCoordinates()).to.eql([[
|
||||
@@ -185,7 +185,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a feature with null geometry', function() {
|
||||
var feature = format.readFeature(nullGeometryGeoJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.eql(null);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
@@ -193,7 +193,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('can read a feature with id equal to 0', function() {
|
||||
var feature = format.readFeature(zeroIdGeoJSON);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
expect(feature.getId()).to.be(0);
|
||||
});
|
||||
|
||||
@@ -271,13 +271,13 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(array.length).to.be(2);
|
||||
|
||||
var first = array[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('LINK_ID')).to.be(573730499);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(LineString);
|
||||
|
||||
var second = array[1];
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
|
||||
var secondGeom = second.getGeometry();
|
||||
expect(secondGeom).to.be.a(LineString);
|
||||
@@ -297,7 +297,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(result.length).to.be(179);
|
||||
|
||||
var first = result[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('name')).to.be('Afghanistan');
|
||||
expect(first.getId()).to.be('AFG');
|
||||
var firstGeom = first.getGeometry();
|
||||
@@ -307,7 +307,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
.to.be(true);
|
||||
|
||||
var last = result[178];
|
||||
expect(last).to.be.a(_ol_Feature_);
|
||||
expect(last).to.be.a(Feature);
|
||||
expect(last.get('name')).to.be('Zimbabwe');
|
||||
expect(last.getId()).to.be('ZWE');
|
||||
var lastGeom = last.getGeometry();
|
||||
@@ -338,7 +338,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features.length).to.be(1);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('bam')).to.be('baz');
|
||||
expect(first.getGeometry()).to.be.a(LineString);
|
||||
|
||||
@@ -462,12 +462,12 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(Point);
|
||||
|
||||
var second = features[1];
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(LineString);
|
||||
|
||||
@@ -505,12 +505,12 @@ describe('ol.format.GeoJSON', function() {
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(Point);
|
||||
|
||||
var second = features[1];
|
||||
expect(second).to.be.a(_ol_Feature_);
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(LineString);
|
||||
|
||||
@@ -560,7 +560,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('writes out a feature with a different geometryName correctly',
|
||||
function() {
|
||||
var feature = new _ol_Feature_({'foo': 'bar'});
|
||||
var feature = new Feature({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new Point([5, 10]));
|
||||
var geojson = format.writeFeaturesObject([feature]);
|
||||
@@ -568,19 +568,19 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('writes out a feature without properties correctly', function() {
|
||||
var feature = new _ol_Feature_(new Point([5, 10]));
|
||||
var feature = new Feature(new Point([5, 10]));
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.properties).to.eql(null);
|
||||
});
|
||||
|
||||
it('writes out a feature without geometry correctly', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.geometry).to.eql(null);
|
||||
});
|
||||
|
||||
it('writes out a feature with id equal to 0 correctly', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId(0);
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.id).to.eql(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import _ol_format_GML_ from '../../../../src/ol/format/GML.js';
|
||||
import GML2 from '../../../../src/ol/format/GML2.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
@@ -163,7 +163,7 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new LineString([[1.1, 2], [3, 4.2]])
|
||||
});
|
||||
feature.setId(1);
|
||||
@@ -194,7 +194,7 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Polygon([[[1.1, 2], [3, 4.2], [5.2, 6]]])
|
||||
});
|
||||
feature.setId(1);
|
||||
@@ -221,7 +221,7 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new Point([1.1, 2])
|
||||
});
|
||||
feature.setId(1);
|
||||
@@ -252,7 +252,7 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new MultiPoint([[1.1, 2]])
|
||||
});
|
||||
feature.setId(1);
|
||||
@@ -283,7 +283,7 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new MultiLineString([[[1.1, 2], [3, 4.2]]])
|
||||
});
|
||||
feature.setId(1);
|
||||
@@ -318,7 +318,7 @@ describe('ol.format.GML2', function() {
|
||||
' </geometry>' +
|
||||
' </layer>';
|
||||
|
||||
var feature = new _ol_Feature_({
|
||||
var feature = new Feature({
|
||||
geometry: new MultiPolygon([[[[1.1, 2], [3, 4.2], [5.2, 6]]]])
|
||||
});
|
||||
feature.setId(1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import GPX from '../../../../src/ol/format/GPX.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
@@ -36,7 +36,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([]);
|
||||
@@ -65,7 +65,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
expect(f.get('cmt')).to.be('Comment');
|
||||
expect(f.get('desc')).to.be('Description');
|
||||
@@ -93,7 +93,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
@@ -118,7 +118,7 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
@@ -160,7 +160,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([]);
|
||||
@@ -189,7 +189,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
expect(f.get('cmt')).to.be('Comment');
|
||||
expect(f.get('desc')).to.be('Description');
|
||||
@@ -216,7 +216,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([[]]);
|
||||
@@ -247,7 +247,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
@@ -282,7 +282,7 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
@@ -329,7 +329,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
@@ -391,7 +391,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
@@ -413,7 +413,7 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
var expectedPoint = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
@@ -438,7 +438,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3]);
|
||||
@@ -460,7 +460,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 1263115752]);
|
||||
@@ -483,7 +483,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
|
||||
@@ -523,7 +523,7 @@ describe('ol.format.GPX', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('magvar')).to.be(11);
|
||||
expect(f.get('geoidheight')).to.be(4);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
@@ -663,7 +663,7 @@ describe('ol.format.GPX', function() {
|
||||
it('does not fail', function() {
|
||||
var polygon = new Polygon(
|
||||
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
|
||||
var feature = new _ol_Feature_(polygon);
|
||||
var feature = new Feature(polygon);
|
||||
var features = [feature];
|
||||
var gpx = format.writeFeaturesNode(features);
|
||||
var expected =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import IGC from '../../../../src/ol/format/IGC.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('ol.format.IGC', function() {
|
||||
|
||||
it('does read a feature', function() {
|
||||
var feature = format.readFeature(igc);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([
|
||||
@@ -60,7 +60,7 @@ describe('ol.format.IGC', function() {
|
||||
var feature = format.readFeature(igc, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('ol.format.IGC', function() {
|
||||
var features = format.readFeatures(igc);
|
||||
expect(features.length).to.eql(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([
|
||||
@@ -109,7 +109,7 @@ describe('ol.format.IGC', function() {
|
||||
});
|
||||
expect(features.length).to.eql(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import {find} from '../../../../src/ol/array.js';
|
||||
import GeoJSON from '../../../../src/ol/format/GeoJSON.js';
|
||||
import KML from '../../../../src/ol/format/KML.js';
|
||||
@@ -54,7 +54,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -101,7 +101,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getId()).to.be('foo');
|
||||
});
|
||||
|
||||
@@ -113,12 +113,12 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getId()).to.be(undefined);
|
||||
});
|
||||
|
||||
it('can write a Feature', function() {
|
||||
var features = [new _ol_Feature_()];
|
||||
var features = [new Feature()];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -132,7 +132,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
|
||||
it('can write a Feature as string', function() {
|
||||
var features = [new _ol_Feature_()];
|
||||
var features = [new Feature()];
|
||||
var node = format.writeFeatures(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -146,7 +146,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
|
||||
it('can write a Feature\'s id', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
var features = [feature];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
@@ -173,13 +173,13 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be(null);
|
||||
});
|
||||
|
||||
it('can write feature with null geometries', function() {
|
||||
var features = [new _ol_Feature_(null)];
|
||||
var features = [new Feature(null)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -199,7 +199,7 @@ describe('ol.format.KML', function() {
|
||||
lineString.set('tessellate', true);
|
||||
lineString.set('altitudeMode', 'clampToGround');
|
||||
lineString.set('unsupportedProperty', 'foo');
|
||||
var features = [new _ol_Feature_(lineString)];
|
||||
var features = [new Feature(lineString)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -237,7 +237,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([1, 2, 3]);
|
||||
@@ -263,7 +263,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
@@ -285,7 +285,7 @@ describe('ol.format.KML', function() {
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
var f = format.readFeature(text);
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([1, 2, 3]);
|
||||
@@ -307,7 +307,7 @@ describe('ol.format.KML', function() {
|
||||
var f = format.readFeature(text, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
@@ -318,7 +318,7 @@ describe('ol.format.KML', function() {
|
||||
it('can write XY Point geometries', function() {
|
||||
var layout = 'XY';
|
||||
var point = new Point([1, 2], layout);
|
||||
var features = [new _ol_Feature_(point)];
|
||||
var features = [new Feature(point)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -338,7 +338,7 @@ describe('ol.format.KML', function() {
|
||||
it('can write XYZ Point geometries', function() {
|
||||
var layout = 'XYZ';
|
||||
var point = new Point([1, 2, 3], layout);
|
||||
var features = [new _ol_Feature_(point)];
|
||||
var features = [new Feature(point)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -368,7 +368,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZ';
|
||||
var point = new Point([1, 2, 3], layout).transform(
|
||||
'EPSG:4326', 'double');
|
||||
var features = [new _ol_Feature_(point)];
|
||||
var features = [new Feature(point)];
|
||||
var node = format.writeFeaturesNode(features, {
|
||||
featureProjection: 'double'
|
||||
});
|
||||
@@ -393,7 +393,7 @@ describe('ol.format.KML', function() {
|
||||
it('can write XYM Point geometries', function() {
|
||||
var layout = 'XYM';
|
||||
var point = new Point([1, 2, 100], layout);
|
||||
var features = [new _ol_Feature_(point)];
|
||||
var features = [new Feature(point)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -413,7 +413,7 @@ describe('ol.format.KML', function() {
|
||||
it('can write XYZM Point geometries', function() {
|
||||
var layout = 'XYZM';
|
||||
var point = new Point([1, 2, 3, 100], layout);
|
||||
var features = [new _ol_Feature_(point)];
|
||||
var features = [new Feature(point)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -445,7 +445,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
|
||||
@@ -457,7 +457,7 @@ describe('ol.format.KML', function() {
|
||||
it('can write XY LineString geometries', function() {
|
||||
var layout = 'XY';
|
||||
var lineString = new LineString([[1, 2], [3, 4]], layout);
|
||||
var features = [new _ol_Feature_(lineString)];
|
||||
var features = [new Feature(lineString)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -478,7 +478,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZ';
|
||||
var lineString = new LineString(
|
||||
[[1, 2, 3], [4, 5, 6]], layout);
|
||||
var features = [new _ol_Feature_(lineString)];
|
||||
var features = [new Feature(lineString)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -499,7 +499,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYM';
|
||||
var lineString = new LineString(
|
||||
[[1, 2, 100], [3, 4, 200]], layout);
|
||||
var features = [new _ol_Feature_(lineString)];
|
||||
var features = [new Feature(lineString)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -520,7 +520,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZM';
|
||||
var lineString = new LineString(
|
||||
[[1, 2, 3, 100], [4, 5, 6, 200]], layout);
|
||||
var features = [new _ol_Feature_(lineString)];
|
||||
var features = [new Feature(lineString)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -549,7 +549,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Polygon);
|
||||
expect(g.getCoordinates()).to.eql([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]);
|
||||
@@ -559,7 +559,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XY';
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2], [3, 4], [1, 2]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var features = [new Feature(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -580,7 +580,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZ';
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2, 3], [4, 5, 6], [1, 2, 3]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var features = [new Feature(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -601,7 +601,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYM';
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2, 100], [3, 4, 200], [1, 2, 100]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var features = [new Feature(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -622,7 +622,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZM';
|
||||
var linearRing = new LinearRing(
|
||||
[[1, 2, 3, 100], [4, 5, 6, 200], [1, 2, 3, 100]], layout);
|
||||
var features = [new _ol_Feature_(linearRing)];
|
||||
var features = [new Feature(linearRing)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -657,7 +657,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Polygon);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
@@ -670,7 +670,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XY';
|
||||
var polygon = new Polygon(
|
||||
[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]], layout);
|
||||
var features = [new _ol_Feature_(polygon)];
|
||||
var features = [new Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -695,7 +695,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZ';
|
||||
var polygon = new Polygon(
|
||||
[[[0, 0, 1], [0, 2, 2], [2, 2, 3], [2, 0, 4], [0, 0, 5]]], layout);
|
||||
var features = [new _ol_Feature_(polygon)];
|
||||
var features = [new Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -722,7 +722,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYM';
|
||||
var polygon = new Polygon(
|
||||
[[[0, 0, 1], [0, 2, 1], [2, 2, 1], [2, 0, 1], [0, 0, 1]]], layout);
|
||||
var features = [new _ol_Feature_(polygon)];
|
||||
var features = [new Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -750,7 +750,7 @@ describe('ol.format.KML', function() {
|
||||
var polygon = new Polygon([
|
||||
[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1], [2, 0, 4, 1], [0, 0, 5, 1]]
|
||||
], layout);
|
||||
var features = [new _ol_Feature_(polygon)];
|
||||
var features = [new Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -797,7 +797,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Polygon);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
@@ -814,7 +814,7 @@ describe('ol.format.KML', function() {
|
||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]
|
||||
], layout);
|
||||
var features = [new _ol_Feature_(polygon)];
|
||||
var features = [new Feature(polygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -872,7 +872,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiPolygon);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
@@ -893,7 +893,7 @@ describe('ol.format.KML', function() {
|
||||
var multiPolygon = new MultiPolygon(
|
||||
[[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
|
||||
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]], layout);
|
||||
var features = [new _ol_Feature_(multiPolygon)];
|
||||
var features = [new Feature(multiPolygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -944,7 +944,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiPoint);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 3], [4, 5, 6]]);
|
||||
@@ -962,7 +962,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZ';
|
||||
var multiPoint = new MultiPoint(
|
||||
[[1, 2, 3], [4, 5, 6]], layout);
|
||||
var features = [new _ol_Feature_(multiPoint)];
|
||||
var features = [new Feature(multiPoint)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -1004,7 +1004,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
@@ -1027,7 +1027,7 @@ describe('ol.format.KML', function() {
|
||||
var layout = 'XYZ';
|
||||
var multiLineString = new MultiLineString(
|
||||
[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]], layout);
|
||||
var features = [new _ol_Feature_(multiLineString)];
|
||||
var features = [new Feature(multiLineString)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -1076,7 +1076,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiPolygon);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
@@ -1099,7 +1099,7 @@ describe('ol.format.KML', function() {
|
||||
[[[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]]],
|
||||
[[[3, 0, 0], [3, 1, 0], [4, 1, 0], [4, 0, 0]]]
|
||||
], layout);
|
||||
var features = [new _ol_Feature_(multiPolygon)];
|
||||
var features = [new Feature(multiPolygon)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -1140,7 +1140,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(GeometryCollection);
|
||||
expect(g.getGeometries()).to.be.empty();
|
||||
@@ -1173,7 +1173,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(GeometryCollection);
|
||||
var gs = g.getGeometries();
|
||||
@@ -1197,7 +1197,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(GeometryCollection);
|
||||
var gs = g.getGeometries();
|
||||
@@ -1211,7 +1211,7 @@ describe('ol.format.KML', function() {
|
||||
new LineString([[1, 2], [3, 4]]),
|
||||
new Polygon([[[1, 2], [3, 4], [3, 2], [1, 2]]])
|
||||
]);
|
||||
var features = [new _ol_Feature_(collection)];
|
||||
var features = [new Feature(collection)];
|
||||
var node = format.writeFeaturesNode(features);
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2"' +
|
||||
@@ -1258,7 +1258,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
});
|
||||
@@ -1285,7 +1285,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
var gs = g.getLineStrings();
|
||||
@@ -1340,7 +1340,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('open')).to.be(true);
|
||||
expect(f.get('visibility')).to.be(false);
|
||||
});
|
||||
@@ -1358,7 +1358,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('address')).to.be('My address');
|
||||
expect(f.get('description')).to.be('My description');
|
||||
expect(f.get('name')).to.be('My name');
|
||||
@@ -1375,7 +1375,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('description')).to.be('My description');
|
||||
});
|
||||
|
||||
@@ -1389,7 +1389,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('name')).to.be('My name in CDATA');
|
||||
});
|
||||
|
||||
@@ -1403,12 +1403,12 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('name')).to.be('My name in CDATA');
|
||||
});
|
||||
|
||||
it('can write Feature\'s string attributes', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('address', 'My address');
|
||||
feature.set('description', 'My description');
|
||||
feature.set('name', 'My name');
|
||||
@@ -1432,7 +1432,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
|
||||
it('can write Feature\'s boolean attributes', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('open', true);
|
||||
feature.set('visibility', false);
|
||||
var features = [feature];
|
||||
@@ -1477,7 +1477,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var extent = f.get('extent');
|
||||
expect(extent).to.be.an(Array);
|
||||
expect(extent).to.have.length(4);
|
||||
@@ -1509,7 +1509,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('minLodPixels')).to.be(128);
|
||||
expect(f.get('maxLodPixels')).to.be(2048);
|
||||
expect(f.get('minFadeExtent')).to.be(0.2);
|
||||
@@ -1521,7 +1521,7 @@ describe('ol.format.KML', function() {
|
||||
describe('extended data', function() {
|
||||
|
||||
it('can write ExtendedData with no values', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('foo', null);
|
||||
feature.set('bar', undefined);
|
||||
var features = [feature];
|
||||
@@ -1543,7 +1543,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
|
||||
it('can write ExtendedData with values', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('foo', 'bar');
|
||||
feature.set('aNumber', 1000);
|
||||
var features = [feature];
|
||||
@@ -1574,7 +1574,7 @@ describe('ol.format.KML', function() {
|
||||
displayName: 'display name'
|
||||
};
|
||||
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('foo', pair);
|
||||
|
||||
var features = [feature];
|
||||
@@ -1611,7 +1611,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getProperties()).to.only.have.keys(['foo', 'geometry']);
|
||||
expect(f.get('foo')).to.be('bar');
|
||||
});
|
||||
@@ -1631,7 +1631,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getProperties()).to.only.have.keys(['foo', 'bar', 'geometry']);
|
||||
expect(f.get('foo')).to.be('200');
|
||||
expect(f.get('bar')).to.be(undefined);
|
||||
@@ -1652,7 +1652,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('foo')).to.be('bar');
|
||||
});
|
||||
|
||||
@@ -1671,7 +1671,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('capital')).to.be('London');
|
||||
expect(f.get('population')).to.be('60000000');
|
||||
});
|
||||
@@ -1695,7 +1695,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('capital')).to.be('London');
|
||||
expect(f.get('country')).to.be('United-Kingdom');
|
||||
});
|
||||
@@ -1712,7 +1712,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -1745,7 +1745,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -1824,7 +1824,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(5);
|
||||
fs.forEach(function(f) {
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getId()).to.be.within(1, 5);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
@@ -1896,7 +1896,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -1932,7 +1932,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -1967,7 +1967,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -1999,7 +1999,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2036,7 +2036,7 @@ describe('ol.format.KML', function() {
|
||||
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2075,7 +2075,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2112,7 +2112,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2150,7 +2150,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2203,7 +2203,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2252,7 +2252,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2281,7 +2281,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
var imageStyle = style.getImage();
|
||||
imageStyle.iconImage_.size_ = [192, 144]; // sprite de 12 images(4*3)
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
@@ -2318,7 +2318,7 @@ describe('ol.format.KML', function() {
|
||||
src: 'http://foo.png'
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
@@ -2342,7 +2342,7 @@ describe('ol.format.KML', function() {
|
||||
})
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
@@ -2369,7 +2369,7 @@ describe('ol.format.KML', function() {
|
||||
})
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
@@ -2398,7 +2398,7 @@ describe('ol.format.KML', function() {
|
||||
width: 2
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
@@ -2425,7 +2425,7 @@ describe('ol.format.KML', function() {
|
||||
color: 'rgba(12, 34, 223, 0.7)'
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle([style]);
|
||||
var node = format.writeFeaturesNode([feature]);
|
||||
var text =
|
||||
@@ -2451,9 +2451,9 @@ describe('ol.format.KML', function() {
|
||||
color: 'rgba(12, 34, 223, 0.7)'
|
||||
})
|
||||
});
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setStyle(style);
|
||||
var feature2 = new _ol_Feature_();
|
||||
var feature2 = new Feature();
|
||||
feature2.setStyle(style);
|
||||
var node = format.writeFeaturesNode([feature, feature2]);
|
||||
var text =
|
||||
@@ -2506,7 +2506,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2539,7 +2539,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2580,7 +2580,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2614,7 +2614,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2648,7 +2648,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2682,7 +2682,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2715,7 +2715,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2747,7 +2747,7 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var styleFunction = f.getStyleFunction();
|
||||
expect(styleFunction).not.to.be(undefined);
|
||||
var styleArray = styleFunction.call(f, 0);
|
||||
@@ -2780,13 +2780,13 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(2);
|
||||
var f1 = fs[0];
|
||||
expect(f1).to.be.an(_ol_Feature_);
|
||||
expect(f1).to.be.an(Feature);
|
||||
var styleFunction1 = f1.getStyleFunction();
|
||||
expect(styleFunction1).not.to.be(undefined);
|
||||
var styleArray1 = styleFunction1.call(f1, 0);
|
||||
expect(styleArray1).to.be.an(Array);
|
||||
var f2 = fs[1];
|
||||
expect(f2).to.be.an(_ol_Feature_);
|
||||
expect(f2).to.be.an(Feature);
|
||||
var styleFunction2 = f2.getStyleFunction();
|
||||
expect(styleFunction2).not.to.be(undefined);
|
||||
var styleArray2 = styleFunction2.call(f2, 0);
|
||||
@@ -2814,7 +2814,7 @@ describe('ol.format.KML', function() {
|
||||
'</Document>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('can read a single feature from nested Document', function() {
|
||||
@@ -2827,7 +2827,7 @@ describe('ol.format.KML', function() {
|
||||
'</Document>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('can transform and read a single feature from a Document', function() {
|
||||
@@ -2844,7 +2844,7 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
var expectedPoint = transform([1, 2], 'EPSG:4326', 'EPSG:3857');
|
||||
@@ -2862,9 +2862,9 @@ describe('ol.format.KML', function() {
|
||||
'</Document>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(2);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
expect(fs[0].getId()).to.be('1');
|
||||
expect(fs[1]).to.be.an(_ol_Feature_);
|
||||
expect(fs[1]).to.be.an(Feature);
|
||||
expect(fs[1].getId()).to.be('2');
|
||||
});
|
||||
|
||||
@@ -2884,7 +2884,7 @@ describe('ol.format.KML', function() {
|
||||
'</Folder>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('can read a multiple features from a Folder', function() {
|
||||
@@ -2897,9 +2897,9 @@ describe('ol.format.KML', function() {
|
||||
'</Folder>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(2);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
expect(fs[0].getId()).to.be('1');
|
||||
expect(fs[1]).to.be.an(_ol_Feature_);
|
||||
expect(fs[1]).to.be.an(Feature);
|
||||
expect(fs[1].getId()).to.be('2');
|
||||
});
|
||||
|
||||
@@ -2913,7 +2913,7 @@ describe('ol.format.KML', function() {
|
||||
'</Document>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('can read features from Folders nested in Folders', function() {
|
||||
@@ -2926,7 +2926,7 @@ describe('ol.format.KML', function() {
|
||||
'</Folder>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('can read a single feature', function() {
|
||||
@@ -2935,7 +2935,7 @@ describe('ol.format.KML', function() {
|
||||
'</Placemark>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('can read features at multiple levels', function() {
|
||||
@@ -2955,15 +2955,15 @@ describe('ol.format.KML', function() {
|
||||
'</kml>';
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(5);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
expect(fs[0].getId()).to.be('a');
|
||||
expect(fs[1]).to.be.an(_ol_Feature_);
|
||||
expect(fs[1]).to.be.an(Feature);
|
||||
expect(fs[1].getId()).to.be('b');
|
||||
expect(fs[2]).to.be.an(_ol_Feature_);
|
||||
expect(fs[2]).to.be.an(Feature);
|
||||
expect(fs[2].getId()).to.be('c');
|
||||
expect(fs[3]).to.be.an(_ol_Feature_);
|
||||
expect(fs[3]).to.be.an(Feature);
|
||||
expect(fs[3].getId()).to.be('d');
|
||||
expect(fs[4]).to.be.an(_ol_Feature_);
|
||||
expect(fs[4]).to.be.an(Feature);
|
||||
expect(fs[4].getId()).to.be('e');
|
||||
});
|
||||
|
||||
@@ -2990,9 +2990,9 @@ describe('ol.format.KML', function() {
|
||||
});
|
||||
|
||||
it('can write multiple features', function() {
|
||||
var feature1 = new _ol_Feature_();
|
||||
var feature1 = new Feature();
|
||||
feature1.setId('1');
|
||||
var feature2 = new _ol_Feature_();
|
||||
var feature2 = new Feature();
|
||||
feature2.setId('2');
|
||||
var node = format.writeFeaturesNode([feature1, feature2]);
|
||||
var text =
|
||||
@@ -3034,7 +3034,7 @@ describe('ol.format.KML', function() {
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getGeometry()).to.be(null);
|
||||
});
|
||||
|
||||
@@ -3051,7 +3051,7 @@ describe('ol.format.KML', function() {
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getGeometry()).to.be(null);
|
||||
});
|
||||
|
||||
@@ -3068,7 +3068,7 @@ describe('ol.format.KML', function() {
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getGeometry()).to.be(null);
|
||||
});
|
||||
|
||||
@@ -3089,7 +3089,7 @@ describe('ol.format.KML', function() {
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.getGeometry()).to.be(null);
|
||||
});
|
||||
|
||||
@@ -3108,7 +3108,7 @@ describe('ol.format.KML', function() {
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(GeometryCollection);
|
||||
expect(g.getGeometries()).to.be.empty();
|
||||
@@ -3125,7 +3125,7 @@ describe('ol.format.KML', function() {
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('visibility')).to.be(undefined);
|
||||
});
|
||||
|
||||
@@ -3145,15 +3145,15 @@ describe('ol.format.KML', function() {
|
||||
var fs = format.readFeatures(kml);
|
||||
expect(fs).to.be.an(Array);
|
||||
expect(fs).to.have.length(5);
|
||||
expect(fs[0]).to.be.an(_ol_Feature_);
|
||||
expect(fs[0]).to.be.an(Feature);
|
||||
expect(fs[0].getId()).to.be('a');
|
||||
expect(fs[1]).to.be.an(_ol_Feature_);
|
||||
expect(fs[1]).to.be.an(Feature);
|
||||
expect(fs[1].getId()).to.be('b');
|
||||
expect(fs[2]).to.be.an(_ol_Feature_);
|
||||
expect(fs[2]).to.be.an(Feature);
|
||||
expect(fs[2].getId()).to.be('c');
|
||||
expect(fs[3]).to.be.an(_ol_Feature_);
|
||||
expect(fs[3]).to.be.an(Feature);
|
||||
expect(fs[3].getId()).to.be('d');
|
||||
expect(fs[4]).to.be.an(_ol_Feature_);
|
||||
expect(fs[4]).to.be.an(Feature);
|
||||
expect(fs[4].getId()).to.be('e');
|
||||
});
|
||||
|
||||
@@ -3182,7 +3182,7 @@ describe('ol.format.KML', function() {
|
||||
it('creates features with heterogeneous geometry collections', function() {
|
||||
// FIXME decide if we should instead create features with multiple geoms
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(GeometryCollection);
|
||||
});
|
||||
@@ -3191,7 +3191,7 @@ describe('ol.format.KML', function() {
|
||||
var alaska = find(features, function(feature) {
|
||||
return feature.get('name') === 'Alaska';
|
||||
});
|
||||
expect(alaska).to.be.an(_ol_Feature_);
|
||||
expect(alaska).to.be.an(Feature);
|
||||
var geometry = alaska.getGeometry();
|
||||
expect(geometry).to.be.an(GeometryCollection);
|
||||
var components = geometry.getGeometries();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import MVT from '../../../../src/ol/format/MVT.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
@@ -36,7 +36,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
|
||||
it('parses geometries correctly', function() {
|
||||
var format = new MVT({
|
||||
featureClass: _ol_Feature_,
|
||||
featureClass: Feature,
|
||||
layers: ['poi_label']
|
||||
});
|
||||
var geometry;
|
||||
@@ -61,7 +61,7 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
it('parses id property', function() {
|
||||
// ol.Feature
|
||||
var format = new MVT({
|
||||
featureClass: _ol_Feature_,
|
||||
featureClass: Feature,
|
||||
layers: ['building']
|
||||
});
|
||||
var features = format.readFeatures(data);
|
||||
@@ -90,7 +90,7 @@ describe('ol.format.MVT', function() {
|
||||
describe('#createFeature_', function() {
|
||||
it('accepts a geometryName', function() {
|
||||
var format = new MVT({
|
||||
featureClass: _ol_Feature_,
|
||||
featureClass: Feature,
|
||||
geometryName: 'myGeom'
|
||||
});
|
||||
var rawFeature = {
|
||||
@@ -118,7 +118,7 @@ describe('ol.format.MVT', function() {
|
||||
|
||||
it('detects a Polygon', function() {
|
||||
var format = new MVT({
|
||||
featureClass: _ol_Feature_
|
||||
featureClass: Feature
|
||||
});
|
||||
var rawFeature = {
|
||||
type: 3,
|
||||
@@ -141,7 +141,7 @@ describe('ol.format.MVT', function() {
|
||||
|
||||
it('detects a MultiPolygon', function() {
|
||||
var format = new MVT({
|
||||
featureClass: _ol_Feature_
|
||||
featureClass: Feature
|
||||
});
|
||||
var rawFeature = {
|
||||
type: 3,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import OSMXML from '../../../../src/ol/format/OSMXML.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
@@ -49,7 +49,7 @@ describe('ol.format.OSMXML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(2);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
@@ -74,12 +74,12 @@ describe('ol.format.OSMXML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
var point = fs[0];
|
||||
expect(point).to.be.an(_ol_Feature_);
|
||||
expect(point).to.be.an(Feature);
|
||||
var g = point.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
var line = fs[2];
|
||||
expect(line).to.be.an(_ol_Feature_);
|
||||
expect(line).to.be.an(Feature);
|
||||
g = line.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
@@ -105,7 +105,7 @@ describe('ol.format.OSMXML', function() {
|
||||
var fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
var line = fs[2];
|
||||
expect(line).to.be.an(_ol_Feature_);
|
||||
expect(line).to.be.an(Feature);
|
||||
var g = line.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
@@ -128,7 +128,7 @@ describe('ol.format.OSMXML', function() {
|
||||
});
|
||||
expect(fs).to.have.length(2);
|
||||
var f = fs[0];
|
||||
expect(f).to.be.an(_ol_Feature_);
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Polyline, * as polyline from '../../../../src/ol/format/Polyline.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
@@ -265,7 +265,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
it('returns the expected feature', function() {
|
||||
var feature = format.readFeature(encodedFlatPoints);
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
@@ -275,7 +275,7 @@ describe('ol.format.Polyline', function() {
|
||||
var feature = format.readFeature(encodedFlatPoints, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
@@ -290,7 +290,7 @@ describe('ol.format.Polyline', function() {
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
@@ -303,7 +303,7 @@ describe('ol.format.Polyline', function() {
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.an(_ol_Feature_);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
@@ -360,12 +360,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeFeature', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var feature = new _ol_Feature_(new LineString(points));
|
||||
var feature = new Feature(new LineString(points));
|
||||
expect(format.writeFeature(feature)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var feature = new _ol_Feature_(new LineString(points3857));
|
||||
var feature = new Feature(new LineString(points3857));
|
||||
expect(format.writeFeature(feature, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
@@ -376,12 +376,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeFeature', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var features = [new _ol_Feature_(new LineString(points))];
|
||||
var features = [new Feature(new LineString(points))];
|
||||
expect(format.writeFeatures(features)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var features = [new _ol_Feature_(new LineString(points3857))];
|
||||
var features = [new Feature(new LineString(points3857))];
|
||||
expect(format.writeFeatures(features, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import FeatureFormat from '../../../../src/ol/format/Feature.js';
|
||||
@@ -59,7 +59,7 @@ describe('ol.format.TopoJSON', function() {
|
||||
expect(features).to.have.length(1);
|
||||
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.a(_ol_Feature_);
|
||||
expect(feature).to.be.a(Feature);
|
||||
|
||||
var geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(Polygon);
|
||||
@@ -80,7 +80,7 @@ describe('ol.format.TopoJSON', function() {
|
||||
expect(features).to.have.length(1);
|
||||
|
||||
var feature = features[0];
|
||||
expect(feature).to.be.a(_ol_Feature_);
|
||||
expect(feature).to.be.a(Feature);
|
||||
expect(feature.getId()).to.be(0);
|
||||
});
|
||||
|
||||
@@ -155,14 +155,14 @@ describe('ol.format.TopoJSON', function() {
|
||||
expect(features.length).to.be(178);
|
||||
|
||||
var first = features[0];
|
||||
expect(first).to.be.a(_ol_Feature_);
|
||||
expect(first).to.be.a(Feature);
|
||||
var firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(MultiPolygon);
|
||||
expect(firstGeom.getExtent()).to.eql(
|
||||
[-180, -85.60903777459777, 180, 83.64513000000002]);
|
||||
|
||||
var last = features[177];
|
||||
expect(last).to.be.a(_ol_Feature_);
|
||||
expect(last).to.be.a(Feature);
|
||||
var lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(Polygon);
|
||||
expect(lastGeom.getExtent()).to.eql([
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import GML2 from '../../../../src/ol/format/GML2.js';
|
||||
import WFS from '../../../../src/ol/format/WFS.js';
|
||||
import _ol_format_filter_ from '../../../../src/ol/format/filter.js';
|
||||
@@ -712,7 +712,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
it('creates the correct srsName', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
var insertFeature = new Feature({
|
||||
the_geom: new MultiLineString([[
|
||||
[-5178372.1885436, 1992365.7775042],
|
||||
[-4434792.7774889, 1601008.1927386],
|
||||
@@ -743,7 +743,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('creates the correct update', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
var updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -764,7 +764,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('creates the correct update if geometry name is alias', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new _ol_Feature_(new MultiLineString([[
|
||||
var updateFeature = new Feature(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
@@ -788,7 +788,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('creates the correct update with default featurePrefix', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
var updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -811,7 +811,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('does not create an update if no fid', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
var updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -844,7 +844,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('handles multiple geometries', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new _ol_Feature_();
|
||||
var updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -879,14 +879,14 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('creates the correct transaction body', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
var insertFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new _ol_Feature_({
|
||||
var updateFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -898,7 +898,7 @@ describe('ol.format.WFS', function() {
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new _ol_Feature_();
|
||||
var deleteFeature = new Feature();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
@@ -949,14 +949,14 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('handles the WFS version', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
var insertFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2], [3, 4.2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new _ol_Feature_({
|
||||
var updateFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2], [3, 4.2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -968,7 +968,7 @@ describe('ol.format.WFS', function() {
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new _ol_Feature_();
|
||||
var deleteFeature = new Feature();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
@@ -993,14 +993,14 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('do not add feature prefix twice', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
var insertFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new _ol_Feature_({
|
||||
var updateFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -1012,7 +1012,7 @@ describe('ol.format.WFS', function() {
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new _ol_Feature_();
|
||||
var deleteFeature = new Feature();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
@@ -1036,14 +1036,14 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('handles 3D in WFS 1.0.0', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
var insertFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new _ol_Feature_({
|
||||
var updateFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2, 6], [3, 4.2, 7]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -1078,14 +1078,14 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('handles 3D in WFS 1.1.0', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new _ol_Feature_({
|
||||
var insertFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2, 3]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new _ol_Feature_({
|
||||
var updateFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2, 3]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -1247,7 +1247,7 @@ describe('ol.format.WFS', function() {
|
||||
it('reads all features', function() {
|
||||
expect(features.length).to.be(5);
|
||||
features.forEach(function(feature) {
|
||||
expect(feature instanceof _ol_Feature_).to.be(true);
|
||||
expect(feature instanceof Feature).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import WKT from '../../../../src/ol/format/WKT.js';
|
||||
import {transform} from '../../../../src/ol/proj.js';
|
||||
@@ -62,14 +62,14 @@ describe('ol.format.WKT', function() {
|
||||
describe('#writeFeature()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var feature = new _ol_Feature_(
|
||||
var feature = new Feature(
|
||||
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857'));
|
||||
var wkt = format.writeFeature(feature, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var gotFeature = format.readFeature(wkt);
|
||||
expect(gotFeature).to.be.a(_ol_Feature_);
|
||||
expect(gotFeature).to.be.a(Feature);
|
||||
var got = gotFeature.getGeometry().getCoordinates();
|
||||
expect(got[0]).to.roughlyEqual(1, 1e-6);
|
||||
expect(got[1]).to.roughlyEqual(2, 1e-6);
|
||||
@@ -101,9 +101,9 @@ describe('ol.format.WKT', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var features = [
|
||||
new _ol_Feature_(
|
||||
new Feature(
|
||||
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')),
|
||||
new _ol_Feature_(
|
||||
new Feature(
|
||||
new Point([4, 5]).transform('EPSG:4326', 'EPSG:3857'))
|
||||
];
|
||||
var wkt = format.writeFeatures(features, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -1035,7 +1035,7 @@ describe('ol.interaction.Draw', function() {
|
||||
type: 'LineString'
|
||||
});
|
||||
map.addInteraction(draw);
|
||||
feature = new _ol_Feature_(
|
||||
feature = new Feature(
|
||||
new LineString([[0, 0], [1, 1], [2, 0]]));
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -34,7 +34,7 @@ describe('ol.interaction.Modify', function() {
|
||||
document.body.appendChild(target);
|
||||
|
||||
features = [
|
||||
new _ol_Feature_({
|
||||
new Feature({
|
||||
geometry: new Polygon([
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
])
|
||||
@@ -151,7 +151,7 @@ describe('ol.interaction.Modify', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('adds features to the RTree', function() {
|
||||
var feature = new _ol_Feature_(
|
||||
var feature = new Feature(
|
||||
new Point([0, 0]));
|
||||
var features = new _ol_Collection_([feature]);
|
||||
var modify = new _ol_interaction_Modify_({
|
||||
@@ -163,7 +163,7 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
it('accepts feature without geometry', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
var features = new _ol_Collection_([feature]);
|
||||
var modify = new _ol_interaction_Modify_({
|
||||
features: features
|
||||
@@ -178,7 +178,7 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
it('accepts a source', function() {
|
||||
var feature = new _ol_Feature_(
|
||||
var feature = new Feature(
|
||||
new Point([0, 0]));
|
||||
var source = new _ol_source_Vector_({features: [feature]});
|
||||
var modify = new _ol_interaction_Modify_({source: source});
|
||||
@@ -225,7 +225,7 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
it('deletes first vertex of a LineString', function() {
|
||||
var lineFeature = new _ol_Feature_({
|
||||
var lineFeature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
@@ -261,7 +261,7 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
it('deletes last vertex of a LineString', function() {
|
||||
var lineFeature = new _ol_Feature_({
|
||||
var lineFeature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
@@ -297,7 +297,7 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
it('deletes vertex of a LineString programmatically', function() {
|
||||
var lineFeature = new _ol_Feature_({
|
||||
var lineFeature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||
)
|
||||
@@ -339,7 +339,7 @@ describe('ol.interaction.Modify', function() {
|
||||
describe('vertex modification', function() {
|
||||
|
||||
it('keeps the third dimension', function() {
|
||||
var lineFeature = new _ol_Feature_({
|
||||
var lineFeature = new Feature({
|
||||
geometry: new LineString(
|
||||
[[0, 0, 10], [10, 20, 20], [0, 40, 30], [40, 40, 40], [40, 0, 50]]
|
||||
)
|
||||
@@ -382,7 +382,7 @@ describe('ol.interaction.Modify', function() {
|
||||
|
||||
describe('circle modification', function() {
|
||||
it('changes the circle radius and center', function() {
|
||||
var circleFeature = new _ol_Feature_(new Circle([10, 10], 20));
|
||||
var circleFeature = new Feature(new Circle([10, 10], 20));
|
||||
features.length = 0;
|
||||
features.push(circleFeature);
|
||||
|
||||
@@ -617,7 +617,7 @@ describe('ol.interaction.Modify', function() {
|
||||
});
|
||||
|
||||
it('updates circle segment data', function() {
|
||||
var feature = new _ol_Feature_(new Circle([10, 10], 20));
|
||||
var feature = new Feature(new Circle([10, 10], 20));
|
||||
features.length = 0;
|
||||
features.push(feature);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserEventType from '../../../../src/ol/MapBrowserEventType.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
@@ -36,19 +36,19 @@ describe('ol.interaction.Select', function() {
|
||||
// -> foo -> bar.
|
||||
var features = [];
|
||||
features.push(
|
||||
new _ol_Feature_({
|
||||
new Feature({
|
||||
geometry: geometry,
|
||||
type: 'bar'
|
||||
}),
|
||||
new _ol_Feature_({
|
||||
new Feature({
|
||||
geometry: geometry,
|
||||
type: 'foo'
|
||||
}),
|
||||
new _ol_Feature_({
|
||||
new Feature({
|
||||
geometry: geometry,
|
||||
type: 'bar'
|
||||
}),
|
||||
new _ol_Feature_({
|
||||
new Feature({
|
||||
geometry: geometry,
|
||||
type: 'foo'
|
||||
}));
|
||||
@@ -356,7 +356,7 @@ describe('ol.interaction.Select', function() {
|
||||
var feature = e.selected[0];
|
||||
var layer_ = interaction.getLayer(feature);
|
||||
expect(e.selected).to.have.length(1);
|
||||
expect(feature).to.be.a(_ol_Feature_);
|
||||
expect(feature).to.be.a(Feature);
|
||||
expect(layer_).to.be.a(_ol_layer_Vector_);
|
||||
expect(layer_).to.equal(layer);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Circle from '../../../../src/ol/geom/Circle.js';
|
||||
@@ -56,7 +56,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('can handle XYZ coordinates', function() {
|
||||
var point = new _ol_Feature_(new Point([0, 0, 123]));
|
||||
var point = new Feature(new Point([0, 0, 123]));
|
||||
var snapInteraction = new _ol_interaction_Snap_({
|
||||
features: new _ol_Collection_([point])
|
||||
});
|
||||
@@ -73,7 +73,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('snaps to edges only', function() {
|
||||
var point = new _ol_Feature_(new LineString([[-10, 0], [10, 0]]));
|
||||
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
|
||||
var snapInteraction = new _ol_interaction_Snap_({
|
||||
features: new _ol_Collection_([point]),
|
||||
pixelTolerance: 5,
|
||||
@@ -91,7 +91,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('snaps to vertices only', function() {
|
||||
var point = new _ol_Feature_(new LineString([[-10, 0], [10, 0]]));
|
||||
var point = new Feature(new LineString([[-10, 0], [10, 0]]));
|
||||
var snapInteraction = new _ol_interaction_Snap_({
|
||||
features: new _ol_Collection_([point]),
|
||||
pixelTolerance: 5,
|
||||
@@ -109,7 +109,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('snaps to circle', function() {
|
||||
var circle = new _ol_Feature_(new Circle([0, 0], 10));
|
||||
var circle = new Feature(new Circle([0, 0], 10));
|
||||
var snapInteraction = new _ol_interaction_Snap_({
|
||||
features: new _ol_Collection_([circle]),
|
||||
pixelTolerance: 5
|
||||
@@ -128,7 +128,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('handle feature without geometry', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
var snapInteraction = new _ol_interaction_Snap_({
|
||||
features: new _ol_Collection_([feature]),
|
||||
pixelTolerance: 5,
|
||||
@@ -148,7 +148,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('handle geometry changes', function() {
|
||||
var line = new _ol_Feature_(new LineString([[-10, 0], [0, 0]]));
|
||||
var line = new Feature(new LineString([[-10, 0], [0, 0]]));
|
||||
var snapInteraction = new _ol_interaction_Snap_({
|
||||
features: new _ol_Collection_([line]),
|
||||
pixelTolerance: 5,
|
||||
@@ -168,7 +168,7 @@ describe('ol.interaction.Snap', function() {
|
||||
});
|
||||
|
||||
it('handle geometry name changes', function() {
|
||||
var line = new _ol_Feature_({
|
||||
var line = new Feature({
|
||||
geometry: new LineString([[-10, 0], [0, 0]]),
|
||||
alt_geometry: new LineString([[-10, 0], [10, 0]])
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import MapBrowserPointerEvent from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
@@ -27,9 +27,9 @@ describe('ol.interaction.Translate', function() {
|
||||
style.height = height + 'px';
|
||||
document.body.appendChild(target);
|
||||
source = new _ol_source_Vector_();
|
||||
features = [new _ol_Feature_({
|
||||
features = [new Feature({
|
||||
geometry: new Point([10, -20])
|
||||
}), new _ol_Feature_({
|
||||
}), new Feature({
|
||||
geometry: new Point([20, -30])
|
||||
})];
|
||||
source.addFeatures(features);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
||||
import Feature from '../../../src/ol/Feature.js';
|
||||
import Map from '../../../src/ol/Map.js';
|
||||
import MapEvent from '../../../src/ol/MapEvent.js';
|
||||
import Overlay from '../../../src/ol/Overlay.js';
|
||||
@@ -197,7 +197,7 @@ describe('ol.Map', function() {
|
||||
target: target,
|
||||
layers: [new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [new _ol_Feature_(new LineString([[-50, 0], [50, 0]]))]
|
||||
features: [new Feature(new LineString([[-50, 0], [50, 0]]))]
|
||||
})
|
||||
})],
|
||||
view: new _ol_View_({
|
||||
@@ -219,7 +219,7 @@ describe('ol.Map', function() {
|
||||
it('returns an array of found features', function() {
|
||||
var features = map.getFeaturesAtPixel([50, 50]);
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features[0]).to.be.an(_ol_Feature_);
|
||||
expect(features[0]).to.be.an(Feature);
|
||||
});
|
||||
|
||||
it('returns an array of found features with declutter: true', function() {
|
||||
@@ -233,7 +233,7 @@ describe('ol.Map', function() {
|
||||
map.renderSync();
|
||||
var features = map.getFeaturesAtPixel([50, 50]);
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features[0]).to.be.an(_ol_Feature_);
|
||||
expect(features[0]).to.be.a(Feature);
|
||||
});
|
||||
|
||||
it('respects options', function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_render_canvas_TextReplay_ from '../../../../../src/ol/render/canvas/TextReplay.js';
|
||||
@@ -9,7 +9,7 @@ describe('ol.render.canvas.TextReplay', function() {
|
||||
it('renders polygon labels only when they fit', function() {
|
||||
var replay = new _ol_render_canvas_TextReplay_(1, [-180, -90, 180, 90], 0.02, 1, true);
|
||||
var geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
|
||||
replay.setTextStyle(new _ol_style_Text_({
|
||||
text: 'This is a long text'
|
||||
@@ -30,7 +30,7 @@ describe('ol.render.canvas.TextReplay', function() {
|
||||
[[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]],
|
||||
[[[1, 1], [1, 2], [2, 2], [2, 1], [1, 1]]]
|
||||
]);
|
||||
var feature = new _ol_Feature_(geometry);
|
||||
var feature = new Feature(geometry);
|
||||
|
||||
replay.setTextStyle(new _ol_style_Text_({
|
||||
text: 'This is a long text'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getUid} from '../../../../../src/ol/index.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import Circle from '../../../../../src/ol/geom/Circle.js';
|
||||
import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js';
|
||||
import _ol_render_webgl_circlereplay_defaultshader_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js';
|
||||
@@ -173,13 +173,13 @@ describe('ol.render.webgl.CircleReplay', function() {
|
||||
|
||||
describe('#drawReplay', function() {
|
||||
var gl, context;
|
||||
var feature1 = new _ol_Feature_({
|
||||
var feature1 = new Feature({
|
||||
geometry: new Circle([0, 0], 5000)
|
||||
});
|
||||
var feature2 = new _ol_Feature_({
|
||||
var feature2 = new Feature({
|
||||
geometry: new Circle([10, 10], 5000)
|
||||
});
|
||||
var feature3 = new _ol_Feature_({
|
||||
var feature3 = new Feature({
|
||||
geometry: new Circle([20, 20], 5000)
|
||||
});
|
||||
beforeEach(function() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import Circle from '../../../../../src/ol/geom/Circle.js';
|
||||
import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
|
||||
import LineString from '../../../../../src/ol/geom/LineString.js';
|
||||
@@ -47,7 +47,7 @@ describe('ol.render.webgl.Immediate', function() {
|
||||
describe('#drawFeature', function() {
|
||||
var feat;
|
||||
beforeEach(function() {
|
||||
feat = new _ol_Feature_({
|
||||
feat = new Feature({
|
||||
geometry: circle
|
||||
});
|
||||
context.setStyle = function() {};
|
||||
@@ -67,14 +67,14 @@ describe('ol.render.webgl.Immediate', function() {
|
||||
});
|
||||
|
||||
it('does nothing if no geometry is provided', function() {
|
||||
feat = new _ol_Feature_();
|
||||
feat = new Feature();
|
||||
context.drawFeature(feat, style);
|
||||
expect(context.setStyle.called).to.be(false);
|
||||
expect(context.drawGeometry.called).to.be(false);
|
||||
});
|
||||
|
||||
it('does nothing if geometry is out of bounds', function() {
|
||||
feat = new _ol_Feature_({
|
||||
feat = new Feature({
|
||||
geometry: new Circle([540, 540], 1)
|
||||
});
|
||||
context.drawFeature(feat, style);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getUid} from '../../../../../src/ol/index.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import LineString from '../../../../../src/ol/geom/LineString.js';
|
||||
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
|
||||
import _ol_render_webgl_LineStringReplay_ from '../../../../../src/ol/render/webgl/LineStringReplay.js';
|
||||
@@ -286,13 +286,13 @@ describe('ol.render.webgl.LineStringReplay', function() {
|
||||
|
||||
describe('#drawReplay', function() {
|
||||
var gl, context;
|
||||
var feature1 = new _ol_Feature_({
|
||||
var feature1 = new Feature({
|
||||
geometry: new LineString([[0, 0], [500, 500]])
|
||||
});
|
||||
var feature2 = new _ol_Feature_({
|
||||
var feature2 = new Feature({
|
||||
geometry: new LineString([[0, 0], [500, 500]])
|
||||
});
|
||||
var feature3 = new _ol_Feature_({
|
||||
var feature3 = new Feature({
|
||||
geometry: new LineString([[0, 0], [500, 500]])
|
||||
});
|
||||
beforeEach(function() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getUid} from '../../../../../src/ol/index.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js';
|
||||
@@ -395,13 +395,13 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
||||
|
||||
describe('#drawReplay', function() {
|
||||
var gl, context;
|
||||
var feature1 = new _ol_Feature_({
|
||||
var feature1 = new Feature({
|
||||
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
||||
});
|
||||
var feature2 = new _ol_Feature_({
|
||||
var feature2 = new Feature({
|
||||
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
||||
});
|
||||
var feature3 = new _ol_Feature_({
|
||||
var feature3 = new Feature({
|
||||
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
||||
});
|
||||
beforeEach(function() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getUid} from '../../../../../src/ol/index.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../../src/ol/View.js';
|
||||
import Point from '../../../../../src/ol/geom/Point.js';
|
||||
@@ -53,7 +53,7 @@ describe('ol.renderer.canvas.Map', function() {
|
||||
layer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [
|
||||
new _ol_Feature_({
|
||||
new Feature({
|
||||
geometry: new Point([0, 0])
|
||||
})
|
||||
]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getUid} from '../../../../../src/ol/index.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import GeometryCollection from '../../../../../src/ol/geom/GeometryCollection.js';
|
||||
import LineString from '../../../../../src/ol/geom/LineString.js';
|
||||
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
|
||||
@@ -29,13 +29,13 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
beforeEach(function() {
|
||||
transform = _ol_transform_.create();
|
||||
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, false);
|
||||
feature0 = new _ol_Feature_(new Polygon(
|
||||
feature0 = new Feature(new Polygon(
|
||||
[[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]]));
|
||||
feature1 = new _ol_Feature_(new Polygon(
|
||||
feature1 = new Feature(new Polygon(
|
||||
[[[-90, -45], [-90, 0], [0, 0], [0, -45], [-90, -45]]]));
|
||||
feature2 = new _ol_Feature_(new Polygon(
|
||||
feature2 = new Feature(new Polygon(
|
||||
[[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]]));
|
||||
feature3 = new _ol_Feature_(new Polygon(
|
||||
feature3 = new Feature(new Polygon(
|
||||
[[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]]));
|
||||
fill0 = new _ol_style_Style_({
|
||||
fill: new _ol_style_Fill_({color: 'black'})
|
||||
@@ -229,17 +229,17 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
}
|
||||
});
|
||||
var point = new _ol_Feature_(new Point([45, 90]));
|
||||
var multipoint = new _ol_Feature_(new MultiPoint(
|
||||
var point = new Feature(new Point([45, 90]));
|
||||
var multipoint = new Feature(new MultiPoint(
|
||||
[[45, 90], [90, 45]]));
|
||||
var linestring = new _ol_Feature_(new LineString(
|
||||
var linestring = new Feature(new LineString(
|
||||
[[45, 90], [45, 45], [90, 45]]));
|
||||
var multilinestring = new _ol_Feature_(new MultiLineString(
|
||||
var multilinestring = new Feature(new MultiLineString(
|
||||
[linestring.getGeometry().getCoordinates(), linestring.getGeometry().getCoordinates()]));
|
||||
var polygon = feature1;
|
||||
var multipolygon = new _ol_Feature_(new MultiPolygon(
|
||||
var multipolygon = new Feature(new MultiPolygon(
|
||||
[polygon.getGeometry().getCoordinates(), polygon.getGeometry().getCoordinates()]));
|
||||
var geometrycollection = new _ol_Feature_(new GeometryCollection(
|
||||
var geometrycollection = new Feature(new GeometryCollection(
|
||||
[point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()]));
|
||||
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, true);
|
||||
_ol_renderer_vector_.renderFeature(replay, point, style, 1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {getUid} from '../../../../../src/ol/index.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../../../../../src/ol/extent.js';
|
||||
@@ -66,8 +66,8 @@ describe('ol.renderer.canvas.VectorLayer', function() {
|
||||
text: 'feature'
|
||||
})
|
||||
})];
|
||||
var feature1 = new _ol_Feature_(new Point([0, 0]));
|
||||
var feature2 = new _ol_Feature_(new Point([0, 0]));
|
||||
var feature1 = new Feature(new Point([0, 0]));
|
||||
var feature2 = new Feature(new Point([0, 0]));
|
||||
feature2.setStyle(featureStyle);
|
||||
var layer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
@@ -100,7 +100,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
|
||||
})
|
||||
});
|
||||
|
||||
var feature = new _ol_Feature_(new Point([0, 0]));
|
||||
var feature = new Feature(new Point([0, 0]));
|
||||
var layer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [feature]
|
||||
@@ -131,7 +131,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
|
||||
})
|
||||
});
|
||||
|
||||
var feature = new _ol_Feature_(new Point([0, 0]));
|
||||
var feature = new Feature(new Point([0, 0]));
|
||||
var layer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [feature]
|
||||
@@ -163,7 +163,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
|
||||
})
|
||||
});
|
||||
|
||||
var feature = new _ol_Feature_(new Point([0, 0]));
|
||||
var feature = new Feature(new Point([0, 0]));
|
||||
var layer = new _ol_layer_Vector_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [feature]
|
||||
@@ -193,7 +193,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
|
||||
renderer.replayGroup_ = replayGroup;
|
||||
replayGroup.forEachFeatureAtCoordinate = function(coordinate,
|
||||
resolution, rotation, hitTolerance, skippedFeaturesUids, callback) {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
callback(feature);
|
||||
callback(feature);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {getUid, inherits} from '../../../../../src/ol/index.js';
|
||||
import _ol_obj_ from '../../../../../src/ol/obj.js';
|
||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../../src/ol/Map.js';
|
||||
import TileState from '../../../../../src/ol/TileState.js';
|
||||
import VectorImageTile from '../../../../../src/ol/VectorImageTile.js';
|
||||
@@ -55,8 +55,8 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
text: 'feature'
|
||||
})
|
||||
})];
|
||||
feature1 = new _ol_Feature_(new Point([1, -1]));
|
||||
feature2 = new _ol_Feature_(new Point([0, 0]));
|
||||
feature1 = new Feature(new Point([1, -1]));
|
||||
feature2 = new Feature(new Point([0, 0]));
|
||||
feature3 = new _ol_render_Feature_('Point', [1, -1], []);
|
||||
feature2.setStyle(featureStyle);
|
||||
var TileClass = function() {
|
||||
@@ -317,7 +317,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
renderer = new _ol_renderer_canvas_VectorTileLayer_(layer);
|
||||
replayGroup.forEachFeatureAtCoordinate = function(coordinate,
|
||||
resolution, rotation, hitTolerance, skippedFeaturesUids, callback) {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
callback(feature);
|
||||
callback(feature);
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
||||
import _ol_style_Icon_ from '../../../../src/ol/style/Icon.js';
|
||||
import _ol_style_Stroke_ from '../../../../src/ol/style/Stroke.js';
|
||||
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
|
||||
|
||||
describe('ol.renderer.vector', function() {
|
||||
@@ -23,7 +23,7 @@ describe('ol.renderer.vector', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
replayGroup = new _ol_render_canvas_ReplayGroup_(1);
|
||||
feature = new _ol_Feature_();
|
||||
feature = new Feature();
|
||||
iconStyle = new _ol_style_Icon_({
|
||||
src: 'http://example.com/icon.png'
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
@@ -28,8 +28,8 @@ describe('ol.source.Cluster', function() {
|
||||
var source = new _ol_source_Cluster_({
|
||||
source: new _ol_source_Vector_({
|
||||
features: [
|
||||
new _ol_Feature_(new Point([0, 0])),
|
||||
new _ol_Feature_(new Point([0, 0]))
|
||||
new Feature(new Point([0, 0])),
|
||||
new Feature(new Point([0, 0]))
|
||||
]
|
||||
})
|
||||
});
|
||||
@@ -50,9 +50,9 @@ describe('ol.source.Cluster', function() {
|
||||
},
|
||||
source: new _ol_source_Vector_({
|
||||
features: [
|
||||
new _ol_Feature_(new Point([0, 0])),
|
||||
new _ol_Feature_(new LineString([[0, 0], [1, 1]])),
|
||||
new _ol_Feature_(new Polygon(
|
||||
new Feature(new Point([0, 0])),
|
||||
new Feature(new LineString([[0, 0], [1, 1]])),
|
||||
new Feature(new Polygon(
|
||||
[[[-1, -1], [-1, 1], [1, 1], [1, -1], [-1, -1]]]))
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
import _ol_Collection_ from '../../../../src/ol/Collection.js';
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import _ol_View_ from '../../../../src/ol/View.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
@@ -16,7 +16,7 @@ describe('ol.source.Vector', function() {
|
||||
var pointFeature;
|
||||
var infiniteExtent;
|
||||
beforeEach(function() {
|
||||
pointFeature = new _ol_Feature_(new Point([0, 0]));
|
||||
pointFeature = new Feature(new Point([0, 0]));
|
||||
infiniteExtent = [-Infinity, -Infinity, Infinity, Infinity];
|
||||
});
|
||||
|
||||
@@ -74,9 +74,9 @@ describe('ol.source.Vector', function() {
|
||||
|
||||
it('adds same id features only once', function() {
|
||||
var source = new _ol_source_Vector_();
|
||||
var feature1 = new _ol_Feature_();
|
||||
var feature1 = new Feature();
|
||||
feature1.setId('1');
|
||||
var feature2 = new _ol_Feature_();
|
||||
var feature2 = new Feature();
|
||||
feature2.setId('1');
|
||||
source.addFeature(feature1);
|
||||
source.addFeature(feature2);
|
||||
@@ -92,9 +92,9 @@ describe('ol.source.Vector', function() {
|
||||
var features = [];
|
||||
var vectorSource;
|
||||
beforeEach(function() {
|
||||
features.push(new _ol_Feature_(new LineString([[0, 0], [10, 10]])));
|
||||
features.push(new _ol_Feature_(new Point([0, 10])));
|
||||
features.push(new _ol_Feature_(new Point([10, 5])));
|
||||
features.push(new Feature(new LineString([[0, 0], [10, 10]])));
|
||||
features.push(new Feature(new Point([0, 10])));
|
||||
features.push(new Feature(new Point([10, 5])));
|
||||
vectorSource = new _ol_source_Vector_({
|
||||
features: features
|
||||
});
|
||||
@@ -127,9 +127,9 @@ describe('ol.source.Vector', function() {
|
||||
var i;
|
||||
for (i = 0; i < 10; ++i) {
|
||||
features[i] =
|
||||
new _ol_Feature_(new Point([Math.random(), Math.random()]));
|
||||
new Feature(new Point([Math.random(), Math.random()]));
|
||||
}
|
||||
features.push(new _ol_Feature_(null));
|
||||
features.push(new Feature(null));
|
||||
vectorSource = new _ol_source_Vector_({
|
||||
features: features
|
||||
});
|
||||
@@ -269,7 +269,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('keeps its index up-to-date', function() {
|
||||
var feature = new _ol_Feature_(new Point([1, 1]));
|
||||
var feature = new Feature(new Point([1, 1]));
|
||||
vectorSource.addFeature(feature);
|
||||
expect(vectorSource.getFeaturesInExtent([0, 0, 2, 2])).
|
||||
to.eql([feature]);
|
||||
@@ -281,13 +281,13 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('handles features with null geometries', function() {
|
||||
var feature = new _ol_Feature_(null);
|
||||
var feature = new Feature(null);
|
||||
vectorSource.addFeature(feature);
|
||||
expect(vectorSource.getFeatures()).to.eql([feature]);
|
||||
});
|
||||
|
||||
it('handles features with geometries changing from null', function() {
|
||||
var feature = new _ol_Feature_(null);
|
||||
var feature = new Feature(null);
|
||||
vectorSource.addFeature(feature);
|
||||
expect(vectorSource.getFeatures()).to.eql([feature]);
|
||||
feature.setGeometry(new Point([1, 1]));
|
||||
@@ -297,7 +297,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('handles features with geometries changing to null', function() {
|
||||
var feature = new _ol_Feature_(new Point([1, 1]));
|
||||
var feature = new Feature(new Point([1, 1]));
|
||||
vectorSource.addFeature(feature);
|
||||
expect(vectorSource.getFeatures()).to.eql([feature]);
|
||||
expect(vectorSource.getFeaturesInExtent([0, 0, 2, 2])).
|
||||
@@ -308,7 +308,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('fires a change event when setting a feature\'s property', function() {
|
||||
var feature = new _ol_Feature_(new Point([1, 1]));
|
||||
var feature = new Feature(new Point([1, 1]));
|
||||
vectorSource.addFeature(feature);
|
||||
var listener = sinon.spy();
|
||||
_ol_events_.listen(vectorSource, 'change', listener);
|
||||
@@ -317,7 +317,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('fires a changefeature event when updating a feature', function() {
|
||||
var feature = new _ol_Feature_(new Point([1, 1]));
|
||||
var feature = new Feature(new Point([1, 1]));
|
||||
vectorSource.addFeature(feature);
|
||||
var listener = sinon.spy(function(event) {
|
||||
expect(event.feature).to.be(feature);
|
||||
@@ -336,14 +336,14 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('returns a feature by id', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('foo')).to.be(feature);
|
||||
});
|
||||
|
||||
it('returns a feature by id (set after add)', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('foo')).to.be(null);
|
||||
feature.setId('foo');
|
||||
@@ -351,14 +351,14 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('returns null when no feature is found', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('bar')).to.be(null);
|
||||
});
|
||||
|
||||
it('returns null after removing feature', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('foo')).to.be(feature);
|
||||
@@ -367,7 +367,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('returns null after unsetting id', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('foo')).to.be(feature);
|
||||
@@ -376,7 +376,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('returns null after clear', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('foo')).to.be(feature);
|
||||
@@ -386,19 +386,19 @@ describe('ol.source.Vector', function() {
|
||||
|
||||
it('returns null when no features are indexed', function() {
|
||||
expect(source.getFeatureById('foo')).to.be(null);
|
||||
source.addFeature(new _ol_Feature_());
|
||||
source.addFeature(new Feature());
|
||||
expect(source.getFeatureById('foo')).to.be(null);
|
||||
});
|
||||
|
||||
it('returns correct feature after add/remove/add', function() {
|
||||
expect(source.getFeatureById('foo')).to.be(null);
|
||||
var first = new _ol_Feature_();
|
||||
var first = new Feature();
|
||||
first.setId('foo');
|
||||
source.addFeature(first);
|
||||
expect(source.getFeatureById('foo')).to.be(first);
|
||||
source.removeFeature(first);
|
||||
expect(source.getFeatureById('foo')).to.be(null);
|
||||
var second = new _ol_Feature_();
|
||||
var second = new Feature();
|
||||
second.setId('foo');
|
||||
source.addFeature(second);
|
||||
expect(source.getFeatureById('foo')).to.be(second);
|
||||
@@ -406,7 +406,7 @@ describe('ol.source.Vector', function() {
|
||||
|
||||
it('returns correct feature after add/change', function() {
|
||||
expect(source.getFeatureById('foo')).to.be(null);
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
expect(source.getFeatureById('foo')).to.be(feature);
|
||||
@@ -515,10 +515,10 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('ignores features with the same id', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.setId('foo');
|
||||
source.addFeature(feature);
|
||||
var dupe = new _ol_Feature_();
|
||||
var dupe = new Feature();
|
||||
dupe.setId('foo');
|
||||
source.addFeature(dupe);
|
||||
expect(source.getFeatures()).to.have.length(1);
|
||||
@@ -526,10 +526,10 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('allows changing feature and set the same id', function() {
|
||||
var foo = new _ol_Feature_();
|
||||
var foo = new Feature();
|
||||
foo.setId('foo');
|
||||
source.addFeature(foo);
|
||||
var bar = new _ol_Feature_();
|
||||
var bar = new Feature();
|
||||
bar.setId('bar');
|
||||
source.addFeature(bar);
|
||||
bar.setId('foo');
|
||||
@@ -545,7 +545,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('disallows adding the same feature twice', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
source.addFeature(feature);
|
||||
expect(function() {
|
||||
source.addFeature(feature);
|
||||
@@ -564,7 +564,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('#forEachFeatureInExtent loops through all features', function() {
|
||||
source.addFeatures([new _ol_Feature_(), new _ol_Feature_()]);
|
||||
source.addFeatures([new Feature(), new Feature()]);
|
||||
var spy = sinon.spy();
|
||||
source.forEachFeatureInExtent([0, 0, 0, 0], spy);
|
||||
expect(spy.callCount).to.be(2);
|
||||
@@ -586,7 +586,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('adding/removing features keeps the collection in sync', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
source.addFeature(feature);
|
||||
expect(collection.getLength()).to.be(1);
|
||||
source.removeFeature(feature);
|
||||
@@ -594,7 +594,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('#clear() features keeps the collection in sync', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
source.addFeatures([feature]);
|
||||
expect(collection.getLength()).to.be(1);
|
||||
source.clear();
|
||||
@@ -606,7 +606,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('keeps the source\'s features in sync with the collection', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
collection.push(feature);
|
||||
expect(source.getFeatures().length).to.be(1);
|
||||
collection.remove(feature);
|
||||
@@ -633,7 +633,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('adding/removing features keeps the collection in sync', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
source.addFeature(feature);
|
||||
expect(collection.getLength()).to.be(1);
|
||||
source.removeFeature(feature);
|
||||
@@ -641,7 +641,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('#clear() features keeps the collection in sync', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
source.addFeatures([feature]);
|
||||
expect(collection.getLength()).to.be(1);
|
||||
source.clear();
|
||||
@@ -653,7 +653,7 @@ describe('ol.source.Vector', function() {
|
||||
});
|
||||
|
||||
it('keeps the source\'s features in sync with the collection', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
collection.push(feature);
|
||||
expect(source.getFeatures().length).to.be(1);
|
||||
collection.remove(feature);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||
import Feature from '../../../../src/ol/Feature.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import _ol_style_Style_ from '../../../../src/ol/style/Style.js';
|
||||
import _ol_style_Fill_ from '../../../../src/ol/style/Fill.js';
|
||||
@@ -194,7 +194,7 @@ describe('ol.style.Style', function() {
|
||||
var style = new _ol_style_Style_();
|
||||
|
||||
it('creates a geometry function from a string', function() {
|
||||
var feature = new _ol_Feature_();
|
||||
var feature = new Feature();
|
||||
feature.set('myGeom', new Point([0, 0]));
|
||||
style.setGeometry('myGeom');
|
||||
expect(style.getGeometryFunction()(feature))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_Feature_ from '../../../src/ol/Feature.js';
|
||||
import Feature from '../../../src/ol/Feature.js';
|
||||
import {defaultLoadFunction} from '../../../src/ol/VectorImageTile.js';
|
||||
import VectorTile from '../../../src/ol/VectorTile.js';
|
||||
import _ol_events_ from '../../../src/ol/events.js';
|
||||
@@ -19,7 +19,7 @@ describe('ol.VectorTile', function() {
|
||||
});
|
||||
};
|
||||
format.readFeatures = function(source, options) {
|
||||
return [new _ol_Feature_()];
|
||||
return [new Feature()];
|
||||
};
|
||||
|
||||
var tile = new VectorTile([0, 0, 0], null, null, format);
|
||||
|
||||
Reference in New Issue
Block a user