Merge pull request #1412 from fredj/vector-api-hidpi-cleanup

[vector-api] hidpi cleanup
This commit is contained in:
Éric Lemoine
2013-12-20 07:51:10 -08:00
6 changed files with 13 additions and 9 deletions

View File

@@ -28,7 +28,7 @@ var layers = [
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale', 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'FORMAT': 'image/jpeg' 'FORMAT': 'image/jpeg'
}, },
serverType: 'mapserver', serverType: /** @type {ol.source.wms.ServerType} */ ('mapserver'),
extent: extent extent: extent
}) })
}), }),
@@ -43,7 +43,7 @@ var layers = [
'National parks / geo.admin.ch</a>' 'National parks / geo.admin.ch</a>'
})], })],
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
serverType: 'mapserver', serverType: /** @type {ol.source.wms.ServerType} */ ('mapserver'),
extent: extent extent: extent
}) })
}) })

View File

@@ -15,7 +15,7 @@ var layers = [
source: new ol.source.ImageWMS({ 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'},
serverType: 'geoserver', serverType: /** @type {ol.source.wms.ServerType} */ ('geoserver'),
extent: [-13884991, 2870341, -7455066, 6338219] extent: [-13884991, 2870341, -7455066, 6338219]
}) })
}) })

View File

@@ -37,7 +37,7 @@ var layers = [
})], })],
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}, params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
serverType: 'mapserver', serverType: /** @type {ol.source.wms.ServerType} */ ('mapserver'),
url: 'http://wms.geo.admin.ch/' url: 'http://wms.geo.admin.ch/'
}) })
}) })

View File

@@ -543,9 +543,6 @@
* @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} extent Extent.
* @property {boolean|undefined} hidpi Use the `ol.Map#devicePixelRatio` value when * @property {boolean|undefined} hidpi Use the `ol.Map#devicePixelRatio` value when
* requesting the image from the remote server. Default is `true`. * requesting the image from the remote server. Default is `true`.
* @property {ol.source.wms.ServerType|undefined} serverType The type of the remote WMS
* server: `mapserver`, `geoserver` or `qgis`. Only needed if `hidpi` is `true`.
* Default is `undefined`.
* @property {boolean|undefined} useOverlay If `true`, will use * @property {boolean|undefined} useOverlay If `true`, will use
* `GETDYNAMICMAPOVERLAYIMAGE`. * `GETDYNAMICMAPOVERLAYIMAGE`.
* @property {ol.proj.ProjectionLike} projection Projection. * @property {ol.proj.ProjectionLike} projection Projection.
@@ -607,6 +604,9 @@
* @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} extent Extent.
* @property {boolean|undefined} hidpi Use the `ol.Map#devicePixelRatio` value when * @property {boolean|undefined} hidpi Use the `ol.Map#devicePixelRatio` value when
* requesting the image from the remote server. Default is `true`. * requesting the image from the remote server. Default is `true`.
* @property {ol.source.wms.ServerType|undefined} serverType The type of the remote WMS
* server: `mapserver`, `geoserver` or `qgis`. Only needed if `hidpi` is `true`.
* Default is `undefined`.
* @property {Object.<string,*>} params WMS request parameters. At least a * @property {Object.<string,*>} params WMS request parameters. At least a
* `LAYERS` param is required. `STYLES` is `` by default. `VERSION` is * `LAYERS` param is required. `STYLES` is `` by default. `VERSION` is
* `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS * `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS

View File

@@ -0,0 +1,4 @@
@exportSymbol ol.source.wms.ServerType
@exportProperty ol.source.wms.ServerType.GEOSERVER
@exportProperty ol.source.wms.ServerType.MAPSERVER
@exportProperty ol.source.wms.ServerType.QGIS

View File

@@ -10,8 +10,8 @@ goog.require('goog.uri.utils');
* @enum {string} * @enum {string}
*/ */
ol.source.wms.ServerType = { ol.source.wms.ServerType = {
MAPSERVER: 'mapserver',
GEOSERVER: 'geoserver', GEOSERVER: 'geoserver',
MAPSERVER: 'mapserver',
QGIS: 'qgis' QGIS: 'qgis'
}; };
@@ -63,7 +63,7 @@ ol.source.wms.getDpiParam = function(serverType, pixelRatio) {
if (serverType == ol.source.wms.ServerType.MAPSERVER) { if (serverType == ol.source.wms.ServerType.MAPSERVER) {
param['MAP_RESOLUTION'] = 90 * pixelRatio; param['MAP_RESOLUTION'] = 90 * pixelRatio;
} else if (serverType == ol.source.wms.ServerType.GEOSERVER) { } else if (serverType == ol.source.wms.ServerType.GEOSERVER) {
param['FORMAT_OPTION'] = 'dpi:' + 90 * pixelRatio; param['FORMAT_OPTIONS'] = 'dpi:' + 90 * pixelRatio;
} else if (serverType == ol.source.wms.ServerType.QGIS) { } else if (serverType == ol.source.wms.ServerType.QGIS) {
param['DPI'] = 90 * pixelRatio; param['DPI'] = 90 * pixelRatio;
} else { } else {