Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct initial KML checkbox values #1384

Merged
merged 3 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions MAVProxy/modules/mavproxy_kmlread.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,17 @@ def loadkml(self, filename):

# print("Adding " + point[1])
newcolour = (random.randint(0, 255), 0, random.randint(0, 255))
layer_name = point[1]+"-"+str(counter)
curpoly = mp_slipmap.SlipPolygon(
point[1]+"-"+str(counter),
layer_name,
point[2],
layer=2,
linewidth=2,
colour=newcolour,
)
self.mpstate.map.add_object(curpoly)
self.allayers.append(curpoly)
self.curlayers.append(point[1])
self.curlayers.append(layer_name)

# and points - barrell image and text
if self.mpstate.map is not None and point[0] == 'Point':
Expand Down Expand Up @@ -389,20 +390,16 @@ def idle_task(self):
# then add all the layers to the menu, ensuring to
# check the active layers text elements aren't
# included on the menu
if layer.key in self.curlayers and layer.key[-5:] != "-text":
self.menu.items.append(MPMenuCheckbox(
layer.key,
layer.key,
'# kml toggle \"' + layer.key + '\"',
checked=True,
))
elif layer.key[-5:] != "-text":
self.menu.items.append(MPMenuCheckbox(
layer.key,
layer.key,
'# kml toggle \"' + layer.key + '\"',
checked=False,
))
if layer.key.endswith('-text'):
continue

checked = layer.key in self.curlayers
self.menu.items.append(MPMenuCheckbox(
layer.key,
layer.key,
f'# kml toggle \"{layer.key}\"',
checked=checked,
))
# and add the menu to the map popu menu
self.module('map').add_menu(self.menu)
self.menu_needs_refreshing = False
Expand Down
Loading