Remove vector code from files
This commit is contained in:
@@ -7,8 +7,6 @@
|
||||
@exportProperty ol.Map.prototype.getControls
|
||||
@exportProperty ol.Map.prototype.getEventCoordinate
|
||||
@exportProperty ol.Map.prototype.getEventPixel
|
||||
@exportProperty ol.Map.prototype.getFeatureInfo
|
||||
@exportProperty ol.Map.prototype.getFeatures
|
||||
@exportProperty ol.Map.prototype.getInteractions
|
||||
@exportProperty ol.Map.prototype.getLayers
|
||||
@exportProperty ol.Map.prototype.getOverlays
|
||||
|
||||
@@ -563,34 +563,6 @@ ol.Map.prototype.getOverlays = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get feature information for a pixel on the map.
|
||||
*
|
||||
* @param {ol.GetFeatureInfoOptions} options Options.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.Map.prototype.getFeatureInfo = function(options) {
|
||||
var layers = goog.isDefAndNotNull(options.layers) ?
|
||||
options.layers : this.getLayerGroup().getLayersArray();
|
||||
this.getRenderer().getFeatureInfoForPixel(
|
||||
options.pixel, layers, options.success, options.error);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get features for a pixel on the map.
|
||||
*
|
||||
* @param {ol.GetFeaturesOptions} options Options.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.Map.prototype.getFeatures = function(options) {
|
||||
var layers = goog.isDefAndNotNull(options.layers) ?
|
||||
options.layers : this.getLayerGroup().getLayersArray();
|
||||
this.getRenderer().getFeaturesForPixel(
|
||||
options.pixel, layers, options.success, options.error);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Gets the collection of
|
||||
* {@link ol.interaction|ol.interaction.Interaction} instances
|
||||
|
||||
@@ -9,11 +9,9 @@ goog.require('goog.style');
|
||||
goog.require('ol.css');
|
||||
goog.require('ol.layer.Image');
|
||||
goog.require('ol.layer.Tile');
|
||||
goog.require('ol.layer.Vector');
|
||||
goog.require('ol.renderer.Map');
|
||||
goog.require('ol.renderer.canvas.ImageLayer');
|
||||
goog.require('ol.renderer.canvas.TileLayer');
|
||||
goog.require('ol.renderer.canvas.VectorLayer2');
|
||||
goog.require('ol.source.State');
|
||||
|
||||
|
||||
@@ -62,8 +60,6 @@ ol.renderer.canvas.Map.prototype.createLayerRenderer = function(layer) {
|
||||
return new ol.renderer.canvas.ImageLayer(this, layer);
|
||||
} else if (layer instanceof ol.layer.Tile) {
|
||||
return new ol.renderer.canvas.TileLayer(this, layer);
|
||||
} else if (layer instanceof ol.layer.Vector) {
|
||||
return new ol.renderer.canvas.VectorLayer2(this, layer);
|
||||
} else {
|
||||
goog.asserts.fail();
|
||||
return null;
|
||||
|
||||
@@ -42,26 +42,6 @@ ol.renderer.Layer = function(mapRenderer, layer) {
|
||||
goog.inherits(ol.renderer.Layer, goog.Disposable);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel coordinate relative to the map viewport.
|
||||
* @param {function(string, ol.layer.Layer)} success Callback for
|
||||
* successful queries. The passed arguments are the resulting feature
|
||||
* information and the layer.
|
||||
* @param {function()=} opt_error Callback for unsuccessful queries.
|
||||
*/
|
||||
ol.renderer.Layer.prototype.getFeatureInfoForPixel =
|
||||
function(pixel, success, opt_error) {
|
||||
var layer = this.getLayer();
|
||||
var source = layer.getSource();
|
||||
if (goog.isFunction(source.getFeatureInfoForPixel)) {
|
||||
var callback = function(layerFeatureInfo) {
|
||||
success(layerFeatureInfo, layer);
|
||||
};
|
||||
source.getFeatureInfoForPixel(pixel, this.getMap(), callback, opt_error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @return {ol.layer.Layer} Layer.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
goog.provide('ol.renderer.Map');
|
||||
|
||||
goog.require('goog.Disposable');
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.dispose');
|
||||
goog.require('goog.functions');
|
||||
@@ -98,78 +97,6 @@ ol.renderer.Map.prototype.disposeInternal = function() {
|
||||
ol.renderer.Map.prototype.getCanvas = goog.functions.NULL;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel coordinate relative to the map viewport.
|
||||
* @param {Array.<ol.layer.Layer>} layers Layers to query.
|
||||
* @param {function(Array.<Array.<string|undefined>>)} success Callback for
|
||||
* successful queries. The passed argument is the resulting feature
|
||||
* information. Layers that are able to provide attribute data will put
|
||||
* ol.Feature instances, other layers will put a string which can either
|
||||
* be plain text or markup.
|
||||
* @param {function()=} opt_error Callback for unsuccessful
|
||||
* queries.
|
||||
*/
|
||||
ol.renderer.Map.prototype.getFeatureInfoForPixel =
|
||||
function(pixel, layers, success, opt_error) {
|
||||
var numLayers = layers.length;
|
||||
var featureInfo = new Array(numLayers);
|
||||
var callbackCount = 0;
|
||||
var callback = function(layerFeatureInfo, layer) {
|
||||
featureInfo[goog.array.indexOf(layers, layer)] = layerFeatureInfo;
|
||||
--callbackCount;
|
||||
if (callbackCount <= 0) {
|
||||
success(featureInfo);
|
||||
}
|
||||
};
|
||||
|
||||
var layer, layerRenderer;
|
||||
for (var i = 0; i < numLayers; ++i) {
|
||||
layer = layers[i];
|
||||
layerRenderer = this.getLayerRenderer(layer);
|
||||
if (goog.isFunction(layerRenderer.getFeatureInfoForPixel)) {
|
||||
++callbackCount;
|
||||
layerRenderer.getFeatureInfoForPixel(pixel, callback, opt_error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel coordinate relative to the map viewport.
|
||||
* @param {Array.<ol.layer.Layer>} layers Layers to query.
|
||||
* @param {function(Array.<Array.<ol.Feature|undefined>>)} success Callback for
|
||||
* successful queries. The passed argument is the resulting feature
|
||||
* information. Layers that are able to provide attribute data will put
|
||||
* ol.Feature instances, other layers will put a string which can either
|
||||
* be plain text or markup.
|
||||
* @param {function()=} opt_error Callback for unsuccessful
|
||||
* queries.
|
||||
*/
|
||||
ol.renderer.Map.prototype.getFeaturesForPixel =
|
||||
function(pixel, layers, success, opt_error) {
|
||||
var numLayers = layers.length;
|
||||
var features = new Array(numLayers);
|
||||
var callbackCount = 0;
|
||||
var callback = function(layerFeatures, layer) {
|
||||
features[goog.array.indexOf(layers, layer)] = layerFeatures;
|
||||
--callbackCount;
|
||||
if (callbackCount <= 0) {
|
||||
success(features);
|
||||
}
|
||||
};
|
||||
|
||||
var layer, layerRenderer;
|
||||
for (var i = 0; i < numLayers; ++i) {
|
||||
layer = layers[i];
|
||||
layerRenderer = this.getLayerRenderer(layer);
|
||||
if (goog.isFunction(layerRenderer.getFeaturesForPixel)) {
|
||||
++callbackCount;
|
||||
layerRenderer.getFeaturesForPixel(pixel, callback, opt_error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.layer.Layer} layer Layer.
|
||||
* @protected
|
||||
|
||||
@@ -5,7 +5,6 @@ goog.require('goog.object');
|
||||
goog.require('ol.Image');
|
||||
goog.require('ol.ImageUrlFunction');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.source.FeatureInfoSource');
|
||||
goog.require('ol.source.Image');
|
||||
goog.require('ol.source.wms');
|
||||
|
||||
@@ -14,7 +13,6 @@ goog.require('ol.source.wms');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.Image}
|
||||
* @implements {ol.source.FeatureInfoSource}
|
||||
* @param {ol.source.ImageWMSOptions} options Options.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
@@ -40,13 +38,6 @@ ol.source.ImageWMS = function(options) {
|
||||
imageUrlFunction: imageUrlFunction
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.source.WMSGetFeatureInfoOptions}
|
||||
*/
|
||||
this.getFeatureInfoOptions_ = goog.isDef(options.getFeatureInfoOptions) ?
|
||||
options.getFeatureInfoOptions : {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.Image}
|
||||
@@ -99,23 +90,6 @@ ol.source.ImageWMS.prototype.getImage =
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.ImageWMS.prototype.getFeatureInfoForPixel =
|
||||
function(pixel, map, success, opt_error) {
|
||||
var view = map.getView().getView2D();
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(goog.isDefAndNotNull(size));
|
||||
var extent = view.calculateExtent(size);
|
||||
var url = this.imageUrlFunction(extent, size, view.getProjection());
|
||||
goog.asserts.assert(goog.isDef(url),
|
||||
'ol.source.ImageWMS#imageUrlFunction does not return a URL');
|
||||
ol.source.wms.getFeatureInfo(url, pixel, this.getFeatureInfoOptions_, success,
|
||||
opt_error);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Update the user-provided params.
|
||||
* @param {Object} params Params.
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
goog.provide('ol.source.TileWMS');
|
||||
|
||||
goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.math');
|
||||
goog.require('goog.object');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.source.FeatureInfoSource');
|
||||
goog.require('ol.source.TileImage');
|
||||
goog.require('ol.source.wms');
|
||||
|
||||
@@ -18,7 +16,6 @@ goog.require('ol.source.wms');
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.TileImage}
|
||||
* @implements {ol.source.FeatureInfoSource}
|
||||
* @param {ol.source.TileWMSOptions} options Tile WMS options.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
@@ -105,13 +102,6 @@ ol.source.TileWMS = function(options) {
|
||||
tileCoordTransform, tileUrlFunction)
|
||||
});
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.source.WMSGetFeatureInfoOptions}
|
||||
*/
|
||||
this.getFeatureInfoOptions_ = goog.isDef(options.getFeatureInfoOptions) ?
|
||||
options.getFeatureInfoOptions : {};
|
||||
|
||||
};
|
||||
goog.inherits(ol.source.TileWMS, ol.source.TileImage);
|
||||
|
||||
@@ -135,29 +125,6 @@ ol.source.TileWMS.prototype.getParams = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.TileWMS.prototype.getFeatureInfoForPixel =
|
||||
function(pixel, map, success, opt_error) {
|
||||
var coord = map.getCoordinateFromPixel(pixel),
|
||||
view2D = map.getView().getView2D(),
|
||||
projection = view2D.getProjection(),
|
||||
tileGrid = goog.isNull(this.tileGrid) ?
|
||||
ol.tilegrid.getForProjection(projection) : this.tileGrid,
|
||||
tileCoord = tileGrid.getTileCoordForCoordAndResolution(coord,
|
||||
view2D.getResolution()),
|
||||
tileExtent = tileGrid.getTileCoordExtent(tileCoord),
|
||||
offset = map.getPixelFromCoordinate(ol.extent.getTopLeft(tileExtent)),
|
||||
url = this.tileUrlFunction(tileCoord, projection);
|
||||
goog.asserts.assert(goog.isDef(url),
|
||||
'ol.source.TileWMS#tileUrlFunction does not return a URL');
|
||||
ol.source.wms.getFeatureInfo(url,
|
||||
[pixel[0] - offset[0], pixel[1] - offset[1]], this.getFeatureInfoOptions_,
|
||||
success, opt_error);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -1,30 +1,9 @@
|
||||
goog.provide('ol.source.WMSGetFeatureInfoMethod');
|
||||
goog.provide('ol.source.wms');
|
||||
|
||||
goog.require('goog.net.XhrIo');
|
||||
goog.require('goog.object');
|
||||
goog.require('goog.uri.utils');
|
||||
|
||||
|
||||
/**
|
||||
* Method to use to get WMS feature info.
|
||||
* @enum {string}
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.source.WMSGetFeatureInfoMethod = {
|
||||
/**
|
||||
* Load the info in an IFRAME. Only works with `text/html` and `text/plain` as
|
||||
* `INFO_FORMAT`.
|
||||
*/
|
||||
IFRAME: 'iframe',
|
||||
/**
|
||||
* Use an asynchronous GET request. Requires CORS headers or a server at the
|
||||
* same origin as the application script.
|
||||
*/
|
||||
XHR_GET: 'xhr_get'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} baseUrl WMS base URL.
|
||||
* @param {Object.<string, string|number>} params Request parameters.
|
||||
@@ -61,62 +40,3 @@ ol.source.wms.getUrl =
|
||||
|
||||
return goog.uri.utils.appendParamsFromMap(baseUrl, baseParams);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} url URL as provided by the url function.
|
||||
* @param {ol.Pixel} pixel Pixel.
|
||||
* @param {ol.source.WMSGetFeatureInfoOptions} options Options as defined in the
|
||||
* source.
|
||||
* @param {function(string)} success Callback function for successful queries.
|
||||
* @param {function()=} opt_error Optional callback function for unsuccessful
|
||||
* queries.
|
||||
*/
|
||||
ol.source.wms.getFeatureInfo =
|
||||
function(url, pixel, options, success, opt_error) {
|
||||
// TODO: This could be done in a smarter way if the url function was not a
|
||||
// closure
|
||||
url = url.replace('REQUEST=GetMap', 'REQUEST=GetFeatureInfo')
|
||||
.replace(ol.source.wms.regExes.layers, 'LAYERS=$1&QUERY_LAYERS=$1');
|
||||
options = /** @type {ol.source.WMSGetFeatureInfoOptions} */
|
||||
(goog.isDef(options) ? goog.object.clone(options) : {});
|
||||
var localOptions = /** @type {ol.source.WMSGetFeatureInfoOptions} */ ({
|
||||
method: ol.source.WMSGetFeatureInfoMethod.IFRAME,
|
||||
params: {}
|
||||
});
|
||||
goog.object.extend(localOptions, options);
|
||||
var params = {'INFO_FORMAT': 'text/html'},
|
||||
version = parseFloat(url.match(ol.source.wms.regExes.version)[1]),
|
||||
x = Math.round(pixel[0]),
|
||||
y = Math.round(pixel[1]);
|
||||
if (version >= 1.3) {
|
||||
goog.object.extend(params, {'I': x, 'J': y});
|
||||
} else {
|
||||
goog.object.extend(params, {'X': x, 'Y': y});
|
||||
}
|
||||
goog.object.extend(params, localOptions.params);
|
||||
url = goog.uri.utils.appendParamsFromMap(url, params);
|
||||
if (localOptions.method == ol.source.WMSGetFeatureInfoMethod.IFRAME) {
|
||||
goog.global.setTimeout(function() {
|
||||
success('<iframe seamless src="' + url + '"></iframe>');
|
||||
}, 0);
|
||||
} else if (localOptions.method == ol.source.WMSGetFeatureInfoMethod.XHR_GET) {
|
||||
goog.net.XhrIo.send(url, function(event) {
|
||||
var xhr = event.target;
|
||||
if (xhr.isSuccess()) {
|
||||
success(xhr.getResponseText());
|
||||
} else if (goog.isDef(opt_error)) {
|
||||
opt_error();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {RegExp}
|
||||
*/
|
||||
ol.source.wms.regExes = {
|
||||
layers: (/LAYERS=([^&]+)/),
|
||||
version: (/VERSION=([^&]+)/)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user