1 /**************************************************************************
2 * tileutils.h -- support routines to handle dynamic management of scenery tiles
4 * Written by Curtis Olson, started January 1998.
6 * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * (Log is kept at end of this file)
24 **************************************************************************/
32 int lon; /* longitude (-180 to 179) */
33 int lat; /* latitude (-90 to 89) */
34 int x; /* x (0 to 7) */
35 int y; /* y (0 to 7) */
39 /* Generate the unique scenery tile index containing the specified
42 The index is constructed as follows:
44 9 bits - to represent 360 degrees of longitude (-180 to 179)
45 8 bits - to represent 180 degrees of latitude (-90 to 89)
47 Each 1 degree by 1 degree tile is further broken down into an 8x8
48 grid. So we also need:
50 3 bits - to represent x (0 to 7)
51 3 bits - to represent y (0 to 7) */
52 long int gen_index(struct bucket *p);
55 /* Parse a unique scenery tile index and find the lon, lat, x, and y */
56 void parse_index(long int index, struct bucket *p);
59 /* Build a path name from an tile index */
60 void gen_base_path(struct bucket *p, char *path);
63 /* offset an bucket struct by the specified amounts in the X & Y direction */
64 /* static void offset_bucket(struct bucket *in, struct bucket *out, int x, int y); */
67 /* Given a lat/lon, find the "bucket" or tile that it falls within */
68 void find_bucket(double lon, double lat, struct bucket *p);
71 /* Given a lat/lon, fill in the local tile index array */
72 void gen_idx_array(struct bucket *p1, struct bucket *tiles,
73 int width, int height);
76 #endif /* TILEUTILS_H */
80 /* Revision 1.4 1998/01/13 00:23:12 curt
81 /* Initial changes to support loading and management of scenery tiles. Note,
82 /* there's still a fair amount of work left to be done.
84 * Revision 1.3 1998/01/10 00:01:48 curt
85 * Misc api changes and tweaks.
87 * Revision 1.2 1998/01/08 02:22:28 curt
88 * Continue working on basic features.
90 * Revision 1.1 1998/01/07 23:50:52 curt
91 * "area" renamed to "tile"
93 * Revision 1.1 1998/01/07 23:23:40 curt