source: mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/raster_digitised_product/sd_rasterdigitisedproduct.py @ 8197

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/raster_digitised_product/sd_rasterdigitisedproduct.py@8197
Revision 8197, 5.0 KB checked in by mnagni, 8 years ago (diff)

New database schema where URL class is a string and MO_Project.subProject use CEDA_Project as subType

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_19130_sensor_data.sd_geolocationinformation import  SD_GeolocationInformation
22from ascore.utils import has_value, collectionProofHash
23
24'''
25Created on 30-Mar-2012 16:45:23
26
27@author: mnagni
28'''
29
30class SD_RasterDigitisedProduct(SD_GeolocationInformation):
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._sd_geolocationinformation = SD_GeolocationInformation()   
43
44        self.interiorOrientation = None
45        self.detectorArray = None
46        self.qualityInfo = []
47        self._scannerControlPoint_sd_gcplocation = None
48        self._scannerControlPoint_sd_gcpregistry = None
49        self._scannerControlPoint_sd_gcpsurvey = None
50        self._scannerControlPoint_sd_gcplibrary = None
51        self._hardcopy_sd_film = []
52        self._hardcopy_sd_paper = []
53        self.scannerTransformation = None
54        super(SD_RasterDigitisedProduct, self).__init__()
55
56    @property
57    def qualityInfo(self):     
58        return self._sd_geolocationinformation.qualityInfo
59
60    @qualityInfo.setter
61    def qualityInfo(self, value):       
62            self._sd_geolocationinformation.qualityInfo = value
63
64    @property
65    def scannerControlPoint(self):     
66        if(has_value(self._scannerControlPoint_sd_gcplocation)):
67            return self._scannerControlPoint_sd_gcplocation
68        if(has_value(self._scannerControlPoint_sd_gcpregistry)):
69            return self._scannerControlPoint_sd_gcpregistry
70        if(has_value(self._scannerControlPoint_sd_gcpsurvey)):
71            return self._scannerControlPoint_sd_gcpsurvey
72        if(has_value(self._scannerControlPoint_sd_gcplibrary)):
73            return self._scannerControlPoint_sd_gcplibrary
74        return  None
75
76    @scannerControlPoint.setter
77    def scannerControlPoint(self, value):       
78        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
79        if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcplocation.SD_GCPLocation":
80            self._scannerControlPoint_sd_gcplocation = value
81            self._scannerControlPoint_sd_gcpregistry = None
82            self._scannerControlPoint_sd_gcpsurvey = None
83            self._scannerControlPoint_sd_gcplibrary = None
84        if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcpregistry.SD_GCPRegistry":
85            self._scannerControlPoint_sd_gcpregistry = value
86            self._scannerControlPoint_sd_gcplocation = None
87            self._scannerControlPoint_sd_gcpsurvey = None
88            self._scannerControlPoint_sd_gcplibrary = None
89        if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcpsurvey.SD_GCPSurvey":
90            self._scannerControlPoint_sd_gcpsurvey = value
91            self._scannerControlPoint_sd_gcplocation = None
92            self._scannerControlPoint_sd_gcpregistry = None
93            self._scannerControlPoint_sd_gcplibrary = None
94        if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcplibrary.SD_GCPLibrary":
95            self._scannerControlPoint_sd_gcplibrary = value
96            self._scannerControlPoint_sd_gcplocation = None
97            self._scannerControlPoint_sd_gcpregistry = None
98            self._scannerControlPoint_sd_gcpsurvey = None
99
100    @property
101    def hardcopy(self): 
102        ret = []
103        for item in self._hardcopy_sd_film:
104            ret.append(item)
105        for item in self._hardcopy_sd_paper:
106            ret.append(item)
107        return ret
108
109    @hardcopy.setter
110    def hardcopy(self, value): 
111        if isinstance(value, list):
112            self._hardcopy_sd_film[:]
113            self._hardcopy_sd_paper[:]
114            for item in value:
115                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
116                if valueClass == "ea_model.iso_19130_sensor_data.raster_digitised_product.sd_film.SD_Film":
117                    self._hardcopy_sd_film.append(item)
118                    continue
119                if valueClass == "ea_model.iso_19130_sensor_data.raster_digitised_product.sd_paper.SD_Paper":
120                    self._hardcopy_sd_paper.append(item)
121                    continue
122
123    def __key(self):
124        return (self.interiorOrientation, self.detectorArray, self.qualityInfo, self.scannerControlPoint, self.hardcopy, self.scannerTransformation)
125
126    def __eq__(self, y):
127        if type(self) != type(y):
128            return False
129        '''
130        Cannot compare classes which do not define a "__key" attribute
131        '''
132        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
133            return self.__key() == y.__key()
134        return id(self) == id(y)
135
136    def __hash__(self):
137        return collectionProofHash(self.__key())
Note: See TracBrowser for help on using the repository browser.