Changing license to MIT.
[PyCIM.git] / CDPSM / Geographical / IEC61968 / Common / CoordinateSystem.py
blob6504b406d731abe3cc56454540b4e42fb930e7cc
1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 # IN THE SOFTWARE.
21 from CDPSM.Geographical.IEC61970.Core.IdentifiedObject import IdentifiedObject
23 class CoordinateSystem(IdentifiedObject):
24 """Coordinate reference system.
25 """
27 def __init__(self, crsUrn='', Location=None, *args, **kw_args):
28 """Initialises a new 'CoordinateSystem' instance.
30 @param crsUrn: A Uniform Resource Name (URN) for the coordinate reference system (crs) used to define 'Location.PositionPoints'. An example would be the European Petroleum Survey Group (EPSG) code for a coordinate reference system, defined in URN under the Open Geospatial Consortium (OGC) namespace as: urn:ogc :def:uom:EPSG::XXXX, where XXXX is an EPSG code (a full list of codes can be found at the EPSG Registry website http://www.epsg-registry.org/). To define the coordinate system as being WGS84 (latitude, longitude) using an EPSG OGC, this attribute would be urn:ogc:def:uom:EPSG::4236. A profile should limit this code to a set of allowed URNs agreed to by all sending and receiving parties.
31 @param Location: All locations described with position points in this coordinate system.
32 """
33 #: A Uniform Resource Name (URN) for the coordinate reference system (crs) used to define 'Location.PositionPoints'. An example would be the European Petroleum Survey Group (EPSG) code for a coordinate reference system, defined in URN under the Open Geospatial Consortium (OGC) namespace as: urn:ogc :def:uom:EPSG::XXXX, where XXXX is an EPSG code (a full list of codes can be found at the EPSG Registry website http://www.epsg-registry.org/). To define the coordinate system as being WGS84 (latitude, longitude) using an EPSG OGC, this attribute would be urn:ogc:def:uom:EPSG::4236. A profile should limit this code to a set of allowed URNs agreed to by all sending and receiving parties.
34 self.crsUrn = crsUrn
36 self._Location = []
37 self.Location = [] if Location is None else Location
39 super(CoordinateSystem, self).__init__(*args, **kw_args)
41 _attrs = ["crsUrn"]
42 _attr_types = {"crsUrn": str}
43 _defaults = {"crsUrn": ''}
44 _enums = {}
45 _refs = ["Location"]
46 _many_refs = ["Location"]
48 def getLocation(self):
49 """All locations described with position points in this coordinate system.
50 """
51 return self._Location
53 def setLocation(self, value):
54 for x in self._Location:
55 x.CoordinateSystem = None
56 for y in value:
57 y._CoordinateSystem = self
58 self._Location = value
60 Location = property(getLocation, setLocation)
62 def addLocation(self, *Location):
63 for obj in Location:
64 obj.CoordinateSystem = self
66 def removeLocation(self, *Location):
67 for obj in Location:
68 obj.CoordinateSystem = None