source: mauRepo/CedaMolesModel/tags/0.1.0/ceda_moles_model/ea_model/iso_19111_referencing_by_coordinates/coordinate_operations/cc_coordinateoperation.py @ 8398

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/tags/0.1.0/ceda_moles_model/ea_model/iso_19111_referencing_by_coordinates/coordinate_operations/cc_coordinateoperation.py@8405
Revision 8398, 6.1 KB checked in by mnagni, 8 years ago (diff)

Incomplete - # 22504: CedaMoles? as python package
 http://team.ceda.ac.uk/trac/ceda/ticket/22504

  • 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_19111_referencing_by_coordinates.identified_objects.io_identifiedobject import  IO_IdentifiedObject
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 26-Jun-2012 10:16:17
26
27@author: mnagni
28'''
29
30class CC_CoordinateOperation(IO_IdentifiedObject):
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._io_identifiedobject = IO_IdentifiedObject()       
43
44                self.name = None
45                self.concatOperation = []
46                self.domainOfValidity = None
47                self.remarks = None
48                self._coordinateOperationAccuracy_dq_absoluteexternalpositionalaccuracy = []
49                self._coordinateOperationAccuracy_dq_relativeinternalpositionalaccuracy = []
50                self._coordinateOperationAccuracy_dq_griddeddatapositionalaccuracy = []
51                self._coordinateOperationAccuracy = []
52                self.scope = []
53                self.operationVersion = None
54                self._targetCRS_sc_compoundcrs = None
55                self._targetCRS_sc_singlecrs = None
56                self._targetCRS = None
57                self.passThruOperation = []
58                self._sourceCRS_sc_compoundcrs = None
59                self._sourceCRS_sc_singlecrs = None
60                self._sourceCRS = None
61                super(CC_CoordinateOperation, self).__init__()
62        @property
63        def identifier(self):   
64                return self._io_identifiedobject.identifier
65
66        @identifier.setter
67        def identifier(self, value):   
68                        self._io_identifiedobject.identifier = value
69        @property
70        def name(self):
71                return self._io_identifiedobject.name
72
73        @name.setter
74        def name(self, value): 
75                        self._io_identifiedobject.name = value
76        @property
77        def remarks(self):     
78                return self._io_identifiedobject.remarks
79
80        @remarks.setter
81        def remarks(self, value):       
82                        self._io_identifiedobject.remarks = value
83        @property
84        def coordinateOperationAccuracy(self): 
85                try:
86                        ret = []
87                        ret.extend(self._coordinateOperationAccuracy_dq_absoluteexternalpositionalaccuracy)
88                        ret.extend(self._coordinateOperationAccuracy_dq_relativeinternalpositionalaccuracy)
89                        ret.extend(self._coordinateOperationAccuracy_dq_griddeddatapositionalaccuracy)
90                        if not hasattr(self, '_coordinateOperationAccuracy'):
91                                self._coordinateOperationAccuracy = []
92                        if self._coordinateOperationAccuracy:
93                                ret.extend(self._coordinateOperationAccuracy)
94                        del self._coordinateOperationAccuracy[:]
95                        self._coordinateOperationAccuracy.extend(set(ret))
96                except Exception as e:
97                        pass
98                return self._coordinateOperationAccuracy
99
100        @property
101        def alias(self):       
102                return self._io_identifiedobject.alias
103
104        @alias.setter
105        def alias(self, value):
106                        self._io_identifiedobject.alias = value
107        @property
108        def targetCRS(self):   
109                if(has_value(self._targetCRS_sc_compoundcrs)):
110                        return self._targetCRS_sc_compoundcrs
111                if(has_value(self._targetCRS_sc_singlecrs)):
112                        return self._targetCRS_sc_singlecrs
113                return  None
114
115        @targetCRS.setter
116        def targetCRS(self, value):     
117                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
118                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_compoundcrs.SC_CompoundCRS":
119                        self._targetCRS_sc_compoundcrs = value
120                        self._targetCRS_sc_singlecrs = None
121                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_singlecrs.SC_SingleCRS":
122                        self._targetCRS_sc_singlecrs = value
123                        self._targetCRS_sc_compoundcrs = None
124        @property
125        def sourceCRS(self):   
126                if(has_value(self._sourceCRS_sc_compoundcrs)):
127                        return self._sourceCRS_sc_compoundcrs
128                if(has_value(self._sourceCRS_sc_singlecrs)):
129                        return self._sourceCRS_sc_singlecrs
130                return  None
131
132        @sourceCRS.setter
133        def sourceCRS(self, value):     
134                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
135                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_compoundcrs.SC_CompoundCRS":
136                        self._sourceCRS_sc_compoundcrs = value
137                        self._sourceCRS_sc_singlecrs = None
138                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_singlecrs.SC_SingleCRS":
139                        self._sourceCRS_sc_singlecrs = value
140                        self._sourceCRS_sc_compoundcrs = None
141
142        def synchronize(self):
143                del self._coordinateOperationAccuracy_dq_absoluteexternalpositionalaccuracy[:]
144                del self._coordinateOperationAccuracy_dq_relativeinternalpositionalaccuracy[:]
145                del self._coordinateOperationAccuracy_dq_griddeddatapositionalaccuracy[:]
146                for item in self.coordinateOperationAccuracy:   
147                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
148                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_absoluteexternalpositionalaccuracy.DQ_AbsoluteExternalPositionalAccuracy":
149                                self._coordinateOperationAccuracy_dq_absoluteexternalpositionalaccuracy.append(item)
150                                continue
151                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
152                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_relativeinternalpositionalaccuracy.DQ_RelativeInternalPositionalAccuracy":
153                                self._coordinateOperationAccuracy_dq_relativeinternalpositionalaccuracy.append(item)
154                                continue
155                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
156                        if valueClass == "ea_model.iso_19115_2006_metadata_corrigendum.data_quality_information.dq_griddeddatapositionalaccuracy.DQ_GriddedDataPositionalAccuracy":
157                                self._coordinateOperationAccuracy_dq_griddeddatapositionalaccuracy.append(item)
158                                continue
159                pass
160
161        def __key(self):
162                return (self.identifier, self.name, self.concatOperation, self.domainOfValidity, self.remarks, self.coordinateOperationAccuracy, self.alias, self.scope, self.operationVersion, self.targetCRS, self.passThruOperation, self.sourceCRS)
163
164        def __eq__(self, y):
165                if type(self) != type(y):
166                        return False
167                '''
168                Cannot compare classes which do not define a "__key" attribute
169                '''
170                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
171                        return self.__key() == y.__key()
172                return id(self) == id(y)
173
174        def __hash__(self):
175                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.