1 /* 2 * 3 * XASTIR, Amateur Station Tracking and Information Reporting 4 * Copyright (C) 1999,2000 Frank Giannandrea 5 * Copyright (C) 2000-2019 The Xastir Group 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * 21 * Look at the README for more information on the program. 22 */ 23 24 #ifndef __XASTIR_MAPS_H 25 #define __XASTIR_MAPS_H 26 27 #include <X11/Intrinsic.h> 28 #include <Xm/Xm.h> 29 30 #define MAX_OUTBOUND 900 31 #define MAX_MAP_POINTS 100000 32 #define MAX_FILENAME 2000 33 34 #define DRAW_TO_PIXMAP 0 35 #define DRAW_TO_PIXMAP_FINAL 1 36 #define DRAW_TO_PIXMAP_ALERTS 2 37 #define INDEX_CHECK_TIMESTAMPS 9998 38 #define INDEX_NO_TIMESTAMPS 9999 39 40 41 /* memory structs */ 42 43 typedef struct 44 { 45 unsigned char vector_start_color; 46 unsigned char object_behavior; 47 unsigned long longitude; 48 unsigned long latitude; 49 } map_vectors; 50 51 typedef struct 52 { 53 unsigned long longitude; 54 unsigned long latitude; 55 unsigned int mag; 56 char label_text[33]; 57 unsigned char text_color_quad; 58 } text_label; 59 60 typedef struct 61 { 62 unsigned long longitude; 63 unsigned long latitude; 64 unsigned int mag; 65 unsigned char symbol; 66 unsigned char aprs_symbol; 67 unsigned char text_color; 68 char label_text[30]; 69 } symbol_label; 70 71 typedef struct _map_index_record 72 { 73 char filename[MAX_FILENAME]; 74 XmString XmStringPtr; 75 unsigned long bottom; 76 unsigned long top; 77 unsigned long left; 78 unsigned long right; 79 int accessed; 80 int max_zoom; // Specify maximum zoom at which this layer is drawn. 81 int min_zoom; // Specify minimum zoom at which this layer is drawn. 82 int map_layer; // Specify which layer to draw the map on. 83 int draw_filled; // Specify whether to fill polygons when drawing. 84 // 0 = Global No-Fill (Vector) 85 // 1 = Global Fill 86 // 2 = Auto (dbfawk controls it if present) 87 int usgs_drg; // Specify whether the map has USGS DRG colormap 88 // and should have color configuration applied 89 // 0 = No 90 // 1 = Yes 91 // 2 = Auto (detect from TIFFTAG_IMAGEDESCRIPTION) 92 int selected; // Specifies if map is currently selected 93 int temp_select; // Temporary selection used in map properties dialog 94 int auto_maps; // Specifies if map included in automaps function 95 struct _map_index_record *next; 96 } map_index_record; 97 extern map_index_record *map_index_head; 98 99 typedef struct 100 { 101 int img_x; 102 int img_y; 103 unsigned long x_long; 104 unsigned long y_lat; 105 } tiepoint; 106 107 void draw_point(Widget w, 108 unsigned long x1, 109 unsigned long y1, 110 GC gc, 111 Pixmap which_pixmap, 112 int skip_duplicates); 113 114 void draw_point_ll(Widget w, 115 float y1, 116 float x1, 117 GC gc, 118 Pixmap which_pixmap, 119 int skip_duplicates); 120 121 void draw_vector(Widget w, 122 unsigned long x1, 123 unsigned long y1, 124 unsigned long x2, 125 unsigned long y2, 126 GC gc, 127 Pixmap which_pixmap, 128 int skip_duplicates); 129 130 void draw_vector_ll(Widget w, 131 float y1, 132 float x1, 133 float y2, 134 float x2, 135 GC gc, 136 Pixmap which_pixmap, 137 int skip_duplicates); 138 139 char *get_map_ext (char *filename); 140 char *get_map_dir (char *fullpath); 141 void load_auto_maps(Widget w, char *dir); 142 void load_maps(Widget w); 143 void fill_in_new_alert_entries(void); 144 void load_alert_maps(Widget w, char *dir); 145 void index_update_xastir(char *filename, unsigned long bottom, unsigned long top, unsigned long left, unsigned long right, int default_map_layer); 146 void index_update_ll(char *filename, double bottom, double top, double left, double right, int default_map_layer); 147 extern void get_horizontal_datum(char *datum, int sizeof_datum); 148 void draw_grid (Widget w); 149 void Snapshot(void); 150 extern int index_retrieve(char *filename, unsigned long *bottom, 151 unsigned long *top, unsigned long *left, unsigned long *right, 152 int *max_zoom, int *min_zoom, int *map_layer, int *draw_filled, 153 int *usgs_drg, int *automaps); 154 extern void index_restore_from_file(void); 155 extern void index_save_to_file(void); 156 extern void map_indexer(int parameter); 157 extern void get_viewport_lat_lon(double *xmin, 158 double *ymin, 159 double *xmax, 160 double *ymax); 161 extern int map_visible (unsigned long bottom_map_boundary, 162 unsigned long top_map_boundary, 163 unsigned long left_map_boundary, 164 unsigned long right_map_boundary); 165 extern int map_visible_lat_lon (double f_bottom_map_boundary, 166 double f_top_map_boundary, 167 double f_left_map_boundary, 168 double f_right_map_boundary); 169 extern int map_inside_viewport_lat_lon(double map_min_y, 170 double map_max_y, 171 double map_min_x, 172 double map_max_x); 173 extern void draw_label_text (Widget w, int x, int y, int label_length, int color, char *label_text); 174 extern void draw_rotated_label_text (Widget w, int rotation, int x, int y, int label_length, int color, char *label_text, int fontsize); 175 extern int get_rotated_label_text_length_pixels(Widget w, char *label_text, int fontsize); 176 extern void draw_centered_label_text (Widget w, int rotation, int x, int y, int label_length, int color, char *label_text, int fontsize); 177 extern void Monochrome( Widget widget, XtPointer clientData, XtPointer callData); 178 extern void Snapshot(void); 179 extern void clean_string(char *input); 180 extern int print_rotated; 181 extern int print_auto_rotation; 182 extern int print_auto_scale; 183 extern int print_in_monochrome; 184 extern int print_invert; 185 extern char printer_program[MAX_FILENAME+1]; 186 extern char previewer_program[MAX_FILENAME+1]; 187 188 extern int gnis_locate_place(Widget w, char *name, char *state, 189 char *county, char *quad, char* type, char *filename, int 190 follow_case, int get_match, char match_array_name[50][200], long 191 match_array_lat[50], long match_array_long[50]); 192 193 extern int pop_locate_place(Widget w, char *name, char *state, 194 char *county, char *quad, char* type, char *filename, int 195 follow_case, int get_match, char match_array_name[50][200], long 196 match_array_lat[50], long match_array_long[50]); 197 198 199 extern void maps_init(void); 200 enum map_onscreen_enum {MAP_NOT_VIS=0,MAP_IS_VIS,MAP_NOT_INDEXED}; 201 extern enum map_onscreen_enum map_onscreen(long left, long right, long top, long bottom, int checkpercentage); 202 extern enum map_onscreen_enum map_onscreen_index(char *filename); 203 extern time_t last_snapshot; 204 extern time_t last_kmlsnapshot; 205 extern int snapshot_interval; 206 207 extern int grid_size; 208 209 #if !defined(NO_GRAPHICS) 210 #if defined(HAVE_MAGICK) 211 extern float imagemagick_gamma_adjust; 212 #endif // HAVE_MAGICK 213 #endif // NO_GRAPHICS 214 215 extern float raster_map_intensity; 216 217 extern void Print_Postscript(Widget widget, XtPointer clientData, XtPointer callData); 218 219 extern void map_plot (Widget w, long max_x, long max_y, long x_long_cord, long y_lat_cord, unsigned char color, long object_behavior, int destination_pixmap, int draw_filled); 220 221 // A struct to pass down in to map driver functions so they can have 222 // driver-specific flags. Most drivers won't care about any (or even all) 223 // of the flags, but this way we can just pass a single pointer rather than 224 // adding new arguments to the generic interface each time we want new flags 225 typedef struct 226 { 227 int draw_filled; 228 int usgs_drg; 229 } map_draw_flags; 230 231 #endif /* __XASTIR_MAPS_H */ 232 233 234