Compare commits
656
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c19cf094a7 | ||
|
|
279179e88d | ||
|
|
0ddd3e7f2f | ||
|
|
fe96298be5 | ||
|
|
c6351292dd | ||
|
|
e2caad3b0b | ||
|
|
a095ab684c | ||
|
|
fe41a03180 | ||
|
|
332d9dfadb | ||
|
|
c05802a498 | ||
|
|
0970bb1be2 | ||
|
|
c9d83fab6c | ||
|
|
edcce32f24 | ||
|
|
68d265f0e7 | ||
|
|
b985bb5757 | ||
|
|
f030816385 | ||
|
|
6f9f694eff | ||
|
|
a0d7f0e172 | ||
|
|
9f98e438cb | ||
|
|
f029ca7b64 | ||
|
|
ca6c6dd6d3 | ||
|
|
4ba4ea5602 | ||
|
|
ca5f66da9f | ||
|
|
92d053d850 | ||
|
|
001ae80723 | ||
|
|
58d9a6d0b5 | ||
|
|
261316cb45 | ||
|
|
2ad4d2e672 | ||
|
|
1d9fa929fa | ||
|
|
26bb6236a0 | ||
|
|
b2acf5a623 | ||
|
|
bea88bb3a9 | ||
|
|
def2af2bdd | ||
|
|
6f6d705f22 | ||
|
|
e9c33104d3 | ||
|
|
985897f8ba | ||
|
|
4251b28e88 | ||
|
|
76540a211c | ||
|
|
904fc5a7dd | ||
|
|
4aebc159d5 | ||
|
|
f89227fc1a | ||
|
|
f50f383cc0 | ||
|
|
706ab387de | ||
|
|
cddfdb7d1d | ||
|
|
3c64578848 | ||
|
|
e1fe9b45e0 | ||
|
|
8fdc1d306f | ||
|
|
6e0c39bb68 | ||
|
|
f20b416cfe | ||
|
|
47e06b5216 | ||
|
|
bfcdf22705 | ||
|
|
d0db407faa | ||
|
|
d95b1c0441 | ||
|
|
837ba86d57 | ||
|
|
0cb1b463e1 | ||
|
|
8a772c8edd | ||
|
|
03bdad0a10 | ||
|
|
537776e1f8 | ||
|
|
f34a4a304e | ||
|
|
a59c4e2c8b | ||
|
|
46f4967f6e | ||
|
|
9305417207 | ||
|
|
11da8b33f9 | ||
|
|
c7b320eb55 | ||
|
|
72b2eb0ebf | ||
|
|
ec3829addb | ||
|
|
96bafef3f3 | ||
|
|
3ff3bd0a6c | ||
|
|
78d073a0f0 | ||
|
|
d62796c19d | ||
|
|
7ea7ff43fc | ||
|
|
dafd185595 | ||
|
|
1568ed8b97 | ||
|
|
444e2ffb2d | ||
|
|
32ccdaec6f | ||
|
|
bd9f04d980 | ||
|
|
9c530d6978 | ||
|
|
05094510be | ||
|
|
41e43eeba0 | ||
|
|
f95cbd703a | ||
|
|
e39036a635 | ||
|
|
1171d57b72 | ||
|
|
852058150b | ||
|
|
9be955262e | ||
|
|
bfa411e9b7 | ||
|
|
dab015742a | ||
|
|
0ab81d36b9 | ||
|
|
4d905135e8 | ||
|
|
afad224ca0 | ||
|
|
99c159d46e | ||
|
|
733efd08dd | ||
|
|
3753c62783 | ||
|
|
3e804605b7 | ||
|
|
35b1d321fe | ||
|
|
6ab7f68f4b | ||
|
|
b2e149a737 | ||
|
|
e28c4fa5ca | ||
|
|
61dc19f635 | ||
|
|
60634bc445 | ||
|
|
b3e93eaf6e | ||
|
|
36dca92c2b | ||
|
|
5a1ed52d7c | ||
|
|
fd191b51ce | ||
|
|
6167159795 | ||
|
|
672afdbc34 | ||
|
|
27e61b3dec | ||
|
|
f1d00c9b40 | ||
|
|
1b00ece8c4 | ||
|
|
d0f24229b2 | ||
|
|
ab8795f6dc | ||
|
|
2fe60c9635 | ||
|
|
27a3ee3bce | ||
|
|
0721db3acd | ||
|
|
24b58cbe21 | ||
|
|
5b3274e688 | ||
|
|
fcd75cfae5 | ||
|
|
6387a1d6d0 | ||
|
|
fc4ce2528b | ||
|
|
18d2bfcd8b | ||
|
|
6738a3aa2b | ||
|
|
a8c1bef0bf | ||
|
|
4faf0ea468 | ||
|
|
80cc09fe90 | ||
|
|
ca8dbb985e | ||
|
|
751cdc32a8 | ||
|
|
1d978429f5 | ||
|
|
2b2e3ae5c4 | ||
|
|
0e3ac7e078 | ||
|
|
01ab3b2385 | ||
|
|
11cf87951c | ||
|
|
7c004a4c90 | ||
|
|
a48693d273 | ||
|
|
12d57a6373 | ||
|
|
c7c8fc7777 | ||
|
|
6e054e57ef | ||
|
|
1d89a76d13 | ||
|
|
65925cccdf | ||
|
|
898559ab31 | ||
|
|
ad3621e23b | ||
|
|
57b0f70a55 | ||
|
|
8d6e543cc2 | ||
|
|
bd93fb279b | ||
|
|
81bdae283a | ||
|
|
00e25404c7 | ||
|
|
6a157e1c08 | ||
|
|
7a6f9151a6 | ||
|
|
567293c14d | ||
|
|
2ff6a4966a | ||
|
|
b13d7f9392 | ||
|
|
d21137739d | ||
|
|
1e13cf6fec | ||
|
|
5c52cdc255 | ||
|
|
17d7808200 | ||
|
|
f144bd5a89 | ||
|
|
b72553f6f0 | ||
|
|
c82a14c252 | ||
|
|
faa559e9af | ||
|
|
c51c0c43ed | ||
|
|
2ab0122124 | ||
|
|
8626e0482d | ||
|
|
c9a4c0dac1 | ||
|
|
825d93423d | ||
|
|
ad24ce02e7 | ||
|
|
695616a8f2 | ||
|
|
b3bdf8636a | ||
|
|
c62c080a4b | ||
|
|
c90ab3df5b | ||
|
|
21e21a1fa8 | ||
|
|
92ebdbfacc | ||
|
|
8dbabc8b43 | ||
|
|
c83dc79357 | ||
|
|
a53c1bfe8b | ||
|
|
6185b8fd0d | ||
|
|
ef002f6dfa | ||
|
|
9cdec99fa4 | ||
|
|
9393f84972 | ||
|
|
ceba006c60 | ||
|
|
e9e2053c64 | ||
|
|
bf013aea54 | ||
|
|
454df4872a | ||
|
|
ec315bf26d | ||
|
|
74c304097d | ||
|
|
ad1833a4d5 | ||
|
|
d65bb58317 | ||
|
|
8cf11f9208 | ||
|
|
73f00bd842 | ||
|
|
1b6545fc05 | ||
|
|
40725a76ab | ||
|
|
75f40fad95 | ||
|
|
b458300c02 | ||
|
|
6c6e74e8d1 | ||
|
|
4bab064ad6 | ||
|
|
3da2880aae | ||
|
|
c8d802bc1d | ||
|
|
c3a169319c | ||
|
|
72af950573 | ||
|
|
edae7a2b75 | ||
|
|
1fa48e7edb | ||
|
|
d76992efe6 | ||
|
|
87da4680c7 | ||
|
|
9cc7508b07 | ||
|
|
b258bc598e | ||
|
|
f25c0c60a8 | ||
|
|
f350bd31bd | ||
|
|
06f1699223 | ||
|
|
3e4d528859 | ||
|
|
b847f57382 | ||
|
|
2d7ad25031 | ||
|
|
d670cc13ac | ||
|
|
43699d039f | ||
|
|
9192b009e1 | ||
|
|
3fe85809b2 | ||
|
|
a4b79d6882 | ||
|
|
fc21e6eafa | ||
|
|
11e243a216 | ||
|
|
9f862dcc0e | ||
|
|
faf43d2c4b | ||
|
|
b0580b2df5 | ||
|
|
308903dc91 | ||
|
|
1c7fd67c39 | ||
|
|
c3ae704610 | ||
|
|
9f8e6c0634 | ||
|
|
aab88b411e | ||
|
|
867cf6b60a | ||
|
|
ed87114c5e | ||
|
|
213adb5f0d | ||
|
|
c5c10a003a | ||
|
|
e78205f071 | ||
|
|
ba7134c2a2 | ||
|
|
1eadaa4cda | ||
|
|
d93ce29b20 | ||
|
|
0cddb9e843 | ||
|
|
67e2860cc3 | ||
|
|
0cf9dd165e | ||
|
|
3aa567b672 | ||
|
|
fa1e3cb183 | ||
|
|
14845bf3f2 | ||
|
|
120328eb2b | ||
|
|
e222c0888c | ||
|
|
ec19dfc2f2 | ||
|
|
da45c26e7d | ||
|
|
c39a5fd8c0 | ||
|
|
fb57fe9da7 | ||
|
|
02496da4d2 | ||
|
|
eb1afec22b | ||
|
|
1619df97f8 | ||
|
|
c653a82619 | ||
|
|
2289618cea | ||
|
|
dc886118ba | ||
|
|
879b01004b | ||
|
|
86f3169e4b | ||
|
|
d5957b8c5f | ||
|
|
595eb3efea | ||
|
|
81e93448e3 | ||
|
|
0f9fe8adef | ||
|
|
56933067c0 | ||
|
|
0919f5bf9c | ||
|
|
b91d4411b5 | ||
|
|
15c6131f0e | ||
|
|
c2f2f25046 | ||
|
|
94ced66f87 | ||
|
|
ece2f913a1 | ||
|
|
2b2ada2037 | ||
|
|
1a4568175c | ||
|
|
0c8949e723 | ||
|
|
012966f6a2 | ||
|
|
82b1cca247 | ||
|
|
2976dc29d5 | ||
|
|
99d5b0dc8a | ||
|
|
d1eb768de6 | ||
|
|
5db8e42c69 | ||
|
|
c7efa81efe | ||
|
|
7d92698644 | ||
|
|
4b280a00db | ||
|
|
02b61b145a | ||
|
|
0a7514c47b | ||
|
|
4b1a53367f | ||
|
|
de3625d992 | ||
|
|
65331599ec | ||
|
|
74cd8cf75c | ||
|
|
07586e84ce | ||
|
|
ca97b4371b | ||
|
|
b742607c76 | ||
|
|
1399cc9482 | ||
|
|
7464e17e22 | ||
|
|
053bda26a4 | ||
|
|
93995cd742 | ||
|
|
202dfc9ebe | ||
|
|
23f378cd93 | ||
|
|
70c564dd2c | ||
|
|
9bea6afb80 | ||
|
|
20fb7a9ce0 | ||
|
|
7762bc2cad | ||
|
|
f407785f10 | ||
|
|
138e28fcbe | ||
|
|
38f6a5a40a | ||
|
|
b28f030874 | ||
|
|
d883ab278d | ||
|
|
40ce45c8e9 | ||
|
|
fa754ecaf8 | ||
|
|
c11557316d | ||
|
|
5bf28d3f90 | ||
|
|
c8625ce599 | ||
|
|
991fafb839 | ||
|
|
d7323f5f19 | ||
|
|
10662e4ca5 | ||
|
|
b73dfb08ae | ||
|
|
d8a46cffa5 | ||
|
|
3b3093c72e | ||
|
|
3d841a214c | ||
|
|
2cbbb29eb5 | ||
|
|
c0677ad8c5 | ||
|
|
098c5b0924 | ||
|
|
01ac9a71b7 | ||
|
|
ab8b1d39bd | ||
|
|
b22a8debf2 | ||
|
|
92a3c8bbd8 | ||
|
|
c71f287498 | ||
|
|
b7f8fbe7a0 | ||
|
|
1ca3f60f80 | ||
|
|
7a903361e6 | ||
|
|
4f6e72de55 | ||
|
|
a68c4e9434 | ||
|
|
798b90e0a5 | ||
|
|
cba902f22b | ||
|
|
8eb51e813f | ||
|
|
9ac3c1a394 | ||
|
|
5486ca3b4a | ||
|
|
90845974ea | ||
|
|
57fd817486 | ||
|
|
b322fa8f32 | ||
|
|
81d1e16d7b | ||
|
|
4c52d77aa5 | ||
|
|
523d5166ef | ||
|
|
cde95864b4 | ||
|
|
7354201b5d | ||
|
|
14971f88ee | ||
|
|
0b114ac5cd | ||
|
|
c06eabff24 | ||
|
|
b3ef2478f5 | ||
|
|
39eb9837e9 | ||
|
|
1a429b63c5 | ||
|
|
ae6ad20940 | ||
|
|
3e57b50066 | ||
|
|
dd38e399ca | ||
|
|
319b59500c | ||
|
|
3a79b71e80 | ||
|
|
0c0eab9247 | ||
|
|
114ddcff52 | ||
|
|
57339486d9 | ||
|
|
5f9b17d55b | ||
|
|
325b89e023 | ||
|
|
9ebc823975 | ||
|
|
5fdf6ef4f3 | ||
|
|
0792962591 | ||
|
|
f964374027 | ||
|
|
4352c0a737 | ||
|
|
a0bdcb30fd | ||
|
|
7e0a10c016 | ||
|
|
7fb6f82ab1 | ||
|
|
fdcc9c9e0e | ||
|
|
846f024e91 | ||
|
|
7e969f4e28 | ||
|
|
10a701308d | ||
|
|
e2bed86bfc | ||
|
|
487cdc85cd | ||
|
|
052bbecc3b | ||
|
|
c860b12b3d | ||
|
|
e227008331 | ||
|
|
72f3a784de | ||
|
|
31c9df665d | ||
|
|
dd240116b1 | ||
|
|
92ec139175 | ||
|
|
f076c43b90 | ||
|
|
98215e3dbd | ||
|
|
6197098541 | ||
|
|
34b3c52a28 | ||
|
|
caea68007e | ||
|
|
c1dd8faa29 | ||
|
|
95d065b3d7 | ||
|
|
2303da846b | ||
|
|
7246edcb4b | ||
|
|
dc2f24dbed | ||
|
|
4b793d5344 | ||
|
|
72dd45388f | ||
|
|
b76f78c6da | ||
|
|
30482a3599 | ||
|
|
b3f9571b2d | ||
|
|
0d5afe83a2 | ||
|
|
8b35c9a4b1 | ||
|
|
a5d8eec25f | ||
|
|
df6ec4f94c | ||
|
|
61ebee12ad | ||
|
|
105d63a697 | ||
|
|
07036ac48f | ||
|
|
4f6c8f7784 | ||
|
|
8e57a61aed | ||
|
|
8707005a97 | ||
|
|
cb024dd82d | ||
|
|
84046a6717 | ||
|
|
8bcaa50ba6 | ||
|
|
c433d29171 | ||
|
|
64d51b5290 | ||
|
|
6393b7704e | ||
|
|
0a2071b2f1 | ||
|
|
7981809f36 | ||
|
|
ed87a0b032 | ||
|
|
fc2630e66d | ||
|
|
ec14050890 | ||
|
|
4b17ea95fc | ||
|
|
1be3e5771a | ||
|
|
232cbbac5e | ||
|
|
dee204d2b2 | ||
|
|
b71e9eac51 | ||
|
|
f88636f47c | ||
|
|
8a301efe8b | ||
|
|
5bd393135f | ||
|
|
d550eac525 | ||
|
|
fea59adbbe | ||
|
|
dae0d0ff8b | ||
|
|
86d739cc85 | ||
|
|
9d99f4ce30 | ||
|
|
460a666234 | ||
|
|
ba9342cd4b | ||
|
|
c37eae3b56 | ||
|
|
61cc8d6c50 | ||
|
|
758ab5e581 | ||
|
|
f05ff37560 | ||
|
|
14354090f9 | ||
|
|
0185884ca8 | ||
|
|
5665403d66 | ||
|
|
46b271d75c | ||
|
|
854b958797 | ||
|
|
ff52b55a25 | ||
|
|
e755735ac2 | ||
|
|
69e20a3931 | ||
|
|
05da3db2ed | ||
|
|
6d89cc6c1d | ||
|
|
0494af48a3 | ||
|
|
f4cad42958 | ||
|
|
32189b7239 | ||
|
|
c192071f03 | ||
|
|
8c9fda9137 | ||
|
|
35d1bb1149 | ||
|
|
8dd0833993 | ||
|
|
306eaeaba9 | ||
|
|
7853a5329d | ||
|
|
1fa77078fc | ||
|
|
8e8ce04e18 | ||
|
|
264779e1d3 | ||
|
|
6f505f3a76 | ||
|
|
3817bdd602 | ||
|
|
2c9420d9bc | ||
|
|
2e3cace7f9 | ||
|
|
9553a604ac | ||
|
|
f1e1bf11b6 | ||
|
|
f77724a646 | ||
|
|
5921fd19fb | ||
|
|
a0c4913f84 | ||
|
|
3dfce43de2 | ||
|
|
0e9e5f77cc | ||
|
|
f2f465960b | ||
|
|
05d8ab3000 | ||
|
|
126f69434b | ||
|
|
3e081ae869 | ||
|
|
4e8df9dcc8 | ||
|
|
d7a413d5e7 | ||
|
|
609ac93c10 | ||
|
|
b1d6a41c65 | ||
|
|
a4e2fdfad2 | ||
|
|
22c2971c3c | ||
|
|
123c597e01 | ||
|
|
05e3c29ee4 | ||
|
|
9b1444deb5 | ||
|
|
99d30d5bb7 | ||
|
|
100bb3a571 | ||
|
|
7fb89e4d45 | ||
|
|
1d7c3984ca | ||
|
|
03156a6d94 | ||
|
|
08258ee4b3 | ||
|
|
3dceaf7a0b | ||
|
|
856473ca43 | ||
|
|
7dfe705717 | ||
|
|
dc2f142480 | ||
|
|
fce06105f9 | ||
|
|
94a1156a6b | ||
|
|
5ed4fbd4a3 | ||
|
|
d92a289c25 | ||
|
|
2ba5676eb0 | ||
|
|
66cfa800be | ||
|
|
9755110ec7 | ||
|
|
f5ff969cd4 | ||
|
|
a232565b3e | ||
|
|
fd4ca1c811 | ||
|
|
b6f5b40557 | ||
|
|
5710d33dbf | ||
|
|
831369f653 | ||
|
|
6db59c64aa | ||
|
|
888d7fb262 | ||
|
|
8b4ace6fb8 | ||
|
|
368120c479 | ||
|
|
b01718aae7 | ||
|
|
48b228f68f | ||
|
|
bf21c0e099 | ||
|
|
d85d85e7dc | ||
|
|
99c1dd8124 | ||
|
|
9ce026e22e | ||
|
|
2797970837 | ||
|
|
4796c8b7f9 | ||
|
|
cf03307b70 | ||
|
|
dfed2184f1 | ||
|
|
2ee5127748 | ||
|
|
340a469153 | ||
|
|
934e769513 | ||
|
|
62ae6ca35e | ||
|
|
711a4fe0c8 | ||
|
|
cba07157d5 | ||
|
|
a653d67aae | ||
|
|
249e6130fd | ||
|
|
6a142bc264 | ||
|
|
8bcdd89796 | ||
|
|
489573329e | ||
|
|
843df4b334 | ||
|
|
ef1821c025 | ||
|
|
ed5372f439 | ||
|
|
bc63381fb0 | ||
|
|
c59f2a0749 | ||
|
|
5c30ca5dc6 | ||
|
|
37bc43c7aa | ||
|
|
4edd3f45b7 | ||
|
|
087ea4c5f3 | ||
|
|
40534d6316 | ||
|
|
8621925e75 | ||
|
|
5cb2360985 | ||
|
|
b831d2b64a | ||
|
|
e81597a176 | ||
|
|
7df4f32de6 | ||
|
|
8d265a8123 | ||
|
|
db3725880e | ||
|
|
af5833cbc5 | ||
|
|
9078a085c3 | ||
|
|
396a7d7f09 | ||
|
|
8a128a57cd | ||
|
|
3dca9b8a68 | ||
|
|
5f8f5a1c33 | ||
|
|
5a72a7d9f4 | ||
|
|
51a91bfa8a | ||
|
|
4cedd0a346 | ||
|
|
b989f4085d | ||
|
|
19cc797c41 | ||
|
|
99ee3d9dec | ||
|
|
455753c774 | ||
|
|
da099d4312 | ||
|
|
a88b9181b6 | ||
|
|
7f7c632914 | ||
|
|
e7356223bb | ||
|
|
7547ad0391 | ||
|
|
ca30d6bb3d | ||
|
|
ebd2cdb7a7 | ||
|
|
52b8f60953 | ||
|
|
ab1e2d49ab | ||
|
|
401bd1c643 | ||
|
|
e6a540660d | ||
|
|
53e6bec425 | ||
|
|
f6ded69fa3 | ||
|
|
68053d64b5 | ||
|
|
1f12966628 | ||
|
|
8d3723c91f | ||
|
|
7dcc359110 | ||
|
|
854881bba2 | ||
|
|
ddb7958f40 | ||
|
|
fe0d3fd448 | ||
|
|
15d5c878f3 | ||
|
|
4f63c3f8a8 | ||
|
|
b766ce76ff | ||
|
|
0b4b09958f | ||
|
|
e12fc5a89d | ||
|
|
bd3c351f1f | ||
|
|
6064be33e5 | ||
|
|
1540d6f472 | ||
|
|
1310092c0c | ||
|
|
12bed8e8ad | ||
|
|
e485fac8ed | ||
|
|
55d75f18de | ||
|
|
e8648a3f71 | ||
|
|
0c7cabe46f | ||
|
|
a9ec3be2fd | ||
|
|
abaaee1af2 | ||
|
|
6283a515b9 | ||
|
|
ce7d463710 | ||
|
|
bc3404fcbe | ||
|
|
bd87d3963a | ||
|
|
fed449a801 | ||
|
|
19dd92d3e0 | ||
|
|
f22b9ba9f1 | ||
|
|
fedafb9352 | ||
|
|
18f0484249 | ||
|
|
10956056b3 | ||
|
|
e482f04123 | ||
|
|
db89f0d4d1 | ||
|
|
2ac97a9f1f | ||
|
|
c03359a189 | ||
|
|
84b636debc | ||
|
|
2642299d77 | ||
|
|
2a60e5e338 | ||
|
|
880c063d04 | ||
|
|
7a374c43dc | ||
|
|
7be1fcc32e | ||
|
|
b57dca66be | ||
|
|
d455f5f445 | ||
|
|
5305095832 | ||
|
|
2200fad30e | ||
|
|
e4b9cbcb80 | ||
|
|
e5e112c3c2 | ||
|
|
dd3cdf63e6 | ||
|
|
a800189c25 | ||
|
|
b342245619 | ||
|
|
6cd5ac2d0d | ||
|
|
872a48dacb | ||
|
|
721aa544c9 | ||
|
|
7bfbda7188 | ||
|
|
602244979b | ||
|
|
8e29cae309 | ||
|
|
2a73e6c0d5 | ||
|
|
d4198659b7 | ||
|
|
16b5dd5e78 | ||
|
|
ef1edc7ee8 | ||
|
|
3ccfb74028 | ||
|
|
1aba20d642 | ||
|
|
27786d709d | ||
|
|
e0e6a29150 | ||
|
|
dfd6076e19 | ||
|
|
e589ef8627 | ||
|
|
e8c1baa396 | ||
|
|
69ba2617d2 | ||
|
|
34c215ad83 | ||
|
|
2a3bb62001 | ||
|
|
fe46ae09ef | ||
|
|
46f67fce7a | ||
|
|
629e68428f | ||
|
|
100439aadd | ||
|
|
f6a348ba94 | ||
|
|
a54b3ffcee | ||
|
|
47842c9ea7 | ||
|
|
834e25521b | ||
|
|
f78597f010 | ||
|
|
c06e433e74 | ||
|
|
9971d517fd | ||
|
|
f8548029a2 | ||
|
|
3e337e3e97 | ||
|
|
e59f8eda74 | ||
|
|
31e70b205c | ||
|
|
5d02f1db5f | ||
|
|
b01bd93a20 | ||
|
|
05bbba5074 | ||
|
|
679d4e1dcd |
@@ -14,3 +14,6 @@ CTestTestfile.cmake
|
|||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
build*
|
build*
|
||||||
Build
|
Build
|
||||||
|
CMakeLists.txt.user
|
||||||
|
3rdparty/expat_2.2.6/
|
||||||
|
nbproject
|
||||||
|
|||||||
Vendored
-2
@@ -2,8 +2,6 @@ if (NOT SYSTEM_EXPAT)
|
|||||||
add_subdirectory(expat)
|
add_subdirectory(expat)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(utf8)
|
|
||||||
|
|
||||||
if (ENABLE_DNS AND NOT SYSTEM_UDNS)
|
if (ENABLE_DNS AND NOT SYSTEM_UDNS)
|
||||||
add_subdirectory(udns)
|
add_subdirectory(udns)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
configure_file (
|
configure_file (
|
||||||
"${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in"
|
"${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in"
|
||||||
"${PROJECT_BINARY_DIR}/3rdparty/expat/expat_config.h"
|
"${PROJECT_BINARY_DIR}/3rdparty/expat/simgear_expat_config.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(expat_sources
|
set(expat_sources
|
||||||
|
|||||||
Vendored
+2
@@ -18,6 +18,8 @@
|
|||||||
#include "amigaconfig.h"
|
#include "amigaconfig.h"
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
#include "watcomconfig.h"
|
#include "watcomconfig.h"
|
||||||
|
#elif defined(HAVE_SIMGEAR_EXPAT_CONFIG_H)
|
||||||
|
#include "simgear_expat_config.h"
|
||||||
#elif defined(HAVE_EXPAT_CONFIG_H)
|
#elif defined(HAVE_EXPAT_CONFIG_H)
|
||||||
#include "expat_config.h"
|
#include "expat_config.h"
|
||||||
#endif /* ndef COMPILED_FROM_DSP */
|
#endif /* ndef COMPILED_FROM_DSP */
|
||||||
|
|||||||
Vendored
+2
@@ -12,6 +12,8 @@
|
|||||||
#include "amigaconfig.h"
|
#include "amigaconfig.h"
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
#include "watcomconfig.h"
|
#include "watcomconfig.h"
|
||||||
|
#elif defined(HAVE_SIMGEAR_EXPAT_CONFIG_H)
|
||||||
|
#include "simgear_expat_config.h"
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_EXPAT_CONFIG_H
|
#ifdef HAVE_EXPAT_CONFIG_H
|
||||||
#include "expat_config.h"
|
#include "expat_config.h"
|
||||||
|
|||||||
Vendored
+2
@@ -12,6 +12,8 @@
|
|||||||
#include "amigaconfig.h"
|
#include "amigaconfig.h"
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
#include "watcomconfig.h"
|
#include "watcomconfig.h"
|
||||||
|
#elif defined(HAVE_SIMGEAR_EXPAT_CONFIG_H)
|
||||||
|
#include "simgear_expat_config.h"
|
||||||
#else
|
#else
|
||||||
#ifdef HAVE_EXPAT_CONFIG_H
|
#ifdef HAVE_EXPAT_CONFIG_H
|
||||||
#include "expat_config.h"
|
#include "expat_config.h"
|
||||||
|
|||||||
Vendored
+3
-3
@@ -24,7 +24,7 @@
|
|||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
# include <winsock2.h> /* includes <windows.h> */
|
# include <winsock2.h> /* includes <windows.h> */
|
||||||
# include <iphlpapi.h> /* for dns server addresses etc */
|
# include <iphlpapi.h> /* for dns server addresses etc */
|
||||||
#else
|
#else
|
||||||
@@ -53,7 +53,7 @@ static void dns_set_srch_internal(struct dns_ctx *ctx, char *srch) {
|
|||||||
dns_add_srch(ctx, srch);
|
dns_add_srch(ctx, srch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
|
|
||||||
#ifndef NO_IPHLPAPI
|
#ifndef NO_IPHLPAPI
|
||||||
/* Apparently, some systems does not have proper headers for IPHLPAIP to work.
|
/* Apparently, some systems does not have proper headers for IPHLPAIP to work.
|
||||||
@@ -217,7 +217,7 @@ int dns_init(struct dns_ctx *ctx, int do_open) {
|
|||||||
ctx = &dns_defctx;
|
ctx = &dns_defctx;
|
||||||
dns_reset(ctx);
|
dns_reset(ctx);
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
if (dns_initns_iphlpapi(ctx) != 0)
|
if (dns_initns_iphlpapi(ctx) != 0)
|
||||||
dns_initns_registry(ctx);
|
dns_initns_registry(ctx);
|
||||||
/*XXX WINDOWS: probably good to get default domain and search list too...
|
/*XXX WINDOWS: probably good to get default domain and search list too...
|
||||||
|
|||||||
Vendored
+4
-4
@@ -24,7 +24,7 @@
|
|||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
# include <winsock2.h> /* includes <windows.h> */
|
# include <winsock2.h> /* includes <windows.h> */
|
||||||
# include <ws2tcpip.h> /* needed for struct in6_addr */
|
# include <ws2tcpip.h> /* needed for struct in6_addr */
|
||||||
#else
|
#else
|
||||||
@@ -392,7 +392,7 @@ dns_set_tmcbck(struct dns_ctx *ctx, dns_utm_fn *fn, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned dns_nonrandom_32(void) {
|
static unsigned dns_nonrandom_32(void) {
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
GetSystemTimeAsFileTime(&ft);
|
GetSystemTimeAsFileTime(&ft);
|
||||||
return ft.dwLowDateTime;
|
return ft.dwLowDateTime;
|
||||||
@@ -551,7 +551,7 @@ int dns_open(struct dns_ctx *ctx) {
|
|||||||
ctx->dnsc_qstatus = DNS_E_TEMPFAIL;
|
ctx->dnsc_qstatus = DNS_E_TEMPFAIL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
{ unsigned long on = 1;
|
{ unsigned long on = 1;
|
||||||
if (ioctlsocket(sock, FIONBIO, &on) == SOCKET_ERROR) {
|
if (ioctlsocket(sock, FIONBIO, &on) == SOCKET_ERROR) {
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
@@ -991,7 +991,7 @@ again: /* receive the reply */
|
|||||||
* or remote. On local errors, we should stop, while
|
* or remote. On local errors, we should stop, while
|
||||||
* remote errors should be ignored (for now anyway).
|
* remote errors should be ignored (for now anyway).
|
||||||
*/
|
*/
|
||||||
#ifdef WINDOWS
|
#if defined(_WINDOWS) || defined(WINDOWS)
|
||||||
if (WSAGetLastError() == WSAEWOULDBLOCK)
|
if (WSAGetLastError() == WSAEWOULDBLOCK)
|
||||||
#else
|
#else
|
||||||
if (errno == EAGAIN)
|
if (errno == EAGAIN)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifndef WINDOWS
|
#if !defined(_WINDOWS) && !defined(WINDOWS)
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Vendored
-17
@@ -1,17 +0,0 @@
|
|||||||
include (SimGearComponent)
|
|
||||||
|
|
||||||
set(HEADERS
|
|
||||||
source/utf8.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(HEADERS_utf8
|
|
||||||
source/utf8/checked.h
|
|
||||||
source/utf8/core.h
|
|
||||||
source/utf8/unchecked.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(SOURCES
|
|
||||||
)
|
|
||||||
|
|
||||||
simgear_component(utf8 3rdparty/utf8 "${SOURCES}" "${HEADERS}")
|
|
||||||
simgear_component(utf8-internal 3rdparty/utf8/utf8 "" "${HEADERS_utf8}")
|
|
||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
utf8 cpp library
|
|
||||||
Release 2.3.4
|
|
||||||
|
|
||||||
A minor bug fix release. Thanks to all who reported bugs.
|
|
||||||
|
|
||||||
Note: Version 2.3.3 contained a regression, and therefore was removed.
|
|
||||||
|
|
||||||
Changes from version 2.3.2
|
|
||||||
- Bug fix [39]: checked.h Line 273 and unchecked.h Line 182 have an extra ';'
|
|
||||||
- Bug fix [36]: replace_invalid() only works with back_inserter
|
|
||||||
|
|
||||||
Files included in the release: utf8.h, core.h, checked.h, unchecked.h, utf8cpp.html, ReleaseNotes
|
|
||||||
Vendored
-1789
File diff suppressed because it is too large
Load Diff
Vendored
-34
@@ -1,34 +0,0 @@
|
|||||||
// Copyright 2006 Nemanja Trifunovic
|
|
||||||
|
|
||||||
/*
|
|
||||||
Permission is hereby granted, free of charge, to any person or organization
|
|
||||||
obtaining a copy of the software and accompanying documentation covered by
|
|
||||||
this license (the "Software") to use, reproduce, display, distribute,
|
|
||||||
execute, and transmit the Software, and to prepare derivative works of the
|
|
||||||
Software, and to permit third-parties to whom the Software is furnished to
|
|
||||||
do so, all subject to the following:
|
|
||||||
|
|
||||||
The copyright notices in the Software and this entire statement, including
|
|
||||||
the above license grant, this restriction and the following disclaimer,
|
|
||||||
must be included in all copies of the Software, in whole or in part, and
|
|
||||||
all derivative works of the Software, unless such copies or derivative
|
|
||||||
works are solely in the form of machine-executable object code generated by
|
|
||||||
a source language processor.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
|
|
||||||
#include "utf8/checked.h"
|
|
||||||
#include "utf8/unchecked.h"
|
|
||||||
|
|
||||||
#endif // header guard
|
|
||||||
Vendored
-327
@@ -1,327 +0,0 @@
|
|||||||
// Copyright 2006 Nemanja Trifunovic
|
|
||||||
|
|
||||||
/*
|
|
||||||
Permission is hereby granted, free of charge, to any person or organization
|
|
||||||
obtaining a copy of the software and accompanying documentation covered by
|
|
||||||
this license (the "Software") to use, reproduce, display, distribute,
|
|
||||||
execute, and transmit the Software, and to prepare derivative works of the
|
|
||||||
Software, and to permit third-parties to whom the Software is furnished to
|
|
||||||
do so, all subject to the following:
|
|
||||||
|
|
||||||
The copyright notices in the Software and this entire statement, including
|
|
||||||
the above license grant, this restriction and the following disclaimer,
|
|
||||||
must be included in all copies of the Software, in whole or in part, and
|
|
||||||
all derivative works of the Software, unless such copies or derivative
|
|
||||||
works are solely in the form of machine-executable object code generated by
|
|
||||||
a source language processor.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
#define UTF8_FOR_CPP_CHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
|
|
||||||
#include "core.h"
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
namespace utf8
|
|
||||||
{
|
|
||||||
// Base for the exceptions that may be thrown from the library
|
|
||||||
class exception : public ::std::exception {
|
|
||||||
};
|
|
||||||
|
|
||||||
// Exceptions that may be thrown from the library functions.
|
|
||||||
class invalid_code_point : public exception {
|
|
||||||
uint32_t cp;
|
|
||||||
public:
|
|
||||||
invalid_code_point(uint32_t cp) : cp(cp) {}
|
|
||||||
virtual const char* what() const throw() { return "Invalid code point"; }
|
|
||||||
uint32_t code_point() const {return cp;}
|
|
||||||
};
|
|
||||||
|
|
||||||
class invalid_utf8 : public exception {
|
|
||||||
uint8_t u8;
|
|
||||||
public:
|
|
||||||
invalid_utf8 (uint8_t u) : u8(u) {}
|
|
||||||
virtual const char* what() const throw() { return "Invalid UTF-8"; }
|
|
||||||
uint8_t utf8_octet() const {return u8;}
|
|
||||||
};
|
|
||||||
|
|
||||||
class invalid_utf16 : public exception {
|
|
||||||
uint16_t u16;
|
|
||||||
public:
|
|
||||||
invalid_utf16 (uint16_t u) : u16(u) {}
|
|
||||||
virtual const char* what() const throw() { return "Invalid UTF-16"; }
|
|
||||||
uint16_t utf16_word() const {return u16;}
|
|
||||||
};
|
|
||||||
|
|
||||||
class not_enough_room : public exception {
|
|
||||||
public:
|
|
||||||
virtual const char* what() const throw() { return "Not enough space"; }
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The library API - functions intended to be called by the users
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
octet_iterator append(uint32_t cp, octet_iterator result)
|
|
||||||
{
|
|
||||||
if (!utf8::internal::is_code_point_valid(cp))
|
|
||||||
throw invalid_code_point(cp);
|
|
||||||
|
|
||||||
if (cp < 0x80) // one octet
|
|
||||||
*(result++) = static_cast<uint8_t>(cp);
|
|
||||||
else if (cp < 0x800) { // two octets
|
|
||||||
*(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
|
|
||||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
|
||||||
}
|
|
||||||
else if (cp < 0x10000) { // three octets
|
|
||||||
*(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
|
|
||||||
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
|
|
||||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
|
||||||
}
|
|
||||||
else { // four octets
|
|
||||||
*(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
|
|
||||||
*(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f) | 0x80);
|
|
||||||
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
|
|
||||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename output_iterator>
|
|
||||||
output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement)
|
|
||||||
{
|
|
||||||
while (start != end) {
|
|
||||||
octet_iterator sequence_start = start;
|
|
||||||
internal::utf_error err_code = utf8::internal::validate_next(start, end);
|
|
||||||
switch (err_code) {
|
|
||||||
case internal::UTF8_OK :
|
|
||||||
for (octet_iterator it = sequence_start; it != start; ++it)
|
|
||||||
*out++ = *it;
|
|
||||||
break;
|
|
||||||
case internal::NOT_ENOUGH_ROOM:
|
|
||||||
throw not_enough_room();
|
|
||||||
case internal::INVALID_LEAD:
|
|
||||||
out = utf8::append (replacement, out);
|
|
||||||
++start;
|
|
||||||
break;
|
|
||||||
case internal::INCOMPLETE_SEQUENCE:
|
|
||||||
case internal::OVERLONG_SEQUENCE:
|
|
||||||
case internal::INVALID_CODE_POINT:
|
|
||||||
out = utf8::append (replacement, out);
|
|
||||||
++start;
|
|
||||||
// just one replacement mark for the sequence
|
|
||||||
while (start != end && utf8::internal::is_trail(*start))
|
|
||||||
++start;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename output_iterator>
|
|
||||||
inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out)
|
|
||||||
{
|
|
||||||
static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd);
|
|
||||||
return utf8::replace_invalid(start, end, out, replacement_marker);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t next(octet_iterator& it, octet_iterator end)
|
|
||||||
{
|
|
||||||
uint32_t cp = 0;
|
|
||||||
internal::utf_error err_code = utf8::internal::validate_next(it, end, cp);
|
|
||||||
switch (err_code) {
|
|
||||||
case internal::UTF8_OK :
|
|
||||||
break;
|
|
||||||
case internal::NOT_ENOUGH_ROOM :
|
|
||||||
throw not_enough_room();
|
|
||||||
case internal::INVALID_LEAD :
|
|
||||||
case internal::INCOMPLETE_SEQUENCE :
|
|
||||||
case internal::OVERLONG_SEQUENCE :
|
|
||||||
throw invalid_utf8(*it);
|
|
||||||
case internal::INVALID_CODE_POINT :
|
|
||||||
throw invalid_code_point(cp);
|
|
||||||
}
|
|
||||||
return cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t peek_next(octet_iterator it, octet_iterator end)
|
|
||||||
{
|
|
||||||
return utf8::next(it, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t prior(octet_iterator& it, octet_iterator start)
|
|
||||||
{
|
|
||||||
// can't do much if it == start
|
|
||||||
if (it == start)
|
|
||||||
throw not_enough_room();
|
|
||||||
|
|
||||||
octet_iterator end = it;
|
|
||||||
// Go back until we hit either a lead octet or start
|
|
||||||
while (utf8::internal::is_trail(*(--it)))
|
|
||||||
if (it == start)
|
|
||||||
throw invalid_utf8(*it); // error - no lead byte in the sequence
|
|
||||||
return utf8::peek_next(it, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deprecated in versions that include "prior"
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t previous(octet_iterator& it, octet_iterator pass_start)
|
|
||||||
{
|
|
||||||
octet_iterator end = it;
|
|
||||||
while (utf8::internal::is_trail(*(--it)))
|
|
||||||
if (it == pass_start)
|
|
||||||
throw invalid_utf8(*it); // error - no lead byte in the sequence
|
|
||||||
octet_iterator temp = it;
|
|
||||||
return utf8::next(temp, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename distance_type>
|
|
||||||
void advance (octet_iterator& it, distance_type n, octet_iterator end)
|
|
||||||
{
|
|
||||||
for (distance_type i = 0; i < n; ++i)
|
|
||||||
utf8::next(it, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
typename std::iterator_traits<octet_iterator>::difference_type
|
|
||||||
distance (octet_iterator first, octet_iterator last)
|
|
||||||
{
|
|
||||||
typename std::iterator_traits<octet_iterator>::difference_type dist;
|
|
||||||
for (dist = 0; first < last; ++dist)
|
|
||||||
utf8::next(first, last);
|
|
||||||
return dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16bit_iterator, typename octet_iterator>
|
|
||||||
octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
|
|
||||||
{
|
|
||||||
while (start != end) {
|
|
||||||
uint32_t cp = utf8::internal::mask16(*start++);
|
|
||||||
// Take care of surrogate pairs first
|
|
||||||
if (utf8::internal::is_lead_surrogate(cp)) {
|
|
||||||
if (start != end) {
|
|
||||||
uint32_t trail_surrogate = utf8::internal::mask16(*start++);
|
|
||||||
if (utf8::internal::is_trail_surrogate(trail_surrogate))
|
|
||||||
cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
|
|
||||||
else
|
|
||||||
throw invalid_utf16(static_cast<uint16_t>(trail_surrogate));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw invalid_utf16(static_cast<uint16_t>(cp));
|
|
||||||
|
|
||||||
}
|
|
||||||
// Lone trail surrogate
|
|
||||||
else if (utf8::internal::is_trail_surrogate(cp))
|
|
||||||
throw invalid_utf16(static_cast<uint16_t>(cp));
|
|
||||||
|
|
||||||
result = utf8::append(cp, result);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16bit_iterator, typename octet_iterator>
|
|
||||||
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
|
|
||||||
{
|
|
||||||
while (start != end) {
|
|
||||||
uint32_t cp = utf8::next(start, end);
|
|
||||||
if (cp > 0xffff) { //make a surrogate pair
|
|
||||||
*result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
|
|
||||||
*result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*result++ = static_cast<uint16_t>(cp);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename u32bit_iterator>
|
|
||||||
octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
|
|
||||||
{
|
|
||||||
while (start != end)
|
|
||||||
result = utf8::append(*(start++), result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename u32bit_iterator>
|
|
||||||
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
|
|
||||||
{
|
|
||||||
while (start != end)
|
|
||||||
(*result++) = utf8::next(start, end);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The iterator class
|
|
||||||
template <typename octet_iterator>
|
|
||||||
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
|
|
||||||
octet_iterator it;
|
|
||||||
octet_iterator range_start;
|
|
||||||
octet_iterator range_end;
|
|
||||||
public:
|
|
||||||
iterator () {}
|
|
||||||
explicit iterator (const octet_iterator& octet_it,
|
|
||||||
const octet_iterator& range_start,
|
|
||||||
const octet_iterator& range_end) :
|
|
||||||
it(octet_it), range_start(range_start), range_end(range_end)
|
|
||||||
{
|
|
||||||
if (it < range_start || it > range_end)
|
|
||||||
throw std::out_of_range("Invalid utf-8 iterator position");
|
|
||||||
}
|
|
||||||
// the default "big three" are OK
|
|
||||||
octet_iterator base () const { return it; }
|
|
||||||
uint32_t operator * () const
|
|
||||||
{
|
|
||||||
octet_iterator temp = it;
|
|
||||||
return utf8::next(temp, range_end);
|
|
||||||
}
|
|
||||||
bool operator == (const iterator& rhs) const
|
|
||||||
{
|
|
||||||
if (range_start != rhs.range_start || range_end != rhs.range_end)
|
|
||||||
throw std::logic_error("Comparing utf-8 iterators defined with different ranges");
|
|
||||||
return (it == rhs.it);
|
|
||||||
}
|
|
||||||
bool operator != (const iterator& rhs) const
|
|
||||||
{
|
|
||||||
return !(operator == (rhs));
|
|
||||||
}
|
|
||||||
iterator& operator ++ ()
|
|
||||||
{
|
|
||||||
utf8::next(it, range_end);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
iterator operator ++ (int)
|
|
||||||
{
|
|
||||||
iterator temp = *this;
|
|
||||||
utf8::next(it, range_end);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
iterator& operator -- ()
|
|
||||||
{
|
|
||||||
utf8::prior(it, range_start);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
iterator operator -- (int)
|
|
||||||
{
|
|
||||||
iterator temp = *this;
|
|
||||||
utf8::prior(it, range_start);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
}; // class iterator
|
|
||||||
|
|
||||||
} // namespace utf8
|
|
||||||
|
|
||||||
#endif //header guard
|
|
||||||
|
|
||||||
|
|
||||||
Vendored
-329
@@ -1,329 +0,0 @@
|
|||||||
// Copyright 2006 Nemanja Trifunovic
|
|
||||||
|
|
||||||
/*
|
|
||||||
Permission is hereby granted, free of charge, to any person or organization
|
|
||||||
obtaining a copy of the software and accompanying documentation covered by
|
|
||||||
this license (the "Software") to use, reproduce, display, distribute,
|
|
||||||
execute, and transmit the Software, and to prepare derivative works of the
|
|
||||||
Software, and to permit third-parties to whom the Software is furnished to
|
|
||||||
do so, all subject to the following:
|
|
||||||
|
|
||||||
The copyright notices in the Software and this entire statement, including
|
|
||||||
the above license grant, this restriction and the following disclaimer,
|
|
||||||
must be included in all copies of the Software, in whole or in part, and
|
|
||||||
all derivative works of the Software, unless such copies or derivative
|
|
||||||
works are solely in the form of machine-executable object code generated by
|
|
||||||
a source language processor.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
namespace utf8
|
|
||||||
{
|
|
||||||
// The typedefs for 8-bit, 16-bit and 32-bit unsigned integers
|
|
||||||
// You may need to change them to match your system.
|
|
||||||
// These typedefs have the same names as ones from cstdint, or boost/cstdint
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
|
|
||||||
// Helper code - not intended to be directly called by the library users. May be changed at any time
|
|
||||||
namespace internal
|
|
||||||
{
|
|
||||||
// Unicode constants
|
|
||||||
// Leading (high) surrogates: 0xd800 - 0xdbff
|
|
||||||
// Trailing (low) surrogates: 0xdc00 - 0xdfff
|
|
||||||
const uint16_t LEAD_SURROGATE_MIN = 0xd800u;
|
|
||||||
const uint16_t LEAD_SURROGATE_MAX = 0xdbffu;
|
|
||||||
const uint16_t TRAIL_SURROGATE_MIN = 0xdc00u;
|
|
||||||
const uint16_t TRAIL_SURROGATE_MAX = 0xdfffu;
|
|
||||||
const uint16_t LEAD_OFFSET = LEAD_SURROGATE_MIN - (0x10000 >> 10);
|
|
||||||
const uint32_t SURROGATE_OFFSET = 0x10000u - (LEAD_SURROGATE_MIN << 10) - TRAIL_SURROGATE_MIN;
|
|
||||||
|
|
||||||
// Maximum valid value for a Unicode code point
|
|
||||||
const uint32_t CODE_POINT_MAX = 0x0010ffffu;
|
|
||||||
|
|
||||||
template<typename octet_type>
|
|
||||||
inline uint8_t mask8(octet_type oc)
|
|
||||||
{
|
|
||||||
return static_cast<uint8_t>(0xff & oc);
|
|
||||||
}
|
|
||||||
template<typename u16_type>
|
|
||||||
inline uint16_t mask16(u16_type oc)
|
|
||||||
{
|
|
||||||
return static_cast<uint16_t>(0xffff & oc);
|
|
||||||
}
|
|
||||||
template<typename octet_type>
|
|
||||||
inline bool is_trail(octet_type oc)
|
|
||||||
{
|
|
||||||
return ((utf8::internal::mask8(oc) >> 6) == 0x2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16>
|
|
||||||
inline bool is_lead_surrogate(u16 cp)
|
|
||||||
{
|
|
||||||
return (cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16>
|
|
||||||
inline bool is_trail_surrogate(u16 cp)
|
|
||||||
{
|
|
||||||
return (cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16>
|
|
||||||
inline bool is_surrogate(u16 cp)
|
|
||||||
{
|
|
||||||
return (cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u32>
|
|
||||||
inline bool is_code_point_valid(u32 cp)
|
|
||||||
{
|
|
||||||
return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
inline typename std::iterator_traits<octet_iterator>::difference_type
|
|
||||||
sequence_length(octet_iterator lead_it)
|
|
||||||
{
|
|
||||||
uint8_t lead = utf8::internal::mask8(*lead_it);
|
|
||||||
if (lead < 0x80)
|
|
||||||
return 1;
|
|
||||||
else if ((lead >> 5) == 0x6)
|
|
||||||
return 2;
|
|
||||||
else if ((lead >> 4) == 0xe)
|
|
||||||
return 3;
|
|
||||||
else if ((lead >> 3) == 0x1e)
|
|
||||||
return 4;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_difference_type>
|
|
||||||
inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length)
|
|
||||||
{
|
|
||||||
if (cp < 0x80) {
|
|
||||||
if (length != 1)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (cp < 0x800) {
|
|
||||||
if (length != 2)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (cp < 0x10000) {
|
|
||||||
if (length != 3)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT};
|
|
||||||
|
|
||||||
/// Helper for get_sequence_x
|
|
||||||
template <typename octet_iterator>
|
|
||||||
utf_error increase_safely(octet_iterator& it, octet_iterator end)
|
|
||||||
{
|
|
||||||
if (++it == end)
|
|
||||||
return NOT_ENOUGH_ROOM;
|
|
||||||
|
|
||||||
if (!utf8::internal::is_trail(*it))
|
|
||||||
return INCOMPLETE_SEQUENCE;
|
|
||||||
|
|
||||||
return UTF8_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;}
|
|
||||||
|
|
||||||
/// get_sequence_x functions decode utf-8 sequences of the length x
|
|
||||||
template <typename octet_iterator>
|
|
||||||
utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point)
|
|
||||||
{
|
|
||||||
if (it == end)
|
|
||||||
return NOT_ENOUGH_ROOM;
|
|
||||||
|
|
||||||
code_point = utf8::internal::mask8(*it);
|
|
||||||
|
|
||||||
return UTF8_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point)
|
|
||||||
{
|
|
||||||
if (it == end)
|
|
||||||
return NOT_ENOUGH_ROOM;
|
|
||||||
|
|
||||||
code_point = utf8::internal::mask8(*it);
|
|
||||||
|
|
||||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
|
||||||
|
|
||||||
code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f);
|
|
||||||
|
|
||||||
return UTF8_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point)
|
|
||||||
{
|
|
||||||
if (it == end)
|
|
||||||
return NOT_ENOUGH_ROOM;
|
|
||||||
|
|
||||||
code_point = utf8::internal::mask8(*it);
|
|
||||||
|
|
||||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
|
||||||
|
|
||||||
code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
|
|
||||||
|
|
||||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
|
||||||
|
|
||||||
code_point += (*it) & 0x3f;
|
|
||||||
|
|
||||||
return UTF8_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point)
|
|
||||||
{
|
|
||||||
if (it == end)
|
|
||||||
return NOT_ENOUGH_ROOM;
|
|
||||||
|
|
||||||
code_point = utf8::internal::mask8(*it);
|
|
||||||
|
|
||||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
|
||||||
|
|
||||||
code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
|
|
||||||
|
|
||||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
|
||||||
|
|
||||||
code_point += (utf8::internal::mask8(*it) << 6) & 0xfff;
|
|
||||||
|
|
||||||
UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end)
|
|
||||||
|
|
||||||
code_point += (*it) & 0x3f;
|
|
||||||
|
|
||||||
return UTF8_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point)
|
|
||||||
{
|
|
||||||
// Save the original value of it so we can go back in case of failure
|
|
||||||
// Of course, it does not make much sense with i.e. stream iterators
|
|
||||||
octet_iterator original_it = it;
|
|
||||||
|
|
||||||
uint32_t cp = 0;
|
|
||||||
// Determine the sequence length based on the lead octet
|
|
||||||
typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type;
|
|
||||||
const octet_difference_type length = utf8::internal::sequence_length(it);
|
|
||||||
|
|
||||||
// Get trail octets and calculate the code point
|
|
||||||
utf_error err = UTF8_OK;
|
|
||||||
switch (length) {
|
|
||||||
case 0:
|
|
||||||
return INVALID_LEAD;
|
|
||||||
case 1:
|
|
||||||
err = utf8::internal::get_sequence_1(it, end, cp);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
err = utf8::internal::get_sequence_2(it, end, cp);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
err = utf8::internal::get_sequence_3(it, end, cp);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
err = utf8::internal::get_sequence_4(it, end, cp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err == UTF8_OK) {
|
|
||||||
// Decoding succeeded. Now, security checks...
|
|
||||||
if (utf8::internal::is_code_point_valid(cp)) {
|
|
||||||
if (!utf8::internal::is_overlong_sequence(cp, length)){
|
|
||||||
// Passed! Return here.
|
|
||||||
code_point = cp;
|
|
||||||
++it;
|
|
||||||
return UTF8_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
err = OVERLONG_SEQUENCE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
err = INVALID_CODE_POINT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Failure branch - restore the original value of the iterator
|
|
||||||
it = original_it;
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
inline utf_error validate_next(octet_iterator& it, octet_iterator end) {
|
|
||||||
uint32_t ignored;
|
|
||||||
return utf8::internal::validate_next(it, end, ignored);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
/// The library API - functions intended to be called by the users
|
|
||||||
|
|
||||||
// Byte order mark
|
|
||||||
const uint8_t bom[] = {0xef, 0xbb, 0xbf};
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
octet_iterator find_invalid(octet_iterator start, octet_iterator end)
|
|
||||||
{
|
|
||||||
octet_iterator result = start;
|
|
||||||
while (result != end) {
|
|
||||||
utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end);
|
|
||||||
if (err_code != internal::UTF8_OK)
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
inline bool is_valid(octet_iterator start, octet_iterator end)
|
|
||||||
{
|
|
||||||
return (utf8::find_invalid(start, end) == end);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
inline bool starts_with_bom (octet_iterator it, octet_iterator end)
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) &&
|
|
||||||
((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) &&
|
|
||||||
((it != end) && (utf8::internal::mask8(*it)) == bom[2])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Deprecated in release 2.3
|
|
||||||
template <typename octet_iterator>
|
|
||||||
inline bool is_bom (octet_iterator it)
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
(utf8::internal::mask8(*it++)) == bom[0] &&
|
|
||||||
(utf8::internal::mask8(*it++)) == bom[1] &&
|
|
||||||
(utf8::internal::mask8(*it)) == bom[2]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} // namespace utf8
|
|
||||||
|
|
||||||
#endif // header guard
|
|
||||||
|
|
||||||
|
|
||||||
-228
@@ -1,228 +0,0 @@
|
|||||||
// Copyright 2006 Nemanja Trifunovic
|
|
||||||
|
|
||||||
/*
|
|
||||||
Permission is hereby granted, free of charge, to any person or organization
|
|
||||||
obtaining a copy of the software and accompanying documentation covered by
|
|
||||||
this license (the "Software") to use, reproduce, display, distribute,
|
|
||||||
execute, and transmit the Software, and to prepare derivative works of the
|
|
||||||
Software, and to permit third-parties to whom the Software is furnished to
|
|
||||||
do so, all subject to the following:
|
|
||||||
|
|
||||||
The copyright notices in the Software and this entire statement, including
|
|
||||||
the above license grant, this restriction and the following disclaimer,
|
|
||||||
must be included in all copies of the Software, in whole or in part, and
|
|
||||||
all derivative works of the Software, unless such copies or derivative
|
|
||||||
works are solely in the form of machine-executable object code generated by
|
|
||||||
a source language processor.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
||||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
||||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
||||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
#define UTF8_FOR_CPP_UNCHECKED_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
|
|
||||||
|
|
||||||
#include "core.h"
|
|
||||||
|
|
||||||
namespace utf8
|
|
||||||
{
|
|
||||||
namespace unchecked
|
|
||||||
{
|
|
||||||
template <typename octet_iterator>
|
|
||||||
octet_iterator append(uint32_t cp, octet_iterator result)
|
|
||||||
{
|
|
||||||
if (cp < 0x80) // one octet
|
|
||||||
*(result++) = static_cast<uint8_t>(cp);
|
|
||||||
else if (cp < 0x800) { // two octets
|
|
||||||
*(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0);
|
|
||||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
|
||||||
}
|
|
||||||
else if (cp < 0x10000) { // three octets
|
|
||||||
*(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
|
|
||||||
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
|
|
||||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
|
||||||
}
|
|
||||||
else { // four octets
|
|
||||||
*(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
|
|
||||||
*(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f)| 0x80);
|
|
||||||
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
|
|
||||||
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t next(octet_iterator& it)
|
|
||||||
{
|
|
||||||
uint32_t cp = utf8::internal::mask8(*it);
|
|
||||||
typename std::iterator_traits<octet_iterator>::difference_type length = utf8::internal::sequence_length(it);
|
|
||||||
switch (length) {
|
|
||||||
case 1:
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
it++;
|
|
||||||
cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
++it;
|
|
||||||
cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff);
|
|
||||||
++it;
|
|
||||||
cp += (*it) & 0x3f;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
++it;
|
|
||||||
cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff);
|
|
||||||
++it;
|
|
||||||
cp += (utf8::internal::mask8(*it) << 6) & 0xfff;
|
|
||||||
++it;
|
|
||||||
cp += (*it) & 0x3f;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++it;
|
|
||||||
return cp;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t peek_next(octet_iterator it)
|
|
||||||
{
|
|
||||||
return utf8::unchecked::next(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
uint32_t prior(octet_iterator& it)
|
|
||||||
{
|
|
||||||
while (utf8::internal::is_trail(*(--it))) ;
|
|
||||||
octet_iterator temp = it;
|
|
||||||
return utf8::unchecked::next(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous)
|
|
||||||
template <typename octet_iterator>
|
|
||||||
inline uint32_t previous(octet_iterator& it)
|
|
||||||
{
|
|
||||||
return utf8::unchecked::prior(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename distance_type>
|
|
||||||
void advance (octet_iterator& it, distance_type n)
|
|
||||||
{
|
|
||||||
for (distance_type i = 0; i < n; ++i)
|
|
||||||
utf8::unchecked::next(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator>
|
|
||||||
typename std::iterator_traits<octet_iterator>::difference_type
|
|
||||||
distance (octet_iterator first, octet_iterator last)
|
|
||||||
{
|
|
||||||
typename std::iterator_traits<octet_iterator>::difference_type dist;
|
|
||||||
for (dist = 0; first < last; ++dist)
|
|
||||||
utf8::unchecked::next(first);
|
|
||||||
return dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16bit_iterator, typename octet_iterator>
|
|
||||||
octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result)
|
|
||||||
{
|
|
||||||
while (start != end) {
|
|
||||||
uint32_t cp = utf8::internal::mask16(*start++);
|
|
||||||
// Take care of surrogate pairs first
|
|
||||||
if (utf8::internal::is_lead_surrogate(cp)) {
|
|
||||||
uint32_t trail_surrogate = utf8::internal::mask16(*start++);
|
|
||||||
cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET;
|
|
||||||
}
|
|
||||||
result = utf8::unchecked::append(cp, result);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename u16bit_iterator, typename octet_iterator>
|
|
||||||
u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result)
|
|
||||||
{
|
|
||||||
while (start < end) {
|
|
||||||
uint32_t cp = utf8::unchecked::next(start);
|
|
||||||
if (cp > 0xffff) { //make a surrogate pair
|
|
||||||
*result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET);
|
|
||||||
*result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*result++ = static_cast<uint16_t>(cp);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename u32bit_iterator>
|
|
||||||
octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result)
|
|
||||||
{
|
|
||||||
while (start != end)
|
|
||||||
result = utf8::unchecked::append(*(start++), result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename octet_iterator, typename u32bit_iterator>
|
|
||||||
u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result)
|
|
||||||
{
|
|
||||||
while (start < end)
|
|
||||||
(*result++) = utf8::unchecked::next(start);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The iterator class
|
|
||||||
template <typename octet_iterator>
|
|
||||||
class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
|
|
||||||
octet_iterator it;
|
|
||||||
public:
|
|
||||||
iterator () {}
|
|
||||||
explicit iterator (const octet_iterator& octet_it): it(octet_it) {}
|
|
||||||
// the default "big three" are OK
|
|
||||||
octet_iterator base () const { return it; }
|
|
||||||
uint32_t operator * () const
|
|
||||||
{
|
|
||||||
octet_iterator temp = it;
|
|
||||||
return utf8::unchecked::next(temp);
|
|
||||||
}
|
|
||||||
bool operator == (const iterator& rhs) const
|
|
||||||
{
|
|
||||||
return (it == rhs.it);
|
|
||||||
}
|
|
||||||
bool operator != (const iterator& rhs) const
|
|
||||||
{
|
|
||||||
return !(operator == (rhs));
|
|
||||||
}
|
|
||||||
iterator& operator ++ ()
|
|
||||||
{
|
|
||||||
::std::advance(it, utf8::internal::sequence_length(it));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
iterator operator ++ (int)
|
|
||||||
{
|
|
||||||
iterator temp = *this;
|
|
||||||
::std::advance(it, utf8::internal::sequence_length(it));
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
iterator& operator -- ()
|
|
||||||
{
|
|
||||||
utf8::unchecked::prior(it);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
iterator operator -- (int)
|
|
||||||
{
|
|
||||||
iterator temp = *this;
|
|
||||||
utf8::unchecked::prior(it);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
}; // class iterator
|
|
||||||
|
|
||||||
} // namespace utf8::unchecked
|
|
||||||
} // namespace utf8
|
|
||||||
|
|
||||||
|
|
||||||
#endif // header guard
|
|
||||||
|
|
||||||
+138
-52
@@ -7,6 +7,18 @@ if(COMMAND cmake_policy)
|
|||||||
if(POLICY CMP0042)
|
if(POLICY CMP0042)
|
||||||
cmake_policy(SET CMP0042 NEW)
|
cmake_policy(SET CMP0042 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
if(POLICY CMP0067)
|
||||||
|
cmake_policy(SET CMP0067 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# OpenGL VND policy : use the old definition for now, until we can audit this
|
||||||
|
if(POLICY CMP0072)
|
||||||
|
cmake_policy(SET CMP0072 OLD)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(POLICY CMP0093)
|
||||||
|
cmake_policy(SET CMP0093 NEW)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -29,6 +41,7 @@ include (GenerateExportHeader)
|
|||||||
|
|
||||||
# only relevant for building shared libs but let's set it regardless
|
# only relevant for building shared libs but let's set it regardless
|
||||||
set(CMAKE_OSX_RPATH 1)
|
set(CMAKE_OSX_RPATH 1)
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
|
||||||
|
|
||||||
# let's use & require C++11 - note these are only functional with CMake 3.1
|
# let's use & require C++11 - note these are only functional with CMake 3.1
|
||||||
# we do manual fallbacks for CMake 3.0 in the compilers section
|
# we do manual fallbacks for CMake 3.0 in the compilers section
|
||||||
@@ -36,20 +49,15 @@ set(CMAKE_CXX_STANDARD 11)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||||
|
|
||||||
# read 'version' file into a variable (stripping any newlines or spaces)
|
# read 'version' file into a variable (stripping any newlines or spaces)
|
||||||
file(READ version versionFile)
|
file(READ simgear-version versionFile)
|
||||||
string(STRIP ${versionFile} SIMGEAR_VERSION)
|
string(STRIP ${versionFile} SIMGEAR_VERSION)
|
||||||
|
|
||||||
project(SimGear VERSION ${SIMGEAR_VERSION} LANGUAGES C CXX)
|
project(SimGear VERSION ${SIMGEAR_VERSION} LANGUAGES C CXX)
|
||||||
|
|
||||||
# using 10.7 because boost requires libc++ and 10.6 doesn't include it
|
# add a dependency on the version file
|
||||||
# Cmake documentation says we must set this before calling project(), but
|
|
||||||
# it only seems to be picked up setting it /after/ the call to project()
|
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7")
|
|
||||||
|
|
||||||
# add a dependency on the versino file
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS version)
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS version)
|
||||||
|
|
||||||
set(FIND_LIBRARY_USE_LIB64_PATHS ON)
|
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
|
||||||
|
|
||||||
# use simgear version also as the SO version (if building SOs)
|
# use simgear version also as the SO version (if building SOs)
|
||||||
SET(SIMGEAR_SOVERSION ${SIMGEAR_VERSION})
|
SET(SIMGEAR_SOVERSION ${SIMGEAR_VERSION})
|
||||||
@@ -123,20 +131,36 @@ option(ENABLE_RTI "Set to ON to build SimGear with RTI support" OFF)
|
|||||||
option(ENABLE_GDAL "Set to ON to build SimGear with GDAL support" OFF)
|
option(ENABLE_GDAL "Set to ON to build SimGear with GDAL support" OFF)
|
||||||
option(ENABLE_TESTS "Set to OFF to disable building SimGear's test applications" ON)
|
option(ENABLE_TESTS "Set to OFF to disable building SimGear's test applications" ON)
|
||||||
option(ENABLE_SOUND "Set to OFF to disable building SimGear's sound support" ON)
|
option(ENABLE_SOUND "Set to OFF to disable building SimGear's sound support" ON)
|
||||||
option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" OFF)
|
option(USE_AEONWAVE "Set to ON to use AeonWave instead of OpenAL" ON)
|
||||||
option(ENABLE_PKGUTIL "Set to ON to build the sg_pkgutil application (default)" ON)
|
option(ENABLE_PKGUTIL "Set to ON to build the sg_pkgutil application (default)" ON)
|
||||||
option(ENABLE_DNS "Set to ON to use udns library and DNS service resolver" ON)
|
option(ENABLE_DNS "Set to ON to use udns library and DNS service resolver" ON)
|
||||||
option(ENABLE_SIMD "Enable SSE/SSE2 support for x86 compilers" ON)
|
option(ENABLE_SIMD "Enable SSE/SSE2 support for compilers" ON)
|
||||||
|
option(ENABLE_SIMD_CODE "Enable SSE/SSE2 support code for compilers" OFF)
|
||||||
option(ENABLE_OPENMP "Enable OpenMP compiler support" OFF)
|
option(ENABLE_OPENMP "Enable OpenMP compiler support" OFF)
|
||||||
|
|
||||||
|
if (NOT ENABLE_SIMD AND ENABLE_SIMD_CODE)
|
||||||
|
set(ENABLE_SIMD_CODE OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
include (DetectArch)
|
include (DetectArch)
|
||||||
|
include (ExportDebugSymbols)
|
||||||
|
|
||||||
# until the fstream fix is applied and generally available in OSG,
|
# until the fstream fix is applied and generally available in OSG,
|
||||||
# keep the compatability link option as the default
|
# keep the compatability link option as the default
|
||||||
option(OSG_FSTREAM_EXPORT_FIXED "Set to ON if the osgDB fstream export patch is applied" OFF)
|
option(OSG_FSTREAM_EXPORT_FIXED "Set to ON if the osgDB fstream export patch is applied" OFF)
|
||||||
|
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCXX OR CLANG)
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.1)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++${CMAKE_CXX_STANDARD}")
|
||||||
|
elseif (CMAKE_VERSION VERSION_LESS 3.8)
|
||||||
|
# policy CMP0067 (try_compile does not honor CMAKE_CXX_STANDARD)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++${CMAKE_CXX_STANDARD}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_BINARY_DIR} PATH)
|
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_BINARY_DIR} DIRECTORY)
|
||||||
if (CMAKE_CL_64)
|
if (CMAKE_CL_64)
|
||||||
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty.x64")
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdparty.x64")
|
||||||
else (CMAKE_CL_64)
|
else (CMAKE_CL_64)
|
||||||
@@ -147,6 +171,11 @@ if (MSVC)
|
|||||||
else (EXISTS ${TEST_3RDPARTY_DIR})
|
else (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
endif (EXISTS ${TEST_3RDPARTY_DIR})
|
endif (EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
|
||||||
|
# override CMake default RelWithDebInfo flags. This is important to ensure
|
||||||
|
# good performance
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Zi /O2 /Ob2 /D NDEBUG")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Zi /O2 /Ob2 /D NDEBUG")
|
||||||
else (MSVC)
|
else (MSVC)
|
||||||
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
endif (MSVC)
|
endif (MSVC)
|
||||||
@@ -154,14 +183,24 @@ endif (MSVC)
|
|||||||
if (MSVC AND MSVC_3RDPARTY_ROOT)
|
if (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_ROOT}")
|
message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_ROOT}")
|
||||||
|
|
||||||
|
string(SUBSTRING ${MSVC_VERSION} 0 2 MSVC_VERSION_MAJOR)
|
||||||
|
string(SUBSTRING ${MSVC_VERSION} 2 2 MSVC_VERSION_MINOR)
|
||||||
|
|
||||||
set( OSG_MSVC "msvc" )
|
set( OSG_MSVC "msvc" )
|
||||||
if (${MSVC_VERSION} EQUAL 1900)
|
if (${MSVC_VERSION_MAJOR} EQUAL "19")
|
||||||
|
if (${MSVC_VERSION_MINOR} GREATER_EQUAL "20")
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}142 )
|
||||||
|
elseif (${MSVC_VERSION_MINOR} GREATER_EQUAL "10")
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}141 )
|
||||||
|
else ()
|
||||||
set( OSG_MSVC ${OSG_MSVC}140 )
|
set( OSG_MSVC ${OSG_MSVC}140 )
|
||||||
elseif (${MSVC_VERSION} EQUAL 1800)
|
endif ()
|
||||||
|
elseif (${MSVC_VERSION_MAJOR} EQUAL "18")
|
||||||
set( OSG_MSVC ${OSG_MSVC}120 )
|
set( OSG_MSVC ${OSG_MSVC}120 )
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "Visual Studio 2013/2015 is required now")
|
message(FATAL_ERROR "Visual Studio 2013 or higher is required")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (CMAKE_CL_64)
|
if (CMAKE_CL_64)
|
||||||
set( OSG_MSVC ${OSG_MSVC}-64 )
|
set( OSG_MSVC ${OSG_MSVC}-64 )
|
||||||
set( MSVC_3RDPARTY_DIR 3rdParty.x64 )
|
set( MSVC_3RDPARTY_DIR 3rdParty.x64 )
|
||||||
@@ -176,16 +215,13 @@ if (MSVC AND MSVC_3RDPARTY_ROOT)
|
|||||||
# if this variable was not set by the user, set it to 3rdparty root's
|
# if this variable was not set by the user, set it to 3rdparty root's
|
||||||
# parent dir, which is the normal location for people using our
|
# parent dir, which is the normal location for people using our
|
||||||
# windows-3rd-party repo
|
# windows-3rd-party repo
|
||||||
GET_FILENAME_COMPONENT(MSVC_ROOT_PARENT_DIR ${MSVC_3RDPARTY_ROOT} PATH)
|
get_filename_component(MSVC_ROOT_PARENT_DIR ${MSVC_3RDPARTY_ROOT} DIRECTORY)
|
||||||
set(BOOST_INCLUDEDIR ${MSVC_ROOT_PARENT_DIR})
|
set(BOOST_INCLUDEDIR ${MSVC_ROOT_PARENT_DIR})
|
||||||
message(STATUS "BOOST_INCLUDEDIR is ${BOOST_INCLUDEDIR}")
|
message(STATUS "BOOST_INCLUDEDIR is ${BOOST_INCLUDEDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT USE_AEONWAVE)
|
|
||||||
set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
||||||
set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib)
|
set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib)
|
||||||
message(STATUS "OPENAL_INCLUDE_DIR is ${OPENAL_INCLUDE_DIR}")
|
|
||||||
endif()
|
|
||||||
endif (MSVC AND MSVC_3RDPARTY_ROOT)
|
endif (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
@@ -197,7 +233,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
set (BOOST_CXX_FLAGS "-DBOOST_BIMAP_DISABLE_SERIALIZATION -DBOOST_NO_STDLIB_CONFIG")
|
||||||
include(BoostTestTargets)
|
include(BoostTestTargets)
|
||||||
|
|
||||||
if(SIMGEAR_HEADLESS)
|
if(SIMGEAR_HEADLESS)
|
||||||
@@ -209,12 +245,19 @@ else()
|
|||||||
|
|
||||||
if (ENABLE_SOUND)
|
if (ENABLE_SOUND)
|
||||||
if (USE_AEONWAVE)
|
if (USE_AEONWAVE)
|
||||||
find_package(AAX COMPONENTS aax REQUIRED)
|
find_package(AAX)
|
||||||
else()
|
endif()
|
||||||
|
|
||||||
|
if(NOT AAX_FOUND)
|
||||||
|
set(USE_AEONWAVE FALSE)
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Sound support: ENABLED")
|
if(AAX_FOUND)
|
||||||
|
message(STATUS "Sound support: AeonWave")
|
||||||
|
else()
|
||||||
|
message(STATUS "Sound support: OpenAL")
|
||||||
|
endif()
|
||||||
endif(ENABLE_SOUND)
|
endif(ENABLE_SOUND)
|
||||||
|
|
||||||
find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgSim osgDB osgParticle osgGA osgViewer osgUtil)
|
find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgSim osgDB osgParticle osgGA osgViewer osgUtil)
|
||||||
@@ -235,7 +278,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif(SIMGEAR_HEADLESS)
|
endif(SIMGEAR_HEADLESS)
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||||
|
# As of 2020-08-01, OpenBSD's system zlib is slightly old, but it's usable
|
||||||
|
# with a workaround in simgear/io/iostreams/gzfstream.cxx.
|
||||||
|
find_package(ZLIB 1.2.3 REQUIRED)
|
||||||
|
else()
|
||||||
find_package(ZLIB 1.2.4 REQUIRED)
|
find_package(ZLIB 1.2.4 REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(LibLZMA REQUIRED)
|
||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
|
|
||||||
if (SYSTEM_EXPAT)
|
if (SYSTEM_EXPAT)
|
||||||
@@ -245,9 +296,6 @@ if (SYSTEM_EXPAT)
|
|||||||
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "Using built-in expat code")
|
message(STATUS "Using built-in expat code")
|
||||||
# XML_STATIC is important to avoid sg_expat_external.h
|
|
||||||
# declaring symbols as declspec(import)
|
|
||||||
add_definitions(-DHAVE_EXPAT_CONFIG_H -DXML_STATIC)
|
|
||||||
set(EXPAT_INCLUDE_DIRS
|
set(EXPAT_INCLUDE_DIRS
|
||||||
${PROJECT_SOURCE_DIR}/3rdparty/expat
|
${PROJECT_SOURCE_DIR}/3rdparty/expat
|
||||||
${PROJECT_BINARY_DIR}/3rdparty/expat)
|
${PROJECT_BINARY_DIR}/3rdparty/expat)
|
||||||
@@ -264,9 +312,16 @@ if(HAVE_INTTYPES_H)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_RTI)
|
if(ENABLE_RTI)
|
||||||
# See if we have any rti library variant installed
|
find_package(PkgConfig)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
SET(ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
|
||||||
|
pkg_check_modules(RTI hla-rti13)
|
||||||
|
endif(PKG_CONFIG_FOUND)
|
||||||
|
if(RTI_FOUND)
|
||||||
message(STATUS "RTI: ENABLED")
|
message(STATUS "RTI: ENABLED")
|
||||||
find_package(RTI)
|
else()
|
||||||
|
message(STATUS "RTI: DISABLED")
|
||||||
|
endif(RTI_FOUND)
|
||||||
else()
|
else()
|
||||||
message(STATUS "RTI: DISABLED")
|
message(STATUS "RTI: DISABLED")
|
||||||
endif(ENABLE_RTI)
|
endif(ENABLE_RTI)
|
||||||
@@ -335,7 +390,7 @@ SET(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "add a postfix, usually empty on wi
|
|||||||
|
|
||||||
# isnan might not be real symbol, so can't check using function_exists
|
# isnan might not be real symbol, so can't check using function_exists
|
||||||
check_cxx_source_compiles(
|
check_cxx_source_compiles(
|
||||||
"#include <cstdlib>
|
"#include <cmath>
|
||||||
int main() { return std::isnan(0.0);} "
|
int main() { return std::isnan(0.0);} "
|
||||||
HAVE_STD_ISNAN)
|
HAVE_STD_ISNAN)
|
||||||
|
|
||||||
@@ -343,23 +398,41 @@ if (NOT ${HAVE_STD_ISNAN})
|
|||||||
message(FATAL_ERROR "Your compiler lacks C++11 std::isnan, please update it")
|
message(FATAL_ERROR "Your compiler lacks C++11 std::isnan, please update it")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Check if the <regex> implementation in the C++ standard library is usable.
|
||||||
|
# This is necessary because g++ 4.8 lies about its C++11 compliance: its
|
||||||
|
# <regex> is utterly unusable, cf. [1].
|
||||||
|
# The big preprocessor test essentially comes from [2], and gcc upstream devs
|
||||||
|
# appear to back it (see comments following [2], as well as [3]).
|
||||||
|
#
|
||||||
|
# [1] https://stackoverflow.com/a/12665408/4756009
|
||||||
|
# [2] https://stackoverflow.com/a/41186162/4756009
|
||||||
|
# [3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78905
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"#include <regex>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
#if __cplusplus >= 201103L && \
|
||||||
|
(!defined(__GLIBCXX__) || \
|
||||||
|
(__cplusplus >= 201402L) || \
|
||||||
|
defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \
|
||||||
|
defined(_GLIBCXX_REGEX_STATE_LIMIT) || \
|
||||||
|
(defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE > 4))
|
||||||
|
#else
|
||||||
|
nullptr = void; // intentionally trigger a compilation error
|
||||||
|
#endif
|
||||||
|
}"
|
||||||
|
HAVE_WORKING_STD_REGEX)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(WARNING_FLAGS_CXX "-Wall -fPIC")
|
set(WARNING_FLAGS_CXX "-Wall -fPIC")
|
||||||
set(WARNING_FLAGS_C "-Wall -fPIC")
|
set(WARNING_FLAGS_C "-Wall -fPIC")
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_LESS 3.1)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
|
||||||
message(WARNING "GCC 4.4 will be required soon, please upgrade")
|
message(WARNING "GCC 4.4 will be required soon, please upgrade")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_SIMD)
|
|
||||||
if (X86 OR X86_64)
|
if (X86 OR X86_64)
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -msse2 -mfpmath=sse")
|
set(SIMD_COMPILER_FLAGS "-msse2 -mfpmath=sse -ftree-vectorize -ftree-slp-vectorize")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -msse2 -mfpmath=sse")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# certain GCC versions don't provide the atomic builds, and hence
|
# certain GCC versions don't provide the atomic builds, and hence
|
||||||
@@ -368,6 +441,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
check_cxx_source_compiles(
|
check_cxx_source_compiles(
|
||||||
"int main() { unsigned mValue; return __sync_add_and_fetch(&mValue, 1); }"
|
"int main() { unsigned mValue; return __sync_add_and_fetch(&mValue, 1); }"
|
||||||
GCC_ATOMIC_BUILTINS_FOUND)
|
GCC_ATOMIC_BUILTINS_FOUND)
|
||||||
|
|
||||||
|
# override CMake default RelWithDebInfo flags.
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
if (CLANG)
|
if (CLANG)
|
||||||
@@ -378,16 +455,11 @@ if (CLANG)
|
|||||||
# fix Boost compilation :(
|
# fix Boost compilation :(
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
|
||||||
if (CMAKE_VERSION VERSION_LESS 3.1)
|
# override CMake default RelWithDebInfo flags.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
|
||||||
endif()
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
|
||||||
|
|
||||||
if(ENABLE_SIMD)
|
set(SIMD_COMPILER_FLAGS "-msse2 -mfpmath=sse -ftree-vectorize -ftree-slp-vectorize")
|
||||||
if (X86 OR X86_64)
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -msse2 -mfpmath=sse")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -msse2 -mfpmath=sse")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_OPENMP)
|
if (ENABLE_OPENMP)
|
||||||
@@ -419,14 +491,8 @@ if(WIN32)
|
|||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP")
|
set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP")
|
||||||
if(ENABLE_SIMD)
|
|
||||||
if (X86)
|
if (X86)
|
||||||
SET(CMAKE_C_FLAGS_RELEASE "/O2 /arch:SSE /arch:SSE2")
|
set(SIMD_COMPILER_FLAGS "/arch:SSE /arch:SSE2")
|
||||||
SET(CMAKE_CXX_FLAGS_RELEASE "/O2 /arch:SSE /arch:SSE2")
|
|
||||||
else()
|
|
||||||
SET(CMAKE_C_FLAGS_RELEASE "/O2")
|
|
||||||
SET(CMAKE_CXX_FLAGS_RELEASE "/O2")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT OSG_FSTREAM_EXPORT_FIXED)
|
if (NOT OSG_FSTREAM_EXPORT_FIXED)
|
||||||
@@ -450,14 +516,34 @@ if(WIN32)
|
|||||||
set( RT_LIBRARY "winmm" )
|
set( RT_LIBRARY "winmm" )
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
# append the SIMD flags if requested
|
||||||
|
if (ENABLE_SIMD)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SIMD_COMPILER_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SIMD_COMPILER_FLAGS}")
|
||||||
|
|
||||||
|
# set for multi-configuration generators
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${SIMD_COMPILER_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SIMD_COMPILER_FLAGS}")
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${SIMD_COMPILER_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SIMD_COMPILER_FLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
|
||||||
|
|
||||||
|
include(CheckCXXFeatures)
|
||||||
|
|
||||||
# use BEFORE to ensure local directories are used first,
|
# use BEFORE to ensure local directories are used first,
|
||||||
# ahead of system-installed libs
|
# ahead of system-installed libs
|
||||||
include_directories(BEFORE ${PROJECT_BINARY_DIR}/simgear)
|
include_directories(BEFORE ${PROJECT_BINARY_DIR}/simgear)
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||||
|
include_directories("/usr/X11R6/include")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions(-DHAVE_CONFIG_H)
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
# configure a header file to pass some of the CMake settings
|
# configure a header file to pass some of the CMake settings
|
||||||
|
|||||||
@@ -46,11 +46,17 @@ set(BOOST_TEST_TARGET_PREFIX "test")
|
|||||||
if(NOT Boost_FOUND)
|
if(NOT Boost_FOUND)
|
||||||
find_package(Boost 1.34.0 QUIET)
|
find_package(Boost 1.34.0 QUIET)
|
||||||
endif()
|
endif()
|
||||||
if("${Boost_VERSION}0" LESS "1034000")
|
|
||||||
|
if (NOT Boost_VERSION_MACRO)
|
||||||
|
# Compatibility with pre CMP0093 (CMake 3.15)
|
||||||
|
set(Boost_VERSION_MACRO ${Boost_VERSION})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if("${Boost_VERSION_MACRO}0" LESS "1034000")
|
||||||
set(_shared_msg
|
set(_shared_msg
|
||||||
"NOTE: boost::test-based targets and tests cannot "
|
"NOTE: boost::test-based targets and tests cannot "
|
||||||
"be added: boost >= 1.34.0 required but not found. "
|
"be added: boost >= 1.34.0 required but not found. "
|
||||||
"(found: '${Boost_VERSION}'; want >=103400) ")
|
"(found: '${Boost_VERSION_MACRO}'; want >=103400) ")
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
message(FATAL_ERROR
|
message(FATAL_ERROR
|
||||||
${_shared_msg}
|
${_shared_msg}
|
||||||
@@ -66,7 +72,7 @@ endif()
|
|||||||
include(GetForceIncludeDefinitions)
|
include(GetForceIncludeDefinitions)
|
||||||
include(CopyResourcesToBuildTree)
|
include(CopyResourcesToBuildTree)
|
||||||
|
|
||||||
if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
|
if(Boost_FOUND AND NOT "${Boost_VERSION_MACRO}0" LESS "1034000")
|
||||||
set(_boosttesttargets_libs)
|
set(_boosttesttargets_libs)
|
||||||
set(_boostConfig "BoostTestTargetsIncluded.h")
|
set(_boostConfig "BoostTestTargetsIncluded.h")
|
||||||
if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
|
if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
|
||||||
@@ -80,7 +86,7 @@ if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
|
|||||||
set(_boostConfig "BoostTestTargetsDynamic.h")
|
set(_boostConfig "BoostTestTargetsDynamic.h")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} DIRECTORY)
|
||||||
configure_file("${_moddir}/${_boostConfig}"
|
configure_file("${_moddir}/${_boostConfig}"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h"
|
||||||
COPYONLY)
|
COPYONLY)
|
||||||
@@ -129,7 +135,7 @@ function(add_boost_test _name)
|
|||||||
"Syntax error in use of add_boost_test: at least one source file required!")
|
"Syntax error in use of add_boost_test: at least one source file required!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
|
if(Boost_FOUND AND NOT "${Boost_VERSION_MACRO}0" LESS "1034000")
|
||||||
|
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
|
||||||
@@ -221,7 +227,7 @@ function(add_boost_test _name)
|
|||||||
set(_test_command ${_target_name})
|
set(_test_command ${_target_name})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TESTS AND ( "${Boost_VERSION}" VERSION_GREATER "103799" ))
|
if(TESTS AND ( "${Boost_VERSION_MACRO}" VERSION_GREATER "103799" ))
|
||||||
foreach(_test ${TESTS})
|
foreach(_test ${TESTS})
|
||||||
add_test(
|
add_test(
|
||||||
${_name}-${_test}
|
${_name}-${_test}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <utility>
|
||||||
|
#include <type_traits>
|
||||||
|
std::make_index_sequence<0> t;
|
||||||
|
int main() {}" HAVE_STD_INDEX_SEQUENCE
|
||||||
|
)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <type_traits>
|
||||||
|
std::remove_cv_t<const int> t;
|
||||||
|
int main() {}" HAVE_STD_REMOVE_CV_T
|
||||||
|
)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <type_traits>
|
||||||
|
std::remove_cvref_t<const int&> t;
|
||||||
|
int main() {}" HAVE_STD_REMOVE_CVREF_T
|
||||||
|
)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <type_traits>
|
||||||
|
std::enable_if_t<true, int> t;
|
||||||
|
int main() {}" HAVE_STD_ENABLE_IF_T
|
||||||
|
)
|
||||||
|
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <type_traits>
|
||||||
|
std::bool_constant<true> t;
|
||||||
|
int main() {}" HAVE_STD_BOOL_CONSTANT
|
||||||
|
)
|
||||||
@@ -30,12 +30,12 @@ function(copy_resources_to_build_tree _target)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_target_property(_path ${_target} LOCATION)
|
get_target_property(_path ${_target} LOCATION)
|
||||||
get_filename_component(_path "${_path}" PATH)
|
get_filename_component(_path "${_path}" DIRECTORY)
|
||||||
|
|
||||||
if(NOT MSVC AND NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles")
|
if(NOT MSVC AND NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles")
|
||||||
foreach(_config ${CMAKE_CONFIGURATION_TYPES})
|
foreach(_config ${CMAKE_CONFIGURATION_TYPES})
|
||||||
get_target_property(_path${_config} ${_target} LOCATION_${_config})
|
get_target_property(_path${_config} ${_target} LOCATION_${_config})
|
||||||
get_filename_component(_path${_config} "${_path${_config}}" PATH)
|
get_filename_component(_path${_config} "${_path${_config}}" DIRECTORY)
|
||||||
add_custom_command(TARGET ${_target}
|
add_custom_command(TARGET ${_target}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND
|
COMMAND
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# placehodler target for other ones to depend upon
|
||||||
|
add_custom_target(
|
||||||
|
debug_symbols
|
||||||
|
)
|
||||||
|
|
||||||
|
function(export_debug_symbols target)
|
||||||
|
|
||||||
|
if (NOT SIMGEAR_SHARED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
add_custom_target(${target}.dSYM
|
||||||
|
COMMENT "Generating dSYM files for ${target}"
|
||||||
|
COMMAND dsymutil --out=${target}.dSYM $<TARGET_FILE:${target}>
|
||||||
|
DEPENDS $<TARGET_FILE:${target}>
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM DESTINATION symbols OPTIONAL)
|
||||||
|
|
||||||
|
add_dependencies(debug_symbols ${target}.dSYM)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
+40
-14
@@ -1,21 +1,31 @@
|
|||||||
# Locate AAX
|
# Try to find AAX (AeonWave)
|
||||||
# This module defines
|
# This module defines
|
||||||
# AAX_LIBRARIES
|
#
|
||||||
# AAX_FOUND, if false, do not try to link to AAX
|
# AAX_FOUND - if false, do not try to link to AAX
|
||||||
# AAX_INCLUDE_DIR, where to find the headers
|
# AAX_INCLUDE_DIR - where to find the headers
|
||||||
|
# AAX_LIBRARIES - Link these to use AAX
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016-2018 by Erik Hofman.
|
||||||
|
# Copyright (C) 2016-2018 by Adalin B.V.
|
||||||
#
|
#
|
||||||
# $AAXDIR is an environment variable that would
|
# $AAXDIR is an environment variable that would
|
||||||
# correspond to the ./configure --prefix=$AAXDIR
|
# correspond to the ./configure --prefix=$AAXDIR
|
||||||
# used in building AAX.
|
# used in building AAX.
|
||||||
#
|
#
|
||||||
# Created by Erik Hofman.
|
# This file is Public Domain (www.unlicense.org)
|
||||||
|
# This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
FIND_PATH(AAX_INCLUDE_DIR aax/aeonwave.hpp
|
if (AAX_LIBRARY AND AAX_INCLUDE_DIR)
|
||||||
|
# in cache already
|
||||||
|
set(AAX_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
find_path(AAX_INCLUDE_DIR aax/aax.h
|
||||||
HINTS
|
HINTS
|
||||||
$ENV{AAXDIR}
|
$ENV{AAXDIR}
|
||||||
$ENV{ProgramFiles}/aax
|
$ENV{ProgramFiles}/aax
|
||||||
$ENV{ProgramFiles}/AeonWave
|
$ENV{ProgramFiles}/AeonWave
|
||||||
$ENV{ProgramFiles}/Adalin/AeonWave
|
$ENV{ProgramFiles}/Adalin/AeonWave
|
||||||
|
${CMAKE_SOURCE_DIR}/aax
|
||||||
PATH_SUFFIXES include
|
PATH_SUFFIXES include
|
||||||
PATHS
|
PATHS
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
@@ -25,24 +35,40 @@ FIND_PATH(AAX_INCLUDE_DIR aax/aeonwave.hpp
|
|||||||
/opt
|
/opt
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(AAX_LIBRARY
|
find_library(AAX_LIBRARY
|
||||||
NAMES AAX aax AAX32 libAAX32
|
NAMES AAX aax libAAX
|
||||||
HINTS
|
HINTS
|
||||||
$ENV{AAXDIR}
|
$ENV{AAXDIR}
|
||||||
$ENV{ProgramFiles}/AAX
|
$ENV{ProgramFiles}/AAX
|
||||||
$ENV{ProgramFiles}/AeonWave
|
$ENV{ProgramFiles}/AeonWave
|
||||||
$ENV{ProgramFiles}/Adalin/AeonWave
|
$ENV{ProgramFiles}/Adalin/AeonWave
|
||||||
PATH_SUFFIXES bin lib lib/${CMAKE_LIBRARY_ARCHITECTURE} lib64 libs64 libs libs/Win32 libs/Win64
|
${CMAKE_BUILD_DIR}/aax
|
||||||
|
PATH_SUFFIXES lib64 lib lib/${CMAKE_LIBRARY_ARCHITECTURE} libs64 libs libs/Win32 libs/Win64 bin
|
||||||
PATHS
|
PATHS
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
/usr
|
/usr
|
||||||
/opt
|
/opt
|
||||||
/usr/local
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(AAX_FOUND "NO")
|
set(AAX_DEFINITIONS "")
|
||||||
IF(AAX_LIBRARY AND AAX_INCLUDE_DIR)
|
if (AAX_LIBRARY AND AAX_INCLUDE_DIR)
|
||||||
SET(AAX_FOUND "YES")
|
set(AAX_FOUND TRUE)
|
||||||
ENDIF(AAX_LIBRARY AND AAX_INCLUDE_DIR)
|
endif()
|
||||||
|
|
||||||
|
if (AAX_FOUND)
|
||||||
|
if (NOT Udns_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found AeonWave: ${AAX_LIBRARIES}")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
if (Udns_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find AeonWave")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# show the AAX_INCLUDE_DIRS and AAX_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(AAX_INCLUDE_DIRS AAX_LIBRARIES)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
FindLibLZMA
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Find LZMA compression algorithm headers and library.
|
||||||
|
|
||||||
|
|
||||||
|
Imported Targets
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module defines :prop_tgt:`IMPORTED` target ``LibLZMA::LibLZMA``, if
|
||||||
|
liblzma has been found.
|
||||||
|
|
||||||
|
Result variables
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
This module will set the following variables in your project:
|
||||||
|
|
||||||
|
``LIBLZMA_FOUND``
|
||||||
|
True if liblzma headers and library were found.
|
||||||
|
``LIBLZMA_INCLUDE_DIRS``
|
||||||
|
Directory where liblzma headers are located.
|
||||||
|
``LIBLZMA_LIBRARIES``
|
||||||
|
Lzma libraries to link against.
|
||||||
|
``LIBLZMA_HAS_AUTO_DECODER``
|
||||||
|
True if lzma_auto_decoder() is found (required).
|
||||||
|
``LIBLZMA_HAS_EASY_ENCODER``
|
||||||
|
True if lzma_easy_encoder() is found (required).
|
||||||
|
``LIBLZMA_HAS_LZMA_PRESET``
|
||||||
|
True if lzma_lzma_preset() is found (required).
|
||||||
|
``LIBLZMA_VERSION_MAJOR``
|
||||||
|
The major version of lzma
|
||||||
|
``LIBLZMA_VERSION_MINOR``
|
||||||
|
The minor version of lzma
|
||||||
|
``LIBLZMA_VERSION_PATCH``
|
||||||
|
The patch version of lzma
|
||||||
|
``LIBLZMA_VERSION_STRING``
|
||||||
|
version number as a string (ex: "5.0.3")
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
|
||||||
|
if(NOT LIBLZMA_LIBRARY)
|
||||||
|
find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||||
|
find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
select_library_configurations(LIBLZMA)
|
||||||
|
else()
|
||||||
|
file(TO_CMAKE_PATH "${LIBLZMA_LIBRARY}" LIBLZMA_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h")
|
||||||
|
file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+")
|
||||||
|
|
||||||
|
string(REGEX REPLACE ".*#define LZMA_VERSION_MAJOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MAJOR "${LIBLZMA_HEADER_CONTENTS}")
|
||||||
|
string(REGEX REPLACE ".*#define LZMA_VERSION_MINOR ([0-9]+).*" "\\1" LIBLZMA_VERSION_MINOR "${LIBLZMA_HEADER_CONTENTS}")
|
||||||
|
string(REGEX REPLACE ".*#define LZMA_VERSION_PATCH ([0-9]+).*" "\\1" LIBLZMA_VERSION_PATCH "${LIBLZMA_HEADER_CONTENTS}")
|
||||||
|
|
||||||
|
set(LIBLZMA_VERSION_STRING "${LIBLZMA_VERSION_MAJOR}.${LIBLZMA_VERSION_MINOR}.${LIBLZMA_VERSION_PATCH}")
|
||||||
|
unset(LIBLZMA_HEADER_CONTENTS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# We're using new code known now as XZ, even library still been called LZMA
|
||||||
|
# it can be found in http://tukaani.org/xz/
|
||||||
|
# Avoid using old codebase
|
||||||
|
if (LIBLZMA_LIBRARY)
|
||||||
|
include(CheckLibraryExists)
|
||||||
|
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
||||||
|
set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY})
|
||||||
|
if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG)
|
||||||
|
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY})
|
||||||
|
elseif(LIBLZMA_LIBRARY_RELEASE)
|
||||||
|
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_RELEASE})
|
||||||
|
elseif(LIBLZMA_LIBRARY_DEBUG)
|
||||||
|
set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_DEBUG})
|
||||||
|
endif()
|
||||||
|
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
|
||||||
|
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
|
||||||
|
CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
|
||||||
|
unset(LIBLZMA_LIBRARY_check)
|
||||||
|
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(LibLZMA REQUIRED_VARS LIBLZMA_LIBRARY
|
||||||
|
LIBLZMA_INCLUDE_DIR
|
||||||
|
LIBLZMA_HAS_AUTO_DECODER
|
||||||
|
LIBLZMA_HAS_EASY_ENCODER
|
||||||
|
LIBLZMA_HAS_LZMA_PRESET
|
||||||
|
VERSION_VAR LIBLZMA_VERSION_STRING
|
||||||
|
)
|
||||||
|
mark_as_advanced( LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY )
|
||||||
|
|
||||||
|
if (LIBLZMA_FOUND)
|
||||||
|
set(LIBLZMA_LIBRARIES ${LIBLZMA_LIBRARY})
|
||||||
|
set(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_INCLUDE_DIR})
|
||||||
|
if(NOT TARGET LibLZMA::LibLZMA)
|
||||||
|
add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR}
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES C)
|
||||||
|
|
||||||
|
if(LIBLZMA_LIBRARY_RELEASE)
|
||||||
|
set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||||
|
IMPORTED_LOCATION_RELEASE "${LIBLZMA_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LIBLZMA_LIBRARY_DEBUG)
|
||||||
|
set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||||
|
IMPORTED_LOCATION_DEBUG "${LIBLZMA_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG)
|
||||||
|
set_target_properties(LibLZMA::LibLZMA PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${LIBLZMA_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
@@ -12,6 +12,11 @@ macro(simgear_component_common name includePath sourcesList sources headers)
|
|||||||
set_property(GLOBAL
|
set_property(GLOBAL
|
||||||
APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
||||||
set(fh${sourcesList} "${fh${sourcesList}}#${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
set(fh${sourcesList} "${fh${sourcesList}}#${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
||||||
|
|
||||||
|
# also append headers to the sources list, so that IDEs find the files
|
||||||
|
# correctly (otherwise they are not in the project)
|
||||||
|
set_property(GLOBAL
|
||||||
|
APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set_property(GLOBAL APPEND PROPERTY FG_GROUPS_${sourcesList}_C "${fc${sourcesList}}@")
|
set_property(GLOBAL APPEND PROPERTY FG_GROUPS_${sourcesList}_C "${fc${sourcesList}}@")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Doxyfile 1.8.6
|
# Doxyfile 1.8.13
|
||||||
|
|
||||||
# This file describes the settings to be used by the documentation system
|
# This file describes the settings to be used by the documentation system
|
||||||
# doxygen (www.doxygen.org) for a project.
|
# doxygen (www.doxygen.org) for a project.
|
||||||
@@ -38,7 +38,7 @@ PROJECT_NAME = SimGear
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 3.3.0
|
PROJECT_NUMBER = 2019.2.0
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
@@ -46,10 +46,10 @@ PROJECT_NUMBER = 3.3.0
|
|||||||
|
|
||||||
PROJECT_BRIEF =
|
PROJECT_BRIEF =
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
|
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
|
||||||
# the documentation. The maximum height of the logo should not exceed 55 pixels
|
# in the documentation. The maximum height of the logo should not exceed 55
|
||||||
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
|
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
|
||||||
# to the output directory.
|
# the logo to the output directory.
|
||||||
|
|
||||||
PROJECT_LOGO =
|
PROJECT_LOGO =
|
||||||
|
|
||||||
@@ -58,9 +58,9 @@ PROJECT_LOGO =
|
|||||||
# entered, it will be relative to the location where doxygen was started. If
|
# entered, it will be relative to the location where doxygen was started. If
|
||||||
# left blank the current directory will be used.
|
# left blank the current directory will be used.
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = ../doxy
|
OUTPUT_DIRECTORY = ../docs/SimGear
|
||||||
|
|
||||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
|
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
|
||||||
# directories (in 2 levels) under the output directory of each output format and
|
# directories (in 2 levels) under the output directory of each output format and
|
||||||
# will distribute the generated files over these directories. Enabling this
|
# will distribute the generated files over these directories. Enabling this
|
||||||
# option can be useful when feeding doxygen a huge amount of source files, where
|
# option can be useful when feeding doxygen a huge amount of source files, where
|
||||||
@@ -70,6 +70,14 @@ OUTPUT_DIRECTORY = ../doxy
|
|||||||
|
|
||||||
CREATE_SUBDIRS = NO
|
CREATE_SUBDIRS = NO
|
||||||
|
|
||||||
|
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
|
||||||
|
# characters to appear in the names of generated files. If set to NO, non-ASCII
|
||||||
|
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
|
||||||
|
# U+3044.
|
||||||
|
# The default value is: NO.
|
||||||
|
|
||||||
|
ALLOW_UNICODE_NAMES = NO
|
||||||
|
|
||||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||||
# documentation generated by doxygen is written. Doxygen will use this
|
# documentation generated by doxygen is written. Doxygen will use this
|
||||||
# information to generate all constant output in the proper language.
|
# information to generate all constant output in the proper language.
|
||||||
@@ -85,14 +93,14 @@ CREATE_SUBDIRS = NO
|
|||||||
|
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
|
|
||||||
# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
|
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
|
||||||
# descriptions after the members that are listed in the file and class
|
# descriptions after the members that are listed in the file and class
|
||||||
# documentation (similar to Javadoc). Set to NO to disable this.
|
# documentation (similar to Javadoc). Set to NO to disable this.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
BRIEF_MEMBER_DESC = YES
|
BRIEF_MEMBER_DESC = YES
|
||||||
|
|
||||||
# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
|
# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
|
||||||
# description of a member or function before the detailed description
|
# description of a member or function before the detailed description
|
||||||
#
|
#
|
||||||
# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
|
# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
|
||||||
@@ -127,7 +135,7 @@ ALWAYS_DETAILED_SEC = NO
|
|||||||
|
|
||||||
INLINE_INHERITED_MEMB = NO
|
INLINE_INHERITED_MEMB = NO
|
||||||
|
|
||||||
# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
|
# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
|
||||||
# before files name in the file list and in the header files. If set to NO the
|
# before files name in the file list and in the header files. If set to NO the
|
||||||
# shortest path that makes the file name unique will be used
|
# shortest path that makes the file name unique will be used
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -197,9 +205,9 @@ MULTILINE_CPP_IS_BRIEF = NO
|
|||||||
|
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = YES
|
||||||
|
|
||||||
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
|
# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
|
||||||
# new page for each member. If set to NO, the documentation of a member will be
|
# page for each member. If set to NO, the documentation of a member will be part
|
||||||
# part of the file/class/namespace that contains it.
|
# of the file/class/namespace that contains it.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
@@ -261,11 +269,14 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
|||||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
||||||
# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
|
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
|
||||||
# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
|
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
|
||||||
# (default is Fortran), use: inc=Fortran f=C.
|
# Fortran. In the later case the parser tries to guess whether the code is fixed
|
||||||
|
# or free formatted code, this is the default for Fortran type files), VHDL. For
|
||||||
|
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
|
||||||
|
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
|
||||||
#
|
#
|
||||||
# Note For files without extension you can use no_extension as a placeholder.
|
# Note: For files without extension you can use no_extension as a placeholder.
|
||||||
#
|
#
|
||||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||||
# the files are not read by doxygen.
|
# the files are not read by doxygen.
|
||||||
@@ -282,10 +293,19 @@ EXTENSION_MAPPING =
|
|||||||
|
|
||||||
MARKDOWN_SUPPORT = YES
|
MARKDOWN_SUPPORT = YES
|
||||||
|
|
||||||
|
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
|
||||||
|
# to that level are automatically included in the table of contents, even if
|
||||||
|
# they do not have an id attribute.
|
||||||
|
# Note: This feature currently applies only to Markdown headings.
|
||||||
|
# Minimum value: 0, maximum value: 99, default value: 0.
|
||||||
|
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
|
||||||
|
|
||||||
|
TOC_INCLUDE_HEADINGS = 0
|
||||||
|
|
||||||
# When enabled doxygen tries to link words that correspond to documented
|
# When enabled doxygen tries to link words that correspond to documented
|
||||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||||
# be prevented in individual cases by by putting a % sign in front of the word
|
# be prevented in individual cases by putting a % sign in front of the word or
|
||||||
# or globally by setting AUTOLINK_SUPPORT to NO.
|
# globally by setting AUTOLINK_SUPPORT to NO.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
AUTOLINK_SUPPORT = YES
|
AUTOLINK_SUPPORT = YES
|
||||||
@@ -325,13 +345,20 @@ SIP_SUPPORT = NO
|
|||||||
IDL_PROPERTY_SUPPORT = YES
|
IDL_PROPERTY_SUPPORT = YES
|
||||||
|
|
||||||
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
|
||||||
# tag is set to YES, then doxygen will reuse the documentation of the first
|
# tag is set to YES then doxygen will reuse the documentation of the first
|
||||||
# member in the group (if any) for the other members of the group. By default
|
# member in the group (if any) for the other members of the group. By default
|
||||||
# all members of a group must be documented explicitly.
|
# all members of a group must be documented explicitly.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
DISTRIBUTE_GROUP_DOC = NO
|
||||||
|
|
||||||
|
# If one adds a struct or class to a group and this option is enabled, then also
|
||||||
|
# any nested class or struct is added to the same group. By default this option
|
||||||
|
# is disabled and one has to add nested compounds explicitly via \ingroup.
|
||||||
|
# The default value is: NO.
|
||||||
|
|
||||||
|
GROUP_NESTED_COMPOUNDS = NO
|
||||||
|
|
||||||
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
|
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
|
||||||
# (for instance a group of public functions) to be put as a subgroup of that
|
# (for instance a group of public functions) to be put as a subgroup of that
|
||||||
# type (e.g. under the Public Functions section). Set it to NO to prevent
|
# type (e.g. under the Public Functions section). Set it to NO to prevent
|
||||||
@@ -390,7 +417,7 @@ LOOKUP_CACHE_SIZE = 0
|
|||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
|
||||||
# documentation are documented, even if no documentation was available. Private
|
# documentation are documented, even if no documentation was available. Private
|
||||||
# class members and static file members will be hidden unless the
|
# class members and static file members will be hidden unless the
|
||||||
# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
|
# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
|
||||||
@@ -398,37 +425,37 @@ LOOKUP_CACHE_SIZE = 0
|
|||||||
# normally produced when WARNINGS is set to YES.
|
# normally produced when WARNINGS is set to YES.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = YES
|
||||||
|
|
||||||
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
|
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
|
||||||
# be included in the documentation.
|
# be included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_PRIVATE = NO
|
EXTRACT_PRIVATE = NO
|
||||||
|
|
||||||
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
|
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
|
||||||
# scope will be included in the documentation.
|
# scope will be included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_PACKAGE = NO
|
EXTRACT_PACKAGE = NO
|
||||||
|
|
||||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
|
# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
|
||||||
# included in the documentation.
|
# included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
EXTRACT_STATIC = YES
|
EXTRACT_STATIC = YES
|
||||||
|
|
||||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
|
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
|
||||||
# locally in source files will be included in the documentation. If set to NO
|
# locally in source files will be included in the documentation. If set to NO,
|
||||||
# only classes defined in header files are included. Does not have any effect
|
# only classes defined in header files are included. Does not have any effect
|
||||||
# for Java sources.
|
# for Java sources.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
|
|
||||||
# This flag is only useful for Objective-C code. When set to YES local methods,
|
# This flag is only useful for Objective-C code. If set to YES, local methods,
|
||||||
# which are defined in the implementation section but not in the interface are
|
# which are defined in the implementation section but not in the interface are
|
||||||
# included in the documentation. If set to NO only methods in the interface are
|
# included in the documentation. If set to NO, only methods in the interface are
|
||||||
# included.
|
# included.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
@@ -453,21 +480,21 @@ HIDE_UNDOC_MEMBERS = YES
|
|||||||
|
|
||||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
|
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
|
||||||
# undocumented classes that are normally visible in the class hierarchy. If set
|
# undocumented classes that are normally visible in the class hierarchy. If set
|
||||||
# to NO these classes will be included in the various overviews. This option has
|
# to NO, these classes will be included in the various overviews. This option
|
||||||
# no effect if EXTRACT_ALL is enabled.
|
# has no effect if EXTRACT_ALL is enabled.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HIDE_UNDOC_CLASSES = YES
|
HIDE_UNDOC_CLASSES = YES
|
||||||
|
|
||||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
|
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
|
||||||
# (class|struct|union) declarations. If set to NO these declarations will be
|
# (class|struct|union) declarations. If set to NO, these declarations will be
|
||||||
# included in the documentation.
|
# included in the documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HIDE_FRIEND_COMPOUNDS = NO
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
|
|
||||||
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
|
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
|
||||||
# documentation blocks found inside the body of a function. If set to NO these
|
# documentation blocks found inside the body of a function. If set to NO, these
|
||||||
# blocks will be appended to the function's detailed documentation block.
|
# blocks will be appended to the function's detailed documentation block.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
@@ -481,7 +508,7 @@ HIDE_IN_BODY_DOCS = NO
|
|||||||
INTERNAL_DOCS = NO
|
INTERNAL_DOCS = NO
|
||||||
|
|
||||||
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
||||||
# names in lower-case letters. If set to YES upper-case letters are also
|
# names in lower-case letters. If set to YES, upper-case letters are also
|
||||||
# allowed. This is useful if you have classes or files whose names only differ
|
# allowed. This is useful if you have classes or files whose names only differ
|
||||||
# in case and if your file system supports case sensitive file names. Windows
|
# in case and if your file system supports case sensitive file names. Windows
|
||||||
# and Mac users are advised to set this option to NO.
|
# and Mac users are advised to set this option to NO.
|
||||||
@@ -490,12 +517,19 @@ INTERNAL_DOCS = NO
|
|||||||
CASE_SENSE_NAMES = YES
|
CASE_SENSE_NAMES = YES
|
||||||
|
|
||||||
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
|
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
|
||||||
# their full class and namespace scopes in the documentation. If set to YES the
|
# their full class and namespace scopes in the documentation. If set to YES, the
|
||||||
# scope will be hidden.
|
# scope will be hidden.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
HIDE_SCOPE_NAMES = NO
|
HIDE_SCOPE_NAMES = NO
|
||||||
|
|
||||||
|
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
|
||||||
|
# append additional text to a page's title, such as Class Reference. If set to
|
||||||
|
# YES the compound reference will be hidden.
|
||||||
|
# The default value is: NO.
|
||||||
|
|
||||||
|
HIDE_COMPOUND_REFERENCE= NO
|
||||||
|
|
||||||
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
|
||||||
# the files that are included by a file in the documentation of that file.
|
# the files that are included by a file in the documentation of that file.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -523,14 +557,14 @@ INLINE_INFO = YES
|
|||||||
|
|
||||||
# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
|
# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
|
||||||
# (detailed) documentation of file and class members alphabetically by member
|
# (detailed) documentation of file and class members alphabetically by member
|
||||||
# name. If set to NO the members will appear in declaration order.
|
# name. If set to NO, the members will appear in declaration order.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
SORT_MEMBER_DOCS = YES
|
SORT_MEMBER_DOCS = YES
|
||||||
|
|
||||||
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
|
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
|
||||||
# descriptions of file, namespace and class members alphabetically by member
|
# descriptions of file, namespace and class members alphabetically by member
|
||||||
# name. If set to NO the members will appear in declaration order. Note that
|
# name. If set to NO, the members will appear in declaration order. Note that
|
||||||
# this will also influence the order of the classes in the class list.
|
# this will also influence the order of the classes in the class list.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
@@ -575,16 +609,14 @@ SORT_BY_SCOPE_NAME = NO
|
|||||||
|
|
||||||
STRICT_PROTO_MATCHING = NO
|
STRICT_PROTO_MATCHING = NO
|
||||||
|
|
||||||
# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
|
# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
|
||||||
# todo list. This list is created by putting \todo commands in the
|
# list. This list is created by putting \todo commands in the documentation.
|
||||||
# documentation.
|
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
GENERATE_TODOLIST = YES
|
GENERATE_TODOLIST = YES
|
||||||
|
|
||||||
# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
|
# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
|
||||||
# test list. This list is created by putting \test commands in the
|
# list. This list is created by putting \test commands in the documentation.
|
||||||
# documentation.
|
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
GENERATE_TESTLIST = YES
|
GENERATE_TESTLIST = YES
|
||||||
@@ -620,8 +652,8 @@ ENABLED_SECTIONS =
|
|||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
|
|
||||||
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
|
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
|
||||||
# the bottom of the documentation of classes and structs. If set to YES the list
|
# the bottom of the documentation of classes and structs. If set to YES, the
|
||||||
# will mention the files that were used to generate the documentation.
|
# list will mention the files that were used to generate the documentation.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
@@ -669,8 +701,7 @@ LAYOUT_FILE =
|
|||||||
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
|
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||||
# For LaTeX the style of the bibliography can be controlled using
|
# For LaTeX the style of the bibliography can be controlled using
|
||||||
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
|
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
|
||||||
# search path. Do not use file names with spaces, bibtex cannot handle them. See
|
# search path. See also \cite for info how to create references.
|
||||||
# also \cite for info how to create references.
|
|
||||||
|
|
||||||
CITE_BIB_FILES =
|
CITE_BIB_FILES =
|
||||||
|
|
||||||
@@ -694,7 +725,7 @@ QUIET = NO
|
|||||||
|
|
||||||
WARNINGS = YES
|
WARNINGS = YES
|
||||||
|
|
||||||
# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
|
# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
|
||||||
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
|
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
|
||||||
# will automatically be disabled.
|
# will automatically be disabled.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -711,12 +742,18 @@ WARN_IF_DOC_ERROR = YES
|
|||||||
|
|
||||||
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
|
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
|
||||||
# are documented, but have no documentation for their parameters or return
|
# are documented, but have no documentation for their parameters or return
|
||||||
# value. If set to NO doxygen will only warn about wrong or incomplete parameter
|
# value. If set to NO, doxygen will only warn about wrong or incomplete
|
||||||
# documentation, but not about the absence of documentation.
|
# parameter documentation, but not about the absence of documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
WARN_NO_PARAMDOC = NO
|
WARN_NO_PARAMDOC = NO
|
||||||
|
|
||||||
|
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||||
|
# a warning is encountered.
|
||||||
|
# The default value is: NO.
|
||||||
|
|
||||||
|
WARN_AS_ERROR = NO
|
||||||
|
|
||||||
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
|
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
|
||||||
# can produce. The string should contain the $file, $line, and $text tags, which
|
# can produce. The string should contain the $file, $line, and $text tags, which
|
||||||
# will be replaced by the file and line number from which the warning originated
|
# will be replaced by the file and line number from which the warning originated
|
||||||
@@ -740,7 +777,7 @@ WARN_LOGFILE =
|
|||||||
# The INPUT tag is used to specify the files and/or directories that contain
|
# The INPUT tag is used to specify the files and/or directories that contain
|
||||||
# documented source files. You may enter file names like myfile.cpp or
|
# documented source files. You may enter file names like myfile.cpp or
|
||||||
# directories like /usr/src/myproject. Separate the files or directories with
|
# directories like /usr/src/myproject. Separate the files or directories with
|
||||||
# spaces.
|
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
|
||||||
# Note: If this tag is empty the current directory is searched.
|
# Note: If this tag is empty the current directory is searched.
|
||||||
|
|
||||||
INPUT = DoxygenMain.cxx \
|
INPUT = DoxygenMain.cxx \
|
||||||
@@ -757,12 +794,17 @@ INPUT_ENCODING = UTF-8
|
|||||||
|
|
||||||
# If the value of the INPUT tag contains directories, you can use the
|
# If the value of the INPUT tag contains directories, you can use the
|
||||||
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
|
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
|
||||||
# *.h) to filter out the source-files in the directories. If left blank the
|
# *.h) to filter out the source-files in the directories.
|
||||||
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
|
#
|
||||||
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
|
# Note that for custom extensions or not directly supported extensions you also
|
||||||
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
|
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||||
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
|
# read by doxygen.
|
||||||
# *.qsf, *.as and *.js.
|
#
|
||||||
|
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||||
|
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||||
|
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
||||||
|
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
|
||||||
|
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
|
||||||
|
|
||||||
FILE_PATTERNS = *.h \
|
FILE_PATTERNS = *.h \
|
||||||
*.hxx \
|
*.hxx \
|
||||||
@@ -852,6 +894,10 @@ IMAGE_PATH =
|
|||||||
# Note that the filter must not add or remove lines; it is applied before the
|
# Note that the filter must not add or remove lines; it is applied before the
|
||||||
# code is scanned, but not when the output code is generated. If lines are added
|
# code is scanned, but not when the output code is generated. If lines are added
|
||||||
# or removed, the anchors will not be placed correctly.
|
# or removed, the anchors will not be placed correctly.
|
||||||
|
#
|
||||||
|
# Note that for custom extensions or not directly supported extensions you also
|
||||||
|
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||||
|
# properly processed by doxygen.
|
||||||
|
|
||||||
INPUT_FILTER =
|
INPUT_FILTER =
|
||||||
|
|
||||||
@@ -861,6 +907,10 @@ INPUT_FILTER =
|
|||||||
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
|
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
|
||||||
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
|
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
|
||||||
# patterns match the file name, INPUT_FILTER is applied.
|
# patterns match the file name, INPUT_FILTER is applied.
|
||||||
|
#
|
||||||
|
# Note that for custom extensions or not directly supported extensions you also
|
||||||
|
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||||
|
# properly processed by doxygen.
|
||||||
|
|
||||||
FILTER_PATTERNS =
|
FILTER_PATTERNS =
|
||||||
|
|
||||||
@@ -925,7 +975,7 @@ REFERENCED_BY_RELATION = NO
|
|||||||
REFERENCES_RELATION = NO
|
REFERENCES_RELATION = NO
|
||||||
|
|
||||||
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
|
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
|
||||||
# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
|
# to YES then the hyperlinks from functions in REFERENCES_RELATION and
|
||||||
# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
|
# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
|
||||||
# link to the documentation.
|
# link to the documentation.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -972,6 +1022,25 @@ USE_HTAGS = NO
|
|||||||
|
|
||||||
VERBATIM_HEADERS = YES
|
VERBATIM_HEADERS = YES
|
||||||
|
|
||||||
|
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
|
||||||
|
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
|
||||||
|
# cost of reduced performance. This can be particularly helpful with template
|
||||||
|
# rich C++ code for which doxygen's built-in parser lacks the necessary type
|
||||||
|
# information.
|
||||||
|
# Note: The availability of this option depends on whether or not doxygen was
|
||||||
|
# generated with the -Duse-libclang=ON option for CMake.
|
||||||
|
# The default value is: NO.
|
||||||
|
|
||||||
|
CLANG_ASSISTED_PARSING = NO
|
||||||
|
|
||||||
|
# If clang assisted parsing is enabled you can provide the compiler with command
|
||||||
|
# line options that you would normally use when invoking the compiler. Note that
|
||||||
|
# the include paths will already be set by doxygen for the files and directories
|
||||||
|
# specified with INPUT and INCLUDE_PATH.
|
||||||
|
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
|
||||||
|
|
||||||
|
CLANG_OPTIONS =
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the alphabetical class index
|
# Configuration options related to the alphabetical class index
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -1002,7 +1071,7 @@ IGNORE_PREFIX =
|
|||||||
# Configuration options related to the HTML output
|
# Configuration options related to the HTML output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
|
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
GENERATE_HTML = YES
|
GENERATE_HTML = YES
|
||||||
@@ -1064,13 +1133,15 @@ HTML_FOOTER =
|
|||||||
|
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
|
||||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
|
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||||
# defined cascading style sheet that is included after the standard style sheets
|
# cascading style sheets that are included after the standard style sheets
|
||||||
# created by doxygen. Using this option one can overrule certain style aspects.
|
# created by doxygen. Using this option one can overrule certain style aspects.
|
||||||
# This is preferred over using HTML_STYLESHEET since it does not replace the
|
# This is preferred over using HTML_STYLESHEET since it does not replace the
|
||||||
# standard style sheet and is therefor more robust against future updates.
|
# standard style sheet and is therefore more robust against future updates.
|
||||||
# Doxygen will copy the style sheet file to the output directory. For an example
|
# Doxygen will copy the style sheet files to the output directory.
|
||||||
# see the documentation.
|
# Note: The order of the extra style sheet files is of importance (e.g. the last
|
||||||
|
# style sheet in the list overrules the setting of the previous ones in the
|
||||||
|
# list). For an example see the documentation.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_EXTRA_STYLESHEET =
|
HTML_EXTRA_STYLESHEET =
|
||||||
@@ -1117,8 +1188,9 @@ HTML_COLORSTYLE_GAMMA = 80
|
|||||||
|
|
||||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||||
# page will contain the date and time when the page was generated. Setting this
|
# page will contain the date and time when the page was generated. Setting this
|
||||||
# to NO can help when comparing the output of multiple runs.
|
# to YES can help to show when doxygen was last run and thus if the
|
||||||
# The default value is: YES.
|
# documentation is up to date.
|
||||||
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
|
|
||||||
HTML_TIMESTAMP = YES
|
HTML_TIMESTAMP = YES
|
||||||
@@ -1214,15 +1286,15 @@ GENERATE_HTMLHELP = NO
|
|||||||
CHM_FILE =
|
CHM_FILE =
|
||||||
|
|
||||||
# The HHC_LOCATION tag can be used to specify the location (absolute path
|
# The HHC_LOCATION tag can be used to specify the location (absolute path
|
||||||
# including file name) of the HTML help compiler ( hhc.exe). If non-empty
|
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
|
||||||
# doxygen will try to run the HTML help compiler on the generated index.hhp.
|
# doxygen will try to run the HTML help compiler on the generated index.hhp.
|
||||||
# The file has to be specified with full path.
|
# The file has to be specified with full path.
|
||||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||||
|
|
||||||
HHC_LOCATION =
|
HHC_LOCATION =
|
||||||
|
|
||||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated (
|
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||||
# YES) or that it should be included in the master .chm file ( NO).
|
# (YES) or that it should be included in the master .chm file (NO).
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||||
|
|
||||||
@@ -1234,8 +1306,9 @@ GENERATE_CHI = NO
|
|||||||
|
|
||||||
CHM_INDEX_ENCODING =
|
CHM_INDEX_ENCODING =
|
||||||
|
|
||||||
# The BINARY_TOC flag controls whether a binary table of contents is generated (
|
# The BINARY_TOC flag controls whether a binary table of contents is generated
|
||||||
# YES) or a normal table of contents ( NO) in the .chm file.
|
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
|
||||||
|
# enables the Previous and Next buttons.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||||
|
|
||||||
@@ -1376,7 +1449,7 @@ ENUM_VALUES_PER_LINE = 4
|
|||||||
|
|
||||||
TREEVIEW_WIDTH = 250
|
TREEVIEW_WIDTH = 250
|
||||||
|
|
||||||
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
|
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
|
||||||
# external symbols imported via tag files in a separate window.
|
# external symbols imported via tag files in a separate window.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||||
@@ -1405,7 +1478,7 @@ FORMULA_TRANSPARENT = YES
|
|||||||
|
|
||||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
||||||
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
|
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
|
||||||
# installed or if you want to formulas look prettier in the HTML output. When
|
# installed or if you want to formulas look prettier in the HTML output. When
|
||||||
# enabled you may also need to install MathJax separately and configure the path
|
# enabled you may also need to install MathJax separately and configure the path
|
||||||
# to it using the MATHJAX_RELPATH option.
|
# to it using the MATHJAX_RELPATH option.
|
||||||
@@ -1475,11 +1548,11 @@ SEARCHENGINE = NO
|
|||||||
|
|
||||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||||
# implemented using a web server instead of a web client using Javascript. There
|
# implemented using a web server instead of a web client using Javascript. There
|
||||||
# are two flavours of web server based searching depending on the
|
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
|
||||||
# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
|
# setting. When disabled, doxygen will generate a PHP script for searching and
|
||||||
# searching and an index file used by the script. When EXTERNAL_SEARCH is
|
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
|
||||||
# enabled the indexing and searching needs to be provided by external tools. See
|
# and searching needs to be provided by external tools. See the section
|
||||||
# the section "External Indexing and Searching" for details.
|
# "External Indexing and Searching" for details.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||||
|
|
||||||
@@ -1542,7 +1615,7 @@ EXTRA_SEARCH_MAPPINGS =
|
|||||||
# Configuration options related to the LaTeX output
|
# Configuration options related to the LaTeX output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
|
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
GENERATE_LATEX = NO
|
GENERATE_LATEX = NO
|
||||||
@@ -1573,7 +1646,7 @@ LATEX_CMD_NAME = latex
|
|||||||
|
|
||||||
MAKEINDEX_CMD_NAME = makeindex
|
MAKEINDEX_CMD_NAME = makeindex
|
||||||
|
|
||||||
# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
|
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
|
||||||
# documents. This may be useful for small projects and may help to save some
|
# documents. This may be useful for small projects and may help to save some
|
||||||
# trees in general.
|
# trees in general.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -1591,9 +1664,12 @@ COMPACT_LATEX = NO
|
|||||||
PAPER_TYPE = letter
|
PAPER_TYPE = letter
|
||||||
|
|
||||||
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
|
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
|
||||||
# that should be included in the LaTeX output. To get the times font for
|
# that should be included in the LaTeX output. The package can be specified just
|
||||||
# instance you can specify
|
# by its name or with the correct syntax as to be used with the LaTeX
|
||||||
# EXTRA_PACKAGES=times
|
# \usepackage command. To get the times font for instance you can specify :
|
||||||
|
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
|
||||||
|
# To use the option intlimits with the amsmath package you can specify:
|
||||||
|
# EXTRA_PACKAGES=[intlimits]{amsmath}
|
||||||
# If left blank no extra packages will be included.
|
# If left blank no extra packages will be included.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
@@ -1607,23 +1683,36 @@ EXTRA_PACKAGES =
|
|||||||
#
|
#
|
||||||
# Note: Only use a user-defined header if you know what you are doing! The
|
# Note: Only use a user-defined header if you know what you are doing! The
|
||||||
# following commands have a special meaning inside the header: $title,
|
# following commands have a special meaning inside the header: $title,
|
||||||
# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
|
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
|
||||||
# replace them by respectively the title of the page, the current date and time,
|
# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
|
||||||
# only the current date, the version number of doxygen, the project name (see
|
# string, for the replacement values of the other commands the user is referred
|
||||||
# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
|
# to HTML_HEADER.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
LATEX_HEADER =
|
LATEX_HEADER =
|
||||||
|
|
||||||
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
|
||||||
# generated LaTeX document. The footer should contain everything after the last
|
# generated LaTeX document. The footer should contain everything after the last
|
||||||
# chapter. If it is left blank doxygen will generate a standard footer.
|
# chapter. If it is left blank doxygen will generate a standard footer. See
|
||||||
|
# LATEX_HEADER for more information on how to generate a default footer and what
|
||||||
|
# special commands can be used inside the footer.
|
||||||
#
|
#
|
||||||
# Note: Only use a user-defined footer if you know what you are doing!
|
# Note: Only use a user-defined footer if you know what you are doing!
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
LATEX_FOOTER =
|
LATEX_FOOTER =
|
||||||
|
|
||||||
|
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
|
||||||
|
# LaTeX style sheets that are included after the standard style sheets created
|
||||||
|
# by doxygen. Using this option one can overrule certain style aspects. Doxygen
|
||||||
|
# will copy the style sheet files to the output directory.
|
||||||
|
# Note: The order of the extra style sheet files is of importance (e.g. the last
|
||||||
|
# style sheet in the list overrules the setting of the previous ones in the
|
||||||
|
# list).
|
||||||
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
|
LATEX_EXTRA_STYLESHEET =
|
||||||
|
|
||||||
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
|
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||||
# other source files which should be copied to the LATEX_OUTPUT output
|
# other source files which should be copied to the LATEX_OUTPUT output
|
||||||
# directory. Note that the files will be copied as-is; there are no commands or
|
# directory. Note that the files will be copied as-is; there are no commands or
|
||||||
@@ -1641,8 +1730,8 @@ LATEX_EXTRA_FILES =
|
|||||||
|
|
||||||
PDF_HYPERLINKS = NO
|
PDF_HYPERLINKS = NO
|
||||||
|
|
||||||
# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
||||||
# the PDF file directly from the LaTeX files. Set this option to YES to get a
|
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
|
||||||
# higher quality PDF documentation.
|
# higher quality PDF documentation.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
@@ -1683,11 +1772,19 @@ LATEX_SOURCE_CODE = NO
|
|||||||
|
|
||||||
LATEX_BIB_STYLE = plain
|
LATEX_BIB_STYLE = plain
|
||||||
|
|
||||||
|
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
|
||||||
|
# page will contain the date and time when the page was generated. Setting this
|
||||||
|
# to NO can help when comparing the output of multiple runs.
|
||||||
|
# The default value is: NO.
|
||||||
|
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||||
|
|
||||||
|
LATEX_TIMESTAMP = NO
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the RTF output
|
# Configuration options related to the RTF output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
|
# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
|
||||||
# RTF output is optimized for Word 97 and may not look too pretty with other RTF
|
# RTF output is optimized for Word 97 and may not look too pretty with other RTF
|
||||||
# readers/editors.
|
# readers/editors.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -1702,7 +1799,7 @@ GENERATE_RTF = YES
|
|||||||
|
|
||||||
RTF_OUTPUT = rtf
|
RTF_OUTPUT = rtf
|
||||||
|
|
||||||
# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
|
# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
|
||||||
# documents. This may be useful for small projects and may help to save some
|
# documents. This may be useful for small projects and may help to save some
|
||||||
# trees in general.
|
# trees in general.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -1739,11 +1836,21 @@ RTF_STYLESHEET_FILE =
|
|||||||
|
|
||||||
RTF_EXTENSIONS_FILE =
|
RTF_EXTENSIONS_FILE =
|
||||||
|
|
||||||
|
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
|
||||||
|
# with syntax highlighting in the RTF output.
|
||||||
|
#
|
||||||
|
# Note that which sources are shown also depends on other settings such as
|
||||||
|
# SOURCE_BROWSER.
|
||||||
|
# The default value is: NO.
|
||||||
|
# This tag requires that the tag GENERATE_RTF is set to YES.
|
||||||
|
|
||||||
|
RTF_SOURCE_CODE = NO
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the man page output
|
# Configuration options related to the man page output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
|
# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
|
||||||
# classes and files.
|
# classes and files.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
@@ -1767,6 +1874,13 @@ MAN_OUTPUT = man
|
|||||||
|
|
||||||
MAN_EXTENSION = .3
|
MAN_EXTENSION = .3
|
||||||
|
|
||||||
|
# The MAN_SUBDIR tag determines the name of the directory created within
|
||||||
|
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
|
||||||
|
# MAN_EXTENSION with the initial . removed.
|
||||||
|
# This tag requires that the tag GENERATE_MAN is set to YES.
|
||||||
|
|
||||||
|
MAN_SUBDIR =
|
||||||
|
|
||||||
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
|
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
|
||||||
# will generate one additional man file for each entity documented in the real
|
# will generate one additional man file for each entity documented in the real
|
||||||
# man page(s). These additional files only source the real man page, but without
|
# man page(s). These additional files only source the real man page, but without
|
||||||
@@ -1780,7 +1894,7 @@ MAN_LINKS = NO
|
|||||||
# Configuration options related to the XML output
|
# Configuration options related to the XML output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
|
# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
|
||||||
# captures the structure of the code including all documentation.
|
# captures the structure of the code including all documentation.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
@@ -1794,19 +1908,7 @@ GENERATE_XML = NO
|
|||||||
|
|
||||||
XML_OUTPUT = xml
|
XML_OUTPUT = xml
|
||||||
|
|
||||||
# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
|
# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
|
||||||
# validating XML parser to check the syntax of the XML files.
|
|
||||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
|
||||||
|
|
||||||
XML_SCHEMA =
|
|
||||||
|
|
||||||
# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
|
|
||||||
# validating XML parser to check the syntax of the XML files.
|
|
||||||
# This tag requires that the tag GENERATE_XML is set to YES.
|
|
||||||
|
|
||||||
XML_DTD =
|
|
||||||
|
|
||||||
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
|
|
||||||
# listings (including syntax highlighting and cross-referencing information) to
|
# listings (including syntax highlighting and cross-referencing information) to
|
||||||
# the XML output. Note that enabling this will significantly increase the size
|
# the XML output. Note that enabling this will significantly increase the size
|
||||||
# of the XML output.
|
# of the XML output.
|
||||||
@@ -1819,7 +1921,7 @@ XML_PROGRAMLISTING = YES
|
|||||||
# Configuration options related to the DOCBOOK output
|
# Configuration options related to the DOCBOOK output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
|
# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
|
||||||
# that can be used to generate PDF.
|
# that can be used to generate PDF.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
@@ -1833,14 +1935,23 @@ GENERATE_DOCBOOK = NO
|
|||||||
|
|
||||||
DOCBOOK_OUTPUT = docbook
|
DOCBOOK_OUTPUT = docbook
|
||||||
|
|
||||||
|
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
|
||||||
|
# program listings (including syntax highlighting and cross-referencing
|
||||||
|
# information) to the DOCBOOK output. Note that enabling this will significantly
|
||||||
|
# increase the size of the DOCBOOK output.
|
||||||
|
# The default value is: NO.
|
||||||
|
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
|
||||||
|
|
||||||
|
DOCBOOK_PROGRAMLISTING = NO
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options for the AutoGen Definitions output
|
# Configuration options for the AutoGen Definitions output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
|
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
|
||||||
# Definitions (see http://autogen.sf.net) file that captures the structure of
|
# AutoGen Definitions (see http://autogen.sf.net) file that captures the
|
||||||
# the code including all documentation. Note that this feature is still
|
# structure of the code including all documentation. Note that this feature is
|
||||||
# experimental and incomplete at the moment.
|
# still experimental and incomplete at the moment.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
GENERATE_AUTOGEN_DEF = NO
|
GENERATE_AUTOGEN_DEF = NO
|
||||||
@@ -1849,7 +1960,7 @@ GENERATE_AUTOGEN_DEF = NO
|
|||||||
# Configuration options related to the Perl module output
|
# Configuration options related to the Perl module output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
|
# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
|
||||||
# file that captures the structure of the code including all documentation.
|
# file that captures the structure of the code including all documentation.
|
||||||
#
|
#
|
||||||
# Note that this feature is still experimental and incomplete at the moment.
|
# Note that this feature is still experimental and incomplete at the moment.
|
||||||
@@ -1857,7 +1968,7 @@ GENERATE_AUTOGEN_DEF = NO
|
|||||||
|
|
||||||
GENERATE_PERLMOD = NO
|
GENERATE_PERLMOD = NO
|
||||||
|
|
||||||
# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
|
# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
|
||||||
# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
|
# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
|
||||||
# output from the Perl module output.
|
# output from the Perl module output.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -1865,9 +1976,9 @@ GENERATE_PERLMOD = NO
|
|||||||
|
|
||||||
PERLMOD_LATEX = NO
|
PERLMOD_LATEX = NO
|
||||||
|
|
||||||
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
|
# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
|
||||||
# formatted so it can be parsed by a human reader. This is useful if you want to
|
# formatted so it can be parsed by a human reader. This is useful if you want to
|
||||||
# understand what is going on. On the other hand, if this tag is set to NO the
|
# understand what is going on. On the other hand, if this tag is set to NO, the
|
||||||
# size of the Perl module output will be much smaller and Perl will parse it
|
# size of the Perl module output will be much smaller and Perl will parse it
|
||||||
# just the same.
|
# just the same.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -1887,14 +1998,14 @@ PERLMOD_MAKEVAR_PREFIX =
|
|||||||
# Configuration options related to the preprocessor
|
# Configuration options related to the preprocessor
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
|
# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
|
||||||
# C-preprocessor directives found in the sources and include files.
|
# C-preprocessor directives found in the sources and include files.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
ENABLE_PREPROCESSING = YES
|
ENABLE_PREPROCESSING = YES
|
||||||
|
|
||||||
# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
|
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
|
||||||
# in the source code. If set to NO only conditional compilation will be
|
# in the source code. If set to NO, only conditional compilation will be
|
||||||
# performed. Macro expansion can be done in a controlled way by setting
|
# performed. Macro expansion can be done in a controlled way by setting
|
||||||
# EXPAND_ONLY_PREDEF to YES.
|
# EXPAND_ONLY_PREDEF to YES.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -1910,7 +2021,7 @@ MACRO_EXPANSION = YES
|
|||||||
|
|
||||||
EXPAND_ONLY_PREDEF = NO
|
EXPAND_ONLY_PREDEF = NO
|
||||||
|
|
||||||
# If the SEARCH_INCLUDES tag is set to YES the includes files in the
|
# If the SEARCH_INCLUDES tag is set to YES, the include files in the
|
||||||
# INCLUDE_PATH will be searched if a #include is found.
|
# INCLUDE_PATH will be searched if a #include is found.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||||
@@ -1952,9 +2063,9 @@ PREDEFINED =
|
|||||||
EXPAND_AS_DEFINED =
|
EXPAND_AS_DEFINED =
|
||||||
|
|
||||||
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
|
||||||
# remove all refrences to function-like macros that are alone on a line, have an
|
# remove all references to function-like macros that are alone on a line, have
|
||||||
# all uppercase name, and do not end with a semicolon. Such function macros are
|
# an all uppercase name, and do not end with a semicolon. Such function macros
|
||||||
# typically used for boiler-plate code, and will confuse the parser if not
|
# are typically used for boiler-plate code, and will confuse the parser if not
|
||||||
# removed.
|
# removed.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||||
@@ -1974,7 +2085,7 @@ SKIP_FUNCTION_MACROS = YES
|
|||||||
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
|
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
|
||||||
# section "Linking to external documentation" for more information about the use
|
# section "Linking to external documentation" for more information about the use
|
||||||
# of tag files.
|
# of tag files.
|
||||||
# Note: Each tag file must have an unique name (where the name does NOT include
|
# Note: Each tag file must have a unique name (where the name does NOT include
|
||||||
# the path). If a tag file is not located in the directory in which doxygen is
|
# the path). If a tag file is not located in the directory in which doxygen is
|
||||||
# run, you must also specify the path to the tagfile here.
|
# run, you must also specify the path to the tagfile here.
|
||||||
|
|
||||||
@@ -1986,20 +2097,21 @@ TAGFILES =
|
|||||||
|
|
||||||
GENERATE_TAGFILE =
|
GENERATE_TAGFILE =
|
||||||
|
|
||||||
# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
|
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
|
||||||
# class index. If set to NO only the inherited external classes will be listed.
|
# the class index. If set to NO, only the inherited external classes will be
|
||||||
|
# listed.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
|
|
||||||
ALLEXTERNALS = NO
|
ALLEXTERNALS = NO
|
||||||
|
|
||||||
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
|
# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
|
||||||
# the modules index. If set to NO, only the current project's groups will be
|
# in the modules index. If set to NO, only the current project's groups will be
|
||||||
# listed.
|
# listed.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
EXTERNAL_GROUPS = YES
|
EXTERNAL_GROUPS = YES
|
||||||
|
|
||||||
# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
|
# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
|
||||||
# the related pages index. If set to NO, only the current project's pages will
|
# the related pages index. If set to NO, only the current project's pages will
|
||||||
# be listed.
|
# be listed.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
@@ -2016,14 +2128,14 @@ PERL_PATH = /usr/bin/perl
|
|||||||
# Configuration options related to the dot tool
|
# Configuration options related to the dot tool
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
|
# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
|
||||||
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
|
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
|
||||||
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
|
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
|
||||||
# disabled, but it is recommended to install and use dot, since it yields more
|
# disabled, but it is recommended to install and use dot, since it yields more
|
||||||
# powerful graphs.
|
# powerful graphs.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
CLASS_DIAGRAMS = YES
|
CLASS_DIAGRAMS = NO
|
||||||
|
|
||||||
# You can define message sequence charts within doxygen comments using the \msc
|
# You can define message sequence charts within doxygen comments using the \msc
|
||||||
# command. Doxygen will then run the mscgen tool (see:
|
# command. Doxygen will then run the mscgen tool (see:
|
||||||
@@ -2041,7 +2153,7 @@ MSCGEN_PATH =
|
|||||||
|
|
||||||
DIA_PATH =
|
DIA_PATH =
|
||||||
|
|
||||||
# If set to YES, the inheritance and collaboration graphs will hide inheritance
|
# If set to YES the inheritance and collaboration graphs will hide inheritance
|
||||||
# and usage relations if the target is undocumented or is not a class.
|
# and usage relations if the target is undocumented or is not a class.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
@@ -2052,9 +2164,9 @@ HIDE_UNDOC_RELATIONS = YES
|
|||||||
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||||
# Bell Labs. The other options in this section have no effect if this option is
|
# Bell Labs. The other options in this section have no effect if this option is
|
||||||
# set to NO
|
# set to NO
|
||||||
# The default value is: NO.
|
# The default value is: YES.
|
||||||
|
|
||||||
HAVE_DOT = NO
|
HAVE_DOT = YES
|
||||||
|
|
||||||
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
|
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
|
||||||
# to run in parallel. When set to 0 doxygen will base this on the number of
|
# to run in parallel. When set to 0 doxygen will base this on the number of
|
||||||
@@ -2066,7 +2178,7 @@ HAVE_DOT = NO
|
|||||||
|
|
||||||
DOT_NUM_THREADS = 0
|
DOT_NUM_THREADS = 0
|
||||||
|
|
||||||
# When you want a differently looking font n the dot files that doxygen
|
# When you want a differently looking font in the dot files that doxygen
|
||||||
# generates you can specify the font name using DOT_FONTNAME. You need to make
|
# generates you can specify the font name using DOT_FONTNAME. You need to make
|
||||||
# sure dot is able to find the font, which can be done by putting it in a
|
# sure dot is able to find the font, which can be done by putting it in a
|
||||||
# standard location or by setting the DOTFONTPATH environment variable or by
|
# standard location or by setting the DOTFONTPATH environment variable or by
|
||||||
@@ -2114,7 +2226,7 @@ COLLABORATION_GRAPH = YES
|
|||||||
|
|
||||||
GROUP_GRAPHS = YES
|
GROUP_GRAPHS = YES
|
||||||
|
|
||||||
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
|
# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
|
||||||
# collaboration diagrams in a style similar to the OMG's Unified Modeling
|
# collaboration diagrams in a style similar to the OMG's Unified Modeling
|
||||||
# Language.
|
# Language.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
@@ -2166,22 +2278,24 @@ INCLUDED_BY_GRAPH = YES
|
|||||||
#
|
#
|
||||||
# Note that enabling this option will significantly increase the time of a run.
|
# Note that enabling this option will significantly increase the time of a run.
|
||||||
# So in most cases it will be better to enable call graphs for selected
|
# So in most cases it will be better to enable call graphs for selected
|
||||||
# functions only using the \callgraph command.
|
# functions only using the \callgraph command. Disabling a call graph can be
|
||||||
|
# accomplished by means of the command \hidecallgraph.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
CALL_GRAPH = NO
|
CALL_GRAPH = YES
|
||||||
|
|
||||||
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
|
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
|
||||||
# dependency graph for every global function or class method.
|
# dependency graph for every global function or class method.
|
||||||
#
|
#
|
||||||
# Note that enabling this option will significantly increase the time of a run.
|
# Note that enabling this option will significantly increase the time of a run.
|
||||||
# So in most cases it will be better to enable caller graphs for selected
|
# So in most cases it will be better to enable caller graphs for selected
|
||||||
# functions only using the \callergraph command.
|
# functions only using the \callergraph command. Disabling a caller graph can be
|
||||||
|
# accomplished by means of the command \hidecallergraph.
|
||||||
# The default value is: NO.
|
# The default value is: NO.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
CALLER_GRAPH = NO
|
CALLER_GRAPH = YES
|
||||||
|
|
||||||
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
|
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
|
||||||
# hierarchy of all classes instead of a textual one.
|
# hierarchy of all classes instead of a textual one.
|
||||||
@@ -2200,11 +2314,17 @@ GRAPHICAL_HIERARCHY = YES
|
|||||||
DIRECTORY_GRAPH = YES
|
DIRECTORY_GRAPH = YES
|
||||||
|
|
||||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||||
# generated by dot.
|
# generated by dot. For an explanation of the image formats see the section
|
||||||
|
# output formats in the documentation of the dot tool (Graphviz (see:
|
||||||
|
# http://www.graphviz.org/)).
|
||||||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
||||||
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
||||||
# requirement).
|
# requirement).
|
||||||
# Possible values are: png, jpg, gif and svg.
|
# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
|
||||||
|
# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
|
||||||
|
# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
|
||||||
|
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
|
||||||
|
# png:gdiplus:gdiplus.
|
||||||
# The default value is: png.
|
# The default value is: png.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|
||||||
@@ -2247,6 +2367,24 @@ MSCFILE_DIRS =
|
|||||||
|
|
||||||
DIAFILE_DIRS =
|
DIAFILE_DIRS =
|
||||||
|
|
||||||
|
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
|
||||||
|
# path where java can find the plantuml.jar file. If left blank, it is assumed
|
||||||
|
# PlantUML is not used or called during a preprocessing step. Doxygen will
|
||||||
|
# generate a warning when it encounters a \startuml command in this case and
|
||||||
|
# will not generate output for the diagram.
|
||||||
|
|
||||||
|
PLANTUML_JAR_PATH =
|
||||||
|
|
||||||
|
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
|
||||||
|
# configuration file for plantuml.
|
||||||
|
|
||||||
|
PLANTUML_CFG_FILE =
|
||||||
|
|
||||||
|
# When using plantuml, the specified paths are searched for files specified by
|
||||||
|
# the !include statement in a plantuml block.
|
||||||
|
|
||||||
|
PLANTUML_INCLUDE_PATH =
|
||||||
|
|
||||||
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
|
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
|
||||||
# that will be shown in the graph. If the number of nodes in a graph becomes
|
# that will be shown in the graph. If the number of nodes in a graph becomes
|
||||||
# larger than this value, doxygen will truncate the graph, which is visualized
|
# larger than this value, doxygen will truncate the graph, which is visualized
|
||||||
@@ -2283,7 +2421,7 @@ MAX_DOT_GRAPH_DEPTH = 0
|
|||||||
|
|
||||||
DOT_TRANSPARENT = NO
|
DOT_TRANSPARENT = NO
|
||||||
|
|
||||||
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
|
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
|
||||||
# files in one run (i.e. multiple -o and -T options on the command line). This
|
# files in one run (i.e. multiple -o and -T options on the command line). This
|
||||||
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
|
||||||
# this, this feature is disabled by default.
|
# this, this feature is disabled by default.
|
||||||
@@ -2300,7 +2438,7 @@ DOT_MULTI_TARGETS = YES
|
|||||||
|
|
||||||
GENERATE_LEGEND = YES
|
GENERATE_LEGEND = YES
|
||||||
|
|
||||||
# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
|
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
|
||||||
# files that are used to generate the various graphs.
|
# files that are used to generate the various graphs.
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
documentation. It has a .cxx extension so that emacs will happily
|
documentation. It has a .cxx extension so that emacs will happily
|
||||||
autoindent correctly. */
|
autoindent correctly. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \namespace simgear
|
||||||
|
* \brief \ref index "SimGear" main namespace.
|
||||||
|
*/
|
||||||
/** \mainpage SimGear
|
/** \mainpage SimGear
|
||||||
* Simulation, Visualization, and Game development libraries.
|
* Simulation, Visualization, and Game development libraries.
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
|
||||||
|
|
||||||
You *must* have the development components of OpenAL installed on your system
|
|
||||||
to build FlightGear!" You can get a copy here:
|
|
||||||
|
|
||||||
http://connect.creativelabs.com/openal/default.aspx
|
|
||||||
|
|
||||||
Build notes:
|
|
||||||
|
|
||||||
You can download a versioned release of the openal library from
|
|
||||||
http://www.openal.org/downloads.html. Download the openal source,
|
|
||||||
release 0.0.8 (dated February 11, 2006) and run:
|
|
||||||
tar xjvf openal-soft-1.5.304.tar.bz2
|
|
||||||
cd openal-soft-1.5.304/
|
|
||||||
ccmake .
|
|
||||||
|
|
||||||
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
|
||||||
then press 'g' to generate and exit ]
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||||
|
|
||||||
|
For Sound support FlightGear requires one of the two following packages:
|
||||||
|
- OpenAL
|
||||||
|
- AeonWave
|
||||||
|
|
||||||
|
== OpenAL ===
|
||||||
|
|
||||||
|
You *must* have the development components of OpenAL installed on your system
|
||||||
|
to build FlightGear!" You can get a copy here:
|
||||||
|
|
||||||
|
http://connect.creativelabs.com/openal/default.aspx
|
||||||
|
|
||||||
|
Build notes:
|
||||||
|
|
||||||
|
You can download a versioned release of the openal library from
|
||||||
|
http://www.openal.org/downloads.html. Download the openal source,
|
||||||
|
release 0.0.8 (dated February 11, 2006) and run:
|
||||||
|
tar xjvf openal-soft-1.5.304.tar.bz2
|
||||||
|
cd openal-soft-1.5.304/
|
||||||
|
ccmake .
|
||||||
|
|
||||||
|
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
||||||
|
then press 'g' to generate and exit ]
|
||||||
|
|
||||||
|
|
||||||
|
== AeonWave ===
|
||||||
|
|
||||||
|
For FlightGear AeonWave has a number of advantages over OpenAL:
|
||||||
|
* Correct Doppler effect behavior
|
||||||
|
* Default distance attenuation frequency filtering
|
||||||
|
* Native support for 29 types of audio formats.
|
||||||
|
* Native support for wav, mp3, vorbis and raw file formats.
|
||||||
|
|
||||||
|
The source code of AeonWave can be found on GitHub:
|
||||||
|
https://github.com/adalinbv
|
||||||
|
|
||||||
|
Optimized binary packages are available at:
|
||||||
|
http://www.adalin.com/
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
%define ver @VERSION@
|
|
||||||
%define rel 1
|
|
||||||
%define prefix /usr
|
|
||||||
|
|
||||||
Summary: Simulator Construction Gear.
|
|
||||||
Name: @PACKAGE@
|
|
||||||
Version: %ver
|
|
||||||
Release: %rel
|
|
||||||
Copyright: LGPL
|
|
||||||
Group: Libraries/Graphics
|
|
||||||
Source: %{name}-%{version}.tar.gz
|
|
||||||
#URL:
|
|
||||||
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
|
|
||||||
Packager: Fill In As You Wish
|
|
||||||
Docdir: %{prefix}/doc
|
|
||||||
|
|
||||||
%description
|
|
||||||
This package contains a tools and libraries useful for constructing
|
|
||||||
simulation and visualization applications such as FlightGear or TerraGear.
|
|
||||||
|
|
||||||
Authors:
|
|
||||||
N/A
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -n %{name}-%{version}
|
|
||||||
|
|
||||||
|
|
||||||
%build
|
|
||||||
# Needed for snapshot releases.
|
|
||||||
if [ ! -f configure ]; then
|
|
||||||
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix
|
|
||||||
else
|
|
||||||
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$SMP" != "" ]; then
|
|
||||||
JSMP = '"MAKE=make -k -j $SMP"'
|
|
||||||
fi
|
|
||||||
|
|
||||||
make ${JSMP};
|
|
||||||
|
|
||||||
|
|
||||||
%install
|
|
||||||
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
|
|
||||||
|
|
||||||
make prefix=${RPM_BUILD_ROOT}%{prefix} install
|
|
||||||
|
|
||||||
#
|
|
||||||
# Generating file lists and store them in file-lists
|
|
||||||
# Starting with the directory listings
|
|
||||||
#
|
|
||||||
find ${RPM_BUILD_ROOT}%{prefix}/{bin,include,lib} -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" > file-lists
|
|
||||||
%{?ETCDR:find ${RPM_BUILD_ROOT}%{!?SYSCF:%{prefix}}/etc -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" >> file-lists}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Then, the file listings
|
|
||||||
#
|
|
||||||
echo "%defattr (-, root, root)" >> file-lists
|
|
||||||
%{?ETCDR:find ${RPM_BUILD_ROOT}%{!?SYSCF:%{prefix}}/etc/%{name}.conf -type f | sed -e "s#^${RPM_BUILD_ROOT}#%config #g" >> file-lists}
|
|
||||||
find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> file-lists
|
|
||||||
|
|
||||||
|
|
||||||
%clean
|
|
||||||
(cd ..; rm -rf %{name}-%{version} ${RPM_BUILD_ROOT})
|
|
||||||
|
|
||||||
|
|
||||||
%files -f file-lists
|
|
||||||
%defattr (-, root, root)
|
|
||||||
%doc AUTHORS
|
|
||||||
%doc COPYING
|
|
||||||
%doc ChangeLog
|
|
||||||
%doc INSTALL
|
|
||||||
%doc NEWS
|
|
||||||
%doc README
|
|
||||||
%doc %{name}.spec.in
|
|
||||||
|
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
include(CMakeFindDependencyMacro)
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
find_dependency(ZLIB)
|
find_dependency(ZLIB)
|
||||||
|
find_dependency(LibLZMA)
|
||||||
find_dependency(Threads)
|
find_dependency(Threads)
|
||||||
|
|
||||||
# OSG
|
# OSG
|
||||||
|
|
||||||
set(SIMGEAR_HEADLESS @SIMGEAR_HEADLESS@)
|
set(SIMGEAR_HEADLESS @SIMGEAR_HEADLESS@)
|
||||||
set(SIMGEAR_SOUND @ENABLE_SOUND@)
|
set(SIMGEAR_SOUND @ENABLE_SOUND@)
|
||||||
|
set(USE_AEONWAVE @USE_AEONWAVE@)
|
||||||
|
|
||||||
# OpenAL isn't a public dependency, so maybe not needed
|
# OpenAL isn't a public dependency, so maybe not needed
|
||||||
#if (SIMGEAR_SOUND)
|
#if (SIMGEAR_SOUND)
|
||||||
@@ -17,6 +19,16 @@ set(SIMGEAR_SOUND @ENABLE_SOUND@)
|
|||||||
|
|
||||||
set(ENABLE_SIMD @ENABLE_SIMD@)
|
set(ENABLE_SIMD @ENABLE_SIMD@)
|
||||||
|
|
||||||
|
# OpenRTI support
|
||||||
|
set(ENABLE_RTI @ENABLE_RTI@)
|
||||||
|
if(ENABLE_RTI)
|
||||||
|
set(RTI_FOUND @RTI_FOUND@)
|
||||||
|
if(RTI_FOUND)
|
||||||
|
set(RTI_INCLUDE_DIRS @RTI_INCLUDE_DIRS@)
|
||||||
|
set(RTI_LDFLAGS @RTI_LDFLAGS@)
|
||||||
|
endif(RTI_FOUND)
|
||||||
|
endif(ENABLE_RTI)
|
||||||
|
|
||||||
# Alternative terrain engine based on pagedLOD
|
# Alternative terrain engine based on pagedLOD
|
||||||
|
|
||||||
set(ENABLE_GDAL @ENABLE_GDAL@)
|
set(ENABLE_GDAL @ENABLE_GDAL@)
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
Building a SimGear RPM package for Red Hat
|
|
||||||
|
|
||||||
Please see the "package/openSUSE" directory for an
|
|
||||||
example how to build a SimGear RPM package with
|
|
||||||
shared SimGear libraries.
|
|
||||||
|
|
||||||
You may need to adapt the names (exact spelling) of some
|
|
||||||
of the package dependencies in the openSUSE RPM spec,
|
|
||||||
since these may slightly differ for Red Hat.
|
|
||||||
|
|
||||||
(If you have a working and tested Red Hat RPM spec,
|
|
||||||
you're welcome to contribute it to this project.)
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
Building a SimGear RPM package for openSUSE
|
|
||||||
|
|
||||||
(Last tested with openSUSE 11.4+12.1)
|
|
||||||
|
|
||||||
This directory contains the files which, along with
|
|
||||||
the source code tar files, can be used to build
|
|
||||||
an RPM package targeted at an openSUSE Linux system.
|
|
||||||
|
|
||||||
To build SimGear from source do the following:
|
|
||||||
|
|
||||||
1. obtain simgear-2.8.0.tar.bz2 (adapt version if
|
|
||||||
necessary) and copy it into ~/rpmbuild/SOURCES
|
|
||||||
|
|
||||||
2. look in the BuildRequires section of SimGear.spec
|
|
||||||
and check that all the packages referred to are
|
|
||||||
installed (note, some of these packages may be part
|
|
||||||
of openSUSE's "games" repository).
|
|
||||||
|
|
||||||
3. run 'rpmbuild -ba simgear.spec' and find the RPM
|
|
||||||
build result in ~/rpmbuild/RPMS
|
|
||||||
|
|
||||||
That's all!
|
|
||||||
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
Summary: Simulator Construction Gear
|
|
||||||
Name: SimGear
|
|
||||||
Version: 2.8.0
|
|
||||||
Release: 1
|
|
||||||
License: LGPL
|
|
||||||
URL: http://www.flightgear.org
|
|
||||||
Group: Amusements/Games/3D/Simulation
|
|
||||||
Source: http://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/Source/simgear-%{version}.tar.bz2
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
||||||
|
|
||||||
BuildRequires: gcc, gcc-c++, cmake
|
|
||||||
BuildRequires: libopenal1-soft, openal-soft
|
|
||||||
BuildRequires: libOpenSceneGraph-devel >= 3.0
|
|
||||||
BuildRequires: zlib, zlib-devel
|
|
||||||
BuildRequires: libjpeg62, libjpeg62-devel
|
|
||||||
BuildRequires: boost-devel >= 1.37
|
|
||||||
BuildRequires: subversion-devel, libapr1-devel
|
|
||||||
Requires: OpenSceneGraph-plugins >= 3.0
|
|
||||||
|
|
||||||
%description
|
|
||||||
This package contains a tools and libraries useful for constructing
|
|
||||||
simulation and visualization applications such as FlightGear or TerraGear.
|
|
||||||
|
|
||||||
%package devel
|
|
||||||
Group: Development/Libraries/Other
|
|
||||||
Summary: Development header files for SimGear
|
|
||||||
Requires: SimGear = %{version}
|
|
||||||
|
|
||||||
%description devel
|
|
||||||
Development headers and libraries for building applications against SimGear.
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -T -q -n simgear-%{version} -b 0
|
|
||||||
|
|
||||||
%build
|
|
||||||
export CFLAGS="$RPM_OPT_FLAGS"
|
|
||||||
export CXXFLAGS="$RPM_OPT_FLAGS"
|
|
||||||
# build SHARED simgear libraries
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DSIMGEAR_SHARED:BOOL=ON -DENABLE_TESTS:BOOL=OFF -DJPEG_FACTORY:BOOL=ON
|
|
||||||
make %{?_smp_mflags}
|
|
||||||
|
|
||||||
%install
|
|
||||||
make DESTDIR=%{buildroot} install
|
|
||||||
|
|
||||||
%post -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%postun -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr (-, root, root, -)
|
|
||||||
%doc AUTHORS COPYING ChangeLog NEWS README
|
|
||||||
%{_libdir}/libSimGear*.so.*
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%dir %{_includedir}/simgear
|
|
||||||
%{_includedir}/simgear/*
|
|
||||||
%{_libdir}/libSimGear*.so
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Mon Jul 02 2012 thorstenb@flightgear.org
|
|
||||||
- Initial version
|
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
2020.3.9
|
||||||
+36
-10
@@ -5,6 +5,8 @@ foreach( mylibfolder
|
|||||||
bucket
|
bucket
|
||||||
bvh
|
bvh
|
||||||
debug
|
debug
|
||||||
|
embedded_resources
|
||||||
|
emesary
|
||||||
ephemeris
|
ephemeris
|
||||||
io
|
io
|
||||||
magvar
|
magvar
|
||||||
@@ -14,6 +16,7 @@ foreach( mylibfolder
|
|||||||
nasal/cppbind
|
nasal/cppbind
|
||||||
props
|
props
|
||||||
serial
|
serial
|
||||||
|
std
|
||||||
structure
|
structure
|
||||||
threads
|
threads
|
||||||
timing
|
timing
|
||||||
@@ -62,6 +65,9 @@ if(SIMGEAR_SHARED)
|
|||||||
set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION})
|
set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION})
|
||||||
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
|
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
export_debug_symbols(SimGearCore)
|
||||||
|
export_debug_symbols(SimGearScene)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Library building mode: STATIC LIBRARIES")
|
message(STATUS "Library building mode: STATIC LIBRARIES")
|
||||||
|
|
||||||
@@ -112,11 +118,22 @@ target_include_directories(SimGearCore BEFORE PUBLIC
|
|||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||||
$<INSTALL_INTERFACE:include>)
|
$<INSTALL_INTERFACE:include>)
|
||||||
|
|
||||||
|
# so simgear/simgear_config.h is found
|
||||||
|
target_include_directories(SimGearCore BEFORE PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
|
||||||
|
$<INSTALL_INTERFACE:include>)
|
||||||
|
|
||||||
target_include_directories(SimGearCore PUBLIC
|
target_include_directories(SimGearCore PUBLIC
|
||||||
${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
||||||
target_include_directories(SimGearCore PRIVATE
|
target_include_directories(SimGearCore PRIVATE
|
||||||
${EXPAT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS})
|
${EXPAT_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
if (NOT SYSTEM_EXPAT)
|
||||||
|
# XML_STATIC is important to avoid sg_expat_external.h
|
||||||
|
# declaring symbols as declspec(import)
|
||||||
|
target_compile_definitions(SimGearCore PRIVATE HAVE_SIMGEAR_EXPAT_CONFIG_H XML_STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(TARGETS SimGearCore
|
install(TARGETS SimGearCore
|
||||||
EXPORT SimGearTargets
|
EXPORT SimGearTargets
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
@@ -141,37 +158,46 @@ if (NOT SIMGEAR_HEADLESS)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# we expose ZLib in some of our headers
|
||||||
|
target_link_libraries(SimGearCore PUBLIC ${ZLIB_LIBRARY})
|
||||||
|
|
||||||
target_link_libraries(SimGearCore
|
target_link_libraries(SimGearCore PRIVATE
|
||||||
${ZLIB_LIBRARY}
|
|
||||||
${RT_LIBRARY}
|
${RT_LIBRARY}
|
||||||
${DL_LIBRARY}
|
${DL_LIBRARY}
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
${COCOA_LIBRARY}
|
${COCOA_LIBRARY}
|
||||||
${CURL_LIBRARIES}
|
${CURL_LIBRARIES}
|
||||||
${WINSOCK_LIBRARY})
|
${WINSOCK_LIBRARY}
|
||||||
|
${SHLWAPI_LIBRARY}
|
||||||
|
LibLZMA::LibLZMA
|
||||||
|
)
|
||||||
|
|
||||||
if(SYSTEM_EXPAT)
|
if(SYSTEM_EXPAT)
|
||||||
target_link_libraries(SimGearCore
|
target_link_libraries(SimGearCore PRIVATE ${EXPAT_LIBRARIES})
|
||||||
${EXPAT_LIBRARIES})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_DNS AND SYSTEM_UDNS)
|
if(ENABLE_DNS AND SYSTEM_UDNS)
|
||||||
target_link_libraries(SimGearCore
|
target_link_libraries(SimGearCore PRIVATE ${UDNS_LIBRARIES})
|
||||||
${UDNS_LIBRARIES})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SIMGEAR_HEADLESS)
|
if(NOT SIMGEAR_HEADLESS)
|
||||||
target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
|
target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/simgear/canvas/ShivaVG/include)
|
||||||
|
|
||||||
target_link_libraries(SimGearScene
|
target_link_libraries(SimGearScene PUBLIC
|
||||||
SimGearCore
|
SimGearCore
|
||||||
${ZLIB_LIBRARY}
|
|
||||||
${OPENSCENEGRAPH_LIBRARIES}
|
${OPENSCENEGRAPH_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(SimGearScene PRIVATE
|
||||||
|
${ZLIB_LIBRARY}
|
||||||
${OPENAL_LIBRARY}
|
${OPENAL_LIBRARY}
|
||||||
${OPENGL_LIBRARY}
|
${OPENGL_LIBRARY}
|
||||||
${JPEG_LIBRARY})
|
${JPEG_LIBRARY})
|
||||||
|
|
||||||
|
if(ENABLE_GDAL)
|
||||||
|
target_link_libraries(SimGearScene PRIVATE ${GDAL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
# only actually needed by canvas/KeyboardEvent.cxx
|
# only actually needed by canvas/KeyboardEvent.cxx
|
||||||
target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/utf8/source)
|
target_include_directories(SimGearScene PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/utf8/source)
|
||||||
endif()
|
endif()
|
||||||
@@ -181,5 +207,5 @@ if(ENABLE_RTI)
|
|||||||
set_property(SOURCE hla/RTI13InteractionClass.cxx hla/RTI13ObjectClass.cxx
|
set_property(SOURCE hla/RTI13InteractionClass.cxx hla/RTI13ObjectClass.cxx
|
||||||
hla/RTI13ObjectInstance.cxx hla/RTI13Federate.cxx
|
hla/RTI13ObjectInstance.cxx hla/RTI13Federate.cxx
|
||||||
hla/RTI13FederateFactory.cxx
|
hla/RTI13FederateFactory.cxx
|
||||||
APPEND PROPERTY COMPILE_FLAGS "-I${RTI_INCLUDE_DIR}")
|
APPEND PROPERTY COMPILE_FLAGS "-I${RTI_INCLUDE_DIRS}")
|
||||||
endif(ENABLE_RTI)
|
endif(ENABLE_RTI)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void testBasic()
|
|||||||
SG_CHECK_EQUAL(atAntiMeridian2.get_chunk_lon(), -180);
|
SG_CHECK_EQUAL(atAntiMeridian2.get_chunk_lon(), -180);
|
||||||
SG_CHECK_EQUAL(atAntiMeridian2.get_x(), 0);
|
SG_CHECK_EQUAL(atAntiMeridian2.get_x(), 0);
|
||||||
|
|
||||||
// check comparisom operator overload
|
// check comparison operator overload
|
||||||
SGBucket b4(5.11, 55.1);
|
SGBucket b4(5.11, 55.1);
|
||||||
SG_VERIFY(b1 == b4); // should be equal
|
SG_VERIFY(b1 == b4); // should be equal
|
||||||
SG_VERIFY(b1 == b1);
|
SG_VERIFY(b1 == b1);
|
||||||
@@ -100,6 +100,34 @@ void testBasic()
|
|||||||
|
|
||||||
SGBucket clipPole(48.9, 91);
|
SGBucket clipPole(48.9, 91);
|
||||||
SG_CHECK_EQUAL(clipPole.get_chunk_lat(), 89);
|
SG_CHECK_EQUAL(clipPole.get_chunk_lat(), 89);
|
||||||
|
|
||||||
|
// test override of a bucket's geod
|
||||||
|
auto geod = SGGeod::fromDegFt(-86.678, 36.1248, 599.0);
|
||||||
|
#ifndef NO_DEPRECATED_API
|
||||||
|
SGBucket bna_airport;
|
||||||
|
bna_airport.set_bucket(geod);
|
||||||
|
#else
|
||||||
|
SGBucket bna_airport(geod);
|
||||||
|
#endif
|
||||||
|
SG_VERIFY(bna_airport.isValid());
|
||||||
|
SG_CHECK_EQUAL(bna_airport.get_chunk_lon(), -87); // left origin of the 1-degree chunk
|
||||||
|
SG_CHECK_EQUAL(bna_airport.get_chunk_lat(), 36); // bottom origin of the 1-degree chunk
|
||||||
|
SG_CHECK_EQUAL(bna_airport.get_x(), 1); // buckets are 0.25 deg wide at the W87 parallel
|
||||||
|
// we're 0.322 deg from the origin (second bucket)
|
||||||
|
SG_CHECK_EQUAL(bna_airport.get_y(), 0); // buckets are always 0.125 deg tall
|
||||||
|
// we're 0.1248 deg from the origin (first bucket)
|
||||||
|
SG_CHECK_EQUAL(bna_airport.gen_base_path(), "w090n30/w087n36");
|
||||||
|
SG_CHECK_EQUAL_EP2(bna_airport.get_width_m(), 22479.1, 0.1);
|
||||||
|
SG_CHECK_EQUAL_EP2(bna_airport.get_height_m(), 13914.9, 0.1);
|
||||||
|
SG_CHECK_EQUAL(bna_airport.gen_index_str(), "1531777"); // 0x175F81 = b01011101|01111110|000|001
|
||||||
|
// = 93-180 | 126-90 | 0 | 1
|
||||||
|
// = -87 | 36 | 0 | 1
|
||||||
|
|
||||||
|
// test stream output
|
||||||
|
cout << "[TEST] BNA Airport: " << bna_airport << endl;
|
||||||
|
auto center = bna_airport.get_center();
|
||||||
|
cout << "[TEST] BNA lon: " << center.getLongitudeDeg() << endl;
|
||||||
|
cout << "[TEST] BNA lat: " << center.getLatitudeDeg() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void testPolar()
|
void testPolar()
|
||||||
@@ -153,7 +181,6 @@ void testPolar()
|
|||||||
|
|
||||||
SGBucket b7(200, 89.88);
|
SGBucket b7(200, 89.88);
|
||||||
SG_CHECK_EQUAL(b7.get_chunk_lon(), -168);
|
SG_CHECK_EQUAL(b7.get_chunk_lon(), -168);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// test the tiles just below the pole (between 86 & 89 degrees N/S)
|
// test the tiles just below the pole (between 86 & 89 degrees N/S)
|
||||||
@@ -263,8 +290,59 @@ void testOffsetWrap()
|
|||||||
SG_CHECK_EQUAL(b2.get_x(), 7);
|
SG_CHECK_EQUAL(b2.get_x(), 7);
|
||||||
SG_CHECK_EQUAL(b2.get_y(), 6);
|
SG_CHECK_EQUAL(b2.get_y(), 6);
|
||||||
SG_CHECK_EQUAL(b2.gen_index(), sgBucketOffset(-179.8, 16.8, -2, 0));
|
SG_CHECK_EQUAL(b2.gen_index(), sgBucketOffset(-179.8, 16.8, -2, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void testSiblings()
|
||||||
|
{
|
||||||
|
SGBucket bna_airport(-86.678, 36.1248);
|
||||||
|
SG_VERIFY(bna_airport.isValid());
|
||||||
|
|
||||||
|
// retrieve the sibling two positions north-east of my position
|
||||||
|
auto sib1 = bna_airport.sibling(2, 2);
|
||||||
|
SG_CHECK_EQUAL(sib1.get_chunk_lon(), bna_airport.get_chunk_lon());
|
||||||
|
SG_CHECK_EQUAL(sib1.get_chunk_lat(), bna_airport.get_chunk_lat());
|
||||||
|
SG_CHECK_EQUAL(sib1.get_x(), 3); // my x-pos (1) + 2 = 3
|
||||||
|
SG_CHECK_EQUAL(sib1.get_y(), 2); // my y-pos (0) + 2 = 2
|
||||||
|
SG_CHECK_EQUAL(sib1.gen_base_path(), bna_airport.gen_base_path());
|
||||||
|
|
||||||
|
// retrieve the one sibling two positions to the north-east
|
||||||
|
std::vector<SGBucket> siblings;
|
||||||
|
bna_airport.siblings(2, 2, siblings);
|
||||||
|
SG_CHECK_EQUAL(siblings.size(), static_cast<std::vector<SGBucket>::size_type>(1));
|
||||||
|
siblings.clear();
|
||||||
|
|
||||||
|
// retrieve the one sibling at the chunk origin of sib1
|
||||||
|
sib1.siblings(-2, -2, siblings);
|
||||||
|
SG_CHECK_EQUAL(siblings.size(), static_cast<std::vector<SGBucket>::size_type>(1));
|
||||||
|
siblings.clear();
|
||||||
|
|
||||||
|
// calculate delta between two buckets
|
||||||
|
int dx = 0;
|
||||||
|
int dy = 0;
|
||||||
|
sgBucketDiff(bna_airport, sib1, &dx, &dy);
|
||||||
|
SG_CHECK_EQUAL(dx, 2);
|
||||||
|
SG_CHECK_EQUAL(dy, 2);
|
||||||
|
|
||||||
|
// retrieve all siblings between two geodetic locations
|
||||||
|
auto geod_bna = SGGeod::fromDegFt(-86.678, 36.1248, 599.0);
|
||||||
|
auto geod_m54 = SGGeod::fromDegFt(-86.317, 36.1908, 122.0);
|
||||||
|
sgGetBuckets(geod_bna, geod_m54, siblings);
|
||||||
|
SG_CHECK_EQUAL(siblings.size(), static_cast<std::vector<SGBucket>::size_type>(4));
|
||||||
|
siblings.clear();
|
||||||
|
|
||||||
|
// edge cases
|
||||||
|
|
||||||
|
// ensure you cannot retrieve the sibling of an invalid bucket
|
||||||
|
SGBucket bad;
|
||||||
|
auto bad_sib = bad.sibling(1, 1);
|
||||||
|
SG_CHECK_EQUAL(bad_sib.get_chunk_lon(), -1000);
|
||||||
|
SG_CHECK_EQUAL(bad.siblings(2, 2, siblings), 0);
|
||||||
|
|
||||||
|
// if we drop below the 22nd parallel, the bucket widths are half the size
|
||||||
|
// expect this to retrieve two buckets
|
||||||
|
bna_airport.siblings(0, -160, siblings);
|
||||||
|
SG_CHECK_EQUAL(siblings.size(), static_cast<std::vector<SGBucket>::size_type>(2));
|
||||||
|
siblings.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
@@ -277,8 +355,8 @@ int main(int argc, char* argv[])
|
|||||||
testOffset();
|
testOffset();
|
||||||
testOffsetWrap();
|
testOffsetWrap();
|
||||||
testPolarOffset();
|
testPolarOffset();
|
||||||
|
testSiblings();
|
||||||
|
|
||||||
cout << "all tests passed OK" << endl;
|
cout << "all tests passed OK" << endl;
|
||||||
return 0; // passed
|
return 0; // passed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
#include "BVHPager.hxx"
|
#include "BVHPager.hxx"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include <simgear/threads/SGThread.hxx>
|
#include <simgear/threads/SGThread.hxx>
|
||||||
#include <simgear/threads/SGGuard.hxx>
|
|
||||||
|
|
||||||
#include "BVHPageNode.hxx"
|
#include "BVHPageNode.hxx"
|
||||||
#include "BVHPageRequest.hxx"
|
#include "BVHPageRequest.hxx"
|
||||||
@@ -37,12 +37,12 @@ struct BVHPager::_PrivateData : protected SGThread {
|
|||||||
struct _LockedQueue {
|
struct _LockedQueue {
|
||||||
void _push(const _Request& request)
|
void _push(const _Request& request)
|
||||||
{
|
{
|
||||||
SGGuard<SGMutex> scopeLock(_mutex);
|
std::lock_guard<std::mutex> scopeLock(_mutex);
|
||||||
_requestList.push_back(request);
|
_requestList.push_back(request);
|
||||||
}
|
}
|
||||||
_Request _pop()
|
_Request _pop()
|
||||||
{
|
{
|
||||||
SGGuard<SGMutex> scopeLock(_mutex);
|
std::lock_guard<std::mutex> scopeLock(_mutex);
|
||||||
if (_requestList.empty())
|
if (_requestList.empty())
|
||||||
return _Request();
|
return _Request();
|
||||||
_Request request;
|
_Request request;
|
||||||
@@ -51,7 +51,7 @@ struct BVHPager::_PrivateData : protected SGThread {
|
|||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SGMutex _mutex;
|
std::mutex _mutex;
|
||||||
_RequestList _requestList;
|
_RequestList _requestList;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ struct BVHPager::_PrivateData : protected SGThread {
|
|||||||
}
|
}
|
||||||
void _push(const _Request& request)
|
void _push(const _Request& request)
|
||||||
{
|
{
|
||||||
SGGuard<SGMutex> scopeLock(_mutex);
|
std::lock_guard<std::mutex> scopeLock(_mutex);
|
||||||
bool needSignal = _requestList.empty();
|
bool needSignal = _requestList.empty();
|
||||||
_requestList.push_back(request);
|
_requestList.push_back(request);
|
||||||
if (needSignal)
|
if (needSignal)
|
||||||
@@ -70,7 +70,7 @@ struct BVHPager::_PrivateData : protected SGThread {
|
|||||||
}
|
}
|
||||||
_Request _pop()
|
_Request _pop()
|
||||||
{
|
{
|
||||||
SGGuard<SGMutex> scopeLock(_mutex);
|
std::lock_guard<std::mutex> scopeLock(_mutex);
|
||||||
while (_requestList.empty())
|
while (_requestList.empty())
|
||||||
_waitCondition.wait(_mutex);
|
_waitCondition.wait(_mutex);
|
||||||
_Request request;
|
_Request request;
|
||||||
@@ -79,7 +79,7 @@ struct BVHPager::_PrivateData : protected SGThread {
|
|||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
SGMutex _mutex;
|
std::mutex _mutex;
|
||||||
SGWaitCondition _waitCondition;
|
SGWaitCondition _waitCondition;
|
||||||
_RequestList _requestList;
|
_RequestList _requestList;
|
||||||
};
|
};
|
||||||
|
|||||||
+138
-20
@@ -1,4 +1,5 @@
|
|||||||
// The canvas for rendering with the 2d API
|
///@file
|
||||||
|
/// The canvas for rendering with the 2d API
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -22,8 +23,10 @@
|
|||||||
#include "CanvasEventManager.hxx"
|
#include "CanvasEventManager.hxx"
|
||||||
#include "CanvasEventVisitor.hxx"
|
#include "CanvasEventVisitor.hxx"
|
||||||
#include "CanvasPlacement.hxx"
|
#include "CanvasPlacement.hxx"
|
||||||
|
|
||||||
#include <simgear/canvas/events/KeyboardEvent.hxx>
|
#include <simgear/canvas/events/KeyboardEvent.hxx>
|
||||||
#include <simgear/canvas/events/MouseEvent.hxx>
|
#include <simgear/canvas/events/MouseEvent.hxx>
|
||||||
|
#include <simgear/misc/strutils.hxx>
|
||||||
#include <simgear/scene/util/parse_color.hxx>
|
#include <simgear/scene/util/parse_color.hxx>
|
||||||
#include <simgear/scene/util/RenderConstants.hxx>
|
#include <simgear/scene/util/RenderConstants.hxx>
|
||||||
|
|
||||||
@@ -32,13 +35,79 @@
|
|||||||
#include <osgText/Text>
|
#include <osgText/Text>
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
namespace canvas
|
namespace canvas
|
||||||
{
|
{
|
||||||
|
static int globalinstanceid = 1;
|
||||||
|
/**
|
||||||
|
* Camera Callback for moving completed canvas images to subscribed listener.
|
||||||
|
*/
|
||||||
|
class CanvasImageCallback : public osg::Camera::DrawCallback {
|
||||||
|
public:
|
||||||
|
osg::Image *_rawImage;
|
||||||
|
|
||||||
|
CanvasImageCallback(osg::Image *rawImage)
|
||||||
|
: _min_delta_tick(1.0 / 8.0) {
|
||||||
|
_previousFrameTick = osg::Timer::instance()->tick();
|
||||||
|
_rawImage = rawImage;
|
||||||
|
SG_LOG(SG_GENERAL,SG_INFO,"CanvasImageCallback created. instance is " << instanceid);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void operator()(osg::RenderInfo& renderInfo) const {
|
||||||
|
osg::Timer_t n = osg::Timer::instance()->tick();
|
||||||
|
double dt = osg::Timer::instance()->delta_s(_previousFrameTick, n);
|
||||||
|
if (dt < _min_delta_tick)
|
||||||
|
return;
|
||||||
|
_previousFrameTick = n;
|
||||||
|
SG_LOG(SG_GENERAL,SG_DEBUG,"CanvasImageCallback " << instanceid << ": image available for " << _subscribers.size() << " subscribers. camera is " << renderInfo.getCurrentCamera());
|
||||||
|
|
||||||
|
bool hasSubscribers = false;
|
||||||
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_lock);
|
||||||
|
hasSubscribers = !_subscribers.empty();
|
||||||
|
}
|
||||||
|
if (hasSubscribers) {
|
||||||
|
//Make sure image can be overwritten by next frame while it is still returned to the client
|
||||||
|
osg::Image* image = new osg::Image(*_rawImage, osg::CopyOp::DEEP_COPY_ALL);
|
||||||
|
{
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_lock);
|
||||||
|
while (!_subscribers.empty()) {
|
||||||
|
try {
|
||||||
|
CanvasImageReadyListener *subs = _subscribers.back();
|
||||||
|
if (subs){
|
||||||
|
subs->imageReady(image);
|
||||||
|
}else{
|
||||||
|
SG_LOG(SG_GENERAL,SG_WARN,"CanvasImageCallback subscriber null");
|
||||||
|
}
|
||||||
|
} catch (...) { }
|
||||||
|
_subscribers.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void subscribe(CanvasImageReadyListener * subscriber) {
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_lock);
|
||||||
|
_subscribers.push_back(subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unsubscribe(CanvasImageReadyListener * subscriber) {
|
||||||
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_lock);
|
||||||
|
_subscribers.remove(subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSubscriberCount() {
|
||||||
|
return _subscribers.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
mutable list<CanvasImageReadyListener*> _subscribers;
|
||||||
|
mutable OpenThreads::Mutex _lock;
|
||||||
|
mutable double _previousFrameTick;
|
||||||
|
double _min_delta_tick;
|
||||||
|
int instanceid = globalinstanceid++;
|
||||||
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Canvas::CullCallback::CullCallback(const CanvasWeakPtr& canvas):
|
Canvas::CullCallback::CullCallback(const CanvasWeakPtr& canvas):
|
||||||
@@ -64,18 +133,9 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Canvas::Canvas(SGPropertyNode* node):
|
Canvas::Canvas(SGPropertyNode* node):
|
||||||
PropertyBasedElement(node),
|
PropertyBasedElement(node),
|
||||||
_canvas_mgr(0),
|
|
||||||
_event_manager(new EventManager),
|
_event_manager(new EventManager),
|
||||||
_size_x(-1),
|
|
||||||
_size_y(-1),
|
|
||||||
_view_width(-1),
|
|
||||||
_view_height(-1),
|
|
||||||
_status(node, "status"),
|
_status(node, "status"),
|
||||||
_status_msg(node, "status-msg"),
|
_status_msg(node, "status-msg")
|
||||||
_sampling_dirty(false),
|
|
||||||
_render_dirty(true),
|
|
||||||
_visible(true),
|
|
||||||
_render_always(false)
|
|
||||||
{
|
{
|
||||||
_status = 0;
|
_status = 0;
|
||||||
setStatusFlags(MISSING_SIZE_X | MISSING_SIZE_Y);
|
setStatusFlags(MISSING_SIZE_X | MISSING_SIZE_Y);
|
||||||
@@ -236,6 +296,10 @@ namespace canvas
|
|||||||
|
|
||||||
if( _status & STATUS_DIRTY )
|
if( _status & STATUS_DIRTY )
|
||||||
{
|
{
|
||||||
|
// Retrieve reference here, to ensure the scene group is not deleted while
|
||||||
|
// creating the new texture and camera
|
||||||
|
osg::ref_ptr<osg::Group> root_scene_group = _root_group->getSceneGroup();
|
||||||
|
|
||||||
_texture.setSize(_size_x, _size_y);
|
_texture.setSize(_size_x, _size_y);
|
||||||
|
|
||||||
if( !_texture.serviceable() )
|
if( !_texture.serviceable() )
|
||||||
@@ -253,6 +317,21 @@ namespace canvas
|
|||||||
|
|
||||||
osg::Camera* camera = _texture.getCamera();
|
osg::Camera* camera = _texture.getCamera();
|
||||||
|
|
||||||
|
string canvasname = _node->getStringValue("name");
|
||||||
|
int renderToImage = _node->getBoolValue("render-to-image");
|
||||||
|
|
||||||
|
if (renderToImage){
|
||||||
|
CanvasImageCallback *_screenshotCallback = dynamic_cast<CanvasImageCallback*> (camera->getFinalDrawCallback());
|
||||||
|
if (!_screenshotCallback) {
|
||||||
|
// no draw callback yet
|
||||||
|
osg::Image* shot = new osg::Image();
|
||||||
|
shot->allocateImage(getSizeX(), getSizeY(), 24, GL_RGB, GL_UNSIGNED_BYTE);
|
||||||
|
camera->attach(osg::Camera::COLOR_BUFFER, shot);
|
||||||
|
camera->setFinalDrawCallback(new CanvasImageCallback(shot));
|
||||||
|
SG_LOG(SG_GENERAL,SG_INFO,"CanvasImage: attached image and draw callback to camera " << camera << " for canvas " << canvasname << ". Ready for subscriber now.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO Allow custom render order? For now just keep in order with
|
// TODO Allow custom render order? For now just keep in order with
|
||||||
// property tree.
|
// property tree.
|
||||||
camera->setRenderOrder(osg::Camera::PRE_RENDER, _node->getIndex());
|
camera->setRenderOrder(osg::Camera::PRE_RENDER, _node->getIndex());
|
||||||
@@ -261,7 +340,7 @@ namespace canvas
|
|||||||
parseColor(_node->getStringValue("background"), clear_color);
|
parseColor(_node->getStringValue("background"), clear_color);
|
||||||
camera->setClearColor(clear_color);
|
camera->setClearColor(clear_color);
|
||||||
|
|
||||||
camera->addChild(_root_group->getMatrixTransform());
|
camera->addChild(root_scene_group);
|
||||||
|
|
||||||
if( _texture.serviceable() )
|
if( _texture.serviceable() )
|
||||||
{
|
{
|
||||||
@@ -281,7 +360,7 @@ namespace canvas
|
|||||||
|
|
||||||
if( _visible || _render_always )
|
if( _visible || _render_always )
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(CanvasWeakPtr canvas_weak, _child_canvases)
|
for(auto& canvas_weak: _child_canvases)
|
||||||
{
|
{
|
||||||
// TODO should we check if the image the child canvas is displayed
|
// TODO should we check if the image the child canvas is displayed
|
||||||
// within is really visible?
|
// within is really visible?
|
||||||
@@ -293,7 +372,7 @@ namespace canvas
|
|||||||
if( _render_dirty )
|
if( _render_dirty )
|
||||||
{
|
{
|
||||||
// Also mark all canvases this canvas is displayed within as dirty
|
// Also mark all canvases this canvas is displayed within as dirty
|
||||||
BOOST_FOREACH(CanvasWeakPtr canvas_weak, _parent_canvases)
|
for(auto& canvas_weak: _parent_canvases)
|
||||||
{
|
{
|
||||||
CanvasPtr canvas = canvas_weak.lock();
|
CanvasPtr canvas = canvas_weak.lock();
|
||||||
if( canvas )
|
if( canvas )
|
||||||
@@ -352,6 +431,41 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Canvas::subscribe(CanvasImageReadyListener * subscriber) {
|
||||||
|
osg::Camera* camera = _texture.getCamera();
|
||||||
|
const string canvasname = _node->getStringValue("name");
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL,SG_DEBUG,"CanvasImage: subscribe to canvas " << canvasname.c_str() << ", camera ="<< camera);
|
||||||
|
|
||||||
|
if (!_node->getBoolValue("render-to-image")) {
|
||||||
|
SG_LOG(SG_GENERAL,SG_INFO,"CanvasImage: Setting render-to-image");
|
||||||
|
_node->addChild("render-to-image", 0)->setBoolValue(1);
|
||||||
|
setStatusFlags(STATUS_DIRTY, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
CanvasImageCallback *_screenshotCallback = dynamic_cast<CanvasImageCallback*> (camera->getFinalDrawCallback());
|
||||||
|
if (_screenshotCallback) {
|
||||||
|
// Camera ready for subscriber. Otherwise, draw callback is created by canvas thread later.
|
||||||
|
SG_LOG(SG_GENERAL,SG_DEBUG,"CanvasImage: adding subscriber to camera draw callback");
|
||||||
|
_screenshotCallback->subscribe(subscriber);
|
||||||
|
// TODO: check: Is this the correct way to ensure the canvas will be available?
|
||||||
|
enableRendering(true);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Canvas::unsubscribe(CanvasImageReadyListener * subscriber) {
|
||||||
|
osg::Camera* camera = _texture.getCamera();
|
||||||
|
SG_LOG(SG_GENERAL,SG_DEBUG,"CanvasImage: unsubscribe");
|
||||||
|
CanvasImageCallback *cb = dynamic_cast<CanvasImageCallback*> (camera->getFinalDrawCallback());
|
||||||
|
if (cb) {
|
||||||
|
SG_LOG(SG_GENERAL,SG_DEBUG,"CanvasImage: unsubscribe from camera " << camera);
|
||||||
|
cb->unsubscribe(subscriber);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool Canvas::addEventListener( const std::string& type,
|
bool Canvas::addEventListener( const std::string& type,
|
||||||
const EventListener& cb )
|
const EventListener& cb )
|
||||||
@@ -522,8 +636,8 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
const std::string& name = node->getNameString();
|
const std::string& name = node->getNameString();
|
||||||
|
|
||||||
if( boost::starts_with(name, "status")
|
if( strutils::starts_with(name, "status")
|
||||||
|| boost::starts_with(name, "data-") )
|
|| strutils::starts_with(name, "data-") )
|
||||||
return;
|
return;
|
||||||
_render_dirty = true;
|
_render_dirty = true;
|
||||||
|
|
||||||
@@ -538,7 +652,7 @@ namespace canvas
|
|||||||
if( !placements.empty() )
|
if( !placements.empty() )
|
||||||
{
|
{
|
||||||
bool placement_dirty = false;
|
bool placement_dirty = false;
|
||||||
BOOST_FOREACH(PlacementPtr& placement, placements)
|
for(auto& placement: placements)
|
||||||
{
|
{
|
||||||
// check if change can be directly handled by placement
|
// check if change can be directly handled by placement
|
||||||
if( placement->getProps() == node->getParent()
|
if( placement->getProps() == node->getParent()
|
||||||
@@ -577,6 +691,10 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
_sampling_dirty = true;
|
_sampling_dirty = true;
|
||||||
}
|
}
|
||||||
|
else if( name == "anisotropy" )
|
||||||
|
{
|
||||||
|
_texture.setMaxAnisotropy( node->getFloatValue() );
|
||||||
|
}
|
||||||
else if( name == "additive-blend" )
|
else if( name == "additive-blend" )
|
||||||
{
|
{
|
||||||
_texture.useAdditiveBlend( node->getBoolValue() );
|
_texture.useAdditiveBlend( node->getBoolValue() );
|
||||||
|
|||||||
+39
-23
@@ -33,7 +33,7 @@
|
|||||||
#include <osg/NodeCallback>
|
#include <osg/NodeCallback>
|
||||||
#include <osg/observer_ptr>
|
#include <osg/observer_ptr>
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
@@ -44,6 +44,17 @@ namespace canvas
|
|||||||
class CanvasMgr;
|
class CanvasMgr;
|
||||||
class MouseEvent;
|
class MouseEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A listener interested in completed canvas drawing.
|
||||||
|
*/
|
||||||
|
class CanvasImageReadyListener {
|
||||||
|
public:
|
||||||
|
virtual void imageReady(osg::ref_ptr<osg::Image>) = 0;
|
||||||
|
virtual ~CanvasImageReadyListener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Canvas to draw onto (to an off-screen render target).
|
* Canvas to draw onto (to an off-screen render target).
|
||||||
*/
|
*/
|
||||||
@@ -71,18 +82,18 @@ namespace canvas
|
|||||||
public osg::NodeCallback
|
public osg::NodeCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CullCallback(const CanvasWeakPtr& canvas);
|
explicit CullCallback(const CanvasWeakPtr& canvas);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CanvasWeakPtr _canvas;
|
CanvasWeakPtr _canvas;
|
||||||
|
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
void operator()(osg::Node* node, osg::NodeVisitor* nv) override;
|
||||||
};
|
};
|
||||||
typedef osg::ref_ptr<CullCallback> CullCallbackPtr;
|
typedef osg::ref_ptr<CullCallback> CullCallbackPtr;
|
||||||
|
|
||||||
Canvas(SGPropertyNode* node);
|
explicit Canvas(SGPropertyNode* node);
|
||||||
virtual ~Canvas();
|
virtual ~Canvas();
|
||||||
virtual void onDestroy();
|
void onDestroy() override;
|
||||||
|
|
||||||
void setCanvasMgr(CanvasMgr* canvas_mgr);
|
void setCanvasMgr(CanvasMgr* canvas_mgr);
|
||||||
CanvasMgr* getCanvasMgr() const;
|
CanvasMgr* getCanvasMgr() const;
|
||||||
@@ -160,7 +171,12 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
void enableRendering(bool force = false);
|
void enableRendering(bool force = false);
|
||||||
|
|
||||||
void update(double delta_time_sec);
|
void update(double delta_time_sec) override;
|
||||||
|
|
||||||
|
osg::Camera* getCamera();
|
||||||
|
int subscribe(CanvasImageReadyListener * subscriber);
|
||||||
|
int unsubscribe(CanvasImageReadyListener * subscriber);
|
||||||
|
int getSubscriberCount();
|
||||||
|
|
||||||
bool addEventListener(const std::string& type, const EventListener& cb);
|
bool addEventListener(const std::string& type, const EventListener& cb);
|
||||||
bool dispatchEvent(const EventPtr& event);
|
bool dispatchEvent(const EventPtr& event);
|
||||||
@@ -184,11 +200,9 @@ namespace canvas
|
|||||||
bool propagateEvent( EventPtr const& event,
|
bool propagateEvent( EventPtr const& event,
|
||||||
EventPropagationPath const& path );
|
EventPropagationPath const& path );
|
||||||
|
|
||||||
virtual void childAdded( SGPropertyNode * parent,
|
void childAdded(SGPropertyNode* parent, SGPropertyNode* child) override;
|
||||||
SGPropertyNode * child );
|
void childRemoved(SGPropertyNode* parent, SGPropertyNode* child) override;
|
||||||
virtual void childRemoved( SGPropertyNode * parent,
|
void valueChanged(SGPropertyNode * node) override;
|
||||||
SGPropertyNode * child );
|
|
||||||
virtual void valueChanged (SGPropertyNode * node);
|
|
||||||
|
|
||||||
osg::Texture2D* getTexture() const;
|
osg::Texture2D* getTexture() const;
|
||||||
|
|
||||||
@@ -211,21 +225,21 @@ namespace canvas
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
CanvasMgr *_canvas_mgr;
|
CanvasMgr *_canvas_mgr {nullptr};
|
||||||
|
|
||||||
boost::scoped_ptr<EventManager> _event_manager;
|
std::unique_ptr<EventManager> _event_manager;
|
||||||
|
|
||||||
int _size_x,
|
int _size_x {-1},
|
||||||
_size_y,
|
_size_y {-1},
|
||||||
_view_width,
|
_view_width {-1},
|
||||||
_view_height;
|
_view_height {-1};
|
||||||
|
|
||||||
PropertyObject<int> _status;
|
PropertyObject<int> _status;
|
||||||
PropertyObject<std::string> _status_msg;
|
PropertyObject<std::string> _status_msg;
|
||||||
|
|
||||||
bool _sampling_dirty,
|
bool _sampling_dirty {false},
|
||||||
_render_dirty,
|
_render_dirty {true},
|
||||||
_visible;
|
_visible {true};
|
||||||
|
|
||||||
ODGauge _texture;
|
ODGauge _texture;
|
||||||
|
|
||||||
@@ -235,7 +249,9 @@ namespace canvas
|
|||||||
ElementWeakPtr _focus_element;
|
ElementWeakPtr _focus_element;
|
||||||
|
|
||||||
CullCallbackPtr _cull_callback;
|
CullCallbackPtr _cull_callback;
|
||||||
bool _render_always; //!< Used to disable automatic lazy rendering (culling)
|
|
||||||
|
/** Used to disable automatic lazy rendering (culling) */
|
||||||
|
bool _render_always {false};
|
||||||
|
|
||||||
std::vector<SGPropertyNode*> _dirty_placements;
|
std::vector<SGPropertyNode*> _dirty_placements;
|
||||||
std::vector<Placements> _placements;
|
std::vector<Placements> _placements;
|
||||||
@@ -252,8 +268,8 @@ namespace canvas
|
|||||||
|
|
||||||
static SystemAdapterPtr _system_adapter;
|
static SystemAdapterPtr _system_adapter;
|
||||||
|
|
||||||
Canvas(const Canvas&); // = delete;
|
Canvas(const Canvas&) = delete;
|
||||||
Canvas& operator=(const Canvas&); // = delete;
|
Canvas& operator=(const Canvas&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Canvas Event for event model similar to DOM Level 3 Event Model
|
///@file
|
||||||
|
/// Canvas Event for event model similar to DOM Level 3 Event Model
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -125,10 +126,10 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string Event::typeToStr(int type)
|
std::string Event::typeToStr(int type)
|
||||||
{
|
{
|
||||||
TypeMap const& type_map = getTypeMap();
|
auto const& map_by_id = getTypeMap().by<id>();
|
||||||
|
|
||||||
TypeMap::map_by<id>::const_iterator it = type_map.by<id>().find(type);
|
auto it = map_by_id.find(type);
|
||||||
if( it == type_map.by<id>().end() )
|
if( it == map_by_id.end() )
|
||||||
return "unknown";
|
return "unknown";
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ namespace canvas
|
|||||||
// of the actual event instances.
|
// of the actual event instances.
|
||||||
virtual ~Event();
|
virtual ~Event();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clone event and set to the given type (Same type if not specified)
|
||||||
|
*/
|
||||||
|
virtual Event* clone(int type = 0) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether this events support bubbling
|
* Get whether this events support bubbling
|
||||||
*/
|
*/
|
||||||
@@ -110,7 +115,14 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
bool defaultPrevented() const;
|
bool defaultPrevented() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new type string or get the id of an existing type string
|
||||||
|
*
|
||||||
|
* @param type Type string
|
||||||
|
* @return Id of the given @a type
|
||||||
|
*/
|
||||||
static int getOrRegisterType(const std::string& type);
|
static int getOrRegisterType(const std::string& type);
|
||||||
|
|
||||||
static int strToType(const std::string& type);
|
static int strToType(const std::string& type);
|
||||||
static std::string typeToStr(int type);
|
static std::string typeToStr(int type);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
|
///@file
|
||||||
|
/// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -17,9 +18,11 @@
|
|||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
|
|
||||||
#include "CanvasEventManager.hxx"
|
#include "CanvasEventManager.hxx"
|
||||||
#include <simgear/canvas/events/MouseEvent.hxx>
|
#include "elements/CanvasElement.hxx"
|
||||||
#include <simgear/canvas/elements/CanvasElement.hxx>
|
#include "events/MouseEvent.hxx"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
@@ -114,6 +117,8 @@ namespace canvas
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
case Event::DRAG:
|
case Event::DRAG:
|
||||||
|
case Event::DRAG_START:
|
||||||
|
case Event::DRAG_END:
|
||||||
if( !_last_mouse_down.valid() )
|
if( !_last_mouse_down.valid() )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
|
///@file
|
||||||
|
/// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Mapping between canvas gui Event types and their names
|
///@file
|
||||||
|
/// Mapping between canvas gui Event types and their names
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -25,6 +26,8 @@ ENUM_MAPPING(MOUSE_UP, "mouseup", MouseEvent)
|
|||||||
ENUM_MAPPING(CLICK, "click", MouseEvent)
|
ENUM_MAPPING(CLICK, "click", MouseEvent)
|
||||||
ENUM_MAPPING(DBL_CLICK, "dblclick", MouseEvent)
|
ENUM_MAPPING(DBL_CLICK, "dblclick", MouseEvent)
|
||||||
ENUM_MAPPING(DRAG, "drag", MouseEvent)
|
ENUM_MAPPING(DRAG, "drag", MouseEvent)
|
||||||
|
ENUM_MAPPING(DRAG_START, "dragstart", MouseEvent)
|
||||||
|
ENUM_MAPPING(DRAG_END, "dragend", MouseEvent)
|
||||||
ENUM_MAPPING(WHEEL, "wheel", MouseEvent)
|
ENUM_MAPPING(WHEEL, "wheel", MouseEvent)
|
||||||
ENUM_MAPPING(MOUSE_MOVE, "mousemove", MouseEvent)
|
ENUM_MAPPING(MOUSE_MOVE, "mousemove", MouseEvent)
|
||||||
ENUM_MAPPING(MOUSE_OVER, "mouseover", MouseEvent)
|
ENUM_MAPPING(MOUSE_OVER, "mouseover", MouseEvent)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// Visitor for traversing a canvas element hierarchy similar to the traversal
|
///@file
|
||||||
// of the DOM Level 3 Event Model
|
/// Visitor for traversing a canvas element hierarchy similar to the traversal
|
||||||
|
/// of the DOM Level 3 Event Model
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -18,9 +19,10 @@
|
|||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
|
|
||||||
#include "CanvasEvent.hxx"
|
#include "CanvasEvent.hxx"
|
||||||
#include "CanvasEventVisitor.hxx"
|
#include "CanvasEventVisitor.hxx"
|
||||||
#include <simgear/canvas/elements/CanvasElement.hxx>
|
#include "elements/CanvasElement.hxx"
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// Visitor for traversing a canvas element hierarchy similar to the traversal
|
///@file
|
||||||
// of the DOM Level 3 Event Model
|
/// Visitor for traversing a canvas element hierarchy similar to the traversal
|
||||||
|
/// of the DOM Level 3 Event Model
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Canvas with 2D rendering API
|
///@file
|
||||||
|
/// Canvas with 2D rendering API
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -17,12 +18,11 @@
|
|||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
|
|
||||||
#include "CanvasMgr.hxx"
|
#include "CanvasMgr.hxx"
|
||||||
#include "Canvas.hxx"
|
#include "Canvas.hxx"
|
||||||
#include "CanvasEventManager.hxx"
|
#include "CanvasEventManager.hxx"
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
namespace canvas
|
namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Canvas with 2D rendering API
|
///@file
|
||||||
|
/// Canvas with 2D rendering API
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -27,11 +28,9 @@ namespace simgear
|
|||||||
namespace canvas
|
namespace canvas
|
||||||
{
|
{
|
||||||
|
|
||||||
class CanvasMgr:
|
class CanvasMgr : public PropertyBasedMgr
|
||||||
public PropertyBasedMgr
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param node Root node of branch used to control canvasses
|
* @param node Root node of branch used to control canvasses
|
||||||
*/
|
*/
|
||||||
@@ -60,8 +59,7 @@ namespace canvas
|
|||||||
CanvasPtr getCanvas(const std::string& name) const;
|
CanvasPtr getCanvas(const std::string& name) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void elementCreated(PropertyBasedElementPtr element) override;
|
||||||
virtual void elementCreated(PropertyBasedElementPtr element);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Canvas placement for placing a canvas texture onto osg objects.
|
///@file
|
||||||
|
/// Canvas placement for placing a canvas texture onto osg objects
|
||||||
//
|
//
|
||||||
// It also provides a SGPickCallback for passing mouse events to the canvas and
|
// It also provides a SGPickCallback for passing mouse events to the canvas and
|
||||||
// manages emissive lighting of the placed canvas.
|
// manages emissive lighting of the placed canvas.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
///@file
|
///@file
|
||||||
/// Placement for putting a canvas texture onto OpenSceneGraph objects.
|
/// Placement for putting a canvas texture onto OpenSceneGraph objects
|
||||||
///
|
///
|
||||||
/// It also provides a SGPickCallback for passing mouse events to the canvas and
|
/// It also provides a SGPickCallback for passing mouse events to the canvas and
|
||||||
/// manages emissive lighting of the placed canvas.
|
/// manages emissive lighting of the placed canvas.
|
||||||
@@ -60,7 +60,7 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
void setCaptureEvents(bool enable);
|
void setCaptureEvents(bool enable);
|
||||||
|
|
||||||
virtual bool childChanged(SGPropertyNode* child);
|
bool childChanged(SGPropertyNode* child) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef SGSharedPtr<SGPickCallback> PickCallbackPtr;
|
typedef SGSharedPtr<SGPickCallback> PickCallbackPtr;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Base class for canvas placements
|
///@file
|
||||||
|
/// Base class for canvas placements
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Base class for canvas placements
|
///@file
|
||||||
|
/// Base class for canvas placements
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -40,9 +41,8 @@ namespace canvas
|
|||||||
protected:
|
protected:
|
||||||
SGPropertyNode_ptr _node;
|
SGPropertyNode_ptr _node;
|
||||||
|
|
||||||
private:
|
Placement(const Placement&) = delete;
|
||||||
Placement(const Placement&) /* = delete */;
|
Placement& operator=(const Placement&) = delete;
|
||||||
Placement& operator=(const Placement&) /* = delete */;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Adapter for using the canvas with different applications
|
///@file
|
||||||
|
/// Adapter for using the canvas with different applications
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -29,6 +30,10 @@ namespace HTTP { class Client; }
|
|||||||
namespace canvas
|
namespace canvas
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to different required systems of the application to the
|
||||||
|
* Canvas
|
||||||
|
*/
|
||||||
class SystemAdapter
|
class SystemAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Window for placing a Canvas onto it (for dialogs, menus, etc.)
|
///@file
|
||||||
|
/// Window for placing a Canvas onto it (for dialogs, menus, etc.)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -22,13 +23,11 @@
|
|||||||
#include "CanvasWindow.hxx"
|
#include "CanvasWindow.hxx"
|
||||||
|
|
||||||
#include <simgear/canvas/Canvas.hxx>
|
#include <simgear/canvas/Canvas.hxx>
|
||||||
|
#include <simgear/misc/strutils.hxx>
|
||||||
#include <simgear/scene/util/OsgMath.hxx>
|
#include <simgear/scene/util/OsgMath.hxx>
|
||||||
|
|
||||||
#include <osgGA/GUIEventHandler>
|
#include <osgGA/GUIEventHandler>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
namespace canvas
|
namespace canvas
|
||||||
@@ -43,9 +42,6 @@ namespace canvas
|
|||||||
const Style& parent_style,
|
const Style& parent_style,
|
||||||
Element* parent ):
|
Element* parent ):
|
||||||
Image(canvas, node, parent_style, parent),
|
Image(canvas, node, parent_style, parent),
|
||||||
_attributes_dirty(0),
|
|
||||||
_resizable(false),
|
|
||||||
_capture_events(true),
|
|
||||||
_resize_top(node, "resize-top"),
|
_resize_top(node, "resize-top"),
|
||||||
_resize_right(node, "resize-right"),
|
_resize_right(node, "resize-right"),
|
||||||
_resize_bottom(node, "resize-bottom"),
|
_resize_bottom(node, "resize-bottom"),
|
||||||
@@ -92,7 +88,7 @@ namespace canvas
|
|||||||
_capture_events = node->getBoolValue();
|
_capture_events = node->getBoolValue();
|
||||||
else if( name == "decoration-border" )
|
else if( name == "decoration-border" )
|
||||||
parseDecorationBorder(node->getStringValue());
|
parseDecorationBorder(node->getStringValue());
|
||||||
else if( boost::starts_with(name, "shadow-")
|
else if( strutils::starts_with(name, "shadow-")
|
||||||
|| name == "content-size" )
|
|| name == "content-size" )
|
||||||
_attributes_dirty |= DECORATION;
|
_attributes_dirty |= DECORATION;
|
||||||
else
|
else
|
||||||
@@ -103,16 +99,10 @@ namespace canvas
|
|||||||
Image::valueChanged(node);
|
Image::valueChanged(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
osg::Group* Window::getGroup()
|
|
||||||
{
|
|
||||||
return getMatrixTransform();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const SGVec2<float> Window::getPosition() const
|
const SGVec2<float> Window::getPosition() const
|
||||||
{
|
{
|
||||||
const osg::Matrix& m = getMatrixTransform()->getMatrix();
|
auto const& m = getMatrix();
|
||||||
return SGVec2<float>( m(3, 0), m(3, 1) );
|
return SGVec2<float>( m(3, 0), m(3, 1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,6 +213,19 @@ namespace canvas
|
|||||||
_resize_left = getRegion().l() + offset.x();
|
_resize_left = getRegion().l() + offset.x();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool Window::handleEvent(const EventPtr& event)
|
||||||
|
{
|
||||||
|
if( auto mouse_event = dynamic_cast<MouseEvent*>(event.get()) )
|
||||||
|
{
|
||||||
|
mouse_event->local_pos =
|
||||||
|
mouse_event->client_pos =
|
||||||
|
mouse_event->screen_pos - toOsg(getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Image::handleEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Window::parseDecorationBorder(const std::string& str)
|
void Window::parseDecorationBorder(const std::string& str)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Window for placing a Canvas onto it (for dialogs, menus, etc.)
|
///@file
|
||||||
|
/// Window for placing a Canvas onto it (for dialogs, menus, etc.)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -67,10 +68,9 @@ namespace canvas
|
|||||||
Element* parent = 0 );
|
Element* parent = 0 );
|
||||||
virtual ~Window();
|
virtual ~Window();
|
||||||
|
|
||||||
virtual void update(double delta_time_sec);
|
void update(double delta_time_sec) override;
|
||||||
virtual void valueChanged(SGPropertyNode* node);
|
void valueChanged(SGPropertyNode* node) override;
|
||||||
|
|
||||||
osg::Group* getGroup();
|
|
||||||
const SGVec2<float> getPosition() const;
|
const SGVec2<float> getPosition() const;
|
||||||
const SGRect<float> getScreenRegion() const;
|
const SGRect<float> getScreenRegion() const;
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ namespace canvas
|
|||||||
bool isResizable() const;
|
bool isResizable() const;
|
||||||
bool isCapturingEvents() const;
|
bool isCapturingEvents() const;
|
||||||
|
|
||||||
virtual void setVisible(bool visible);
|
void setVisible(bool visible) override;
|
||||||
virtual bool isVisible() const;
|
bool isVisible() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves window on top of all other windows with the same z-index.
|
* Moves window on top of all other windows with the same z-index.
|
||||||
@@ -97,6 +97,8 @@ namespace canvas
|
|||||||
void handleResize( uint8_t mode,
|
void handleResize( uint8_t mode,
|
||||||
const osg::Vec2f& offset = osg::Vec2f() );
|
const osg::Vec2f& offset = osg::Vec2f() );
|
||||||
|
|
||||||
|
bool handleEvent(const EventPtr& event) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
enum Attributes
|
enum Attributes
|
||||||
@@ -104,7 +106,7 @@ namespace canvas
|
|||||||
DECORATION = 1
|
DECORATION = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t _attributes_dirty;
|
uint32_t _attributes_dirty {0};
|
||||||
|
|
||||||
CanvasPtr _canvas_decoration;
|
CanvasPtr _canvas_decoration;
|
||||||
CanvasWeakPtr _canvas_content;
|
CanvasWeakPtr _canvas_content;
|
||||||
@@ -113,8 +115,8 @@ namespace canvas
|
|||||||
ImagePtr _image_content,
|
ImagePtr _image_content,
|
||||||
_image_shadow;
|
_image_shadow;
|
||||||
|
|
||||||
bool _resizable,
|
bool _resizable {false},
|
||||||
_capture_events;
|
_capture_events {true};
|
||||||
|
|
||||||
PropertyObject<int> _resize_top,
|
PropertyObject<int> _resize_top,
|
||||||
_resize_right,
|
_resize_right,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Owner Drawn Gauge helper class
|
///@file
|
||||||
|
/// Owner Drawn Gauge helper class
|
||||||
//
|
//
|
||||||
// Written by Harald JOHNSEN, started May 2005.
|
// Written by Harald JOHNSEN, started May 2005.
|
||||||
//
|
//
|
||||||
@@ -6,9 +7,9 @@
|
|||||||
//
|
//
|
||||||
// Ported to OSG by Tim Moore - Jun 2007
|
// Ported to OSG by Tim Moore - Jun 2007
|
||||||
//
|
//
|
||||||
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012
|
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April
|
||||||
// Supports now multisampling/mipmapping, usage of the stencil buffer and placing
|
// 2012 Supports now multisampling/mipmapping, usage of the stencil buffer and
|
||||||
// the texture in the scene by certain filter criteria
|
// placing the texture in the scene by certain filter criteria.
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Library General Public
|
// modify it under the terms of the GNU Library General Public
|
||||||
@@ -201,6 +202,12 @@ namespace canvas
|
|||||||
updateSampling();
|
updateSampling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void ODGauge::setMaxAnisotropy(float anis)
|
||||||
|
{
|
||||||
|
texture->setMaxAnisotropy(anis);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void ODGauge::setRender(bool render)
|
void ODGauge::setRender(bool render)
|
||||||
{
|
{
|
||||||
@@ -249,10 +256,16 @@ namespace canvas
|
|||||||
|
|
||||||
if( !texture )
|
if( !texture )
|
||||||
{
|
{
|
||||||
|
// It shouldn't be necessary to allocate an image for the
|
||||||
|
// texture that is the target of dynamic rendering, but
|
||||||
|
// otherwise OSG won't construct all the mipmaps for the texture
|
||||||
|
// and dynamic mipmap generation doesn't work.
|
||||||
|
osg::Image* image = new osg::Image;
|
||||||
|
image->allocateImage(_size_x, _size_y, 1, GL_RGBA, GL_UNSIGNED_BYTE);
|
||||||
texture = new osg::Texture2D;
|
texture = new osg::Texture2D;
|
||||||
texture->setResizeNonPowerOfTwoHint(false);
|
texture->setResizeNonPowerOfTwoHint(false);
|
||||||
texture->setTextureSize(_size_x, _size_y);
|
texture->setImage(image);
|
||||||
texture->setInternalFormat(GL_RGBA);
|
texture->setUnRefImageDataAfterApply(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSampling();
|
updateSampling();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Owner Drawn Gauge helper class
|
///@file
|
||||||
|
/// Owner Drawn Gauge helper class
|
||||||
//
|
//
|
||||||
// Written by Harald JOHNSEN, started May 2005.
|
// Written by Harald JOHNSEN, started May 2005.
|
||||||
//
|
//
|
||||||
@@ -6,9 +7,9 @@
|
|||||||
//
|
//
|
||||||
// Ported to OSG by Tim Moore - Jun 2007
|
// Ported to OSG by Tim Moore - Jun 2007
|
||||||
//
|
//
|
||||||
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012
|
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April
|
||||||
// Supports now multisampling/mipmapping, usage of the stencil buffer and placing
|
// 2012 Supports now multisampling/mipmapping, usage of the stencil buffer and
|
||||||
// the texture in the scene by certain filter criteria
|
// placing the texture in the scene by certain filter criteria.
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Library General Public
|
// modify it under the terms of the GNU Library General Public
|
||||||
@@ -108,6 +109,8 @@ namespace canvas
|
|||||||
int coverage_samples = 0,
|
int coverage_samples = 0,
|
||||||
int color_samples = 0 );
|
int color_samples = 0 );
|
||||||
|
|
||||||
|
void setMaxAnisotropy(float anis);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable updating the texture (If disabled the contents of the
|
* Enable/Disable updating the texture (If disabled the contents of the
|
||||||
* texture remains with the outcome of the last rendering pass)
|
* texture remains with the outcome of the last rendering pass)
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
// FreeBSD
|
// FreeBSD
|
||||||
#define VG_API_FREEBSD
|
#define VG_API_FREEBSD
|
||||||
|
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
|
||||||
|
// FreeBSD
|
||||||
|
#define VG_API_OPENBSD
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Unsupported system
|
// Unsupported system
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#if !defined(VG_API_MACOSX) && !defined(__FreeBSD__)
|
#if !defined(VG_API_MACOSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ SHfloat getMaxFloat();
|
|||||||
|
|
||||||
/* OpenGL headers */
|
/* OpenGL headers */
|
||||||
|
|
||||||
#if defined(VG_API_LINUX) || defined(VG_API_FREEBSD)
|
#if defined(VG_API_LINUX) || defined(VG_API_FREEBSD) || defined(VG_API_OPENBSD)
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#elif defined(VG_API_MACOSX)
|
#elif defined(VG_API_MACOSX)
|
||||||
|
|||||||
@@ -1193,7 +1193,7 @@ VG_API_CALL VGboolean vgInterpolatePath(VGPath dstPath, VGPath startPath,
|
|||||||
SHfloat *procData1, *procData2;
|
SHfloat *procData1, *procData2;
|
||||||
SHint procSegCount1=0, procSegCount2=0;
|
SHint procSegCount1=0, procSegCount2=0;
|
||||||
SHint procDataCount1=0, procDataCount2=0;
|
SHint procDataCount1=0, procDataCount2=0;
|
||||||
SHuint8 *newSegs, *newData;
|
SHuint8 *newSegs, *newData=0;
|
||||||
void *userData[4];
|
void *userData[4];
|
||||||
SHint segment1, segment2;
|
SHint segment1, segment2;
|
||||||
SHint segindex, s,d,i;
|
SHint segindex, s,d,i;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// osg::Operation to initialize the OpenVG context used for path rendering
|
///@file
|
||||||
|
/// osg::Operation to initialize the OpenVG context used for path rendering
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// osg::Operation to initialize the OpenVG context used for path rendering
|
///@file
|
||||||
|
/// osg::Operation to initialize the OpenVG context used for path rendering
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Canvas forward declarations
|
///@file
|
||||||
|
/// Canvas forward declarations
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -25,11 +26,9 @@
|
|||||||
#include <osg/ref_ptr>
|
#include <osg/ref_ptr>
|
||||||
#include <osgText/Font>
|
#include <osgText/Font>
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <functional>
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <boost/weak_ptr.hpp>
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
@@ -61,8 +60,8 @@ namespace canvas
|
|||||||
|
|
||||||
#define SG_FWD_DECL(name)\
|
#define SG_FWD_DECL(name)\
|
||||||
class name;\
|
class name;\
|
||||||
typedef boost::shared_ptr<name> name##Ptr;\
|
typedef std::shared_ptr<name> name##Ptr;\
|
||||||
typedef boost::weak_ptr<name> name##WeakPtr;
|
typedef std::weak_ptr<name> name##WeakPtr;
|
||||||
|
|
||||||
SG_FWD_DECL(Placement)
|
SG_FWD_DECL(Placement)
|
||||||
SG_FWD_DECL(SystemAdapter)
|
SG_FWD_DECL(SystemAdapter)
|
||||||
@@ -84,10 +83,10 @@ namespace canvas
|
|||||||
typedef osg::ref_ptr<osgText::Font> FontPtr;
|
typedef osg::ref_ptr<osgText::Font> FontPtr;
|
||||||
|
|
||||||
typedef std::vector<PlacementPtr> Placements;
|
typedef std::vector<PlacementPtr> Placements;
|
||||||
typedef boost::function<Placements( SGPropertyNode*,
|
typedef std::function<Placements( SGPropertyNode*,
|
||||||
CanvasPtr )> PlacementFactory;
|
CanvasPtr )> PlacementFactory;
|
||||||
|
|
||||||
typedef boost::function<void(const EventPtr&)> EventListener;
|
typedef std::function<void(const EventPtr&)> EventListener;
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
} // namespace simgear
|
} // namespace simgear
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ set(HEADERS
|
|||||||
CanvasText.hxx
|
CanvasText.hxx
|
||||||
)
|
)
|
||||||
|
|
||||||
set(DETAIL_HEADERS
|
|
||||||
detail/add_segment_variadic.hxx
|
|
||||||
)
|
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
CanvasElement.cxx
|
CanvasElement.cxx
|
||||||
CanvasGroup.cxx
|
CanvasGroup.cxx
|
||||||
@@ -23,7 +19,6 @@ set(SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
simgear_scene_component(canvas-elements canvas/elements "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(canvas-elements canvas/elements "${SOURCES}" "${HEADERS}")
|
||||||
simgear_component(canvas-elements/detail canvas/elements/detail "" "${DETAIL_HEADERS}")
|
|
||||||
|
|
||||||
add_boost_test(canvas_element
|
add_boost_test(canvas_element
|
||||||
SOURCES canvas_element_test.cpp
|
SOURCES canvas_element_test.cpp
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Interface for 2D Canvas element
|
///@file
|
||||||
|
/// Interface for 2D Canvas element
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -31,10 +32,6 @@
|
|||||||
#include <osg/StateAttribute>
|
#include <osg/StateAttribute>
|
||||||
#include <osg/Version>
|
#include <osg/Version>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/make_shared.hpp>
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -214,22 +211,22 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Element::onDestroy()
|
void Element::onDestroy()
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// The transform node keeps a reference on this element, so ensure it is
|
// The transform node keeps a reference on this element, so ensure it is
|
||||||
// deleted.
|
// deleted.
|
||||||
BOOST_FOREACH(osg::Group* parent, _transform->getParents())
|
for(osg::Group* parent: _scene_group->getParents())
|
||||||
{
|
{
|
||||||
parent->removeChild(_transform.get());
|
parent->removeChild(_scene_group.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide in case someone still holds a reference
|
// Hide in case someone still holds a reference
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
removeListener();
|
removeListener();
|
||||||
|
|
||||||
_parent = 0;
|
_parent = nullptr;
|
||||||
_transform = 0;
|
_scene_group = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -247,29 +244,8 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Element::update(double dt)
|
void Element::update(double dt)
|
||||||
{
|
{
|
||||||
if( !isVisible() )
|
if( isVisible() )
|
||||||
return;
|
updateImpl(dt);
|
||||||
|
|
||||||
// Trigger matrix update
|
|
||||||
getMatrix();
|
|
||||||
|
|
||||||
// Update bounding box on manual update (manual updates pass zero dt)
|
|
||||||
if( dt == 0 && _drawable )
|
|
||||||
_drawable->getBound();
|
|
||||||
|
|
||||||
if( (_attributes_dirty & BLEND_FUNC) && _transform.valid() )
|
|
||||||
{
|
|
||||||
parseBlendFunc(
|
|
||||||
_transform->getOrCreateStateSet(),
|
|
||||||
_node->getChild("blend-source"),
|
|
||||||
_node->getChild("blend-destination"),
|
|
||||||
_node->getChild("blend-source-rgb"),
|
|
||||||
_node->getChild("blend-destination-rgb"),
|
|
||||||
_node->getChild("blend-source-alpha"),
|
|
||||||
_node->getChild("blend-destination-alpha")
|
|
||||||
);
|
|
||||||
_attributes_dirty &= ~BLEND_FUNC;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -296,8 +272,7 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Element::setFocus()
|
void Element::setFocus()
|
||||||
{
|
{
|
||||||
CanvasPtr canvas = _canvas.lock();
|
if( auto canvas = _canvas.lock() )
|
||||||
if( canvas )
|
|
||||||
canvas->setFocusElement(this);
|
canvas->setFocusElement(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +316,8 @@ namespace canvas
|
|||||||
if( listeners == _listener.end() )
|
if( listeners == _listener.end() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BOOST_FOREACH(EventListener const& listener, listeners->second)
|
for(auto const& listener: listeners->second)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
listener(event);
|
listener(event);
|
||||||
@@ -354,6 +330,7 @@ namespace canvas
|
|||||||
"canvas::Element: event handler error: '" << ex.what() << "'"
|
"canvas::Element: event handler error: '" << ex.what() << "'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -395,9 +372,9 @@ namespace canvas
|
|||||||
getBoundingBox()
|
getBoundingBox()
|
||||||
#endif
|
#endif
|
||||||
.contains(osg::Vec3f(local_pos, 0));
|
.contains(osg::Vec3f(local_pos, 0));
|
||||||
else if( _transform.valid() )
|
else if( _scene_group.valid() )
|
||||||
// ... for other elements, i.e. groups only a bounding sphere is available
|
// ... for other elements, i.e. groups only a bounding sphere is available
|
||||||
return _transform->getBound().contains(osg::Vec3f(parent_pos, 0));
|
return _scene_group->getBound().contains(osg::Vec3f(parent_pos, 0));
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -406,34 +383,32 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Element::setVisible(bool visible)
|
void Element::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
if( _transform.valid() )
|
if( _scene_group.valid() )
|
||||||
// TODO check if we need another nodemask
|
// TODO check if we need another nodemask
|
||||||
_transform->setNodeMask(visible ? 0xffffffff : 0);
|
_scene_group->setNodeMask(visible ? 0xffffffff : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool Element::isVisible() const
|
bool Element::isVisible() const
|
||||||
{
|
{
|
||||||
return _transform.valid() && _transform->getNodeMask() != 0;
|
return _scene_group.valid() && _scene_group->getNodeMask() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::MatrixTransform* Element::getMatrixTransform()
|
osg::MatrixTransform* Element::getSceneGroup() const
|
||||||
{
|
{
|
||||||
return _transform.get();
|
return _scene_group.get();
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
osg::MatrixTransform const* Element::getMatrixTransform() const
|
|
||||||
{
|
|
||||||
return _transform.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::Vec2f Element::posToLocal(const osg::Vec2f& pos) const
|
osg::Vec2f Element::posToLocal(const osg::Vec2f& pos) const
|
||||||
{
|
{
|
||||||
getMatrix();
|
if( !_scene_group )
|
||||||
const osg::Matrix& m = _transform->getInverseMatrix();
|
// TODO log warning?
|
||||||
|
return pos;
|
||||||
|
|
||||||
|
updateMatrix();
|
||||||
|
const osg::Matrix& m = _scene_group->getInverseMatrix();
|
||||||
return osg::Vec2f
|
return osg::Vec2f
|
||||||
(
|
(
|
||||||
m(0, 0) * pos[0] + m(1, 0) * pos[1] + m(3, 0),
|
m(0, 0) * pos[0] + m(1, 0) * pos[1] + m(3, 0),
|
||||||
@@ -486,9 +461,6 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
if( child->getNameString() == NAME_TRANSFORM )
|
if( child->getNameString() == NAME_TRANSFORM )
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( child->getIndex() >= static_cast<int>(_transform_types.size()) )
|
if( child->getIndex() >= static_cast<int>(_transform_types.size()) )
|
||||||
{
|
{
|
||||||
SG_LOG
|
SG_LOG
|
||||||
@@ -525,7 +497,7 @@ namespace canvas
|
|||||||
if( parent == _node )
|
if( parent == _node )
|
||||||
{
|
{
|
||||||
const std::string& name = child->getNameString();
|
const std::string& name = child->getNameString();
|
||||||
if( boost::starts_with(name, "data-") )
|
if( strutils::starts_with(name, "data-") )
|
||||||
return;
|
return;
|
||||||
else if( StyleInfo const* style_info = getStyleInfo(name) )
|
else if( StyleInfo const* style_info = getStyleInfo(name) )
|
||||||
{
|
{
|
||||||
@@ -540,7 +512,7 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
else if( name == "update" )
|
else if( name == "update" )
|
||||||
return update(0);
|
return update(0);
|
||||||
else if( boost::starts_with(name, "blend-") )
|
else if( strutils::starts_with(name, "blend-") )
|
||||||
return (void)(_attributes_dirty |= BLEND_FUNC);
|
return (void)(_attributes_dirty |= BLEND_FUNC);
|
||||||
}
|
}
|
||||||
else if( parent
|
else if( parent
|
||||||
@@ -564,6 +536,10 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Element::setClip(const std::string& clip)
|
void Element::setClip(const std::string& clip)
|
||||||
{
|
{
|
||||||
|
if( !_scene_group )
|
||||||
|
// TODO warn?
|
||||||
|
return;
|
||||||
|
|
||||||
osg::StateSet* ss = getOrCreateStateSet();
|
osg::StateSet* ss = getOrCreateStateSet();
|
||||||
if( !ss )
|
if( !ss )
|
||||||
return;
|
return;
|
||||||
@@ -577,8 +553,8 @@ namespace canvas
|
|||||||
|
|
||||||
// TODO generalize CSS property parsing
|
// TODO generalize CSS property parsing
|
||||||
const std::string RECT("rect(");
|
const std::string RECT("rect(");
|
||||||
if( !boost::ends_with(clip, ")")
|
if( !strutils::ends_with(clip, ")")
|
||||||
|| !boost::starts_with(clip, RECT) )
|
|| !strutils::starts_with(clip, RECT) )
|
||||||
{
|
{
|
||||||
SG_LOG(SG_GENERAL, SG_WARN, "Canvas: invalid clip: " << clip);
|
SG_LOG(SG_GENERAL, SG_WARN, "Canvas: invalid clip: " << clip);
|
||||||
return;
|
return;
|
||||||
@@ -618,7 +594,7 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !_scissor )
|
if( !_scissor )
|
||||||
_scissor = new RelativeScissor(_transform.get());
|
_scissor = new RelativeScissor(_scene_group.get());
|
||||||
|
|
||||||
// <top>, <right>, <bottom>, <left>
|
// <top>, <right>, <bottom>, <left>
|
||||||
_scissor->x() = values[3];
|
_scissor->x() = values[3];
|
||||||
@@ -675,8 +651,8 @@ namespace canvas
|
|||||||
|
|
||||||
osg::BoundingBox bb;
|
osg::BoundingBox bb;
|
||||||
|
|
||||||
if( _transform.valid() )
|
if( _scene_group.valid() )
|
||||||
bb.expandBy(_transform->getBound());
|
bb.expandBy( _scene_group->getBound() );
|
||||||
|
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
@@ -710,73 +686,11 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::Matrix Element::getMatrix() const
|
osg::Matrix Element::getMatrix() const
|
||||||
{
|
{
|
||||||
if( !_transform )
|
if( !_scene_group )
|
||||||
return osg::Matrix::identity();
|
return osg::Matrix::identity();
|
||||||
|
|
||||||
if( !(_attributes_dirty & TRANSFORM) )
|
updateMatrix();
|
||||||
return _transform->getMatrix();
|
return _scene_group->getMatrix();
|
||||||
|
|
||||||
osg::Matrix m;
|
|
||||||
for( size_t i = 0; i < _transform_types.size(); ++i )
|
|
||||||
{
|
|
||||||
// Skip unused indizes...
|
|
||||||
if( _transform_types[i] == TT_NONE )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SGPropertyNode* tf_node = _node->getChild("tf", i, true);
|
|
||||||
if (!tf_node->getBoolValue("enabled", true)) {
|
|
||||||
continue; // skip disabled transforms
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build up the matrix representation of the current transform node
|
|
||||||
osg::Matrix tf;
|
|
||||||
switch( _transform_types[i] )
|
|
||||||
{
|
|
||||||
case TT_MATRIX:
|
|
||||||
tf = osg::Matrix( tf_node->getDoubleValue("m[0]", 1),
|
|
||||||
tf_node->getDoubleValue("m[1]", 0),
|
|
||||||
0,
|
|
||||||
tf_node->getDoubleValue("m[6]", 0),
|
|
||||||
|
|
||||||
tf_node->getDoubleValue("m[2]", 0),
|
|
||||||
tf_node->getDoubleValue("m[3]", 1),
|
|
||||||
0,
|
|
||||||
tf_node->getDoubleValue("m[7]", 0),
|
|
||||||
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
|
|
||||||
tf_node->getDoubleValue("m[4]", 0),
|
|
||||||
tf_node->getDoubleValue("m[5]", 0),
|
|
||||||
0,
|
|
||||||
tf_node->getDoubleValue("m[8]", 1) );
|
|
||||||
break;
|
|
||||||
case TT_TRANSLATE:
|
|
||||||
tf.makeTranslate( osg::Vec3f( tf_node->getDoubleValue("t[0]", 0),
|
|
||||||
tf_node->getDoubleValue("t[1]", 0),
|
|
||||||
0 ) );
|
|
||||||
break;
|
|
||||||
case TT_ROTATE:
|
|
||||||
tf.makeRotate( tf_node->getDoubleValue("rot", 0), 0, 0, 1 );
|
|
||||||
break;
|
|
||||||
case TT_SCALE:
|
|
||||||
{
|
|
||||||
float sx = tf_node->getDoubleValue("s[0]", 1);
|
|
||||||
// sy defaults to sx...
|
|
||||||
tf.makeScale( sx, tf_node->getDoubleValue("s[1]", sx), 1 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m.postMult( tf );
|
|
||||||
}
|
|
||||||
_transform->setMatrix(m);
|
|
||||||
_attributes_dirty &= ~TRANSFORM;
|
|
||||||
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -790,11 +704,8 @@ namespace canvas
|
|||||||
PropertyBasedElement(node),
|
PropertyBasedElement(node),
|
||||||
_canvas( canvas ),
|
_canvas( canvas ),
|
||||||
_parent( parent ),
|
_parent( parent ),
|
||||||
_attributes_dirty( 0 ),
|
_scene_group( new osg::MatrixTransform ),
|
||||||
_transform( new osg::MatrixTransform ),
|
_style( parent_style )
|
||||||
_style( parent_style ),
|
|
||||||
_scissor( 0 ),
|
|
||||||
_drawable( 0 )
|
|
||||||
{
|
{
|
||||||
staticInit();
|
staticInit();
|
||||||
|
|
||||||
@@ -806,15 +717,15 @@ namespace canvas
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Ensure elements are drawn in order they appear in the element tree
|
// Ensure elements are drawn in order they appear in the element tree
|
||||||
_transform->getOrCreateStateSet()
|
_scene_group
|
||||||
->setRenderBinDetails
|
->getOrCreateStateSet()
|
||||||
(
|
->setRenderBinDetails(
|
||||||
0,
|
0,
|
||||||
"PreOrderBin",
|
"PreOrderBin",
|
||||||
osg::StateSet::OVERRIDE_RENDERBIN_DETAILS
|
osg::StateSet::OVERRIDE_RENDERBIN_DETAILS
|
||||||
);
|
);
|
||||||
|
|
||||||
_transform->setUserData( new OSGUserData(this) );
|
_scene_group->setUserData( new OSGUserData(this) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -902,11 +813,21 @@ namespace canvas
|
|||||||
void Element::setDrawable( osg::Drawable* drawable )
|
void Element::setDrawable( osg::Drawable* drawable )
|
||||||
{
|
{
|
||||||
_drawable = drawable;
|
_drawable = drawable;
|
||||||
assert( _drawable );
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
if( !_drawable )
|
||||||
|
{
|
||||||
|
SG_LOG(SG_GL, SG_WARN, "canvas::Element::setDrawable: NULL drawable");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( !_scene_group )
|
||||||
|
{
|
||||||
|
SG_LOG(SG_GL, SG_WARN, "canvas::Element::setDrawable: NULL scenegroup");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto geode = new osg::Geode;
|
||||||
geode->addDrawable(_drawable);
|
geode->addDrawable(_drawable);
|
||||||
_transform->addChild(geode);
|
_scene_group->addChild(geode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -914,18 +835,109 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
if( _drawable.valid() )
|
if( _drawable.valid() )
|
||||||
return _drawable->getOrCreateStateSet();
|
return _drawable->getOrCreateStateSet();
|
||||||
if( _transform.valid() )
|
else if( _scene_group.valid() )
|
||||||
return _transform->getOrCreateStateSet();
|
return _scene_group->getOrCreateStateSet();
|
||||||
|
else
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Element::setupStyle()
|
void Element::setupStyle()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( Style::value_type style, _style )
|
for(auto const& style: _style)
|
||||||
setStyle(style.second);
|
setStyle(style.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Element::updateMatrix() const
|
||||||
|
{
|
||||||
|
if( !(_attributes_dirty & TRANSFORM) || !_scene_group )
|
||||||
|
return;
|
||||||
|
|
||||||
|
osg::Matrix m;
|
||||||
|
for( size_t i = 0; i < _transform_types.size(); ++i )
|
||||||
|
{
|
||||||
|
// Skip unused indizes...
|
||||||
|
if( _transform_types[i] == TT_NONE )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
SGPropertyNode* tf_node = _node->getChild("tf", i, true);
|
||||||
|
if (!tf_node->getBoolValue("enabled", true)) {
|
||||||
|
continue; // skip disabled transforms
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build up the matrix representation of the current transform node
|
||||||
|
osg::Matrix tf;
|
||||||
|
switch( _transform_types[i] )
|
||||||
|
{
|
||||||
|
case TT_MATRIX:
|
||||||
|
tf = osg::Matrix( tf_node->getDoubleValue("m[0]", 1),
|
||||||
|
tf_node->getDoubleValue("m[1]", 0),
|
||||||
|
0,
|
||||||
|
tf_node->getDoubleValue("m[6]", 0),
|
||||||
|
|
||||||
|
tf_node->getDoubleValue("m[2]", 0),
|
||||||
|
tf_node->getDoubleValue("m[3]", 1),
|
||||||
|
0,
|
||||||
|
tf_node->getDoubleValue("m[7]", 0),
|
||||||
|
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
|
||||||
|
tf_node->getDoubleValue("m[4]", 0),
|
||||||
|
tf_node->getDoubleValue("m[5]", 0),
|
||||||
|
0,
|
||||||
|
tf_node->getDoubleValue("m[8]", 1) );
|
||||||
|
break;
|
||||||
|
case TT_TRANSLATE:
|
||||||
|
tf.makeTranslate( osg::Vec3f( tf_node->getDoubleValue("t[0]", 0),
|
||||||
|
tf_node->getDoubleValue("t[1]", 0),
|
||||||
|
0 ) );
|
||||||
|
break;
|
||||||
|
case TT_ROTATE:
|
||||||
|
tf.makeRotate( tf_node->getDoubleValue("rot", 0), 0, 0, 1 );
|
||||||
|
break;
|
||||||
|
case TT_SCALE:
|
||||||
|
{
|
||||||
|
float sx = tf_node->getDoubleValue("s[0]", 1);
|
||||||
|
// sy defaults to sx...
|
||||||
|
tf.makeScale( sx, tf_node->getDoubleValue("s[1]", sx), 1 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m.postMult( tf );
|
||||||
|
}
|
||||||
|
_scene_group->setMatrix(m);
|
||||||
|
_attributes_dirty &= ~TRANSFORM;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Element::updateImpl(double dt)
|
||||||
|
{
|
||||||
|
updateMatrix();
|
||||||
|
|
||||||
|
// Update bounding box on manual update (manual updates pass zero dt)
|
||||||
|
if( dt == 0 && _drawable )
|
||||||
|
_drawable->getBound();
|
||||||
|
|
||||||
|
if( (_attributes_dirty & BLEND_FUNC) )
|
||||||
|
{
|
||||||
|
parseBlendFunc(
|
||||||
|
_scene_group->getOrCreateStateSet(),
|
||||||
|
_node->getChild("blend-source"),
|
||||||
|
_node->getChild("blend-destination"),
|
||||||
|
_node->getChild("blend-source-rgb"),
|
||||||
|
_node->getChild("blend-destination-rgb"),
|
||||||
|
_node->getChild("blend-source-alpha"),
|
||||||
|
_node->getChild("blend-destination-alpha")
|
||||||
|
);
|
||||||
|
_attributes_dirty &= ~BLEND_FUNC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
} // namespace simgear
|
} // namespace simgear
|
||||||
|
|||||||
@@ -24,14 +24,11 @@
|
|||||||
#include <simgear/canvas/CanvasEvent.hxx>
|
#include <simgear/canvas/CanvasEvent.hxx>
|
||||||
#include <simgear/props/PropertyBasedElement.hxx>
|
#include <simgear/props/PropertyBasedElement.hxx>
|
||||||
#include <simgear/misc/stdint.hxx> // for uint32_t
|
#include <simgear/misc/stdint.hxx> // for uint32_t
|
||||||
|
#include <simgear/std/type_traits.hxx>
|
||||||
|
|
||||||
#include <osg/BoundingBox>
|
#include <osg/BoundingBox>
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
#include <boost/function.hpp>
|
|
||||||
#include <boost/type_traits/is_base_of.hpp>
|
|
||||||
|
|
||||||
namespace osg
|
namespace osg
|
||||||
{
|
{
|
||||||
class Drawable;
|
class Drawable;
|
||||||
@@ -49,6 +46,7 @@ namespace canvas
|
|||||||
public PropertyBasedElement
|
public PropertyBasedElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using SceneGroupWeakPtr = osg::observer_ptr<osg::MatrixTransform>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store pointer to window as user data
|
* Store pointer to window as user data
|
||||||
@@ -61,9 +59,9 @@ namespace canvas
|
|||||||
OSGUserData(ElementPtr element);
|
OSGUserData(ElementPtr element);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::function<bool(Element&, const SGPropertyNode*)>
|
typedef std::function<bool(Element&, const SGPropertyNode*)>
|
||||||
StyleSetterFunc;
|
StyleSetterFunc;
|
||||||
typedef boost::function<void(Element&, const SGPropertyNode*)>
|
typedef std::function<void(Element&, const SGPropertyNode*)>
|
||||||
StyleSetterFuncUnchecked;
|
StyleSetterFuncUnchecked;
|
||||||
struct StyleSetter:
|
struct StyleSetter:
|
||||||
public SGReferenced
|
public SGReferenced
|
||||||
@@ -94,7 +92,7 @@ namespace canvas
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual ~Element() = 0;
|
virtual ~Element() = 0;
|
||||||
virtual void onDestroy();
|
void onDestroy() override;
|
||||||
|
|
||||||
ElementPtr getParent() const;
|
ElementPtr getParent() const;
|
||||||
CanvasWeakPtr getCanvas() const;
|
CanvasWeakPtr getCanvas() const;
|
||||||
@@ -104,7 +102,7 @@ namespace canvas
|
|||||||
*
|
*
|
||||||
* @param dt Frame time in seconds
|
* @param dt Frame time in seconds
|
||||||
*/
|
*/
|
||||||
virtual void update(double dt);
|
void update(double dt) override;
|
||||||
|
|
||||||
bool addEventListener(const std::string& type, const EventListener& cb);
|
bool addEventListener(const std::string& type, const EventListener& cb);
|
||||||
virtual void clearEventListener();
|
virtual void clearEventListener();
|
||||||
@@ -142,19 +140,20 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
virtual bool isVisible() const;
|
virtual bool isVisible() const;
|
||||||
|
|
||||||
osg::MatrixTransform* getMatrixTransform();
|
/**
|
||||||
osg::MatrixTransform const* getMatrixTransform() const;
|
* Get the according group in the OSG scene graph
|
||||||
|
*/
|
||||||
|
// TODO ref_ptr
|
||||||
|
osg::MatrixTransform* getSceneGroup() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform position to local coordinages.
|
* Transform position to local coordinages.
|
||||||
*/
|
*/
|
||||||
osg::Vec2f posToLocal(const osg::Vec2f& pos) const;
|
osg::Vec2f posToLocal(const osg::Vec2f& pos) const;
|
||||||
|
|
||||||
virtual void childAdded( SGPropertyNode * parent,
|
void childAdded(SGPropertyNode* parent, SGPropertyNode* child) override;
|
||||||
SGPropertyNode * child );
|
void childRemoved(SGPropertyNode* parent, SGPropertyNode* child) override;
|
||||||
virtual void childRemoved( SGPropertyNode * parent,
|
void valueChanged(SGPropertyNode* child) override;
|
||||||
SGPropertyNode * child );
|
|
||||||
virtual void valueChanged(SGPropertyNode * child);
|
|
||||||
|
|
||||||
virtual bool setStyle( const SGPropertyNode* child,
|
virtual bool setStyle( const SGPropertyNode* child,
|
||||||
const StyleInfo* style_info = 0 );
|
const StyleInfo* style_info = 0 );
|
||||||
@@ -217,10 +216,11 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
static
|
static
|
||||||
typename boost::enable_if<
|
std::enable_if_t<
|
||||||
boost::is_base_of<Element, Derived>,
|
std::is_base_of<Element, Derived>::value,
|
||||||
ElementPtr
|
ElementPtr
|
||||||
>::type create( const CanvasWeakPtr& canvas,
|
>
|
||||||
|
create( const CanvasWeakPtr& canvas,
|
||||||
const SGPropertyNode_ptr& node,
|
const SGPropertyNode_ptr& node,
|
||||||
const Style& style = Style(),
|
const Style& style = Style(),
|
||||||
Element* parent = NULL )
|
Element* parent = NULL )
|
||||||
@@ -251,13 +251,13 @@ namespace canvas
|
|||||||
CanvasWeakPtr _canvas;
|
CanvasWeakPtr _canvas;
|
||||||
ElementWeakPtr _parent;
|
ElementWeakPtr _parent;
|
||||||
|
|
||||||
mutable uint32_t _attributes_dirty;
|
mutable uint32_t _attributes_dirty = 0;
|
||||||
|
|
||||||
osg::observer_ptr<osg::MatrixTransform> _transform;
|
SceneGroupWeakPtr _scene_group;
|
||||||
std::vector<TransformType> _transform_types;
|
std::vector<TransformType> _transform_types;
|
||||||
|
|
||||||
Style _style;
|
Style _style;
|
||||||
RelativeScissor *_scissor;
|
RelativeScissor *_scissor = nullptr;
|
||||||
|
|
||||||
typedef std::vector<EventListener> Listener;
|
typedef std::vector<EventListener> Listener;
|
||||||
typedef std::map<int, Listener> ListenerMap;
|
typedef std::map<int, Listener> ListenerMap;
|
||||||
@@ -316,7 +316,7 @@ namespace canvas
|
|||||||
StyleSetter
|
StyleSetter
|
||||||
addStyle( const std::string& name,
|
addStyle( const std::string& name,
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const boost::function<void (Derived&, T2)>& setter,
|
const std::function<void (Derived&, T2)>& setter,
|
||||||
bool inheritable = true )
|
bool inheritable = true )
|
||||||
{
|
{
|
||||||
StyleInfo& style_info = _style_setters[ name ];
|
StyleInfo& style_info = _style_setters[ name ];
|
||||||
@@ -342,13 +342,10 @@ namespace canvas
|
|||||||
if( style->func )
|
if( style->func )
|
||||||
style = style->next = new StyleSetter;
|
style = style->next = new StyleSetter;
|
||||||
|
|
||||||
style->func = boost::bind
|
style->func = std::bind(&type_match<Derived>::call,
|
||||||
(
|
std::placeholders::_1,
|
||||||
&type_match<Derived>::call,
|
std::placeholders::_2,
|
||||||
_1,
|
bindStyleSetter<T1>(name, setter));
|
||||||
_2,
|
|
||||||
bindStyleSetter<T1>(name, setter)
|
|
||||||
);
|
|
||||||
return *style;
|
return *style;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +357,7 @@ namespace canvas
|
|||||||
StyleSetter
|
StyleSetter
|
||||||
addStyle( const std::string& name,
|
addStyle( const std::string& name,
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const boost::function<void (Derived&, T)>& setter,
|
const std::function<void (Derived&, T)>& setter,
|
||||||
bool inheritable = true )
|
bool inheritable = true )
|
||||||
{
|
{
|
||||||
return addStyle<T, T>(name, type, setter, inheritable);
|
return addStyle<T, T>(name, type, setter, inheritable);
|
||||||
@@ -381,7 +378,7 @@ namespace canvas
|
|||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
boost::function<void (Derived&, T)>(setter),
|
std::function<void (Derived&, T)>(setter),
|
||||||
inheritable
|
inheritable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -402,7 +399,7 @@ namespace canvas
|
|||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
boost::function<void (Derived&, T2)>(setter),
|
std::function<void (Derived&, T2)>(setter),
|
||||||
inheritable
|
inheritable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -421,7 +418,7 @@ namespace canvas
|
|||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
boost::function<void (Derived&, const std::string&)>(setter),
|
std::function<void (Derived&, const std::string&)>(setter),
|
||||||
inheritable
|
inheritable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -484,7 +481,7 @@ namespace canvas
|
|||||||
StyleSetter
|
StyleSetter
|
||||||
addStyle( const std::string& name,
|
addStyle( const std::string& name,
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const boost::function<void (Other&, T2)>& setter,
|
const std::function<void (Other&, T2)>& setter,
|
||||||
OtherRef Derived::*instance_ref,
|
OtherRef Derived::*instance_ref,
|
||||||
bool inheritable = true )
|
bool inheritable = true )
|
||||||
{
|
{
|
||||||
@@ -514,7 +511,7 @@ namespace canvas
|
|||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
boost::function<void (Other&, const std::string&)>(setter),
|
std::function<void (Other&, const std::string&)>(setter),
|
||||||
instance_ref,
|
instance_ref,
|
||||||
inheritable
|
inheritable
|
||||||
);
|
);
|
||||||
@@ -522,44 +519,37 @@ namespace canvas
|
|||||||
|
|
||||||
template<typename T, class Derived, class Other, class OtherRef>
|
template<typename T, class Derived, class Other, class OtherRef>
|
||||||
static
|
static
|
||||||
boost::function<void (Derived&, T)>
|
std::function<void (Derived&, T)>
|
||||||
bindOther( void (Other::*setter)(T), OtherRef Derived::*instance_ref )
|
bindOther( void (Other::*setter)(T), OtherRef Derived::*instance_ref )
|
||||||
{
|
{
|
||||||
return boost::bind(setter, boost::bind(instance_ref, _1), _2);
|
return std::bind(setter,
|
||||||
|
std::bind(instance_ref, std::placeholders::_1),
|
||||||
|
std::placeholders::_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, class Derived, class Other, class OtherRef>
|
template<typename T, class Derived, class Other, class OtherRef>
|
||||||
static
|
static
|
||||||
boost::function<void (Derived&, T)>
|
std::function<void (Derived&, T)>
|
||||||
bindOther( const boost::function<void (Other&, T)>& setter,
|
bindOther( const std::function<void (Other&, T)>& setter,
|
||||||
OtherRef Derived::*instance_ref )
|
OtherRef Derived::*instance_ref )
|
||||||
{
|
{
|
||||||
return boost::bind
|
return std::bind(setter,
|
||||||
(
|
std::bind(&reference_from_pointer<Other, OtherRef>,
|
||||||
setter,
|
std::bind(instance_ref, std::placeholders::_1)),
|
||||||
boost::bind
|
std::placeholders::_2);
|
||||||
(
|
|
||||||
&reference_from_pointer<Other, OtherRef>,
|
|
||||||
boost::bind(instance_ref, _1)
|
|
||||||
),
|
|
||||||
_2
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2, class Derived>
|
template<typename T1, typename T2, class Derived>
|
||||||
static
|
static
|
||||||
StyleSetterFuncUnchecked
|
StyleSetterFuncUnchecked
|
||||||
bindStyleSetter( const std::string& name,
|
bindStyleSetter( const std::string& name,
|
||||||
const boost::function<void (Derived&, T2)>& setter )
|
const std::function<void (Derived&, T2)>& setter )
|
||||||
{
|
{
|
||||||
return boost::bind
|
return std::bind(setter,
|
||||||
(
|
|
||||||
setter,
|
|
||||||
// We will only call setters with Derived instances, so we can safely
|
// We will only call setters with Derived instances, so we can safely
|
||||||
// cast here.
|
// cast here.
|
||||||
boost::bind(&derived_cast<Derived>, _1),
|
std::bind(&derived_cast<Derived>, std::placeholders::_1),
|
||||||
boost::bind(&getValue<T1>, _2)
|
std::bind(&getValue<T1>, std::placeholders::_2));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isStyleEmpty(const SGPropertyNode* child) const;
|
bool isStyleEmpty(const SGPropertyNode* child) const;
|
||||||
@@ -584,11 +574,15 @@ namespace canvas
|
|||||||
|
|
||||||
void setupStyle();
|
void setupStyle();
|
||||||
|
|
||||||
|
void updateMatrix() const;
|
||||||
|
|
||||||
|
virtual void updateImpl(double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
osg::ref_ptr<osg::Drawable> _drawable;
|
osg::ref_ptr<osg::Drawable> _drawable;
|
||||||
|
|
||||||
Element(const Element&);// = delete
|
Element(const Element&) = delete;
|
||||||
|
|
||||||
template<class Derived>
|
template<class Derived>
|
||||||
static Derived& derived_cast(Element& el)
|
static Derived& derived_cast(Element& el)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// A group of 2D Canvas elements
|
///@file
|
||||||
|
/// A group of 2D Canvas elements
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -23,13 +24,10 @@
|
|||||||
#include "CanvasMap.hxx"
|
#include "CanvasMap.hxx"
|
||||||
#include "CanvasPath.hxx"
|
#include "CanvasPath.hxx"
|
||||||
#include "CanvasText.hxx"
|
#include "CanvasText.hxx"
|
||||||
|
|
||||||
#include <simgear/canvas/CanvasEventVisitor.hxx>
|
#include <simgear/canvas/CanvasEventVisitor.hxx>
|
||||||
#include <simgear/canvas/events/MouseEvent.hxx>
|
#include <simgear/canvas/events/MouseEvent.hxx>
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/lambda/core.hpp>
|
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
namespace canvas
|
namespace canvas
|
||||||
@@ -48,7 +46,7 @@ namespace canvas
|
|||||||
ElementFactories Group::_child_factories;
|
ElementFactories Group::_child_factories;
|
||||||
const std::string Group::TYPE_NAME = "group";
|
const std::string Group::TYPE_NAME = "group";
|
||||||
|
|
||||||
void warnTransformExpired(const char* member_name)
|
void warnSceneGroupExpired(const char* member_name)
|
||||||
{
|
{
|
||||||
SG_LOG( SG_GENERAL,
|
SG_LOG( SG_GENERAL,
|
||||||
SG_WARN,
|
SG_WARN,
|
||||||
@@ -135,64 +133,59 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ElementPtr Group::getElementById(const std::string& id)
|
ElementPtr Group::getElementById(const std::string& id)
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
{
|
{
|
||||||
warnTransformExpired("getElementById");
|
warnSceneGroupExpired("getElementById");
|
||||||
return ElementPtr();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<GroupPtr> groups;
|
// TODO check search algorithm. Not completely breadth-first and might be
|
||||||
for(size_t i = 0; i < _transform->getNumChildren(); ++i)
|
// possible with using less dynamic memory
|
||||||
|
std::vector<GroupPtr> child_groups;
|
||||||
|
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
|
||||||
{
|
{
|
||||||
const ElementPtr& el = getChildByIndex(i);
|
const ElementPtr& el = getChildByIndex(i);
|
||||||
if( el->get<std::string>("id") == id )
|
if( el->get<std::string>("id") == id )
|
||||||
return el;
|
return el;
|
||||||
|
|
||||||
Group* group = dynamic_cast<Group*>(el.get());
|
if( Group* child_group = dynamic_cast<Group*>(el.get()) )
|
||||||
if( group )
|
child_groups.push_back(child_group);
|
||||||
groups.push_back(group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH( GroupPtr group, groups )
|
for(auto group: child_groups)
|
||||||
{
|
{
|
||||||
ElementPtr el = group->getElementById(id);
|
if( ElementPtr el = group->getElementById(id) )
|
||||||
if( el )
|
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ElementPtr();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Group::clearEventListener()
|
void Group::clearEventListener()
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
|
||||||
return warnTransformExpired("clearEventListener");
|
|
||||||
|
|
||||||
for(size_t i = 0; i < _transform->getNumChildren(); ++i)
|
|
||||||
getChildByIndex(i)->clearEventListener();
|
|
||||||
|
|
||||||
Element::clearEventListener();
|
Element::clearEventListener();
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
if( !_scene_group.valid() )
|
||||||
void Group::update(double dt)
|
return warnSceneGroupExpired("clearEventListener");
|
||||||
{
|
|
||||||
for(size_t i = 0; i < _transform->getNumChildren(); ++i)
|
|
||||||
getChildByIndex(i)->update(dt);
|
|
||||||
|
|
||||||
Element::update(dt);
|
// TODO should this be recursive?
|
||||||
|
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
|
||||||
|
getChildByIndex(i)->clearEventListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool Group::traverse(EventVisitor& visitor)
|
bool Group::traverse(EventVisitor& visitor)
|
||||||
|
{
|
||||||
|
if( _scene_group.valid() )
|
||||||
{
|
{
|
||||||
// Iterate in reverse order as last child is displayed on top
|
// Iterate in reverse order as last child is displayed on top
|
||||||
for(size_t i = _transform->getNumChildren(); i --> 0;)
|
for(size_t i = _scene_group->getNumChildren(); i --> 0;)
|
||||||
{
|
{
|
||||||
if( getChildByIndex(i)->accept(visitor) )
|
if( getChildByIndex(i)->accept(visitor) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,13 +199,13 @@ namespace canvas
|
|||||||
bool handled = setStyleImpl(style, style_info);
|
bool handled = setStyleImpl(style, style_info);
|
||||||
if( style_info->inheritable )
|
if( style_info->inheritable )
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
{
|
{
|
||||||
warnTransformExpired("setStyle");
|
warnSceneGroupExpired("setStyle");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0; i < _transform->getNumChildren(); ++i)
|
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
|
||||||
handled |= getChildByIndex(i)->setStyle(style, style_info);
|
handled |= getChildByIndex(i)->setStyle(style, style_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,26 +215,20 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::BoundingBox Group::getTransformedBounds(const osg::Matrix& m) const
|
osg::BoundingBox Group::getTransformedBounds(const osg::Matrix& m) const
|
||||||
{
|
{
|
||||||
osg::BoundingBox bb;
|
if( !_scene_group.valid() )
|
||||||
if( !_transform.valid() )
|
|
||||||
{
|
{
|
||||||
warnTransformExpired("getTransformedBounds");
|
warnSceneGroupExpired("getTransformedBounds");
|
||||||
return bb;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0; i < _transform->getNumChildren(); ++i)
|
osg::BoundingBox bb;
|
||||||
|
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
|
||||||
{
|
{
|
||||||
const ElementPtr& child = getChildByIndex(i);
|
auto child = getChildByIndex(i);
|
||||||
if( !child->getMatrixTransform()->getNodeMask() )
|
if( !child || !child->isVisible() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bb.expandBy
|
bb.expandBy( child->getTransformedBounds(child->getMatrix() * m) );
|
||||||
(
|
|
||||||
child->getTransformedBounds
|
|
||||||
(
|
|
||||||
child->getMatrixTransform()->getMatrix() * m
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bb;
|
return bb;
|
||||||
@@ -257,6 +244,15 @@ namespace canvas
|
|||||||
return ElementFactory();
|
return ElementFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Group::updateImpl(double dt)
|
||||||
|
{
|
||||||
|
Element::updateImpl(dt);
|
||||||
|
|
||||||
|
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
|
||||||
|
getChildByIndex(i)->update(dt);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Group::childAdded(SGPropertyNode* child)
|
void Group::childAdded(SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
@@ -266,13 +262,13 @@ namespace canvas
|
|||||||
ElementFactory child_factory = getChildFactory( child->getNameString() );
|
ElementFactory child_factory = getChildFactory( child->getNameString() );
|
||||||
if( child_factory )
|
if( child_factory )
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
return warnTransformExpired("childAdded");
|
return warnSceneGroupExpired("childAdded");
|
||||||
|
|
||||||
ElementPtr element = child_factory(_canvas, child, _style, this);
|
ElementPtr element = child_factory(_canvas, child, _style, this);
|
||||||
|
|
||||||
// Add to osg scene graph...
|
// Add to osg scene graph...
|
||||||
_transform->addChild( element->getMatrixTransform() );
|
_scene_group->addChild(element->getSceneGroup());
|
||||||
|
|
||||||
// ...and ensure correct ordering
|
// ...and ensure correct ordering
|
||||||
handleZIndexChanged(element);
|
handleZIndexChanged(element);
|
||||||
@@ -293,7 +289,7 @@ namespace canvas
|
|||||||
|
|
||||||
if( getChildFactory(node->getNameString()) )
|
if( getChildFactory(node->getNameString()) )
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
// If transform is destroyed also all children are destroyed, so we can
|
// If transform is destroyed also all children are destroyed, so we can
|
||||||
// not do anything here.
|
// not do anything here.
|
||||||
return;
|
return;
|
||||||
@@ -323,7 +319,7 @@ namespace canvas
|
|||||||
void Group::childChanged(SGPropertyNode* node)
|
void Group::childChanged(SGPropertyNode* node)
|
||||||
{
|
{
|
||||||
SGPropertyNode* parent = node->getParent();
|
SGPropertyNode* parent = node->getParent();
|
||||||
SGPropertyNode* grand_parent = parent ? parent->getParent() : NULL;
|
SGPropertyNode* grand_parent = parent ? parent->getParent() : nullptr;
|
||||||
|
|
||||||
if( grand_parent == _node
|
if( grand_parent == _node
|
||||||
&& node->getNameString() == "z-index" )
|
&& node->getNameString() == "z-index" )
|
||||||
@@ -333,16 +329,18 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Group::handleZIndexChanged(ElementPtr child, int z_index)
|
void Group::handleZIndexChanged(ElementPtr child, int z_index)
|
||||||
{
|
{
|
||||||
if( !child || !_transform.valid() )
|
if( !child || !_scene_group.valid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
osg::ref_ptr<osg::MatrixTransform> tf = child->getMatrixTransform();
|
// Keep reference to prevent deleting while removing and re-inserting later
|
||||||
size_t index = _transform->getChildIndex(tf),
|
osg::ref_ptr<osg::MatrixTransform> tf = child->getSceneGroup();
|
||||||
|
|
||||||
|
size_t index = _scene_group->getChildIndex(tf),
|
||||||
index_new = index;
|
index_new = index;
|
||||||
|
|
||||||
for(;; ++index_new)
|
for(;; ++index_new)
|
||||||
{
|
{
|
||||||
if( index_new + 1 == _transform->getNumChildren() )
|
if( index_new + 1 == _scene_group->getNumChildren() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Move to end of block with same index (= move upwards until the next
|
// Move to end of block with same index (= move upwards until the next
|
||||||
@@ -369,8 +367,8 @@ namespace canvas
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_transform->removeChild(index);
|
_scene_group->removeChild(index);
|
||||||
_transform->insertChild(index_new, tf);
|
_scene_group->insertChild(index_new, tf);
|
||||||
|
|
||||||
SG_LOG
|
SG_LOG
|
||||||
(
|
(
|
||||||
@@ -383,24 +381,27 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ElementPtr Group::getChildByIndex(size_t index) const
|
ElementPtr Group::getChildByIndex(size_t index) const
|
||||||
{
|
{
|
||||||
assert(_transform.valid());
|
assert( _scene_group.valid() );
|
||||||
OSGUserData* ud =
|
|
||||||
static_cast<OSGUserData*>(_transform->getChild(index)->getUserData());
|
auto child = _scene_group->getChild(index);
|
||||||
assert(ud);
|
if( !child )
|
||||||
return ud->element;
|
return {};
|
||||||
|
|
||||||
|
auto ud = static_cast<OSGUserData*>(child->getUserData());
|
||||||
|
return ud ? ud->element : ElementPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
ElementPtr Group::findChild( const SGPropertyNode* node,
|
ElementPtr Group::findChild( const SGPropertyNode* node,
|
||||||
const std::string& id ) const
|
const std::string& id ) const
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
{
|
{
|
||||||
warnTransformExpired("findChild");
|
warnSceneGroupExpired("findChild");
|
||||||
return ElementPtr();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
for(size_t i = 0; i < _transform->getNumChildren(); ++i)
|
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
|
||||||
{
|
{
|
||||||
ElementPtr el = getChildByIndex(i);
|
ElementPtr el = getChildByIndex(i);
|
||||||
|
|
||||||
@@ -416,7 +417,7 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ElementPtr();
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// A group of 2D Canvas elements
|
///@file
|
||||||
|
/// A group of 2D Canvas elements
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -86,16 +87,15 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
ElementPtr getElementById(const std::string& id);
|
ElementPtr getElementById(const std::string& id);
|
||||||
|
|
||||||
virtual void clearEventListener();
|
void clearEventListener() override;
|
||||||
|
|
||||||
virtual void update(double dt);
|
bool traverse(EventVisitor& visitor) override;
|
||||||
|
|
||||||
virtual bool traverse(EventVisitor& visitor);
|
bool setStyle( const SGPropertyNode* child,
|
||||||
|
const StyleInfo* style_info = 0 ) override;
|
||||||
|
|
||||||
virtual bool setStyle( const SGPropertyNode* child,
|
osg::BoundingBox
|
||||||
const StyleInfo* style_info = 0 );
|
getTransformedBounds(const osg::Matrix& m) const override;
|
||||||
|
|
||||||
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -107,9 +107,11 @@ namespace canvas
|
|||||||
*/
|
*/
|
||||||
virtual ElementFactory getChildFactory(const std::string& type) const;
|
virtual ElementFactory getChildFactory(const std::string& type) const;
|
||||||
|
|
||||||
virtual void childAdded(SGPropertyNode * child);
|
void updateImpl(double dt) override;
|
||||||
virtual void childRemoved(SGPropertyNode * child);
|
|
||||||
virtual void childChanged(SGPropertyNode * child);
|
void childAdded(SGPropertyNode * child) override;
|
||||||
|
void childRemoved(SGPropertyNode * child) override;
|
||||||
|
void childChanged(SGPropertyNode * child) override;
|
||||||
|
|
||||||
void handleZIndexChanged(ElementPtr child, int z_index = 0);
|
void handleZIndexChanged(ElementPtr child, int z_index = 0);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// An image on the Canvas
|
///@file
|
||||||
|
/// An image on the Canvas
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -117,9 +118,7 @@ namespace canvas
|
|||||||
ElementWeakPtr parent ):
|
ElementWeakPtr parent ):
|
||||||
Element(canvas, node, parent_style, parent),
|
Element(canvas, node, parent_style, parent),
|
||||||
_texture(new osg::Texture2D),
|
_texture(new osg::Texture2D),
|
||||||
_node_src_rect( node->getNode("source", 0, true) ),
|
_node_src_rect( node->getNode("source", 0, true) )
|
||||||
_src_rect(0,0),
|
|
||||||
_region(0,0)
|
|
||||||
{
|
{
|
||||||
staticInit();
|
staticInit();
|
||||||
|
|
||||||
@@ -157,22 +156,207 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Image::~Image()
|
Image::~Image()
|
||||||
{
|
{
|
||||||
if( _http_request ) {
|
if( _http_request )
|
||||||
Canvas::getSystemAdapter()->getHTTPClient()->cancelRequest(_http_request, "image destroyed");
|
{
|
||||||
|
Canvas::getSystemAdapter()
|
||||||
|
->getHTTPClient()
|
||||||
|
->cancelRequest(_http_request, "image destroyed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Image::update(double dt)
|
void Image::valueChanged(SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
Element::update(dt);
|
// If the image is switched from invisible to visible, and it shows a
|
||||||
|
// canvas, we need to delay showing it by one frame to ensure the canvas is
|
||||||
|
// updated before the image is displayed.
|
||||||
|
//
|
||||||
|
// As canvas::Element handles and filters changes to the "visible" property
|
||||||
|
// we can not check this in Image::childChanged but instead have to override
|
||||||
|
// Element::valueChanged.
|
||||||
|
if( !isVisible()
|
||||||
|
&& child->getParent() == _node
|
||||||
|
&& child->getNameString() == "visible"
|
||||||
|
&& child->getBoolValue() )
|
||||||
|
{
|
||||||
|
CullCallback* cb =
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||||
|
static_cast<CullCallback*>
|
||||||
|
#else
|
||||||
|
dynamic_cast<CullCallback*>
|
||||||
|
#endif
|
||||||
|
( _geom->getCullCallback() );
|
||||||
|
|
||||||
|
if( cb )
|
||||||
|
cb->cullNextFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
Element::valueChanged(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setSrcCanvas(CanvasPtr canvas)
|
||||||
|
{
|
||||||
|
CanvasPtr src_canvas = _src_canvas.lock(),
|
||||||
|
self_canvas = _canvas.lock();
|
||||||
|
|
||||||
|
if( src_canvas )
|
||||||
|
src_canvas->removeParentCanvas(self_canvas);
|
||||||
|
if( self_canvas )
|
||||||
|
self_canvas->removeChildCanvas(src_canvas);
|
||||||
|
|
||||||
|
_src_canvas = src_canvas = canvas;
|
||||||
|
_attributes_dirty |= SRC_CANVAS;
|
||||||
|
_geom->setCullCallback(canvas ? new CullCallback(canvas) : 0);
|
||||||
|
|
||||||
|
if( src_canvas )
|
||||||
|
{
|
||||||
|
setupDefaultDimensions();
|
||||||
|
|
||||||
|
if( self_canvas )
|
||||||
|
{
|
||||||
|
self_canvas->addChildCanvas(src_canvas);
|
||||||
|
src_canvas->addParentCanvas(self_canvas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CanvasWeakPtr Image::getSrcCanvas() const
|
||||||
|
{
|
||||||
|
return _src_canvas;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setImage(osg::ref_ptr<osg::Image> img)
|
||||||
|
{
|
||||||
|
// remove canvas...
|
||||||
|
setSrcCanvas( CanvasPtr() );
|
||||||
|
|
||||||
|
_texture->setResizeNonPowerOfTwoHint(false);
|
||||||
|
_texture->setImage(img);
|
||||||
|
_texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
||||||
|
_texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
||||||
|
_geom->getOrCreateStateSet()
|
||||||
|
->setTextureAttributeAndModes(0, _texture);
|
||||||
|
|
||||||
|
if( img )
|
||||||
|
setupDefaultDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setFill(const std::string& fill)
|
||||||
|
{
|
||||||
|
osg::Vec4 color(1,1,1,1);
|
||||||
|
if( !fill.empty() // If no color is given default to white
|
||||||
|
&& !parseColor(fill, color) )
|
||||||
|
return;
|
||||||
|
setFill(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setFill(const osg::Vec4& color)
|
||||||
|
{
|
||||||
|
_colors->front() = color;
|
||||||
|
_colors->dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setOutset(const std::string& outset)
|
||||||
|
{
|
||||||
|
_outset = CSSBorder::parse(outset);
|
||||||
|
_attributes_dirty |= DEST_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setPreserveAspectRatio(const std::string& scale)
|
||||||
|
{
|
||||||
|
_preserve_aspect_ratio = SVGpreserveAspectRatio::parse(scale);
|
||||||
|
_attributes_dirty |= SRC_RECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setSourceRect(const SGRect<float>& sourceRect)
|
||||||
|
{
|
||||||
|
_attributes_dirty |= SRC_RECT;
|
||||||
|
_src_rect = sourceRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setSlice(const std::string& slice)
|
||||||
|
{
|
||||||
|
_slice = CSSBorder::parse(slice);
|
||||||
|
_attributes_dirty |= SRC_RECT | DEST_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setSliceWidth(const std::string& width)
|
||||||
|
{
|
||||||
|
_slice_width = CSSBorder::parse(width);
|
||||||
|
_attributes_dirty |= DEST_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
const SGRect<float>& Image::getRegion() const
|
||||||
|
{
|
||||||
|
return _region;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool Image::handleEvent(const EventPtr& event)
|
||||||
|
{
|
||||||
|
bool handled = Element::handleEvent(event);
|
||||||
|
|
||||||
|
CanvasPtr src_canvas = _src_canvas.lock();
|
||||||
|
if( !src_canvas )
|
||||||
|
return handled;
|
||||||
|
|
||||||
|
if( MouseEventPtr mouse_event = dynamic_cast<MouseEvent*>(event.get()) )
|
||||||
|
{
|
||||||
|
mouse_event.reset( new MouseEvent(*mouse_event) );
|
||||||
|
|
||||||
|
mouse_event->client_pos = mouse_event->local_pos
|
||||||
|
- toOsg(_region.getMin());
|
||||||
|
|
||||||
|
osg::Vec2f size(_region.width(), _region.height());
|
||||||
|
if( _outset.isValid() )
|
||||||
|
{
|
||||||
|
CSSBorder::Offsets outset =
|
||||||
|
_outset.getAbsOffsets(getTextureDimensions());
|
||||||
|
|
||||||
|
mouse_event->client_pos += osg::Vec2f(outset.l, outset.t);
|
||||||
|
size.x() += outset.l + outset.r;
|
||||||
|
size.y() += outset.t + outset.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scale event pos according to canvas view size vs. displayed/screen size
|
||||||
|
mouse_event->client_pos.x() *= src_canvas->getViewWidth() / size.x();
|
||||||
|
mouse_event->client_pos.y() *= src_canvas->getViewHeight()/ size.y();
|
||||||
|
mouse_event->local_pos = mouse_event->client_pos;
|
||||||
|
|
||||||
|
handled |= src_canvas->handleMouseEvent(mouse_event);
|
||||||
|
}
|
||||||
|
else if( KeyboardEventPtr keyboard_event =
|
||||||
|
dynamic_cast<KeyboardEvent*>(event.get()) )
|
||||||
|
{
|
||||||
|
handled |= src_canvas->handleKeyboardEvent(keyboard_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::updateImpl(double dt)
|
||||||
|
{
|
||||||
|
Element::updateImpl(dt);
|
||||||
|
|
||||||
osg::Texture2D* texture = dynamic_cast<osg::Texture2D*>
|
osg::Texture2D* texture = dynamic_cast<osg::Texture2D*>
|
||||||
(
|
(
|
||||||
_geom->getOrCreateStateSet()
|
_geom->getOrCreateStateSet()
|
||||||
->getTextureAttribute(0, osg::StateAttribute::TEXTURE)
|
->getTextureAttribute(0, osg::StateAttribute::TEXTURE)
|
||||||
);
|
);
|
||||||
simgear::canvas::CanvasPtr canvas = _src_canvas.lock();
|
auto canvas = _src_canvas.lock();
|
||||||
|
|
||||||
if( (_attributes_dirty & SRC_CANVAS)
|
if( (_attributes_dirty & SRC_CANVAS)
|
||||||
// check if texture has changed (eg. due to resizing)
|
// check if texture has changed (eg. due to resizing)
|
||||||
@@ -402,188 +586,6 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::valueChanged(SGPropertyNode* child)
|
|
||||||
{
|
|
||||||
// If the image is switched from invisible to visible, and it shows a
|
|
||||||
// canvas, we need to delay showing it by one frame to ensure the canvas is
|
|
||||||
// updated before the image is displayed.
|
|
||||||
//
|
|
||||||
// As canvas::Element handles and filters changes to the "visible" property
|
|
||||||
// we can not check this in Image::childChanged but instead have to override
|
|
||||||
// Element::valueChanged.
|
|
||||||
if( !isVisible()
|
|
||||||
&& child->getParent() == _node
|
|
||||||
&& child->getNameString() == "visible"
|
|
||||||
&& child->getBoolValue() )
|
|
||||||
{
|
|
||||||
CullCallback* cb =
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
|
||||||
static_cast<CullCallback*>
|
|
||||||
#else
|
|
||||||
dynamic_cast<CullCallback*>
|
|
||||||
#endif
|
|
||||||
( _geom->getCullCallback() );
|
|
||||||
|
|
||||||
if( cb )
|
|
||||||
cb->cullNextFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
Element::valueChanged(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setSrcCanvas(CanvasPtr canvas)
|
|
||||||
{
|
|
||||||
CanvasPtr src_canvas = _src_canvas.lock(),
|
|
||||||
self_canvas = _canvas.lock();
|
|
||||||
|
|
||||||
if( src_canvas )
|
|
||||||
src_canvas->removeParentCanvas(self_canvas);
|
|
||||||
if( self_canvas )
|
|
||||||
self_canvas->removeChildCanvas(src_canvas);
|
|
||||||
|
|
||||||
_src_canvas = src_canvas = canvas;
|
|
||||||
_attributes_dirty |= SRC_CANVAS;
|
|
||||||
_geom->setCullCallback(canvas ? new CullCallback(canvas) : 0);
|
|
||||||
|
|
||||||
if( src_canvas )
|
|
||||||
{
|
|
||||||
setupDefaultDimensions();
|
|
||||||
|
|
||||||
if( self_canvas )
|
|
||||||
{
|
|
||||||
self_canvas->addChildCanvas(src_canvas);
|
|
||||||
src_canvas->addParentCanvas(self_canvas);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
CanvasWeakPtr Image::getSrcCanvas() const
|
|
||||||
{
|
|
||||||
return _src_canvas;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setImage(osg::ref_ptr<osg::Image> img)
|
|
||||||
{
|
|
||||||
// remove canvas...
|
|
||||||
setSrcCanvas( CanvasPtr() );
|
|
||||||
|
|
||||||
_texture->setResizeNonPowerOfTwoHint(false);
|
|
||||||
_texture->setImage(img);
|
|
||||||
_texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
|
|
||||||
_texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
|
|
||||||
_geom->getOrCreateStateSet()
|
|
||||||
->setTextureAttributeAndModes(0, _texture);
|
|
||||||
|
|
||||||
if( img )
|
|
||||||
setupDefaultDimensions();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setFill(const std::string& fill)
|
|
||||||
{
|
|
||||||
osg::Vec4 color(1,1,1,1);
|
|
||||||
if( !fill.empty() // If no color is given default to white
|
|
||||||
&& !parseColor(fill, color) )
|
|
||||||
return;
|
|
||||||
setFill(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setFill(const osg::Vec4& color)
|
|
||||||
{
|
|
||||||
_colors->front() = color;
|
|
||||||
_colors->dirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setOutset(const std::string& outset)
|
|
||||||
{
|
|
||||||
_outset = CSSBorder::parse(outset);
|
|
||||||
_attributes_dirty |= DEST_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setPreserveAspectRatio(const std::string& scale)
|
|
||||||
{
|
|
||||||
_preserve_aspect_ratio = SVGpreserveAspectRatio::parse(scale);
|
|
||||||
_attributes_dirty |= SRC_RECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setSourceRect(const SGRect<float>& sourceRect)
|
|
||||||
{
|
|
||||||
_attributes_dirty |= SRC_RECT;
|
|
||||||
_src_rect = sourceRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setSlice(const std::string& slice)
|
|
||||||
{
|
|
||||||
_slice = CSSBorder::parse(slice);
|
|
||||||
_attributes_dirty |= SRC_RECT | DEST_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Image::setSliceWidth(const std::string& width)
|
|
||||||
{
|
|
||||||
_slice_width = CSSBorder::parse(width);
|
|
||||||
_attributes_dirty |= DEST_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
const SGRect<float>& Image::getRegion() const
|
|
||||||
{
|
|
||||||
return _region;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool Image::handleEvent(const EventPtr& event)
|
|
||||||
{
|
|
||||||
bool handled = Element::handleEvent(event);
|
|
||||||
|
|
||||||
CanvasPtr src_canvas = _src_canvas.lock();
|
|
||||||
if( !src_canvas )
|
|
||||||
return handled;
|
|
||||||
|
|
||||||
if( MouseEventPtr mouse_event = dynamic_cast<MouseEvent*>(event.get()) )
|
|
||||||
{
|
|
||||||
mouse_event.reset( new MouseEvent(*mouse_event) );
|
|
||||||
|
|
||||||
mouse_event->client_pos = mouse_event->local_pos
|
|
||||||
- toOsg(_region.getMin());
|
|
||||||
|
|
||||||
osg::Vec2f size(_region.width(), _region.height());
|
|
||||||
if( _outset.isValid() )
|
|
||||||
{
|
|
||||||
CSSBorder::Offsets outset =
|
|
||||||
_outset.getAbsOffsets(getTextureDimensions());
|
|
||||||
|
|
||||||
mouse_event->client_pos += osg::Vec2f(outset.l, outset.t);
|
|
||||||
size.x() += outset.l + outset.r;
|
|
||||||
size.y() += outset.t + outset.b;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scale event pos according to canvas view size vs. displayed/screen size
|
|
||||||
mouse_event->client_pos.x() *= src_canvas->getViewWidth() / size.x();
|
|
||||||
mouse_event->client_pos.y() *= src_canvas->getViewHeight()/ size.y();
|
|
||||||
mouse_event->local_pos = mouse_event->client_pos;
|
|
||||||
|
|
||||||
handled |= src_canvas->handleMouseEvent(mouse_event);
|
|
||||||
}
|
|
||||||
else if( KeyboardEventPtr keyboard_event =
|
|
||||||
dynamic_cast<KeyboardEvent*>(event.get()) )
|
|
||||||
{
|
|
||||||
handled |= src_canvas->handleKeyboardEvent(keyboard_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
return handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Image::childChanged(SGPropertyNode* child)
|
void Image::childChanged(SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
@@ -634,7 +636,9 @@ namespace canvas
|
|||||||
// Abort pending request
|
// Abort pending request
|
||||||
if( _http_request )
|
if( _http_request )
|
||||||
{
|
{
|
||||||
Canvas::getSystemAdapter()->getHTTPClient()->cancelRequest(_http_request, "setting new image");
|
Canvas::getSystemAdapter()
|
||||||
|
->getHTTPClient()
|
||||||
|
->cancelRequest(_http_request, "setting new image");
|
||||||
_http_request.reset();
|
_http_request.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -834,5 +838,143 @@ namespace canvas
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Image::fillRect(const SGRect<int>& rect, const std::string& c)
|
||||||
|
{
|
||||||
|
osg::Vec4 color(1,1,1,1);
|
||||||
|
if(!c.empty() && !parseColor(c, color))
|
||||||
|
return;
|
||||||
|
|
||||||
|
fillRect(rect, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fillRow(GLubyte* row, GLuint pixel, GLuint width, GLuint pixelBytes)
|
||||||
|
{
|
||||||
|
GLubyte* dst = row;
|
||||||
|
for (GLuint x = 0; x < width; ++x) {
|
||||||
|
memcpy(dst, &pixel, pixelBytes);
|
||||||
|
dst += pixelBytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SGRect<int> intersectRect(const SGRect<int>& a, const SGRect<int>& b)
|
||||||
|
{
|
||||||
|
SGVec2<int> m1 = max(a.getMin(), b.getMin());
|
||||||
|
SGVec2<int> m2 = min(a.getMax(), b.getMax());
|
||||||
|
return SGRect<int>(m1, m2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::fillRect(const SGRect<int>& rect, const osg::Vec4& color)
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::Image> image = _texture->getImage();
|
||||||
|
if (!image) {
|
||||||
|
allocateImage();
|
||||||
|
image = _texture->getImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image->getDataVariance() != osg::Object::DYNAMIC) {
|
||||||
|
image->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto format = image->getInternalTextureFormat();
|
||||||
|
|
||||||
|
auto clippedRect = intersectRect(rect, SGRect<int>(0, 0, image->s(), image->t()));
|
||||||
|
if ((clippedRect.width() == 0) || (clippedRect.height() == 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLubyte* rowData = nullptr;
|
||||||
|
size_t rowByteSize = 0;
|
||||||
|
GLuint pixelWidth = clippedRect.width();
|
||||||
|
GLuint pixel = 0;
|
||||||
|
GLuint pixelBytes = 0;
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
case GL_RGBA8:
|
||||||
|
case GL_RGBA:
|
||||||
|
rowByteSize = pixelWidth * 4;
|
||||||
|
rowData = static_cast<GLubyte*>(alloca(rowByteSize));
|
||||||
|
|
||||||
|
// assume litte-endian, so read out backwards, hence when we memcpy
|
||||||
|
// the data, it ends up in RGBA order
|
||||||
|
pixel = color.asABGR();
|
||||||
|
pixelBytes = 4;
|
||||||
|
fillRow(rowData, pixel, pixelWidth, pixelBytes);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GL_RGB8:
|
||||||
|
case GL_RGB:
|
||||||
|
rowByteSize = pixelWidth * 3;
|
||||||
|
rowData = static_cast<GLubyte*>(alloca(rowByteSize));
|
||||||
|
pixel = color.asABGR();
|
||||||
|
pixelBytes = 3;
|
||||||
|
fillRow(rowData, pixel, pixelWidth, pixelBytes);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
SG_LOG(SG_IO, SG_WARN, "Image::fillRect: unsupported internal image format:" << format);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int row=clippedRect.t(); row < clippedRect.b(); ++row) {
|
||||||
|
GLubyte* imageData = image->data(clippedRect.l(), row);
|
||||||
|
memcpy(imageData, rowData, rowByteSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
image->dirty();
|
||||||
|
auto c = getCanvas().lock();
|
||||||
|
c->enableRendering(true); // force a repaint
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::setPixel(int x, int y, const std::string& c)
|
||||||
|
{
|
||||||
|
osg::Vec4 color(1,1,1,1);
|
||||||
|
if(!c.empty() && !parseColor(c, color))
|
||||||
|
return;
|
||||||
|
|
||||||
|
setPixel(x, y, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::setPixel(int x, int y, const osg::Vec4& color)
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::Image> image = _texture->getImage();
|
||||||
|
if (!image) {
|
||||||
|
allocateImage();
|
||||||
|
image = _texture->getImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image->getDataVariance() != osg::Object::DYNAMIC) {
|
||||||
|
image->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
image->setColor(color, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::dirtyPixels()
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::Image> image = _texture->getImage();
|
||||||
|
if (!image)
|
||||||
|
return;
|
||||||
|
image->dirty();
|
||||||
|
auto c = getCanvas().lock();
|
||||||
|
c->enableRendering(true); // force a repaint
|
||||||
|
}
|
||||||
|
|
||||||
|
void Image::allocateImage()
|
||||||
|
{
|
||||||
|
osg::Image* image = new osg::Image;
|
||||||
|
// default to RGBA
|
||||||
|
image->allocateImage(_node->getIntValue("size[0]"), _node->getIntValue("size[1]"), 1, GL_RGBA, GL_UNSIGNED_BYTE);
|
||||||
|
image->setInternalTextureFormat(GL_RGBA);
|
||||||
|
_texture->setImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Image> Image::getImage() const
|
||||||
|
{
|
||||||
|
if (!_texture)
|
||||||
|
return {};
|
||||||
|
return _texture->getImage();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
} // namespace simgear
|
} // namespace simgear
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// An image on the Canvas
|
///@file
|
||||||
|
/// An image on the Canvas
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -53,8 +54,7 @@ namespace canvas
|
|||||||
ElementWeakPtr parent = 0 );
|
ElementWeakPtr parent = 0 );
|
||||||
virtual ~Image();
|
virtual ~Image();
|
||||||
|
|
||||||
virtual void update(double dt);
|
void valueChanged(SGPropertyNode* child) override;
|
||||||
virtual void valueChanged(SGPropertyNode* child);
|
|
||||||
|
|
||||||
void setSrcCanvas(CanvasPtr canvas);
|
void setSrcCanvas(CanvasPtr canvas);
|
||||||
CanvasWeakPtr getSrcCanvas() const;
|
CanvasWeakPtr getSrcCanvas() const;
|
||||||
@@ -94,14 +94,36 @@ namespace canvas
|
|||||||
|
|
||||||
const SGRect<float>& getRegion() const;
|
const SGRect<float>& getRegion() const;
|
||||||
|
|
||||||
bool handleEvent(const EventPtr& event);
|
bool handleEvent(const EventPtr& event) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void setSourceRect(const SGRect<float>& sourceRect);
|
void setSourceRect(const SGRect<float>& sourceRect);
|
||||||
protected:
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fill the specified rectangle of the image, with an RGB value
|
||||||
|
*/
|
||||||
|
void fillRect(const SGRect<int>& rect, const std::string& color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fill the specified rectangle of the image, with an RGB value
|
||||||
|
*/
|
||||||
|
void fillRect(const SGRect<int>& rect, const osg::Vec4& color);
|
||||||
|
|
||||||
|
void setPixel(int x, int y, const std::string& color);
|
||||||
|
|
||||||
|
void setPixel(int x, int y, const osg::Vec4& color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mark the image pixels as modified, so the canvas is re-painted
|
||||||
|
*/
|
||||||
|
void dirtyPixels();
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Image> getImage() const;
|
||||||
|
|
||||||
|
// void setRow(int row, int offset, )
|
||||||
|
protected:
|
||||||
enum ImageAttributes
|
enum ImageAttributes
|
||||||
{
|
{
|
||||||
SRC_RECT = LAST_ATTRIBUTE << 1, // Source image rectangle
|
SRC_RECT = LAST_ATTRIBUTE << 1, // Source image rectangle
|
||||||
@@ -109,7 +131,9 @@ namespace canvas
|
|||||||
SRC_CANVAS = DEST_SIZE << 1
|
SRC_CANVAS = DEST_SIZE << 1
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void childChanged(SGPropertyNode * child);
|
void updateImpl(double dt) override;
|
||||||
|
|
||||||
|
void childChanged(SGPropertyNode * child) override;
|
||||||
|
|
||||||
void setupDefaultDimensions();
|
void setupDefaultDimensions();
|
||||||
SGRect<int> getTextureDimensions() const;
|
SGRect<int> getTextureDimensions() const;
|
||||||
@@ -123,6 +147,8 @@ namespace canvas
|
|||||||
HTTP::Request& request,
|
HTTP::Request& request,
|
||||||
const std::string& type );
|
const std::string& type );
|
||||||
|
|
||||||
|
void allocateImage();
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> _texture;
|
osg::ref_ptr<osg::Texture2D> _texture;
|
||||||
// TODO optionally forward events to canvas
|
// TODO optionally forward events to canvas
|
||||||
CanvasWeakPtr _src_canvas;
|
CanvasWeakPtr _src_canvas;
|
||||||
@@ -134,9 +160,9 @@ namespace canvas
|
|||||||
osg::ref_ptr<osg::Vec2Array> _texCoords;
|
osg::ref_ptr<osg::Vec2Array> _texCoords;
|
||||||
osg::ref_ptr<osg::Vec4Array> _colors;
|
osg::ref_ptr<osg::Vec4Array> _colors;
|
||||||
|
|
||||||
SGPropertyNode *_node_src_rect;
|
SGPropertyNode *_node_src_rect = nullptr;
|
||||||
SGRect<float> _src_rect,
|
SGRect<float> _src_rect {0, 0},
|
||||||
_region;
|
_region {0, 0};
|
||||||
|
|
||||||
SVGpreserveAspectRatio _preserve_aspect_ratio;
|
SVGpreserveAspectRatio _preserve_aspect_ratio;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// A group of 2D Canvas elements which get automatically transformed according
|
///@file
|
||||||
// to the map parameters.
|
/// A group of 2D Canvas elements which get automatically transformed according
|
||||||
|
/// to the map parameters.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -18,13 +19,14 @@
|
|||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
|
|
||||||
#include "CanvasMap.hxx"
|
#include "CanvasMap.hxx"
|
||||||
#include "map/geo_node_pair.hxx"
|
#include "map/geo_node_pair.hxx"
|
||||||
#include "map/projection.hxx"
|
#include "map/projection.hxx"
|
||||||
|
|
||||||
#include <cmath>
|
#include <simgear/misc/strutils.hxx>
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <cmath>
|
||||||
|
|
||||||
#define LOG_GEO_RET(msg) \
|
#define LOG_GEO_RET(msg) \
|
||||||
{\
|
{\
|
||||||
@@ -47,6 +49,12 @@ namespace canvas
|
|||||||
const std::string GEO = "-geo";
|
const std::string GEO = "-geo";
|
||||||
const std::string HDG = "hdg";
|
const std::string HDG = "hdg";
|
||||||
const std::string Map::TYPE_NAME = "map";
|
const std::string Map::TYPE_NAME = "map";
|
||||||
|
const std::string WEB_MERCATOR = "webmercator";
|
||||||
|
const std::string REF_LAT = "ref-lat";
|
||||||
|
const std::string REF_LON = "ref-lon";
|
||||||
|
const std::string SCREEN_RANGE = "screen-range";
|
||||||
|
const std::string RANGE = "range";
|
||||||
|
const std::string PROJECTION = "projection";
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::staticInit()
|
void Map::staticInit()
|
||||||
@@ -64,12 +72,11 @@ namespace canvas
|
|||||||
const SGPropertyNode_ptr& node,
|
const SGPropertyNode_ptr& node,
|
||||||
const Style& parent_style,
|
const Style& parent_style,
|
||||||
ElementWeakPtr parent ):
|
ElementWeakPtr parent ):
|
||||||
Group(canvas, node, parent_style, parent),
|
Group(canvas, node, parent_style, parent)
|
||||||
// TODO make projection configurable
|
|
||||||
_projection(new SansonFlamsteedProjection),
|
|
||||||
_projection_dirty(true)
|
|
||||||
{
|
{
|
||||||
staticInit();
|
staticInit();
|
||||||
|
|
||||||
|
projectionNodeChanged(node->getChild(PROJECTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -79,17 +86,19 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::update(double dt)
|
void Map::updateImpl(double dt)
|
||||||
{
|
{
|
||||||
for( GeoNodes::iterator it = _geo_nodes.begin();
|
Group::updateImpl(dt);
|
||||||
it != _geo_nodes.end();
|
|
||||||
++it )
|
for(auto& it: _geo_nodes)
|
||||||
{
|
{
|
||||||
GeoNodePair* geo_node = it->second.get();
|
GeoNodePair* geo_node = it.second.get();
|
||||||
if( !geo_node->isComplete()
|
if( !geo_node->isComplete()
|
||||||
|| (!geo_node->isDirty() && !_projection_dirty) )
|
|| (!geo_node->isDirty() && !_projection_dirty) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
double latD = -9999.0, lonD = -9999.0;
|
||||||
|
if (geo_node->isDirty()) {
|
||||||
GeoCoord lat = parseGeoCoord(geo_node->getLat());
|
GeoCoord lat = parseGeoCoord(geo_node->getLat());
|
||||||
if( lat.type != GeoCoord::LATITUDE )
|
if( lat.type != GeoCoord::LATITUDE )
|
||||||
continue;
|
continue;
|
||||||
@@ -98,23 +107,28 @@ namespace canvas
|
|||||||
if( lon.type != GeoCoord::LONGITUDE )
|
if( lon.type != GeoCoord::LONGITUDE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Projection::ScreenPosition pos =
|
// save the parsed values so we can re-use them if only projection
|
||||||
_projection->worldToScreen(lat.value, lon.value);
|
// is changed (very common case for moving vehicle)
|
||||||
|
latD = lat.value;
|
||||||
|
lonD = lon.value;
|
||||||
|
geo_node->setCachedLatLon(std::make_pair(latD, lonD));
|
||||||
|
} else {
|
||||||
|
std::tie(latD, lonD) = geo_node->getCachedLatLon();
|
||||||
|
}
|
||||||
|
|
||||||
|
Projection::ScreenPosition pos = _projection->worldToScreen(latD, lonD);
|
||||||
geo_node->setScreenPos(pos.x, pos.y);
|
geo_node->setScreenPos(pos.x, pos.y);
|
||||||
|
|
||||||
// geo_node->print();
|
// geo_node->print();
|
||||||
geo_node->setDirty(false);
|
geo_node->setDirty(false);
|
||||||
}
|
}
|
||||||
_projection_dirty = false;
|
_projection_dirty = false;
|
||||||
|
|
||||||
Group::update(dt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::childAdded(SGPropertyNode* parent, SGPropertyNode* child)
|
void Map::childAdded(SGPropertyNode* parent, SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
if( boost::ends_with(child->getNameString(), GEO) )
|
if( strutils::ends_with(child->getNameString(), GEO) )
|
||||||
_geo_nodes[child].reset(new GeoNodePair());
|
_geo_nodes[child].reset(new GeoNodePair());
|
||||||
else if( parent != _node && child->getNameString() == HDG )
|
else if( parent != _node && child->getNameString() == HDG )
|
||||||
_hdg_nodes.insert(child);
|
_hdg_nodes.insert(child);
|
||||||
@@ -125,7 +139,7 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::childRemoved(SGPropertyNode* parent, SGPropertyNode* child)
|
void Map::childRemoved(SGPropertyNode* parent, SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
if( boost::ends_with(child->getNameString(), GEO) )
|
if( strutils::ends_with(child->getNameString(), GEO) )
|
||||||
// TODO remove from other node
|
// TODO remove from other node
|
||||||
_geo_nodes.erase(child);
|
_geo_nodes.erase(child);
|
||||||
else if( parent != _node && child->getName() == HDG )
|
else if( parent != _node && child->getName() == HDG )
|
||||||
@@ -147,7 +161,7 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
const std::string& name = child->getNameString();
|
const std::string& name = child->getNameString();
|
||||||
|
|
||||||
if( boost::ends_with(name, GEO) )
|
if( strutils::ends_with(name, GEO) )
|
||||||
return geoNodeChanged(child);
|
return geoNodeChanged(child);
|
||||||
else if( name == HDG )
|
else if( name == HDG )
|
||||||
return hdgNodeChanged(child);
|
return hdgNodeChanged(child);
|
||||||
@@ -162,10 +176,10 @@ namespace canvas
|
|||||||
if( child->getParent() != _node )
|
if( child->getParent() != _node )
|
||||||
return Group::childChanged(child);
|
return Group::childChanged(child);
|
||||||
|
|
||||||
if( child->getNameString() == "ref-lat"
|
if( child->getNameString() == REF_LAT
|
||||||
|| child->getNameString() == "ref-lon" )
|
|| child->getNameString() == REF_LON )
|
||||||
_projection->setWorldPosition( _node->getDoubleValue("ref-lat"),
|
_projection->setWorldPosition( _node->getDoubleValue(REF_LAT),
|
||||||
_node->getDoubleValue("ref-lon") );
|
_node->getDoubleValue(REF_LON) );
|
||||||
else if( child->getNameString() == HDG )
|
else if( child->getNameString() == HDG )
|
||||||
{
|
{
|
||||||
_projection->setOrientation(child->getFloatValue());
|
_projection->setOrientation(child->getFloatValue());
|
||||||
@@ -174,16 +188,43 @@ namespace canvas
|
|||||||
++it )
|
++it )
|
||||||
hdgNodeChanged(*it);
|
hdgNodeChanged(*it);
|
||||||
}
|
}
|
||||||
else if( child->getNameString() == "range" )
|
else if( child->getNameString() == RANGE )
|
||||||
_projection->setRange(child->getDoubleValue());
|
_projection->setRange(child->getDoubleValue());
|
||||||
else if( child->getNameString() == "screen-range" )
|
else if( child->getNameString() == SCREEN_RANGE )
|
||||||
_projection->setScreenRange(child->getDoubleValue());
|
_projection->setScreenRange(child->getDoubleValue());
|
||||||
|
else if( child->getNameString() == PROJECTION )
|
||||||
|
projectionNodeChanged(child);
|
||||||
else
|
else
|
||||||
return Group::childChanged(child);
|
return Group::childChanged(child);
|
||||||
|
|
||||||
_projection_dirty = true;
|
_projection_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Map::projectionNodeChanged(SGPropertyNode* child)
|
||||||
|
{
|
||||||
|
if(child && child->getStringValue() == WEB_MERCATOR)
|
||||||
|
_projection = std::make_shared<WebMercatorProjection>();
|
||||||
|
else
|
||||||
|
_projection = std::make_shared<SansonFlamsteedProjection>();
|
||||||
|
|
||||||
|
_projection->setWorldPosition(_node->getDoubleValue(REF_LAT),
|
||||||
|
_node->getDoubleValue(REF_LON));
|
||||||
|
|
||||||
|
// Only set existing properties to prevent using 0 instead of default values
|
||||||
|
|
||||||
|
if( auto heading = _node->getChild(HDG) )
|
||||||
|
_projection->setOrientation(heading->getFloatValue());
|
||||||
|
|
||||||
|
if( auto screen_range = _node->getChild(SCREEN_RANGE) )
|
||||||
|
_projection->setScreenRange(screen_range->getDoubleValue());
|
||||||
|
|
||||||
|
if( auto range = _node->getChild(RANGE) )
|
||||||
|
_projection->setRange(range->getDoubleValue());
|
||||||
|
|
||||||
|
_projection_dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Map::geoNodeChanged(SGPropertyNode* child)
|
void Map::geoNodeChanged(SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// A group of 2D Canvas elements which get automatically transformed according
|
///@file
|
||||||
// to the map parameters.
|
/// A group of 2D Canvas elements which get automatically transformed according
|
||||||
|
/// to the map parameters.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -22,9 +23,9 @@
|
|||||||
|
|
||||||
#include "CanvasGroup.hxx"
|
#include "CanvasGroup.hxx"
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <memory>
|
||||||
#include <boost/unordered_map.hpp>
|
#include <unordered_map>
|
||||||
#include <boost/unordered_set.hpp>
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
@@ -45,43 +46,37 @@ namespace canvas
|
|||||||
ElementWeakPtr parent = 0 );
|
ElementWeakPtr parent = 0 );
|
||||||
virtual ~Map();
|
virtual ~Map();
|
||||||
|
|
||||||
virtual void update(double dt);
|
|
||||||
|
|
||||||
virtual void childAdded( SGPropertyNode * parent,
|
|
||||||
SGPropertyNode * child );
|
|
||||||
virtual void childRemoved( SGPropertyNode * parent,
|
|
||||||
SGPropertyNode * child );
|
|
||||||
virtual void valueChanged(SGPropertyNode * child);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void updateImpl(double dt) override;
|
||||||
|
|
||||||
virtual void childChanged(SGPropertyNode * child);
|
void updateProjection(SGPropertyNode* type_node);
|
||||||
|
|
||||||
typedef boost::unordered_map< SGPropertyNode*,
|
void childAdded(SGPropertyNode* parent, SGPropertyNode* child) override;
|
||||||
boost::shared_ptr<GeoNodePair>
|
void childRemoved(SGPropertyNode* parent, SGPropertyNode* child) override;
|
||||||
> GeoNodes;
|
void valueChanged(SGPropertyNode* child) override;
|
||||||
typedef boost::unordered_set<SGPropertyNode*> NodeSet;
|
void childChanged(SGPropertyNode* child) override;
|
||||||
|
|
||||||
|
using GeoNodes =
|
||||||
|
std::unordered_map<SGPropertyNode*, std::shared_ptr<GeoNodePair>>;
|
||||||
|
using NodeSet = std::unordered_set<SGPropertyNode*>;
|
||||||
|
|
||||||
GeoNodes _geo_nodes;
|
GeoNodes _geo_nodes;
|
||||||
NodeSet _hdg_nodes;
|
NodeSet _hdg_nodes;
|
||||||
boost::shared_ptr<HorizontalProjection> _projection;
|
std::shared_ptr<HorizontalProjection> _projection;
|
||||||
bool _projection_dirty;
|
bool _projection_dirty = false;
|
||||||
|
|
||||||
struct GeoCoord
|
struct GeoCoord
|
||||||
{
|
{
|
||||||
GeoCoord():
|
|
||||||
type(INVALID),
|
|
||||||
value(0)
|
|
||||||
{}
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
INVALID,
|
INVALID,
|
||||||
LATITUDE,
|
LATITUDE,
|
||||||
LONGITUDE
|
LONGITUDE
|
||||||
} type;
|
} type = INVALID;
|
||||||
double value;
|
double value = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void projectionNodeChanged(SGPropertyNode* child);
|
||||||
void geoNodeChanged(SGPropertyNode* child);
|
void geoNodeChanged(SGPropertyNode* child);
|
||||||
void hdgNodeChanged(SGPropertyNode* child);
|
void hdgNodeChanged(SGPropertyNode* child);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// An OpenVG path on the Canvas
|
///@file
|
||||||
|
/// An OpenVG path on the Canvas
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -207,22 +208,12 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
class Path::PathDrawable:
|
class Path::PathDrawable:
|
||||||
public osg::Drawable
|
public osg::Drawable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PathDrawable(Path* path):
|
PathDrawable(Path* path):
|
||||||
_path_element(path),
|
_path_element(path)
|
||||||
_path(VG_INVALID_HANDLE),
|
|
||||||
_paint(VG_INVALID_HANDLE),
|
|
||||||
_paint_fill(VG_INVALID_HANDLE),
|
|
||||||
_attributes_dirty(~0),
|
|
||||||
_mode(0),
|
|
||||||
_fill_rule(VG_EVEN_ODD),
|
|
||||||
_stroke_width(1),
|
|
||||||
_stroke_linecap(VG_CAP_BUTT),
|
|
||||||
_stroke_linejoin(VG_JOIN_MITER)
|
|
||||||
{
|
{
|
||||||
setSupportsDisplayList(false);
|
setSupportsDisplayList(false);
|
||||||
setDataVariance(Object::DYNAMIC);
|
setDataVariance(Object::DYNAMIC);
|
||||||
@@ -240,9 +231,12 @@ namespace canvas
|
|||||||
vgDestroyPaint(_paint_fill);
|
vgDestroyPaint(_paint_fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* className() const { return "PathDrawable"; }
|
const char* className() const override
|
||||||
virtual osg::Object* cloneType() const { return new PathDrawable(_path_element); }
|
{ return "PathDrawable"; }
|
||||||
virtual osg::Object* clone(const osg::CopyOp&) const { return new PathDrawable(_path_element); }
|
osg::Object* cloneType() const override
|
||||||
|
{ return new PathDrawable(_path_element); }
|
||||||
|
osg::Object* clone(const osg::CopyOp&) const override
|
||||||
|
{ return new PathDrawable(_path_element); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the current path segments with the new ones
|
* Replace the current path segments with the new ones
|
||||||
@@ -283,6 +277,16 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set path fill opacity (Only used if fill is not "none")
|
||||||
|
*/
|
||||||
|
void setFillOpacity(float opacity)
|
||||||
|
{
|
||||||
|
_fill_opacity =
|
||||||
|
static_cast<uint8_t>(SGMiscf::clip(opacity, 0.f, 1.f) * 255);
|
||||||
|
_attributes_dirty |= FILL_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set path fill rule ("pseudo-nonzero" or "evenodd")
|
* Set path fill rule ("pseudo-nonzero" or "evenodd")
|
||||||
*
|
*
|
||||||
@@ -323,6 +327,16 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set path stroke opacity (only used if stroke is not "none")
|
||||||
|
*/
|
||||||
|
void setStrokeOpacity(float opacity)
|
||||||
|
{
|
||||||
|
_stroke_opacity =
|
||||||
|
static_cast<uint8_t>(SGMiscf::clip(opacity, 0.f, 1.f) * 255);
|
||||||
|
_attributes_dirty |= STROKE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set stroke width
|
* Set stroke width
|
||||||
*/
|
*/
|
||||||
@@ -373,7 +387,7 @@ namespace canvas
|
|||||||
/**
|
/**
|
||||||
* Draw callback
|
* Draw callback
|
||||||
*/
|
*/
|
||||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const
|
void drawImplementation(osg::RenderInfo& renderInfo) const override
|
||||||
{
|
{
|
||||||
if( _attributes_dirty & PATH )
|
if( _attributes_dirty & PATH )
|
||||||
return;
|
return;
|
||||||
@@ -390,31 +404,22 @@ namespace canvas
|
|||||||
osg::StateAttribute const* blend_func =
|
osg::StateAttribute const* blend_func =
|
||||||
state->getLastAppliedAttribute(osg::StateAttribute::BLENDFUNC);
|
state->getLastAppliedAttribute(osg::StateAttribute::BLENDFUNC);
|
||||||
|
|
||||||
|
// Setup paint
|
||||||
|
if( _mode & VG_STROKE_PATH )
|
||||||
|
{
|
||||||
// Initialize/Update the paint
|
// Initialize/Update the paint
|
||||||
if( _attributes_dirty & STROKE_COLOR )
|
if( _attributes_dirty & STROKE_COLOR )
|
||||||
{
|
{
|
||||||
if( _paint == VG_INVALID_HANDLE )
|
if( _paint == VG_INVALID_HANDLE )
|
||||||
_paint = vgCreatePaint();
|
_paint = vgCreatePaint();
|
||||||
|
|
||||||
vgSetParameterfv(_paint, VG_PAINT_COLOR, 4, _stroke_color._v);
|
auto color = _stroke_color;
|
||||||
|
color.a() *= _stroke_opacity / 255.f;
|
||||||
|
vgSetParameterfv(_paint, VG_PAINT_COLOR, 4, color._v);
|
||||||
|
|
||||||
_attributes_dirty &= ~STROKE_COLOR;
|
_attributes_dirty &= ~STROKE_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize/update fill paint
|
|
||||||
if( _attributes_dirty & FILL_COLOR )
|
|
||||||
{
|
|
||||||
if( _paint_fill == VG_INVALID_HANDLE )
|
|
||||||
_paint_fill = vgCreatePaint();
|
|
||||||
|
|
||||||
vgSetParameterfv(_paint_fill, VG_PAINT_COLOR, 4, _fill_color._v);
|
|
||||||
|
|
||||||
_attributes_dirty &= ~FILL_COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup paint
|
|
||||||
if( _mode & VG_STROKE_PATH )
|
|
||||||
{
|
|
||||||
vgSetPaint(_paint, VG_STROKE_PATH);
|
vgSetPaint(_paint, VG_STROKE_PATH);
|
||||||
|
|
||||||
vgSetf(VG_STROKE_LINE_WIDTH, _stroke_width);
|
vgSetf(VG_STROKE_LINE_WIDTH, _stroke_width);
|
||||||
@@ -426,6 +431,19 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
if( _mode & VG_FILL_PATH )
|
if( _mode & VG_FILL_PATH )
|
||||||
{
|
{
|
||||||
|
// Initialize/update fill paint
|
||||||
|
if( _attributes_dirty & FILL_COLOR )
|
||||||
|
{
|
||||||
|
if( _paint_fill == VG_INVALID_HANDLE )
|
||||||
|
_paint_fill = vgCreatePaint();
|
||||||
|
|
||||||
|
auto color = _fill_color;
|
||||||
|
color.a() *= _fill_opacity / 255.f;
|
||||||
|
vgSetParameterfv(_paint_fill, VG_PAINT_COLOR, 4, color._v);
|
||||||
|
|
||||||
|
_attributes_dirty &= ~FILL_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
vgSetPaint(_paint_fill, VG_FILL_PATH);
|
vgSetPaint(_paint_fill, VG_FILL_PATH);
|
||||||
|
|
||||||
vgSeti(VG_FILL_RULE, _fill_rule);
|
vgSeti(VG_FILL_RULE, _fill_rule);
|
||||||
@@ -541,13 +559,13 @@ namespace canvas
|
|||||||
/**
|
/**
|
||||||
* Compute the bounding box
|
* Compute the bounding box
|
||||||
*/
|
*/
|
||||||
virtual osg::BoundingBox
|
osg::BoundingBox
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||||
computeBound()
|
computeBound()
|
||||||
#else
|
#else
|
||||||
computeBoundingBox()
|
computeBoundingBox()
|
||||||
#endif
|
#endif
|
||||||
const
|
const override
|
||||||
{
|
{
|
||||||
if( _path == VG_INVALID_HANDLE || (_attributes_dirty & PATH) )
|
if( _path == VG_INVALID_HANDLE || (_attributes_dirty & PATH) )
|
||||||
return osg::BoundingBox();
|
return osg::BoundingBox();
|
||||||
@@ -579,22 +597,24 @@ namespace canvas
|
|||||||
|
|
||||||
Path *_path_element;
|
Path *_path_element;
|
||||||
|
|
||||||
mutable VGPath _path;
|
mutable VGPath _path {VG_INVALID_HANDLE};
|
||||||
mutable VGPaint _paint;
|
mutable VGPaint _paint {VG_INVALID_HANDLE};
|
||||||
mutable VGPaint _paint_fill;
|
mutable VGPaint _paint_fill {VG_INVALID_HANDLE};
|
||||||
mutable uint32_t _attributes_dirty;
|
mutable uint32_t _attributes_dirty {~0u};
|
||||||
|
|
||||||
CmdList _cmds;
|
CmdList _cmds;
|
||||||
CoordList _coords;
|
CoordList _coords;
|
||||||
|
|
||||||
VGbitfield _mode;
|
VGbitfield _mode {0};
|
||||||
osg::Vec4f _fill_color;
|
osg::Vec4f _fill_color;
|
||||||
VGFillRule _fill_rule;
|
uint8_t _fill_opacity {255};
|
||||||
|
VGFillRule _fill_rule {VG_EVEN_ODD};
|
||||||
osg::Vec4f _stroke_color;
|
osg::Vec4f _stroke_color;
|
||||||
VGfloat _stroke_width;
|
uint8_t _stroke_opacity {255};
|
||||||
|
VGfloat _stroke_width {1};
|
||||||
std::vector<VGfloat> _stroke_dash;
|
std::vector<VGfloat> _stroke_dash;
|
||||||
VGCapStyle _stroke_linecap;
|
VGCapStyle _stroke_linecap {VG_CAP_BUTT};
|
||||||
VGJoinStyle _stroke_linejoin;
|
VGJoinStyle _stroke_linejoin {VG_JOIN_MITER};
|
||||||
|
|
||||||
osg::Vec3f transformPoint( const osg::Matrix& m,
|
osg::Vec3f transformPoint( const osg::Matrix& m,
|
||||||
osg::Vec2f pos ) const
|
osg::Vec2f pos ) const
|
||||||
@@ -651,7 +671,7 @@ namespace canvas
|
|||||||
struct PathUpdateCallback:
|
struct PathUpdateCallback:
|
||||||
public osg::Drawable::UpdateCallback
|
public osg::Drawable::UpdateCallback
|
||||||
{
|
{
|
||||||
virtual void update(osg::NodeVisitor*, osg::Drawable* drawable)
|
void update(osg::NodeVisitor*, osg::Drawable* drawable) override
|
||||||
{
|
{
|
||||||
static_cast<PathDrawable*>(drawable)->update();
|
static_cast<PathDrawable*>(drawable)->update();
|
||||||
}
|
}
|
||||||
@@ -670,8 +690,10 @@ namespace canvas
|
|||||||
PathDrawableRef Path::*path = &Path::_path;
|
PathDrawableRef Path::*path = &Path::_path;
|
||||||
|
|
||||||
addStyle("fill", "color", &PathDrawable::setFill, path);
|
addStyle("fill", "color", &PathDrawable::setFill, path);
|
||||||
|
addStyle("fill-opacity", "numeric", &PathDrawable::setFillOpacity, path);
|
||||||
addStyle("fill-rule", "", &PathDrawable::setFillRule, path);
|
addStyle("fill-rule", "", &PathDrawable::setFillRule, path);
|
||||||
addStyle("stroke", "color", &PathDrawable::setStroke, path);
|
addStyle("stroke", "color", &PathDrawable::setStroke, path);
|
||||||
|
addStyle("stroke-opacity", "numeric", &PathDrawable::setStrokeOpacity, path);
|
||||||
addStyle("stroke-width", "numeric", &PathDrawable::setStrokeWidth, path);
|
addStyle("stroke-width", "numeric", &PathDrawable::setStrokeWidth, path);
|
||||||
addStyle("stroke-dasharray", "", &PathDrawable::setStrokeDashArray, path);
|
addStyle("stroke-dasharray", "", &PathDrawable::setStrokeDashArray, path);
|
||||||
addStyle("stroke-linecap", "", &PathDrawable::setStrokeLinecap, path);
|
addStyle("stroke-linecap", "", &PathDrawable::setStrokeLinecap, path);
|
||||||
@@ -700,92 +722,69 @@ namespace canvas
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void Path::update(double dt)
|
|
||||||
{
|
|
||||||
if( _attributes_dirty & (CMDS | COORDS) )
|
|
||||||
{
|
|
||||||
_path->setSegments
|
|
||||||
(
|
|
||||||
_node->getChildValues<VGubyte, int>("cmd"),
|
|
||||||
_node->getChildValues<VGfloat, float>("coord")
|
|
||||||
);
|
|
||||||
|
|
||||||
_attributes_dirty &= ~(CMDS | COORDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SVG path overrides manual cmd/coord specification
|
|
||||||
if ( _hasSVG && (_attributes_dirty & SVG))
|
|
||||||
{
|
|
||||||
CmdList cmds;
|
|
||||||
CoordList coords;
|
|
||||||
parseSVGPathToVGPath(_node->getStringValue("svg"), cmds, coords);
|
|
||||||
_path->setSegments(cmds, coords);
|
|
||||||
_attributes_dirty &= ~SVG;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( _hasRect &&(_attributes_dirty & RECT))
|
|
||||||
{
|
|
||||||
parseRectToVGPath();
|
|
||||||
_attributes_dirty &= ~RECT;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Element::update(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::BoundingBox Path::getTransformedBounds(const osg::Matrix& m) const
|
osg::BoundingBox Path::getTransformedBounds(const osg::Matrix& m) const
|
||||||
{
|
{
|
||||||
return _path->getTransformedBounds(m);
|
return _path->getTransformedBounds(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
Path& Path::addSegment(uint8_t cmd, std::initializer_list<float> coords)
|
||||||
|
{
|
||||||
|
_node->addChild("cmd")->setIntValue(cmd);
|
||||||
|
|
||||||
|
for(float coord: coords)
|
||||||
|
_node->addChild("coord")->setFloatValue(coord);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::moveTo(float x_abs, float y_abs)
|
Path& Path::moveTo(float x_abs, float y_abs)
|
||||||
{
|
{
|
||||||
return addSegment(VG_MOVE_TO_ABS, x_abs, y_abs);
|
return addSegment(VG_MOVE_TO_ABS, {x_abs, y_abs});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::move(float x_rel, float y_rel)
|
Path& Path::move(float x_rel, float y_rel)
|
||||||
{
|
{
|
||||||
return addSegment(VG_MOVE_TO_REL, x_rel, y_rel);
|
return addSegment(VG_MOVE_TO_REL, {x_rel, y_rel});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::lineTo(float x_abs, float y_abs)
|
Path& Path::lineTo(float x_abs, float y_abs)
|
||||||
{
|
{
|
||||||
return addSegment(VG_LINE_TO_ABS, x_abs, y_abs);
|
return addSegment(VG_LINE_TO_ABS, {x_abs, y_abs});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::line(float x_rel, float y_rel)
|
Path& Path::line(float x_rel, float y_rel)
|
||||||
{
|
{
|
||||||
return addSegment(VG_LINE_TO_REL, x_rel, y_rel);
|
return addSegment(VG_LINE_TO_REL, {x_rel, y_rel});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::horizTo(float x_abs)
|
Path& Path::horizTo(float x_abs)
|
||||||
{
|
{
|
||||||
return addSegment(VG_HLINE_TO_ABS, x_abs);
|
return addSegment(VG_HLINE_TO_ABS, {x_abs});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::horiz(float x_rel)
|
Path& Path::horiz(float x_rel)
|
||||||
{
|
{
|
||||||
return addSegment(VG_HLINE_TO_REL, x_rel);
|
return addSegment(VG_HLINE_TO_REL, {x_rel});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::vertTo(float y_abs)
|
Path& Path::vertTo(float y_abs)
|
||||||
{
|
{
|
||||||
return addSegment(VG_VLINE_TO_ABS, y_abs);
|
return addSegment(VG_VLINE_TO_ABS, {y_abs});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Path& Path::vert(float y_rel)
|
Path& Path::vert(float y_rel)
|
||||||
{
|
{
|
||||||
return addSegment(VG_VLINE_TO_REL, y_rel);
|
return addSegment(VG_VLINE_TO_REL, {y_rel});
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -828,19 +827,56 @@ namespace canvas
|
|||||||
_node->getChild("border-radius", 1, true)->setDoubleValue(radiusY);
|
_node->getChild("border-radius", 1, true)->setDoubleValue(radiusY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Path::updateImpl(double dt)
|
||||||
|
{
|
||||||
|
Element::updateImpl(dt);
|
||||||
|
|
||||||
|
if( _attributes_dirty & (CMDS | COORDS) )
|
||||||
|
{
|
||||||
|
_path->setSegments
|
||||||
|
(
|
||||||
|
_node->getChildValues<VGubyte, int>("cmd"),
|
||||||
|
_node->getChildValues<VGfloat, float>("coord")
|
||||||
|
);
|
||||||
|
|
||||||
|
_attributes_dirty &= ~(CMDS | COORDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// SVG path overrides manual cmd/coord specification
|
||||||
|
if( _hasSVG && (_attributes_dirty & SVG) )
|
||||||
|
{
|
||||||
|
CmdList cmds;
|
||||||
|
CoordList coords;
|
||||||
|
parseSVGPathToVGPath(_node->getStringValue("svg"), cmds, coords);
|
||||||
|
_path->setSegments(cmds, coords);
|
||||||
|
_attributes_dirty &= ~SVG;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( _hasRect &&(_attributes_dirty & RECT) )
|
||||||
|
{
|
||||||
|
parseRectToVGPath();
|
||||||
|
_attributes_dirty &= ~RECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Path::childChanged(SGPropertyNode* child)
|
void Path::childChanged(SGPropertyNode* child)
|
||||||
{
|
{
|
||||||
|
if( child->getParent() != _node )
|
||||||
|
return;
|
||||||
|
|
||||||
const std::string& name = child->getNameString();
|
const std::string& name = child->getNameString();
|
||||||
const std::string &prName = child->getParent()->getNameString();
|
const std::string &prName = child->getParent()->getNameString();
|
||||||
|
|
||||||
if (simgear::strutils::starts_with(name, "border-"))
|
if( strutils::starts_with(name, "border-") )
|
||||||
{
|
{
|
||||||
_attributes_dirty |= RECT;
|
_attributes_dirty |= RECT;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prName == "rect") {
|
if (prName == "rect")
|
||||||
|
{
|
||||||
_hasRect = true;
|
_hasRect = true;
|
||||||
if (name == "left") {
|
if (name == "left") {
|
||||||
_rect.setLeft(child->getDoubleValue());
|
_rect.setLeft(child->getDoubleValue());
|
||||||
@@ -859,17 +895,16 @@ namespace canvas
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( child->getParent() != _node )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( name == "cmd" )
|
if( name == "cmd" )
|
||||||
_attributes_dirty |= CMDS;
|
_attributes_dirty |= CMDS;
|
||||||
else if( name == "coord" )
|
else if( name == "coord" )
|
||||||
_attributes_dirty |= COORDS;
|
_attributes_dirty |= COORDS;
|
||||||
else if ( name == "svg")
|
else if ( name == "svg")
|
||||||
|
{
|
||||||
_hasSVG = true;
|
_hasSVG = true;
|
||||||
_attributes_dirty |= SVG;
|
_attributes_dirty |= SVG;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::vector<float> splitAndConvert(const char del[], const std::string& str)
|
std::vector<float> splitAndConvert(const char del[], const std::string& str)
|
||||||
@@ -894,12 +929,12 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void operator+=(CoordList& base, const std::initializer_list<VGfloat>& other)
|
void operator+=(CoordList& base, const std::initializer_list<VGfloat>& other)
|
||||||
{
|
{
|
||||||
base.insert(base.end(), other.begin(), other.end());
|
base.insert(base.end(), other.begin(), other.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void Path::parseRectToVGPath()
|
void Path::parseRectToVGPath()
|
||||||
{
|
{
|
||||||
CmdList commands;
|
CmdList commands;
|
||||||
@@ -955,5 +990,6 @@ namespace canvas
|
|||||||
commands.push_back(VG_CLOSE_PATH);
|
commands.push_back(VG_CLOSE_PATH);
|
||||||
_path->setSegments(commands, coords);
|
_path->setSegments(commands, coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
} // namespace simgear
|
} // namespace simgear
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// An OpenVG path on the Canvas
|
///@file
|
||||||
|
/// An OpenVG path on the Canvas
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -20,8 +21,8 @@
|
|||||||
#define CANVAS_PATH_HXX_
|
#define CANVAS_PATH_HXX_
|
||||||
|
|
||||||
#include "CanvasElement.hxx"
|
#include "CanvasElement.hxx"
|
||||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
|
||||||
#include <simgear/math/SGRect.hxx>
|
#include <simgear/math/SGRect.hxx>
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
@@ -40,14 +41,11 @@ namespace canvas
|
|||||||
ElementWeakPtr parent = 0 );
|
ElementWeakPtr parent = 0 );
|
||||||
virtual ~Path();
|
virtual ~Path();
|
||||||
|
|
||||||
virtual void update(double dt);
|
osg::BoundingBox
|
||||||
|
getTransformedBounds(const osg::Matrix& m) const override;
|
||||||
|
|
||||||
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const;
|
/** Add a segment with the given command and coordinates */
|
||||||
|
Path& addSegment(uint8_t cmd, std::initializer_list<float> coords = {});
|
||||||
#define BOOST_PP_ITERATION_LIMITS (0, 6)
|
|
||||||
#define BOOST_PP_FILENAME_1 \
|
|
||||||
<simgear/canvas/elements/detail/add_segment_variadic.hxx>
|
|
||||||
#include BOOST_PP_ITERATE()
|
|
||||||
|
|
||||||
/** Move path cursor */
|
/** Move path cursor */
|
||||||
Path& moveTo(float x_abs, float y_abs);
|
Path& moveTo(float x_abs, float y_abs);
|
||||||
@@ -70,10 +68,10 @@ namespace canvas
|
|||||||
|
|
||||||
void setSVGPath(const std::string& svgPath);
|
void setSVGPath(const std::string& svgPath);
|
||||||
|
|
||||||
void setRect(const SGRect<float>& r);
|
void setRect(const SGRectf& r);
|
||||||
void setRoundRect(const SGRect<float>& r, float radiusX, float radiusY = -1.0);
|
void setRoundRect(const SGRectf& r, float radiusX, float radiusY = -1.0);
|
||||||
protected:
|
|
||||||
|
|
||||||
|
protected:
|
||||||
enum PathAttributes
|
enum PathAttributes
|
||||||
{
|
{
|
||||||
CMDS = LAST_ATTRIBUTE << 1,
|
CMDS = LAST_ATTRIBUTE << 1,
|
||||||
@@ -88,12 +86,14 @@ namespace canvas
|
|||||||
|
|
||||||
bool _hasSVG : 1;
|
bool _hasSVG : 1;
|
||||||
bool _hasRect : 1;
|
bool _hasRect : 1;
|
||||||
SGRect<float> _rect;
|
SGRectf _rect;
|
||||||
|
|
||||||
|
void updateImpl(double dt) override;
|
||||||
|
|
||||||
|
void childRemoved(SGPropertyNode * child) override;
|
||||||
|
void childChanged(SGPropertyNode * child) override;
|
||||||
|
|
||||||
void parseRectToVGPath();
|
void parseRectToVGPath();
|
||||||
|
|
||||||
virtual void childRemoved(SGPropertyNode * child);
|
|
||||||
virtual void childChanged(SGPropertyNode * child);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// A text on the Canvas
|
///@file
|
||||||
|
/// A text on the Canvas
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
|
||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
|
|
||||||
#include "CanvasText.hxx"
|
#include "CanvasText.hxx"
|
||||||
#include <simgear/canvas/Canvas.hxx>
|
#include <simgear/canvas/Canvas.hxx>
|
||||||
#include <simgear/canvas/CanvasSystemAdapter.hxx>
|
#include <simgear/canvas/CanvasSystemAdapter.hxx>
|
||||||
@@ -51,26 +53,30 @@ namespace canvas
|
|||||||
TextLine lineAt(size_t i) const;
|
TextLine lineAt(size_t i) const;
|
||||||
|
|
||||||
/// Get nearest line to given y-coordinate
|
/// Get nearest line to given y-coordinate
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,6,5)
|
||||||
TextLine nearestLine(float pos_y) const;
|
TextLine nearestLine(float pos_y) const;
|
||||||
|
|
||||||
|
|
||||||
SGVec2i sizeForWidth(int w) const;
|
SGVec2i sizeForWidth(int w) const;
|
||||||
|
|
||||||
virtual osg::BoundingBox
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
|
||||||
computeBound()
|
|
||||||
#else
|
#else
|
||||||
computeBoundingBox()
|
TextLine nearestLine(float pos_y);
|
||||||
|
SGVec2i sizeForWidth(int w);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||||
|
osg::BoundingBox computeBound() const override;
|
||||||
|
#else
|
||||||
|
osg::BoundingBox computeBoundingBox() const override;
|
||||||
#endif
|
#endif
|
||||||
const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
friend class TextLine;
|
friend class TextLine;
|
||||||
|
|
||||||
canvas::Text *_text_element;
|
canvas::Text *_text_element;
|
||||||
|
|
||||||
virtual void computePositions(unsigned int contextID) const;
|
#if OSG_VERSION_LESS_THAN(3,5,6)
|
||||||
|
void computePositions(unsigned int contextID) const override;
|
||||||
|
#else
|
||||||
|
void computePositionsImplementation() override;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextLine
|
class TextLine
|
||||||
@@ -121,6 +127,7 @@ namespace canvas
|
|||||||
|
|
||||||
_quads = &text->_textureGlyphQuadMap.begin()->second;
|
_quads = &text->_textureGlyphQuadMap.begin()->second;
|
||||||
|
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,5,6)
|
||||||
GlyphQuads::LineNumbers const& line_numbers = _quads->_lineNumbers;
|
GlyphQuads::LineNumbers const& line_numbers = _quads->_lineNumbers;
|
||||||
GlyphQuads::LineNumbers::const_iterator begin_it =
|
GlyphQuads::LineNumbers::const_iterator begin_it =
|
||||||
std::lower_bound(line_numbers.begin(), line_numbers.end(), _line);
|
std::lower_bound(line_numbers.begin(), line_numbers.end(), _line);
|
||||||
@@ -132,6 +139,9 @@ namespace canvas
|
|||||||
_begin = begin_it - line_numbers.begin();
|
_begin = begin_it - line_numbers.begin();
|
||||||
_end = std::upper_bound(begin_it, line_numbers.end(), _line)
|
_end = std::upper_bound(begin_it, line_numbers.end(), _line)
|
||||||
- line_numbers.begin();
|
- line_numbers.begin();
|
||||||
|
#else
|
||||||
|
// TODO: Need 3.5.6 version of this
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -160,12 +170,17 @@ namespace canvas
|
|||||||
|
|
||||||
if( empty() )
|
if( empty() )
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
|
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,6)
|
||||||
|
// TODO: need 3.5.6 version of this.
|
||||||
|
#else
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,5)
|
#if OSG_VERSION_LESS_THAN(3,3,5)
|
||||||
GlyphQuads::Coords2 const& coords = _quads->_coords;
|
GlyphQuads::Coords2 const& coords = _quads->_coords;
|
||||||
#else
|
#else
|
||||||
GlyphQuads::Coords2 refCoords = _quads->_coords;
|
GlyphQuads::Coords2 refCoords = _quads->_coords;
|
||||||
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t global_i = _begin + i;
|
size_t global_i = _begin + i;
|
||||||
|
|
||||||
if (global_i == _begin)
|
if (global_i == _begin)
|
||||||
@@ -188,6 +203,7 @@ namespace canvas
|
|||||||
// position at center between characters
|
// position at center between characters
|
||||||
pos.x() = 0.5 * (prev_r + cur_l);
|
pos.x() = 0.5 * (prev_r + cur_l);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
@@ -198,7 +214,10 @@ namespace canvas
|
|||||||
if (empty())
|
if (empty())
|
||||||
return cursorPos(0);
|
return cursorPos(0);
|
||||||
|
|
||||||
GlyphQuads::Glyphs const& glyphs = _quads->_glyphs;
|
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,6)
|
||||||
|
// TODO: need 3.5.7 version of this.
|
||||||
|
return cursorPos(0);
|
||||||
|
#else
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,5)
|
#if OSG_VERSION_LESS_THAN(3,3,5)
|
||||||
GlyphQuads::Coords2 const& coords = _quads->_coords;
|
GlyphQuads::Coords2 const& coords = _quads->_coords;
|
||||||
#else
|
#else
|
||||||
@@ -206,6 +225,8 @@ namespace canvas
|
|||||||
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
GlyphQuads::Coords2::element_type &coords = *refCoords.get();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GlyphQuads::Glyphs const& glyphs = _quads->_glyphs;
|
||||||
|
|
||||||
float const HIT_FRACTION = 0.6;
|
float const HIT_FRACTION = 0.6;
|
||||||
float const character_width = _text->getCharacterHeight()
|
float const character_width = _text->getCharacterHeight()
|
||||||
* _text->getCharacterAspectRatio();
|
* _text->getCharacterAspectRatio();
|
||||||
@@ -224,6 +245,7 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
return cursorPos(i - _begin);
|
return cursorPos(i - _begin);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -302,9 +324,16 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,6,5)
|
||||||
TextLine Text::TextOSG::nearestLine(float pos_y) const
|
TextLine Text::TextOSG::nearestLine(float pos_y) const
|
||||||
{
|
{
|
||||||
osgText::Font const* font = getActiveFont();
|
osgText::Font const* font = getActiveFont();
|
||||||
|
#else
|
||||||
|
TextLine Text::TextOSG::nearestLine(float pos_y)
|
||||||
|
{
|
||||||
|
auto font = getActiveFont();
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !font || lineCount() <= 0 )
|
if( !font || lineCount() <= 0 )
|
||||||
return TextLine(0, this);
|
return TextLine(0, this);
|
||||||
|
|
||||||
@@ -326,12 +355,21 @@ namespace canvas
|
|||||||
// simplified version of osgText::Text::computeGlyphRepresentation() to
|
// simplified version of osgText::Text::computeGlyphRepresentation() to
|
||||||
// just calculate the size for a given weight. Glpyh calculations/creating
|
// just calculate the size for a given weight. Glpyh calculations/creating
|
||||||
// is not necessary for this...
|
// is not necessary for this...
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,6,5)
|
||||||
SGVec2i Text::TextOSG::sizeForWidth(int w) const
|
SGVec2i Text::TextOSG::sizeForWidth(int w) const
|
||||||
|
#else
|
||||||
|
SGVec2i Text::TextOSG::sizeForWidth(int w)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if( _text.empty() )
|
if( _text.empty() )
|
||||||
return SGVec2i(0, 0);
|
return SGVec2i(0, 0);
|
||||||
|
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,6,5)
|
||||||
osgText::Font* activefont = const_cast<osgText::Font*>(getActiveFont());
|
osgText::Font* activefont = const_cast<osgText::Font*>(getActiveFont());
|
||||||
|
#else
|
||||||
|
auto activefont = getActiveFont();
|
||||||
|
#endif
|
||||||
|
|
||||||
if( !activefont )
|
if( !activefont )
|
||||||
return SGVec2i(-1, -1);
|
return SGVec2i(-1, -1);
|
||||||
|
|
||||||
@@ -611,19 +649,16 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::BoundingBox
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||||
Text::TextOSG::computeBound()
|
osg::BoundingBox Text::TextOSG::computeBound() const
|
||||||
#else
|
#else
|
||||||
Text::TextOSG::computeBoundingBox()
|
osg::BoundingBox Text::TextOSG::computeBoundingBox() const
|
||||||
#endif
|
#endif
|
||||||
const
|
|
||||||
{
|
{
|
||||||
osg::BoundingBox bb =
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,3,2)
|
#if OSG_VERSION_LESS_THAN(3,3,2)
|
||||||
osgText::Text::computeBound();
|
osg::BoundingBox bb = osgText::Text::computeBound();
|
||||||
#else
|
#else
|
||||||
osgText::Text::computeBoundingBox();
|
osg::BoundingBox bb = osgText::Text::computeBoundingBox();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OSG_VERSION_LESS_THAN(3,1,0)
|
#if OSG_VERSION_LESS_THAN(3,1,0)
|
||||||
@@ -639,7 +674,7 @@ namespace canvas
|
|||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
#if OSG_VERSION_LESS_THAN(3,5,6)
|
||||||
void Text::TextOSG::computePositions(unsigned int contextID) const
|
void Text::TextOSG::computePositions(unsigned int contextID) const
|
||||||
{
|
{
|
||||||
if( _textureGlyphQuadMap.empty() || _layout == VERTICAL )
|
if( _textureGlyphQuadMap.empty() || _layout == VERTICAL )
|
||||||
@@ -709,6 +744,14 @@ namespace canvas
|
|||||||
return osgText::Text::computePositions(contextID);
|
return osgText::Text::computePositions(contextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
void Text::TextOSG::computePositionsImplementation()
|
||||||
|
{
|
||||||
|
TextBase::computePositionsImplementation();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const std::string Text::TYPE_NAME = "text";
|
const std::string Text::TYPE_NAME = "text";
|
||||||
|
|
||||||
@@ -865,12 +908,12 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
osg::StateSet* Text::getOrCreateStateSet()
|
osg::StateSet* Text::getOrCreateStateSet()
|
||||||
{
|
{
|
||||||
if( !_transform.valid() )
|
if( !_scene_group.valid() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
// Only check for StateSet on Transform, as the text stateset is shared
|
// Only check for StateSet on Transform, as the text stateset is shared
|
||||||
// between all text instances using the same font (texture).
|
// between all text instances using the same font (texture).
|
||||||
return _transform->getOrCreateStateSet();
|
return _scene_group->getOrCreateStateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// A text on the Canvas
|
///@file
|
||||||
|
/// A text on the Canvas
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef CANVAS_PATH_HXX_
|
|
||||||
# error Canvas - do not include this file!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define n BOOST_PP_ITERATION()
|
|
||||||
|
|
||||||
Path& addSegment( uint8_t cmd
|
|
||||||
BOOST_PP_COMMA_IF(n)
|
|
||||||
BOOST_PP_ENUM_PARAMS(n, float coord) )
|
|
||||||
{
|
|
||||||
_node->addChild("cmd")->setIntValue(cmd);
|
|
||||||
|
|
||||||
#define SG_CANVAS_PATH_SET_COORD(z, n, dummy)\
|
|
||||||
_node->addChild("coord")->setFloatValue(coord##n);
|
|
||||||
|
|
||||||
BOOST_PP_REPEAT(n, SG_CANVAS_PATH_SET_COORD, 0)
|
|
||||||
#undef SG_CANVAS_PATH_SET_COORD
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef n
|
|
||||||
@@ -67,6 +67,7 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
_node_lat = node;
|
_node_lat = node;
|
||||||
_status &= ~LAT_MISSING;
|
_status &= ~LAT_MISSING;
|
||||||
|
_xNode.reset();
|
||||||
|
|
||||||
if( node == _node_lon )
|
if( node == _node_lon )
|
||||||
{
|
{
|
||||||
@@ -79,6 +80,7 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
_node_lon = node;
|
_node_lon = node;
|
||||||
_status &= ~LON_MISSING;
|
_status &= ~LON_MISSING;
|
||||||
|
_yNode.reset();
|
||||||
|
|
||||||
if( node == _node_lat )
|
if( node == _node_lat )
|
||||||
{
|
{
|
||||||
@@ -97,19 +99,34 @@ namespace canvas
|
|||||||
return _node_lon ? _node_lon->getStringValue() : "";
|
return _node_lon ? _node_lon->getStringValue() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCachedLatLon(const std::pair<double, double>& latLon)
|
||||||
|
{ _cachedLatLon = latLon; }
|
||||||
|
|
||||||
|
std::pair<double, double> getCachedLatLon()
|
||||||
|
{ return _cachedLatLon; }
|
||||||
|
|
||||||
void setTargetName(const std::string& name)
|
void setTargetName(const std::string& name)
|
||||||
{
|
{
|
||||||
_target_name = name;
|
_target_name = name;
|
||||||
|
_xNode.reset();
|
||||||
|
_yNode.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setScreenPos(float x, float y)
|
void setScreenPos(float x, float y)
|
||||||
{
|
{
|
||||||
assert( isComplete() );
|
assert( isComplete() );
|
||||||
|
if (!_xNode) {
|
||||||
SGPropertyNode *parent = _node_lat->getParent();
|
SGPropertyNode *parent = _node_lat->getParent();
|
||||||
parent->getChild(_target_name, _node_lat->getIndex(), true)
|
_xNode = parent->getChild(_target_name, _node_lat->getIndex(), true);
|
||||||
->setDoubleValue(x);
|
}
|
||||||
parent->getChild(_target_name, _node_lon->getIndex(), true)
|
|
||||||
->setDoubleValue(y);
|
if (!_yNode) {
|
||||||
|
SGPropertyNode *parent = _node_lat->getParent();
|
||||||
|
_yNode = parent->getChild(_target_name, _node_lon->getIndex(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_xNode->setDoubleValue(x);
|
||||||
|
_yNode->setDoubleValue(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print()
|
void print()
|
||||||
@@ -125,6 +142,9 @@ namespace canvas
|
|||||||
SGPropertyNode *_node_lat,
|
SGPropertyNode *_node_lat,
|
||||||
*_node_lon;
|
*_node_lon;
|
||||||
std::string _target_name;
|
std::string _target_name;
|
||||||
|
SGPropertyNode_ptr _xNode,
|
||||||
|
_yNode;
|
||||||
|
std::pair<double, double> _cachedLatLon;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Geographic projections for Canvas map element
|
///@file
|
||||||
|
/// Geographic projections for Canvas map element
|
||||||
//
|
//
|
||||||
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -190,6 +191,32 @@ namespace canvas
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebMercator projection, relative to the projection center.
|
||||||
|
* Required for Slippy Maps - i.e. openstreetmap
|
||||||
|
*/
|
||||||
|
class WebMercatorProjection:
|
||||||
|
public HorizontalProjection
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual ScreenPosition project(double lat, double lon) const
|
||||||
|
{
|
||||||
|
double d_lat = lat - _ref_lat,
|
||||||
|
d_lon = lon - _ref_lon;
|
||||||
|
double r = 6378137.f / 1852; // Equatorial radius divided by ?
|
||||||
|
|
||||||
|
ScreenPosition pos;
|
||||||
|
|
||||||
|
pos.x = r * d_lon;
|
||||||
|
pos.y = r * (log(tan(d_lat) + 1.0 / cos(d_lat)));
|
||||||
|
//pos.x = lon;
|
||||||
|
//pos.y = log(tan(lat) + 1.0 / cos(lat));
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace canvas
|
} // namespace canvas
|
||||||
} // namespace simgear
|
} // namespace simgear
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Canvas user defined event
|
///@file
|
||||||
|
/// Canvas user defined event
|
||||||
//
|
//
|
||||||
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -46,6 +47,14 @@ namespace canvas
|
|||||||
// assert( type_map.find(type_id) != type_map.end() );
|
// assert( type_map.find(type_id) != type_map.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
CustomEvent* CustomEvent::clone(int type) const
|
||||||
|
{
|
||||||
|
auto event = new CustomEvent(*this);
|
||||||
|
event->type = type;
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void CustomEvent::setDetail(StringMap const& data)
|
void CustomEvent::setDetail(StringMap const& data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace canvas
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @brief Construct a user defined event from a type string
|
||||||
*
|
*
|
||||||
* @param type_str Event type name (if name does not exist yet it will
|
* @param type_str Event type name (if name does not exist yet it will
|
||||||
* be registered as new event type)
|
* be registered as new event type)
|
||||||
@@ -49,6 +50,10 @@ namespace canvas
|
|||||||
StringMap const& data = StringMap() );
|
StringMap const& data = StringMap() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @brief Construct a user defined event from a (previously registered)
|
||||||
|
* type id
|
||||||
|
*
|
||||||
|
* @see getOrRegisterType()
|
||||||
*
|
*
|
||||||
* @param type_id Event type id
|
* @param type_id Event type id
|
||||||
* @param bubbles If this event should take part in the bubbling phase
|
* @param bubbles If this event should take part in the bubbling phase
|
||||||
@@ -58,6 +63,8 @@ namespace canvas
|
|||||||
bool bubbles = false,
|
bool bubbles = false,
|
||||||
StringMap const& data = StringMap() );
|
StringMap const& data = StringMap() );
|
||||||
|
|
||||||
|
CustomEvent* clone(int type = 0) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set user data
|
* Set user data
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +81,7 @@ namespace canvas
|
|||||||
* @see #bubbles
|
* @see #bubbles
|
||||||
* @see CustomEvent()
|
* @see CustomEvent()
|
||||||
*/
|
*/
|
||||||
virtual bool canBubble() const { return bubbles; }
|
bool canBubble() const override { return bubbles; }
|
||||||
|
|
||||||
StringMap detail; //!< User data map
|
StringMap detail; //!< User data map
|
||||||
bool bubbles; //!< Whether the event supports bubbling
|
bool bubbles; //!< Whether the event supports bubbling
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Input device event
|
///@file
|
||||||
|
/// Input device event
|
||||||
//
|
//
|
||||||
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Keyboard event
|
///@file
|
||||||
|
/// Keyboard event
|
||||||
//
|
//
|
||||||
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
|
|
||||||
#include "KeyboardEvent.hxx"
|
#include "KeyboardEvent.hxx"
|
||||||
#include "utf8.h"
|
|
||||||
|
|
||||||
#include <osgGA/GUIEventAdapter>
|
#include <osgGA/GUIEventAdapter>
|
||||||
|
|
||||||
@@ -43,6 +43,7 @@ namespace canvas
|
|||||||
// TODO check Win/Mac keycode for altgr/ISO Level3 Shift
|
// TODO check Win/Mac keycode for altgr/ISO Level3 Shift
|
||||||
const uint32_t KEY_AltGraph = 0xfe03;
|
const uint32_t KEY_AltGraph = 0xfe03;
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
KeyboardEvent::KeyboardEvent():
|
KeyboardEvent::KeyboardEvent():
|
||||||
_key(0),
|
_key(0),
|
||||||
@@ -69,6 +70,14 @@ namespace canvas
|
|||||||
// // TODO what to do with wrong event type?
|
// // TODO what to do with wrong event type?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
KeyboardEvent* KeyboardEvent::clone(int type) const
|
||||||
|
{
|
||||||
|
auto event = new KeyboardEvent(*this);
|
||||||
|
event->type = type;
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void KeyboardEvent::setKey(uint32_t key)
|
void KeyboardEvent::setKey(uint32_t key)
|
||||||
{
|
{
|
||||||
@@ -269,10 +278,24 @@ namespace canvas
|
|||||||
// Empty or no mapping -> convert UTF-32 key value to UTF-8
|
// Empty or no mapping -> convert UTF-32 key value to UTF-8
|
||||||
if( _name.empty() )
|
if( _name.empty() )
|
||||||
{
|
{
|
||||||
if( !utf8::internal::is_code_point_valid(_key) )
|
if (( _key >= 0xd800u && _key <= 0xdfffu ) || _key > 0x10ffffu )
|
||||||
_name = "Unidentified";
|
_name = "Unidentified";
|
||||||
else
|
else
|
||||||
utf8::unchecked::append(_key, std::back_inserter(_name));
|
if ( _key <= 0x7f ) {
|
||||||
|
_name.push_back(static_cast<uint8_t>(_key));
|
||||||
|
} else if ( _key <= 0x7ff ) {
|
||||||
|
_name.push_back(static_cast<uint8_t>((_key >> 6) | 0xc0));
|
||||||
|
_name.push_back(static_cast<uint8_t>((_key & 0x3f) | 0x80));
|
||||||
|
} else if ( _key <= 0xffff ) {
|
||||||
|
_name.push_back(static_cast<uint8_t>((_key >> 12) | 0xe0));
|
||||||
|
_name.push_back(static_cast<uint8_t>(((_key >> 6) & 0x3f) | 0x80));
|
||||||
|
_name.push_back(static_cast<uint8_t>((_key & 0x3f) | 0x80));
|
||||||
|
} else {
|
||||||
|
_name.push_back(static_cast<uint8_t>((_key >> 18) | 0xf0));
|
||||||
|
_name.push_back(static_cast<uint8_t>(((_key >> 12) & 0x3f) | 0x80));
|
||||||
|
_name.push_back(static_cast<uint8_t>(((_key >> 6) & 0x3f) | 0x80));
|
||||||
|
_name.push_back(static_cast<uint8_t>((_key & 0x3f) | 0x80));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keys on the numpad with NumLock enabled are reported just like their
|
// Keys on the numpad with NumLock enabled are reported just like their
|
||||||
@@ -307,11 +330,30 @@ namespace canvas
|
|||||||
if( key_name.empty() )
|
if( key_name.empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string::const_iterator it = key_name.begin();
|
// Convert the key name to the corresponding code point by checking the
|
||||||
uint32_t cp = utf8::next(it, key_name.end());
|
// sequence length (the first bits of the first byte) and performing the
|
||||||
|
// conversion accordingly.
|
||||||
|
uint32_t cp = key_name[0] & 0xff;
|
||||||
|
size_t len;
|
||||||
|
if (cp < 0x80) {
|
||||||
|
len = 1;
|
||||||
|
} else if ((cp >> 5) == 0x6) {
|
||||||
|
cp = ((cp << 6) & 0x7ff) + (key_name[1] & 0x3f);
|
||||||
|
len = 2;
|
||||||
|
} else if ((cp >> 4) == 0xe) {
|
||||||
|
cp = ((cp << 12) & 0xffff) + (((key_name[1] & 0xff) << 6) & 0xfff)
|
||||||
|
+ (key_name[2] & 0x3f);
|
||||||
|
len = 3;
|
||||||
|
} else if ((cp >> 3) == 0x1e) {
|
||||||
|
cp = ((cp << 18) & 0x1fffff) + (((key_name[1] & 0xff) << 12) & 0x3ffff)
|
||||||
|
+ (((key_name[2] & 0xff) << 6) & 0xfff) + (key_name[3] & 0x3f);
|
||||||
|
len = 4;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if _name contains exactly one (UTF-8 encoded) character.
|
// Check if _name contains exactly one (UTF-8 encoded) character.
|
||||||
if( it != key_name.end() )
|
if (key_name.length() > len)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// C0 and C1 control characters are not printable.
|
// C0 and C1 control characters are not printable.
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace canvas
|
|||||||
|
|
||||||
KeyboardEvent();
|
KeyboardEvent();
|
||||||
KeyboardEvent(const osgGA::GUIEventAdapter& ea);
|
KeyboardEvent(const osgGA::GUIEventAdapter& ea);
|
||||||
|
KeyboardEvent* clone(int type = 0) const override;
|
||||||
|
|
||||||
void setKey(uint32_t key);
|
void setKey(uint32_t key);
|
||||||
void setUnmodifiedKey(uint32_t key);
|
void setUnmodifiedKey(uint32_t key);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Mouse event
|
///@file
|
||||||
|
/// Mouse event
|
||||||
//
|
//
|
||||||
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
@@ -48,6 +49,14 @@ namespace canvas
|
|||||||
button += 1;
|
button += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
MouseEvent* MouseEvent::clone(int type) const
|
||||||
|
{
|
||||||
|
auto event = new MouseEvent(*this);
|
||||||
|
event->type = type;
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool MouseEvent::canBubble() const
|
bool MouseEvent::canBubble() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ namespace canvas
|
|||||||
public:
|
public:
|
||||||
MouseEvent();
|
MouseEvent();
|
||||||
MouseEvent(const osgGA::GUIEventAdapter& ea);
|
MouseEvent(const osgGA::GUIEventAdapter& ea);
|
||||||
|
MouseEvent* clone(int type = 0) const override;
|
||||||
|
|
||||||
virtual bool canBubble() const;
|
bool canBubble() const override;
|
||||||
|
|
||||||
osg::Vec2f getScreenPos() const { return screen_pos; }
|
osg::Vec2f getScreenPos() const { return screen_pos; }
|
||||||
osg::Vec2f getClientPos() const { return client_pos; }
|
osg::Vec2f getClientPos() const { return client_pos; }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// Keyboard event demo. Press some keys and get some info...
|
///@file
|
||||||
|
/// Keyboard event demo. Press some keys and get some info...
|
||||||
//
|
//
|
||||||
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace canvas
|
|||||||
int stretch,
|
int stretch,
|
||||||
uint8_t alignment )
|
uint8_t alignment )
|
||||||
{
|
{
|
||||||
ItemData item_data = {0};
|
ItemData item_data = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
item_data.layout_item = item;
|
item_data.layout_item = item;
|
||||||
item_data.stretch = std::max(0, stretch);
|
item_data.stretch = std::max(0, stretch);
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
#include "Layout.hxx"
|
#include "Layout.hxx"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
NasalWidget::~NasalWidget()
|
NasalWidget::~NasalWidget()
|
||||||
{
|
{
|
||||||
onRemove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -150,7 +150,7 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool NasalWidget::hasHeightForWidth() const
|
bool NasalWidget::hasHeightForWidth() const
|
||||||
{
|
{
|
||||||
return !_height_for_width.empty() || !_min_height_for_width.empty();
|
return _height_for_width || _min_height_for_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -186,13 +186,13 @@ namespace canvas
|
|||||||
int NasalWidget::callHeightForWidthFunc( const HeightForWidthFunc& hfw,
|
int NasalWidget::callHeightForWidthFunc( const HeightForWidthFunc& hfw,
|
||||||
int w ) const
|
int w ) const
|
||||||
{
|
{
|
||||||
if( hfw.empty() )
|
if( !hfw )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
naContext c = naNewContext();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return hfw(nasal::to_nasal(c, const_cast<NasalWidget*>(this)), w);
|
nasal::Context ctx;
|
||||||
|
return hfw(ctx.to_me(const_cast<NasalWidget*>(this)), w);
|
||||||
}
|
}
|
||||||
catch( std::exception const& ex )
|
catch( std::exception const& ex )
|
||||||
{
|
{
|
||||||
@@ -202,7 +202,6 @@ namespace canvas
|
|||||||
"NasalWidget.heightForWidth: callback error: '" << ex.what() << "'"
|
"NasalWidget.heightForWidth: callback error: '" << ex.what() << "'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
naFreeContext(c);
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -240,17 +239,17 @@ namespace canvas
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int NasalWidget::heightForWidthImpl(int w) const
|
int NasalWidget::heightForWidthImpl(int w) const
|
||||||
{
|
{
|
||||||
return callHeightForWidthFunc( _height_for_width.empty()
|
return callHeightForWidthFunc( _height_for_width
|
||||||
? _min_height_for_width
|
? _height_for_width
|
||||||
: _height_for_width, w );
|
: _min_height_for_width, w );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int NasalWidget::minimumHeightForWidthImpl(int w) const
|
int NasalWidget::minimumHeightForWidthImpl(int w) const
|
||||||
{
|
{
|
||||||
return callHeightForWidthFunc( _min_height_for_width.empty()
|
return callHeightForWidthFunc( _min_height_for_width
|
||||||
? _height_for_width
|
? _min_height_for_width
|
||||||
: _min_height_for_width, w );
|
: _height_for_width, w );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -262,8 +261,8 @@ namespace canvas
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nasal::Context c;
|
nasal::Context ctx;
|
||||||
_set_geometry(nasal::to_nasal(c, this), rect);
|
_set_geometry(ctx.to_me(this), rect);
|
||||||
_flags &= ~LAYOUT_DIRTY;
|
_flags &= ~LAYOUT_DIRTY;
|
||||||
}
|
}
|
||||||
catch( std::exception const& ex )
|
catch( std::exception const& ex )
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ namespace canvas
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::function<void (nasal::Me, const SGRecti&)> SetGeometryFunc;
|
typedef std::function<void (nasal::Me, const SGRecti&)> SetGeometryFunc;
|
||||||
typedef boost::function<int (nasal::Me, int)> HeightForWidthFunc;
|
typedef std::function<int (nasal::Me, int)> HeightForWidthFunc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
+6
-1
@@ -95,7 +95,7 @@ const float SG_RADIANS_TO_DEGREES = 180.0f / SG_PI;
|
|||||||
/** Value of earth radius from LaRCsim (ft) */
|
/** Value of earth radius from LaRCsim (ft) */
|
||||||
#define SG_EQUATORIAL_RADIUS_FT 20925650.
|
#define SG_EQUATORIAL_RADIUS_FT 20925650.
|
||||||
|
|
||||||
/** Value of earth radius from LaRCsim (meter) */
|
/** Value of equatorial earth radius from LaRCsim (meter) */
|
||||||
#define SG_EQUATORIAL_RADIUS_M 6378138.12
|
#define SG_EQUATORIAL_RADIUS_M 6378138.12
|
||||||
|
|
||||||
/** Radius squared (ft) */
|
/** Radius squared (ft) */
|
||||||
@@ -104,6 +104,8 @@ const float SG_RADIANS_TO_DEGREES = 180.0f / SG_PI;
|
|||||||
/** Radius squared (meter) */
|
/** Radius squared (meter) */
|
||||||
#define SG_EQ_RAD_SQUARE_M 40680645877797.1344
|
#define SG_EQ_RAD_SQUARE_M 40680645877797.1344
|
||||||
|
|
||||||
|
/** Value of WGS84 polar earth radius (meter) */
|
||||||
|
#define SG_POLAR_RADIUS_M 6356752.3142451794975639668
|
||||||
|
|
||||||
// Physical Constants, SI
|
// Physical Constants, SI
|
||||||
|
|
||||||
@@ -216,6 +218,9 @@ const float SG_RADIANS_TO_DEGREES = 180.0f / SG_PI;
|
|||||||
#define SG_OBJECT_RANGE_ROUGH 9000.0
|
#define SG_OBJECT_RANGE_ROUGH 9000.0
|
||||||
#define SG_OBJECT_RANGE_DETAILED 1500.0
|
#define SG_OBJECT_RANGE_DETAILED 1500.0
|
||||||
|
|
||||||
|
/** Minimum expiry time of PagedLOD within the Tile. Overridden by /sim/rendering/plod-minimum-expiry-time-secs **/
|
||||||
|
#define SG_TILE_MIN_EXPIRY 180.0
|
||||||
|
|
||||||
/** Radius of scenery tiles in m **/
|
/** Radius of scenery tiles in m **/
|
||||||
#define SG_TILE_RADIUS 14000.0
|
#define SG_TILE_RADIUS 14000.0
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,12 @@
|
|||||||
#include <simgear_config.h>
|
#include <simgear_config.h>
|
||||||
#include <simgear/debug/BufferedLogCallback.hxx>
|
#include <simgear/debug/BufferedLogCallback.hxx>
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
|
|
||||||
#include <simgear/sg_inlines.h>
|
#include <simgear/sg_inlines.h>
|
||||||
#include <simgear/threads/SGThread.hxx>
|
#include <simgear/threads/SGThread.hxx>
|
||||||
#include <simgear/threads/SGGuard.hxx>
|
|
||||||
|
|
||||||
#include <cstdlib> // for malloc
|
#include <cstdlib> // for malloc
|
||||||
|
#include <cstring>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
@@ -36,7 +35,7 @@ namespace simgear
|
|||||||
class BufferedLogCallback::BufferedLogCallbackPrivate
|
class BufferedLogCallback::BufferedLogCallbackPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SGMutex m_mutex;
|
std::mutex m_mutex;
|
||||||
vector_cstring m_buffer;
|
vector_cstring m_buffer;
|
||||||
unsigned int m_stamp;
|
unsigned int m_stamp;
|
||||||
unsigned int m_maxLength;
|
unsigned int m_maxLength;
|
||||||
@@ -52,7 +51,7 @@ BufferedLogCallback::BufferedLogCallback(sgDebugClass c, sgDebugPriority p) :
|
|||||||
|
|
||||||
BufferedLogCallback::~BufferedLogCallback()
|
BufferedLogCallback::~BufferedLogCallback()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(unsigned char* msg, d->m_buffer) {
|
for (auto msg : d->m_buffer) {
|
||||||
free(msg);
|
free(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +73,7 @@ void BufferedLogCallback::operator()(sgDebugClass c, sgDebugPriority p,
|
|||||||
msg = (vector_cstring::value_type) strdup(aMessage.c_str());
|
msg = (vector_cstring::value_type) strdup(aMessage.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
SGGuard<SGMutex> g(d->m_mutex);
|
std::lock_guard<std::mutex> g(d->m_mutex);
|
||||||
d->m_buffer.push_back(msg);
|
d->m_buffer.push_back(msg);
|
||||||
d->m_stamp++;
|
d->m_stamp++;
|
||||||
}
|
}
|
||||||
@@ -86,7 +85,7 @@ unsigned int BufferedLogCallback::stamp() const
|
|||||||
|
|
||||||
unsigned int BufferedLogCallback::threadsafeCopy(vector_cstring& aOutput)
|
unsigned int BufferedLogCallback::threadsafeCopy(vector_cstring& aOutput)
|
||||||
{
|
{
|
||||||
SGGuard<SGMutex> g(d->m_mutex);
|
std::lock_guard<std::mutex> g(d->m_mutex);
|
||||||
size_t sz = d->m_buffer.size();
|
size_t sz = d->m_buffer.size();
|
||||||
aOutput.resize(sz);
|
aOutput.resize(sz);
|
||||||
memcpy(aOutput.data(), d->m_buffer.data(), sz * sizeof(vector_cstring::value_type));
|
memcpy(aOutput.data(), d->m_buffer.data(), sz * sizeof(vector_cstring::value_type));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory> // for std::unique_ptr
|
#include <memory> // for std::unique_ptr
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/LogCallback.hxx>
|
||||||
|
|
||||||
namespace simgear
|
namespace simgear
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
|
|
||||||
include (SimGearComponent)
|
include (SimGearComponent)
|
||||||
|
|
||||||
set(HEADERS debug_types.h logstream.hxx BufferedLogCallback.hxx)
|
set(HEADERS debug_types.h
|
||||||
set(SOURCES logstream.cxx BufferedLogCallback.cxx)
|
logstream.hxx BufferedLogCallback.hxx OsgIoCapture.hxx
|
||||||
|
LogCallback.hxx LogEntry.hxx
|
||||||
|
ErrorReportingCallback.hxx)
|
||||||
|
|
||||||
|
set(SOURCES logstream.cxx BufferedLogCallback.cxx
|
||||||
|
LogCallback.cxx LogEntry.cxx
|
||||||
|
ErrorReportingCallback.cxx
|
||||||
|
)
|
||||||
|
|
||||||
simgear_component(debug debug "${SOURCES}" "${HEADERS}")
|
simgear_component(debug debug "${SOURCES}" "${HEADERS}")
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 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
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <simgear_config.h>
|
||||||
|
|
||||||
|
#include "ErrorReportingCallback.hxx"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
static ErrorReportCallback static_callback;
|
||||||
|
|
||||||
|
void setErrorReportCallback(ErrorReportCallback cb)
|
||||||
|
{
|
||||||
|
static_callback = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void reportError(const std::string& msg, const std::string& more)
|
||||||
|
{
|
||||||
|
if (!static_callback)
|
||||||
|
return;
|
||||||
|
|
||||||
|
static_callback(msg, more, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reportFatalError(const std::string& msg, const std::string& more)
|
||||||
|
{
|
||||||
|
if (!static_callback)
|
||||||
|
return;
|
||||||
|
static_callback(msg, more, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 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
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
void reportError(const std::string& msg, const std::string& more = {});
|
||||||
|
|
||||||
|
void reportFatalError(const std::string& msg, const std::string& more = {});
|
||||||
|
|
||||||
|
using ErrorReportCallback = std::function<void(const std::string& msg, const std::string& more, bool isFatal)>;
|
||||||
|
|
||||||
|
void setErrorReportCallback(ErrorReportCallback cb);
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 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
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <simgear_config.h>
|
||||||
|
|
||||||
|
#include "LogCallback.hxx"
|
||||||
|
|
||||||
|
using namespace simgear;
|
||||||
|
|
||||||
|
LogCallback::LogCallback(sgDebugClass c, sgDebugPriority p) : m_class(c),
|
||||||
|
m_priority(p)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogCallback::operator()(sgDebugClass c, sgDebugPriority p,
|
||||||
|
const char* file, int line, const std::string& aMessage)
|
||||||
|
{
|
||||||
|
// override me
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LogCallback::doProcessEntry(const LogEntry& e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogCallback::processEntry(const LogEntry& e)
|
||||||
|
{
|
||||||
|
if (doProcessEntry(e))
|
||||||
|
return; // derived class used the new API
|
||||||
|
|
||||||
|
// call the old API
|
||||||
|
(*this)(e.debugClass, e.debugPriority, e.file, e.line, e.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LogCallback::shouldLog(sgDebugClass c, sgDebugPriority p) const
|
||||||
|
{
|
||||||
|
if ((c & m_class) != 0 && p >= m_priority)
|
||||||
|
return true;
|
||||||
|
if (c == SG_OSG) // always have OSG logging as it OSG logging is configured separately.
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogCallback::setLogLevels(sgDebugClass c, sgDebugPriority p)
|
||||||
|
{
|
||||||
|
m_priority = p;
|
||||||
|
m_class = c;
|
||||||
|
}
|
||||||
|
const char* LogCallback::debugPriorityToString(sgDebugPriority p)
|
||||||
|
{
|
||||||
|
switch (p) {
|
||||||
|
case SG_DEV_ALERT:
|
||||||
|
case SG_ALERT:
|
||||||
|
return "ALRT";
|
||||||
|
case SG_BULK: return "BULK";
|
||||||
|
case SG_DEBUG: return "DBUG";
|
||||||
|
case SG_MANDATORY_INFO:
|
||||||
|
case SG_INFO:
|
||||||
|
return "INFO";
|
||||||
|
case SG_POPUP: return "POPU";
|
||||||
|
case SG_DEV_WARN:
|
||||||
|
case SG_WARN:
|
||||||
|
return "WARN";
|
||||||
|
|
||||||
|
default: return "UNKN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* LogCallback::debugClassToString(sgDebugClass c)
|
||||||
|
{
|
||||||
|
switch (c) {
|
||||||
|
case SG_NONE: return "none";
|
||||||
|
case SG_TERRAIN: return "terrain";
|
||||||
|
case SG_ASTRO: return "astro";
|
||||||
|
case SG_FLIGHT: return "flight";
|
||||||
|
case SG_INPUT: return "input";
|
||||||
|
case SG_GL: return "opengl";
|
||||||
|
case SG_VIEW: return "view";
|
||||||
|
case SG_COCKPIT: return "cockpit";
|
||||||
|
case SG_GENERAL: return "general";
|
||||||
|
case SG_MATH: return "math";
|
||||||
|
case SG_EVENT: return "event";
|
||||||
|
case SG_AIRCRAFT: return "aircraft";
|
||||||
|
case SG_AUTOPILOT: return "autopilot";
|
||||||
|
case SG_IO: return "io";
|
||||||
|
case SG_CLIPPER: return "clipper";
|
||||||
|
case SG_NETWORK: return "network";
|
||||||
|
case SG_ATC: return "atc";
|
||||||
|
case SG_NASAL: return "nasal";
|
||||||
|
case SG_INSTR: return "instruments";
|
||||||
|
case SG_SYSTEMS: return "systems";
|
||||||
|
case SG_AI: return "ai";
|
||||||
|
case SG_ENVIRONMENT: return "environment";
|
||||||
|
case SG_SOUND: return "sound";
|
||||||
|
case SG_NAVAID: return "navaid";
|
||||||
|
case SG_GUI: return "gui";
|
||||||
|
case SG_TERRASYNC: return "terrasync";
|
||||||
|
case SG_PARTICLES: return "particles";
|
||||||
|
case SG_HEADLESS: return "headless";
|
||||||
|
case SG_OSG: return "OSG";
|
||||||
|
default: return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 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
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "LogEntry.hxx"
|
||||||
|
#include "debug_types.h"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class LogCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~LogCallback() = default;
|
||||||
|
|
||||||
|
// newer API: return true if you handled the message, otherwise
|
||||||
|
// the old API will be called
|
||||||
|
virtual bool doProcessEntry(const LogEntry& e);
|
||||||
|
|
||||||
|
// old API, kept for compatability
|
||||||
|
virtual void operator()(sgDebugClass c, sgDebugPriority p,
|
||||||
|
const char* file, int line, const std::string& aMessage);
|
||||||
|
|
||||||
|
void setLogLevels(sgDebugClass c, sgDebugPriority p);
|
||||||
|
|
||||||
|
void processEntry(const LogEntry& e);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LogCallback(sgDebugClass c, sgDebugPriority p);
|
||||||
|
|
||||||
|
bool shouldLog(sgDebugClass c, sgDebugPriority p) const;
|
||||||
|
|
||||||
|
static const char* debugClassToString(sgDebugClass c);
|
||||||
|
static const char* debugPriorityToString(sgDebugPriority p);
|
||||||
|
|
||||||
|
private:
|
||||||
|
sgDebugClass m_class;
|
||||||
|
sgDebugPriority m_priority;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 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
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <simgear_config.h>
|
||||||
|
|
||||||
|
#include "LogEntry.hxx"
|
||||||
|
|
||||||
|
#include <cstring> // for strdup
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
LogEntry::~LogEntry()
|
||||||
|
{
|
||||||
|
if (freeFilename) {
|
||||||
|
free(const_cast<char*>(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogEntry::LogEntry(const LogEntry& c) : debugClass(c.debugClass),
|
||||||
|
debugPriority(c.debugPriority),
|
||||||
|
originalPriority(c.originalPriority),
|
||||||
|
file(c.file),
|
||||||
|
line(c.line),
|
||||||
|
message(c.message),
|
||||||
|
freeFilename(c.freeFilename)
|
||||||
|
{
|
||||||
|
if (c.freeFilename) {
|
||||||
|
file = strdup(c.file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user