1 | |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | from ea_model.iso_19107_2003_spatial_schema.geometry.geometric_complex.gm_complex import GM_Complex |
---|
22 | from ascore.utils import has_value, collectionProofHash |
---|
23 | |
---|
24 | ''' |
---|
25 | Created on 10-Jul-2012 14:14:59 |
---|
26 | |
---|
27 | @author: mnagni |
---|
28 | ''' |
---|
29 | |
---|
30 | class GM_Composite(GM_Complex): |
---|
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._gm_complex = GM_Complex() |
---|
43 | |
---|
44 | self.topology = None |
---|
45 | self.CRS = None |
---|
46 | self._generator_simplex = [] |
---|
47 | self._generator_gm_solid = [] |
---|
48 | self._generator_cell = [] |
---|
49 | self._generator_gm_orientableprimitive = [] |
---|
50 | self._generator_gm_point = [] |
---|
51 | self._generator = [] |
---|
52 | super(GM_Composite, self).__init__() |
---|
53 | @property |
---|
54 | def topology(self): |
---|
55 | return self._gm_complex.topology |
---|
56 | |
---|
57 | @topology.setter |
---|
58 | def topology(self, value): |
---|
59 | self._gm_complex.topology = value |
---|
60 | @property |
---|
61 | def CRS(self): |
---|
62 | return self._gm_complex.CRS |
---|
63 | |
---|
64 | @CRS.setter |
---|
65 | def CRS(self, value): |
---|
66 | self._gm_complex.CRS = value |
---|
67 | @property |
---|
68 | def superComplex(self): |
---|
69 | return self._gm_complex.superComplex |
---|
70 | |
---|
71 | @superComplex.setter |
---|
72 | def superComplex(self, value): |
---|
73 | self._gm_complex.superComplex = value |
---|
74 | @property |
---|
75 | def subComplex(self): |
---|
76 | return self._gm_complex.subComplex |
---|
77 | |
---|
78 | @subComplex.setter |
---|
79 | def subComplex(self, value): |
---|
80 | self._gm_complex.subComplex = value |
---|
81 | @property |
---|
82 | def element(self): |
---|
83 | return self._gm_complex.element |
---|
84 | |
---|
85 | @element.setter |
---|
86 | def element(self, value): |
---|
87 | self._gm_complex.element = value |
---|
88 | @property |
---|
89 | def generator(self): |
---|
90 | try: |
---|
91 | ret = [] |
---|
92 | ret.extend(self._generator_simplex) |
---|
93 | ret.extend(self._generator_gm_solid) |
---|
94 | ret.extend(self._generator_cell) |
---|
95 | ret.extend(self._generator_gm_orientableprimitive) |
---|
96 | ret.extend(self._generator_gm_point) |
---|
97 | if not hasattr(self, '_generator'): |
---|
98 | self._generator = [] |
---|
99 | if self._generator is not None: |
---|
100 | ret.extend(self._generator) |
---|
101 | del self._generator[:] |
---|
102 | self._generator.extend(set(ret)) |
---|
103 | except Exception as e: |
---|
104 | pass |
---|
105 | return self._generator |
---|
106 | |
---|
107 | |
---|
108 | def synchronize(self): |
---|
109 | int_generator = self.generator |
---|
110 | del self._generator_simplex[:] |
---|
111 | del self._generator_gm_solid[:] |
---|
112 | del self._generator_cell[:] |
---|
113 | del self._generator_gm_orientableprimitive[:] |
---|
114 | del self._generator_gm_point[:] |
---|
115 | for item in int_generator: |
---|
116 | valueClass = "%s.%s" % (type(item).__module__,type(item).__name__) |
---|
117 | if valueClass == "ea_model.informative.spatial_examples_from_iso_19107.application_schema.simplicial_topology.simplex.Simplex": |
---|
118 | self._generator_simplex.append(item) |
---|
119 | continue |
---|
120 | if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_primitive.gm_solid.GM_Solid": |
---|
121 | self._generator_gm_solid.append(item) |
---|
122 | continue |
---|
123 | if valueClass == "ea_model.informative.spatial_examples_from_iso_19107.application_schema.topology_simple.cellular_topology.cell.Cell": |
---|
124 | self._generator_cell.append(item) |
---|
125 | continue |
---|
126 | if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_primitive.gm_orientableprimitive.GM_OrientablePrimitive": |
---|
127 | self._generator_gm_orientableprimitive.append(item) |
---|
128 | continue |
---|
129 | if valueClass == "ea_model.iso_19107_2003_spatial_schema.geometry.geometric_primitive.gm_point.GM_Point": |
---|
130 | self._generator_gm_point.append(item) |
---|
131 | continue |
---|
132 | pass |
---|
133 | |
---|
134 | def __key(self): |
---|
135 | return (self.topology, self.CRS, self.superComplex, self.subComplex, self.element, self.generator) |
---|
136 | |
---|
137 | def __eq__(self, y): |
---|
138 | if type(self) != type(y): |
---|
139 | return False |
---|
140 | ''' |
---|
141 | Cannot compare classes which do not define a "__key" attribute |
---|
142 | ''' |
---|
143 | if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): |
---|
144 | return self.__key() == y.__key() |
---|
145 | return id(self) == id(y) |
---|
146 | |
---|
147 | def __hash__(self): |
---|
148 | return collectionProofHash(self.__key()) |
---|