-
Notifications
You must be signed in to change notification settings - Fork 2
/
sam_xml_test.cpp
105 lines (82 loc) · 3.23 KB
/
sam_xml_test.cpp
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
105
/*
openSAM: open source SAM emulator for X Plane
Copyright (C) 2024 Holger Teutsch
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*/
#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <iostream>
#include "openSAM.h"
#include "os_dgs.h"
#include "os_jw.h"
#include "os_anim.h"
int
main(int argc, char **argv) {
std::cout << "sam_xml_test starting\n";
SceneryPacks scp("E:/X-Plane-12");
if (! scp.valid) {
log_msg("%s", "Can't create SceneryPacks");
return 1;
}
if (!collect_sam_xml(scp)) {
log_msg("Error reading sam.xml files");
exit(2);
}
printf("\n%d sceneries collected\n", (int)sceneries.size());
printf("%d datarefs collected\n", (int)sam_drfs.size());
for (auto drf : sam_drfs) {
printf("%s, auto_play: %d, randomize_phase: %d, augment_wind_speed: %d\n",
drf->name, drf->autoplay, drf->randomize_phase, drf->augment_wind_speed);
for (int j = 0; j < drf->n_tv; j++)
printf(" t: %6.2f, v: %6.2f\n", drf->t[j], drf->v[j]);
puts("");
}
for (auto sc : sceneries) {
printf("%s: %d jetways, %d stands collected, bbox: %0.3f,%0.3f -> %0.3f, %0.3f\n",
sc->name, (int)sc->sam_jws.size(), (int)sc->stands.size(),
sc->bb_lat_min, sc->bb_lon_min, sc->bb_lat_max, sc->bb_lon_max);
puts("\nObjects");
for (auto obj : sc->sam_objs)
printf("%s %5.6f %5.6f %5.6f %5.6f\n", obj->id, obj->latitude, obj->longitude,
obj->elevation, obj->heading);
puts("\nAnimations");
for (auto anim : sc->sam_anims)
printf("'%s' '%s', obj: '%s', drf: '%s'\n", anim->label, anim->title,
sc->sam_objs[anim->obj_idx]->id, sam_drfs[anim->drf_idx]->name);
puts("\nJetways");
for (auto jw : sc->sam_jws) {
printf("%s %5.6f %5.6f door: %d\n", jw->name, jw->latitude, jw->longitude, jw->door);
}
puts("\n");
}
puts("Library jetways");
for (int i = 0; i <= MAX_SAM3_LIB_JW; i++) {
SamJw *jw = &sam3_lib_jw[i];
if (jw->id == 0)
continue;
log_msg("%d; %s height: %0.2f, cabinPos: %0.2f", jw->id, jw->name, jw->height, jw->cabinPos);
}
puts("Ramps");
for (auto sc : sceneries) {
printf("%s\n", sc->name);
for (auto stand : sc->stands) {
log_msg("%-40s %5.6f, %5.6f %6.2f", stand->id,
stand->lat, stand->lon, stand->hdgt);
}
puts("\n");
}
return (0);
}