Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Flight-Planning (KML Imports)
# Flight-Planning (KML Imports)
Flight Planning*
# User dropped / attached KML file via advanced settings
Empty*
add KML file -> KML Added
KML Added
remove KML file -> Empty
# Begins as soon as a user drops/attaches a KML file
Create Readable File
succeeded -> Convert to GeoJSON
failed -> KML Added With Error Messaging
# Passes File contents to @mapbox/togeojson
Convert to GeoJSON
succeeded -> Validate GeoJSON
failed -> KML Added With Error Messaging
# Checks for a single Polygon feature
Validate GeoJSON
# GeoJSON has one Polygon
succeeded -> Upload KML to S3
# GeoJSON doesn't contain a Polygon, or has more than one
failed -> KML Added With Error Messaging
# Saves the attached KML file in S3 under the relevant mission
Upload KML to S3
succeeded -> With KML Upload Succeeded Messaging
failed -> With KML Upload Failed Messaging
KML Added With Error Messaging
retry -> KML Added
# Add new Polygon/Flight Boundary to the map
Update Map
With KML Upload Succeeded Messaging*
# This is an odd state because technically the important parts succeeded...
# the map is updated, but the KML won't be saved to the mission
With KML Upload Failed Messaging
retry -> Upload KML to S3
dismiss -> KML Added
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment