Rename _ol_geom_Polygon_ to Polygon
This commit is contained in:
@@ -4,7 +4,7 @@ import _ol_Map_ from '../src/ol/Map.js';
|
|||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import LineString from '../src/ol/geom/LineString.js';
|
import LineString from '../src/ol/geom/LineString.js';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_ from '../src/ol/interaction.js';
|
import _ol_interaction_ from '../src/ol/interaction.js';
|
||||||
import _ol_interaction_Pointer_ from '../src/ol/interaction/Pointer.js';
|
import _ol_interaction_Pointer_ from '../src/ol/interaction/Pointer.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
@@ -140,7 +140,7 @@ var lineFeature = new _ol_Feature_(
|
|||||||
new LineString([[-1e7, 1e6], [-1e6, 3e6]]));
|
new LineString([[-1e7, 1e6], [-1e6, 3e6]]));
|
||||||
|
|
||||||
var polygonFeature = new _ol_Feature_(
|
var polygonFeature = new _ol_Feature_(
|
||||||
new _ol_geom_Polygon_([[[-3e6, -1e6], [-3e6, 1e6],
|
new Polygon([[[-3e6, -1e6], [-3e6, 1e6],
|
||||||
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
|
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ol_Map_ from '../src/ol/Map.js';
|
import _ol_Map_ from '../src/ol/Map.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||||
@@ -43,7 +43,7 @@ function addInteraction() {
|
|||||||
value = 'Circle';
|
value = 'Circle';
|
||||||
geometryFunction = function(coordinates, geometry) {
|
geometryFunction = function(coordinates, geometry) {
|
||||||
if (!geometry) {
|
if (!geometry) {
|
||||||
geometry = new _ol_geom_Polygon_(null);
|
geometry = new Polygon(null);
|
||||||
}
|
}
|
||||||
var center = coordinates[0];
|
var center = coordinates[0];
|
||||||
var last = coordinates[1];
|
var last = coordinates[1];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Map_ from '../src/ol/Map.js';
|
import _ol_Map_ from '../src/ol/Map.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import _ol_format_KML_ from '../src/ol/format/KML.js';
|
import _ol_format_KML_ from '../src/ol/format/KML.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||||
import _ol_render_ from '../src/ol/render.js';
|
import _ol_render_ from '../src/ol/render.js';
|
||||||
@@ -39,7 +39,7 @@ var styleFunction = function(feature) {
|
|||||||
fill: new _ol_style_Fill_({color: 'rgba(255, 153, 0, 0.4)'}),
|
fill: new _ol_style_Fill_({color: 'rgba(255, 153, 0, 0.4)'}),
|
||||||
stroke: new _ol_style_Stroke_({color: 'rgba(255, 204, 0, 0.2)', width: 2})
|
stroke: new _ol_style_Stroke_({color: 'rgba(255, 204, 0, 0.2)', width: 2})
|
||||||
}));
|
}));
|
||||||
vectorContext.drawGeometry(new _ol_geom_Polygon_([symbol.map(scaleFunction)]));
|
vectorContext.drawGeometry(new Polygon([symbol.map(scaleFunction)]));
|
||||||
style = new _ol_style_Style_({
|
style = new _ol_style_Style_({
|
||||||
image: new _ol_style_Icon_({
|
image: new _ol_style_Icon_({
|
||||||
img: canvas,
|
img: canvas,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import _ol_Overlay_ from '../src/ol/Overlay.js';
|
|||||||
import _ol_Sphere_ from '../src/ol/Sphere.js';
|
import _ol_Sphere_ from '../src/ol/Sphere.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import LineString from '../src/ol/geom/LineString.js';
|
import LineString from '../src/ol/geom/LineString.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||||
@@ -104,7 +104,7 @@ var pointerMoveHandler = function(evt) {
|
|||||||
|
|
||||||
if (sketch) {
|
if (sketch) {
|
||||||
var geom = (sketch.getGeometry());
|
var geom = (sketch.getGeometry());
|
||||||
if (geom instanceof _ol_geom_Polygon_) {
|
if (geom instanceof Polygon) {
|
||||||
helpMsg = continuePolygonMsg;
|
helpMsg = continuePolygonMsg;
|
||||||
} else if (geom instanceof LineString) {
|
} else if (geom instanceof LineString) {
|
||||||
helpMsg = continueLineMsg;
|
helpMsg = continueLineMsg;
|
||||||
@@ -217,7 +217,7 @@ function addInteraction() {
|
|||||||
listener = sketch.getGeometry().on('change', function(evt) {
|
listener = sketch.getGeometry().on('change', function(evt) {
|
||||||
var geom = evt.target;
|
var geom = evt.target;
|
||||||
var output;
|
var output;
|
||||||
if (geom instanceof _ol_geom_Polygon_) {
|
if (geom instanceof Polygon) {
|
||||||
output = formatArea(geom);
|
output = formatArea(geom);
|
||||||
tooltipCoord = geom.getInteriorPoint().getCoordinates();
|
tooltipCoord = geom.getInteriorPoint().getCoordinates();
|
||||||
} else if (geom instanceof LineString) {
|
} else if (geom instanceof LineString) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import LineString from '../src/ol/geom/LineString.js';
|
import LineString from '../src/ol/geom/LineString.js';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_ from '../src/ol/render.js';
|
import _ol_render_ from '../src/ol/render.js';
|
||||||
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../src/ol/style/Circle.js';
|
||||||
import _ol_style_Fill_ from '../src/ol/style/Fill.js';
|
import _ol_style_Fill_ from '../src/ol/style/Fill.js';
|
||||||
@@ -25,5 +25,5 @@ var style = new _ol_style_Style_({
|
|||||||
vectorContext.setStyle(style);
|
vectorContext.setStyle(style);
|
||||||
|
|
||||||
vectorContext.drawGeometry(new LineString([[10, 10], [90, 90]]));
|
vectorContext.drawGeometry(new LineString([[10, 10], [90, 90]]));
|
||||||
vectorContext.drawGeometry(new _ol_geom_Polygon_([[[2, 2], [98, 2], [2, 98], [2, 2]]]));
|
vectorContext.drawGeometry(new Polygon([[[2, 2], [98, 2], [2, 98], [2, 2]]]));
|
||||||
vectorContext.drawGeometry(new Point([88, 88]));
|
vectorContext.drawGeometry(new Point([88, 88]));
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../src/ol/Feature.js';
|
|||||||
import _ol_Map_ from '../src/ol/Map.js';
|
import _ol_Map_ from '../src/ol/Map.js';
|
||||||
import _ol_Sphere_ from '../src/ol/Sphere.js';
|
import _ol_Sphere_ from '../src/ol/Sphere.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||||
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
|
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
|
||||||
@@ -63,7 +63,7 @@ var radius = 800000;
|
|||||||
var x, y;
|
var x, y;
|
||||||
for (x = -180; x < 180; x += 30) {
|
for (x = -180; x < 180; x += 30) {
|
||||||
for (y = -90; y < 90; y += 30) {
|
for (y = -90; y < 90; y += 30) {
|
||||||
var circle4326 = _ol_geom_Polygon_.circular(wgs84Sphere, [x, y], radius, 64);
|
var circle4326 = Polygon.circular(wgs84Sphere, [x, y], radius, 64);
|
||||||
var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
|
var circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
|
||||||
vectorLayer4326.getSource().addFeature(new _ol_Feature_(circle4326));
|
vectorLayer4326.getSource().addFeature(new _ol_Feature_(circle4326));
|
||||||
vectorLayer3857.getSource().addFeature(new _ol_Feature_(circle3857));
|
vectorLayer3857.getSource().addFeature(new _ol_Feature_(circle3857));
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import _ol_Map_ from '../src/ol/Map.js';
|
|||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point.js';
|
||||||
import LineString from '../src/ol/geom/LineString.js';
|
import LineString from '../src/ol/geom/LineString.js';
|
||||||
import _ol_geom_Polygon_ from '../src/ol/geom/Polygon.js';
|
import Polygon from '../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
import _ol_interaction_Draw_ from '../src/ol/interaction/Draw.js';
|
||||||
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
import _ol_interaction_Snap_ from '../src/ol/interaction/Snap.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
@@ -149,7 +149,7 @@ function edgeToFeature(edge) {
|
|||||||
function faceToFeature(face) {
|
function faceToFeature(face) {
|
||||||
var coordinates = topo.getFaceGeometry(face);
|
var coordinates = topo.getFaceGeometry(face);
|
||||||
var feature = new _ol_Feature_({
|
var feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_(coordinates),
|
geometry: new Polygon(coordinates),
|
||||||
face: face
|
face: face
|
||||||
});
|
});
|
||||||
feature.setId(face.id);
|
feature.setId(face.id);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import _ol_Object_ from './Object.js';
|
|||||||
import _ol_Sphere_ from './Sphere.js';
|
import _ol_Sphere_ from './Sphere.js';
|
||||||
import _ol_events_ from './events.js';
|
import _ol_events_ from './events.js';
|
||||||
import _ol_events_EventType_ from './events/EventType.js';
|
import _ol_events_EventType_ from './events/EventType.js';
|
||||||
import _ol_geom_Polygon_ from './geom/Polygon.js';
|
import Polygon from './geom/Polygon.js';
|
||||||
import _ol_has_ from './has.js';
|
import _ol_has_ from './has.js';
|
||||||
import _ol_math_ from './math.js';
|
import _ol_math_ from './math.js';
|
||||||
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
|
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
|
||||||
@@ -161,7 +161,7 @@ _ol_Geolocation_.prototype.positionChange_ = function(position) {
|
|||||||
this.set(_ol_GeolocationProperty_.POSITION, projectedPosition);
|
this.set(_ol_GeolocationProperty_.POSITION, projectedPosition);
|
||||||
this.set(_ol_GeolocationProperty_.SPEED,
|
this.set(_ol_GeolocationProperty_.SPEED,
|
||||||
coords.speed === null ? undefined : coords.speed);
|
coords.speed === null ? undefined : coords.speed);
|
||||||
var geometry = _ol_geom_Polygon_.circular(
|
var geometry = Polygon.circular(
|
||||||
this.sphere_, this.position_, coords.accuracy);
|
this.sphere_, this.position_, coords.accuracy);
|
||||||
geometry.applyTransform(this.transform_);
|
geometry.applyTransform(this.transform_);
|
||||||
this.set(_ol_GeolocationProperty_.ACCURACY_GEOMETRY, geometry);
|
this.set(_ol_GeolocationProperty_.ACCURACY_GEOMETRY, geometry);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import _ol_coordinate_ from './coordinate.js';
|
|||||||
import {inAndOut} from './easing.js';
|
import {inAndOut} from './easing.js';
|
||||||
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
||||||
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
|
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
|
||||||
import _ol_geom_Polygon_ from './geom/Polygon.js';
|
import Polygon from './geom/Polygon.js';
|
||||||
import _ol_geom_SimpleGeometry_ from './geom/SimpleGeometry.js';
|
import _ol_geom_SimpleGeometry_ from './geom/SimpleGeometry.js';
|
||||||
import _ol_math_ from './math.js';
|
import _ol_math_ from './math.js';
|
||||||
import _ol_obj_ from './obj.js';
|
import _ol_obj_ from './obj.js';
|
||||||
@@ -884,10 +884,10 @@ _ol_View_.prototype.fit = function(geometryOrExtent, opt_options) {
|
|||||||
24); // Invalid extent or geometry provided as `geometry`
|
24); // Invalid extent or geometry provided as `geometry`
|
||||||
_ol_asserts_.assert(!isEmpty(geometryOrExtent),
|
_ol_asserts_.assert(!isEmpty(geometryOrExtent),
|
||||||
25); // Cannot fit empty extent provided as `geometry`
|
25); // Cannot fit empty extent provided as `geometry`
|
||||||
geometry = _ol_geom_Polygon_.fromExtent(geometryOrExtent);
|
geometry = Polygon.fromExtent(geometryOrExtent);
|
||||||
} else if (geometryOrExtent.getType() === _ol_geom_GeometryType_.CIRCLE) {
|
} else if (geometryOrExtent.getType() === _ol_geom_GeometryType_.CIRCLE) {
|
||||||
geometryOrExtent = geometryOrExtent.getExtent();
|
geometryOrExtent = geometryOrExtent.getExtent();
|
||||||
geometry = _ol_geom_Polygon_.fromExtent(geometryOrExtent);
|
geometry = Polygon.fromExtent(geometryOrExtent);
|
||||||
geometry.rotate(this.getRotation(), getCenter(geometryOrExtent));
|
geometry.rotate(this.getRotation(), getCenter(geometryOrExtent));
|
||||||
} else {
|
} else {
|
||||||
geometry = geometryOrExtent;
|
geometry = geometryOrExtent;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
@@ -238,7 +238,7 @@ _ol_format_EsriJSON_.readMultiPolygonGeometry_ = function(object) {
|
|||||||
*/
|
*/
|
||||||
_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) {
|
_ol_format_EsriJSON_.readPolygonGeometry_ = function(object) {
|
||||||
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
|
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
|
||||||
return new _ol_geom_Polygon_(object.rings, layout);
|
return new Polygon(object.rings, layout);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
|||||||
import LineString from '../geom/LineString.js';
|
import LineString from '../geom/LineString.js';
|
||||||
import MultiLineString from '../geom/MultiLineString.js';
|
import MultiLineString from '../geom/MultiLineString.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import {get as getProjection, transformExtent} from '../proj.js';
|
import {get as getProjection, transformExtent} from '../proj.js';
|
||||||
import _ol_xml_ from '../xml.js';
|
import _ol_xml_ from '../xml.js';
|
||||||
@@ -244,7 +244,7 @@ _ol_format_GML3_.prototype.readSurface_ = function(node, objectStack) {
|
|||||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
var flatCoordinates = flatLinearRings[0];
|
var flatCoordinates = flatLinearRings[0];
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
import _ol_xml_ from '../xml.js';
|
import _ol_xml_ from '../xml.js';
|
||||||
@@ -423,7 +423,7 @@ _ol_format_GMLBase_.prototype.readPolygon = function(node, objectStack) {
|
|||||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
var flatCoordinates = flatLinearRings[0];
|
var flatCoordinates = flatLinearRings[0];
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ _ol_format_GeoJSON_.readMultiPolygonGeometry_ = function(object) {
|
|||||||
* @return {ol.geom.Polygon} Polygon.
|
* @return {ol.geom.Polygon} Polygon.
|
||||||
*/
|
*/
|
||||||
_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) {
|
_ol_format_GeoJSON_.readPolygonGeometry_ = function(object) {
|
||||||
return new _ol_geom_Polygon_(object.coordinates);
|
return new Polygon(object.coordinates);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_math_ from '../math.js';
|
import _ol_math_ from '../math.js';
|
||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
import _ol_style_Fill_ from '../style/Fill.js';
|
import _ol_style_Fill_ from '../style/Fill.js';
|
||||||
@@ -887,7 +887,7 @@ _ol_format_KML_.readLinearRing_ = function(node, objectStack) {
|
|||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
_ol_format_KML_.readFlatCoordinatesFromNode_(node, objectStack);
|
_ol_format_KML_.readFlatCoordinatesFromNode_(node, objectStack);
|
||||||
if (flatCoordinates) {
|
if (flatCoordinates) {
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
polygon.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates,
|
polygon.setFlatCoordinates(_ol_geom_GeometryLayout_.XYZ, flatCoordinates,
|
||||||
[flatCoordinates.length]);
|
[flatCoordinates.length]);
|
||||||
polygon.setProperties(properties);
|
polygon.setProperties(properties);
|
||||||
@@ -995,7 +995,7 @@ _ol_format_KML_.readPolygon_ = function(node, objectStack) {
|
|||||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||||
_ol_format_KML_.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
_ol_format_KML_.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
var flatCoordinates = flatLinearRings[0];
|
var flatCoordinates = flatLinearRings[0];
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||||
import _ol_proj_Projection_ from '../proj/Projection.js';
|
import _ol_proj_Projection_ from '../proj/Projection.js';
|
||||||
import _ol_proj_Units_ from '../proj/Units.js';
|
import _ol_proj_Units_ from '../proj/Units.js';
|
||||||
@@ -307,12 +307,12 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
|
|||||||
ends = endss;
|
ends = endss;
|
||||||
geom = new _ol_geom_MultiPolygon_(null);
|
geom = new _ol_geom_MultiPolygon_(null);
|
||||||
} else {
|
} else {
|
||||||
geom = new _ol_geom_Polygon_(null);
|
geom = new Polygon(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
geom = geometryType === _ol_geom_GeometryType_.POINT ? new Point(null) :
|
geom = geometryType === _ol_geom_GeometryType_.POINT ? new Point(null) :
|
||||||
geometryType === _ol_geom_GeometryType_.LINE_STRING ? new LineString(null) :
|
geometryType === _ol_geom_GeometryType_.LINE_STRING ? new LineString(null) :
|
||||||
geometryType === _ol_geom_GeometryType_.POLYGON ? new _ol_geom_Polygon_(null) :
|
geometryType === _ol_geom_GeometryType_.POLYGON ? new Polygon(null) :
|
||||||
geometryType === _ol_geom_GeometryType_.MULTI_POINT ? new MultiPoint (null) :
|
geometryType === _ol_geom_GeometryType_.MULTI_POINT ? new MultiPoint (null) :
|
||||||
geometryType === _ol_geom_GeometryType_.MULTI_LINE_STRING ? new MultiLineString(null) :
|
geometryType === _ol_geom_GeometryType_.MULTI_LINE_STRING ? new MultiLineString(null) :
|
||||||
null;
|
null;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
|
|||||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||||
import LineString from '../geom/LineString.js';
|
import LineString from '../geom/LineString.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
import _ol_xml_ from '../xml.js';
|
import _ol_xml_ from '../xml.js';
|
||||||
@@ -185,7 +185,7 @@ _ol_format_OSMXML_.prototype.readFeaturesFromNode = function(node, opt_options)
|
|||||||
var geometry;
|
var geometry;
|
||||||
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
|
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
|
||||||
// closed way
|
// closed way
|
||||||
geometry = new _ol_geom_Polygon_(null);
|
geometry = new Polygon(null);
|
||||||
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates,
|
geometry.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, flatCoordinates,
|
||||||
[flatCoordinates.length]);
|
[flatCoordinates.length]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -176,7 +176,7 @@ _ol_format_TopoJSON_.readPolygonGeometry_ = function(object, arcs) {
|
|||||||
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
|
for (i = 0, ii = object.arcs.length; i < ii; ++i) {
|
||||||
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
|
coordinates[i] = _ol_format_TopoJSON_.concatenateArcs_(object.arcs[i], arcs);
|
||||||
}
|
}
|
||||||
return new _ol_geom_Polygon_(coordinates);
|
return new Polygon(coordinates);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -920,7 +920,7 @@ _ol_format_WKT_.Parser.prototype.formatErrorMessage_ = function() {
|
|||||||
_ol_format_WKT_.Parser.GeometryConstructor_ = {
|
_ol_format_WKT_.Parser.GeometryConstructor_ = {
|
||||||
'POINT': Point,
|
'POINT': Point,
|
||||||
'LINESTRING': LineString,
|
'LINESTRING': LineString,
|
||||||
'POLYGON': _ol_geom_Polygon_,
|
'POLYGON': Polygon,
|
||||||
'MULTIPOINT': MultiPoint,
|
'MULTIPOINT': MultiPoint,
|
||||||
'MULTILINESTRING': MultiLineString,
|
'MULTILINESTRING': MultiLineString,
|
||||||
'MULTIPOLYGON': _ol_geom_MultiPolygon_
|
'MULTIPOLYGON': _ol_geom_MultiPolygon_
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {closestSquaredDistanceXY} from '../extent.js';
|
|||||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||||
import _ol_geom_flat_area_ from '../geom/flat/area.js';
|
import _ol_geom_flat_area_ from '../geom/flat/area.js';
|
||||||
import _ol_geom_flat_center_ from '../geom/flat/center.js';
|
import _ol_geom_flat_center_ from '../geom/flat/center.js';
|
||||||
@@ -298,7 +298,7 @@ _ol_geom_MultiPolygon_.prototype.getPolygon = function(index) {
|
|||||||
ends[i] -= offset;
|
ends[i] -= offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
polygon.setFlatCoordinates(
|
polygon.setFlatCoordinates(
|
||||||
this.layout, this.flatCoordinates.slice(offset, end), ends);
|
this.layout, this.flatCoordinates.slice(offset, end), ends);
|
||||||
return polygon;
|
return polygon;
|
||||||
@@ -325,7 +325,7 @@ _ol_geom_MultiPolygon_.prototype.getPolygons = function() {
|
|||||||
ends[j] -= offset;
|
ends[j] -= offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
polygon.setFlatCoordinates(
|
polygon.setFlatCoordinates(
|
||||||
layout, flatCoordinates.slice(offset, end), ends);
|
layout, flatCoordinates.slice(offset, end), ends);
|
||||||
polygons.push(polygon);
|
polygons.push(polygon);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import _ol_math_ from '../math.js';
|
|||||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_geom_Polygon_ = function(coordinates, opt_layout) {
|
var Polygon = function(coordinates, opt_layout) {
|
||||||
|
|
||||||
_ol_geom_SimpleGeometry_.call(this);
|
_ol_geom_SimpleGeometry_.call(this);
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ var _ol_geom_Polygon_ = function(coordinates, opt_layout) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_geom_Polygon_, _ol_geom_SimpleGeometry_);
|
inherits(Polygon, _ol_geom_SimpleGeometry_);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +93,7 @@ inherits(_ol_geom_Polygon_, _ol_geom_SimpleGeometry_);
|
|||||||
* @param {ol.geom.LinearRing} linearRing Linear ring.
|
* @param {ol.geom.LinearRing} linearRing Linear ring.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.appendLinearRing = function(linearRing) {
|
Polygon.prototype.appendLinearRing = function(linearRing) {
|
||||||
if (!this.flatCoordinates) {
|
if (!this.flatCoordinates) {
|
||||||
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
|
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
|
||||||
} else {
|
} else {
|
||||||
@@ -110,8 +110,8 @@ _ol_geom_Polygon_.prototype.appendLinearRing = function(linearRing) {
|
|||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.clone = function() {
|
Polygon.prototype.clone = function() {
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
polygon.setFlatCoordinates(
|
polygon.setFlatCoordinates(
|
||||||
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
|
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
|
||||||
return polygon;
|
return polygon;
|
||||||
@@ -121,7 +121,7 @@ _ol_geom_Polygon_.prototype.clone = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
Polygon.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
|
||||||
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
|
||||||
return minSquaredDistance;
|
return minSquaredDistance;
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ _ol_geom_Polygon_.prototype.closestPointXY = function(x, y, closestPoint, minSqu
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.containsXY = function(x, y) {
|
Polygon.prototype.containsXY = function(x, y) {
|
||||||
return _ol_geom_flat_contains_.linearRingsContainsXY(
|
return _ol_geom_flat_contains_.linearRingsContainsXY(
|
||||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
|
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
|
||||||
};
|
};
|
||||||
@@ -150,7 +150,7 @@ _ol_geom_Polygon_.prototype.containsXY = function(x, y) {
|
|||||||
* @return {number} Area (on projected plane).
|
* @return {number} Area (on projected plane).
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getArea = function() {
|
Polygon.prototype.getArea = function() {
|
||||||
return _ol_geom_flat_area_.linearRings(
|
return _ol_geom_flat_area_.linearRings(
|
||||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);
|
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);
|
||||||
};
|
};
|
||||||
@@ -170,7 +170,7 @@ _ol_geom_Polygon_.prototype.getArea = function() {
|
|||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getCoordinates = function(opt_right) {
|
Polygon.prototype.getCoordinates = function(opt_right) {
|
||||||
var flatCoordinates;
|
var flatCoordinates;
|
||||||
if (opt_right !== undefined) {
|
if (opt_right !== undefined) {
|
||||||
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
||||||
@@ -188,7 +188,7 @@ _ol_geom_Polygon_.prototype.getCoordinates = function(opt_right) {
|
|||||||
/**
|
/**
|
||||||
* @return {Array.<number>} Ends.
|
* @return {Array.<number>} Ends.
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getEnds = function() {
|
Polygon.prototype.getEnds = function() {
|
||||||
return this.ends_;
|
return this.ends_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ _ol_geom_Polygon_.prototype.getEnds = function() {
|
|||||||
/**
|
/**
|
||||||
* @return {Array.<number>} Interior point.
|
* @return {Array.<number>} Interior point.
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getFlatInteriorPoint = function() {
|
Polygon.prototype.getFlatInteriorPoint = function() {
|
||||||
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
||||||
var flatCenter = getCenter(this.getExtent());
|
var flatCenter = getCenter(this.getExtent());
|
||||||
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
|
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
|
||||||
@@ -214,7 +214,7 @@ _ol_geom_Polygon_.prototype.getFlatInteriorPoint = function() {
|
|||||||
* length of the horizontal intersection that the point belongs to.
|
* length of the horizontal intersection that the point belongs to.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getInteriorPoint = function() {
|
Polygon.prototype.getInteriorPoint = function() {
|
||||||
return new Point(this.getFlatInteriorPoint(), _ol_geom_GeometryLayout_.XYM);
|
return new Point(this.getFlatInteriorPoint(), _ol_geom_GeometryLayout_.XYM);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ _ol_geom_Polygon_.prototype.getInteriorPoint = function() {
|
|||||||
* @return {number} Number of rings.
|
* @return {number} Number of rings.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getLinearRingCount = function() {
|
Polygon.prototype.getLinearRingCount = function() {
|
||||||
return this.ends_.length;
|
return this.ends_.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ _ol_geom_Polygon_.prototype.getLinearRingCount = function() {
|
|||||||
* @return {ol.geom.LinearRing} Linear ring.
|
* @return {ol.geom.LinearRing} Linear ring.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getLinearRing = function(index) {
|
Polygon.prototype.getLinearRing = function(index) {
|
||||||
if (index < 0 || this.ends_.length <= index) {
|
if (index < 0 || this.ends_.length <= index) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ _ol_geom_Polygon_.prototype.getLinearRing = function(index) {
|
|||||||
* @return {Array.<ol.geom.LinearRing>} Linear rings.
|
* @return {Array.<ol.geom.LinearRing>} Linear rings.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getLinearRings = function() {
|
Polygon.prototype.getLinearRings = function() {
|
||||||
var layout = this.layout;
|
var layout = this.layout;
|
||||||
var flatCoordinates = this.flatCoordinates;
|
var flatCoordinates = this.flatCoordinates;
|
||||||
var ends = this.ends_;
|
var ends = this.ends_;
|
||||||
@@ -278,7 +278,7 @@ _ol_geom_Polygon_.prototype.getLinearRings = function() {
|
|||||||
/**
|
/**
|
||||||
* @return {Array.<number>} Oriented flat coordinates.
|
* @return {Array.<number>} Oriented flat coordinates.
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getOrientedFlatCoordinates = function() {
|
Polygon.prototype.getOrientedFlatCoordinates = function() {
|
||||||
if (this.orientedRevision_ != this.getRevision()) {
|
if (this.orientedRevision_ != this.getRevision()) {
|
||||||
var flatCoordinates = this.flatCoordinates;
|
var flatCoordinates = this.flatCoordinates;
|
||||||
if (_ol_geom_flat_orient_.linearRingsAreOriented(
|
if (_ol_geom_flat_orient_.linearRingsAreOriented(
|
||||||
@@ -299,14 +299,14 @@ _ol_geom_Polygon_.prototype.getOrientedFlatCoordinates = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
Polygon.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
||||||
var simplifiedFlatCoordinates = [];
|
var simplifiedFlatCoordinates = [];
|
||||||
var simplifiedEnds = [];
|
var simplifiedEnds = [];
|
||||||
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.quantizes(
|
simplifiedFlatCoordinates.length = _ol_geom_flat_simplify_.quantizes(
|
||||||
this.flatCoordinates, 0, this.ends_, this.stride,
|
this.flatCoordinates, 0, this.ends_, this.stride,
|
||||||
Math.sqrt(squaredTolerance),
|
Math.sqrt(squaredTolerance),
|
||||||
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
||||||
var simplifiedPolygon = new _ol_geom_Polygon_(null);
|
var simplifiedPolygon = new Polygon(null);
|
||||||
simplifiedPolygon.setFlatCoordinates(
|
simplifiedPolygon.setFlatCoordinates(
|
||||||
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
_ol_geom_GeometryLayout_.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
||||||
return simplifiedPolygon;
|
return simplifiedPolygon;
|
||||||
@@ -317,7 +317,7 @@ _ol_geom_Polygon_.prototype.getSimplifiedGeometryInternal = function(squaredTole
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.getType = function() {
|
Polygon.prototype.getType = function() {
|
||||||
return _ol_geom_GeometryType_.POLYGON;
|
return _ol_geom_GeometryType_.POLYGON;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ _ol_geom_Polygon_.prototype.getType = function() {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.intersectsExtent = function(extent) {
|
Polygon.prototype.intersectsExtent = function(extent) {
|
||||||
return _ol_geom_flat_intersectsextent_.linearRings(
|
return _ol_geom_flat_intersectsextent_.linearRings(
|
||||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);
|
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);
|
||||||
};
|
};
|
||||||
@@ -339,7 +339,7 @@ _ol_geom_Polygon_.prototype.intersectsExtent = function(extent) {
|
|||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||||
if (!coordinates) {
|
if (!coordinates) {
|
||||||
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null, this.ends_);
|
this.setFlatCoordinates(_ol_geom_GeometryLayout_.XY, null, this.ends_);
|
||||||
} else {
|
} else {
|
||||||
@@ -360,7 +360,7 @@ _ol_geom_Polygon_.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
* @param {Array.<number>} ends Ends.
|
* @param {Array.<number>} ends Ends.
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
Polygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
||||||
this.ends_ = ends;
|
this.ends_ = ends;
|
||||||
this.changed();
|
this.changed();
|
||||||
@@ -378,7 +378,7 @@ _ol_geom_Polygon_.prototype.setFlatCoordinates = function(layout, flatCoordinate
|
|||||||
* @return {ol.geom.Polygon} The "circular" polygon.
|
* @return {ol.geom.Polygon} The "circular" polygon.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
Polygon.circular = function(sphere, center, radius, opt_n) {
|
||||||
var n = opt_n ? opt_n : 32;
|
var n = opt_n ? opt_n : 32;
|
||||||
/** @type {Array.<number>} */
|
/** @type {Array.<number>} */
|
||||||
var flatCoordinates = [];
|
var flatCoordinates = [];
|
||||||
@@ -388,7 +388,7 @@ _ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
|||||||
flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n));
|
flatCoordinates, sphere.offset(center, radius, 2 * Math.PI * i / n));
|
||||||
}
|
}
|
||||||
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
polygon.setFlatCoordinates(
|
polygon.setFlatCoordinates(
|
||||||
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
||||||
return polygon;
|
return polygon;
|
||||||
@@ -401,14 +401,14 @@ _ol_geom_Polygon_.circular = function(sphere, center, radius, opt_n) {
|
|||||||
* @return {ol.geom.Polygon} The polygon.
|
* @return {ol.geom.Polygon} The polygon.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.fromExtent = function(extent) {
|
Polygon.fromExtent = function(extent) {
|
||||||
var minX = extent[0];
|
var minX = extent[0];
|
||||||
var minY = extent[1];
|
var minY = extent[1];
|
||||||
var maxX = extent[2];
|
var maxX = extent[2];
|
||||||
var maxY = extent[3];
|
var maxY = extent[3];
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
[minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
|
[minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
|
||||||
var polygon = new _ol_geom_Polygon_(null);
|
var polygon = new Polygon(null);
|
||||||
polygon.setFlatCoordinates(
|
polygon.setFlatCoordinates(
|
||||||
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
_ol_geom_GeometryLayout_.XY, flatCoordinates, [flatCoordinates.length]);
|
||||||
return polygon;
|
return polygon;
|
||||||
@@ -424,11 +424,11 @@ _ol_geom_Polygon_.fromExtent = function(extent) {
|
|||||||
* @return {ol.geom.Polygon} Polygon geometry.
|
* @return {ol.geom.Polygon} Polygon geometry.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.fromCircle = function(circle, opt_sides, opt_angle) {
|
Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||||
var sides = opt_sides ? opt_sides : 32;
|
var sides = opt_sides ? opt_sides : 32;
|
||||||
var stride = circle.getStride();
|
var stride = circle.getStride();
|
||||||
var layout = circle.getLayout();
|
var layout = circle.getLayout();
|
||||||
var polygon = new _ol_geom_Polygon_(null, layout);
|
var polygon = new Polygon(null, layout);
|
||||||
var arrayLength = stride * (sides + 1);
|
var arrayLength = stride * (sides + 1);
|
||||||
var flatCoordinates = new Array(arrayLength);
|
var flatCoordinates = new Array(arrayLength);
|
||||||
for (var i = 0; i < arrayLength; i++) {
|
for (var i = 0; i < arrayLength; i++) {
|
||||||
@@ -436,7 +436,7 @@ _ol_geom_Polygon_.fromCircle = function(circle, opt_sides, opt_angle) {
|
|||||||
}
|
}
|
||||||
var ends = [flatCoordinates.length];
|
var ends = [flatCoordinates.length];
|
||||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||||
_ol_geom_Polygon_.makeRegular(
|
Polygon.makeRegular(
|
||||||
polygon, circle.getCenter(), circle.getRadius(), opt_angle);
|
polygon, circle.getCenter(), circle.getRadius(), opt_angle);
|
||||||
return polygon;
|
return polygon;
|
||||||
};
|
};
|
||||||
@@ -450,7 +450,7 @@ _ol_geom_Polygon_.fromCircle = function(circle, opt_sides, opt_angle) {
|
|||||||
* @param {number=} opt_angle Start angle for the first vertex of the polygon in
|
* @param {number=} opt_angle Start angle for the first vertex of the polygon in
|
||||||
* radians. Default is 0.
|
* radians. Default is 0.
|
||||||
*/
|
*/
|
||||||
_ol_geom_Polygon_.makeRegular = function(polygon, center, radius, opt_angle) {
|
Polygon.makeRegular = function(polygon, center, radius, opt_angle) {
|
||||||
var flatCoordinates = polygon.getFlatCoordinates();
|
var flatCoordinates = polygon.getFlatCoordinates();
|
||||||
var layout = polygon.getLayout();
|
var layout = polygon.getLayout();
|
||||||
var stride = polygon.getStride();
|
var stride = polygon.getStride();
|
||||||
@@ -466,4 +466,4 @@ _ol_geom_Polygon_.makeRegular = function(polygon, center, radius, opt_angle) {
|
|||||||
}
|
}
|
||||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
||||||
};
|
};
|
||||||
export default _ol_geom_Polygon_;
|
export default Polygon;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import MultiLineString from '../geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../geom/MultiPoint.js';
|
import MultiPoint from '../geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_interaction_DrawEventType_ from '../interaction/DrawEventType.js';
|
import _ol_interaction_DrawEventType_ from '../interaction/DrawEventType.js';
|
||||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||||
import _ol_interaction_Property_ from '../interaction/Property.js';
|
import _ol_interaction_Property_ from '../interaction/Property.js';
|
||||||
@@ -156,7 +156,7 @@ var _ol_interaction_Draw_ = function(options) {
|
|||||||
} else if (mode === _ol_interaction_Draw_.Mode_.LINE_STRING) {
|
} else if (mode === _ol_interaction_Draw_.Mode_.LINE_STRING) {
|
||||||
Constructor = LineString;
|
Constructor = LineString;
|
||||||
} else if (mode === _ol_interaction_Draw_.Mode_.POLYGON) {
|
} else if (mode === _ol_interaction_Draw_.Mode_.POLYGON) {
|
||||||
Constructor = _ol_geom_Polygon_;
|
Constructor = Polygon;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {!Array.<ol.Coordinate>} coordinates
|
* @param {!Array.<ol.Coordinate>} coordinates
|
||||||
@@ -555,7 +555,7 @@ _ol_interaction_Draw_.prototype.modifyDrawing_ = function(event) {
|
|||||||
sketchPointGeom.setCoordinates(coordinate);
|
sketchPointGeom.setCoordinates(coordinate);
|
||||||
}
|
}
|
||||||
var sketchLineGeom;
|
var sketchLineGeom;
|
||||||
if (geometry instanceof _ol_geom_Polygon_ &&
|
if (geometry instanceof Polygon &&
|
||||||
this.mode_ !== _ol_interaction_Draw_.Mode_.POLYGON) {
|
this.mode_ !== _ol_interaction_Draw_.Mode_.POLYGON) {
|
||||||
if (!this.sketchLine_) {
|
if (!this.sketchLine_) {
|
||||||
this.sketchLine_ = new _ol_Feature_(new LineString(null));
|
this.sketchLine_ = new _ol_Feature_(new LineString(null));
|
||||||
@@ -798,10 +798,10 @@ _ol_interaction_Draw_.createRegularPolygon = function(opt_sides, opt_angle) {
|
|||||||
var radius = Math.sqrt(
|
var radius = Math.sqrt(
|
||||||
_ol_coordinate_.squaredDistance(center, end));
|
_ol_coordinate_.squaredDistance(center, end));
|
||||||
var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
|
var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
|
||||||
_ol_geom_Polygon_.fromCircle(new _ol_geom_Circle_(center), opt_sides);
|
Polygon.fromCircle(new _ol_geom_Circle_(center), opt_sides);
|
||||||
var angle = opt_angle ? opt_angle :
|
var angle = opt_angle ? opt_angle :
|
||||||
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
|
Math.atan((end[1] - center[1]) / (end[0] - center[0]));
|
||||||
_ol_geom_Polygon_.makeRegular(geometry, center, radius, angle);
|
Polygon.makeRegular(geometry, center, radius, angle);
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -824,7 +824,7 @@ _ol_interaction_Draw_.createBox = function() {
|
|||||||
*/
|
*/
|
||||||
function(coordinates, opt_geometry) {
|
function(coordinates, opt_geometry) {
|
||||||
var extent = boundingExtent(coordinates);
|
var extent = boundingExtent(coordinates);
|
||||||
var geometry = opt_geometry || new _ol_geom_Polygon_(null);
|
var geometry = opt_geometry || new Polygon(null);
|
||||||
geometry.setCoordinates([[
|
geometry.setCoordinates([[
|
||||||
getBottomLeft(extent),
|
getBottomLeft(extent),
|
||||||
getBottomRight(extent),
|
getBottomRight(extent),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import _ol_events_Event_ from '../events/Event.js';
|
|||||||
import {boundingExtent, getArea} from '../extent.js';
|
import {boundingExtent, getArea} from '../extent.js';
|
||||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||||
import Point from '../geom/Point.js';
|
import Point from '../geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js';
|
import _ol_interaction_ExtentEventType_ from '../interaction/ExtentEventType.js';
|
||||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||||
import _ol_layer_Vector_ from '../layer/Vector.js';
|
import _ol_layer_Vector_ from '../layer/Vector.js';
|
||||||
@@ -376,7 +376,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
|
|||||||
if (!extent) {
|
if (!extent) {
|
||||||
extentFeature = new _ol_Feature_({});
|
extentFeature = new _ol_Feature_({});
|
||||||
} else {
|
} else {
|
||||||
extentFeature = new _ol_Feature_(_ol_geom_Polygon_.fromExtent(extent));
|
extentFeature = new _ol_Feature_(Polygon.fromExtent(extent));
|
||||||
}
|
}
|
||||||
this.extentFeature_ = extentFeature;
|
this.extentFeature_ = extentFeature;
|
||||||
this.extentOverlay_.getSource().addFeature(extentFeature);
|
this.extentOverlay_.getSource().addFeature(extentFeature);
|
||||||
@@ -384,7 +384,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
|
|||||||
if (!extent) {
|
if (!extent) {
|
||||||
extentFeature.setGeometry(undefined);
|
extentFeature.setGeometry(undefined);
|
||||||
} else {
|
} else {
|
||||||
extentFeature.setGeometry(_ol_geom_Polygon_.fromExtent(extent));
|
extentFeature.setGeometry(Polygon.fromExtent(extent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return extentFeature;
|
return extentFeature;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import _ol_events_EventType_ from '../events/EventType.js';
|
|||||||
import {boundingExtent, createEmpty} from '../extent.js';
|
import {boundingExtent, createEmpty} from '../extent.js';
|
||||||
import _ol_functions_ from '../functions.js';
|
import _ol_functions_ from '../functions.js';
|
||||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||||
import _ol_obj_ from '../obj.js';
|
import _ol_obj_ from '../obj.js';
|
||||||
import _ol_source_Vector_ from '../source/Vector.js';
|
import _ol_source_Vector_ from '../source/Vector.js';
|
||||||
@@ -435,7 +435,7 @@ _ol_interaction_Snap_.prototype.updateFeature_ = function(feature) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometry) {
|
_ol_interaction_Snap_.prototype.writeCircleGeometry_ = function(feature, geometry) {
|
||||||
var polygon = _ol_geom_Polygon_.fromCircle(geometry);
|
var polygon = Polygon.fromCircle(geometry);
|
||||||
var coordinates = polygon.getCoordinates()[0];
|
var coordinates = polygon.getCoordinates()[0];
|
||||||
var i, ii, segment, segmentData;
|
var i, ii, segment, segmentData;
|
||||||
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
for (i = 0, ii = coordinates.length - 1; i < ii; ++i) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Disposable_ from '../Disposable.js';
|
import _ol_Disposable_ from '../Disposable.js';
|
||||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
import Polygon from '../geom/Polygon.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -118,7 +118,7 @@ _ol_render_Box_.prototype.createOrUpdateGeometry = function() {
|
|||||||
// close the polygon
|
// close the polygon
|
||||||
coordinates[4] = coordinates[0].slice();
|
coordinates[4] = coordinates[0].slice();
|
||||||
if (!this.geometry_) {
|
if (!this.geometry_) {
|
||||||
this.geometry_ = new _ol_geom_Polygon_([coordinates]);
|
this.geometry_ = new Polygon([coordinates]);
|
||||||
} else {
|
} else {
|
||||||
this.geometry_.setCoordinates([coordinates]);
|
this.geometry_.setCoordinates([coordinates]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import _ol_format_GeoJSON_ from '../../../../src/ol/format/GeoJSON.js';
|
|||||||
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
import _ol_source_Vector_ from '../../../../src/ol/source/Vector.js';
|
||||||
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../../../../src/ol/style/Circle.js';
|
||||||
@@ -46,7 +46,7 @@ describe('ol.rendering.layer.Vector', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addPolygon(r) {
|
function addPolygon(r) {
|
||||||
source.addFeature(new _ol_Feature_(new _ol_geom_Polygon_([
|
source.addFeature(new _ol_Feature_(new Polygon([
|
||||||
[
|
[
|
||||||
[center[0] - r, center[1] - r],
|
[center[0] - r, center[1] - r],
|
||||||
[center[0] + r, center[1] - r],
|
[center[0] + r, center[1] - r],
|
||||||
@@ -494,14 +494,14 @@ describe('ol.rendering.layer.Vector', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
var src = new _ol_source_Vector_({
|
var src = new _ol_source_Vector_({
|
||||||
features: [
|
features: [
|
||||||
new _ol_Feature_(new _ol_geom_Polygon_([[
|
new _ol_Feature_(new Polygon([[
|
||||||
[-22, 58],
|
[-22, 58],
|
||||||
[-22, 78],
|
[-22, 78],
|
||||||
[-9, 78],
|
[-9, 78],
|
||||||
[-9, 58],
|
[-9, 58],
|
||||||
[-22, 58]
|
[-22, 58]
|
||||||
]])),
|
]])),
|
||||||
new _ol_Feature_(new _ol_geom_Polygon_([[
|
new _ol_Feature_(new Polygon([[
|
||||||
[-9, 58],
|
[-9, 58],
|
||||||
[-9, 78],
|
[-9, 78],
|
||||||
[4, 78],
|
[4, 78],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import LineString from '../../../src/ol/geom/LineString.js';
|
import LineString from '../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../src/ol/geom/Point.js';
|
import Point from '../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_ from '../../../src/ol/render.js';
|
import _ol_render_ from '../../../src/ol/render.js';
|
||||||
import _ol_render_VectorContext_ from '../../../src/ol/render/VectorContext.js';
|
import _ol_render_VectorContext_ from '../../../src/ol/render/VectorContext.js';
|
||||||
import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.js';
|
import _ol_render_canvas_Immediate_ from '../../../src/ol/render/canvas/Immediate.js';
|
||||||
@@ -143,7 +143,7 @@ describe('ol.render', function() {
|
|||||||
|
|
||||||
vectorContext.setStyle(style);
|
vectorContext.setStyle(style);
|
||||||
|
|
||||||
vectorContext.drawGeometry(new _ol_geom_Polygon_([
|
vectorContext.drawGeometry(new Polygon([
|
||||||
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
|
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
|
||||||
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
|
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
|
||||||
]));
|
]));
|
||||||
@@ -168,7 +168,7 @@ describe('ol.render', function() {
|
|||||||
|
|
||||||
vectorContext.setStyle(style);
|
vectorContext.setStyle(style);
|
||||||
|
|
||||||
vectorContext.drawGeometry(new _ol_geom_Polygon_([
|
vectorContext.drawGeometry(new Polygon([
|
||||||
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
|
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
|
||||||
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
|
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
|
||||||
]));
|
]));
|
||||||
@@ -194,7 +194,7 @@ describe('ol.render', function() {
|
|||||||
|
|
||||||
vectorContext.setStyle(style);
|
vectorContext.setStyle(style);
|
||||||
|
|
||||||
vectorContext.drawGeometry(new _ol_geom_Polygon_([
|
vectorContext.drawGeometry(new Polygon([
|
||||||
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
|
[[25, 25], [75, 25], [75, 75], [25, 75], [25, 25]],
|
||||||
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
|
[[40, 40], [40, 60], [60, 60], [60, 40], [40, 40]]
|
||||||
]));
|
]));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||||
import _ol_View_ from '../../../../src/ol/View.js';
|
import _ol_View_ from '../../../../src/ol/View.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
@@ -49,7 +49,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
var feature;
|
var feature;
|
||||||
// rectangle
|
// rectangle
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -60,7 +60,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with 1 hole
|
// rectangle with 1 hole
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]],
|
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]],
|
||||||
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
|
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with 2 holes
|
// rectangle with 2 holes
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]],
|
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]],
|
||||||
[[-18, -18], [-12, -18], [-12, -12], [-18, -12], [-18, -18]],
|
[[-18, -18], [-12, -18], [-12, -12], [-18, -12], [-18, -18]],
|
||||||
[[5, -18], [12, -18], [12, -12], [5, -12], [5, -18]]
|
[[5, -18], [12, -18], [12, -12], [5, -12], [5, -18]]
|
||||||
@@ -114,7 +114,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
var feature;
|
var feature;
|
||||||
// rectangle
|
// rectangle
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -125,7 +125,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with 1 hole
|
// rectangle with 1 hole
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[0, 10], [0, 20], [20, 20], [20, 10], [0, 10]],
|
[[0, 10], [0, 20], [20, 20], [20, 10], [0, 10]],
|
||||||
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
|
[[5, 13], [10, 13], [10, 17], [5, 17], [5, 13]]
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with 2 holes
|
// rectangle with 2 holes
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, -20], [-20, 5], [20, 5], [20, -20], [-20, -20]],
|
[[-20, -20], [-20, 5], [20, 5], [20, -20], [-20, -20]],
|
||||||
[[-12, -3], [-12, -12], [-8, -12], [-8, -3], [-12, -3]],
|
[[-12, -3], [-12, -12], [-8, -12], [-8, -3], [-12, -3]],
|
||||||
[[0, -12], [13, -12], [13, -3], [0, -3], [0, -12]]
|
[[0, -12], [13, -12], [13, -3], [0, -3], [0, -12]]
|
||||||
@@ -174,7 +174,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
var feature;
|
var feature;
|
||||||
// rectangle with z-index 2
|
// rectangle with z-index 2
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]]
|
[[-20, 10], [-20, 20], [-0, 20], [-0, 10], [-20, 10]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -186,7 +186,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with z-index 3
|
// rectangle with z-index 3
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]]
|
[[-15, 5], [-15, 15], [5, 15], [5, 5], [-15, 5]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -198,7 +198,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with z-index 1
|
// rectangle with z-index 1
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]]
|
[[-10, 0], [-10, 10], [10, 10], [10, 0], [-10, 0]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -231,7 +231,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
var feature;
|
var feature;
|
||||||
// rectangle
|
// rectangle
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
[[-20, 10], [-20, 20], [-5, 20], [-5, 10], [-20, 10]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -243,7 +243,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with 1 hole
|
// rectangle with 1 hole
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]]
|
[[0, 10], [0, 20], [15, 20], [15, 10], [0, 10]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -255,7 +255,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
// rectangle with 2 holes
|
// rectangle with 2 holes
|
||||||
feature = new _ol_Feature_({
|
feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]]
|
[[-20, -20], [-20, 5], [15, 5], [15, -20], [-20, -20]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
@@ -317,7 +317,7 @@ describe('ol.rendering.style.Polygon', function() {
|
|||||||
|
|
||||||
function createFeatures() {
|
function createFeatures() {
|
||||||
var feature = new _ol_Feature_({
|
var feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[-20, -20], [-20, 20], [18, 20], [-20, -20]]
|
[[-20, -20], [-20, 20], [18, 20], [-20, -20]]
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import LineString from '../../../../src/ol/geom/LineString.js';
|
|||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||||
import _ol_View_ from '../../../../src/ol/View.js';
|
import _ol_View_ from '../../../../src/ol/View.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
@@ -287,7 +287,7 @@ describe('ol.rendering.style.Text', function() {
|
|||||||
|
|
||||||
it('renders text along a Polygon', function(done) {
|
it('renders text along a Polygon', function(done) {
|
||||||
createMap('canvas');
|
createMap('canvas');
|
||||||
var geom = new _ol_geom_Polygon_(null);
|
var geom = new Polygon(null);
|
||||||
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
||||||
var feature = new _ol_Feature_(geom);
|
var feature = new _ol_Feature_(geom);
|
||||||
feature.setStyle(new _ol_style_Style_({
|
feature.setStyle(new _ol_style_Style_({
|
||||||
@@ -305,7 +305,7 @@ describe('ol.rendering.style.Text', function() {
|
|||||||
|
|
||||||
it('renders text along a MultiPolygon', function(done) {
|
it('renders text along a MultiPolygon', function(done) {
|
||||||
createMap('canvas');
|
createMap('canvas');
|
||||||
var geom = new _ol_geom_Polygon_(null);
|
var geom = new Polygon(null);
|
||||||
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
||||||
var multiPolygon = new _ol_geom_MultiPolygon_(null);
|
var multiPolygon = new _ol_geom_MultiPolygon_(null);
|
||||||
multiPolygon.appendPolygon(geom);
|
multiPolygon.appendPolygon(geom);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
var feature = format.readFeature(polygonEsriJSON);
|
var feature = format.readFeature(polygonEsriJSON);
|
||||||
expect(feature).to.be.an(_ol_Feature_);
|
expect(feature).to.be.an(_ol_Feature_);
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
expect(geometry).to.be.an(_ol_geom_Polygon_);
|
expect(geometry).to.be.an(Polygon);
|
||||||
expect(geometry.getCoordinates()).to.eql([[
|
expect(geometry.getCoordinates()).to.eql([[
|
||||||
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
||||||
]]);
|
]]);
|
||||||
@@ -229,7 +229,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
expect(features).to.have.length(3);
|
expect(features).to.have.length(3);
|
||||||
expect(features[0].getGeometry()).to.be.an(Point);
|
expect(features[0].getGeometry()).to.be.an(Point);
|
||||||
expect(features[1].getGeometry()).to.be.an(LineString);
|
expect(features[1].getGeometry()).to.be.an(LineString);
|
||||||
expect(features[2].getGeometry()).to.be.an(_ol_geom_Polygon_);
|
expect(features[2].getGeometry()).to.be.an(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can read and transform a point', function() {
|
it('can read and transform a point', function() {
|
||||||
@@ -304,7 +304,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
expect(first.get('field_name')).to.be('EUDORA');
|
expect(first.get('field_name')).to.be('EUDORA');
|
||||||
expect(first.getId()).to.be(6406);
|
expect(first.getId()).to.be(6406);
|
||||||
var firstGeom = first.getGeometry();
|
var firstGeom = first.getGeometry();
|
||||||
expect(firstGeom).to.be.a(_ol_geom_Polygon_);
|
expect(firstGeom).to.be.a(Polygon);
|
||||||
expect(_ol_extent_.equals(firstGeom.getExtent(), [
|
expect(_ol_extent_.equals(firstGeom.getExtent(), [
|
||||||
-10585772.743554419, 4712365.161160459,
|
-10585772.743554419, 4712365.161160459,
|
||||||
-10579560.16462974, 4716567.373073828
|
-10579560.16462974, 4716567.373073828
|
||||||
@@ -315,7 +315,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
expect(last.get('field_name')).to.be('FEAGINS');
|
expect(last.get('field_name')).to.be('FEAGINS');
|
||||||
expect(last.getId()).to.be(6030);
|
expect(last.getId()).to.be(6030);
|
||||||
var lastGeom = last.getGeometry();
|
var lastGeom = last.getGeometry();
|
||||||
expect(lastGeom).to.be.a(_ol_geom_Polygon_);
|
expect(lastGeom).to.be.a(Polygon);
|
||||||
expect(_ol_extent_.equals(lastGeom.getExtent(), [
|
expect(_ol_extent_.equals(lastGeom.getExtent(), [
|
||||||
-10555714.026858449, 4576511.565880965,
|
-10555714.026858449, 4576511.565880965,
|
||||||
-10553671.199322715, 4578554.9934867555
|
-10553671.199322715, 4578554.9934867555
|
||||||
@@ -558,7 +558,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
rings: [outer, inner1, inner2]
|
rings: [outer, inner1, inner2]
|
||||||
});
|
});
|
||||||
var obj = format.readGeometry(str);
|
var obj = format.readGeometry(str);
|
||||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
expect(obj).to.be.a(Polygon);
|
||||||
expect(obj.getLayout()).to.eql('XY');
|
expect(obj.getLayout()).to.eql('XY');
|
||||||
var rings = obj.getLinearRings();
|
var rings = obj.getLinearRings();
|
||||||
expect(rings.length).to.be(3);
|
expect(rings.length).to.be(3);
|
||||||
@@ -577,7 +577,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
hasZ: true
|
hasZ: true
|
||||||
});
|
});
|
||||||
var obj = format.readGeometry(str);
|
var obj = format.readGeometry(str);
|
||||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
expect(obj).to.be.a(Polygon);
|
||||||
expect(obj.getLayout()).to.eql('XYZ');
|
expect(obj.getLayout()).to.eql('XYZ');
|
||||||
var rings = obj.getLinearRings();
|
var rings = obj.getLinearRings();
|
||||||
expect(rings.length).to.be(3);
|
expect(rings.length).to.be(3);
|
||||||
@@ -596,7 +596,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
hasM: true
|
hasM: true
|
||||||
});
|
});
|
||||||
var obj = format.readGeometry(str);
|
var obj = format.readGeometry(str);
|
||||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
expect(obj).to.be.a(Polygon);
|
||||||
expect(obj.getLayout()).to.eql('XYM');
|
expect(obj.getLayout()).to.eql('XYM');
|
||||||
var rings = obj.getLinearRings();
|
var rings = obj.getLinearRings();
|
||||||
expect(rings.length).to.be(3);
|
expect(rings.length).to.be(3);
|
||||||
@@ -625,7 +625,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
hasM: true
|
hasM: true
|
||||||
});
|
});
|
||||||
var obj = format.readGeometry(str);
|
var obj = format.readGeometry(str);
|
||||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
expect(obj).to.be.a(Polygon);
|
||||||
expect(obj.getLayout()).to.eql('XYZM');
|
expect(obj.getLayout()).to.eql('XYZM');
|
||||||
var rings = obj.getLinearRings();
|
var rings = obj.getLinearRings();
|
||||||
expect(rings.length).to.be(3);
|
expect(rings.length).to.be(3);
|
||||||
@@ -826,7 +826,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||||
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||||
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
var polygon = new Polygon([outer, inner1, inner2]);
|
||||||
var esrijson = format.writeGeometry(polygon);
|
var esrijson = format.writeGeometry(polygon);
|
||||||
expect(polygon.getCoordinates(false)).to.eql(
|
expect(polygon.getCoordinates(false)).to.eql(
|
||||||
format.readGeometry(esrijson).getCoordinates());
|
format.readGeometry(esrijson).getCoordinates());
|
||||||
@@ -836,7 +836,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
|
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
|
||||||
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
|
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
|
||||||
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
|
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
|
||||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2],
|
var polygon = new Polygon([outer, inner1, inner2],
|
||||||
'XYZ');
|
'XYZ');
|
||||||
var esrijson = format.writeGeometry(polygon);
|
var esrijson = format.writeGeometry(polygon);
|
||||||
expect(polygon.getCoordinates(false)).to.eql(
|
expect(polygon.getCoordinates(false)).to.eql(
|
||||||
@@ -847,7 +847,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
|
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
|
||||||
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
|
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
|
||||||
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
|
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
|
||||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2],
|
var polygon = new Polygon([outer, inner1, inner2],
|
||||||
'XYM');
|
'XYM');
|
||||||
var esrijson = format.writeGeometry(polygon);
|
var esrijson = format.writeGeometry(polygon);
|
||||||
expect(polygon.getCoordinates(false)).to.eql(
|
expect(polygon.getCoordinates(false)).to.eql(
|
||||||
@@ -864,7 +864,7 @@ describe('ol.format.EsriJSON', function() {
|
|||||||
var inner2 = [
|
var inner2 = [
|
||||||
[8, 8, 2, 1], [9, 8, 2, 2], [9, 9, 2, 1], [8, 9, 2, 1], [8, 8, 2, 1]
|
[8, 8, 2, 1], [9, 8, 2, 2], [9, 9, 2, 1], [8, 9, 2, 1], [8, 8, 2, 1]
|
||||||
];
|
];
|
||||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2],
|
var polygon = new Polygon([outer, inner1, inner2],
|
||||||
'XYZM');
|
'XYZM');
|
||||||
var esrijson = format.writeGeometry(polygon);
|
var esrijson = format.writeGeometry(polygon);
|
||||||
expect(polygon.getCoordinates(false)).to.eql(
|
expect(polygon.getCoordinates(false)).to.eql(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import LineString from '../../../../src/ol/geom/LineString.js';
|
|||||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {fromLonLat, get as getProjection, toLonLat, transform} from '../../../../src/ol/proj.js';
|
import {fromLonLat, get as getProjection, toLonLat, transform} from '../../../../src/ol/proj.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
var feature = format.readFeature(polygonGeoJSON);
|
var feature = format.readFeature(polygonGeoJSON);
|
||||||
expect(feature).to.be.an(_ol_Feature_);
|
expect(feature).to.be.an(_ol_Feature_);
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
expect(geometry).to.be.an(_ol_geom_Polygon_);
|
expect(geometry).to.be.an(Polygon);
|
||||||
expect(geometry.getCoordinates()).to.eql([[
|
expect(geometry.getCoordinates()).to.eql([[
|
||||||
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
||||||
]]);
|
]]);
|
||||||
@@ -202,7 +202,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
expect(features).to.have.length(3);
|
expect(features).to.have.length(3);
|
||||||
expect(features[0].getGeometry()).to.be.an(Point);
|
expect(features[0].getGeometry()).to.be.an(Point);
|
||||||
expect(features[1].getGeometry()).to.be.an(LineString);
|
expect(features[1].getGeometry()).to.be.an(LineString);
|
||||||
expect(features[2].getGeometry()).to.be.an(_ol_geom_Polygon_);
|
expect(features[2].getGeometry()).to.be.an(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can read and transform a point', function() {
|
it('can read and transform a point', function() {
|
||||||
@@ -288,7 +288,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
expect(features).to.be.an(Array);
|
expect(features).to.be.an(Array);
|
||||||
expect(features).to.have.length(1);
|
expect(features).to.have.length(1);
|
||||||
var geometry = features[0].getGeometry();
|
var geometry = features[0].getGeometry();
|
||||||
expect(geometry).to.be.an(_ol_geom_Polygon_);
|
expect(geometry).to.be.an(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses countries.geojson', function(done) {
|
it('parses countries.geojson', function(done) {
|
||||||
@@ -301,7 +301,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
expect(first.get('name')).to.be('Afghanistan');
|
expect(first.get('name')).to.be('Afghanistan');
|
||||||
expect(first.getId()).to.be('AFG');
|
expect(first.getId()).to.be('AFG');
|
||||||
var firstGeom = first.getGeometry();
|
var firstGeom = first.getGeometry();
|
||||||
expect(firstGeom).to.be.a(_ol_geom_Polygon_);
|
expect(firstGeom).to.be.a(Polygon);
|
||||||
expect(_ol_extent_.equals(firstGeom.getExtent(),
|
expect(_ol_extent_.equals(firstGeom.getExtent(),
|
||||||
[60.52843, 29.318572, 75.158028, 38.486282]))
|
[60.52843, 29.318572, 75.158028, 38.486282]))
|
||||||
.to.be(true);
|
.to.be(true);
|
||||||
@@ -311,7 +311,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
expect(last.get('name')).to.be('Zimbabwe');
|
expect(last.get('name')).to.be('Zimbabwe');
|
||||||
expect(last.getId()).to.be('ZWE');
|
expect(last.getId()).to.be('ZWE');
|
||||||
var lastGeom = last.getGeometry();
|
var lastGeom = last.getGeometry();
|
||||||
expect(lastGeom).to.be.a(_ol_geom_Polygon_);
|
expect(lastGeom).to.be.a(Polygon);
|
||||||
expect(_ol_extent_.equals(lastGeom.getExtent(),
|
expect(_ol_extent_.equals(lastGeom.getExtent(),
|
||||||
[25.264226, -22.271612, 32.849861, -15.507787]))
|
[25.264226, -22.271612, 32.849861, -15.507787]))
|
||||||
.to.be(true);
|
.to.be(true);
|
||||||
@@ -395,7 +395,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var obj = format.readGeometry(str);
|
var obj = format.readGeometry(str);
|
||||||
expect(obj).to.be.a(_ol_geom_Polygon_);
|
expect(obj).to.be.a(Polygon);
|
||||||
expect(obj.getLayout()).to.eql('XY');
|
expect(obj.getLayout()).to.eql('XY');
|
||||||
var rings = obj.getLinearRings();
|
var rings = obj.getLinearRings();
|
||||||
expect(rings.length).to.be(3);
|
expect(rings.length).to.be(3);
|
||||||
@@ -622,7 +622,7 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||||
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||||
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||||
var polygon = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
var polygon = new Polygon([outer, inner1, inner2]);
|
||||||
var geojson = format.writeGeometry(polygon);
|
var geojson = format.writeGeometry(polygon);
|
||||||
expect(polygon.getCoordinates()).to.eql(
|
expect(polygon.getCoordinates()).to.eql(
|
||||||
format.readGeometry(geojson).getCoordinates());
|
format.readGeometry(geojson).getCoordinates());
|
||||||
@@ -633,9 +633,9 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||||
|
|
||||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
var right = new Polygon([ccw, cw]);
|
||||||
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
||||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
var left = new Polygon([cw, ccw]);
|
||||||
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
||||||
|
|
||||||
var rightObj = {
|
var rightObj = {
|
||||||
@@ -670,9 +670,9 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
|
|
||||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
var right = new Polygon([ccw, cw]);
|
||||||
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
||||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
var left = new Polygon([cw, ccw]);
|
||||||
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
||||||
|
|
||||||
var rightObj = {
|
var rightObj = {
|
||||||
@@ -701,9 +701,9 @@ describe('ol.format.GeoJSON', function() {
|
|||||||
|
|
||||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
var right = new Polygon([ccw, cw]);
|
||||||
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
var rightMulti = new _ol_geom_MultiPolygon_([[ccw, cw]]);
|
||||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
var left = new Polygon([cw, ccw]);
|
||||||
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
var leftMulti = new _ol_geom_MultiPolygon_([[cw, ccw]]);
|
||||||
|
|
||||||
var leftObj = {
|
var leftObj = {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {transform} from '../../../../src/ol/proj.js';
|
import {transform} from '../../../../src/ol/proj.js';
|
||||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ describe('ol.format.GML2', function() {
|
|||||||
' </layer>';
|
' </layer>';
|
||||||
|
|
||||||
var feature = new _ol_Feature_({
|
var feature = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([[[1.1, 2], [3, 4.2], [5.2, 6]]])
|
geometry: new Polygon([[[1.1, 2], [3, 4.2], [5.2, 6]]])
|
||||||
});
|
});
|
||||||
feature.setId(1);
|
feature.setId(1);
|
||||||
var objectStack = [{
|
var objectStack = [{
|
||||||
@@ -610,7 +610,7 @@ describe('ol.format.GML3', function() {
|
|||||||
' </gml:interior>' +
|
' </gml:interior>' +
|
||||||
'</gml:Polygon>';
|
'</gml:Polygon>';
|
||||||
var g = readGeometry(format, text);
|
var g = readGeometry(format, text);
|
||||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
expect(g).to.be.an(Polygon);
|
||||||
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||||
@@ -653,7 +653,7 @@ describe('ol.format.GML3', function() {
|
|||||||
' </gml:patches>' +
|
' </gml:patches>' +
|
||||||
'</gml:Surface>';
|
'</gml:Surface>';
|
||||||
var g = readGeometry(format, text);
|
var g = readGeometry(format, text);
|
||||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
expect(g).to.be.an(Polygon);
|
||||||
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
expect(g.getCoordinates()).to.eql([[[1, 2, 0], [3, 2, 0], [3, 4, 0],
|
||||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||||
@@ -1528,7 +1528,7 @@ describe('ol.format.GML3', function() {
|
|||||||
it('creates a Polygon', function() {
|
it('creates a Polygon', function() {
|
||||||
feature = features[1];
|
feature = features[1];
|
||||||
expect(feature.getId()).to.equal('geoserver_layer.2');
|
expect(feature.getId()).to.equal('geoserver_layer.2');
|
||||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Polygon_);
|
expect(feature.getGeometry()).to.be.an(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates a Point', function() {
|
it('creates a Point', function() {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _ol_format_GPX_ from '../../../../src/ol/format/GPX.js';
|
|||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||||
|
|
||||||
@@ -661,7 +661,7 @@ describe('ol.format.GPX', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does not fail', function() {
|
it('does not fail', function() {
|
||||||
var polygon = new _ol_geom_Polygon_(
|
var polygon = new Polygon(
|
||||||
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
|
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
|
||||||
var feature = new _ol_Feature_(polygon);
|
var feature = new _ol_Feature_(polygon);
|
||||||
var features = [feature];
|
var features = [feature];
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {addProjection, addCoordinateTransforms, transform, get as getProjection} from '../../../../src/ol/proj.js';
|
import {addProjection, addCoordinateTransforms, transform, get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||||
import _ol_proj_transforms_ from '../../../../src/ol/proj/transforms.js';
|
import _ol_proj_transforms_ from '../../../../src/ol/proj/transforms.js';
|
||||||
@@ -553,7 +553,7 @@ describe('ol.format.KML', function() {
|
|||||||
var f = fs[0];
|
var f = fs[0];
|
||||||
expect(f).to.be.an(_ol_Feature_);
|
expect(f).to.be.an(_ol_Feature_);
|
||||||
var g = f.getGeometry();
|
var g = f.getGeometry();
|
||||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
expect(g).to.be.an(Polygon);
|
||||||
expect(g.getCoordinates()).to.eql([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]);
|
expect(g.getCoordinates()).to.eql([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -661,7 +661,7 @@ describe('ol.format.KML', function() {
|
|||||||
var f = fs[0];
|
var f = fs[0];
|
||||||
expect(f).to.be.an(_ol_Feature_);
|
expect(f).to.be.an(_ol_Feature_);
|
||||||
var g = f.getGeometry();
|
var g = f.getGeometry();
|
||||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
expect(g).to.be.an(Polygon);
|
||||||
expect(g.getCoordinates()).to.eql(
|
expect(g.getCoordinates()).to.eql(
|
||||||
[[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]]]);
|
[[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]]]);
|
||||||
expect(g.get('extrude')).to.be(false);
|
expect(g.get('extrude')).to.be(false);
|
||||||
@@ -670,7 +670,7 @@ describe('ol.format.KML', function() {
|
|||||||
|
|
||||||
it('can write XY Polygon geometries', function() {
|
it('can write XY Polygon geometries', function() {
|
||||||
var layout = 'XY';
|
var layout = 'XY';
|
||||||
var polygon = new _ol_geom_Polygon_(
|
var polygon = new Polygon(
|
||||||
[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]], layout);
|
[[[0, 0], [0, 2], [2, 2], [2, 0], [0, 0]]], layout);
|
||||||
var features = [new _ol_Feature_(polygon)];
|
var features = [new _ol_Feature_(polygon)];
|
||||||
var node = format.writeFeaturesNode(features);
|
var node = format.writeFeaturesNode(features);
|
||||||
@@ -695,7 +695,7 @@ describe('ol.format.KML', function() {
|
|||||||
|
|
||||||
it('can write XYZ Polygon geometries', function() {
|
it('can write XYZ Polygon geometries', function() {
|
||||||
var layout = 'XYZ';
|
var layout = 'XYZ';
|
||||||
var polygon = new _ol_geom_Polygon_(
|
var polygon = new Polygon(
|
||||||
[[[0, 0, 1], [0, 2, 2], [2, 2, 3], [2, 0, 4], [0, 0, 5]]], layout);
|
[[[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 _ol_Feature_(polygon)];
|
||||||
var node = format.writeFeaturesNode(features);
|
var node = format.writeFeaturesNode(features);
|
||||||
@@ -722,7 +722,7 @@ describe('ol.format.KML', function() {
|
|||||||
|
|
||||||
it('can write XYM Polygon geometries', function() {
|
it('can write XYM Polygon geometries', function() {
|
||||||
var layout = 'XYM';
|
var layout = 'XYM';
|
||||||
var polygon = new _ol_geom_Polygon_(
|
var polygon = new Polygon(
|
||||||
[[[0, 0, 1], [0, 2, 1], [2, 2, 1], [2, 0, 1], [0, 0, 1]]], layout);
|
[[[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 _ol_Feature_(polygon)];
|
||||||
var node = format.writeFeaturesNode(features);
|
var node = format.writeFeaturesNode(features);
|
||||||
@@ -749,7 +749,7 @@ describe('ol.format.KML', function() {
|
|||||||
|
|
||||||
it('can write XYZM Polygon geometries', function() {
|
it('can write XYZM Polygon geometries', function() {
|
||||||
var layout = 'XYZM';
|
var layout = 'XYZM';
|
||||||
var polygon = new _ol_geom_Polygon_([
|
var polygon = new Polygon([
|
||||||
[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1], [2, 0, 4, 1], [0, 0, 5, 1]]
|
[[0, 0, 1, 1], [0, 2, 2, 1], [2, 2, 3, 1], [2, 0, 4, 1], [0, 0, 5, 1]]
|
||||||
], layout);
|
], layout);
|
||||||
var features = [new _ol_Feature_(polygon)];
|
var features = [new _ol_Feature_(polygon)];
|
||||||
@@ -801,7 +801,7 @@ describe('ol.format.KML', function() {
|
|||||||
var f = fs[0];
|
var f = fs[0];
|
||||||
expect(f).to.be.an(_ol_Feature_);
|
expect(f).to.be.an(_ol_Feature_);
|
||||||
var g = f.getGeometry();
|
var g = f.getGeometry();
|
||||||
expect(g).to.be.an(_ol_geom_Polygon_);
|
expect(g).to.be.an(Polygon);
|
||||||
expect(g.getCoordinates()).to.eql([
|
expect(g.getCoordinates()).to.eql([
|
||||||
[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
||||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||||
@@ -811,7 +811,7 @@ describe('ol.format.KML', function() {
|
|||||||
|
|
||||||
it('can write complex Polygon geometries', function() {
|
it('can write complex Polygon geometries', function() {
|
||||||
var layout = 'XYZ';
|
var layout = 'XYZ';
|
||||||
var polygon = new _ol_geom_Polygon_([
|
var polygon = new Polygon([
|
||||||
[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
[[0, 0, 1], [0, 5, 1], [5, 5, 2], [5, 0, 3]],
|
||||||
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
[[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]],
|
||||||
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]
|
[[3, 3, 0], [3, 4, 0], [4, 4, 0], [4, 3, 0]]
|
||||||
@@ -1182,8 +1182,8 @@ describe('ol.format.KML', function() {
|
|||||||
expect(gs).to.have.length(4);
|
expect(gs).to.have.length(4);
|
||||||
expect(gs[0]).to.be.an(Point);
|
expect(gs[0]).to.be.an(Point);
|
||||||
expect(gs[1]).to.be.an(LineString);
|
expect(gs[1]).to.be.an(LineString);
|
||||||
expect(gs[2]).to.be.an(_ol_geom_Polygon_);
|
expect(gs[2]).to.be.an(Polygon);
|
||||||
expect(gs[3]).to.be.an(_ol_geom_Polygon_);
|
expect(gs[3]).to.be.an(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can read nested GeometryCollection geometries', function() {
|
it('can read nested GeometryCollection geometries', function() {
|
||||||
@@ -1211,7 +1211,7 @@ describe('ol.format.KML', function() {
|
|||||||
var collection = new _ol_geom_GeometryCollection_([
|
var collection = new _ol_geom_GeometryCollection_([
|
||||||
new Point([1, 2]),
|
new Point([1, 2]),
|
||||||
new LineString([[1, 2], [3, 4]]),
|
new LineString([[1, 2], [3, 4]]),
|
||||||
new _ol_geom_Polygon_([[[1, 2], [3, 4], [3, 2], [1, 2]]])
|
new Polygon([[[1, 2], [3, 4], [3, 2], [1, 2]]])
|
||||||
]);
|
]);
|
||||||
var features = [new _ol_Feature_(collection)];
|
var features = [new _ol_Feature_(collection)];
|
||||||
var node = format.writeFeaturesNode(features);
|
var node = format.writeFeaturesNode(features);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
|||||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||||
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js';
|
import _ol_format_MVT_ from '../../../../src/ol/format/MVT.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js';
|
import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js';
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ describe('ol.format.MVT', function() {
|
|||||||
var feature = format.createFeature_({}, rawFeature);
|
var feature = format.createFeature_({}, rawFeature);
|
||||||
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_;
|
_ol_format_MVT_.readRawGeometry_ = readRawGeometry_;
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('detects a MultiPolygon', function() {
|
it('detects a MultiPolygon', function() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_format_Feature_ from '../../../../src/ol/format/Feature.js';
|
import _ol_format_Feature_ from '../../../../src/ol/format/Feature.js';
|
||||||
import {transform} from '../../../../src/ol/proj.js';
|
import {transform} from '../../../../src/ol/proj.js';
|
||||||
import _ol_format_TopoJSON_ from '../../../../src/ol/format/TopoJSON.js';
|
import _ol_format_TopoJSON_ from '../../../../src/ol/format/TopoJSON.js';
|
||||||
@@ -62,7 +62,7 @@ describe('ol.format.TopoJSON', function() {
|
|||||||
expect(feature).to.be.a(_ol_Feature_);
|
expect(feature).to.be.a(_ol_Feature_);
|
||||||
|
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
|
|
||||||
// Parses identifier
|
// Parses identifier
|
||||||
expect(feature.getId()).to.be(533);
|
expect(feature.getId()).to.be(533);
|
||||||
@@ -164,7 +164,7 @@ describe('ol.format.TopoJSON', function() {
|
|||||||
var last = features[177];
|
var last = features[177];
|
||||||
expect(last).to.be.a(_ol_Feature_);
|
expect(last).to.be.a(_ol_Feature_);
|
||||||
var lastGeom = last.getGeometry();
|
var lastGeom = last.getGeometry();
|
||||||
expect(lastGeom).to.be.a(_ol_geom_Polygon_);
|
expect(lastGeom).to.be.a(Polygon);
|
||||||
expect(lastGeom.getExtent()).to.eql([
|
expect(lastGeom.getExtent()).to.eql([
|
||||||
25.26325263252633, -22.271802279310577,
|
25.26325263252633, -22.271802279310577,
|
||||||
32.848528485284874, -15.50833810039586
|
32.848528485284874, -15.50833810039586
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import LineString from '../../../../src/ol/geom/LineString.js';
|
|||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {transform} from '../../../../src/ol/proj.js';
|
import {transform} from '../../../../src/ol/proj.js';
|
||||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||||
|
|
||||||
@@ -551,7 +551,7 @@ describe('ol.format.WFS', function() {
|
|||||||
featureTypes: ['area'],
|
featureTypes: ['area'],
|
||||||
filter: _ol_format_filter_.contains(
|
filter: _ol_format_filter_.contains(
|
||||||
'the_geom',
|
'the_geom',
|
||||||
new _ol_geom_Polygon_([[
|
new Polygon([[
|
||||||
[10, 20],
|
[10, 20],
|
||||||
[10, 25],
|
[10, 25],
|
||||||
[15, 25],
|
[15, 25],
|
||||||
@@ -588,7 +588,7 @@ describe('ol.format.WFS', function() {
|
|||||||
featureTypes: ['area'],
|
featureTypes: ['area'],
|
||||||
filter: _ol_format_filter_.intersects(
|
filter: _ol_format_filter_.intersects(
|
||||||
'the_geom',
|
'the_geom',
|
||||||
new _ol_geom_Polygon_([[
|
new Polygon([[
|
||||||
[10, 20],
|
[10, 20],
|
||||||
[10, 25],
|
[10, 25],
|
||||||
[15, 25],
|
[15, 25],
|
||||||
@@ -625,7 +625,7 @@ describe('ol.format.WFS', function() {
|
|||||||
featureTypes: ['area'],
|
featureTypes: ['area'],
|
||||||
filter: _ol_format_filter_.within(
|
filter: _ol_format_filter_.within(
|
||||||
'the_geom',
|
'the_geom',
|
||||||
new _ol_geom_Polygon_([[
|
new Polygon([[
|
||||||
[10, 20],
|
[10, 20],
|
||||||
[10, 25],
|
[10, 25],
|
||||||
[15, 25],
|
[15, 25],
|
||||||
@@ -1138,7 +1138,7 @@ describe('ol.format.WFS', function() {
|
|||||||
var fid = 'Historische_Messtischblaetter_WFS.71055885';
|
var fid = 'Historische_Messtischblaetter_WFS.71055885';
|
||||||
expect(feature.getId()).to.equal(fid);
|
expect(feature.getId()).to.equal(fid);
|
||||||
expect(feature.get('titel')).to.equal('Arnstadt');
|
expect(feature.get('titel')).to.equal('Arnstadt');
|
||||||
expect(feature.getGeometry()).to.be.an(_ol_geom_Polygon_);
|
expect(feature.getGeometry()).to.be.an(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ol_geom_Geometry_ from '../../../../src/ol/geom/Geometry.js';
|
|||||||
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js';
|
import _ol_geom_GeometryCollection_ from '../../../../src/ol/geom/GeometryCollection.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
|
|
||||||
describe('ol.geom.GeometryCollection', function() {
|
describe('ol.geom.GeometryCollection', function() {
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ describe('ol.geom.GeometryCollection', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
point = new Point([10, 20]);
|
point = new Point([10, 20]);
|
||||||
line = new LineString([[10, 20], [30, 40]]);
|
line = new LineString([[10, 20], [30, 40]]);
|
||||||
poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
poly = new Polygon([outer, inner1, inner2]);
|
||||||
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ describe('ol.geom.GeometryCollection', function() {
|
|||||||
it('returns a collection of geometries', function() {
|
it('returns a collection of geometries', function() {
|
||||||
var point = new Point([10, 20]);
|
var point = new Point([10, 20]);
|
||||||
var line = new LineString([[10, 20], [30, 40]]);
|
var line = new LineString([[10, 20], [30, 40]]);
|
||||||
var poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
var poly = new Polygon([outer, inner1, inner2]);
|
||||||
var multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
var multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||||
|
|
||||||
var geometries = multi.getGeometries();
|
var geometries = multi.getGeometries();
|
||||||
@@ -66,7 +66,7 @@ describe('ol.geom.GeometryCollection', function() {
|
|||||||
expect(geometries).to.have.length(3);
|
expect(geometries).to.have.length(3);
|
||||||
expect(geometries[0]).to.be.a(Point);
|
expect(geometries[0]).to.be.a(Point);
|
||||||
expect(geometries[1]).to.be.a(LineString);
|
expect(geometries[1]).to.be.a(LineString);
|
||||||
expect(geometries[2]).to.be.a(_ol_geom_Polygon_);
|
expect(geometries[2]).to.be.a(Polygon);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -76,7 +76,7 @@ describe('ol.geom.GeometryCollection', function() {
|
|||||||
it('has a working clone method', function() {
|
it('has a working clone method', function() {
|
||||||
var point = new Point([10, 20]);
|
var point = new Point([10, 20]);
|
||||||
var line = new LineString([[10, 20], [30, 40]]);
|
var line = new LineString([[10, 20], [30, 40]]);
|
||||||
var poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
var poly = new Polygon([outer, inner1, inner2]);
|
||||||
var multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
var multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||||
var clone = multi.clone();
|
var clone = multi.clone();
|
||||||
expect(clone).to.not.be(multi);
|
expect(clone).to.not.be(multi);
|
||||||
@@ -124,7 +124,7 @@ describe('ol.geom.GeometryCollection', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
point = new Point([5, 20]);
|
point = new Point([5, 20]);
|
||||||
line = new LineString([[10, 20], [30, 40]]);
|
line = new LineString([[10, 20], [30, 40]]);
|
||||||
poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
poly = new Polygon([outer, inner1, inner2]);
|
||||||
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ describe('ol.geom.GeometryCollection', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
point = new Point([10, 20]);
|
point = new Point([10, 20]);
|
||||||
line = new LineString([[10, 20], [30, 40]]);
|
line = new LineString([[10, 20], [30, 40]]);
|
||||||
poly = new _ol_geom_Polygon_([outer, inner1, inner2]);
|
poly = new Polygon([outer, inner1, inner2]);
|
||||||
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
multi = new _ol_geom_GeometryCollection_([point, line, poly]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.geom.MultiPolygon', function() {
|
describe('ol.geom.MultiPolygon', function() {
|
||||||
@@ -19,11 +19,11 @@ describe('ol.geom.MultiPolygon', function() {
|
|||||||
|
|
||||||
it('can append polygons', function() {
|
it('can append polygons', function() {
|
||||||
multiPolygon.appendPolygon(
|
multiPolygon.appendPolygon(
|
||||||
new _ol_geom_Polygon_([[[0, 0], [0, 2], [1, 1], [2, 0]]]));
|
new Polygon([[[0, 0], [0, 2], [1, 1], [2, 0]]]));
|
||||||
expect(multiPolygon.getCoordinates()).to.eql(
|
expect(multiPolygon.getCoordinates()).to.eql(
|
||||||
[[[[0, 0], [0, 2], [1, 1], [2, 0]]]]);
|
[[[[0, 0], [0, 2], [1, 1], [2, 0]]]]);
|
||||||
multiPolygon.appendPolygon(
|
multiPolygon.appendPolygon(
|
||||||
new _ol_geom_Polygon_([[[3, 0], [4, 1], [5, 2], [5, 0]]]));
|
new Polygon([[[3, 0], [4, 1], [5, 2], [5, 0]]]));
|
||||||
expect(multiPolygon.getCoordinates()).to.eql([
|
expect(multiPolygon.getCoordinates()).to.eql([
|
||||||
[[[0, 0], [0, 2], [1, 1], [2, 0]]],
|
[[[0, 0], [0, 2], [1, 1], [2, 0]]],
|
||||||
[[[3, 0], [4, 1], [5, 2], [5, 0]]]
|
[[[3, 0], [4, 1], [5, 2], [5, 0]]]
|
||||||
@@ -42,11 +42,11 @@ describe('ol.geom.MultiPolygon', function() {
|
|||||||
|
|
||||||
it('can append polygons', function() {
|
it('can append polygons', function() {
|
||||||
multiPolygon.appendPolygon(
|
multiPolygon.appendPolygon(
|
||||||
new _ol_geom_Polygon_([[[0, 0], [0, 2], [1, 1], [2, 0]]]));
|
new Polygon([[[0, 0], [0, 2], [1, 1], [2, 0]]]));
|
||||||
expect(multiPolygon.getCoordinates()).to.eql(
|
expect(multiPolygon.getCoordinates()).to.eql(
|
||||||
[[[[0, 0], [0, 2], [1, 1], [2, 0]]]]);
|
[[[[0, 0], [0, 2], [1, 1], [2, 0]]]]);
|
||||||
multiPolygon.appendPolygon(
|
multiPolygon.appendPolygon(
|
||||||
new _ol_geom_Polygon_([[[3, 0], [4, 1], [5, 2], [5, 0]]]));
|
new Polygon([[[3, 0], [4, 1], [5, 2], [5, 0]]]));
|
||||||
expect(multiPolygon.getCoordinates()).to.eql([
|
expect(multiPolygon.getCoordinates()).to.eql([
|
||||||
[[[0, 0], [0, 2], [1, 1], [2, 0]]],
|
[[[0, 0], [0, 2], [1, 1], [2, 0]]],
|
||||||
[[[3, 0], [4, 1], [5, 2], [5, 0]]]
|
[[[3, 0], [4, 1], [5, 2], [5, 0]]]
|
||||||
@@ -99,11 +99,11 @@ describe('ol.geom.MultiPolygon', function() {
|
|||||||
|
|
||||||
it('can return individual polygons', function() {
|
it('can return individual polygons', function() {
|
||||||
var polygon0 = multiPolygon.getPolygon(0);
|
var polygon0 = multiPolygon.getPolygon(0);
|
||||||
expect(polygon0).to.be.an(_ol_geom_Polygon_);
|
expect(polygon0).to.be.an(Polygon);
|
||||||
expect(polygon0.getCoordinates()).to.eql(
|
expect(polygon0.getCoordinates()).to.eql(
|
||||||
[[[0, 0], [0, 2], [1, 1], [2, 0]]]);
|
[[[0, 0], [0, 2], [1, 1], [2, 0]]]);
|
||||||
var polygon1 = multiPolygon.getPolygon(1);
|
var polygon1 = multiPolygon.getPolygon(1);
|
||||||
expect(polygon1).to.be.an(_ol_geom_Polygon_);
|
expect(polygon1).to.be.an(Polygon);
|
||||||
expect(polygon1.getCoordinates()).to.eql(
|
expect(polygon1.getCoordinates()).to.eql(
|
||||||
[[[3, 0], [4, 1], [5, 2], [5, 0]]]);
|
[[[3, 0], [4, 1], [5, 2], [5, 0]]]);
|
||||||
});
|
});
|
||||||
@@ -112,10 +112,10 @@ describe('ol.geom.MultiPolygon', function() {
|
|||||||
var polygons = multiPolygon.getPolygons();
|
var polygons = multiPolygon.getPolygons();
|
||||||
expect(polygons).to.be.an(Array);
|
expect(polygons).to.be.an(Array);
|
||||||
expect(polygons).to.have.length(2);
|
expect(polygons).to.have.length(2);
|
||||||
expect(polygons[0]).to.be.an(_ol_geom_Polygon_);
|
expect(polygons[0]).to.be.an(Polygon);
|
||||||
expect(polygons[0].getCoordinates()).to.eql(
|
expect(polygons[0].getCoordinates()).to.eql(
|
||||||
[[[0, 0], [0, 2], [1, 1], [2, 0]]]);
|
[[[0, 0], [0, 2], [1, 1], [2, 0]]]);
|
||||||
expect(polygons[1]).to.be.an(_ol_geom_Polygon_);
|
expect(polygons[1]).to.be.an(Polygon);
|
||||||
expect(polygons[1].getCoordinates()).to.eql(
|
expect(polygons[1].getCoordinates()).to.eql(
|
||||||
[[[3, 0], [4, 1], [5, 2], [5, 0]]]);
|
[[[3, 0], [4, 1], [5, 2], [5, 0]]]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||||
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
||||||
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
import _ol_geom_LinearRing_ from '../../../../src/ol/geom/LinearRing.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
|
|
||||||
|
|
||||||
describe('ol.geom.Polygon', function() {
|
describe('ol.geom.Polygon', function() {
|
||||||
|
|
||||||
it('can be constructed with a null geometry', function() {
|
it('can be constructed with a null geometry', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
return new _ol_geom_Polygon_(null);
|
return new Polygon(null);
|
||||||
}).not.to.throwException();
|
}).not.to.throwException();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
var polygon;
|
var polygon;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
polygon = new _ol_geom_Polygon_([]);
|
polygon = new Polygon([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('defaults to layout XY', function() {
|
it('defaults to layout XY', function() {
|
||||||
@@ -59,7 +59,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
outerRing = [[0, 1], [1, 4], [4, 3], [3, 0]];
|
outerRing = [[0, 1], [1, 4], [4, 3], [3, 0]];
|
||||||
innerRing = [[2, 2], [3, 2], [3, 3], [2, 3]];
|
innerRing = [[2, 2], [3, 2], [3, 3], [2, 3]];
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0, 2, 2, 3, 2, 3, 3, 2, 3];
|
flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0, 2, 2, 3, 2, 3, 3, 2, 3];
|
||||||
outsideOuter = [0, 4];
|
outsideOuter = [0, 4];
|
||||||
inside = [1.5, 1.5];
|
inside = [1.5, 1.5];
|
||||||
@@ -104,7 +104,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
it('does not reverse any rings', function() {
|
it('does not reverse any rings', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
var coordinates = polygon.getCoordinates();
|
var coordinates = polygon.getCoordinates();
|
||||||
expect(coordinates[0]).to.eql(outerRing);
|
expect(coordinates[0]).to.eql(outerRing);
|
||||||
expect(coordinates[1]).to.eql(innerRing);
|
expect(coordinates[1]).to.eql(innerRing);
|
||||||
@@ -126,8 +126,8 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||||
var right = new _ol_geom_Polygon_([ccw, cw]);
|
var right = new Polygon([ccw, cw]);
|
||||||
var left = new _ol_geom_Polygon_([cw, ccw]);
|
var left = new Polygon([cw, ccw]);
|
||||||
|
|
||||||
it('returns coordinates as they were constructed', function() {
|
it('returns coordinates as they were constructed', function() {
|
||||||
expect(right.getCoordinates()).to.eql([ccw, cw]);
|
expect(right.getCoordinates()).to.eql([ccw, cw]);
|
||||||
@@ -150,20 +150,20 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('reverses the outer ring if necessary', function() {
|
it('reverses the outer ring if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses inner rings if necessary', function() {
|
it('reverses inner rings if necessary', function() {
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses all rings if necessary', function() {
|
it('reverses all rings if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
outerRing = [[0, 0, 1], [4, 4, 2], [4, 0, 3]];
|
outerRing = [[0, 0, 1], [4, 4, 2], [4, 0, 3]];
|
||||||
innerRing = [[2, 1, 4], [3, 1, 5], [3, 2, 6]];
|
innerRing = [[2, 1, 4], [3, 1, 5], [3, 2, 6]];
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
flatCoordinates = [0, 0, 1, 4, 4, 2, 4, 0, 3, 2, 1, 4, 3, 1, 5, 3, 2, 6];
|
flatCoordinates = [0, 0, 1, 4, 4, 2, 4, 0, 3, 2, 1, 4, 3, 1, 5, 3, 2, 6];
|
||||||
outsideOuter = [1, 3];
|
outsideOuter = [1, 3];
|
||||||
inside = [3.5, 0.5];
|
inside = [3.5, 0.5];
|
||||||
@@ -248,20 +248,20 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('reverses the outer ring if necessary', function() {
|
it('reverses the outer ring if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses inner rings if necessary', function() {
|
it('reverses inner rings if necessary', function() {
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses all rings if necessary', function() {
|
it('reverses all rings if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
outerRing = [[0, 0, 1], [4, 4, 2], [4, 0, 3]];
|
outerRing = [[0, 0, 1], [4, 4, 2], [4, 0, 3]];
|
||||||
innerRing = [[2, 1, 4], [3, 1, 5], [3, 2, 6]];
|
innerRing = [[2, 1, 4], [3, 1, 5], [3, 2, 6]];
|
||||||
polygon = new _ol_geom_Polygon_(
|
polygon = new Polygon(
|
||||||
[outerRing, innerRing], 'XYM');
|
[outerRing, innerRing], 'XYM');
|
||||||
flatCoordinates = [0, 0, 1, 4, 4, 2, 4, 0, 3, 2, 1, 4, 3, 1, 5, 3, 2, 6];
|
flatCoordinates = [0, 0, 1, 4, 4, 2, 4, 0, 3, 2, 1, 4, 3, 1, 5, 3, 2, 6];
|
||||||
outsideOuter = [1, 3];
|
outsideOuter = [1, 3];
|
||||||
@@ -347,20 +347,20 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('reverses the outer ring if necessary', function() {
|
it('reverses the outer ring if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses inner rings if necessary', function() {
|
it('reverses inner rings if necessary', function() {
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses all rings if necessary', function() {
|
it('reverses all rings if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
innerRing.reverse();
|
innerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing]);
|
polygon = new Polygon([outerRing, innerRing]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
innerRing1 =
|
innerRing1 =
|
||||||
[[2, 4, 7, 8], [4, 4, 9, 10], [4, 5, 11, 12], [2, 5, 13, 14]];
|
[[2, 4, 7, 8], [4, 4, 9, 10], [4, 5, 11, 12], [2, 5, 13, 14]];
|
||||||
innerRing2 = [[3, 2, 15, 16], [4, 3, 17, 18], [2, 3, 19, 20]];
|
innerRing2 = [[3, 2, 15, 16], [4, 3, 17, 18], [2, 3, 19, 20]];
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing1, innerRing2]);
|
polygon = new Polygon([outerRing, innerRing1, innerRing2]);
|
||||||
flatCoordinates = [
|
flatCoordinates = [
|
||||||
0, 6, 1, 2, 6, 6, 3, 4, 3, 0, 5, 6,
|
0, 6, 1, 2, 6, 6, 3, 4, 3, 0, 5, 6,
|
||||||
2, 4, 7, 8, 4, 4, 9, 10, 4, 5, 11, 12, 2, 5, 13, 14,
|
2, 4, 7, 8, 4, 4, 9, 10, 4, 5, 11, 12, 2, 5, 13, 14,
|
||||||
@@ -456,14 +456,14 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('reverses the outer ring if necessary', function() {
|
it('reverses the outer ring if necessary', function() {
|
||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing1, innerRing2]);
|
polygon = new Polygon([outerRing, innerRing1, innerRing2]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reverses inner rings if necessary', function() {
|
it('reverses inner rings if necessary', function() {
|
||||||
innerRing1.reverse();
|
innerRing1.reverse();
|
||||||
innerRing2.reverse();
|
innerRing2.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing1, innerRing2]);
|
polygon = new Polygon([outerRing, innerRing1, innerRing2]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
outerRing.reverse();
|
outerRing.reverse();
|
||||||
innerRing1.reverse();
|
innerRing1.reverse();
|
||||||
innerRing2.reverse();
|
innerRing2.reverse();
|
||||||
polygon = new _ol_geom_Polygon_([outerRing, innerRing1, innerRing2]);
|
polygon = new Polygon([outerRing, innerRing1, innerRing2]);
|
||||||
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
expect(polygon.getOrientedFlatCoordinates()).to.eql(flatCoordinates);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
var polygon;
|
var polygon;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
polygon = new _ol_geom_Polygon_(
|
polygon = new Polygon(
|
||||||
[[[3, 0], [1, 3], [0, 6], [2, 6], [3, 7], [4, 6], [6, 6], [4, 3]]]);
|
[[[3, 0], [1, 3], [0, 6], [2, 6], [3, 7], [4, 6], [6, 6], [4, 3]]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('returns the expected result', function() {
|
it('returns the expected result', function() {
|
||||||
var simplifiedGeometry = polygon.getSimplifiedGeometry(9);
|
var simplifiedGeometry = polygon.getSimplifiedGeometry(9);
|
||||||
expect(simplifiedGeometry).to.be.an(_ol_geom_Polygon_);
|
expect(simplifiedGeometry).to.be.an(Polygon);
|
||||||
expect(simplifiedGeometry.getCoordinates()).to.eql(
|
expect(simplifiedGeometry.getCoordinates()).to.eql(
|
||||||
[[[3, 0], [0, 3], [0, 6], [6, 6], [3, 3]]]);
|
[[[3, 0], [0, 3], [0, 6], [6, 6], [3, 3]]]);
|
||||||
});
|
});
|
||||||
@@ -511,7 +511,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
describe('#scale()', function() {
|
describe('#scale()', function() {
|
||||||
|
|
||||||
it('scales a polygon', function() {
|
it('scales a polygon', function() {
|
||||||
var geom = new _ol_geom_Polygon_([
|
var geom = new Polygon([
|
||||||
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
|
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
|
||||||
]);
|
]);
|
||||||
geom.scale(10);
|
geom.scale(10);
|
||||||
@@ -520,7 +520,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts sx and sy', function() {
|
it('accepts sx and sy', function() {
|
||||||
var geom = new _ol_geom_Polygon_([
|
var geom = new Polygon([
|
||||||
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
|
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
|
||||||
]);
|
]);
|
||||||
geom.scale(2, 3);
|
geom.scale(2, 3);
|
||||||
@@ -529,7 +529,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('accepts an anchor', function() {
|
it('accepts an anchor', function() {
|
||||||
var geom = new _ol_geom_Polygon_([
|
var geom = new Polygon([
|
||||||
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
|
[[-1, -2], [1, -2], [1, 2], [-1, 2], [-1, -2]]
|
||||||
]);
|
]);
|
||||||
geom.scale(3, 2, [-1, -2]);
|
geom.scale(3, 2, [-1, -2]);
|
||||||
@@ -542,7 +542,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
describe('#getInteriorPoint', function() {
|
describe('#getInteriorPoint', function() {
|
||||||
|
|
||||||
it('returns XYM point with intersection width as M', function() {
|
it('returns XYM point with intersection width as M', function() {
|
||||||
var geom = new _ol_geom_Polygon_([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
|
var geom = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
|
||||||
var interiorPoint = geom.getInteriorPoint();
|
var interiorPoint = geom.getInteriorPoint();
|
||||||
expect(interiorPoint.getType()).to.be('Point');
|
expect(interiorPoint.getType()).to.be('Point');
|
||||||
expect(interiorPoint.layout).to.be('XYM');
|
expect(interiorPoint.layout).to.be('XYM');
|
||||||
@@ -550,7 +550,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns XYM point for donut polygons', function() {
|
it('returns XYM point for donut polygons', function() {
|
||||||
var geom = new _ol_geom_Polygon_([
|
var geom = new Polygon([
|
||||||
[[0.5, 0.5], [0.5, 2.5], [2.5, 2.5], [2.5, 0.5], [0.5, 0.5]],
|
[[0.5, 0.5], [0.5, 2.5], [2.5, 2.5], [2.5, 0.5], [0.5, 0.5]],
|
||||||
[[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]
|
[[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]
|
||||||
]);
|
]);
|
||||||
@@ -564,7 +564,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
describe('ol.geom.Polygon.fromExtent', function() {
|
describe('ol.geom.Polygon.fromExtent', function() {
|
||||||
it('creates the correct polygon', function() {
|
it('creates the correct polygon', function() {
|
||||||
var extent = [1, 2, 3, 5];
|
var extent = [1, 2, 3, 5];
|
||||||
var polygon = _ol_geom_Polygon_.fromExtent(extent);
|
var polygon = Polygon.fromExtent(extent);
|
||||||
var flatCoordinates = polygon.getFlatCoordinates();
|
var flatCoordinates = polygon.getFlatCoordinates();
|
||||||
expect(flatCoordinates).to.eql(
|
expect(flatCoordinates).to.eql(
|
||||||
[1, 2, 1, 5, 3, 5, 3, 2, 1, 2]);
|
[1, 2, 1, 5, 3, 5, 3, 2, 1, 2]);
|
||||||
@@ -578,7 +578,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('creates a regular polygon', function() {
|
it('creates a regular polygon', function() {
|
||||||
var circle = new _ol_geom_Circle_([0, 0, 0], 1, 'XYZ');
|
var circle = new _ol_geom_Circle_([0, 0, 0], 1, 'XYZ');
|
||||||
var polygon = _ol_geom_Polygon_.fromCircle(circle);
|
var polygon = Polygon.fromCircle(circle);
|
||||||
var coordinates = polygon.getLinearRing(0).getCoordinates();
|
var coordinates = polygon.getLinearRing(0).getCoordinates();
|
||||||
expect(coordinates[0].length).to.eql(3);
|
expect(coordinates[0].length).to.eql(3);
|
||||||
expect(coordinates[0][2]).to.eql(0);
|
expect(coordinates[0][2]).to.eql(0);
|
||||||
@@ -599,7 +599,7 @@ describe('ol.geom.Polygon', function() {
|
|||||||
|
|
||||||
it('creates a regular polygon with custom sides and angle', function() {
|
it('creates a regular polygon with custom sides and angle', function() {
|
||||||
var circle = new _ol_geom_Circle_([0, 0], 1);
|
var circle = new _ol_geom_Circle_([0, 0], 1);
|
||||||
var polygon = _ol_geom_Polygon_.fromCircle(circle, 4, Math.PI / 2);
|
var polygon = Polygon.fromCircle(circle, 4, Math.PI / 2);
|
||||||
var coordinates = polygon.getLinearRing(0).getCoordinates();
|
var coordinates = polygon.getLinearRing(0).getCoordinates();
|
||||||
expect(coordinates[4]).to.eql(coordinates[0]);
|
expect(coordinates[4]).to.eql(coordinates[0]);
|
||||||
expect(coordinates[0][0]).to.roughlyEqual(0, 1e-9);
|
expect(coordinates[0][0]).to.roughlyEqual(0, 1e-9);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||||
import _ol_View_ from '../../../../src/ol/View.js';
|
import _ol_View_ from '../../../../src/ol/View.js';
|
||||||
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_DragZoom_ from '../../../../src/ol/interaction/DragZoom.js';
|
import _ol_interaction_DragZoom_ from '../../../../src/ol/interaction/DragZoom.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_render_Box_ from '../../../../src/ol/render/Box.js';
|
import _ol_render_Box_ from '../../../../src/ol/render/Box.js';
|
||||||
@@ -72,7 +72,7 @@ describe('ol.interaction.DragZoom', function() {
|
|||||||
|
|
||||||
var box = new _ol_render_Box_();
|
var box = new _ol_render_Box_();
|
||||||
var extent = [-110, 40, -90, 60];
|
var extent = [-110, 40, -90, 60];
|
||||||
box.geometry_ = _ol_geom_Polygon_.fromExtent(extent);
|
box.geometry_ = Polygon.fromExtent(extent);
|
||||||
interaction.box_ = box;
|
interaction.box_ = box;
|
||||||
|
|
||||||
interaction.onBoxEnd();
|
interaction.onBoxEnd();
|
||||||
@@ -94,7 +94,7 @@ describe('ol.interaction.DragZoom', function() {
|
|||||||
|
|
||||||
var box = new _ol_render_Box_();
|
var box = new _ol_render_Box_();
|
||||||
var extent = [-11.25, -11.25, 11.25, 11.25];
|
var extent = [-11.25, -11.25, 11.25, 11.25];
|
||||||
box.geometry_ = _ol_geom_Polygon_.fromExtent(extent);
|
box.geometry_ = Polygon.fromExtent(extent);
|
||||||
interaction.box_ = box;
|
interaction.box_ = box;
|
||||||
|
|
||||||
map.getView().setResolution(0.25);
|
map.getView().setResolution(0.25);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Draw_ from '../../../../src/ol/interaction/Draw.js';
|
import _ol_interaction_Draw_ from '../../../../src/ol/interaction/Draw.js';
|
||||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
@@ -551,7 +551,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
var features = source.getFeatures();
|
var features = source.getFeatures();
|
||||||
expect(features).to.have.length(1);
|
expect(features).to.have.length(1);
|
||||||
var geometry = features[0].getGeometry();
|
var geometry = features[0].getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
|
|
||||||
expect(geometry.getCoordinates()).to.eql([
|
expect(geometry.getCoordinates()).to.eql([
|
||||||
[[10, -20], [30, -20], [40, -10], [10, -20]]
|
[[10, -20], [30, -20], [40, -10], [10, -20]]
|
||||||
@@ -629,7 +629,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
var features = source.getFeatures();
|
var features = source.getFeatures();
|
||||||
expect(features).to.have.length(1);
|
expect(features).to.have.length(1);
|
||||||
var geometry = features[0].getGeometry();
|
var geometry = features[0].getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
|
|
||||||
expect(geometry.getCoordinates()).to.eql([
|
expect(geometry.getCoordinates()).to.eql([
|
||||||
[[10, -20], [30, -20], [40, -10], [10, -20]]
|
[[10, -20], [30, -20], [40, -10], [10, -20]]
|
||||||
@@ -653,7 +653,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
var features = source.getFeatures();
|
var features = source.getFeatures();
|
||||||
expect(features).to.have.length(1);
|
expect(features).to.have.length(1);
|
||||||
var geometry = features[0].getGeometry();
|
var geometry = features[0].getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
|
|
||||||
expect(geometry.getCoordinates()).to.eql([
|
expect(geometry.getCoordinates()).to.eql([
|
||||||
[[10, -20], [30, -20], [40, -10], [10, -20]]
|
[[10, -20], [30, -20], [40, -10], [10, -20]]
|
||||||
@@ -988,7 +988,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
|
|
||||||
var features = source.getFeatures();
|
var features = source.getFeatures();
|
||||||
var geometry = features[0].getGeometry();
|
var geometry = features[0].getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
var coordinates = geometry.getCoordinates();
|
var coordinates = geometry.getCoordinates();
|
||||||
expect(coordinates[0].length).to.eql(5);
|
expect(coordinates[0].length).to.eql(5);
|
||||||
expect(coordinates[0][0][0]).to.roughlyEqual(20, 1e-9);
|
expect(coordinates[0][0][0]).to.roughlyEqual(20, 1e-9);
|
||||||
@@ -1017,7 +1017,7 @@ describe('ol.interaction.Draw', function() {
|
|||||||
|
|
||||||
var features = source.getFeatures();
|
var features = source.getFeatures();
|
||||||
var geometry = features[0].getGeometry();
|
var geometry = features[0].getGeometry();
|
||||||
expect(geometry).to.be.a(_ol_geom_Polygon_);
|
expect(geometry).to.be.a(Polygon);
|
||||||
var coordinates = geometry.getCoordinates();
|
var coordinates = geometry.getCoordinates();
|
||||||
expect(coordinates[0]).to.have.length(5);
|
expect(coordinates[0]).to.have.length(5);
|
||||||
expect(geometry.getArea()).to.equal(400);
|
expect(geometry.getArea()).to.equal(400);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import _ol_events_condition_ from '../../../../src/ol/events/condition.js';
|
|||||||
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
import _ol_geom_Circle_ from '../../../../src/ol/geom/Circle.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Modify_ from '../../../../src/ol/interaction/Modify.js';
|
import _ol_interaction_Modify_ from '../../../../src/ol/interaction/Modify.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
import _ol_pointer_PointerEvent_ from '../../../../src/ol/pointer/PointerEvent.js';
|
||||||
@@ -35,7 +35,7 @@ describe('ol.interaction.Modify', function() {
|
|||||||
|
|
||||||
features = [
|
features = [
|
||||||
new _ol_Feature_({
|
new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([
|
geometry: new Polygon([
|
||||||
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
[[0, 0], [10, 20], [0, 40], [40, 40], [40, 0]]
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js';
|
|||||||
import _ol_MapBrowserEventType_ from '../../../../src/ol/MapBrowserEventType.js';
|
import _ol_MapBrowserEventType_ from '../../../../src/ol/MapBrowserEventType.js';
|
||||||
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
import _ol_MapBrowserPointerEvent_ from '../../../../src/ol/MapBrowserPointerEvent.js';
|
||||||
import _ol_View_ from '../../../../src/ol/View.js';
|
import _ol_View_ from '../../../../src/ol/View.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
import _ol_interaction_Interaction_ from '../../../../src/ol/interaction/Interaction.js';
|
||||||
import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js';
|
import _ol_interaction_Select_ from '../../../../src/ol/interaction/Select.js';
|
||||||
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../../../../src/ol/layer/Vector.js';
|
||||||
@@ -29,7 +29,7 @@ describe('ol.interaction.Select', function() {
|
|||||||
style.height = height + 'px';
|
style.height = height + 'px';
|
||||||
document.body.appendChild(target);
|
document.body.appendChild(target);
|
||||||
|
|
||||||
var geometry = new _ol_geom_Polygon_([[[0, 0], [0, 40], [40, 40], [40, 0]]]);
|
var geometry = new Polygon([[[0, 0], [0, 40], [40, 40], [40, 0]]]);
|
||||||
|
|
||||||
// Four overlapping features, two features of type "foo" and two features
|
// Four overlapping features, two features of type "foo" and two features
|
||||||
// of type "bar". The rendering order is, from top to bottom, foo -> bar
|
// of type "bar". The rendering order is, from top to bottom, foo -> bar
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Disposable_ from '../../../../src/ol/Disposable.js';
|
import _ol_Disposable_ from '../../../../src/ol/Disposable.js';
|
||||||
import _ol_Map_ from '../../../../src/ol/Map.js';
|
import _ol_Map_ from '../../../../src/ol/Map.js';
|
||||||
import _ol_View_ from '../../../../src/ol/View.js';
|
import _ol_View_ from '../../../../src/ol/View.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_Box_ from '../../../../src/ol/render/Box.js';
|
import _ol_render_Box_ from '../../../../src/ol/render/Box.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ describe('ol.render.Box', function() {
|
|||||||
it('creates a polygon geometry', function() {
|
it('creates a polygon geometry', function() {
|
||||||
expect(box.getGeometry()).to.be(null);
|
expect(box.getGeometry()).to.be(null);
|
||||||
box.setPixels([1, 2], [3, 4]);
|
box.setPixels([1, 2], [3, 4]);
|
||||||
expect(box.getGeometry()).to.be.a(_ol_geom_Polygon_);
|
expect(box.getGeometry()).to.be.a(Polygon);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../../src/ol/geom/Point.js';
|
import Point from '../../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_VectorContext_ from '../../../../../src/ol/render/VectorContext.js';
|
import _ol_render_VectorContext_ from '../../../../../src/ol/render/VectorContext.js';
|
||||||
import _ol_render_canvas_Immediate_ from '../../../../../src/ol/render/canvas/Immediate.js';
|
import _ol_render_canvas_Immediate_ from '../../../../../src/ol/render/canvas/Immediate.js';
|
||||||
import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js';
|
import _ol_style_Circle_ from '../../../../../src/ol/style/Circle.js';
|
||||||
@@ -91,7 +91,7 @@ describe('ol.render.canvas.Immediate', function() {
|
|||||||
var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent);
|
var context = new _ol_render_canvas_Immediate_(getMockContext(), 1, extent);
|
||||||
sinon.spy(context, 'drawPolygon');
|
sinon.spy(context, 'drawPolygon');
|
||||||
|
|
||||||
var geometry = new _ol_geom_Polygon_([[[1, 2], [3, 4], [5, 6], [1, 2]]]);
|
var geometry = new Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]);
|
||||||
context.drawGeometry(geometry);
|
context.drawGeometry(geometry);
|
||||||
expect(context.drawPolygon.calledOnce).to.be(true);
|
expect(context.drawPolygon.calledOnce).to.be(true);
|
||||||
expect(context.drawPolygon.firstCall.calledWithExactly(geometry)).to.be(true);
|
expect(context.drawPolygon.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||||
@@ -136,7 +136,7 @@ describe('ol.render.canvas.Immediate', function() {
|
|||||||
|
|
||||||
var point = new Point([1, 2]);
|
var point = new Point([1, 2]);
|
||||||
var linestring = new LineString([[1, 2], [3, 4]]);
|
var linestring = new LineString([[1, 2], [3, 4]]);
|
||||||
var polygon = new _ol_geom_Polygon_([[[1, 2], [3, 4], [5, 6], [1, 2]]]);
|
var polygon = new Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]);
|
||||||
|
|
||||||
var geometry = new _ol_geom_GeometryCollection_([point, linestring, polygon]);
|
var geometry = new _ol_geom_GeometryCollection_([point, linestring, polygon]);
|
||||||
context.drawGeometry(geometry);
|
context.drawGeometry(geometry);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_canvas_TextReplay_ from '../../../../../src/ol/render/canvas/TextReplay.js';
|
import _ol_render_canvas_TextReplay_ from '../../../../../src/ol/render/canvas/TextReplay.js';
|
||||||
import _ol_style_Text_ from '../../../../../src/ol/style/Text.js';
|
import _ol_style_Text_ from '../../../../../src/ol/style/Text.js';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ describe('ol.render.canvas.TextReplay', function() {
|
|||||||
|
|
||||||
it('renders polygon labels only when they fit', 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 replay = new _ol_render_canvas_TextReplay_(1, [-180, -90, 180, 90], 0.02, 1, true);
|
||||||
var geometry = new _ol_geom_Polygon_([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
|
var geometry = new Polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]);
|
||||||
var feature = new _ol_Feature_(geometry);
|
var feature = new _ol_Feature_(geometry);
|
||||||
|
|
||||||
replay.setTextStyle(new _ol_style_Text_({
|
replay.setTextStyle(new _ol_style_Text_({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js';
|
import _ol_render_Feature_ from '../../../../src/ol/render/Feature.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ describe('ol.render.Feature', function() {
|
|||||||
|
|
||||||
describe('#getFlatInteriorPoint()', function() {
|
describe('#getFlatInteriorPoint()', function() {
|
||||||
it('returns correct point and caches it', function() {
|
it('returns correct point and caches it', function() {
|
||||||
var polygon = new _ol_geom_Polygon_([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]);
|
var polygon = new Polygon([[[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]]]);
|
||||||
var feature = new _ol_render_Feature_('Polygon', polygon.getOrientedFlatCoordinates(),
|
var feature = new _ol_render_Feature_('Polygon', polygon.getOrientedFlatCoordinates(),
|
||||||
polygon.getEnds());
|
polygon.getEnds());
|
||||||
expect(feature.getFlatInteriorPoint()).to.eql([5, 5, 10]);
|
expect(feature.getFlatInteriorPoint()).to.eql([5, 5, 10]);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../../src/ol/geom/Point.js';
|
import Point from '../../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js';
|
import _ol_render_webgl_CircleReplay_ from '../../../../../src/ol/render/webgl/CircleReplay.js';
|
||||||
import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/ImageReplay.js';
|
import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/ImageReplay.js';
|
||||||
import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Immediate.js';
|
import _ol_render_webgl_Immediate_ from '../../../../../src/ol/render/webgl/Immediate.js';
|
||||||
@@ -31,7 +31,7 @@ describe('ol.render.webgl.Immediate', function() {
|
|||||||
multiLine = new MultiLineString([[[0, 0], [5, 5]]]);
|
multiLine = new MultiLineString([[[0, 0], [5, 5]]]);
|
||||||
point = new Point([0, 0]);
|
point = new Point([0, 0]);
|
||||||
multiPoint = new MultiPoint([[0, 0]]);
|
multiPoint = new MultiPoint([[0, 0]]);
|
||||||
polygon = new _ol_geom_Polygon_([[[0, 0], [5, 5], [5, 0], [0, 0]]]);
|
polygon = new Polygon([[[0, 0], [5, 5], [5, 0], [0, 0]]]);
|
||||||
multiPolygon = new _ol_geom_MultiPolygon_([[[[0, 0], [5, 5], [5, 0], [0, 0]]]]);
|
multiPolygon = new _ol_geom_MultiPolygon_([[[[0, 0], [5, 5], [5, 0], [0, 0]]]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {getUid} from '../../../../../src/ol/index.js';
|
import {getUid} from '../../../../../src/ol/index.js';
|
||||||
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../../src/ol/Feature.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js';
|
import _ol_render_webgl_PolygonReplay_ from '../../../../../src/ol/render/webgl/PolygonReplay.js';
|
||||||
import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js';
|
import _ol_render_webgl_polygonreplay_defaultshader_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js';
|
||||||
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js';
|
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js';
|
||||||
@@ -32,7 +32,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('sets the buffer data', function() {
|
it('sets the buffer data', function() {
|
||||||
var polygon1 = new _ol_geom_Polygon_(
|
var polygon1 = new Polygon(
|
||||||
[[[1000, 2000], [1200, 2000], [1200, 3000]]]
|
[[[1000, 2000], [1200, 2000], [1200, 3000]]]
|
||||||
);
|
);
|
||||||
replay.drawPolygon(polygon1, null);
|
replay.drawPolygon(polygon1, null);
|
||||||
@@ -43,7 +43,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
|||||||
1000, 2000, 1200, 3000, 1200, 2000, 1000, 2000]);
|
1000, 2000, 1200, 3000, 1200, 2000, 1000, 2000]);
|
||||||
expect(replay.indices).to.eql([2, 0, 1]);
|
expect(replay.indices).to.eql([2, 0, 1]);
|
||||||
|
|
||||||
var polygon2 = new _ol_geom_Polygon_(
|
var polygon2 = new Polygon(
|
||||||
[[[4000, 2000], [4200, 2000], [4200, 3000]]]
|
[[[4000, 2000], [4200, 2000], [4200, 3000]]]
|
||||||
);
|
);
|
||||||
replay.drawPolygon(polygon2, null);
|
replay.drawPolygon(polygon2, null);
|
||||||
@@ -396,13 +396,13 @@ describe('ol.render.webgl.PolygonReplay', function() {
|
|||||||
describe('#drawReplay', function() {
|
describe('#drawReplay', function() {
|
||||||
var gl, context;
|
var gl, context;
|
||||||
var feature1 = new _ol_Feature_({
|
var feature1 = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
||||||
});
|
});
|
||||||
var feature2 = new _ol_Feature_({
|
var feature2 = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
||||||
});
|
});
|
||||||
var feature3 = new _ol_Feature_({
|
var feature3 = new _ol_Feature_({
|
||||||
geometry: new _ol_geom_Polygon_([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
|
||||||
});
|
});
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
gl = {
|
gl = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
|
|||||||
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../../src/ol/geom/MultiPolygon.js';
|
||||||
import Point from '../../../../../src/ol/geom/Point.js';
|
import Point from '../../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../../src/ol/geom/Polygon.js';
|
||||||
import _ol_render_canvas_LineStringReplay_ from '../../../../../src/ol/render/canvas/LineStringReplay.js';
|
import _ol_render_canvas_LineStringReplay_ from '../../../../../src/ol/render/canvas/LineStringReplay.js';
|
||||||
import _ol_render_canvas_PolygonReplay_ from '../../../../../src/ol/render/canvas/PolygonReplay.js';
|
import _ol_render_canvas_PolygonReplay_ from '../../../../../src/ol/render/canvas/PolygonReplay.js';
|
||||||
import _ol_render_canvas_Replay_ from '../../../../../src/ol/render/canvas/Replay.js';
|
import _ol_render_canvas_Replay_ from '../../../../../src/ol/render/canvas/Replay.js';
|
||||||
@@ -29,13 +29,13 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
transform = _ol_transform_.create();
|
transform = _ol_transform_.create();
|
||||||
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, false);
|
replay = new _ol_render_canvas_ReplayGroup_(1, [-180, -90, 180, 90], 1, 1, false);
|
||||||
feature0 = new _ol_Feature_(new _ol_geom_Polygon_(
|
feature0 = new _ol_Feature_(new Polygon(
|
||||||
[[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]]));
|
[[[-90, 0], [-45, 45], [0, 0], [1, 1], [0, -45], [-90, 0]]]));
|
||||||
feature1 = new _ol_Feature_(new _ol_geom_Polygon_(
|
feature1 = new _ol_Feature_(new Polygon(
|
||||||
[[[-90, -45], [-90, 0], [0, 0], [0, -45], [-90, -45]]]));
|
[[[-90, -45], [-90, 0], [0, 0], [0, -45], [-90, -45]]]));
|
||||||
feature2 = new _ol_Feature_(new _ol_geom_Polygon_(
|
feature2 = new _ol_Feature_(new Polygon(
|
||||||
[[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]]));
|
[[[90, 45], [90, 0], [0, 0], [0, 45], [90, 45]]]));
|
||||||
feature3 = new _ol_Feature_(new _ol_geom_Polygon_(
|
feature3 = new _ol_Feature_(new Polygon(
|
||||||
[[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]]));
|
[[[-90, -45], [-90, 45], [90, 45], [90, -45], [-90, -45]]]));
|
||||||
fill0 = new _ol_style_Style_({
|
fill0 = new _ol_style_Style_({
|
||||||
fill: new _ol_style_Fill_({color: 'black'})
|
fill: new _ol_style_Fill_({color: 'black'})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {nullFunction} from '../../../../src/ol/index.js';
|
|||||||
import _ol_events_ from '../../../../src/ol/events.js';
|
import _ol_events_ from '../../../../src/ol/events.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||||
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
import _ol_geom_MultiPolygon_ from '../../../../src/ol/geom/MultiPolygon.js';
|
||||||
@@ -129,7 +129,7 @@ describe('ol.renderer.vector', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('does render the polygon', function() {
|
it('does render the polygon', function() {
|
||||||
feature.setGeometry(new _ol_geom_Polygon_(
|
feature.setGeometry(new Polygon(
|
||||||
[[[0, 0], [1, 1], [1, 0], [0, 0]]]));
|
[[[0, 0], [1, 1], [1, 0], [0, 0]]]));
|
||||||
var polygonReplay = replayGroup.getReplay(
|
var polygonReplay = replayGroup.getReplay(
|
||||||
style.getZIndex(), 'Polygon');
|
style.getZIndex(), 'Polygon');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
import _ol_Feature_ from '../../../../src/ol/Feature.js';
|
||||||
import LineString from '../../../../src/ol/geom/LineString.js';
|
import LineString from '../../../../src/ol/geom/LineString.js';
|
||||||
import Point from '../../../../src/ol/geom/Point.js';
|
import Point from '../../../../src/ol/geom/Point.js';
|
||||||
import _ol_geom_Polygon_ from '../../../../src/ol/geom/Polygon.js';
|
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js';
|
import _ol_source_Cluster_ from '../../../../src/ol/source/Cluster.js';
|
||||||
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
import _ol_source_Source_ from '../../../../src/ol/source/Source.js';
|
||||||
@@ -52,7 +52,7 @@ describe('ol.source.Cluster', function() {
|
|||||||
features: [
|
features: [
|
||||||
new _ol_Feature_(new Point([0, 0])),
|
new _ol_Feature_(new Point([0, 0])),
|
||||||
new _ol_Feature_(new LineString([[0, 0], [1, 1]])),
|
new _ol_Feature_(new LineString([[0, 0], [1, 1]])),
|
||||||
new _ol_Feature_(new _ol_geom_Polygon_(
|
new _ol_Feature_(new Polygon(
|
||||||
[[[-1, -1], [-1, 1], [1, 1], [1, -1], [-1, -1]]]))
|
[[[-1, -1], [-1, 1], [1, 1], [1, -1], [-1, -1]]]))
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user