Skip to content

Commit

Permalink
updated help and added notes and names to plan csv import
Browse files Browse the repository at this point in the history
  • Loading branch information
tamarmot committed Mar 23, 2019
1 parent 81d0499 commit 7569564
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 33 deletions.
21 changes: 17 additions & 4 deletions xgds_planner2/csvPlanImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@
from xgds_planner2.planImporter import PlanImporter, planDocFromPlanDict


def planDictFromCoords(coords, meta):
def planDictFromCoords(coords, meta, names=None, notes=None):
plan = meta.copy()
n = len(coords)
for i, lonLat in enumerate(coords):
plan['sequence'].append({
seq_dict = {
'type': 'Station',
'geometry': {
'type': 'Point',
'coordinates': lonLat
}
})
}
if names and names[i]:
seq_dict['name'] = names[i]
if notes and notes[i]:
seq_dict['notes'] = notes[i]
plan['sequence'].append(seq_dict)
if i != n - 1:
plan['sequence'].append({
'type': 'Segment'
Expand All @@ -48,10 +53,18 @@ class CSVPlanImporter(PlanImporter):
def importPlanFromBuffer(self, buf, meta, schema):
csvReader = csv.DictReader(buf.splitlines())
coords = []
notes = []
names = []
for row in list(csvReader):
longitude = float(row['longitude'])
latitude = float(row['latitude'])
if 'name' in row:
names.append(row['name'])
if 'note' in row:
notes.append(row['note'])
elif 'notes' in row:
notes.append(row['notes'])
coords.append([longitude, latitude])
planDict = planDictFromCoords(coords, meta)
planDict = planDictFromCoords(coords, meta, names, notes)
planDoc = planDocFromPlanDict(planDict, schema.schema)
return planDoc
171 changes: 166 additions & 5 deletions xgds_planner2/static/xgds_planner2/help/editPlan.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,180 @@

**Edit Plan** lets you TODO.
**Edit {{settings.XGDS_PLANNER_PLAN_MONIKER }}** lets you edit and simulate {{settings.XGDS_PLANNER_PLAN_MONIKER }}s

Section 1:
**{{settings.XGDS_PLANNER_PLAN_MONIKER }}** let you plan and simulate execution of a {{settings.XGDS_PLANNER_PLAN_MONIKER }}.
The map view is on the left and you can pan and zoom around the map. The right hand side has tabs
which provide more detailed editing functionality.


Duration/Distance:
------------------

As you edit a {{settings.XGDS_PLANNER_PLAN_MONIKER }}, the overall duration and distance for the {{settings.XGDS_PLANNER_PLAN_MONIKER }}
will be reflected at the top of the page, in the timeline, and in the sequence.

Modes:
------
Buttons in the top left control the modes.

Navigate
Pan and zoom around the map and explore the {{settings.XGDS_PLANNER_PLAN_MONIKER }} without modifying it (in the map).

Edit
Modify existing elements of the {{settings.XGDS_PLANNER_PLAN_MONIKER }} on the map by clicking and dragging their points around.
Note that even if you have just added elements you must click Edit to modify them.

To delete a {{settings.XGDS_PLANNER_STATION_MONIKER}}, press the shift key while you click on it.

To insert a new {{settings.XGDS_PLANNER_STATION_MONIKER}}, simply click on a {{settings.XGDS_PLANNER_SEGMENT_MONIKER}} and drag the blue dot.

Add
Click to add {{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}} to the end of the {{settings.XGDS_PLANNER_PLAN_MONIKER }}


Undo/Redo:
----------

The undo and redo buttons in the top right will allow you to undo or redo edits you have made. This will only be available during an edit session;
if you save and reopen the {{settings.XGDS_PLANNER_PLAN_MONIKER }} your change history will be lost.
You cannot undo a save, but you can undo edits and resave the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Reload:
-------

The *Reload* button will allow you to reload the last saved version of the {{settings.XGDS_PLANNER_PLAN_MONIKER }}. You will still be able to undo and redo.

Save As:
--------

To save the {{settings.XGDS_PLANNER_PLAN_MONIKER }} as a copy, click the *Save As* button. A dialog will pop up allowing you to give the copy a new
name, version, and add some notes to it.

Save:
-----

Changes to the {{settings.XGDS_PLANNER_PLAN_MONIKER }} will not automatically save. If you have made modifications, there will be a red *Unsaved changes*
indicator near the *Save* button. If you have just clicked the *Save* button, your changes were saved.

{{settings.XGDS_PLANNER_PLAN_MONIKER }} Simulation:
---------------------------------------------------

Immediately under the buttons is a playback control and slider. You can see when the vehicle will be at a given position by
simulating the {{settings.XGDS_PLANNER_PLAN_MONIKER }}. Use the *Play* and *Pause* buttons to control the playback, and
modify the playback speed by changing the number to the right of the *Speed:* label.
You can also jump to a specific time by typing it in and clicking *Go:*
You can also control the simulated playback by dragging the square on the slider above the timeline.

Timeline:
---------

Below the playback slider is a timeline. This shows the {{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}} including how long will be spent at each
{{settings.XGDS_PLANNER_STATION_MONIKER}}. The currently selected {{settings.XGDS_PLANNER_STATION_MONIKER}} is highlighted in red.

Meta Tab:
---------

Grayed fields are not editable.

Name
The name of the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Notes
The description of the {{settings.XGDS_PLANNER_PLAN_MONIKER }}, very useful for recording overall goals.

Plan Version
A letter version for the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Default Speed
Used when simulating {{settings.XGDS_PLANNER_SEGMENT_MONIKER}} duration.

Sequence Tab:
-------------

TODO write help
We refer to the sequence of {{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}} and {{settings.XGDS_PLANNER_SEGMENT_MONIKER_PLURAL}} as a sequence.

{{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}}/{{settings.XGDS_PLANNER_SEGMENT_MONIKER_PLURAL}}
The {{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}} and {{settings.XGDS_PLANNER_SEGMENT_MONIKER_PLURAL}} are listed by name in the leftmost column.
For each {{settings.XGDS_PLANNER_STATION_MONIKER}}, the name and time of leaving the {{settings.XGDS_PLANNER_STATION_MONIKER}} is listed.
For each {{settings.XGDS_PLANNER_SEGMENT_MONIKER}}, the distance and duration are listed.
When you select a {{settings.XGDS_PLANNER_STATION_MONIKER}} or {{settings.XGDS_PLANNER_SEGMENT_MONIKER}},
it is highlighted in green and its properties can be edited.

Edit {{settings.XGDS_PLANNER_STATION_MONIKER}} Properties
Click on the name of the {{settings.XGDS_PLANNER_STATION_MONIKER}}. Its properties will show in the third column. Note that when you are editing any properties, you must click away from the field to see the change reflected in the planner.

Name
The name of the {{settings.XGDS_PLANNER_STATION_MONIKER}}

Notes
Notes for the {{settings.XGDS_PLANNER_STATION_MONIKER}}, useful for detailed instruction

Lon, Lat
The longitude of the {{settings.XGDS_PLANNER_STATION_MONIKER}}, which can be edited or copied

Tolerance
A radius around the {{settings.XGDS_PLANNER_STATION_MONIKER}}

Boundary
A different radius around the {{settings.XGDS_PLANNER_STATION_MONIKER}}.

Edit {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}}
{{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}} can contain {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}}.
To edit these:

