Exemple #1
0
 def UTM_get(self):
     d = self.GPS_get()
     if d:
         x = []
         y = []
         for a in range(0, len(d) - 1, 2):
             m, n = cal.wgs84toutm(d[a], d[a + 1])
             x.append(m)
             y.append(n)
         x_move = x[0] - 100
         y_move = y[0] - 100
         for b in range(0, len(x)):
             x[b] = x[b] - x_move
             y[b] = y[b] - y_move
         del (x[-1])
         del (y[-1])
         return x, y
     else:
         pass
Exemple #2
0
 def UTM_field(self):
     self.F = MyFigure(width=3, height=2, dpi=100)
     d = self.Import_Kml()
     if d:
         x = []
         y = []
         for a in range(0, len(d) - 1, 2):
             m, n = cal.wgs84toutm(d[a], d[a + 1])
             x.append(m)
             y.append(n)
         x_move = x[0] - 20
         y_move = y[0] - 20
         for b in range(0, len(x)):
             x[b] = x[b] - x_move
             y[b] = y[b] - y_move
         self.F.axes.plot(x, y)
         self.F.axes.axis('equal')
         self.horizontalLayout.addWidget(self.F)
     else:
         pass
    text = text + line
file.close()
c = re.sub(r"\f|\n|\r|\t|<|>", "", text)
d = re.findall(r"coordinates(.+?)/coordinates", c)
# 实现地块读取,输出坐标点point
for i in d:
    e = (re.sub(r"0 ", "", i))
    f = re.findall(r"([0-9]+\.[0-9]{13})", e)
    d = list(map(float, f[0::]))
    # print('d', d)
    if d:
        point = []
        x = []
        y = []
        for a in range(0, len(d) - 3, 2):
            m, n = cal.wgs84toutm(d[a], d[a + 1])
            # print('m', m)
            # print('n', n)
            x.append(m)
            y.append(n)
        x_move = x[0]
        y_move = y[0]
        for i in range(0, len(x)):
            x[i] = x[i] - x_move + 20
            y[i] = y[i] - y_move + 20
            point.append([x[i], y[i]])
# 画图界面标题
fig = plt.figure("扫描线填充算法", figsize=(6, 6))
ax = fig.add_subplot(1, 1, 1)
# ax.axis([0, LENGTH, 0, LENGTH])