Skip to content

Commit

Permalink
geoutils: add _to_fix movements/drawings
Browse files Browse the repository at this point in the history
  • Loading branch information
a3li committed May 28, 2024
1 parent fd077e0 commit 4e6f185
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mapbuilder/utils/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,29 @@ def es_coords(self):
def move_to(self, dist: float, bearing: float | Brg) -> "Fix":
return Fix(self.fix.destination(dist * NM_IN_METERS, _brg(bearing)), self.lines)

def move_to_fix(self, fix: "Fix") -> "Fix":
return Fix(fix.fix, self.lines)

def line_to(self, dist: float, bearing: float | Brg) -> "Fix":
dest = self.fix.destination(dist * NM_IN_METERS, _brg(bearing))
self.lines.append(f"LINE:{coord2es(self.fix)}:{coord2es(dest)}")
return Fix(self.fix, self.lines)

def line_to_fix(self, fix: "Fix") -> "Fix":
self.lines.append(f"LINE:{coord2es(self.fix)}:{coord2es(fix.fix)}")
return Fix(self.fix, self.lines)

def line_move_to(self, dist: float, bearing: float | Brg) -> "Fix":
dest = self.fix.destination(dist * NM_IN_METERS, _brg(bearing))
self.lines.append(f"LINE:{coord2es(self.fix)}:{coord2es(dest)}")
self.fix = dest
return Fix(self.fix, self.lines)

def line_move_to_fix(self, fix: "Fix") -> "Fix":
self.lines.append(f"LINE:{coord2es(self.fix)}:{coord2es(fix.fix)}")
self.fix = fix.fix
return Fix(self.fix, self.lines)

def __str__(self):
return "\n".join(self.lines)

Expand Down

0 comments on commit 4e6f185

Please sign in to comment.