Update README.rst
[PyCIM.git] / CIM14 / CDPSM / GIS_Connectivity / IEC61968 / Common / PositionPoint.py
blob1477916903cdc7ebbfde020b4f23f6284ed19e13
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 CIM14.CDPSM.GIS_Connectivity.Element import Element
23 class PositionPoint(Element):
24 """Set of spatial coordinates that determine a point. A sequence of PositionPoints can be used to describe: - physical location of non-point oriented objects like cables or lines, or - area of an object like a substation, a geographical zone or a diagram object.
25 """
27 def __init__(self, xPosition='', sequenceNumber=0, yPosition='', Location=None, *args, **kw_args):
28 """Initialises a new 'PositionPoint' instance.
30 @param xPosition: X axis position.
31 @param sequenceNumber: Zero-relative sequence number of this point within a series of points.
32 @param yPosition: Y axis position.
33 @param Location: Location that this position point describes.
34 """
35 #: X axis position.
36 self.xPosition = xPosition
38 #: Zero-relative sequence number of this point within a series of points.
39 self.sequenceNumber = sequenceNumber
41 #: Y axis position.
42 self.yPosition = yPosition
44 self._Location = None
45 self.Location = Location
47 super(PositionPoint, self).__init__(*args, **kw_args)
49 _attrs = ["xPosition", "sequenceNumber", "yPosition"]
50 _attr_types = {"xPosition": str, "sequenceNumber": int, "yPosition": str}
51 _defaults = {"xPosition": '', "sequenceNumber": 0, "yPosition": ''}
52 _enums = {}
53 _refs = ["Location"]
54 _many_refs = []
56 def getLocation(self):
57 """Location that this position point describes.
58 """
59 return self._Location
61 def setLocation(self, value):
62 if self._Location is not None:
63 filtered = [x for x in self.Location.PositionPoints if x != self]
64 self._Location._PositionPoints = filtered
66 self._Location = value
67 if self._Location is not None:
68 if self not in self._Location._PositionPoints:
69 self._Location._PositionPoints.append(self)
71 Location = property(getLocation, setLocation)