source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19115_2006_metadata_corrigendum/spatial_representation_information/md_georectified.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/iso_19115_2006_metadata_corrigendum/spatial_representation_information/md_georectified.py@8457
Revision 8457, 4.9 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_19115_2006_metadata_corrigendum.spatial_representation_information.md_gridspatialrepresentation import  MD_GridSpatialRepresentation
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 10-Jul-2012 14:15:09
26
27@author: mnagni
28'''
29
30class MD_Georectified(MD_GridSpatialRepresentation):
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._md_gridspatialrepresentation = MD_GridSpatialRepresentation()     
43
44                self.checkPointAvailability = None
45                self.transformationParameterAvailability = None
46                self._centerPoint_eg_pointestimate = None
47                self._centerPoint_gm_compositepoint = None
48                self._centerPoint = None
49                self.checkPointDescription = None
50                self.pointInPixel = None
51                self.cellGeometry = None
52                self.transformationDimensionDescription = None
53                self._cornerPoints_eg_pointestimate = []
54                self._cornerPoints_gm_compositepoint = []
55                self._cornerPoints = []
56                self.numberOfDimensions = None
57                self.transformationDimensionMapping = []
58                super(MD_Georectified, self).__init__()
59        @property
60        def transformationParameterAvailability(self): 
61                return self._md_gridspatialrepresentation.transformationParameterAvailability
62
63        @transformationParameterAvailability.setter
64        def transformationParameterAvailability(self, value):   
65                        self._md_gridspatialrepresentation.transformationParameterAvailability = value
66        @property
67        def centerPoint(self): 
68                if(has_value(self._centerPoint_eg_pointestimate)):
69                        return self._centerPoint_eg_pointestimate
70                if(has_value(self._centerPoint_gm_compositepoint)):
71                        return self._centerPoint_gm_compositepoint
72                return  None
73
74        @centerPoint.setter
75        def centerPoint(self, value):   
76                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
77                if valueClass == "ea_model.iso_19133_tracking_and_navigation.tracking.point_estimates.eg_pointestimate.EG_PointEstimate":
78                        self._centerPoint_eg_pointestimate = value
79                        self._centerPoint_gm_compositepoint = None
80                if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_complex.gm_compositepoint.GM_CompositePoint":
81                        self._centerPoint_gm_compositepoint = value
82                        self._centerPoint_eg_pointestimate = None
83        @property
84        def cellGeometry(self):
85                return self._md_gridspatialrepresentation.cellGeometry
86
87        @cellGeometry.setter
88        def cellGeometry(self, value): 
89                        self._md_gridspatialrepresentation.cellGeometry = value
90        @property
91        def cornerPoints(self):
92                try:
93                        ret = []
94                        ret.extend(self._cornerPoints_eg_pointestimate)
95                        ret.extend(self._cornerPoints_gm_compositepoint)
96                        if not hasattr(self, '_cornerPoints'):
97                                self._cornerPoints = []
98                        if self._cornerPoints is not None:
99                                ret.extend(self._cornerPoints)
100                        del self._cornerPoints[:]
101                        self._cornerPoints.extend(set(ret))
102                except Exception as e:
103                        pass
104                return self._cornerPoints
105
106        @property
107        def axisDimensionProperties(self):     
108                return self._md_gridspatialrepresentation.axisDimensionProperties
109
110        @axisDimensionProperties.setter
111        def axisDimensionProperties(self, value):       
112                        self._md_gridspatialrepresentation.axisDimensionProperties = value
113        @property
114        def numberOfDimensions(self):   
115                return self._md_gridspatialrepresentation.numberOfDimensions
116
117        @numberOfDimensions.setter
118        def numberOfDimensions(self, value):   
119                        self._md_gridspatialrepresentation.numberOfDimensions = value
120
121        def synchronize(self):
122                int_cornerPoints = self.cornerPoints   
123                del self._cornerPoints_eg_pointestimate[:]
124                del self._cornerPoints_gm_compositepoint[:]
125                for item in int_cornerPoints:   
126                        valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
127                        if valueClass == "ea_model.iso_19133_tracking_and_navigation.tracking.point_estimates.eg_pointestimate.EG_PointEstimate":
128                                self._cornerPoints_eg_pointestimate.append(item)
129                                continue
130                        if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_complex.gm_compositepoint.GM_CompositePoint":
131                                self._cornerPoints_gm_compositepoint.append(item)
132                                continue
133                pass
134
135        def __key(self):
136                return (self.checkPointAvailability, self.transformationParameterAvailability, self.centerPoint, self.checkPointDescription, self.pointInPixel, self.cellGeometry, self.transformationDimensionDescription, self.cornerPoints, self.axisDimensionProperties, self.numberOfDimensions, self.transformationDimensionMapping)
137
138        def __eq__(self, y):
139                if type(self) != type(y):
140                        return False
141                '''
142                Cannot compare classes which do not define a "__key" attribute
143                '''
144                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
145                        return self.__key() == y.__key()
146                return id(self) == id(y)
147
148        def __hash__(self):
149                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.