Remove olx.source.VectorOptions
This commit is contained in:
-155
@@ -241,161 +241,6 @@ olx.source.TileArcGISRestOptions.prototype.transition;
|
|||||||
olx.source.TileArcGISRestOptions.prototype.urls;
|
olx.source.TileArcGISRestOptions.prototype.urls;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {{attributions: (ol.AttributionLike|undefined),
|
|
||||||
* features: (Array.<module:ol/Feature~Feature>|ol.Collection.<module:ol/Feature~Feature>|undefined),
|
|
||||||
* format: (ol.format.Feature|undefined),
|
|
||||||
* loader: (module:ol/Feature~FeatureLoader|undefined),
|
|
||||||
* overlaps: (boolean|undefined),
|
|
||||||
* strategy: (ol.LoadingStrategy|undefined),
|
|
||||||
* url: (string|module:ol/Feature~FeatureUrlFunction|undefined),
|
|
||||||
* useSpatialIndex: (boolean|undefined),
|
|
||||||
* wrapX: (boolean|undefined)}}
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attributions.
|
|
||||||
* @type {ol.AttributionLike|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.attributions;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Features. If provided as {@link ol.Collection}, the features in the source
|
|
||||||
* and the collection will stay in sync.
|
|
||||||
* @type {Array.<module:ol/Feature~Feature>|ol.Collection.<module:ol/Feature~Feature>|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.features;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The feature format used by the XHR feature loader when `url` is set.
|
|
||||||
* Required if `url` is set, otherwise ignored. Default is `undefined`.
|
|
||||||
* @type {ol.format.Feature|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.format;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The loader function used to load features, from a remote source for example.
|
|
||||||
* If this is not set and `url` is set, the source will create and use an XHR
|
|
||||||
* feature loader.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* var vectorSource = new ol.source.Vector({
|
|
||||||
* format: new ol.format.GeoJSON(),
|
|
||||||
* loader: function(extent, resolution, projection) {
|
|
||||||
* var proj = projection.getCode();
|
|
||||||
* var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
|
|
||||||
* 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
|
|
||||||
* 'outputFormat=application/json&srsname=' + proj + '&' +
|
|
||||||
* 'bbox=' + extent.join(',') + ',' + proj;
|
|
||||||
* var xhr = new XMLHttpRequest();
|
|
||||||
* xhr.open('GET', url);
|
|
||||||
* var onError = function() {
|
|
||||||
* vectorSource.removeLoadedExtent(extent);
|
|
||||||
* }
|
|
||||||
* xhr.onerror = onError;
|
|
||||||
* xhr.onload = function() {
|
|
||||||
* if (xhr.status == 200) {
|
|
||||||
* vectorSource.addFeatures(
|
|
||||||
* vectorSource.getFormat().readFeatures(xhr.responseText));
|
|
||||||
* } else {
|
|
||||||
* onError();
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* xhr.send();
|
|
||||||
* },
|
|
||||||
* strategy: ol.loadingstrategy.bbox
|
|
||||||
* });
|
|
||||||
* ```
|
|
||||||
* @type {module:ol/Feature~FeatureLoader|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.loader;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This source may have overlapping geometries. Default is `true`. Setting this
|
|
||||||
* to `false` (e.g. for sources with polygons that represent administrative
|
|
||||||
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
|
||||||
* stroke operations.
|
|
||||||
* @type {boolean|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.overlaps;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The loading strategy to use. By default an {@link ol.loadingstrategy.all}
|
|
||||||
* strategy is used, a one-off strategy which loads all features at once.
|
|
||||||
* @type {ol.LoadingStrategy|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.strategy;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setting this option instructs the source to load features using an XHR loader
|
|
||||||
* (see {@link ol.featureloader.xhr}). Use a `string` and an
|
|
||||||
* {@link ol.loadingstrategy.all} for a one-off download of all features from
|
|
||||||
* the given URL. Use a {@link module:ol/Feature~FeatureUrlFunction} to generate the url with
|
|
||||||
* other loading strategies.
|
|
||||||
* Requires `format` to be set as well.
|
|
||||||
* When default XHR feature loader is provided, the features will
|
|
||||||
* be transformed from the data projection to the view projection
|
|
||||||
* during parsing. If your remote data source does not advertise its projection
|
|
||||||
* properly, this transformation will be incorrect. For some formats, the
|
|
||||||
* default projection (usually EPSG:4326) can be overridden by setting the
|
|
||||||
* defaultDataProjection constructor option on the format.
|
|
||||||
* Note that if a source contains non-feature data, such as a GeoJSON geometry
|
|
||||||
* or a KML NetworkLink, these will be ignored. Use a custom loader to load these.
|
|
||||||
* @type {string|module:ol/Feature~FeatureUrlFunction|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.url;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* By default, an RTree is used as spatial index. When features are removed and
|
|
||||||
* added frequently, and the total number of features is low, setting this to
|
|
||||||
* `false` may improve performance.
|
|
||||||
*
|
|
||||||
* Note that
|
|
||||||
* {@link ol.source.Vector#getFeaturesInExtent},
|
|
||||||
* {@link ol.source.Vector#getClosestFeatureToCoordinate} and
|
|
||||||
* {@link ol.source.Vector#getExtent} cannot be used when `useSpatialIndex` is
|
|
||||||
* set to `false`, and {@link ol.source.Vector#forEachFeatureInExtent} will loop
|
|
||||||
* through all features.
|
|
||||||
*
|
|
||||||
* When set to `false`, the features will be maintained in an
|
|
||||||
* {@link ol.Collection}, which can be retrieved through
|
|
||||||
* {@link ol.source.Vector#getFeaturesCollection}.
|
|
||||||
*
|
|
||||||
* The default is `true`.
|
|
||||||
* @type {boolean|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.useSpatialIndex;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrap the world horizontally. Default is `true`. For vector editing across the
|
|
||||||
* -180° and 180° meridians to work properly, this should be set to `false`. The
|
|
||||||
* resulting geometry coordinates will then exceed the world bounds.
|
|
||||||
* @type {boolean|undefined}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
olx.source.VectorOptions.prototype.wrapX;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{attributions: (ol.AttributionLike|undefined),
|
* @typedef {{attributions: (ol.AttributionLike|undefined),
|
||||||
* cacheSize: (number|undefined),
|
* cacheSize: (number|undefined),
|
||||||
|
|||||||
+87
-1
@@ -48,6 +48,92 @@ export const VectorSourceEvent = function(type, opt_feature) {
|
|||||||
inherits(VectorSourceEvent, Event);
|
inherits(VectorSourceEvent, Event);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Options
|
||||||
|
* @property {ol.AttributionLike} [attributions] Attributions.
|
||||||
|
* @property {Array.<module:ol/Feature~Feature>|ol.Collection.<module:ol/Feature~Feature>} [features]
|
||||||
|
* Features. If provided as {@link ol.Collection}, the features in the source
|
||||||
|
* and the collection will stay in sync.
|
||||||
|
* @property {ol.format.Feature} [format=undefined] The feature format used by the XHR
|
||||||
|
* feature loader when `url` is set. Required if `url` is set, otherwise ignored.
|
||||||
|
* @property {module:ol/Feature~FeatureLoader} [loader]
|
||||||
|
* The loader function used to load features, from a remote source for example.
|
||||||
|
* If this is not set and `url` is set, the source will create and use an XHR
|
||||||
|
* feature loader.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* var vectorSource = new ol.source.Vector({
|
||||||
|
* format: new ol.format.GeoJSON(),
|
||||||
|
* loader: function(extent, resolution, projection) {
|
||||||
|
* var proj = projection.getCode();
|
||||||
|
* var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
|
||||||
|
* 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
|
||||||
|
* 'outputFormat=application/json&srsname=' + proj + '&' +
|
||||||
|
* 'bbox=' + extent.join(',') + ',' + proj;
|
||||||
|
* var xhr = new XMLHttpRequest();
|
||||||
|
* xhr.open('GET', url);
|
||||||
|
* var onError = function() {
|
||||||
|
* vectorSource.removeLoadedExtent(extent);
|
||||||
|
* }
|
||||||
|
* xhr.onerror = onError;
|
||||||
|
* xhr.onload = function() {
|
||||||
|
* if (xhr.status == 200) {
|
||||||
|
* vectorSource.addFeatures(
|
||||||
|
* vectorSource.getFormat().readFeatures(xhr.responseText));
|
||||||
|
* } else {
|
||||||
|
* onError();
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* xhr.send();
|
||||||
|
* },
|
||||||
|
* strategy: ol.loadingstrategy.bbox
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @property {boolean} [overlaps=true] This source may have overlapping geometries.
|
||||||
|
* Setting this to `false` (e.g. for sources with polygons that represent administrative
|
||||||
|
* boundaries or TopoJSON sources) allows the renderer to optimise fill and
|
||||||
|
* stroke operations.
|
||||||
|
* @property {ol.LoadingStrategy} [strategy] The loading strategy to use.
|
||||||
|
* By default an {@link ol.loadingstrategy.all}
|
||||||
|
* strategy is used, a one-off strategy which loads all features at once.
|
||||||
|
* @property {string|module:ol/Feature~FeatureUrlFunction} [url]
|
||||||
|
* Setting this option instructs the source to load features using an XHR loader
|
||||||
|
* (see {@link ol.featureloader.xhr}). Use a `string` and an
|
||||||
|
* {@link ol.loadingstrategy.all} for a one-off download of all features from
|
||||||
|
* the given URL. Use a {@link module:ol/Feature~FeatureUrlFunction} to generate the url with
|
||||||
|
* other loading strategies.
|
||||||
|
* Requires `format` to be set as well.
|
||||||
|
* When default XHR feature loader is provided, the features will
|
||||||
|
* be transformed from the data projection to the view projection
|
||||||
|
* during parsing. If your remote data source does not advertise its projection
|
||||||
|
* properly, this transformation will be incorrect. For some formats, the
|
||||||
|
* default projection (usually EPSG:4326) can be overridden by setting the
|
||||||
|
* defaultDataProjection constructor option on the format.
|
||||||
|
* Note that if a source contains non-feature data, such as a GeoJSON geometry
|
||||||
|
* or a KML NetworkLink, these will be ignored. Use a custom loader to load these.
|
||||||
|
* @property {boolean} [useSpatialIndex=true]
|
||||||
|
* By default, an RTree is used as spatial index. When features are removed and
|
||||||
|
* added frequently, and the total number of features is low, setting this to
|
||||||
|
* `false` may improve performance.
|
||||||
|
*
|
||||||
|
* Note that
|
||||||
|
* {@link ol.source.Vector#getFeaturesInExtent},
|
||||||
|
* {@link ol.source.Vector#getClosestFeatureToCoordinate} and
|
||||||
|
* {@link ol.source.Vector#getExtent} cannot be used when `useSpatialIndex` is
|
||||||
|
* set to `false`, and {@link ol.source.Vector#forEachFeatureInExtent} will loop
|
||||||
|
* through all features.
|
||||||
|
*
|
||||||
|
* When set to `false`, the features will be maintained in an
|
||||||
|
* {@link ol.Collection}, which can be retrieved through
|
||||||
|
* {@link ol.source.Vector#getFeaturesCollection}.
|
||||||
|
* @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the
|
||||||
|
* -180° and 180° meridians to work properly, this should be set to `false`. The
|
||||||
|
* resulting geometry coordinates will then exceed the world bounds.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Provides a source of features for vector layers. Vector features provided
|
* Provides a source of features for vector layers. Vector features provided
|
||||||
@@ -57,7 +143,7 @@ inherits(VectorSourceEvent, Event);
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Source}
|
* @extends {ol.source.Source}
|
||||||
* @fires ol.source.Vector.Event
|
* @fires ol.source.Vector.Event
|
||||||
* @param {olx.source.VectorOptions=} opt_options Vector source options.
|
* @param {module:ol/source/Vector~Options=} opt_options Vector source options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const VectorSource = function(opt_options) {
|
const VectorSource = function(opt_options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user