* Select the {{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}} by clicking on its name.
* Click the blue *Add {{settings.XGDS_PLANNER_COMMAND_MONIKER}}* button at the bottom of the center column.
* In the 3rd column you will see a list of {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}}.
* To add one, click on it.
* To modify a {{settings.XGDS_PLANNER_COMMAND_MONIKER}}'s properties, click on it in the 2nd column.
* You can then edit its properties in the 3rd column.
* The durations of the {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}} are totaled at the top of the 2nd column, and used to compute the duration spent at the containing {{settings.XGDS_PLANNER_STATION_MONIKER}}.
* To change the order of the {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}} at a {{settings.XGDS_PLANNER_STATION_MONIKER}}, drag and drop them into the desired order.
* To delete {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}}, check the checkbox to the left of one or more and press the *Delete* button at the top of the 2nd column.
* To copy {{settings.XGDS_PLANNER_COMMAND_MONIKER_PLURAL}} between {{settings.XGDS_PLANNER_STATION_MONIKER_PLURAL}}, select one or more with the checkbox, and press the *Copy* button. Select the destination {{settings.XGDS_PLANNER_STATION_MONIKER}} and press the *Paste* button at the top of the 2nd column.

Edit {{settings.XGDS_PLANNER_SEGMENT_MONIKER}} Properties
Click on the distance of the {{settings.XGDS_PLANNER_SEGMENT_MONIKER}}. Its properties will show in the third column.

