source: mauRepo/MolesManager/trunk/src/ea_model/iso_19123_2005_coverages/coverages/coverage_core/cv_geometryvaluepair.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19123_2005_coverages/coverages/coverage_core/cv_geometryvaluepair.py@8091
Revision 8091, 6.4 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:08
25
26@author: mnagni
27'''
28
29class CV_GeometryValuePair(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._collection_cv_discretegridpointcoverage = []
43        self._collection_cvt_discretetimeinstantcoverage = []
44        self._collection_cv_discretesurfacecoverage = []
45        self._collection_cv_discretecurvecoverage = []
46        self._collection_cv_discretepointcoverage = []
47        self._collection_cv_discretesolidcoverage = []
48        self.value = None
49        self.geometry = None
50        self._extension_cv_valuehexagon = []
51        self._extension_cv_gridvaluecell = []
52        self._extension_cv_valuecurve = []
53        self._extension_cv_valuetriangle = []
54        self._extension_cv_thiessenvaluepolygon = []
55        super(CV_GeometryValuePair, self).__init__()
56
57    @property
58    def collection(self):       
59        ret = []
60        for item in self._collection_cv_discretegridpointcoverage:
61            ret.append(item)
62        for item in self._collection_cvt_discretetimeinstantcoverage:
63            ret.append(item)
64        for item in self._collection_cv_discretesurfacecoverage:
65            ret.append(item)
66        for item in self._collection_cv_discretecurvecoverage:
67            ret.append(item)
68        for item in self._collection_cv_discretepointcoverage:
69            ret.append(item)
70        for item in self._collection_cv_discretesolidcoverage:
71            ret.append(item)
72        return ret
73
74    @collection.setter
75    def collection(self, value):       
76        if isinstance(value, list):
77            self._collection_cv_discretegridpointcoverage[:]
78            self._collection_cvt_discretetimeinstantcoverage[:]
79            self._collection_cv_discretesurfacecoverage[:]
80            self._collection_cv_discretecurvecoverage[:]
81            self._collection_cv_discretepointcoverage[:]
82            self._collection_cv_discretesolidcoverage[:]
83            for item in value:
84                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
85                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_discretegridpointcoverage.CV_DiscreteGridPointCoverage":
86                    self._collection_cv_discretegridpointcoverage.append(item)
87                    continue
88                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.temporal_coverage.cvt_discretetimeinstantcoverage.CVT_DiscreteTimeInstantCoverage":
89                    self._collection_cvt_discretetimeinstantcoverage.append(item)
90                    continue
91                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_discretesurfacecoverage.CV_DiscreteSurfaceCoverage":
92                    self._collection_cv_discretesurfacecoverage.append(item)
93                    continue
94                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_discretecurvecoverage.CV_DiscreteCurveCoverage":
95                    self._collection_cv_discretecurvecoverage.append(item)
96                    continue
97                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_discretepointcoverage.CV_DiscretePointCoverage":
98                    self._collection_cv_discretepointcoverage.append(item)
99                    continue
100                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_discretesolidcoverage.CV_DiscreteSolidCoverage":
101                    self._collection_cv_discretesolidcoverage.append(item)
102                    continue
103
104    @property
105    def extension(self):       
106        ret = []
107        for item in self._extension_cv_valuehexagon:
108            ret.append(item)
109        for item in self._extension_cv_gridvaluecell:
110            ret.append(item)
111        for item in self._extension_cv_valuecurve:
112            ret.append(item)
113        for item in self._extension_cv_valuetriangle:
114            ret.append(item)
115        for item in self._extension_cv_thiessenvaluepolygon:
116            ret.append(item)
117        return ret
118
119    @extension.setter
120    def extension(self, value): 
121        if isinstance(value, list):
122            self._extension_cv_valuehexagon[:]
123            self._extension_cv_gridvaluecell[:]
124            self._extension_cv_valuecurve[:]
125            self._extension_cv_valuetriangle[:]
126            self._extension_cv_thiessenvaluepolygon[:]
127            for item in value:
128                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
129                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.hexagonal_grid.cv_valuehexagon.CV_ValueHexagon":
130                    self._extension_cv_valuehexagon.append(item)
131                    continue
132                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.quadrilateral_grid.cv_gridvaluecell.CV_GridValueCell":
133                    self._extension_cv_gridvaluecell.append(item)
134                    continue
135                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.segmented_curve.cv_valuecurve.CV_ValueCurve":
136                    self._extension_cv_valuecurve.append(item)
137                    continue
138                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.tin.cv_valuetriangle.CV_ValueTriangle":
139                    self._extension_cv_valuetriangle.append(item)
140                    continue
141                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.thiessen_polygon.cv_thiessenvaluepolygon.CV_ThiessenValuePolygon":
142                    self._extension_cv_thiessenvaluepolygon.append(item)
143                    continue
144
145    def __key(self):
146        return (self.collection, self.value, self.geometry, self.extension)
147
148    def __eq__(self, y):
149        '''
150        Cannot compare classes which do not define a "__key" attribute
151        '''
152        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
153            return self.__key() == y.__key()
154        return id(self) == id(y)
155
156    def __hash__(self):
157        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.