source: cows/trunk/cows/model/wms.py @ 5629

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/model/wms.py@5629
Revision 5629, 4.9 KB checked in by domlowe, 10 years ago (diff)

Merging in qesdi changes to cows trunk - still need to merge new backend.

Line 
1# BSD Licence
2# Copyright (c) 2009, Science & Technology Facilities Council (STFC)
3# All rights reserved.
4#
5# See the LICENSE file in the source distribution of this software for
6# the full license text.
7
8# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
9# This software may be distributed under the terms of the
10# Q Public License, version 1.0 or later.
11# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
12"""
13Extends cows classes where necessary for implementing WMS 1.3.0
14
15@author: Stephen Pascoe
16"""
17
18from cows.model.contents import DatasetSummary
19from cows.model.domain import Domain
20
21class WmsDatasetSummary(DatasetSummary):
22    """
23    We don't know how WMS will map Layer attributes onto an extension of DatasetSummary
24    so a pragmatic approach is taken here.
25   
26    @ivar CRSs
27    @type CRSs: iterable of str
28    @ivar styles: Style descriptors, default ['']
29    @type styles: iterable of Style objects
30    @ivar dimensions
31    @type dimensions: dictionary mapping dimension names to Dimension objects
32    @ivar attribution
33    @type attribution: None or Attribution object
34    @ivar authorityURLs
35    @type authorityURLs: iterable of AuthorityUrl objects
36    @ivar dataURLs
37    @type dataURLs: dictionary mapping layer names to DataUrl objects
38    @ivar featureListURLs
39    @type featureListURLS: iterable of FeatureListURL objects
40    @ivar minScaleDenominator
41    @type minScaleDenominator: None or double
42    @ivar maxScaleDenominator
43    @type maxScaleDenominator: None or double
44    @ivar queryable
45    @type queryable: Boolean
46    """
47    def __init__(self, CRSs=[], styles=[''], dimensions={}, attribution=None, authorityURLs=[],
48                 dataURLs=[], featureListURLs=[], metadataURLs=[],
49                 minScaleDenominator=None, maxScaleDenominator=None,
50                 queryable=False, **kw):
51        super(WmsDatasetSummary, self).__init__(**kw)
52
53        self.CRSs = CRSs
54        self.styles = styles
55        self.dimensions = dimensions
56        self.attribution = attribution
57        self.authorityURLs = authorityURLs
58        self.dataURLs = dataURLs
59        self.featureListURLs = featureListURLs
60        self.minScaleDenominator = minScaleDenominator
61        self.maxScaleDenominator = maxScaleDenominator
62        self.queryable = queryable
63        self.metadataURLs = metadataURLs
64
65class Style(object):
66    """
67    @ivar name
68    @type name: str
69    @ivar title
70    @type title: str
71    @ivar abstract
72    @type abstract: None or str
73    @ivar legendURLs
74    @type legendURLS: iterable of LegendURL objests
75    @ivar styleSheetURL
76    @type styleSheetURL: None or FormattedURL object
77    @ivar styleURL
78    @type styleURL: None or FormattedURL object
79
80    """
81    def __init__(self, name, title, abstract=None, legendURLs=[], styleSheetURL=None,
82                 styleURL=None):
83        self.name = name
84        self.title = title
85        self.abstract = abstract
86        self.legendURLs = legendURLs
87        self.styleSheetURL = styleSheetURL
88        self.styleURL = styleURL
89
90class FormattedURL(object):
91    """
92    @ivar format
93    @type format: str
94    @ivar onlineResource
95    @type onlineResource: OnlineResource object
96
97    """
98    def __init__(self, format, onlineResource):
99        self.format = format
100        self.onlineResource = onlineResource
101
102class LegendURL(FormattedURL):
103    """
104    @ivar width
105    @type width: None or int
106    @ivar height:
107    @type height: None or int
108
109    """
110    def __init__(self, width, height, **kw):
111        super(LegendURL, self).__init__(**kw)
112       
113        self.width = width
114        self.height = height
115
116class Dimension(Domain):
117    """
118    Use Domain attributes where possible.
119   
120    @ivar multipleValues
121    @type multipleValues: boolean (default False)
122    @ivar nearestValue
123    @type nearestValue: boolean (default False)
124    @ivar current
125    @type current: boolean (default False)
126    @ivar unitSymbol: Unit symbol could probably be taken from the Domain
127        structure but it isn't clear where (the meaning or dataType
128        attributes?).
129    @type unitSymbol: str
130
131    """
132    def __init__(self, multipleValues=False, nearestValue=False,
133                 current=False, unitSymbol=None, **kw):
134        super(Dimension, self).__init__(**kw)
135       
136        self.multipleValues = multipleValues
137        self.nearestValue = nearestValue
138        self.current = current
139        self.unitSymbol = unitSymbol
140
141class DataURL(FormattedURL):
142    """
143    @ivar width
144    @type width: None or int
145    @ivar height:
146    @type height: None or int
147    """
148    def __init__(self, width=None, height=None, **kw):
149        super(DataURL, self).__init__(**kw)
150        self.width = width
151        self.height = height
152
153class MetadataURL(FormattedURL):
154    """
155    @ivar metadataType
156    @type metadataType: None or str
157    """
158    def __init__(self, metadataType=None, **kw):
159        super(MetadataURL, self).__init__(**kw)
160        self.type = metadataType
161
162#
163#!TODO: Other objects referenced by WmsDatasetSummary
164#
Note: See TracBrowser for help on using the repository browser.