-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·62 lines (52 loc) · 1.61 KB
/
test.py
File metadata and controls
executable file
·62 lines (52 loc) · 1.61 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
#!/usr/bin/env python3
# coding: utf-8
import sys
import json
import copy
from opv.graphe import Point, Node, Graphe, GrapheHelper
if __name__ == "__main__":
name = "test.json"
if len(sys.argv) > 1:
name = sys.argv[1]
with open(name, "r") as fic:
data = json.load(fic)
graphe = Graphe("Test")
for name, gps in data.items():
point = Point(
x=gps["latitude"],
y=gps["longitude"],
z=gps["altitude"]
)
graphe.create_node(
name,
point=point
)
graphe.generate_json("01_points.json")
graphe.detect_nears_nodes()
for_reporting = copy.deepcopy(graphe)
for_reporting.create_edge_from_near_nodes()
for_reporting.generate_json("02_detect_nears_panorama.json")
graphes = graphe.get_sub_graphes()
graphe_helper = GrapheHelper()
graphe = graphe_helper.merge_subgraphe(graphes)
graphe.hotpoints = [
'634',
'633',
'660',
'670',
'86',
'770',
'777',
'767'
]
graphe.generate_json("03_merge_graphe.json")
graphe.get_end_points()
graphe.generate_json("04_get_endpoints.json")
final_graphe = graphe_helper.reduce_path(graphe)
final_graphe.generate_json("05_reduce_path.json")
reduce_path = graphe_helper.reduce_nodes(final_graphe, 15)
graphes = reduce_path.get_sub_graphes(near_node=False)
final_graphe = graphe_helper.merge_subgraphe(graphes)
a = final_graphe.get_sub_graphes(near_node=False)
print("Number of reduce path: %s" % len(a))
reduce_path.generate_json("06_reduce_nodes.json")