Rename _ol_geom_GeometryType_ to GeometryType

This commit is contained in:
Tim Schaub
2017-12-14 09:00:57 -07:00
parent 2be36c375d
commit 504368369c
29 changed files with 194 additions and 194 deletions
+19 -19
View File
@@ -8,7 +8,7 @@ import {containsExtent} from '../extent.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_JSONFeature_ from '../format/JSONFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import GeometryType from '../geom/GeometryType.js';
import LineString from '../geom/LineString.js';
import _ol_geom_LinearRing_ from '../geom/LinearRing.js';
import MultiLineString from '../geom/MultiLineString.js';
@@ -61,24 +61,24 @@ _ol_format_EsriJSON_.readGeometry_ = function(object, opt_options) {
/** @type {ol.geom.GeometryType} */
var type;
if (typeof object.x === 'number' && typeof object.y === 'number') {
type = _ol_geom_GeometryType_.POINT;
type = GeometryType.POINT;
} else if (object.points) {
type = _ol_geom_GeometryType_.MULTI_POINT;
type = GeometryType.MULTI_POINT;
} else if (object.paths) {
if (object.paths.length === 1) {
type = _ol_geom_GeometryType_.LINE_STRING;
type = GeometryType.LINE_STRING;
} else {
type = _ol_geom_GeometryType_.MULTI_LINE_STRING;
type = GeometryType.MULTI_LINE_STRING;
}
} else if (object.rings) {
var layout = _ol_format_EsriJSON_.getGeometryLayout_(object);
var rings = _ol_format_EsriJSON_.convertRings_(object.rings, layout);
object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object));
if (rings.length === 1) {
type = _ol_geom_GeometryType_.POLYGON;
type = GeometryType.POLYGON;
object.rings = rings[0];
} else {
type = _ol_geom_GeometryType_.MULTI_POLYGON;
type = GeometryType.MULTI_POLYGON;
object.rings = rings;
}
}
@@ -396,17 +396,17 @@ _ol_format_EsriJSON_.writeMultiPolygonGeometry_ = function(geometry,
* @type {Object.<ol.geom.GeometryType, function(EsriJSONGeometry): ol.geom.Geometry>}
*/
_ol_format_EsriJSON_.GEOMETRY_READERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.POINT] =
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.POINT] =
_ol_format_EsriJSON_.readPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.LINE_STRING] =
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.LINE_STRING] =
_ol_format_EsriJSON_.readLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.POLYGON] =
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.POLYGON] =
_ol_format_EsriJSON_.readPolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POINT] =
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POINT] =
_ol_format_EsriJSON_.readMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.readMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
_ol_format_EsriJSON_.GEOMETRY_READERS_[GeometryType.MULTI_POLYGON] =
_ol_format_EsriJSON_.readMultiPolygonGeometry_;
@@ -416,17 +416,17 @@ _ol_format_EsriJSON_.GEOMETRY_READERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
* @type {Object.<string, function(ol.geom.Geometry, olx.format.WriteOptions=): (EsriJSONGeometry)>}
*/
_ol_format_EsriJSON_.GEOMETRY_WRITERS_ = {};
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.POINT] =
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.POINT] =
_ol_format_EsriJSON_.writePointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.LINE_STRING] =
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.LINE_STRING] =
_ol_format_EsriJSON_.writeLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.POLYGON] =
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.POLYGON] =
_ol_format_EsriJSON_.writePolygonGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_POINT] =
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POINT] =
_ol_format_EsriJSON_.writeMultiPointGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_LINE_STRING] =
_ol_format_EsriJSON_.writeMultiLineStringGeometry_;
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[_ol_geom_GeometryType_.MULTI_POLYGON] =
_ol_format_EsriJSON_.GEOMETRY_WRITERS_[GeometryType.MULTI_POLYGON] =
_ol_format_EsriJSON_.writeMultiPolygonGeometry_;
+10 -10
View File
@@ -16,7 +16,7 @@ import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_format_XSD_ from '../format/XSD.js';
import GeometryCollection from '../geom/GeometryCollection.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import GeometryType from '../geom/GeometryType.js';
import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js';
import MultiPoint from '../geom/MultiPoint.js';
@@ -367,7 +367,7 @@ _ol_format_KML_.createFeatureStyleFunction_ = function(style, styleUrl,
if (drawName) {
if (this.getGeometry()) {
drawName = (this.getGeometry().getType() ===
_ol_geom_GeometryType_.POINT);
GeometryType.POINT);
}
}
@@ -928,7 +928,7 @@ _ol_format_KML_.readMultiGeometry_ = function(node, objectStack) {
if (homogeneous) {
var layout;
var flatCoordinates;
if (type == _ol_geom_GeometryType_.POINT) {
if (type == GeometryType.POINT) {
var point = geometries[0];
layout = point.getLayout();
flatCoordinates = point.getFlatCoordinates();
@@ -939,15 +939,15 @@ _ol_format_KML_.readMultiGeometry_ = function(node, objectStack) {
multiGeometry = new MultiPoint(null);
multiGeometry.setFlatCoordinates(layout, flatCoordinates);
_ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries);
} else if (type == _ol_geom_GeometryType_.LINE_STRING) {
} else if (type == GeometryType.LINE_STRING) {
multiGeometry = new MultiLineString(null);
multiGeometry.setLineStrings(geometries);
_ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries);
} else if (type == _ol_geom_GeometryType_.POLYGON) {
} else if (type == GeometryType.POLYGON) {
multiGeometry = new MultiPolygon(null);
multiGeometry.setPolygons(geometries);
_ol_format_KML_.setCommonGeometryProperties_(multiGeometry, geometries);
} else if (type == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) {
} else if (type == GeometryType.GEOMETRY_COLLECTION) {
multiGeometry = new GeometryCollection(geometries);
} else {
_ol_asserts_.assert(false, 37); // Unknown geometry type found
@@ -2372,17 +2372,17 @@ _ol_format_KML_.writeMultiGeometry_ = function(node, geometry, objectStack) {
var geometries;
/** @type {function(*, Array.<*>, string=): (Node|undefined)} */
var factory;
if (type == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) {
if (type == GeometryType.GEOMETRY_COLLECTION) {
geometries = /** @type {ol.geom.GeometryCollection} */ (geometry).getGeometries();
factory = _ol_format_KML_.GEOMETRY_NODE_FACTORY_;
} else if (type == _ol_geom_GeometryType_.MULTI_POINT) {
} else if (type == GeometryType.MULTI_POINT) {
geometries = /** @type {ol.geom.MultiPoint} */ (geometry).getPoints();
factory = _ol_format_KML_.POINT_NODE_FACTORY_;
} else if (type == _ol_geom_GeometryType_.MULTI_LINE_STRING) {
} else if (type == GeometryType.MULTI_LINE_STRING) {
geometries =
(/** @type {ol.geom.MultiLineString} */ (geometry)).getLineStrings();
factory = _ol_format_KML_.LINE_STRING_NODE_FACTORY_;
} else if (type == _ol_geom_GeometryType_.MULTI_POLYGON) {
} else if (type == GeometryType.MULTI_POLYGON) {
geometries =
(/** @type {ol.geom.MultiPolygon} */ (geometry)).getPolygons();
factory = _ol_format_KML_.POLYGON_NODE_FACTORY_;
+11 -11
View File
@@ -9,7 +9,7 @@ import _ol_ext_PBF_ from 'pbf';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_FormatType_ from '../format/FormatType.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import GeometryType from '../geom/GeometryType.js';
import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js';
import MultiPoint from '../geom/MultiPoint.js';
@@ -250,13 +250,13 @@ _ol_format_MVT_.getGeometryType_ = function(type, numEnds) {
var geometryType;
if (type === 1) {
geometryType = numEnds === 1 ?
_ol_geom_GeometryType_.POINT : _ol_geom_GeometryType_.MULTI_POINT;
GeometryType.POINT : GeometryType.MULTI_POINT;
} else if (type === 2) {
geometryType = numEnds === 1 ?
_ol_geom_GeometryType_.LINE_STRING :
_ol_geom_GeometryType_.MULTI_LINE_STRING;
GeometryType.LINE_STRING :
GeometryType.MULTI_LINE_STRING;
} else if (type === 3) {
geometryType = _ol_geom_GeometryType_.POLYGON;
geometryType = GeometryType.POLYGON;
// MultiPolygon not relevant for rendering - winding order determines
// outer rings of polygons.
}
@@ -291,7 +291,7 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
} else {
var geom;
if (geometryType == _ol_geom_GeometryType_.POLYGON) {
if (geometryType == GeometryType.POLYGON) {
var endss = [];
var offset = 0;
var prevEndIndex = 0;
@@ -310,11 +310,11 @@ _ol_format_MVT_.prototype.createFeature_ = function(pbf, rawFeature, opt_options
geom = new Polygon(null);
}
} else {
geom = geometryType === _ol_geom_GeometryType_.POINT ? new Point(null) :
geometryType === _ol_geom_GeometryType_.LINE_STRING ? new LineString(null) :
geometryType === _ol_geom_GeometryType_.POLYGON ? new Polygon(null) :
geometryType === _ol_geom_GeometryType_.MULTI_POINT ? new MultiPoint (null) :
geometryType === _ol_geom_GeometryType_.MULTI_LINE_STRING ? new MultiLineString(null) :
geom = geometryType === GeometryType.POINT ? new Point(null) :
geometryType === GeometryType.LINE_STRING ? new LineString(null) :
geometryType === GeometryType.POLYGON ? new Polygon(null) :
geometryType === GeometryType.MULTI_POINT ? new MultiPoint (null) :
geometryType === GeometryType.MULTI_LINE_STRING ? new MultiLineString(null) :
null;
}
geom.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, ends);
+3 -3
View File
@@ -6,7 +6,7 @@ import _ol_Feature_ from '../Feature.js';
import _ol_format_Feature_ from '../format/Feature.js';
import _ol_format_TextFeature_ from '../format/TextFeature.js';
import GeometryCollection from '../geom/GeometryCollection.js';
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
import GeometryType from '../geom/GeometryType.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js';
import MultiLineString from '../geom/MultiLineString.js';
@@ -296,7 +296,7 @@ _ol_format_WKT_.prototype.readFeaturesFromText = function(text, opt_options) {
var geometries = [];
var geometry = this.readGeometryFromText(text, opt_options);
if (this.splitCollection_ &&
geometry.getType() == _ol_geom_GeometryType_.GEOMETRY_COLLECTION) {
geometry.getType() == GeometryType.GEOMETRY_COLLECTION) {
geometries = (/** @type {ol.geom.GeometryCollection} */ (geometry))
.getGeometriesArray();
} else {
@@ -669,7 +669,7 @@ _ol_format_WKT_.Parser.prototype.parseGeometry_ = function() {
if (this.match(_ol_format_WKT_.TokenType_.TEXT)) {
var geomType = token.value;
this.layout_ = this.parseGeometryLayout_();
if (geomType == _ol_geom_GeometryType_.GEOMETRY_COLLECTION.toUpperCase()) {
if (geomType == GeometryType.GEOMETRY_COLLECTION.toUpperCase()) {
var geometries = this.parseGeometryCollectionText_();
return new GeometryCollection(geometries);
} else {