source: mauRepo/CedaMolesModel/tags/0.1.0/ceda_moles_model/ea_model/iso_19123_2005_coverages/coverages/coverage_core/cv_coverage.py @ 8398

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/CedaMolesModel/tags/0.1.0/ceda_moles_model/ea_model/iso_19123_2005_coverages/coverages/coverage_core/cv_coverage.py@8405
Revision 8398, 2.0 KB checked in by mnagni, 7 years ago (diff)

Incomplete - # 22504: CedaMoles? as python package
 http://team.ceda.ac.uk/trac/ceda/ticket/22504

  • Property svn:mime-type set to text/plain
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, collectionProofHash
22
23'''
24Created on 26-Jun-2012 10:16:34
25
26@author: mnagni
27'''
28
29class CV_Coverage(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.domainExtent = []
43                self._CRS_sc_compoundcrs = None
44                self._CRS_sc_singlecrs = None
45                self._CRS = None
46                self.domainElement = []
47                self.commonPointRule = None
48                self.rangeType = None
49                self.rangeElement = []
50                super(CV_Coverage, self).__init__()
51        @property
52        def CRS(self): 
53                if(has_value(self._CRS_sc_compoundcrs)):
54                        return self._CRS_sc_compoundcrs
55                if(has_value(self._CRS_sc_singlecrs)):
56                        return self._CRS_sc_singlecrs
57                return  None
58
59        @CRS.setter
60        def CRS(self, value):   
61                valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
62                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_compoundcrs.SC_CompoundCRS":
63                        self._CRS_sc_compoundcrs = value
64                        self._CRS_sc_singlecrs = None
65                if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_singlecrs.SC_SingleCRS":
66                        self._CRS_sc_singlecrs = value
67                        self._CRS_sc_compoundcrs = None
68
69        def synchronize(self):
70                pass
71
72        def __key(self):
73                return (self.domainExtent, self.CRS, self.domainElement, self.commonPointRule, self.rangeType, self.rangeElement)
74
75        def __eq__(self, y):
76                if type(self) != type(y):
77                        return False
78                '''
79                Cannot compare classes which do not define a "__key" attribute
80                '''
81                if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
82                        return self.__key() == y.__key()
83                return id(self) == id(y)
84
85        def __hash__(self):
86                return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.