tangram-airports 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <div class="airport-search">
3
+ <input
4
+ v-model="query"
5
+ type="text"
6
+ placeholder="Search for airports..."
7
+ @click="($event.target as HTMLInputElement).select()"
8
+ @input="onInput"
9
+ />
10
+ <ul v-if="results.length" class="search-results">
11
+ <li
12
+ v-for="airport in results"
13
+ :key="airport.icao"
14
+ @click="selectAirport(airport)"
15
+ >
16
+ {{ airport.name }} ({{ airport.iata }} | {{ airport.icao }})
17
+ </li>
18
+ </ul>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ import { ref, inject } from "vue";
24
+ import type { TangramApi } from "@open-aviation/tangram-core/api";
25
+ import { airport_information } from "rs1090-wasm";
26
+
27
+ interface Airport {
28
+ lat: number;
29
+ lon: number;
30
+ name: string;
31
+ iata: string;
32
+ icao: string;
33
+ }
34
+
35
+ const tangramApi = inject<TangramApi>("tangramApi");
36
+ if (!tangramApi) {
37
+ throw new Error("assert: tangram api not provided");
38
+ }
39
+ const query = ref("");
40
+ const results = ref<Airport[]>([]);
41
+ const timeoutId = ref<number | null>(null);
42
+
43
+ const onInput = () => {
44
+ if (timeoutId.value) {
45
+ clearTimeout(timeoutId.value);
46
+ }
47
+ if (query.value.length >= 3) {
48
+ timeoutId.value = window.setTimeout(() => {
49
+ searchAirports();
50
+ }, 300);
51
+ } else {
52
+ results.value = [];
53
+ }
54
+ };
55
+
56
+ const searchAirports = () => {
57
+ results.value = airport_information(query.value);
58
+ };
59
+
60
+ const selectAirport = (airport: Airport) => {
61
+ tangramApi.map.getMapInstance().flyTo({
62
+ center: [airport.lon, airport.lat],
63
+ zoom: 13,
64
+ speed: 1.2
65
+ });
66
+ query.value = "";
67
+ results.value = [];
68
+ };
69
+ </script>
70
+
71
+ <style scoped>
72
+ .airport-search {
73
+ position: absolute;
74
+ width: 300px;
75
+ z-index: 1000;
76
+ top: 10px;
77
+ right: 10px;
78
+ }
79
+
80
+ .airport-search input {
81
+ width: 100%;
82
+ padding: 8px 12px;
83
+ border: 1px solid #ccc;
84
+ border-radius: 10px;
85
+ font-family: "B612", sans-serif;
86
+ box-sizing: border-box;
87
+ }
88
+
89
+ .search-results {
90
+ position: absolute;
91
+ top: 100%;
92
+ left: 0;
93
+ right: 0;
94
+ padding: 0;
95
+ margin: 4px 0 0 0;
96
+ list-style: none;
97
+ background: #fff;
98
+ border: 1px solid #ccc;
99
+ z-index: 1001;
100
+ max-height: 200px;
101
+ overflow-y: auto;
102
+ font-family: "B612", sans-serif;
103
+ }
104
+
105
+ .search-results li {
106
+ padding: 5px 10px;
107
+ cursor: pointer;
108
+ }
109
+
110
+ .search-results li:hover {
111
+ background-color: #eee;
112
+ }
113
+ </style>
@@ -0,0 +1,5 @@
1
+ import tangram_core
2
+
3
+ plugin = tangram_core.Plugin(
4
+ frontend_path="dist-frontend",
5
+ )
@@ -0,0 +1 @@
1
+ .airport-search[data-v-ddbda8e0]{position:absolute;width:300px;z-index:1000;top:10px;right:10px}.airport-search input[data-v-ddbda8e0]{width:100%;padding:8px 12px;border:1px solid #ccc;border-radius:10px;font-family:B612,sans-serif;box-sizing:border-box}.search-results[data-v-ddbda8e0]{position:absolute;top:100%;left:0;right:0;padding:0;margin:4px 0 0;list-style:none;background:#fff;border:1px solid #ccc;z-index:1001;max-height:200px;overflow-y:auto;font-family:B612,sans-serif}.search-results li[data-v-ddbda8e0]{padding:5px 10px;cursor:pointer}.search-results li[data-v-ddbda8e0]:hover{background-color:#eee}
@@ -0,0 +1,55 @@
1
+ import { defineComponent as _, inject as g, ref as u, createElementBlock as s, openBlock as i, withDirectives as f, createCommentVNode as h, createElementVNode as k, vModelText as y, Fragment as w, renderList as A, toDisplayString as p } from "vue";
2
+ import { airport_information as x } from "rs1090-wasm";
3
+ const C = { class: "airport-search" }, I = {
4
+ key: 0,
5
+ class: "search-results"
6
+ }, S = ["onClick"], T = /* @__PURE__ */ _({
7
+ __name: "AirportSearchWidget",
8
+ setup(r) {
9
+ const a = g("tangramApi");
10
+ if (!a)
11
+ throw new Error("assert: tangram api not provided");
12
+ const t = u(""), o = u([]), n = u(null), d = () => {
13
+ n.value && clearTimeout(n.value), t.value.length >= 3 ? n.value = window.setTimeout(() => {
14
+ m();
15
+ }, 300) : o.value = [];
16
+ }, m = () => {
17
+ o.value = x(t.value);
18
+ }, v = (c) => {
19
+ a.map.getMapInstance().flyTo({
20
+ center: [c.lon, c.lat],
21
+ zoom: 13,
22
+ speed: 1.2
23
+ }), t.value = "", o.value = [];
24
+ };
25
+ return (c, l) => (i(), s("div", C, [
26
+ f(k("input", {
27
+ "onUpdate:modelValue": l[0] || (l[0] = (e) => t.value = e),
28
+ type: "text",
29
+ placeholder: "Search for airports...",
30
+ onClick: l[1] || (l[1] = (e) => e.target.select()),
31
+ onInput: d
32
+ }, null, 544), [
33
+ [y, t.value]
34
+ ]),
35
+ o.value.length ? (i(), s("ul", I, [
36
+ (i(!0), s(w, null, A(o.value, (e) => (i(), s("li", {
37
+ key: e.icao,
38
+ onClick: (V) => v(e)
39
+ }, p(e.name) + " (" + p(e.iata) + " | " + p(e.icao) + ") ", 9, S))), 128))
40
+ ])) : h("", !0)
41
+ ]));
42
+ }
43
+ }), E = (r, a) => {
44
+ const t = r.__vccOpts || r;
45
+ for (const [o, n] of a)
46
+ t[o] = n;
47
+ return t;
48
+ }, M = /* @__PURE__ */ E(T, [["__scopeId", "data-v-ddbda8e0"]]);
49
+ function D(r) {
50
+ r.ui.registerWidget("airport-search-widget", "MapOverlay", M);
51
+ }
52
+ export {
53
+ D as install
54
+ };
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/tangram_airports/AirportSearchWidget.vue","../src/tangram_airports/index.ts"],"sourcesContent":["<template>\n <div class=\"airport-search\">\n <input\n v-model=\"query\"\n type=\"text\"\n placeholder=\"Search for airports...\"\n @click=\"($event.target as HTMLInputElement).select()\"\n @input=\"onInput\"\n />\n <ul v-if=\"results.length\" class=\"search-results\">\n <li\n v-for=\"airport in results\"\n :key=\"airport.icao\"\n @click=\"selectAirport(airport)\"\n >\n {{ airport.name }} ({{ airport.iata }} | {{ airport.icao }})\n </li>\n </ul>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, inject } from \"vue\";\nimport type { TangramApi } from \"@open-aviation/tangram-core/api\";\nimport { airport_information } from \"rs1090-wasm\";\n\ninterface Airport {\n lat: number;\n lon: number;\n name: string;\n iata: string;\n icao: string;\n}\n\nconst tangramApi = inject<TangramApi>(\"tangramApi\");\nif (!tangramApi) {\n throw new Error(\"assert: tangram api not provided\");\n}\nconst query = ref(\"\");\nconst results = ref<Airport[]>([]);\nconst timeoutId = ref<number | null>(null);\n\nconst onInput = () => {\n if (timeoutId.value) {\n clearTimeout(timeoutId.value);\n }\n if (query.value.length >= 3) {\n timeoutId.value = window.setTimeout(() => {\n searchAirports();\n }, 300);\n } else {\n results.value = [];\n }\n};\n\nconst searchAirports = () => {\n results.value = airport_information(query.value);\n};\n\nconst selectAirport = (airport: Airport) => {\n tangramApi.map.getMapInstance().flyTo({\n center: [airport.lon, airport.lat],\n zoom: 13,\n speed: 1.2\n });\n query.value = \"\";\n results.value = [];\n};\n</script>\n\n<style scoped>\n.airport-search {\n position: absolute;\n width: 300px;\n z-index: 1000;\n top: 10px;\n right: 10px;\n}\n\n.airport-search input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #ccc;\n border-radius: 10px;\n font-family: \"B612\", sans-serif;\n box-sizing: border-box;\n}\n\n.search-results {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n padding: 0;\n margin: 4px 0 0 0;\n list-style: none;\n background: #fff;\n border: 1px solid #ccc;\n z-index: 1001;\n max-height: 200px;\n overflow-y: auto;\n font-family: \"B612\", sans-serif;\n}\n\n.search-results li {\n padding: 5px 10px;\n cursor: pointer;\n}\n\n.search-results li:hover {\n background-color: #eee;\n}\n</style>\n","import type { TangramApi } from \"@open-aviation/tangram-core/api\";\nimport AirportSearchWidget from \"./AirportSearchWidget.vue\";\n\nexport function install(api: TangramApi) {\n api.ui.registerWidget(\"airport-search-widget\", \"MapOverlay\", AirportSearchWidget);\n}\n"],"names":["tangramApi","inject","query","ref","results","timeoutId","onInput","searchAirports","airport_information","selectAirport","airport","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","$event","_cache","_hoisted_2","_Fragment","_renderList","_toDisplayString","_hoisted_3","install","api","AirportSearchWidget"],"mappings":";;;;;;;;AAkCA,UAAMA,IAAaC,EAAmB,YAAY;AAClD,QAAI,CAACD;AACH,YAAM,IAAI,MAAM,kCAAkC;AAEpD,UAAME,IAAQC,EAAI,EAAE,GACdC,IAAUD,EAAe,EAAE,GAC3BE,IAAYF,EAAmB,IAAI,GAEnCG,IAAU,MAAM;AACpB,MAAID,EAAU,SACZ,aAAaA,EAAU,KAAK,GAE1BH,EAAM,MAAM,UAAU,IACxBG,EAAU,QAAQ,OAAO,WAAW,MAAM;AACxC,QAAAE,EAAA;AAAA,MACF,GAAG,GAAG,IAENH,EAAQ,QAAQ,CAAA;AAAA,IAEpB,GAEMG,IAAiB,MAAM;AAC3B,MAAAH,EAAQ,QAAQI,EAAoBN,EAAM,KAAK;AAAA,IACjD,GAEMO,IAAgB,CAACC,MAAqB;AAC1C,MAAAV,EAAW,IAAI,eAAA,EAAiB,MAAM;AAAA,QACpC,QAAQ,CAACU,EAAQ,KAAKA,EAAQ,GAAG;AAAA,QACjC,MAAM;AAAA,QACN,OAAO;AAAA,MAAA,CACR,GACDR,EAAM,QAAQ,IACdE,EAAQ,QAAQ,CAAA;AAAA,IAClB;sBAlEEO,EAAA,GAAAC,EAiBM,OAjBNC,GAiBM;AAAA,QAhBJC,EAME,SAAA;AAAA,sDALSZ,EAAK,QAAAa;AAAA,QACd,MAAK;AAAA,QACL,aAAY;AAAA,QACX,SAAKC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAD,MAAGA,EAAO,OAA4B,OAAA;AAAA,QAC3C,SAAAT;AAAA,MAAA;YAJQJ,EAAA,KAAK;AAAA,MAAA;MAMNE,EAAA,MAAQ,UAAlBO,KAAAC,EAQK,MARLK,GAQK;AAAA,gBAPHL,EAMKM,GAAA,MAAAC,EALef,EAAA,OAAO,CAAlBM,YADTE,EAMK,MAAA;AAAA,UAJF,KAAKF,EAAQ;AAAA,UACb,SAAK,CAAAK,MAAEN,EAAcC,CAAO;AAAA,QAAA,GAE1BU,EAAAV,EAAQ,IAAI,IAAG,SAAKA,EAAQ,IAAI,IAAG,QAAGU,EAAGV,EAAQ,IAAI,IAAG,MAC7D,GAAAW,CAAA;;;;;;;;;;ACbC,SAASC,EAAQC,GAAiB;AACvC,EAAAA,EAAI,GAAG,eAAe,yBAAyB,cAAcC,CAAmB;AAClF;"}
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@open-aviation/tangram-airports",
3
+ "main": "index.js",
4
+ "style": "index.css"
5
+ }
@@ -0,0 +1,6 @@
1
+ import type { TangramApi } from "@open-aviation/tangram-core/api";
2
+ import AirportSearchWidget from "./AirportSearchWidget.vue";
3
+
4
+ export function install(api: TangramApi) {
5
+ api.ui.registerWidget("airport-search-widget", "MapOverlay", AirportSearchWidget);
6
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@open-aviation/tangram-airports",
3
+ "version": "0.2.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "src/tangram_airports/index.ts",
7
+ "scripts": {
8
+ "build": "vite build"
9
+ },
10
+ "dependencies": {
11
+ "@open-aviation/tangram-core": "workspace:*"
12
+ },
13
+ "devDependencies": {
14
+ "rs1090-wasm": "^0.4.14",
15
+ "vue": "^3.5.25"
16
+ }
17
+ }
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: tangram_airports
3
+ Version: 0.2.1
4
+ Summary: Airport search widget plugin for tangram
5
+ Author-email: Xavier Olive <git@xoolive.org>
6
+ License-Expression: AGPL-3.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Scientific/Engineering :: Visualization
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: tangram-core>=0.2.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # tangram_airports
22
+
23
+ The `tangram_airports` plugin adds a searchable airport database widget to the tangram frontend.
24
+
25
+ It allows users to quickly locate and center the map on airports using their name, IATA, or ICAO codes.
26
+
27
+ ## About Tangram
28
+
29
+ `tangram_airports` is a plugin for `tangram`, an open framework for modular, real-time air traffic management research.
30
+
31
+ - Documentation: <https://mode-s.org/tangram/>
32
+ - Repository: <https://github.com/open-aviation/tangram>
33
+
34
+ Installation:
35
+
36
+ ```sh
37
+ # cli via uv
38
+ uv tool install --with tangram-airports tangram-core
39
+ # with pip
40
+ pip install tangram-core tangram-airports
41
+ ```
@@ -0,0 +1,12 @@
1
+ tangram_airports/AirportSearchWidget.vue,sha256=nla7RtdjscjlCv0hDUOlo6C0MYSVxYvBwdQjwm6cuPE,2275
2
+ tangram_airports/__init__.py,sha256=Ac5Xf05VZmfh5ojtmmve3csrvPrqzWXJ5LA1Z5KMnJE,88
3
+ tangram_airports/index.ts,sha256=d7zWrEeu_O4Fiy7ta0hdnnSKJho5zI1I2dRzPPmjm0s,259
4
+ tangram_airports/dist-frontend/index.css,sha256=G8xBDgzxLQtPwzaaPIW_qvHIrtsx8VyecH8DgoQk5pg,615
5
+ tangram_airports/dist-frontend/index.js,sha256=XYXCHhYI1DAfQcMVJr-gSPivGORszQcC60pHx0F-BiM,1913
6
+ tangram_airports/dist-frontend/index.js.map,sha256=Vnuw94mpPVf1w-QS7TtdMRWqPfWtX4pGle-6krN01Z4,4410
7
+ tangram_airports/dist-frontend/plugin.json,sha256=HddNVWbOpTk0UFtbUy8frAjbz1Rw_kiRNxppZJcfi6k,93
8
+ tangram_airports/package.json,sha256=P2_3AqFQ4-OJv5-Okg7Jc04MSifxWPYOdNsxlXXl4rk,350
9
+ tangram_airports-0.2.1.dist-info/METADATA,sha256=S5qPtW0ltDvM-Ofd6cckGP2qdvpeblFJ4h8oR7PLL4k,1428
10
+ tangram_airports-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
11
+ tangram_airports-0.2.1.dist-info/entry_points.txt,sha256=x_brdPCglCJL2UVVRCg-AIyAfdNpnV3k-v2XE8xNOc8,66
12
+ tangram_airports-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [tangram_core.plugins]
2
+ tangram_airports = tangram_airports:plugin