Name
The name of the {{settings.XGDS_PLANNER_SEGMENT_MONIKER}}

Notes
Notes for the {{settings.XGDS_PLANNER_SEGMENT_MONIKER}}, useful for detailed instruction

Speed
Speed for the {{settings.XGDS_PLANNER_SEGMENT_MONIKER}}, used to calculate its duration.

Search Tab:
-----------
From the Search tab you can search for and view many other kinds of data in the map.

1. Select the type of data you are searching for in the dropdown and click the **Start** button.
2. A form will be displayed allowing you to filter what you are searching for.
3. Optionally fill that out and click the **Search** button.
4. Check the **Today** checkbox to limit results to those gathered today.
5. Results if any will be displayed below the form.
6. Select a result by clicking on it to see it in the map.

Tools Tab:
----------

* *Reverse {{settings.XGDS_PLANNER_PLAN_MONIKER }}* by clicking the button to reverse the direction.
* Append a {{settings.XGDS_PLANNER_PLAN_MONIKER }}
* Select the {{settings.XGDS_PLANNER_PLAN_MONIKER }} to append from the dropdown
* Select whether you want to place it before *Start* or after *End*
* Check the box if you want to reverse the {{settings.XGDS_PLANNER_PLAN_MONIKER }} you are appending.
* A connecting segment will automatically be inserted
* Press *OK* to append it.

Section 2:
Links Tab:
----------

TODO write more help
Click on any link to download the {{settings.XGDS_PLANNER_PLAN_MONIKER }} in the selected format.


.. |training_video| raw:: html

<a href="https://xgds.org/downloads/training/xgds_planner/" target="_training">Training Video</a>

.. o __BEGIN_LICENSE__
.. o Copyright (c) 2015, United States Government, as represented by the
Expand Down
26 changes: 19 additions & 7 deletions xgds_planner2/static/xgds_planner2/help/import.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@

**Import** lets you TODO.
**Import {{settings.XGDS_PLANNER_PLAN_MONIKER }}** lets you create a new {{settings.XGDS_PLANNER_PLAN_MONIKER }} via an import.

Section 1:
-------------
Import {{settings.XGDS_PLANNER_PLAN_MONIKER }} currently supports:
* kml files containing a LineString
* csv files with column headers including latitude and longitude, and optionally name and notes. Extra columns may be present but they will be ignored
* xpJson files exported from xGDS

