source: mauRepo/MolesManager/trunk/src/ea_model/iso_19107_2003_spatial_schema/topology/topological_primitive/tp_primitive.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19107_2003_spatial_schema/topology/topological_primitive/tp_primitive.py@8091
Revision 8091, 9.1 KB checked in by mnagni, 8 years ago (diff)

The migration process now includes
1) deployment_data files
2) XML document hash
3) full Dojo support


Line 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21from ascore.utils import has_value
22
23'''
24Created on 16-Feb-2012 16:18:09
25
26@author: mnagni
27'''
28
29class TP_Primitive(object):
30    '''
31        Represents a data entity defined in a UML diagram and supposed to
32        be persisted in a relational database.
33 
34        This class has been genererated automatically using the Apache Velocity project.
35    '''
36    '''
37        Please note that any access to the inner attributes should be done using
38        the given get/set methods and NOT accessing them directly.
39    '''
40    def __init__(self):
41
42        self._isolated_tp_directedtopo = []
43        self._isolated_tp_edge = []
44        self._isolated_tp_node = []
45        self._isolated_tp_solid = []
46        self._isolated_tp_face = []
47        self.maximalComplex = None
48        self._proxy_tp_directedface = None
49        self._proxy_tp_directednode = None
50        self._proxy_tp_directedsolid = None
51        self._proxy_tp_directededge = None
52        self._geometry_gm_orientableprimitive = None
53        self._geometry_gm_point = None
54        self._geometry_gm_solid = None
55        self.complex = []
56        self._container_tp_directedtopo = None
57        self._container_tp_edge = None
58        self._container_tp_node = None
59        self._container_tp_solid = None
60        self._container_tp_face = None
61        super(TP_Primitive, self).__init__()
62
63    @property
64    def isolated(self): 
65        ret = []
66        for item in self._isolated_tp_directedtopo:
67            ret.append(item)
68        for item in self._isolated_tp_edge:
69            ret.append(item)
70        for item in self._isolated_tp_node:
71            ret.append(item)
72        for item in self._isolated_tp_solid:
73            ret.append(item)
74        for item in self._isolated_tp_face:
75            ret.append(item)
76        return ret
77
78    @isolated.setter
79    def isolated(self, value): 
80        if isinstance(value, list):
81            self._isolated_tp_directedtopo[:]
82            self._isolated_tp_edge[:]
83            self._isolated_tp_node[:]
84            self._isolated_tp_solid[:]
85            self._isolated_tp_face[:]
86            for item in value:
87                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
88                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedtopo.TP_DirectedTopo":
89                    self._isolated_tp_directedtopo.append(item)
90                    continue
91                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_edge.TP_Edge":
92                    self._isolated_tp_edge.append(item)
93                    continue
94                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_node.TP_Node":
95                    self._isolated_tp_node.append(item)
96                    continue
97                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_solid.TP_Solid":
98                    self._isolated_tp_solid.append(item)
99                    continue
100                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_face.TP_Face":
101                    self._isolated_tp_face.append(item)
102                    continue
103
104    @property
105    def proxy(self):   
106        if(has_value(self._proxy_tp_directedface)):
107            return self._proxy_tp_directedface
108        if(has_value(self._proxy_tp_directednode)):
109            return self._proxy_tp_directednode
110        if(has_value(self._proxy_tp_directedsolid)):
111            return self._proxy_tp_directedsolid
112        if(has_value(self._proxy_tp_directededge)):
113            return self._proxy_tp_directededge
114        return  None
115
116    @proxy.setter
117    def proxy(self, value):     
118        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
119        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedface.TP_DirectedFace":
120            self._proxy_tp_directedface = value
121            self._proxy_tp_directednode = None
122            self._proxy_tp_directedsolid = None
123            self._proxy_tp_directededge = None
124        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directednode.TP_DirectedNode":
125            self._proxy_tp_directednode = value
126            self._proxy_tp_directedface = None
127            self._proxy_tp_directedsolid = None
128            self._proxy_tp_directededge = None
129        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedsolid.TP_DirectedSolid":
130            self._proxy_tp_directedsolid = value
131            self._proxy_tp_directedface = None
132            self._proxy_tp_directednode = None
133            self._proxy_tp_directededge = None
134        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directededge.TP_DirectedEdge":
135            self._proxy_tp_directededge = value
136            self._proxy_tp_directedface = None
137            self._proxy_tp_directednode = None
138            self._proxy_tp_directedsolid = None
139
140    @property
141    def geometry(self): 
142        if(has_value(self._geometry_gm_orientableprimitive)):
143            return self._geometry_gm_orientableprimitive
144        if(has_value(self._geometry_gm_point)):
145            return self._geometry_gm_point
146        if(has_value(self._geometry_gm_solid)):
147            return self._geometry_gm_solid
148        return  None
149
150    @geometry.setter
151    def geometry(self, value): 
152        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
153        if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_primitive.gm_orientableprimitive.GM_OrientablePrimitive":
154            self._geometry_gm_orientableprimitive = value
155            self._geometry_gm_point = None
156            self._geometry_gm_solid = None
157        if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_primitive.gm_point.GM_Point":
158            self._geometry_gm_point = value
159            self._geometry_gm_orientableprimitive = None
160            self._geometry_gm_solid = None
161        if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_primitive.gm_solid.GM_Solid":
162            self._geometry_gm_solid = value
163            self._geometry_gm_orientableprimitive = None
164            self._geometry_gm_point = None
165
166    @property
167    def container(self):       
168        if(has_value(self._container_tp_directedtopo)):
169            return self._container_tp_directedtopo
170        if(has_value(self._container_tp_edge)):
171            return self._container_tp_edge
172        if(has_value(self._container_tp_node)):
173            return self._container_tp_node
174        if(has_value(self._container_tp_solid)):
175            return self._container_tp_solid
176        if(has_value(self._container_tp_face)):
177            return self._container_tp_face
178        return  None
179
180    @container.setter
181    def container(self, value): 
182        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
183        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedtopo.TP_DirectedTopo":
184            self._container_tp_directedtopo = value
185            self._container_tp_edge = None
186            self._container_tp_node = None
187            self._container_tp_solid = None
188            self._container_tp_face = None
189        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_edge.TP_Edge":
190            self._container_tp_edge = value
191            self._container_tp_directedtopo = None
192            self._container_tp_node = None
193            self._container_tp_solid = None
194            self._container_tp_face = None
195        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_node.TP_Node":
196            self._container_tp_node = value
197            self._container_tp_directedtopo = None
198            self._container_tp_edge = None
199            self._container_tp_solid = None
200            self._container_tp_face = None
201        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_solid.TP_Solid":
202            self._container_tp_solid = value
203            self._container_tp_directedtopo = None
204            self._container_tp_edge = None
205            self._container_tp_node = None
206            self._container_tp_face = None
207        if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_face.TP_Face":
208            self._container_tp_face = value
209            self._container_tp_directedtopo = None
210            self._container_tp_edge = None
211            self._container_tp_node = None
212            self._container_tp_solid = None
213
214    def __key(self):
215        return (self.isolated, self.maximalComplex, self.proxy, self.geometry, self.complex, self.container)
216
217    def __eq__(self, y):
218        '''
219        Cannot compare classes which do not define a "__key" attribute
220        '''
221        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
222            return self.__key() == y.__key()
223        return id(self) == id(y)
224
225    def __hash__(self):
226        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.