-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtests.php
More file actions
executable file
·96 lines (79 loc) · 3.54 KB
/
tests.php
File metadata and controls
executable file
·96 lines (79 loc) · 3.54 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
<?php
require_once('lib/tracklogPhp.main.php');
$tracklog = new GPX('test_files/teste.gpx');
print_r(count($tracklog->getPoints()));
// $tracklog->out('KML', 'test_files/1-converted');
//
// $tracklog = new KML('test_files/test_markers/1-converted.kml');
// print_r($tracklog->getMarkers());
// $extensions = ['kml', 'tcx', 'gpx', 'csv', 'js'];
// $files = scandir("test_files/external_files_diversos");
// sort($files, SORT_NUMERIC);
// $array = array();
// foreach ($files as $key => $file) {
// $extension = pathinfo($file, PATHINFO_EXTENSION);
// if (in_array($extension, $extensions)) {
// $file_path = "test_files/external_files_diversos/".$file;
// try {
// ($extension == "js") ? $extension = "geojson" : 0;
// echo "Inicio $file <br>";
// $time_start = microtime(true);
// $tracklog = new $extension($file_path);
// //Metodos não tabulados mas utilizado no controller
// $tracklog->getTrackName();
// //fim
// $array[$key]["Nome"] = $file;
// $array[$key]["Distance"] = $tracklog->getTotalDistance("kilometers");
// try {
// $array[$key]["Elevacao"] = number_format($tracklog->getElevationGain(), 2, ",","") . " / " . number_format($tracklog->getElevationLoss(), 2, ",", "");
// $array[$key]["Elevacao Máxima"] = number_format($tracklog->getMaxElevation(), 2, ",", "");
// //Metodos não tabulados mas utilizado no controller
// $tracklog->getElevations();
// //fim
// } catch (Exception $e) {
// $array[$key]["Elevation"] = " - ";
// $array[$key]["Elevação Máxima"] = " - ";
// }
// try {
// $array[$key]["Pace"] = $tracklog->getPace();
// $array[$key]["Velocidade"] = $tracklog->getAverageSpeed();
// //Metodos não tabulados mas utilizado no controller
// $tracklog->getTotalTime();
// $tracklog->getPace();
// $tracklog->getPaces("seconds", true);
// $tracklog->getAverageSpeeds();
// //fim
// } catch (Exception $e) {
// $array[$key]["Pace"] = " - ";
// $array[$key]["Velocidade"] = " - ";
// }
// $array[$key]["Pontos de GPS"] = count($tracklog->getPoints());
// $array[$key]["Tempo Execução"] = number_format((microtime(true) - $time_start), 10, ",", "");
// $time_start = microtime(true);
// $tracklog->out("TCX");
// $array[$key]["ConversaoTCX"] = number_format((microtime(true) - $time_start), 10, ",", "");
// $time_start = microtime(true);
// $tracklog->out("GPX");
// $array[$key]["ConversaoGPX"] = number_format((microtime(true) - $time_start), 10, ",", "");
// $time_start = microtime(true);
// $tracklog->out("KML");
// $array[$key]["ConversaoKML"] = number_format((microtime(true) - $time_start), 10, ",", "");
// $time_start = microtime(true);
// $tracklog->out("CSV");
// $array[$key]["ConversaoCSV"] = number_format((microtime(true) - $time_start), 10, ",", "");
// $time_start = microtime(true);
// $tracklog->out("GeoJSON");
// $array[$key]["ConversaoJSON"] = number_format((microtime(true) - $time_start), 10, ",", "");
// }catch(Exception $e){
// $array[$key]["Error"] = $e->getMessage();
// }
// echo "Fim $file <br>";
// }
// }
// $file = fopen("test_files/results3.csv", 'w');
// fputcsv($file, ["Nome", "Total Distance", "ElevationGain/ElevationLoss", "Elevacao Maxima", "Pace", "Velocidade", "Ponto de GPS", "Tempo de Execucao", "Tempo de Conversao TCX","Tempo de Conversao GPX","Tempo de Conversao KML","Tempo de Conversao CSV","Tempo de Conversao GeoJSON", "Error"], ";");
// foreach ($array as $key => $value) {
// fputcsv($file, $value, ";");
// }
// fclose($file);
?>