コード例 #1
0
 def Readwaysfromdb(self, ID):
     if self.Istablecreated('ways'):
         query = 'SELECT ref FROM ways WHERE id = %s' % ID
         self.curs.execute(query)
         tmplist = self.curs.fetchone()
         tmp = []
         if tmplist is not None:
             tmplist = tmplist[0].split(' ')
             i = 0
             while(i < (len(tmplist)-2)):
                 point0 = [float(tmplist[i]), float(tmplist[i+1])]
                 point1 = [float(tmplist[i+2]), float(tmplist[i+3])]
                 point0 = dealfile.getXY(point0)
                 point1 = dealfile.getXY(point1)
                 tmp.append([point0, point1])
                 i += 2
         else:
             print "未找到指定way数据"
         return tmp
     else:
         print "ways表格未创建,读取错误!"
         return None
コード例 #2
0
 def nodetrans(self, nd):
     if nd is not None:
         return dealfile.getXY(nd)
     return []
コード例 #3
0
 def nodetrans(self, nd):
     return dealfile.getXY(nd)