Example #1
0
 def initConnections(self,uconf,lgval,destname): 
     from lds.TransferProcessor import TransferProcessor
     #write a refresh CC instead of re initialising the whole object, for use when the dest menu changes  
     #lgval isn't used in CC itself but the gui's use it for menu indexing      
     self.lgval = lgval
     #Optimisation. If the uconf or dest type are unchanged don't go through the expensive task of updating TP and the layer lists
     if uconf and destname and ((uconf,destname)!=(self.uconf,self.destname)):
         #lgpair = (LORG.LAYER if re.match('^v:x',lgval) else LORG.GROUP,lgval) if lgval else (None,None)
         self.uconf = self._checkUConf(uconf)
         self.tp = TransferProcessor(self,lgval, None, None, None, None, None, None, uconf)
         sep = self.reg.openEndPoint(self.SRCNAME, self.uconf)    
         dep = self.reg.openEndPoint(destname, self.uconf)
         self.tp.setSRC(sep)
         self.tp.setDST(dep)
         #svp = Service, Version, Prefix
         self.svp = self.readProtocolVersion(sep)
         self.reg.setupLayerConfig(self.tp,sep,dep,self.initlc)
         #print 'CCt',self.tp
         #print 'CCd',self.dep
         if not self.vlayers or self.destname != destname:
             self.destname = destname
             self.vlayers = self.getValidLayers(sep,dep)
             self.setupReservedLayerList()
         self.setupAssignedLayerList()
         self.buildLayerGroupList()
         self.inclayers = [self.svp['idp']+x[0] for x in ConfigInitialiser.readCSV()]
         #self.reg.closeLayerConfig(dep)
         self.reg.closeEndPoint(destname)
         self.reg.closeEndPoint(self.SRCNAME)
         sep,dep = None,None
     elif destname and not uconf:
         raise ConnectionConfigurationException('Missing configuration, "{}.conf"'.format(uconf))
     elif uconf and not destname:
         raise ConnectionConfigurationException('No driver/dest specified "{}"'.format(destname))
Example #2
0
    def initEPSG(self):
        '''Read GDAL EPSG files, splitting by NZ(RSR) and RestOfTheWorld'''

        gcsf = gdal.FindFile('gdal','gcs.csv') 
        if not gcsf:
            gcsf = os.path.join(self.GD_PATH,'gcs.csv')
        pcsf = gdal.FindFile('gdal','pcs.csv') 
        if not pcsf: 
            pcsf = os.path.join(self.GD_PATH,'pcs.csv')
        gcs = ConfigInitialiser.readCSV(gcsf)
        pcs = ConfigInitialiser.readCSV(pcsf)

        self.nzlsr = [(e[0],e[0]+' - '+e[3]) for e in gcs if 'NZGD'     in e[1] or  'RSRGD'     in e[1]] \
                   + [(e[0],e[0]+' - '+e[1]) for e in pcs if 'NZGD'     in e[1] or  'RSRGD'     in e[1]]
        self.rowsr = [(e[0],e[0]+' - '+e[3]) for e in gcs if 'NZGD' not in e[1] and 'RSRGD' not in e[1]] \
                   + [(e[0],e[0]+' - '+e[1]) for e in pcs if 'NZGD' not in e[1] and 'RSRGD' not in e[1]]
Example #3
0
    def initEPSG(self):
        '''Read GDAL EPSG files, splitting by NZ(RSR) and RestOfTheWorld'''

        gcsf = gdal.FindFile('gdal','gcs.csv') 
        if not gcsf:
            gcsf = os.path.join(self.GD_PATH,'gcs.csv')
        pcsf = gdal.FindFile('gdal','pcs.csv') 
        if not pcsf: 
            pcsf = os.path.join(self.GD_PATH,'pcs.csv')
        gcs = ConfigInitialiser.readCSV(gcsf)
        pcs = ConfigInitialiser.readCSV(pcsf)

        self.nzlsr = [(e[0],e[0]+' - '+e[3]) for e in gcs if 'NZGD'     in e[1] or  'RSRGD'     in e[1]] \
                   + [(e[0],e[0]+' - '+e[1]) for e in pcs if 'NZGD'     in e[1] or  'RSRGD'     in e[1]]
        self.rowsr = [(e[0],e[0]+' - '+e[3]) for e in gcs if 'NZGD' not in e[1] and 'RSRGD' not in e[1]] \
                   + [(e[0],e[0]+' - '+e[1]) for e in pcs if 'NZGD' not in e[1] and 'RSRGD' not in e[1]]
Example #4
0
 def initConnections(self, uconf, lgval, destname):
     from lds.TransferProcessor import TransferProcessor
     #write a refresh CC instead of re initialising the whole object, for use when the dest menu changes
     #lgval isn't used in CC itself but the gui's use it for menu indexing
     self.lgval = lgval
     #Optimisation. If the uconf or dest type are unchanged don't go through the expensive task of updating TP and the layer lists
     if uconf and destname and ((uconf, destname) !=
                                (self.uconf, self.destname)):
         #lgpair = (LORG.LAYER if re.match('^v:x',lgval) else LORG.GROUP,lgval) if lgval else (None,None)
         self.uconf = self._checkUConf(uconf)
         self.tp = TransferProcessor(self, lgval, None, None, None, None,
                                     None, None, uconf)
         sep = self.reg.openEndPoint(self.SRCNAME, self.uconf)
         dep = self.reg.openEndPoint(destname, self.uconf)
         self.tp.setSRC(sep)
         self.tp.setDST(dep)
         #svp = Service, Version, Prefix
         self.svp = self.readProtocolVersion(sep)
         self.reg.setupLayerConfig(self.tp, sep, dep, self.initlc)
         #print 'CCt',self.tp
         #print 'CCd',self.dep
         if not self.vlayers or self.destname != destname:
             self.destname = destname
             self.vlayers = self.getValidLayers(sep, dep)
             self.setupReservedLayerList()
         self.setupAssignedLayerList()
         self.buildLayerGroupList()
         self.inclayers = [
             self.svp['idp'] + x[0] for x in ConfigInitialiser.readCSV()
         ]
         #self.reg.closeLayerConfig(dep)
         self.reg.closeEndPoint(destname)
         self.reg.closeEndPoint(self.SRCNAME)
         sep, dep = None, None
     elif destname and not uconf:
         raise ConnectionConfigurationException(
             'Missing configuration, "{}.conf"'.format(uconf))
     elif uconf and not destname:
         raise ConnectionConfigurationException(
             'No driver/dest specified "{}"'.format(destname))