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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/model/wms.py@4912
Revision 4912, 4.3 KB checked in by spascoe, 13 years ago (diff)

Added LICENSE file and a short banner at the top of each python file.
Use add_license.py to add a license to new files.

NOTE: also contains a couple of files missed at last commit.

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: iterable of 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    """
48    def __init__(self, CRSs=[], styles=[''], dimensions={}, attribution=None, authorityURLs=[],
49                 dataURLs=[], featureListURLs=[],
50                 minScaleDenominator=None, maxScaleDenominator=None,
51                 queryable=False, **kw):
52        super(WmsDatasetSummary, self).__init__(**kw)
53
54        self.CRSs = CRSs
55        self.styles = styles
56        self.dimensions = dimensions
57        self.attribution = attribution
58        self.authorityURLs = authorityURLs
59        self.dataURLs = dataURLs
60        self.featureListURLs = featureListURLs
61        self.minScaleDenominator = minScaleDenominator
62        self.maxScaleDenominator = maxScaleDenominator
63        self.queryable = queryable
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
141#
142#!TODO: Other objects referenced by WmsDatasetSummary
143#
Note: See TracBrowser for help on using the repository browser.