-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocgen_sample.py
More file actions
104 lines (85 loc) · 3.15 KB
/
docgen_sample.py
File metadata and controls
104 lines (85 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"""
An example use of VFRFunctionRoutes library
"""
import os
import math
import datetime
import requests
from dotenv import load_dotenv
load_dotenv()
from VFRFunctionRoutes import VFRFunctionRoute, VFRPoint, VFRRouteState, MapManager #pylint: disable=wrong-import-position
sess = requests.Session()
rootpath = os.path.dirname(os.path.abspath(__file__))
mapmanager = MapManager([int(os.getenv("LOW_DPI", "72")),
int(os.getenv("DOC_DPI", "200")),
int(os.getenv("HIGH_DPI", "600"))
], sess)
mapdef = mapmanager.maps.get("HUNGARY", None)
if mapdef is None:
raise ValueError("HUNGARY map not found")
rgen = VFRFunctionRoute(
"LHFH--Lovasberény--Császár--Nyergesújfalu--LHFH",
mapdef,
100,
dof=datetime.datetime.now(datetime.timezone.utc)+datetime.timedelta(days=2),
session=sess,
workfolder=os.path.join(rootpath, "data"),
outfolder=os.path.join(rootpath, "output"),
tracksfolder=os.path.join(rootpath, "data")
)
rgen.set_state(VFRRouteState.LEGS) # because we also want to add annotations
rgen.add_leg(
'LHFH->Lovasberény',
r'\sqrt[3]{{x}}',
'$x=0$ at Lovasberény, $x=1.5$ at LHFH',
[
# (lat, lon, x),
(VFRPoint(18.55314689455907, 47.31145066437747), 0),
(VFRPoint(18.912424867046774, 47.48950030173632), 1.5)
]
).add_annotation("START", 1.5, (-120, 10)) \
.add_annotation("Etyek", 0.8, (20, -25)) \
.add_annotation("Alcsútdoboz", 0.3, (25, -45)) \
.add_annotation("Vértesacsa", 0.12, (35, -75)) \
.add_annotation("Lovasberény", 0.0001, (-90, 25))
rgen.add_leg(
'Lovasberény->Császár',
r'\frac{1}{e^x}',
r'$x=\pi$ at Lovasberény, $x=-\frac{\pi}{2}$ at Császár',
[
(VFRPoint(18.55314689455907, 47.31145066437747), math.pi),
(VFRPoint(18.13993451767051, 47.50100085714328), -math.pi/2)
]
).add_annotation("Lovasberény", math.pi, (-30, -35)) \
.add_annotation("Zámolyi vízt", math.pi-1., (-80, -30)) \
.add_annotation("Csber/Malmás", math.pi-3., (-100, -40)) \
.add_annotation("Mór", math.pi-3.9, (-100, -20)) \
.add_annotation("Császár", -math.pi/2, (-90, -40)) \
rgen.add_leg(
'Császár->LHFH',
r'\sin(x)',
r'$x=0$ at Császár, $x=\pi$ at LHFH, $x=\frac{\pi}{2}$ at Nyergesújfalu',
[
(VFRPoint(18.13993451767051, 47.50100085714328), 0),
(VFRPoint(18.912424867046774, 47.48950030173632), math.pi),
(VFRPoint(18.54614123145077, 47.7612944935143), math.pi/2)
]
).add_annotation("Császár", 0, (-80, 40)) \
.add_annotation("Szákszend", 0.15, (10, 0)) \
.add_annotation("M1", 0.5, (-110, 20)) \
.add_annotation("Tata", 0.7, (-60, 40)) \
.add_annotation("Dsztmikl", 0.93, (0, -80)) \
.add_annotation("Lábatlan", 1.35, (-40, 30)) \
.add_annotation("Nyergesújfalu", 1.6, (20, 30)) \
.add_annotation("Csolnok", 2.25, (-110, -20)) \
.add_annotation("Tinnye", 2.57, (-25, 60)) \
.add_annotation("Telki", 2.9, (-33, 80)) \
.add_annotation("END", math.pi, (-140, 60))
rgen.set_state(VFRRouteState.ANNOTATIONS)
rgen.finalize()
#print(rgen)
#rgen.draw_map()
#rgen.fig.show()
#rgen.fig.waitforbuttonpress()
rgen.create_doc()
#rgen.save_plan()