Changeset 3496


Ignore:
Timestamp:
21/02/08 15:30:08 (12 years ago)
Author:
spascoe
Message:

More helpers and correction to domain model.

Location:
TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/domain.py

    r2671 r3496  
    2424    @ivar dataType 
    2525    @type dataType: None, DomainMetadata or str 
    26     @ivar valuesUnit 
    27     @type valuesUnit: None or ValuesUnit 
     26    @ivar valuesUnit: The units of measure or reverence System.  This is a 
     27        simplification of the schema that defines valuesUnit to be a union 
     28        of either referenceSystems or UOM.  It's not clear how this should 
     29        be implemented yet. 
     30    @type valuesUnit: None or DomainMetadata 
    2831    @ivar possibleValues 
    2932    @type possibleValues: PossibleValues 
     
    163166        super(DomainMetadata, self).__init__(name) 
    164167        self.reference = reference 
    165      
    166      
    167 class ValuesUnit(object): 
    168     """ 
    169     @ivar referenceSystems 
    170     @type referenceSystems: sequence of str or DomainMetadata 
    171     @ivar uoms 
    172     @type uoms: sequence of str or DomainMetadata 
    173  
    174     """ 
    175  
    176     def __init__(self, referenceSystems=[], uoms=[]): 
    177         assert len(referenceSystems) > 0 
    178         assert len(uoms) > 0 
    179          
    180         self.referenceSystems = referenceSystems 
    181         self.uoms = uoms 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/helpers.py

    r3487 r3496  
    1111from ows_common.domain import Domain, PossibleValues 
    1212from ows_common.operations_metadata import * 
    13 from ows_common.wms import WmsDatasetSummary 
     13from ows_common.wms import WmsDatasetSummary, Dimension 
    1414from ows_common.common import BoundingBox 
    1515 
     
    4040    return Operation(get=RequestMethod(href=uri), parameters=params) 
    4141 
    42 def wms_layer(uri, name, title, srs, bbox, abstract=None): 
     42def wms_layer(name, title, srs, bbox, abstract=None): 
    4343    """ 
    4444    Helper function for making wms layer descriptions. 
     
    6363 
    6464    return ds 
     65 
     66def wms_dimension(extent, units, unitSymbol): 
     67    """ 
     68    Helper function for making wms dimension descriptions. 
     69 
     70    @todo: More parameters like current and multipleValues need implementing. 
     71 
     72    """ 
     73    d = Dimension(valuesUnit=units, 
     74                  unitSymbol=unitSymbol, 
     75                  possibleValues=PossibleValues.fromAllowedValues(extent)) 
     76     
     77    return d 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/ows_controller.py

    r3487 r3496  
    118118    ops[opName] = helpers.operation(url_for(), formats=formats) 
    119119 
    120 def addLayer(name, title, abstract, srs, bbox): 
     120def addLayer(name, title, abstract, srs, bbox, dimensions={}): 
     121    """ 
     122    @param dimensions: Dictionary of dictionaries D[k1][k2]=val where 
     123        k1 is dimension name, k2 is a keyword parameter to send to 
     124        helpers.wms_dimension and val is it's value. 
     125 
     126    @todo: The helpers interface is leaking through.  Could make cleaner. 
     127 
     128    """ 
     129         
    121130    if c.capabilities.contents is None: 
    122131        c.capabilities.contents = Contents() 
    123132 
    124     layer = helpers.wms_layer(url_for(), name, title, srs, bbox, abstract) 
     133    layer = helpers.wms_layer(name, title, srs, bbox, abstract) 
     134 
     135    for k1, kwargs in dimensions.items(): 
     136        dim = helpers.wms_dimension(**kwargs) 
     137        layer.dimensions[k1] = dim 
     138 
    125139    c.capabilities.contents.datasetSummaries.append(layer) 
    126140 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_1_1.xml

    r3487 r3496  
    5858    <!-- TODO ScaleHint --> 
    5959    <py:for each="d_n, d in ds.dimensions.iteritems()"> 
    60       <Dimension name="${d_n}" units="${d.valuesUnit.uoms[0]}" 
     60      <Dimension name="${d_n}" units="${d.valuesUnit}" 
    6161                 unitSymbol="${d.unitSymbol}"/> 
    62       <Extent name="${d_n}" default="${d.defaultValue}" nearestValue="d.nearestValue" 
     62      <Extent name="${d_n}" default="${d.defaultValue}" nearestValue="${d.nearestValue}" 
    6363              py:content="' '.join(d.possibleValues.allowedValues)"/> 
    6464    </py:for> 
Note: See TracChangeset for help on using the changeset viewer.