TODO write help
The options are the same as when creating a new {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Options
-------

Section 2:
----------
{{settings.XGDS_PLANNER_PLAN_MONIKER }} number:
Used to generate the original name and ids within the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

TODO write more help
{{settings.XGDS_PLANNER_PLAN_MONIKER }} version:
Used to set the original version and ids within the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Platform:
What vehicle this {{settings.XGDS_PLANNER_PLAN_MONIKER }} is for.

Region:
What region on the map contains this {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Sourcefile:
The kml, csv or xpJson file you wish to import.


.. o __BEGIN_LICENSE__
Expand Down
41 changes: 34 additions & 7 deletions xgds_planner2/static/xgds_planner2/help/index.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@

**Index** lets you TODO.
**List {{settings.XGDS_PLANNER_PLAN_MONIKER }}** lets you view and manage {{ settings.XGDS_PLANNER_PLAN_MONIKER}}s.

Section 1:
-------------

TODO write help
{{settings.XGDS_PLANNER_PLAN_MONIKER}} Table:
---------------------------------------------

The table contains the {{settings.XGDS_PLANNER_PLAN_MONIKER}}s which have not been deleted.
You can search within the table by typing the search term in the search bar at the top.

Section 2:
----------
* To view or edit a {{settings.XGDS_PLANNER_PLAN_MONIKER}}, click on its name.
* To sort the table, click on the up or down arrow next to the name of the column you wish to sort on.
* To export a {{settings.XGDS_PLANNER_PLAN_MONIKER}}, click on the appropriate format in the Export column.

TODO write more help

Creating a {{settings.XGDS_PLANNER_PLAN_MONIKER}}:
--------------------------------------------------

Click on the *Create {{settings.XGDS_PLANNER_PLAN_MONIKER}}* button.

Importing a {{settings.XGDS_PLANNER_PLAN_MONIKER}}:
---------------------------------------------------

Click on the *Import {{settings.XGDS_PLANNER_PLAN_MONIKER}}* button.

Deleting {{settings.XGDS_PLANNER_PLAN_MONIKER}}s:
---------------------------------------------------

* Click on the checkbox to the left of the {{settings.XGDS_PLANNER_PLAN_MONIKER}}(s) you wish to delete.
* Click on the *Delete Selected* button.
* Verify in the confirmation dialog that you wish to delete the selected plans

Locking and unlocking {{settings.XGDS_PLANNER_PLAN_MONIKER}}s:
--------------------------------------------------------------

{{settings.XGDS_PLANNER_PLAN_MONIKER}}s can be locked, which prohibits all users from editing them.

* Click on the checkbox to the left of the {{settings.XGDS_PLANNER_PLAN_MONIKER}}(s) you wish to lock or unlock.
* Click on the *Toggle lock* button.
* You will see a lock next to the locked plans.



Expand Down
21 changes: 12 additions & 9 deletions xgds_planner2/static/xgds_planner2/help/planCreate.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
**Create {{settings.XGDS_PLANNER_PLAN_MONIKER }}** lets you create a new {{settings.XGDS_PLANNER_PLAN_MONIKER }}

**Create Plan** lets you TODO.
Once the {{settings.XGDS_PLANNER_PLAN_MONIKER }} has been created you may rename it in the *Meta* tab section of the editor.

Section 1:
-------------
Options
-------

TODO write help
{{settings.XGDS_PLANNER_PLAN_MONIKER }} number:
Used to generate the original name and ids within the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

{{settings.XGDS_PLANNER_PLAN_MONIKER }} version:
Used to set the original version and ids within the {{settings.XGDS_PLANNER_PLAN_MONIKER }}.

Section 2:
----------

TODO write more help

Platform:
What vehicle this {{settings.XGDS_PLANNER_PLAN_MONIKER }} is for.

Region:
What region on the map contains this {{settings.XGDS_PLANNER_PLAN_MONIKER }}.


.. o __BEGIN_LICENSE__
Expand Down
2 changes: 1 addition & 1 deletion xgds_planner2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def planImport(request):
if request.method == 'GET':
messages.info(request, 'Create a ' + settings.XGDS_PLANNER_PLAN_MONIKER + ' by importing:')
messages.info(request, 'a kml file containing a LineString')
messages.info(request, 'a csv file, with column headers of latitude and longitude')
messages.info(request, 'a csv file, with column headers of latitude and longitude, and optional name and notes')
messages.info(request, 'an xpJson file')
form = ImportPlanForm()
elif request.method == 'POST':
Expand Down

0 comments on commit 7569564

Please sign in to comment.