def setKMap(lat_result, lon_result): x = Initialize.initialize() lats = int(x.enter_latitude.get()) lons = int(x.enter_longitude.get()) lat, lon, datas = solveKMapData() data, layout = setMapData(lat_result, lon_result, lats, lons, datas) return data, layout
def show(): x = Initialize.initialize() x.top.geometry('300x550') x.top.title("星巴克店铺分布及统计") x.button.place(x=50, y=50) x.button1.place(x=150, y=50) x.button5.place(x=250, y=50) x.button2.place(x=50, y=100) x.button2.place(x=150, y=100) x.latitude.place(x=50, y=150) x.enter_latitude.place(x=100, y=150) x.longitude.place(x=50, y=180) x.enter_longitude.place(x=100, y=180) x.radius.place(x=50, y=210) x.radius_value.place(x=100, y=210) x.k.place(x=50, y=240) x.k_value.place(x=100, y=240) x.key_word.place(x=50, y=270) x.key_word_enter.place(x=100, y=270) x.button3.place(x=100, y=300) x.button4.place(x=100, y=340) x.button6.place(x=100, y=380) x.button7.place(x=100, y=430) x.button8.place(x=100, y=480) x.button9.place(x=200, y=480) x.top.mainloop()
def showKMap(): x = Initialize.initialize() lats = int(x.enter_latitude.get()) lons = int(x.enter_longitude.get()) ks = int(x.k_value.get()) if (lats > 180) or (lats < -180) or (lons < -180) or lons > 180: messagebox.askyesno("error", "经纬度不合法") return lon_result, lat_result, final_result, time = topKSearch(lats, lons, ks) data, layout = setKMap(lat_result, lon_result) fig = dict(data=data, layout=layout) import plotly.offline plotly.offline.plot(fig, filename='result.html')
def kChange(): x = Initialize.initialize() lats = (int)(x.enter_latitude.get()) lons = (int)(x.enter_longitude.get()) times = [] k = [1, 2, 3, 5, 10, 50, 100, 300, 500, 1000, 3000, 5000, 10000, 15000, 20000, 25000] if (lats > 180 or lats < -180 or lons < -180 or lons > 180): messagebox.askyesno("error", "经纬度不合法") return for x in k: lon_result, lat_result, final_result, time = topKSearch(lats, lons, x) times.append(time) plt.plot(k, times, label='k_change', linewidth=1, color='r', marker='o', markerfacecolor='black', markersize=4) plt.xlabel('k') plt.ylabel('time (s)') plt.legend() plt.show()
def keyWordSelect(): x = Initialize.initialize() lats = int(x.enter_latitude.get()) lons = int(x.enter_longitude.get()) ks = int(x.k_value.get()) key_word = x.key_word_enter.get() result = keywordSort(lats, lons, ks, key_word) final_lat = [] final_lon = [] final_data = [] for x in result: la = x[0] lo = x[1] s = 'StoreNumber:' + x[2] + '</br>' + 'StoreName:' + x[3] + '</br>' + 'Postcode:' + x[ 4] + '</br>' + 'PhoneNumber:' + x[5] + '</br>' + 'Address:' + x[6] final_data.append(s) final_lat.append(la) final_lon.append(lo) return lats, lons, final_lat, final_lon, final_data
def radiusSearchShow(): x = Initialize.initialize() lats = (float)(x.enter_latitude.get()) lons = (float)(x.enter_longitude.get()) radius = (float)(x.radius_value.get()) radiusSearch(lats, lons, radius)
def radiusTimeChangeShow(): x = Initialize.initialize() lats = (float)(x.enter_latitude.get()) lons = (float)(x.enter_longitude.get()) radiusTimeChange(lats, lons)