source: TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/model/common.py @ 3553

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/model/common.py@3553
Revision 3553, 2.0 KB checked in by spascoe, 12 years ago (diff)

Moved all the model classes into their own sub-module.

RevLine 
[2469]1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6Classes modelling the OWS common package v1.1.0.
7
8@author: Stephen Pascoe
[3553]9
[2469]10"""
11
12class Metadata(object):
13    """
14    Terminology differences between the XML schema and the UML are confusing.
15    Here is a best-guess of sensible terms.
16   
17    @ivar content
18    @type content: Any object
19    @ivar link: URL as used in the metadata XML element's href attribute
20    @type link: None or str
21    @ivar about: URI as used in the metadata XML element's about attribute
22    @type about: None or str
23
24    """
25    def __init__(self, content=None, link=None, about=None):
26        self.content = content
27        self.link = link
28        self.about = about
29
30class BoundingBox(object):
31    """
32    @ivar lowerCorner
33    @type lowerCorner: sequence of numbers
34    @ivar upperCorner
35    @type upperCorner: sequence of numbers
36    @ivar crs: URI identifying the CRS unless included in a containing object
37    @type crs: None or str
38    @ivar dimensions: Number of dimensions
39    @type dimensions: int (positive)
40
41    """
42    def __init__(self, lowerCorner, upperCorner,
43                 crs=None):
44        if len(lowerCorner) != len(upperCorner):
45            raise ValueError, 'Corners have differing dimensionality'
46
47        self.lowerCorner = lowerCorner
48        self.upperCorner = upperCorner
49        self.crs = crs
50        self.dimensions = len(lowerCorner)
51
52class WGS84BoundingBox(BoundingBox):
53    """
54    Constrains BoundingBox to standard lat/lon CRS (WGS84).
55    """
56    def __init__(self, lowerCorner, upperCorner):
57        if len(lowerCorner) != 2 or len(upperCorner) != 2:
58            raise ValueError, 'Corners are not of dimension 2'
59       
60        BoundingBox.__init__(self, lowerCorner, upperCorner,
61                             crs='um:ogc:def:crs:OGC::84')
Note: See TracBrowser for help on using the repository browser.