source: mauRepo/MolesManager/trunk/src/ea_model/iso_19123_2005_coverages/coverages/discrete_coverages/cv_discretecoverage.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19123_2005_coverages/coverages/discrete_coverages/cv_discretecoverage.py@8091
Revision 8091, 5.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 ea_model.iso_19123_2005_coverages.coverages.coverage_core.cv_coverage import  CV_Coverage
22from ascore.utils import has_value
23
24'''
25Created on 16-Feb-2012 16:18:08
26
27@author: mnagni
28'''
29
30class CV_DiscreteCoverage(CV_Coverage):
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._cv_coverage = CV_Coverage()       
43
44        self.domainExtent = []
45        self._CRS_sc_singlecrs = None
46        self._CRS_sc_compoundcrs = None
47        self.domainElement = []
48        self.commonPointRule = None
49        self.rangeType = None
50        self._element_cv_curvevaluepair = []
51        self._element_cv_solidvaluepair = []
52        self._element_cvt_timeinstantvaluepair = []
53        self._element_cv_pointvaluepair = []
54        self._element_cv_surfacevaluepair = []
55        self._element_cv_gridpointvaluepair = []
56        self.rangeElement = []
57        super(CV_DiscreteCoverage, self).__init__()
58
59    @property
60    def domainExtent(self):     
61        return self._cv_coverage.domainExtent
62
63    @domainExtent.setter
64    def domainExtent(self, value):     
65            self._cv_coverage.domainExtent = value
66
67    @property
68    def CRS(self):     
69        return self._cv_coverage.CRS
70
71    @CRS.setter
72    def CRS(self, value):       
73            self._cv_coverage.CRS = value
74
75    @property
76    def domainElement(self):   
77        return self._cv_coverage.domainElement
78
79    @domainElement.setter
80    def domainElement(self, value):     
81            self._cv_coverage.domainElement = value
82
83    @property
84    def commonPointRule(self): 
85        return self._cv_coverage.commonPointRule
86
87    @commonPointRule.setter
88    def commonPointRule(self, value):   
89            self._cv_coverage.commonPointRule = value
90
91    @property
92    def rangeType(self):       
93        return self._cv_coverage.rangeType
94
95    @rangeType.setter
96    def rangeType(self, value): 
97            self._cv_coverage.rangeType = value
98
99    @property
100    def element(self): 
101        ret = []
102        for item in self._element_cv_curvevaluepair:
103            ret.append(item)
104        for item in self._element_cv_solidvaluepair:
105            ret.append(item)
106        for item in self._element_cvt_timeinstantvaluepair:
107            ret.append(item)
108        for item in self._element_cv_pointvaluepair:
109            ret.append(item)
110        for item in self._element_cv_surfacevaluepair:
111            ret.append(item)
112        for item in self._element_cv_gridpointvaluepair:
113            ret.append(item)
114        return ret
115
116    @element.setter
117    def element(self, value):   
118        if isinstance(value, list):
119            self._element_cv_curvevaluepair[:]
120            self._element_cv_solidvaluepair[:]
121            self._element_cvt_timeinstantvaluepair[:]
122            self._element_cv_pointvaluepair[:]
123            self._element_cv_surfacevaluepair[:]
124            self._element_cv_gridpointvaluepair[:]
125            for item in value:
126                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
127                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_curvevaluepair.CV_CurveValuePair":
128                    self._element_cv_curvevaluepair.append(item)
129                    continue
130                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_solidvaluepair.CV_SolidValuePair":
131                    self._element_cv_solidvaluepair.append(item)
132                    continue
133                if valueClass == "ea_model.iso_19156_2011_observations_and_measurements.temporal_coverage.cvt_timeinstantvaluepair.CVT_TimeInstantValuePair":
134                    self._element_cvt_timeinstantvaluepair.append(item)
135                    continue
136                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_pointvaluepair.CV_PointValuePair":
137                    self._element_cv_pointvaluepair.append(item)
138                    continue
139                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.discrete_coverages.cv_surfacevaluepair.CV_SurfaceValuePair":
140                    self._element_cv_surfacevaluepair.append(item)
141                    continue
142                if valueClass == "ea_model.iso_19123_2005_coverages.coverages.quadrilateral_grid.cv_gridpointvaluepair.CV_GridPointValuePair":
143                    self._element_cv_gridpointvaluepair.append(item)
144                    continue
145
146    @property
147    def rangeElement(self):     
148        return self._cv_coverage.rangeElement
149
150    @rangeElement.setter
151    def rangeElement(self, value):     
152            self._cv_coverage.rangeElement = value
153
154    def __key(self):
155        return (self.domainExtent, self.CRS, self.domainElement, self.commonPointRule, self.rangeType, self.element, self.rangeElement)
156
157    def __eq__(self, y):
158        '''
159        Cannot compare classes which do not define a "__key" attribute
160        '''
161        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
162            return self.__key() == y.__key()
163        return id(self) == id(y)
164
165    def __hash__(self):
166        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.