Changeset 3806
- Timestamp:
- 21/04/08 12:11:53 (13 years ago)
- Location:
- TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_3_0.xml
r3696 r3806 138 138 139 139 </Service> 140 141 140 <!--! These fields are represented in ows_common as service constraints --> 142 141 <Capability py:with="sm=c.capabilities; om=sm.operationsMetadata"> 143 142 <py:if test="om is not None"> 144 <?python ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo'] ?> 143 <?python 144 ops = ['GetCapabilities', 'GetMap', 'GetFeatureInfo'] 145 eops = [x for x in om.operationDict.keys() if x not in ops] 146 ?> 145 147 <Request> 146 148 <py:for each="opName in ops" py:if="opName in om.operationDict.keys()"> … … 155 157 </py:for> 156 158 </Request> 159 <_ExtendedCapabilities> 160 <Request> 161 <py:for each="opName in eops"> 162 <span py:content="markupOperation(opName, om.operationDict[opName])" py:strip="True"/> 163 </py:for> 164 <py:for each="opName in eops"> 165 <?python exceptions = om.operationDict[opName].parameters.get('ExceptionFormat') ?> 166 <Exception py:if="exceptions is not None"> 167 <Format py:for="e in exceptions.possibleValues.allowedValues" 168 py:content="e"/> 169 </Exception> 170 </py:for> 171 </Request> 172 </_ExtendedCapabilities> 157 173 </py:if> 158 174 -
TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/wms_controller.py
r3786 r3806 108 108 dims = {} 109 109 for dimName, dim in layer.dimensions.items(): 110 dims[dimName] = Dimension(valuesUnit=dim.units, 110 dimParam = self._mapDimToParam(dimName) 111 dims[dimParam] = Dimension(valuesUnit=dim.units, 111 112 unitSymbol=dim.units, 112 113 possibleValues= … … 202 203 return format 203 204 205 _escapedDimNames = ['width', 'height', 'version', 'request', 206 'layers', 'styles', 'crs', 'srs', 'bbox', 207 'format', 'transparent', 'bgcolor', 208 'exceptions'] 209 210 def _getDimValues(self, layerObj): 211 dimValues = {} 212 for dimName, dim in layerObj.dimensions.items(): 213 defaultValue = dim.extent[0] 214 dimValues[dimName] = self.getOwsParam(dimName, 215 default=defaultValue) 216 return dimValues 217 218 def _mapDimToParam(self, dimName): 219 """ 220 Dimension names might clash with WMS parameter names, making 221 them inaccessible in WMS requests. This method maps a 222 dimension name to a parameter name that appears in the 223 capabilities document and WMS requests. 224 225 """ 226 if dimName.lower() in self._escapedDimNames: 227 return dimName+'_dim' 228 else: 229 return dimName 230 231 def _mapParamToDim(self, dimParam): 232 """ 233 Maps a dimension parameter name to it's real dimension name. 234 235 @see: _mapDimToParam() 236 237 """ 238 try: 239 dimName = re.match(r'(.*)_dim$', dimParam).group(1) 240 if dimName.lower() in self._escapedDimNames: 241 return dimName 242 else: 243 return dimParam 244 except AttributeError: 245 return dimParam 246 247 248 def _retrieveSlab(self, layerObj, srs, dimValues, renderOpts): 249 # Find the slab in the cache first 250 cacheKey = layerObj.getCacheKey(srs, dimValues) 251 252 slab = self._layerSlabCache.get(cacheKey) 253 if slab is None: 254 slab = layerObj.getSlab(srs, dimValues, renderOpts) 255 if cacheKey is not None: 256 self._layerSlabCache[cacheKey] = slab 257 258 return slab 259 204 260 #------------------------------------------------------------------------- 205 261 # OWS Operation methods … … 238 294 'Format %s not supported' % format, 'format') 239 295 240 # Dimension handling241 296 finalImg = Image.new('RGBA', (width, height), (0,0,0,0)) 242 297 # Multiple Layers handling.. … … 244 299 if srs not in layerObj.crss: 245 300 raise InvalidParameterValue('Layer %s does not support SRS %s' % (layerName, srs)) 246 247 dimValues = {} 248 for dimName, dim in layerObj.dimensions.items(): 249 defaultValue = dim.extent[0] 250 dimValues[dimName] = self.getOwsParam(dimName, default=defaultValue) 251 252 #--------------------------------------------------------------------- 253 # The real work 254 #!TODO: Minimum and maximum values 255 256 # Find the slab in the cache first 257 cacheKey = layerObj.getCacheKey(srs, dimValues) 258 259 slab = self._layerSlabCache.get(cacheKey) 260 if slab is None: 261 slab = layerObj.getSlab(srs, dimValues, dict(minValue=0, maxValue=100)) 262 if cacheKey is not None: 263 self._layerSlabCache[cacheKey] = slab 264 265 # We must request a bbox within the layer's bbox. 301 302 dimValues = self._getDimValues(layerObj) 303 304 #------------------------------------------------------- 305 # The real work 306 #!TODO: Minimum and maximum values 307 308 slab = self._retrieveSlab(layerObj, srs, dimValues, 309 dict(minValue=0, maxValue=100)) 310 311 # We must request a bbox within the layer's bbox. 266 312 lbbox = layerObj.getBBox(srs) 267 313 ibbox = bbox_util.intersection(bbox, lbbox) … … 271 317 log.debug('ibbox = %s' % (ibbox,)) 272 318 273 # If bbox is not within layerObj.bbox then we need to calculate the274 # pixel offset of the inner bbox, request the right width/height275 # and paste the image into a blank background319 # If bbox is not within layerObj.bbox then we need to calculate the 320 # pixel offset of the inner bbox, request the right width/height 321 # and paste the image into a blank background 276 322 if bbox == ibbox: 277 323 img = slab.getImage(bbox, width, height)
Note: See TracChangeset
for help on using the changeset viewer.