-
Notifications
You must be signed in to change notification settings - Fork 157
/
GdaConst.h
438 lines (383 loc) · 16.8 KB
/
GdaConst.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/**
* GeoDa TM, Copyright (C) 2011-2015 by Luc Anselin - all rights reserved
*
* This file is part of GeoDa.
*
* GeoDa is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GeoDa 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Note: This file is the place to hold all constants such as default colors,
* as well as common text strings used in various dialogs. Everything
* should be kept in the GdaConst namespace
*
*/
#ifndef __GEODA_CENTER_GDA_CONST_H__
#define __GEODA_CENTER_GDA_CONST_H__
#include <stdint.h>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <wx/gdicmn.h>
#include <wx/string.h>
#include <wx/colour.h>
#include <wx/font.h>
#include <wx/pen.h>
class GdaConst {
public:
static const int EMPTY = -1;
// This should be called only once in GdaApp::OnInit()
static void init();
// Types for use in Table
enum FieldType {
unknown_type,
double_type, // N or F with decimals > 0 in DBF
long64_type, // N or F with decimals = 0 in DBF
string_type, // C in DBF, max 254 characters
date_type, // D in DBF, YYYYMMDD format
time_type, // HH:MM:SS
datetime_type, // YYYY-MM-DD HH:MM:SS geodatabase
placeholder_type
};
static wxString FieldTypeToStr(GdaConst::FieldType ft);
struct FieldInfo {
FieldInfo() : type(unknown_type), field_len(0),
decimals(0) //, displayed_decimals(0)
{}
FieldType type;
wxString name;
int field_len;
int decimals;
//int displayed_decimals;
};
enum DataSourceType { ds_esri_arc_obj, ds_esri_file_geodb,
ds_esri_personal_gdb, ds_esri_arc_sde,
ds_csv, ds_dbf, ds_geo_json, ds_gml, ds_kml,
ds_mapinfo, ds_mysql, ds_ms_sql, ds_oci, ds_odbc, ds_postgresql,
ds_shapefile, ds_sqlite, ds_gpkg, ds_wfs, ds_xls, ds_xlsx, ds_osm,
ds_ods, ds_cartodb, ds_parquet, ds_arrow, ds_unknown };
static std::map<std::string, DataSourceType> datasrc_str_to_type;
static std::map<DataSourceType, std::string> datasrc_type_to_str;
static std::map<DataSourceType, std::string> datasrc_type_to_prefix;
static std::map<DataSourceType, std::string> datasrc_type_to_fullname;
static std::map<DataSourceType, std::set<std::string> > datasrc_req_flds;
static std::map<DataSourceType, std::set<std::string> > datasrc_opt_flds;
static wxString no_field_warning, db_field_warning, default_field_warning;
static wxString default_field_name_regex, default_field_name_illegal_regex;
static wxString db_field_name_regex, db_field_name_illegal_regex;
static std::map<DataSourceType, int> datasrc_field_lens;
static std::map<DataSourceType, int> datasrc_table_lens;
static std::map<DataSourceType, wxString> datasrc_field_regex;
static std::map<DataSourceType, wxString> datasrc_field_warning;
static std::map<DataSourceType, wxString> datasrc_field_illegal_regex;
static std::map<DataSourceType, bool> datasrc_field_casesensitive;
static int default_display_decimals;
static const int max_dbf_long_len = 20; // 19 digits for max int64 number
static const int min_dbf_long_len = 1;
static const int default_dbf_long_len = 20;
static const int max_dbf_double_len = 35; // 19 + 15 +1 = 35
static const int min_dbf_double_len = 2; // allow for "0." always
static const int default_dbf_double_len = 24; // follow by OGR:dbf
static const int max_dbf_double_decimals = 15;
static const int min_dbf_double_decimals = 1;
static const int default_dbf_double_decimals = 15; // follow by OGR:dbf
static const int max_dbf_string_len = 254;
static const int min_dbf_string_len = 1;
static const int default_dbf_string_len = 50;
static const int max_dbf_date_len = 8;
static const int min_dbf_date_len = 8;
static const int default_dbf_date_len = 8;
// Resource Files
static const wxString gda_prefs_fname_json;
static const wxString gda_prefs_fname_sqlite;
static const wxString gda_prefs_html_table;
static const wxString gda_prefs_html_table_menu;
static const wxString gda_prefs_html_table_url;
// Shared menu ids
static const int ID_TIME_SYNC_VAR1 = wxID_HIGHEST + 1000;
static const int ID_TIME_SYNC_VAR2 = wxID_HIGHEST + 1001;
static const int ID_TIME_SYNC_VAR3 = wxID_HIGHEST + 1002;
static const int ID_TIME_SYNC_VAR4 = wxID_HIGHEST + 1004;
static const int ID_FIX_SCALE_OVER_TIME_VAR1 = wxID_HIGHEST + 2000;
static const int ID_FIX_SCALE_OVER_TIME_VAR2 = wxID_HIGHEST + 2001;
static const int ID_FIX_SCALE_OVER_TIME_VAR3 = wxID_HIGHEST + 2002;
static const int ID_FIX_SCALE_OVER_TIME_VAR4 = wxID_HIGHEST + 2004;
static const int ID_PLOTS_PER_VIEW_1 = wxID_HIGHEST + 3000;
static const int ID_PLOTS_PER_VIEW_2 = wxID_HIGHEST + 3001;
static const int ID_PLOTS_PER_VIEW_3 = wxID_HIGHEST + 3002;
static const int ID_PLOTS_PER_VIEW_4 = wxID_HIGHEST + 3003;
static const int ID_PLOTS_PER_VIEW_5 = wxID_HIGHEST + 3004;
static const int ID_PLOTS_PER_VIEW_6 = wxID_HIGHEST + 3005;
static const int ID_PLOTS_PER_VIEW_7 = wxID_HIGHEST + 3006;
static const int ID_PLOTS_PER_VIEW_8 = wxID_HIGHEST + 3007;
static const int ID_PLOTS_PER_VIEW_9 = wxID_HIGHEST + 3008;
static const int ID_PLOTS_PER_VIEW_10 = wxID_HIGHEST + 3009;
static const int max_plots_per_view_menu_items = 10;
static const int ID_PLOTS_PER_VIEW_OTHER = wxID_HIGHEST + 3100;
static const int ID_PLOTS_PER_VIEW_ALL = wxID_HIGHEST + 3200;
static const int ID_HISTOGRAM_CLASSIFICATION = wxID_HIGHEST + 3300;
static const int ID_CONDITION_CLASSIFICATION = wxID_HIGHEST + 3400;
static const int ID_CUSTOM_CAT_CLASSIF_CHOICE_A0 = wxID_HIGHEST + 4000;
static const int ID_CUSTOM_CAT_CLASSIF_CHOICE_B0 = wxID_HIGHEST + 4100;
static const int ID_CUSTOM_CAT_CLASSIF_CHOICE_C0 = wxID_HIGHEST + 4200;
static const wxString html_submenu_title;
static const int ID_HTML_SUBMENU = wxID_HIGHEST + 5000;
static const int ID_HTML_MENU_ENTRY_CHOICE_0 = ID_HTML_SUBMENU + 1;
static const int ID_HTML_MENU_ENTRY_CHOICE_1 = ID_HTML_SUBMENU + 2;
static const int ID_HTML_MENU_ENTRY_CHOICE_2 = ID_HTML_SUBMENU + 3;
static const int ID_HTML_MENU_ENTRY_CHOICE_3 = ID_HTML_SUBMENU + 4;
static const int ID_HTML_MENU_ENTRY_CHOICE_4 = ID_HTML_SUBMENU + 5;
static const int ID_HTML_MENU_ENTRY_CHOICE_5 = ID_HTML_SUBMENU + 6;
static const int ID_HTML_MENU_ENTRY_CHOICE_6 = ID_HTML_SUBMENU + 7;
static const int ID_HTML_MENU_ENTRY_CHOICE_7 = ID_HTML_SUBMENU + 8;
static const int ID_HTML_MENU_ENTRY_CHOICE_8 = ID_HTML_SUBMENU + 9;
static const int ID_HTML_MENU_ENTRY_CHOICE_9 = ID_HTML_SUBMENU + 10;
static const int ID_CONNECT_POPUP_MENU = wxID_HIGHEST + 6000;
// Standard wxFont pointers.
static wxFont* extra_small_font;
static wxFont* small_font;
static wxFont* medium_font;
static wxFont* large_font;
// GdaShape constants
static const wxPen* default_myshape_pen;
static const wxBrush* default_myshape_brush;
// GdaPoint radius to give a larger target for clicking on
static const int my_point_click_radius = 2;
// Shared Colours
static std::vector<wxColour> qualitative_colors;
static std::vector<wxColour> unique_colors_60;
//background color -- this is light gray
static const wxColour backColor;
// background color -- this is light gray
static const wxColour darkColor;
// color of text, frames, points -- this is dark cherry
static const wxColour textColor;
// outliers color (also used for regression, etc.) -- blue
static const wxColour outliers_colour;
// envelope color (also used for regression, etc.) -- red
static const wxColour envelope_colour;
// Template Canvas shared by Map, Scatterplot, PCP, etc
static const int default_virtual_screen_marg_left = 20;
static const int default_virtual_screen_marg_right = 20;
static const int default_virtual_screen_marg_top = 20;
static const int default_virtual_screen_marg_bottom = 20;
static const int shps_min_width = 100;
static const int shps_min_height = 100;
static const int shps_max_width = 12000;
static const int shps_max_height = 12000;
static const int shps_max_area = 50000000; // 50 million
static const wxColour selectable_outline_color; // black
static const wxColour selectable_fill_color; // forest green
static const wxColour highlight_color; // yellow
static const wxColour canvas_background_color; // white
static const wxColour legend_background_color; // white
// Strings
static const wxString gda_lbl_not_sig;
static const wxString gda_lbl_undefined;
static const wxString gda_lbl_neighborless;
static const wxString gda_lbl_highhigh;
static const wxString gda_lbl_lowlow;
static const wxString gda_lbl_lowhigh;
static const wxString gda_lbl_highlow;
static const wxString gda_lbl_otherpos;
static const wxString gda_lbl_negative;
static const wxString gda_lbl_positive;
static const wxString gda_lbl_1p;
static const wxString gda_lbl_1p_10p;
static const wxString gda_lbl_10p_50p;
static const wxString gda_lbl_50p_90p;
static const wxString gda_lbl_90p_99p;
static const wxString gda_lbl_99p;
static const wxString gda_lbl_loweroutlier;
static const wxString gda_lbl_25p;
static const wxString gda_lbl_25p_50p;
static const wxString gda_lbl_50p_75p;
static const wxString gda_lbl_75p;
static const wxString gda_lbl_upperoutlier;
static const wxString gda_lbl_n2sigma;
static const wxString gda_lbl_n2sigma_n1sigma;
static const wxString gda_lbl_n1sigma;
static const wxString gda_lbl_1sigma;
static const wxString gda_lbl_1sigma_2sigma;
static const wxString gda_lbl_2sigma;
// Projection
static const wxString gda_projection_UNIT;
static const wxString gda_projection_metre;
static const wxString gda_projection_meter;
// Languages
static const wxString gda_lang_english;
static const wxString gda_lang_chinese;
static const wxString gda_lang_french;
static const wxString gda_lang_portuguese;
static const wxString gda_lang_russian;
static const wxString gda_lang_spanish;
// Preferences
static const char gda_config_true[];
static const char gda_config_false[];
static double gda_autoweight_stop;
static bool gda_draw_map_labels;
static int gda_map_label_font_size;
static bool gda_create_csvt;
static wxString gda_basemap_sources;
static bool gda_use_gpu;
static int gda_ui_language;
static double gda_eigen_tol;
static int gda_cpu_cores;
static bool gda_set_cpu_cores;
static wxString gda_user_email;
static uint64_t gda_user_seed;
static bool use_gda_user_seed;
static int gdal_http_timeout;
static bool enable_high_dpi_support;
static bool show_csv_configure_in_merge;
static bool show_recent_sample_connect_ds_dialog;
static bool use_cross_hatching;
static int transparency_highlighted;
static int transparency_unhighlighted;
static int transparency_map_on_basemap;
static bool use_basemap_by_default;
static int default_basemap_selection;
static bool hide_sys_table_postgres;
static bool hide_sys_table_sqlite;
static bool disable_crash_detect;
static bool disable_auto_upgrade;
static int plot_transparency_highlighted;
static int plot_transparency_unhighlighted;
static std::vector<wxString> gda_datetime_formats;
static wxString gda_datetime_formats_str;
static wxString gda_display_datetime_format;
static int gda_ogr_csv_header;
static bool gda_enable_set_transparency_windows;
static wxString gda_ogr_csv_x_name;
static wxString gda_ogr_csv_y_name;
static const wxSize map_default_size;
static const int map_default_legend_width;
// this is a light forest green
static const wxColour map_default_fill_colour;
static const wxColour map_default_outline_colour;
static const int map_default_outline_width = 1;
static const wxColour map_default_highlight_colour;
static wxColour map_undefined_colour;
const static wxColour map_dark_gray;
const static wxColour map_white;
static wxString map_undefined_category;
const static wxString map_undefined_label;
const static wxString map_unmatched_label;
// Connectivity Map
static const wxSize conn_map_default_size;
static const wxColour conn_map_default_fill_colour;
static const wxColour conn_map_default_outline_colour;
static const wxColour conn_map_default_highlight_colour;
// Graph Map
static const wxColour conn_graph_outline_colour;
static const wxColour conn_select_outline_colour;
static const wxColour conn_neighbor_fill_colour;
// Heat Map
static const wxColour heatmap_fill_colour;
static const wxColour heatmap_outline_colour;
// Map Movie
static const wxColour map_movie_default_fill_colour;
static const wxColour map_movie_default_highlight_colour;
// Histogram
static const wxSize hist_default_size;
// Table
static const wxString placeholder_str;
static const wxString table_frame_title;
static const wxSize table_default_size;
static const wxColour table_no_edit_color;
static const wxColour table_row_sel_color;
static const wxColour table_col_sel_color;
static const wxColour table_row_and_col_sel_color;
// Scatterplot
static const wxSize scatterplot_default_size;
static const wxColour scatterplot_scale_color; // black
static const wxColour scatterplot_regression_color; // purple
static const wxColour scatterplot_regression_selected_color; // red
static const wxColour scatterplot_regression_excluded_color; // blue
static const wxColour scatterplot_origin_axes_color; // grey
static wxPen* scatterplot_reg_pen;
static wxPen* scatterplot_reg_selected_pen;
static wxPen* scatterplot_reg_excluded_pen;
static wxPen* scatterplot_scale_pen;
static wxPen* scatterplot_origin_axes_pen;
// Bubble Chart
static const wxSize bubble_chart_default_size;
static const int bubble_chart_default_legend_width;
// 3D Plot
static const wxColour three_d_plot_default_highlight_colour;
static const wxColour three_d_plot_default_point_colour;
static const wxColour three_d_plot_default_background_colour;
static const wxSize three_d_default_size;
// Boxplot
static const wxSize boxplot_default_size;
static const wxColour boxplot_point_color;
static const wxColour boxplot_median_color;
static const wxColour boxplot_mean_point_color;
static const wxColour boxplot_q1q2q3_color;
// PCP (Parallel Coordinate Plot)
static const wxSize pcp_default_size;
static const wxColour pcp_line_color;
static const wxColour pcp_horiz_line_color;
// Averages Chart (Line Chart)
// Legend:
// ln_cht: line chart
// clr: color
// sel: selected
// exl: excluded
// tm1: time subset 1
// tm2: time subset 2
// regimes_hl: regimes highlight
// Use GenUtils.h: wxString GdaColorUtils::ToHexStr(wxColour)
// to produce HTML color string.
// Use GdaColorUtils::ChangeBrightness to make darker
static const wxSize line_chart_default_size;
static wxColour ln_cht_clr_regimes_hl; // yellow
static wxColour ln_cht_clr_sel_dark; // red
static wxColour ln_cht_clr_exl_dark; // blue
static wxColour ln_cht_clr_tm1_dark; // purple
static wxColour ln_cht_clr_tm2_dark; // brown
static wxColour ln_cht_clr_sel_light;
static wxColour ln_cht_clr_exl_light;
static wxColour ln_cht_clr_tm1_light;
static wxColour ln_cht_clr_tm2_light;
// Conditional View
static const wxSize cond_view_default_size;
// Category Classification
static const wxSize cat_classif_default_size;
static const int categorical_display_precision = 3;
// Weights Manager Dialog
static const wxSize weights_man_dlg_default_size;
// Data Change Type Frame
static const wxSize data_change_type_frame_default_size;
// General Global Constants
static const int FileNameLen = 512; // max length of file names
static const int RealWidth = 19; // default width of output for reals
static const int ShpHeaderSize = 50; // size of the header record in Shapefile
static const int ShpObjIdLen = 20; // length of the ID of shape object
// Basemap
static const wxString gda_basemap_osm_useragent;
static const wxString gda_basemap_win_useragent;
static const wxString gda_basemap_mac_useragent;
static const wxString gda_basemap_linux_useragent;
static wxCursor zoomInCursor;
static wxCursor zoomOutCursor;
static const char* raw_zoom_out[65];
static const char* raw_zoom_in[65];
static const char* delete_icon_xpm[48];
static const std::vector<wxString> sample_names;
static const std::vector<wxString> sample_layer_names;
static const std::vector<wxString> sample_datasources;
static const std::vector<wxString> sample_meta_urls;
};
#endif