source: mauRepo/MolesManager/trunk/src/ea_model/iso_19107_2003_spatial_schema/topology/topological_complex/tp_complex.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_complex/tp_complex.py@8091
Revision 8091, 3.2 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_Complex(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.maximalComplex = None
43        self.superComplex = []
44        self.subComplex = []
45        self.geometry = None
46        self._element_tp_directedtopo = []
47        self._element_tp_edge = []
48        self._element_tp_node = []
49        self._element_tp_solid = []
50        self._element_tp_face = []
51        super(TP_Complex, self).__init__()
52
53    @property
54    def element(self): 
55        ret = []
56        for item in self._element_tp_directedtopo:
57            ret.append(item)
58        for item in self._element_tp_edge:
59            ret.append(item)
60        for item in self._element_tp_node:
61            ret.append(item)
62        for item in self._element_tp_solid:
63            ret.append(item)
64        for item in self._element_tp_face:
65            ret.append(item)
66        return ret
67
68    @element.setter
69    def element(self, value):   
70        if isinstance(value, list):
71            self._element_tp_directedtopo[:]
72            self._element_tp_edge[:]
73            self._element_tp_node[:]
74            self._element_tp_solid[:]
75            self._element_tp_face[:]
76            for item in value:
77                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
78                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_directedtopo.TP_DirectedTopo":
79                    self._element_tp_directedtopo.append(item)
80                    continue
81                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_edge.TP_Edge":
82                    self._element_tp_edge.append(item)
83                    continue
84                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_node.TP_Node":
85                    self._element_tp_node.append(item)
86                    continue
87                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_solid.TP_Solid":
88                    self._element_tp_solid.append(item)
89                    continue
90                if valueClass == "ea_model.iso_19107_2003_spatial_schema.topology.topological_primitive.tp_face.TP_Face":
91                    self._element_tp_face.append(item)
92                    continue
93
94    def __key(self):
95        return (self.maximalComplex, self.superComplex, self.subComplex, self.geometry, self.element)
96
97    def __eq__(self, y):
98        '''
99        Cannot compare classes which do not define a "__key" attribute
100        '''
101        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
102            return self.__key() == y.__key()
103        return id(self) == id(y)
104
105    def __hash__(self):
106        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.