source: mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/ground_control/sd_gcpcollection.py @ 8091

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/ea_model/iso_19130_sensor_data/ground_control/sd_gcpcollection.py@8091
Revision 8091, 4.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_19130_sensor_data.sd_geolocationinformation import  SD_GeolocationInformation
22from ascore.utils import has_value
23
24'''
25Created on 16-Feb-2012 16:18:09
26
27@author: mnagni
28'''
29
30class SD_GCPCollection(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._coordinateReferenceSystem_sc_singlecrs = None
45        self._coordinateReferenceSystem_sc_compoundcrs = None
46        self.qualityInfo = []
47        self.collectionName = None
48        self.collectionIdentification = None
49        self._gcp_sd_gcpsurvey = []
50        self._gcp_sd_gcplibrary = []
51        self._gcp_sd_gcplocation = []
52        self._gcp_sd_gcpregistry = []
53        super(SD_GCPCollection, self).__init__()
54
55    @property
56    def coordinateReferenceSystem(self):       
57        if(has_value(self._coordinateReferenceSystem_sc_singlecrs)):
58            return self._coordinateReferenceSystem_sc_singlecrs
59        if(has_value(self._coordinateReferenceSystem_sc_compoundcrs)):
60            return self._coordinateReferenceSystem_sc_compoundcrs
61        return  None
62
63    @coordinateReferenceSystem.setter
64    def coordinateReferenceSystem(self, value): 
65        valueClass = "%s.%s" % (type(value).__module__,type(value).__name__)
66        if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_singlecrs.SC_SingleCRS":
67            self._coordinateReferenceSystem_sc_singlecrs = value
68            self._coordinateReferenceSystem_sc_compoundcrs = None
69        if valueClass == "ea_model.iso_19111_referencing_by_coordinates.coordinate_reference_systems.sc_compoundcrs.SC_CompoundCRS":
70            self._coordinateReferenceSystem_sc_compoundcrs = value
71            self._coordinateReferenceSystem_sc_singlecrs = None
72
73    @property
74    def qualityInfo(self):     
75        return self._sd_geolocationinformation.qualityInfo
76
77    @qualityInfo.setter
78    def qualityInfo(self, value):       
79            self._sd_geolocationinformation.qualityInfo = value
80
81    @property
82    def gcp(self):     
83        ret = []
84        for item in self._gcp_sd_gcpsurvey:
85            ret.append(item)
86        for item in self._gcp_sd_gcplibrary:
87            ret.append(item)
88        for item in self._gcp_sd_gcplocation:
89            ret.append(item)
90        for item in self._gcp_sd_gcpregistry:
91            ret.append(item)
92        return ret
93
94    @gcp.setter
95    def gcp(self, value):       
96        if isinstance(value, list):
97            self._gcp_sd_gcpsurvey[:]
98            self._gcp_sd_gcplibrary[:]
99            self._gcp_sd_gcplocation[:]
100            self._gcp_sd_gcpregistry[:]
101            for item in value:
102                valueClass = "%s.%s" % (type(item).__module__,type(item).__name__)
103                if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcpsurvey.SD_GCPSurvey":
104                    self._gcp_sd_gcpsurvey.append(item)
105                    continue
106                if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcplibrary.SD_GCPLibrary":
107                    self._gcp_sd_gcplibrary.append(item)
108                    continue
109                if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcplocation.SD_GCPLocation":
110                    self._gcp_sd_gcplocation.append(item)
111                    continue
112                if valueClass == "ea_model.iso_19130_sensor_data.ground_control.sd_gcpregistry.SD_GCPRegistry":
113                    self._gcp_sd_gcpregistry.append(item)
114                    continue
115
116    def __key(self):
117        return (self.coordinateReferenceSystem, self.qualityInfo, self.collectionName, self.collectionIdentification, self.gcp)
118
119    def __eq__(self, y):
120        '''
121        Cannot compare classes which do not define a "__key" attribute
122        '''
123        if hasattr(self, '_%s__key' % (type(self).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)):
124            return self.__key() == y.__key()
125        return id(self) == id(y)
126
127    def __hash__(self):
128        return hash(self.__key())
Note: See TracBrowser for help on using the repository browser.