source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/feature/envelopewithtimeperiod.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19136_gml/feature/envelopewithtimeperiod.py@8457
Revision 8457, 4.0 KB checked in by mnagni, 7 years ago (diff)

Corrected an error in the generation of the classes "synchronize" method.

  • Property svn:mime-type set to text/plain
Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ea_model.iso_19107_2003_spatial_schema.geometry.coordinate_geometry.gm_envelope import  GM_Envelope
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:05
26
27@author: mnagni
28'''
29
30class EnvelopeWithTimePeriod(GM_Envelope):
31        '''
32                Represents a data entity defined in a UML diagram and supposed to
33                be persisted in a relational database.
34 
35                This class has been genererated automatically using the Apache Velocity project.
36        '''
37        '''
38                Please note that any access to the inner attributes should be done using
39                the given get/set methods and NOT accessing them directly.
40        '''
41        def __init__(self):
42                self._gm_envelope = GM_Envelope()       
43
44                self.lowerCorner = None
45                self.beginPosition = None
46                self.upperCorner = None
47                self._frame_tm_temporalcrs = None
48                self._frame_tm_ordinalreferencesystem = None
49                self._frame_tm_coordinatesystem = None
50                self._frame_tm_calendar = None
51                self._frame_tm_clock = None
52                self._frame = None
53                self.endPosition = None
54                super(EnvelopeWithTimePeriod, self).__init__()
55        @property
56        def lowerCorner(self): 
57                return self._gm_envelope.lowerCorner
58
59        @lowerCorner.setter
60        def lowerCorner(self, value):   
61                        self._gm_envelope.lowerCorner = value
62        @property
63        def upperCorner(self): 
64                return self._gm_envelope.upperCorner
65
66        @upperCorner.setter
67        def upperCorner(self, value):   
68                        self._gm_envelope.upperCorner = value
69        @property
70        def frame(self):       
71                if(has_value(self._frame_tm_temporalcrs)):
72                        return self._frame_tm_temporalcrs
73                if(has_value(self._frame_tm_ordinalreferencesystem)):
74                        return self._frame_tm_ordinalreferencesystem
75                if(has_value(self._frame_tm_coordinatesystem)):
76                        return self._frame_tm_coordinatesystem
77                if(has_value(self._frame_tm_calendar)):
78                        return self._frame_tm_calendar
79                if(has_value(self._frame_tm_clock)):
80                        return self._frame_tm_clock
81                return  None
82
83        @frame.setter
84        def frame(self, value):
85                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
86                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.temporal_reference_systems.tm_temporalcrs.TM_TemporalCRS":
87                        self._frame_tm_temporalcrs = value
88                        self._frame_tm_ordinalreferencesystem = None
89                        self._frame_tm_coordinatesystem = None
90                        self._frame_tm_calendar = None
91                        self._frame_tm_clock = None
92                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_ordinalreferencesystem.TM_OrdinalReferenceSystem":
93                        self._frame_tm_ordinalreferencesystem = value
94                        self._frame_tm_temporalcrs = None
95                        self._frame_tm_coordinatesystem = None
96                        self._frame_tm_calendar = None
97                        self._frame_tm_clock = None
98                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_coordinatesystem.TM_CoordinateSystem":
99                        self._frame_tm_coordinatesystem = value
100                        self._frame_tm_temporalcrs = None
101                        self._frame_tm_ordinalreferencesystem = None
102                        self._frame_tm_calendar = None
103                        self._frame_tm_clock = None
104                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_calendar.TM_Calendar":
105                        self._frame_tm_calendar = value
106                        self._frame_tm_temporalcrs = None
107                        self._frame_tm_ordinalreferencesystem = None
108                        self._frame_tm_coordinatesystem = None
109                        self._frame_tm_clock = None
110                if valueClass == "ea_model.iso_19108_2006_temporal_schema.temporal_reference_system.tm_clock.TM_Clock":
111                        self._frame_tm_clock = value
112                        self._frame_tm_temporalcrs = None
113                        self._frame_tm_ordinalreferencesystem = None
114                        self._frame_tm_coordinatesystem = None
115                        self._frame_tm_calendar = None
116
117        def synchronize(self):
118                pass
119
120        def __key(self):
121                return (self.lowerCorner, self.beginPosition, self.upperCorner, self.frame, self.endPosition)
122
123        def __eq__(self, y):
124                if type(self) != type(y):
125                        return False
126                '''
127                Cannot compare classes which do not define a "__key" attribute
128                '''
129                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
130                        return self.__key() == y.__key()
131                return id(self) == id(y)
132
133        def __hash__(self):
134                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.