source: mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/simplicial_topology/simplex.py @ 8457

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/trunk/ceda_moles_model/ea_model/informative/spatial_examples_from_iso_19107/application_schema/simplicial_topology/simplex.py@8457
Revision 8457, 4.3 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.geometric_primitive.gm_primitive import  GM_Primitive
22from ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_primitive import  TP_Primitive
23from ascore.utils import has_value, collectionProofHash
24
25'''
26Created on 10-Jul-2012 14:15:03
27
28@author: mnagni
29'''
30
31class Simplex(TP_Primitive,GM_Primitive):
32        '''
33                Represents a data entity defined in a UML diagram and supposed to
34                be persisted in a relational database.
35 
36                This class has been genererated automatically using the Apache Velocity project.
37        '''
38        '''
39                Please note that any access to the inner attributes should be done using
40                the given get/set methods and NOT accessing them directly.
41        '''
42        def __init__(self):
43                self._gm_primitive = GM_Primitive()     
44                self._tp_primitive = TP_Primitive()     
45
46                self.maximalComplex = None
47                self.dimension = None
48                self.CRS = None
49                self.proxy = None
50                self.geometry = None
51                self.container = None
52                self.theSimplicialComplex = []
53                self._vertices_eg_pointestimate = None
54                self._vertices_gm_compositepoint = None
55                self._vertices = None
56                super(Simplex, self).__init__()
57        @property
58        def containedPrimitive(self):   
59                return self._gm_primitive.containedPrimitive
60
61        @containedPrimitive.setter
62        def containedPrimitive(self, value):   
63                        self._gm_primitive.containedPrimitive = value
64        @property
65        def composite(self):   
66                return self._gm_primitive.composite
67
68        @composite.setter
69        def composite(self, value):     
70                        self._gm_primitive.composite = value
71        @property
72        def maximalComplex(self):       
73                return self._tp_primitive.maximalComplex
74
75        @maximalComplex.setter
76        def maximalComplex(self, value):       
77                        self._tp_primitive.maximalComplex = value
78        @property
79        def containingPrimitive(self): 
80                return self._gm_primitive.containingPrimitive
81
82        @containingPrimitive.setter
83        def containingPrimitive(self, value):   
84                        self._gm_primitive.containingPrimitive = value
85        @property
86        def isolated(self):     
87                return self._tp_primitive.isolated
88
89        @isolated.setter
90        def isolated(self, value):     
91                        self._tp_primitive.isolated = value
92        @property
93        def topology(self):     
94                return self._gm_primitive.topology
95
96        @topology.setter
97        def topology(self, value):     
98                        self._gm_primitive.topology = value
99        @property
100        def CRS(self): 
101                return self._gm_primitive.CRS
102
103        @CRS.setter
104        def CRS(self, value):   
105                        self._gm_primitive.CRS = value
106        @property
107        def proxy(self):       
108                return self._gm_primitive.proxy
109
110        @proxy.setter
111        def proxy(self, value):
112                        self._gm_primitive.proxy = value
113        @property
114        def geometry(self):     
115                return self._tp_primitive.geometry
116
117        @geometry.setter
118        def geometry(self, value):     
119                        self._tp_primitive.geometry = value
120        @property
121        def complex(self):     
122                return self._gm_primitive.complex
123
124        @complex.setter
125        def complex(self, value):       
126                        self._gm_primitive.complex = value
127        @property
128        def container(self):   
129                return self._tp_primitive.container
130
131        @container.setter
132        def container(self, value):     
133                        self._tp_primitive.container = value
134        @property
135        def vertices(self):     
136                if(has_value(self._vertices_eg_pointestimate)):
137                        return self._vertices_eg_pointestimate
138                if(has_value(self._vertices_gm_compositepoint)):
139                        return self._vertices_gm_compositepoint
140                return  None
141
142        @vertices.setter
143        def vertices(self, value):     
144                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
145                if valueClass == "ea_model.iso_19133_tracking_and_navigation.tracking.point_estimates.eg_pointestimate.EG_PointEstimate":
146                        self._vertices_eg_pointestimate = value
147                        self._vertices_gm_compositepoint = None
148                if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_complex.gm_compositepoint.GM_CompositePoint":
149                        self._vertices_gm_compositepoint = value
150                        self._vertices_eg_pointestimate = None
151
152        def synchronize(self):
153                pass
154
155        def __key(self):
156                return (self.containedPrimitive, self.composite, self.maximalComplex, self.dimension, self.containingPrimitive, self.isolated, self.topology, self.CRS, self.proxy, self.geometry, self.complex, self.container, self.theSimplicialComplex, self.vertices)
157
158        def __eq__(self, y):
159                if type(self) != type(y):
160                        return False
161                '''
162                Cannot compare classes which do not define a "__key" attribute
163                '''
164                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
165                        return self.__key() == y.__key()
166                return id(self) == id(y)
167
168        def __hash__(self):
169                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.