Rename _ol_Feature_ to Feature

This commit is contained in:
Tim Schaub
2018-01-08 09:35:02 -07:00
parent 6934e148ca
commit 22fce4f97b
79 changed files with 630 additions and 630 deletions

View File

@@ -54,7 +54,7 @@ import _ol_style_Style_ from './style/Style.js';
* include a Geometry associated with a `geometry` key.
* @api
*/
var _ol_Feature_ = function(opt_geometryOrProperties) {
var Feature = function(opt_geometryOrProperties) {
_ol_Object_.call(this);
@@ -107,7 +107,7 @@ var _ol_Feature_ = function(opt_geometryOrProperties) {
}
};
inherits(_ol_Feature_, _ol_Object_);
inherits(Feature, _ol_Object_);
/**
@@ -116,8 +116,8 @@ inherits(_ol_Feature_, _ol_Object_);
* @return {ol.Feature} The clone.
* @api
*/
_ol_Feature_.prototype.clone = function() {
var clone = new _ol_Feature_(this.getProperties());
Feature.prototype.clone = function() {
var clone = new Feature(this.getProperties());
clone.setGeometryName(this.getGeometryName());
var geometry = this.getGeometry();
if (geometry) {
@@ -139,7 +139,7 @@ _ol_Feature_.prototype.clone = function() {
* @api
* @observable
*/
_ol_Feature_.prototype.getGeometry = function() {
Feature.prototype.getGeometry = function() {
return /** @type {ol.geom.Geometry|undefined} */ (
this.get(this.geometryName_));
};
@@ -152,7 +152,7 @@ _ol_Feature_.prototype.getGeometry = function() {
* @return {number|string|undefined} Id.
* @api
*/
_ol_Feature_.prototype.getId = function() {
Feature.prototype.getId = function() {
return this.id_;
};
@@ -164,7 +164,7 @@ _ol_Feature_.prototype.getId = function() {
* for this feature.
* @api
*/
_ol_Feature_.prototype.getGeometryName = function() {
Feature.prototype.getGeometryName = function() {
return this.geometryName_;
};
@@ -176,7 +176,7 @@ _ol_Feature_.prototype.getGeometryName = function() {
* ol.FeatureStyleFunction|ol.StyleFunction} The feature style.
* @api
*/
_ol_Feature_.prototype.getStyle = function() {
Feature.prototype.getStyle = function() {
return this.style_;
};
@@ -187,7 +187,7 @@ _ol_Feature_.prototype.getStyle = function() {
* representing the current style of this feature.
* @api
*/
_ol_Feature_.prototype.getStyleFunction = function() {
Feature.prototype.getStyleFunction = function() {
return this.styleFunction_;
};
@@ -195,7 +195,7 @@ _ol_Feature_.prototype.getStyleFunction = function() {
/**
* @private
*/
_ol_Feature_.prototype.handleGeometryChange_ = function() {
Feature.prototype.handleGeometryChange_ = function() {
this.changed();
};
@@ -203,7 +203,7 @@ _ol_Feature_.prototype.handleGeometryChange_ = function() {
/**
* @private
*/
_ol_Feature_.prototype.handleGeometryChanged_ = function() {
Feature.prototype.handleGeometryChanged_ = function() {
if (this.geometryChangeKey_) {
_ol_events_.unlistenByKey(this.geometryChangeKey_);
this.geometryChangeKey_ = null;
@@ -224,7 +224,7 @@ _ol_Feature_.prototype.handleGeometryChanged_ = function() {
* @api
* @observable
*/
_ol_Feature_.prototype.setGeometry = function(geometry) {
Feature.prototype.setGeometry = function(geometry) {
this.set(this.geometryName_, geometry);
};
@@ -238,10 +238,10 @@ _ol_Feature_.prototype.setGeometry = function(geometry) {
* @api
* @fires ol.events.Event#event:change
*/
_ol_Feature_.prototype.setStyle = function(style) {
Feature.prototype.setStyle = function(style) {
this.style_ = style;
this.styleFunction_ = !style ?
undefined : _ol_Feature_.createStyleFunction(style);
undefined : Feature.createStyleFunction(style);
this.changed();
};
@@ -255,7 +255,7 @@ _ol_Feature_.prototype.setStyle = function(style) {
* @api
* @fires ol.events.Event#event:change
*/
_ol_Feature_.prototype.setId = function(id) {
Feature.prototype.setId = function(id) {
this.id_ = id;
this.changed();
};
@@ -268,7 +268,7 @@ _ol_Feature_.prototype.setId = function(id) {
* @param {string} name The property name of the default geometry.
* @api
*/
_ol_Feature_.prototype.setGeometryName = function(name) {
Feature.prototype.setGeometryName = function(name) {
_ol_events_.unlisten(
this, _ol_Object_.getChangeEventType(this.geometryName_),
this.handleGeometryChanged_, this);
@@ -288,7 +288,7 @@ _ol_Feature_.prototype.setGeometryName = function(name) {
* A feature style function, a single style, or an array of styles.
* @return {ol.FeatureStyleFunction} A style function.
*/
_ol_Feature_.createStyleFunction = function(obj) {
Feature.createStyleFunction = function(obj) {
var styleFunction;
if (typeof obj === 'function') {
@@ -317,4 +317,4 @@ _ol_Feature_.createStyleFunction = function(obj) {
}
return styleFunction;
};
export default _ol_Feature_;
export default Feature;

View File

@@ -2,7 +2,7 @@
* @module ol/format/EsriJSON
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {assert} from '../asserts.js';
import {containsExtent} from '../extent.js';
import {transformWithOptions} from '../format/Feature.js';
@@ -464,7 +464,7 @@ EsriJSON.prototype.readFeatureFromObject = function(
var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
var geometry = EsriJSON.readGeometry_(esriJSONFeature.geometry,
opt_options);
var feature = new _ol_Feature_();
var feature = new Feature();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
}

View File

@@ -6,7 +6,7 @@
// envelopes/extents, only geometries!
import {inherits} from '../index.js';
import {extend} from '../array.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import XMLFeature from '../format/XMLFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
@@ -244,7 +244,7 @@ GMLBase.prototype.readFeatureElement = function(node, objectStack) {
values[localName] = this.readGeometryElement(n, objectStack);
}
}
var feature = new _ol_Feature_(values);
var feature = new Feature(values);
if (geometryName) {
feature.setGeometryName(geometryName);
}

View File

@@ -2,7 +2,7 @@
* @module ol/format/GPX
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {includes} from '../array.js';
import {transformWithOptions} from '../format/Feature.js';
import XMLFeature from '../format/XMLFeature.js';
@@ -542,7 +542,7 @@ function readRte(node, objectStack) {
var geometry = new LineString(null);
geometry.setFlatCoordinates(layout, flatCoordinates);
transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
feature.setProperties(values);
return feature;
}
@@ -574,7 +574,7 @@ function readTrk(node, objectStack) {
var geometry = new MultiLineString(null);
geometry.setFlatCoordinates(layout, flatCoordinates, ends);
transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
feature.setProperties(values);
return feature;
}
@@ -596,7 +596,7 @@ function readWpt(node, objectStack) {
var layout = GPX.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new Point(coordinates, layout);
transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
feature.setProperties(values);
return feature;
}

View File

@@ -6,7 +6,7 @@
import {inherits} from '../index.js';
import {assert} from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import JSONFeature from '../format/JSONFeature.js';
import GeometryCollection from '../geom/GeometryCollection.js';
@@ -360,7 +360,7 @@ GeoJSON.prototype.readFeatureFromObject = function(object, opt_options) {
}
var geometry = readGeometry(geoJSONFeature.geometry, opt_options);
var feature = new _ol_Feature_();
var feature = new Feature();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
} else if (this.extractGeometryName_ && geoJSONFeature.geometry_name !== undefined) {

View File

@@ -2,7 +2,7 @@
* @module ol/format/IGC
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import TextFeature from '../format/TextFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
@@ -163,7 +163,7 @@ IGC.prototype.readFeatureFromText = function(text, opt_options) {
var lineString = new LineString(null);
var layout = altitudeMode == IGCZ.NONE ? GeometryLayout.XYM : GeometryLayout.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new _ol_Feature_(transformWithOptions(lineString, false, opt_options));
var feature = new Feature(transformWithOptions(lineString, false, opt_options));
feature.setProperties(properties);
return feature;
};

View File

@@ -2,7 +2,7 @@
* @module ol/format/KML
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {extend, includes} from '../array.js';
import {assert} from '../asserts.js';
import {asArray} from '../color.js';
@@ -1700,7 +1700,7 @@ KML.prototype.readPlacemark_ = function(node, objectStack) {
if (!object) {
return undefined;
}
var feature = new _ol_Feature_();
var feature = new Feature();
var id = node.getAttribute('id');
if (id !== null) {
feature.setId(id);

View File

@@ -4,7 +4,7 @@
// FIXME add typedef for stack state objects
import {inherits} from '../index.js';
import {extend} from '../array.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import XMLFeature from '../format/XMLFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
@@ -58,7 +58,7 @@ OSMXML.readNode_ = function(node, objectStack) {
if (!_ol_obj_.isEmpty(values.tags)) {
var geometry = new Point(coordinates);
transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
feature.setId(id);
feature.setProperties(values.tags);
state.features.push(feature);
@@ -193,7 +193,7 @@ OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
}
transformWithOptions(geometry, false, options);
var feature = new _ol_Feature_(geometry);
var feature = new Feature(geometry);
feature.setId(values.id);
feature.setProperties(values.tags);
state.features.push(feature);

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import {assert} from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import TextFeature from '../format/TextFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
@@ -282,7 +282,7 @@ Polyline.prototype.readFeature;
*/
Polyline.prototype.readFeatureFromText = function(text, opt_options) {
var geometry = this.readGeometryFromText(text, opt_options);
return new _ol_Feature_(geometry);
return new Feature(geometry);
};

View File

@@ -2,7 +2,7 @@
* @module ol/format/TopoJSON
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import JSONFeature from '../format/JSONFeature.js';
import LineString from '../geom/LineString.js';
@@ -260,7 +260,7 @@ function readFeatureFromGeometry(object, arcs, scale, translate, property, name,
} else {
geometry = geometryReader(object, arcs);
}
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
transformWithOptions(geometry, false, opt_options)));
if (object.id !== undefined) {

View File

@@ -2,7 +2,7 @@
* @module ol/format/WKT
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import {transformWithOptions} from '../format/Feature.js';
import TextFeature from '../format/TextFeature.js';
import GeometryCollection from '../geom/GeometryCollection.js';
@@ -269,7 +269,7 @@ WKT.prototype.readFeature;
WKT.prototype.readFeatureFromText = function(text, opt_options) {
var geom = this.readGeometryFromText(text, opt_options);
if (geom) {
var feature = new _ol_Feature_();
var feature = new Feature();
feature.setGeometry(geom);
return feature;
}
@@ -304,7 +304,7 @@ WKT.prototype.readFeaturesFromText = function(text, opt_options) {
}
var feature, features = [];
for (var i = 0, ii = geometries.length; i < ii; ++i) {
feature = new _ol_Feature_();
feature = new Feature();
feature.setGeometry(geometries[i]);
features.push(feature);
}

View File

@@ -2,7 +2,7 @@
* @module ol/interaction/Draw
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import _ol_Object_ from '../Object.js';
import _ol_coordinate_ from '../coordinate.js';
@@ -481,7 +481,7 @@ Draw.prototype.atFinish_ = function(event) {
Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
var coordinates = event.coordinate.slice();
if (!this.sketchPoint_) {
this.sketchPoint_ = new _ol_Feature_(new Point(coordinates));
this.sketchPoint_ = new Feature(new Point(coordinates));
this.updateSketchFeatures_();
} else {
var sketchPointGeom = /** @type {ol.geom.Point} */ (this.sketchPoint_.getGeometry());
@@ -510,11 +510,11 @@ Draw.prototype.startDrawing_ = function(event) {
}
}
if (this.sketchLineCoords_) {
this.sketchLine_ = new _ol_Feature_(
this.sketchLine_ = new Feature(
new LineString(this.sketchLineCoords_));
}
var geometry = this.geometryFunction_(this.sketchCoords_);
this.sketchFeature_ = new _ol_Feature_();
this.sketchFeature_ = new Feature();
if (this.geometryName_) {
this.sketchFeature_.setGeometryName(this.geometryName_);
}
@@ -557,7 +557,7 @@ Draw.prototype.modifyDrawing_ = function(event) {
if (geometry instanceof Polygon &&
this.mode_ !== Draw.Mode_.POLYGON) {
if (!this.sketchLine_) {
this.sketchLine_ = new _ol_Feature_(new LineString(null));
this.sketchLine_ = new Feature(new LineString(null));
}
var ring = geometry.getLinearRing(0);
sketchLineGeom = /** @type {ol.geom.LineString} */ (this.sketchLine_.getGeometry());

View File

@@ -2,7 +2,7 @@
* @module ol/interaction/Extent
*/
import {inherits} from '../index.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
import _ol_coordinate_ from '../coordinate.js';
@@ -374,9 +374,9 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
if (!extentFeature) {
if (!extent) {
extentFeature = new _ol_Feature_({});
extentFeature = new Feature({});
} else {
extentFeature = new _ol_Feature_(polygonFromExtent(extent));
extentFeature = new Feature(polygonFromExtent(extent));
}
this.extentFeature_ = extentFeature;
this.extentOverlay_.getSource().addFeature(extentFeature);
@@ -399,7 +399,7 @@ _ol_interaction_Extent_.prototype.createOrUpdateExtentFeature_ = function(extent
_ol_interaction_Extent_.prototype.createOrUpdatePointerFeature_ = function(vertex) {
var vertexFeature = this.vertexFeature_;
if (!vertexFeature) {
vertexFeature = new _ol_Feature_(new Point(vertex));
vertexFeature = new Feature(new Point(vertex));
this.vertexFeature_ = vertexFeature;
this.vertexOverlay_.getSource().addFeature(vertexFeature);
} else {

View File

@@ -4,7 +4,7 @@
import {getUid, inherits} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import CollectionEventType from '../CollectionEventType.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
import {equals} from '../array.js';
@@ -579,7 +579,7 @@ _ol_interaction_Modify_.prototype.writeGeometryCollectionGeometry_ = function(fe
_ol_interaction_Modify_.prototype.createOrUpdateVertexFeature_ = function(coordinates) {
var vertexFeature = this.vertexFeature_;
if (!vertexFeature) {
vertexFeature = new _ol_Feature_(new Point(coordinates));
vertexFeature = new Feature(new Point(coordinates));
this.vertexFeature_ = vertexFeature;
this.overlay_.getSource().addFeature(vertexFeature);
} else {

View File

@@ -4,7 +4,7 @@
import {getUid, inherits} from '../index.js';
import {assert} from '../asserts.js';
import _ol_Feature_ from '../Feature.js';
import Feature from '../Feature.js';
import _ol_coordinate_ from '../coordinate.js';
import EventType from '../events/EventType.js';
import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
@@ -191,7 +191,7 @@ _ol_source_Cluster_.prototype.createCluster = function(features) {
}
_ol_coordinate_.scale(centroid, 1 / features.length);
var cluster = new _ol_Feature_(new Point(centroid));
var cluster = new Feature(new Point(centroid));
cluster.set('features', features);
return cluster;
};