решение задания 8

This commit is contained in:
2023-01-30 22:09:24 +07:00
parent 799477de9e
commit 8ba717ddd5
4 changed files with 26 additions and 18 deletions
+2 -1
View File
@@ -11,4 +11,5 @@ def search_organization_pos(search_text: str) -> tuple:
toponym = response.json()["response"]["GeoObjectCollection"]["featureMember"][0]["GeoObject"] toponym = response.json()["response"]["GeoObjectCollection"]["featureMember"][0]["GeoObject"]
point = [float(i) for i in toponym["Point"]["pos"].split(" ")] point = [float(i) for i in toponym["Point"]["pos"].split(" ")]
toponym_longitude, toponym_lattitude = toponym["Point"]["pos"].split(" ") toponym_longitude, toponym_lattitude = toponym["Point"]["pos"].split(" ")
return "{0},{1}".format(point[0], point[1]), toponym_longitude, toponym_lattitude name = toponym["metaDataProperty"]["GeocoderMetaData"]["text"]
return "{0},{1}".format(point[0], point[1]), toponym_longitude, toponym_lattitude, name
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 646 KiB

After

Width:  |  Height:  |  Size: 45 KiB

+6 -1
View File
@@ -19,6 +19,7 @@ class Window(QMainWindow):
self.lat = 55.703118 self.lat = 55.703118
self.variant_map = "map" self.variant_map = "map"
self.org_point = "0.0,0.0" self.org_point = "0.0,0.0"
self.name_find_org = ""
self.update() self.update()
self.button_group = QButtonGroup(None) self.button_group = QButtonGroup(None)
self.button_group.addButton(self.map) self.button_group.addButton(self.map)
@@ -68,11 +69,15 @@ class Window(QMainWindow):
def search_organization(self): def search_organization(self):
# Москва, ул. Ак. Королева, 12 # Москва, ул. Ак. Королева, 12
self.org_point, self.lon, self.lat = search_organization_pos(self.plainTextEdit.toPlainText()) text = self.plainTextEdit.toPlainText()
self.org_point, self.lon, self.lat, self.name_find_org = search_organization_pos(text)
self.label_2.setText(self.name_find_org)
self.update() self.update()
def drop_find(self): def drop_find(self):
self.org_point = "0.0,0.0" self.org_point = "0.0,0.0"
self.name_find_org = ""
self.label_2.setText(self.name_find_org)
self.update() self.update()
+13 -11
View File
@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>550</height> <height>522</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -33,7 +33,7 @@
<x>610</x> <x>610</x>
<y>0</y> <y>0</y>
<width>191</width> <width>191</width>
<height>71</height> <height>30</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
@@ -85,7 +85,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>611</width> <width>611</width>
<height>70</height> <height>30</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@@ -93,9 +93,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>610</x> <x>610</x>
<y>160</y> <y>30</y>
<width>191</width> <width>191</width>
<height>71</height> <height>30</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@@ -105,18 +105,20 @@
<string>Сброс поискового результата</string> <string>Сброс поискового результата</string>
</property> </property>
</widget> </widget>
</widget> <widget class="QLabel" name="label_2">
<widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>30</y>
<width>800</width> <width>611</width>
<height>29</height> <height>30</height>
</rect> </rect>
</property> </property>
<property name="text">
<string/>
</property>
</widget>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>