Skip to content

Commit

Permalink
Merge pull request #43 from gpapadok/plotting_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jannikmi committed Jul 1, 2022
2 parents ee31e3a + 2b51519 commit 1e7dc9b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/0_getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Installation with pip:
Dependencies
------------

(``python3.6+``),``numpy``
(``python3.6+``), ``numpy``



Expand Down
9 changes: 9 additions & 0 deletions docs/4_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ API documentation
PolygonEnvironment
------------------
.. autoclass:: PolygonEnvironment


.. py:module:: extremitypathfinder.plotting
PlottingEnvironment
-------------------
.. autoclass:: PlottingEnvironment
:members: store, prepare, find_shortest_path
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/requirements_docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# python3.6+
numpy>=1.16
sphinx_rtd_theme
matplotlib
6 changes: 6 additions & 0 deletions extremitypathfinder/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def draw_graph(map, graph):


class PlottingEnvironment(PolygonEnvironment):
"""Extends PolygonEnvironment. In addition to the base functionality it
plots graphs of the polygons, the visibility graph and the computed path.
Stores all graphs in the folder defined by plotting_dir parameter."""
def __init__(self, plotting_dir=PLOTTING_DIR):
super().__init__()
global PLOTTING_DIR
Expand All @@ -203,14 +206,17 @@ def __init__(self, plotting_dir=PLOTTING_DIR):
makedirs(plotting_dir)

def store(self, *args, **kwargs):
"""In addition to storing, also plots a graph of the input polygons."""
super().store(*args, **kwargs)
draw_loaded_map(self)

def prepare(self):
"""Also draws a prepared map with the computed visibility graph."""
super().prepare()
draw_prepared_map(self)

def find_shortest_path(self, *args, **kwargs):
"""Also draws the computed shortest path."""
# important to not delete the temp graph! for plotting
vertex_path, distance = super().find_shortest_path(
*args, free_space_after=False, **kwargs
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# basic dependencies:
# python3.7+
numpy>=1.16
matplotlib

0 comments on commit 1e7dc9b

Please sign in to comment.