Named exports from ol/proj
This commit is contained in:
committed by
Andreas Hocevar
parent
fab77e8d37
commit
6f72ffe498
@@ -19,7 +19,7 @@ import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js';
|
||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -547,7 +547,7 @@ _ol_format_EsriJSON_.prototype.readProjectionFromObject = function(object) {
|
||||
var esriJSONObject = /** @type {EsriJSONObject} */ (object);
|
||||
if (esriJSONObject.spatialReference && esriJSONObject.spatialReference.wkid) {
|
||||
var crs = esriJSONObject.spatialReference.wkid;
|
||||
return _ol_proj_.get('EPSG:' + crs);
|
||||
return getProjection('EPSG:' + crs);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -627,8 +627,7 @@ _ol_format_EsriJSON_.prototype.writeFeatureObject = function(
|
||||
_ol_format_EsriJSON_.writeGeometry_(geometry, opt_options);
|
||||
if (opt_options && opt_options.featureProjection) {
|
||||
object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({
|
||||
wkid: _ol_proj_.get(
|
||||
opt_options.featureProjection).getCode().split(':').pop()
|
||||
wkid: getProjection(opt_options.featureProjection).getCode().split(':').pop()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -175,15 +175,15 @@ _ol_format_Feature_.prototype.writeGeometry = function(geometry, opt_options) {}
|
||||
_ol_format_Feature_.transformWithOptions = function(
|
||||
geometry, write, opt_options) {
|
||||
var featureProjection = opt_options ?
|
||||
_ol_proj_.get(opt_options.featureProjection) : null;
|
||||
getProjection(opt_options.featureProjection) : null;
|
||||
var dataProjection = opt_options ?
|
||||
_ol_proj_.get(opt_options.dataProjection) : null;
|
||||
getProjection(opt_options.dataProjection) : null;
|
||||
/**
|
||||
* @type {ol.geom.Geometry|ol.Extent}
|
||||
*/
|
||||
var transformed;
|
||||
if (featureProjection && dataProjection &&
|
||||
!_ol_proj_.equivalent(featureProjection, dataProjection)) {
|
||||
!equivalentProjection(featureProjection, dataProjection)) {
|
||||
if (geometry instanceof _ol_geom_Geometry_) {
|
||||
transformed = (write ? geometry.clone() : geometry).transform(
|
||||
write ? featureProjection : dataProjection,
|
||||
@@ -191,7 +191,7 @@ _ol_format_Feature_.transformWithOptions = function(
|
||||
} else {
|
||||
// FIXME this is necessary because ol.format.GML treats extents
|
||||
// as geometries
|
||||
transformed = _ol_proj_.transformExtent(
|
||||
transformed = transformExtent(
|
||||
geometry,
|
||||
dataProjection,
|
||||
featureProjection);
|
||||
|
||||
@@ -8,7 +8,7 @@ import _ol_format_GMLBase_ from '../format/GMLBase.js';
|
||||
import _ol_format_XSD_ from '../format/XSD.js';
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection, transformExtent} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ _ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) {
|
||||
var containerSrs = context['srsName'];
|
||||
var axisOrientation = 'enu';
|
||||
if (containerSrs) {
|
||||
var proj = _ol_proj_.get(containerSrs);
|
||||
var proj = getProjection(containerSrs);
|
||||
if (proj) {
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
@@ -289,7 +289,7 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec
|
||||
var value;
|
||||
if (Array.isArray(geometry)) {
|
||||
if (context.dataProjection) {
|
||||
value = _ol_proj_.transformExtent(
|
||||
value = transformExtent(
|
||||
geometry, context.featureProjection, context.dataProjection);
|
||||
} else {
|
||||
value = geometry;
|
||||
@@ -467,7 +467,7 @@ _ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) {
|
||||
_ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
||||
var axisOrientation = 'enu';
|
||||
if (opt_srsName) {
|
||||
axisOrientation = _ol_proj_.get(opt_srsName).getAxisOrientation();
|
||||
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
|
||||
}
|
||||
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||
point[0] + ',' + point[1] :
|
||||
|
||||
@@ -14,7 +14,7 @@ import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection, transformExtent} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
|
||||
/**
|
||||
@@ -320,7 +320,7 @@ _ol_format_GML3_.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
var containerSrs = context['srsName'];
|
||||
var axisOrientation = 'enu';
|
||||
if (containerSrs) {
|
||||
var proj = _ol_proj_.get(containerSrs);
|
||||
var proj = getProjection(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
if (axisOrientation === 'neu') {
|
||||
@@ -356,7 +356,7 @@ _ol_format_GML3_.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
var contextDimension = context['srsDimension'];
|
||||
var axisOrientation = 'enu';
|
||||
if (containerSrs) {
|
||||
var proj = _ol_proj_.get(containerSrs);
|
||||
var proj = getProjection(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
var coords = s.split(/\s+/);
|
||||
@@ -582,7 +582,7 @@ _ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) {
|
||||
var srsName = context['srsName'];
|
||||
var axisOrientation = 'enu';
|
||||
if (srsName) {
|
||||
axisOrientation = _ol_proj_.get(srsName).getAxisOrientation();
|
||||
axisOrientation = getProjection(srsName).getAxisOrientation();
|
||||
}
|
||||
var point = value.getCoordinates();
|
||||
var coords;
|
||||
@@ -611,7 +611,7 @@ _ol_format_GML3_.prototype.writePos_ = function(node, value, objectStack) {
|
||||
_ol_format_GML3_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
||||
var axisOrientation = 'enu';
|
||||
if (opt_srsName) {
|
||||
axisOrientation = _ol_proj_.get(opt_srsName).getAxisOrientation();
|
||||
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
|
||||
}
|
||||
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||
point[0] + ' ' + point[1] :
|
||||
@@ -956,7 +956,7 @@ _ol_format_GML3_.prototype.writeGeometryElement = function(node, geometry, objec
|
||||
var value;
|
||||
if (Array.isArray(geometry)) {
|
||||
if (context.dataProjection) {
|
||||
value = _ol_proj_.transformExtent(
|
||||
value = transformExtent(
|
||||
geometry, context.featureProjection, context.dataProjection);
|
||||
} else {
|
||||
value = geometry;
|
||||
|
||||
@@ -18,7 +18,7 @@ import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
|
||||
/**
|
||||
@@ -592,7 +592,7 @@ _ol_format_GMLBase_.prototype.readFeaturesFromNode = function(node, opt_options)
|
||||
* @inheritDoc
|
||||
*/
|
||||
_ol_format_GMLBase_.prototype.readProjectionFromNode = function(node) {
|
||||
return _ol_proj_.get(this.srsName ? this.srsName :
|
||||
return getProjection(this.srsName ? this.srsName :
|
||||
node.firstElementChild.getAttribute('srsName'));
|
||||
};
|
||||
export default _ol_format_GMLBase_;
|
||||
|
||||
@@ -11,7 +11,7 @@ import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_LineString_ from '../geom/LineString.js';
|
||||
import _ol_geom_MultiLineString_ from '../geom/MultiLineString.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ var _ol_format_GPX_ = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
|
||||
this.defaultDataProjection = getProjection('EPSG:4326');
|
||||
|
||||
/**
|
||||
* @type {function(ol.Feature, Node)|undefined}
|
||||
|
||||
@@ -17,7 +17,7 @@ import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -37,13 +37,13 @@ var _ol_format_GeoJSON_ = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get(
|
||||
this.defaultDataProjection = getProjection(
|
||||
options.defaultDataProjection ?
|
||||
options.defaultDataProjection : 'EPSG:4326');
|
||||
|
||||
|
||||
if (options.featureProjection) {
|
||||
this.defaultFeatureProjection = _ol_proj_.get(options.featureProjection);
|
||||
this.defaultFeatureProjection = getProjection(options.featureProjection);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -467,7 +467,7 @@ _ol_format_GeoJSON_.prototype.readProjectionFromObject = function(object) {
|
||||
var projection;
|
||||
if (crs) {
|
||||
if (crs.type == 'name') {
|
||||
projection = _ol_proj_.get(crs.properties.name);
|
||||
projection = getProjection(crs.properties.name);
|
||||
} else {
|
||||
_ol_asserts_.assert(false, 36); // Unknown SRS type
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import _ol_format_IGCZ_ from '../format/IGCZ.js';
|
||||
import _ol_format_TextFeature_ from '../format/TextFeature.js';
|
||||
import _ol_geom_GeometryLayout_ from '../geom/GeometryLayout.js';
|
||||
import _ol_geom_LineString_ from '../geom/LineString.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -28,7 +28,7 @@ var _ol_format_IGC_ = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
|
||||
this.defaultDataProjection = getProjection('EPSG:4326');
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -24,7 +24,7 @@ import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_style_Fill_ from '../style/Fill.js';
|
||||
import _ol_style_Icon_ from '../style/Icon.js';
|
||||
import _ol_style_IconAnchorUnits_ from '../style/IconAnchorUnits.js';
|
||||
@@ -59,7 +59,7 @@ var _ol_format_KML_ = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
|
||||
this.defaultDataProjection = getProjection('EPSG:4326');
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -12,7 +12,7 @@ import _ol_geom_LineString_ from '../geom/LineString.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ var _ol_format_OSMXML_ = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
|
||||
this.defaultDataProjection = getProjection('EPSG:4326');
|
||||
};
|
||||
|
||||
inherits(_ol_format_OSMXML_, _ol_format_XMLFeature_);
|
||||
|
||||
@@ -11,7 +11,7 @@ import _ol_geom_LineString_ from '../geom/LineString.js';
|
||||
import _ol_geom_SimpleGeometry_ from '../geom/SimpleGeometry.js';
|
||||
import _ol_geom_flat_flip_ from '../geom/flat/flip.js';
|
||||
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -33,7 +33,7 @@ var _ol_format_Polyline_ = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get('EPSG:4326');
|
||||
this.defaultDataProjection = getProjection('EPSG:4326');
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -11,7 +11,7 @@ import _ol_geom_MultiPoint_ from '../geom/MultiPoint.js';
|
||||
import _ol_geom_MultiPolygon_ from '../geom/MultiPolygon.js';
|
||||
import _ol_geom_Point_ from '../geom/Point.js';
|
||||
import _ol_geom_Polygon_ from '../geom/Polygon.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -43,7 +43,7 @@ var _ol_format_TopoJSON_ = function(opt_options) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
this.defaultDataProjection = _ol_proj_.get(
|
||||
this.defaultDataProjection = getProjection(
|
||||
options.defaultDataProjection ?
|
||||
options.defaultDataProjection : 'EPSG:4326');
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
|
||||
import _ol_format_XSD_ from '../format/XSD.js';
|
||||
import _ol_geom_Geometry_ from '../geom/Geometry.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
|
||||
/**
|
||||
@@ -1098,7 +1098,7 @@ _ol_format_WFS_.prototype.readProjectionFromNode = function(node) {
|
||||
n.firstChild.nodeType === 3))) {
|
||||
var objectStack = [{}];
|
||||
this.gmlFormat_.readGeometryElement(n, objectStack);
|
||||
return _ol_proj_.get(objectStack.pop().srsName);
|
||||
return getProjection(objectStack.pop().srsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user