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

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

WCS urls now generated in WebMapContext? documents

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=[],
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
64class Style(object):
65    """
66    @ivar name
67    @type name: str
68    @ivar title
69    @type title: str
70    @ivar abstract
71    @type abstract: None or str
72    @ivar legendURLs
73    @type legendURLS: iterable of LegendURL objests
74    @ivar styleSheetURL
75    @type styleSheetURL: None or FormattedURL object
76    @ivar styleURL
77    @type styleURL: None or FormattedURL object
78
79    """
80    def __init__(self, name, title, abstract=None, legendURLs=[], styleSheetURL=None,
81                 styleURL=None):
82        self.name = name
83        self.title = title
84        self.abstract = abstract
85        self.legendURLs = legendURLs
86        self.styleSheetURL = styleSheetURL
87        self.styleURL = styleURL
88
89class FormattedURL(object):
90    """
91    @ivar format
92    @type format: str
93    @ivar onlineResource
94    @type onlineResource: OnlineResource object
95
96    """
97    def __init__(self, format, onlineResource):
98        self.format = format
99        self.onlineResource = onlineResource
100
101class LegendURL(FormattedURL):
102    """
103    @ivar width
104    @type width: None or int
105    @ivar height:
106    @type height: None or int
107
108    """
109    def __init__(self, width, height, **kw):
110        super(LegendURL, self).__init__(**kw)
111       
112        self.width = width
113        self.height = height
114
115class Dimension(Domain):
116    """
117    Use Domain attributes where possible.
118   
119    @ivar multipleValues
120    @type multipleValues: boolean (default False)
121    @ivar nearestValue
122    @type nearestValue: boolean (default False)
123    @ivar current
124    @type current: boolean (default False)
125    @ivar unitSymbol: Unit symbol could probably be taken from the Domain
126        structure but it isn't clear where (the meaning or dataType
127        attributes?).
128    @type unitSymbol: str
129
130    """
131    def __init__(self, multipleValues=False, nearestValue=False,
132                 current=False, unitSymbol=None, **kw):
133        super(Dimension, self).__init__(**kw)
134       
135        self.multipleValues = multipleValues
136        self.nearestValue = nearestValue
137        self.current = current
138        self.unitSymbol = unitSymbol
139
140class DataURL(FormattedURL):
141    """
142    @ivar width
143    @type width: None or int
144    @ivar height:
145    @type height: None or int
146    """
147    def __init__(self, width=None, height=None, **kw):
148        super(DataURL, self).__init__(**kw)
149        self.width = width
150        self.height = height
151       
152#
153#!TODO: Other objects referenced by WmsDatasetSummary
154#
Note: See TracBrowser for help on using the repository browser.