- Timestamp:
- 02/10/08 10:19:58 (13 years ago)
- Location:
- cows/trunk/cows/service
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cows/trunk/cows/service/imps/wms_csmllayer.py
r4228 r4266 20 20 import ConfigParser 21 21 22 from cows.service.wxs_iface import ILayerMapper 23 from cows.service.wms_iface import IwmsLayer, IwmsDimension, IwmsLayerSlab 24 22 25 try: 23 26 from ndgUtils import ndgObject, ndgRetrieve … … 26 29 27 30 28 class CSMLLayerMapper(object): 31 32 33 class CSMLLayerMapper(ILayerMapper): 29 34 """ 30 35 Map keyword arguments to a collection of layers. … … 128 133 129 134 130 class CSMLLayer( object):135 class CSMLLayer(IwmsLayer): 131 136 """ 132 137 representing a WMS layer. Implements ILayer … … 294 299 295 300 296 class CSMLDimension( object):301 class CSMLDimension(IwmsDimension): 297 302 """ 298 303 implements IDimension … … 322 327 self.units='ISO8601' 323 328 324 class CSMLLayerSlab( object):329 class CSMLLayerSlab(IwmsLayerSlab): 325 330 """ 326 331 Implements LayerSlab -
cows/trunk/cows/service/imps/wms_gdal.py
r4106 r4266 9 9 10 10 """ 11 12 from cows.service.wms_iface import *11 from cows.service.wxs_iface import ILayerMapper 12 from cows.service.wms_iface import IwmsLayer, IwmsDimension, IwmsLayerSlab 13 13 from cows.bbox_util import geoToPixel 14 14 from osgeo import osr, gdal … … 67 67 68 68 69 class GDALLayer(I Layer):70 """ 71 This implementation of I Layer can warp images from a source CRS to69 class GDALLayer(IwmsLayer): 70 """ 71 This implementation of IwmsLayer can warp images from a source CRS to 72 72 various other CRSs. 73 73 … … 129 129 return str((x, y)) 130 130 131 class GDALLayerSlab(I LayerSlab):131 class GDALLayerSlab(IwmsLayerSlab): 132 132 def __init__(self, layer, crs, dimValues=None, renderOpts={}): 133 133 self.layer = layer -
cows/trunk/cows/service/imps/wms_layers.py
r4228 r4266 18 18 from matplotlib import dates 19 19 20 from cows.service.wxs_iface import ILayerMapper 21 from cows.service.wms_iface import IwmsLayer, IwmsDimension, IwmsLayerSlab 22 20 23 import logging 21 24 log = logging.getLogger(__name__) 22 25 23 class WMSLayerMapper( object):26 class WMSLayerMapper(ILayerMapper): 24 27 """ 25 28 Map keyword arguments to a collection of layers. … … 111 114 112 115 113 class StationLayer( object):116 class StationLayer(IwmsLayer): 114 117 """ 115 118 representing a WMS layer for MIDAS/ECN Stations. Implements ILayer … … 238 241 return legImage 239 242 240 class StationDimension( object):243 class StationDimension(IwmsDimension): 241 244 """ 242 245 implements IDimension … … 255 258 256 259 257 class StationLayerSlab( object):260 class StationLayerSlab(IwmsLayerSlab): 258 261 """ 259 262 Implements LayerSlab -
cows/trunk/cows/service/wms_iface.py
r4008 r4266 1 1 """ 2 2 The classes in this module define an interface between the OWS Pylons 3 server and components that provide Web Map Server layers. The 4 intention is that a WMS can be created for a given datatype and 5 renderring engine by creating classes that implement these interfaces 6 -- there is no need to mess around with Pylons controllers or the 7 cows metadata model. 3 server and components that provide Web Map Server layers. They extend the interfaces 4 defined in wxs_iface.py. 8 5 9 6 The interface was designed with several requirements in mind: … … 14 11 - To hide how layers are actually retrieved and rendered from ows_server. 15 12 16 The main entry point for the OWS Pylons server is the ILayerMapper 17 interface. This provides a mechanism for serving multiple WMS 18 endpoints through a single server. Keywords deduced from the pylons 19 routes mapper are passed to the ILayerMapper instance to return a 20 dictionary of ILayer instances. These are the layers available to the 21 WMS on this route. 22 23 ILayer instances provide dimension and CRS information to the server 13 IwmsLayer instances provide dimension and CRS information to the server 24 14 and can render a legend. A layer image is requested by a two stage 25 15 process. First the CRS and non-geospatial dimensions are selected 26 through I Layer to return a ILayerSlab instance. WMS images are then27 retrieved through I LayerSlab for a given bounding box.16 through IwmsLayer to return a IwmsLayerSlab instance. WMS images are then 17 retrieved through IwmsLayerSlab for a given bounding box. 28 18 29 19 This allows implementations to cache the result if it makes sense to 30 do so. implementing I Layer.getCacheKey() will cause the server to31 cache I LayerSlab objects for future use, therefore not requiring32 repeated calls to I Layer.getSlab(). This strategy works well with20 do so. implementing IwmsLayer.getCacheKey() will cause the server to 21 cache IwmsLayerSlab objects for future use, therefore not requiring 22 repeated calls to IwmsLayer.getSlab(). This strategy works well with 33 23 tiling WMS clients that will make multiple GetMap requests with the 34 24 same CRS and dimension parameters. 35 25 36 It is expected that implementing classes will inherit from these37 interface classes, using them as abstract base classes. However, in38 the future zope.Interface might be used to associate interfaces with39 implementations.40 26 41 27 42 28 """ 43 29 44 class ILayerMapper(object): 45 """ 46 Maps keyword arguments to a collection of layers. 30 from wxs_iface import ILayer 47 31 48 ILayerMapper supports the retrieval of sets of layers according to arbitary49 keyword/value pairs.50 51 """52 def map(self, **kwargs):53 """54 Given arbitary keywords/value pairs list the names of55 all layers available.56 57 @return: A mapping of layer names to ILayer implementations.58 @raise ValueError: If no layers are available for these keywords.59 60 """61 raise NotImplementedError62 32 63 33 64 class I Layer(object):34 class IwmsLayer(ILayer): 65 35 """ 66 An interface representing a WMS layer. 67 68 @ivar title: The layer title. As seen in the Capabilities document. 69 @ivar abstract: Abstract as seen in the Capabilities document. 70 @ivar dimensions: A mapping of dimension names to IDimension objects. 71 @ivar units: A string describing the units. 72 @ivar crss: A sequence of SRS/CRSs supported by this layer. 73 @ivar wgs84BBox: The bounding box in CRS:84 (lat/lon) 36 An interface representing a WMS layer, based on ILayer. 37 74 38 @ivar legendSize: (width, height) in pixels of legend. 75 39 … … 81 45 82 46 """ 83 title = abstract = dimensions = units = crss = wgs84BBox = NotImplemented84 featureInfoFormats = NotImplemented85 47 86 def getBBox(self, crs):87 """88 @return: the bounding box (llx, lly, urx, ury) in the given89 coordinate reference system.90 91 """92 raise NotImplementedError93 48 94 49 def getSlab(self, crs, dimValues=None, renderOpts={}): … … 150 105 151 106 152 class I Dimension(object):107 class IwmsDimension(object): 153 108 """ 154 109 An interface representing a WMS dimension … … 160 115 units = extent = NotImplemented 161 116 162 class I LayerSlab(object):117 class IwmsLayerSlab(object): 163 118 """ 164 119 An interface representing a particular horizontal slice of a WMS layer. 165 120 166 I LayerSlab objects are designed to be convenient to cache.121 IwmsLayerSlab objects are designed to be convenient to cache. 167 122 Ideally they should be pickleable to enable memcached support in 168 123 the future. 169 124 170 @ivar layer: The source I Layer instance.125 @ivar layer: The source IwmsLayer instance. 171 126 @ivar crs: The coordinate reference system. 172 127 @ivar dimValues: A mapping of dimension values of this view.
Note: See TracChangeset
for help on using the changeset viewer.