@@ -41,7 +41,7 @@
|
|||||||
<p id="shortdesc">Example of two single image WMS layers.</p>
|
<p id="shortdesc">Example of two single image WMS layers.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
|
<p>Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
|
||||||
<p>See the <a href="wms-single-image-custom-proj.js" target="_blank">wms-single-image-custom-proj.js source</a> to see how this is done.</p>
|
<p>See the <a href="wms-image-custom-proj.js" target="_blank">wms-image-custom-proj.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">wms, single image, projection</div>
|
<div id="tags">wms, single image, projection</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/proj4js-compressed.js" type="text/javascript"></script>
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/defs/EPSG21781.js" type="text/javascript"></script>
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/1.1.0/defs/EPSG21781.js" type="text/javascript"></script>
|
||||||
<script src="loader.js?id=wms-single-image-custom-proj" type="text/javascript"></script>
|
<script src="loader.js?id=wms-image-custom-proj" type="text/javascript"></script>
|
||||||
<script src="../resources/social-links.js" type="text/javascript"></script>
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@@ -4,7 +4,7 @@ goog.require('ol.RendererHints');
|
|||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.Image');
|
goog.require('ol.layer.Image');
|
||||||
goog.require('ol.proj');
|
goog.require('ol.proj');
|
||||||
goog.require('ol.source.SingleImageWMS');
|
goog.require('ol.source.ImageWMS');
|
||||||
|
|
||||||
|
|
||||||
var projection = ol.proj.configureProj4jsProjection({
|
var projection = ol.proj.configureProj4jsProjection({
|
||||||
@@ -15,7 +15,7 @@ var projection = ol.proj.configureProj4jsProjection({
|
|||||||
var extent = [420000, 900000, 30000, 350000];
|
var extent = [420000, 900000, 30000, 350000];
|
||||||
var layers = [
|
var layers = [
|
||||||
new ol.layer.Image({
|
new ol.layer.Image({
|
||||||
source: new ol.source.SingleImageWMS({
|
source: new ol.source.ImageWMS({
|
||||||
url: 'http://wms.geo.admin.ch/',
|
url: 'http://wms.geo.admin.ch/',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
attributions: [new ol.Attribution({
|
attributions: [new ol.Attribution({
|
||||||
@@ -32,7 +32,7 @@ var layers = [
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
new ol.layer.Image({
|
new ol.layer.Image({
|
||||||
source: new ol.source.SingleImageWMS({
|
source: new ol.source.ImageWMS({
|
||||||
url: 'http://wms.geo.admin.ch/',
|
url: 'http://wms.geo.admin.ch/',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
attributions: [new ol.Attribution({
|
attributions: [new ol.Attribution({
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<h4 id="title">Single image WMS example</h4>
|
<h4 id="title">Single image WMS example</h4>
|
||||||
<p id="shortdesc">Example of a single image WMS layer.</p>
|
<p id="shortdesc">Example of a single image WMS layer.</p>
|
||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>See the <a href="wms-single-image.js" target="_blank">wms-single-image.js source</a> to see how this is done.</p>
|
<p>See the <a href="wms-image.js" target="_blank">wms-image.js source</a> to see how this is done.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="tags">wms, image</div>
|
<div id="tags">wms, image</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="loader.js?id=wms-single-image" type="text/javascript"></script>
|
<script src="loader.js?id=wms-image" type="text/javascript"></script>
|
||||||
<script src="../resources/social-links.js" type="text/javascript"></script>
|
<script src="../resources/social-links.js" type="text/javascript"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@@ -3,8 +3,8 @@ goog.require('ol.RendererHint');
|
|||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.Image');
|
goog.require('ol.layer.Image');
|
||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
|
goog.require('ol.source.ImageWMS');
|
||||||
goog.require('ol.source.MapQuestOpenAerial');
|
goog.require('ol.source.MapQuestOpenAerial');
|
||||||
goog.require('ol.source.SingleImageWMS');
|
|
||||||
|
|
||||||
|
|
||||||
var layers = [
|
var layers = [
|
||||||
@@ -12,7 +12,7 @@ var layers = [
|
|||||||
source: new ol.source.MapQuestOpenAerial()
|
source: new ol.source.MapQuestOpenAerial()
|
||||||
}),
|
}),
|
||||||
new ol.layer.Image({
|
new ol.layer.Image({
|
||||||
source: new ol.source.SingleImageWMS({
|
source: new ol.source.ImageWMS({
|
||||||
url: 'http://demo.opengeo.org/geoserver/wms',
|
url: 'http://demo.opengeo.org/geoserver/wms',
|
||||||
params: {'LAYERS': 'topp:states'},
|
params: {'LAYERS': 'topp:states'},
|
||||||
extent: [-13884991, -7455066, 2870341, 6338219]
|
extent: [-13884991, -7455066, 2870341, 6338219]
|
||||||
@@ -6,7 +6,7 @@ goog.require('ol.RendererHints');
|
|||||||
goog.require('ol.View2D');
|
goog.require('ol.View2D');
|
||||||
goog.require('ol.layer.Image');
|
goog.require('ol.layer.Image');
|
||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
goog.require('ol.source.SingleImageWMS');
|
goog.require('ol.source.ImageWMS');
|
||||||
goog.require('ol.source.TileWMS');
|
goog.require('ol.source.TileWMS');
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ var layers = [
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
new ol.layer.Image({
|
new ol.layer.Image({
|
||||||
source: new ol.source.SingleImageWMS({
|
source: new ol.source.ImageWMS({
|
||||||
attributions: [new ol.Attribution({
|
attributions: [new ol.Attribution({
|
||||||
html: '© ' +
|
html: '© ' +
|
||||||
'<a href="http://www.geo.admin.ch/internet/geoportal/' +
|
'<a href="http://www.geo.admin.ch/internet/geoportal/' +
|
||||||
|
|||||||
@@ -472,7 +472,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.source.SingleImageWMSOptions
|
* @typedef {Object} ol.source.ImageWMSOptions
|
||||||
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
||||||
* @property {null|string|undefined} crossOrigin crossOrigin setting for image
|
* @property {null|string|undefined} crossOrigin crossOrigin setting for image
|
||||||
* requests.
|
* requests.
|
||||||
@@ -510,7 +510,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ol.source.StaticImageOptions
|
* @typedef {Object} ol.source.ImageStaticOptions
|
||||||
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
|
||||||
* @property {null|string|undefined} crossOrigin crossOrigin setting for image
|
* @property {null|string|undefined} crossOrigin crossOrigin setting for image
|
||||||
* requests.
|
* requests.
|
||||||
|
|||||||
1
src/ol/source/imagestaticsource.exports
Normal file
1
src/ol/source/imagestaticsource.exports
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@exportClass ol.source.ImageStatic ol.source.ImageStaticOptions
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
goog.provide('ol.source.StaticImage');
|
goog.provide('ol.source.ImageStatic');
|
||||||
|
|
||||||
goog.require('ol.Image');
|
goog.require('ol.Image');
|
||||||
goog.require('ol.ImageUrlFunctionType');
|
goog.require('ol.ImageUrlFunctionType');
|
||||||
@@ -11,11 +11,11 @@ goog.require('ol.source.Image');
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Image}
|
* @extends {ol.source.Image}
|
||||||
* @param {ol.source.StaticImageOptions} options Static image options.
|
* @param {ol.source.ImageStaticOptions} options Options.
|
||||||
*/
|
*/
|
||||||
ol.source.StaticImage = function(options) {
|
ol.source.ImageStatic = function(options) {
|
||||||
|
|
||||||
var imageFunction = ol.source.StaticImage.createImageFunction(
|
var imageFunction = ol.source.ImageStatic.createImageFunction(
|
||||||
options.url);
|
options.url);
|
||||||
|
|
||||||
var imageExtent = options.imageExtent;
|
var imageExtent = options.imageExtent;
|
||||||
@@ -40,13 +40,13 @@ ol.source.StaticImage = function(options) {
|
|||||||
imageExtent, imageResolution, imageSize, projection);
|
imageExtent, imageResolution, imageSize, projection);
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.source.StaticImage, ol.source.Image);
|
goog.inherits(ol.source.ImageStatic, ol.source.Image);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.StaticImage.prototype.getImage =
|
ol.source.ImageStatic.prototype.getImage =
|
||||||
function(extent, resolution, projection) {
|
function(extent, resolution, projection) {
|
||||||
if (ol.extent.intersects(extent, this.image_.getExtent())) {
|
if (ol.extent.intersects(extent, this.image_.getExtent())) {
|
||||||
return this.image_;
|
return this.image_;
|
||||||
@@ -59,7 +59,7 @@ ol.source.StaticImage.prototype.getImage =
|
|||||||
* @param {string|undefined} url URL.
|
* @param {string|undefined} url URL.
|
||||||
* @return {ol.ImageUrlFunctionType} Function.
|
* @return {ol.ImageUrlFunctionType} Function.
|
||||||
*/
|
*/
|
||||||
ol.source.StaticImage.createImageFunction = function(url) {
|
ol.source.ImageStatic.createImageFunction = function(url) {
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
3
src/ol/source/imagewmssource.exports
Normal file
3
src/ol/source/imagewmssource.exports
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@exportClass ol.source.ImageWMS ol.source.ImageWMSOptions
|
||||||
|
@exportProperty ol.source.ImageWMS.prototype.getParams
|
||||||
|
@exportProperty ol.source.ImageWMS.prototype.updateParams
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
goog.provide('ol.source.SingleImageWMS');
|
goog.provide('ol.source.ImageWMS');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
@@ -15,9 +15,9 @@ goog.require('ol.source.wms');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Image}
|
* @extends {ol.source.Image}
|
||||||
* @implements {ol.source.FeatureInfoSource}
|
* @implements {ol.source.FeatureInfoSource}
|
||||||
* @param {ol.source.SingleImageWMSOptions} options Options.
|
* @param {ol.source.ImageWMSOptions} options Options.
|
||||||
*/
|
*/
|
||||||
ol.source.SingleImageWMS = function(options) {
|
ol.source.ImageWMS = function(options) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -60,7 +60,7 @@ ol.source.SingleImageWMS = function(options) {
|
|||||||
options.ratio : 1.5;
|
options.ratio : 1.5;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.source.SingleImageWMS, ol.source.Image);
|
goog.inherits(ol.source.ImageWMS, ol.source.Image);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,7 +68,7 @@ goog.inherits(ol.source.SingleImageWMS, ol.source.Image);
|
|||||||
* the "params" option, and possibly updated using the updateParams method.
|
* the "params" option, and possibly updated using the updateParams method.
|
||||||
* @return {Object} Params.
|
* @return {Object} Params.
|
||||||
*/
|
*/
|
||||||
ol.source.SingleImageWMS.prototype.getParams = function() {
|
ol.source.ImageWMS.prototype.getParams = function() {
|
||||||
return this.params_;
|
return this.params_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ ol.source.SingleImageWMS.prototype.getParams = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.SingleImageWMS.prototype.getImage =
|
ol.source.ImageWMS.prototype.getImage =
|
||||||
function(extent, resolution, projection) {
|
function(extent, resolution, projection) {
|
||||||
resolution = this.findNearestResolution(resolution);
|
resolution = this.findNearestResolution(resolution);
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ ol.source.SingleImageWMS.prototype.getImage =
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.source.SingleImageWMS.prototype.getFeatureInfoForPixel =
|
ol.source.ImageWMS.prototype.getFeatureInfoForPixel =
|
||||||
function(pixel, map, success, opt_error) {
|
function(pixel, map, success, opt_error) {
|
||||||
var view2D = map.getView().getView2D(),
|
var view2D = map.getView().getView2D(),
|
||||||
projection = view2D.getProjection(),
|
projection = view2D.getProjection(),
|
||||||
@@ -111,7 +111,7 @@ ol.source.SingleImageWMS.prototype.getFeatureInfoForPixel =
|
|||||||
extent = [bottomLeft[0], topRight[0], bottomLeft[1], topRight[1]],
|
extent = [bottomLeft[0], topRight[0], bottomLeft[1], topRight[1]],
|
||||||
url = this.imageUrlFunction(extent, size, projection);
|
url = this.imageUrlFunction(extent, size, projection);
|
||||||
goog.asserts.assert(goog.isDef(url),
|
goog.asserts.assert(goog.isDef(url),
|
||||||
'ol.source.SingleImageWMS#imageUrlFunction does not return a url');
|
'ol.source.ImageWMS#imageUrlFunction does not return a url');
|
||||||
ol.source.wms.getFeatureInfo(url, pixel, this.getFeatureInfoOptions_, success,
|
ol.source.wms.getFeatureInfo(url, pixel, this.getFeatureInfoOptions_, success,
|
||||||
opt_error);
|
opt_error);
|
||||||
};
|
};
|
||||||
@@ -121,7 +121,7 @@ ol.source.SingleImageWMS.prototype.getFeatureInfoForPixel =
|
|||||||
* Update the user-provided params.
|
* Update the user-provided params.
|
||||||
* @param {Object} params Params.
|
* @param {Object} params Params.
|
||||||
*/
|
*/
|
||||||
ol.source.SingleImageWMS.prototype.updateParams = function(params) {
|
ol.source.ImageWMS.prototype.updateParams = function(params) {
|
||||||
goog.object.extend(this.params_, params);
|
goog.object.extend(this.params_, params);
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
@exportClass ol.source.SingleImageWMS ol.source.SingleImageWMSOptions
|
|
||||||
@exportProperty ol.source.SingleImageWMS.prototype.getParams
|
|
||||||
@exportProperty ol.source.SingleImageWMS.prototype.updateParams
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
@exportClass ol.source.StaticImage ol.source.StaticImageOptions
|
|
||||||
Reference in New Issue
Block a user