Changeset 5163 for cows/branches
- Timestamp:
- 02/04/09 10:40:08 (12 years ago)
- Location:
- cows/branches/cows-spascoe
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
cows/branches/cows-spascoe/cows/pylons/project_templates/cows_server/+package+/public/demo.js
r5102 r5163 48 48 map.addLayer(dataLayer); 49 49 50 var legendURL = dataLayer.url + '?REQUEST=GetLegend&LAYERS=' + 51 dataLayer.params.LAYERS; 52 53 var legend = document.getElementById('legend'); 54 legend.innerHTML = '<img src="' + legendURL + '"/>'; 55 50 56 } 51 57 … … 63 69 params: { 64 70 layers: layer, 65 request: 'GetContext', format: 'application/json' ,71 request: 'GetContext', format: 'application/json' 66 72 }, 67 73 async: false -
cows/branches/cows-spascoe/cows/pylons/project_templates/cows_server/+package+/templates/demo.html
r5066 r5163 43 43 44 44 45 <div id="map"/> 46 <div id="panel"/> 45 <table> 46 <tr> 47 <td> 48 <div id="map"/> 49 </td> 50 <td> 51 <div id="legend"/> 52 </td> 53 <td> 54 <div id="panel"/> 55 </td> 56 </tr> 57 </table> 47 58 48 59 <h2>Features Available</h2> -
cows/branches/cows-spascoe/cows/service/imps/csmlbackend/wms_csmllayer.py
r4971 r5163 12 12 import os, string 13 13 import csml 14 import numpy 15 from cStringIO import StringIO 14 16 try: 15 17 import cdms2 as cdms … … 25 27 log = logging.getLogger(__name__) 26 28 29 from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas 30 from matplotlib.figure import Figure 31 from matplotlib.colorbar import ColorbarBase 27 32 28 33 from cows.service.wms_iface import IwmsLayer, IwmsDimension, IwmsLayerSlab … … 261 266 262 267 268 def getLegendImage(self, orientation='vertical', renderOpts={}): 269 if 'vert' in orientation: 270 figsize = (1, 3.2) 271 rect = (0.05, 0.05, 0.4, 0.9) 272 else: 273 figsize = (4.1, 1) 274 rect = (0.05, 0.55, 0.9, 0.4) 275 276 #!TODO: remove these dummy values 277 minValue, maxValue = (0, 100) 278 cmap = cm.get_cmap(config['colourmap']) 279 280 fig = Figure(figsize=figsize, dpi=100, facecolor='w') 281 282 # If there is no minValue/maxValue don't display a colourbar 283 # but display a warning. Any colourbar would be a complete 284 # guess unless we find the actual range from the slab. 285 if minValue is None: 286 fig.text(0.5, 0.3, 'NO RANGE SET!\n(%s)' % self.units, 287 multialignment='center', 288 rotation=orientation) 289 else: 290 ax = fig.add_axes(rect) 291 cb = ColorbarBase(ax, cmap=cmap, 292 orientation=orientation) 293 if 'vert' in orientation: 294 ax.set_ylabel(self.units) 295 ax.yaxis.set_data_interval(minValue, maxValue) 296 else: 297 ax.set_xlabel(self.units) 298 ax.xaxis.set_data_interval(minValue, maxValue) 299 300 c = FigureCanvas(fig) 301 c.draw() 302 buf = StringIO() 303 c.print_png(buf) 304 buf.seek(0) 305 img = Image.open(buf) 306 307 return img 308 309 310 311 263 312 class CSMLwmsDimension(IwmsDimension): 264 313 """
Note: See TracChangeset
for help on using the changeset viewer.