libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
chartdb.h
Go to the documentation of this file.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license in the file COPYING
10 * or http://www.opensource.org/licenses/CDDL-1.0.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file COPYING.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2023 Saso Kiselkov. All rights reserved.
24 */
38#ifndef _ACF_UTILS_CHARTDB_H_
39#define _ACF_UTILS_CHARTDB_H_
40
41#include <stdlib.h>
42
43#include <cairo.h>
44
45#include "geom.h"
46#include "types.h"
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52#define MAX_CHART_INSETS 16
53#define MAX_CHART_PROCS 24
54
55typedef struct chartdb_s chartdb_t;
56
57typedef enum {
58 CHART_TYPE_UNKNOWN = 0, /* Unknown chart type */
59 CHART_TYPE_APD = 1 << 0, /* Airport Diagram */
60 CHART_TYPE_IAP = 1 << 1, /* Instrument Approach Procedure */
61 CHART_TYPE_DP = 1 << 2, /* Departure Procedure */
62 CHART_TYPE_ODP = 1 << 3, /* Obstacle Departure Procedure */
63 CHART_TYPE_STAR = 1 << 4, /* Standard Terminal Arrival */
64 CHART_TYPE_MIN = 1 << 5, /* Takeoff Minimums */
65 CHART_TYPE_INFO = 1 << 6, /* Airport Information */
66 CHART_TYPE_ALL = 0xffffffffu
67} chart_type_t;
68
75typedef struct {
83 char *username;
91 char *password;
101 char *cainfo;
103
109typedef struct {
110 vect2_t pts[2];
112
128typedef struct {
129 bool_t present;
130 vect2_t pixels[2];
131 geo_pos2_t pos[2];
132 size_t n_insets;
133 chart_bbox_t insets[MAX_CHART_INSETS];
135
148
156typedef struct {
157 size_t n_procs;
158 char procs[MAX_CHART_PROCS][8];
160
202API_EXPORT chartdb_t *chartdb_init(const char *cache_path,
203 const char *pdftoppm_path, const char *pdfinfo_path,
204 unsigned airac, const char *provider_name,
205 const chart_prov_info_login_t *provider_login);
210API_EXPORT void chartdb_fini(chartdb_t *cdb);
215API_EXPORT bool_t chartdb_test_connection(const char *provider_name,
216 const chart_prov_info_login_t *creds);
231API_EXPORT bool_t chartdb_test_connection2(const char *provider_name,
232 const chart_prov_info_login_t *creds, const char *proxy);
241API_EXPORT void chartdb_set_load_limit(chartdb_t *cdb, uint64_t bytes);
247API_EXPORT void chartdb_purge(chartdb_t *cdb);
256API_EXPORT void chartdb_set_proxy(chartdb_t *cdb, const char *proxy);
268API_EXPORT size_t chartdb_get_proxy(chartdb_t *cdb, char *proxy, size_t cap);
284API_EXPORT char **chartdb_get_chart_names(chartdb_t *cdb, const char *icao,
285 chart_type_t type, size_t *num_charts);
292API_EXPORT void chartdb_free_str_list(char **name_list, size_t num);
306API_EXPORT char *chartdb_get_chart_codename(chartdb_t *cdb,
307 const char *icao, const char *chart_name);
314API_EXPORT chart_type_t chartdb_get_chart_type(chartdb_t *cdb,
315 const char *icao, const char *chart_name);
324API_EXPORT chart_georef_t chartdb_get_chart_georef(chartdb_t *cdb,
325 const char *icao, const char *chart_name);
335API_EXPORT chart_bbox_t chartdb_get_chart_view(chartdb_t *cdb,
336 const char *icao, const char *chart_name, chart_view_t view);
346API_EXPORT chart_procs_t chartdb_get_chart_procs(chartdb_t *cdb,
347 const char *icao, const char *chart_name);
395API_EXPORT bool_t chartdb_get_chart_surface(chartdb_t *cdb,
396 const char *icao, const char *chart_name, int page, double zoom,
397 bool_t night, cairo_surface_t **surf, int *num_pages);
406API_EXPORT bool_t chartdb_is_ready(chartdb_t *cdb);
416API_EXPORT bool_t chartdb_is_arpt_known(chartdb_t *cdb, const char *icao);
424API_EXPORT char *chartdb_get_arpt_name(chartdb_t *cdb, const char *icao);
432API_EXPORT char *chartdb_get_arpt_city(chartdb_t *cdb, const char *icao);
440API_EXPORT char *chartdb_get_arpt_state(chartdb_t *cdb, const char *icao);
462API_EXPORT char *chartdb_get_metar(chartdb_t *cdb, const char *icao);
468API_EXPORT char *chartdb_get_taf(chartdb_t *cdb, const char *icao);
483API_EXPORT bool_t chartdb_pending_ext_account_setup(chartdb_t *cdb);
484
485#ifdef __cplusplus
486}
487#endif
488
489#endif /* _ACF_UTILS_CHARTDB_H_ */
char * chartdb_get_chart_codename(chartdb_t *cdb, const char *icao, const char *chart_name)
Definition chartdb.c:1519
bool_t chartdb_pending_ext_account_setup(chartdb_t *cdb)
Definition chartdb.c:1914
chart_georef_t chartdb_get_chart_georef(chartdb_t *cdb, const char *icao, const char *chart_name)
Definition chartdb.c:1566
bool_t chartdb_test_connection2(const char *provider_name, const chart_prov_info_login_t *creds, const char *proxy)
Definition chartdb.c:1331
char * chartdb_get_taf(chartdb_t *cdb, const char *icao)
Definition chartdb.c:1810
char * chartdb_get_arpt_city(chartdb_t *cdb, const char *icao)
Definition chartdb.c:1792
bool_t chartdb_is_ready(chartdb_t *cdb)
Definition chartdb.c:1751
char * chartdb_get_metar(chartdb_t *cdb, const char *icao)
Definition chartdb.c:1804
chartdb_t * chartdb_init(const char *cache_path, const char *pdftoppm_path, const char *pdfinfo_path, unsigned airac, const char *provider_name, const chart_prov_info_login_t *provider_login)
Definition chartdb.c:1212
void chartdb_fini(chartdb_t *cdb)
Definition chartdb.c:1278
chart_bbox_t chartdb_get_chart_view(chartdb_t *cdb, const char *icao, const char *chart_name, chart_view_t view)
Definition chartdb.c:1589
chart_type_t chartdb_get_chart_type(chartdb_t *cdb, const char *icao, const char *chart_name)
Definition chartdb.c:1544
size_t chartdb_get_proxy(chartdb_t *cdb, char *proxy, size_t cap)
Definition chartdb.c:1385
char * chartdb_get_arpt_name(chartdb_t *cdb, const char *icao)
Definition chartdb.c:1786
chart_view_t
Definition chartdb.h:141
@ CHART_VIEW_PLANVIEW
Definition chartdb.h:143
@ CHART_VIEW_MINIMUMS
Definition chartdb.h:145
@ CHART_VIEW_HEADER
Definition chartdb.h:142
@ CHART_VIEW_PROFILE
Definition chartdb.h:144
void chartdb_free_str_list(char **name_list, size_t num)
Definition chartdb.c:1471
bool_t chartdb_test_connection(const char *provider_name, const chart_prov_info_login_t *creds)
Definition chartdb.c:1324
char * chartdb_get_arpt_state(chartdb_t *cdb, const char *icao)
Definition chartdb.c:1798
char ** chartdb_get_chart_names(chartdb_t *cdb, const char *icao, chart_type_t type, size_t *num_charts)
Definition chartdb.c:1406
chart_procs_t chartdb_get_chart_procs(chartdb_t *cdb, const char *icao, const char *chart_name)
Definition chartdb.c:1613
void chartdb_set_proxy(chartdb_t *cdb, const char *proxy)
Definition chartdb.c:1373
void chartdb_set_load_limit(chartdb_t *cdb, uint64_t bytes)
Definition chartdb.c:1349
bool_t chartdb_is_arpt_known(chartdb_t *cdb, const char *icao)
Definition chartdb.c:1761
void chartdb_purge(chartdb_t *cdb)
Definition chartdb.c:1359
bool_t chartdb_get_chart_surface(chartdb_t *cdb, const char *icao, const char *chart_name, int page, double zoom, bool_t night, cairo_surface_t **surf, int *num_pages)
Definition chartdb.c:1636
bool_t present
Definition chartdb.h:129
size_t n_insets
Definition chartdb.h:132