Skip to content

Commit

Permalink
Adapted DEFWPT DELETE to new network logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jooste committed Sep 11, 2023
1 parent 5a89043 commit f267075
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion bluesky/simulation/screenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ def addnavwpt(self, name, lat, lon):
''' Add custom waypoint to visualization '''
self.pub_defwpt.send_append(custwplbl=name, custwplat=lat, custwplon=lon)
return True

def removenavwpt(self, name):
''' Remove custom waypoint to visualization '''
bs.net.send_event(b'DELWPT', dict(name=name), target=[b'*'])
self.pub_defwpt.send_delete(custwplbl=name)
return True

def show_file_dialog(self):
Expand Down
17 changes: 8 additions & 9 deletions bluesky/ui/qtgl/glnavdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,17 @@ def panzoom(self, data, finished=True):
@sharedstate.subscriber
def defwpt(self, data):
''' Receive custom waypoint data and add to visualisation. '''
if ctx.action == ctx.action.Reset or ctx.action == ctx.action.ActChange:# TODO hack
# Simulation reset: Clear all entries
if not data.valid():
self.ncustwpts = 0
return

if data.custwplbl:
self.customwp.update(lat=np.array(data.custwplat, dtype=np.float32),
lon=np.array(data.custwplon, dtype=np.float32))
lbl = [n[:10].ljust(10) for n in data.custwplbl]
self.custwplblbuf.update(
np.array(lbl, dtype=np.string_))
self.ncustwpts = len(data.custwplat)
self.ncustwpts = len(data.custwplbl)
self.customwp.update(lat=np.array(data.custwplat, dtype=np.float32),
lon=np.array(data.custwplon, dtype=np.float32))
lbl = [n[:10].ljust(10) for n in data.custwplbl]
self.custwplblbuf.update(
np.array(lbl, dtype=np.string_))


def create(self):
apt_size = settings.apt_size
Expand Down

0 comments on commit f267075

Please sign in to comment.