Pattern¶
Pattern is the reusable container that sits
between the flight-pattern generators and campaign/planning workflows.
Pattern generators such as
racetrack()andspiral()returnPatterninstances.Line-based patterns store ordered
FlightLineobjects.Waypoint-based patterns store ordered
Waypointobjects.compute_flight_plan()acceptsPatternobjects directly and expands them into their underlying elements.Campaignassigns stablepattern_idandline_idvalues when a pattern is added to a campaign.
Pattern class¶
- class Pattern[source]¶
Bases:
objectA named, parameterized pattern within a campaign.
- Variables:
pattern_id – Stable identifier assigned by the owning Campaign. Empty string for patterns not yet added to a campaign.
kind – Generator kind (“rosette”, “racetrack”, “polygon”, “sawtooth”, “spiral”).
name – Human-readable name.
params – Generator parameters as a plain-JSON-compatible dict (lengths/altitudes in meters). Sufficient to regenerate.
lines – Ordered mapping of line_id -> FlightLine for line-based patterns. Empty for waypoint-based patterns.
waypoints – Ordered list of Waypoints for continuous patterns. Empty for line-based patterns.
- lines: Dict[str, FlightLine]¶
- property entry_waypoint: Waypoint¶
Waypoint where this pattern’s traversal begins.
For line-based patterns, this is the start of the first leg (
self.lines[first_line_id].waypoint1). For waypoint-based patterns, this is the first element ofself.waypoints.Used by the flight-line optimizer to compute transit-in cost when scheduling this pattern in a sortie.
- Raises:
HyPlanValueError – If the pattern has no elements (empty
linesand emptywaypoints).
- property exit_waypoint: Waypoint¶
Waypoint where this pattern’s traversal ends.
For line-based patterns, this is the end of the last leg (
self.lines[last_line_id].waypoint2). For waypoint-based patterns, this is the last element ofself.waypoints.Used by the flight-line optimizer to compute transit-out cost when scheduling this pattern in a sortie.
- Raises:
HyPlanValueError – If the pattern has no elements (empty
linesand emptywaypoints).
- replace_line(line_id, line)[source]¶
Replace a line in place, preserving its ID and pattern membership.
- Return type:
- Parameters:
line_id (str)
line (FlightLine)
- to_geojson()[source]¶
Return a GeoJSON FeatureCollection of this pattern’s elements.
Line-based patterns yield one LineString feature per leg (with
line_idandpattern_idin properties). Waypoint-based patterns yield one Point feature per waypoint plus one LineString for the connecting track.- Return type: