OpenCPN Partial API docs
dychart.h
1 /******************************************************************************
2  *
3  * Project: OpenCPN
4  * Purpose: Global Build Options
5  * Author: David Register
6  *
7  ***************************************************************************
8  * Copyright (C) 2010 by David S. Register *
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the *
22  * Free Software Foundation, Inc., *
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24  ***************************************************************************
25  *
26  */
27 
28 //----------------------------------------------------------------------------------
29 // Global Build options for opencpn
30 //----------------------------------------------------------------------------------
31 #ifndef _DYCHART_H_
32 #define _DYCHART_H_
33 
34 #include "config.h"
35 
36 #include <cmath>
37 #include <algorithm>
38 
39 // Profiling support
40 
41 //#include "/usr/include/valgrind/callgrind.h"
42 
43 // Chart cacheing policy defaults
44 
45 #define CACHE_N_LIMIT_DEFAULT 20 // Cache no more than n charts
46 
47 #define CACHE_MEM_LIMIT_DEFAULT 0 // Application memory useage target, kBytes
48 
49 // If defined, update the system time using GPS receiver data.
50 // Time update is applied if the system time and GPS time differ
51 // by more than one minute, and only once per session.
52 // On Linux, this option requires root privileges, obtained by sudo.
53 // Thus, the following line is required in etc/sudoers:
54 //
55 // nav ALL=NOPASSWD:/bin/date -s *
56 //
57 // Where "nav" is the user's user name.
58 //
59 // Also, the opencpn configuration file must contain the key
60 // [Settings]
61 // SetSystemTime=1
62 // For security, this option is not available on the "Options" dialog
63 #define ocpnUPDATE_SYSTEM_TIME
64 
65 //------------------------------------------------------------------------------
66 // Some private, app global type definitions
67 //------------------------------------------------------------------------------
68 
69 //------------------------------------------------------------------------------
70 // Various compile time options
71 //------------------------------------------------------------------------------
72 
73 #ifdef __MSVC__
74 #pragma warning(disable : 4114)
75 #pragma warning( \
76  disable : 4284) // This one is to do with "reverse iterator UDT..." Huh?
77 #endif
78 
79 // Following definition required by GDAL
80 #define notdef 1
81 
82 #ifdef __MSVC__
83 // __MSVC__ randomly does not link snprintf, or _snprintf
84 // Replace it with a local version, code is in cutil.c
85 #undef snprintf
86 #define snprintf mysnprintf
87 #endif
88 
89 //------------------------------------------------------------------------------
90 // Some Build constants
91 //------------------------------------------------------------------------------
92 
93 // Home Base, used if the config file lat/lon seems bogus or missing
94 
95 //#define START_LAT 35.1025 // New Bern (Ver 1.0)
96 //#define START_LON -77.0342
97 
98 //#define START_LAT 26.783 // Green Turtle Key (Ver 1.2)
99 //#define START_LON -77.333
100 
101 //#define START_LAT 25.786 // Miami Beach (Ver 1.2.2)
102 //#define START_LON -80.148
103 
104 #define START_LAT 33.358 // Georgetown, SC (Ver 1.2.4)
105 #define START_LON -79.282
106 
107 //------------------------------------------------------------------------------
108 // Some MSW and MSVCRT Specific Includes
109 //------------------------------------------------------------------------------
110 #ifdef __WXMSW__
111 #include "wx/msw/private.h"
112 #endif
113 
114 //------------------------------------------------------------------------------
115 // Some Memory Leak Detection Code
116 //------------------------------------------------------------------------------
117 
118 #ifdef __MSVC__
119 #ifdef _DEBUG
120 #define _CRTDBG_MAP_ALLOC
121 #include <crtdbg.h>
122 #define DEBUG_NEW new (_NORMAL_BLOCK, __FILE__, __LINE__)
123 #define new DEBUG_NEW
124 #endif
125 #endif
126 
127 //----------------------------------------------------------------------------
128 // Environment Access functions
129 //----------------------------------------------------------------------------
130 #ifdef __MSVC__
131 #define _putenv _putenv // This is for MSVC
132 #else
133 #define _putenv putenv // This is for other Windows compiler
134 #endif
135 
136 //----------------------------------------------------------------------------
137 // Use the CPL Portability library only if S57 is enabled
138 //----------------------------------------------------------------------------
139 
140 #define USE_CPL
141 //#include "gdal/cpl_port.h"
142 
143 #ifndef NULL
144 #define NULL 0
145 #endif
146 
147 /***********************************************************************
148  * Define __POSIX__ to imply posix thread model compatibility
149  * Especially used for communication port multithreading.
150  *
151  * Posix thread model is available on selected platforms, see code.
152  */
153 
154 #ifdef __POSIX__
155 #undef __POSIX__
156 #endif
157 
158 #ifdef __WXOSX__
159 #define __POSIX__
160 #endif
161 
162 #ifdef __WXGTK__
163 #define __POSIX__
164 #endif
165 
166 #if defined(__OCPN__ANDROID__)
167  #include <qopengl.h>
168  #include <GL/gl_private.h> // this is a cut-down version of gl.h
169  #include <GLES2/gl2.h>
170 #else
171  #ifdef ocpnUSE_GL
172  #if defined(__MSVC__)
173  #include "glew.h"
174  #elif defined(__WXOSX__)
175  #include <OpenGL/gl.h>
176  #include <OpenGL/glu.h>
177  typedef void (* _GLUfuncptr)();
178  #define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0
179  #elif defined(__WXQT__) || defined(__WXGTK__)
180  #include <GL/glew.h>
181  #include <GL/glu.h>
182  #endif
183  #endif
184 #endif
185 
186 
187 /*
188 #if defined(_WIN32) || defined(_WIN64)
189 # include <gl/glew.h>
190 # include <GL/gl.h>
191 # include <GL/glu.h>
192 #elif __APPLE__
193 # include "TargetConditionals.h"
194 # if (TARGET_OS_IPHONE && TARGET_IPHONE_SIMULATOR) || TARGET_OS_IPHONE
195 # include <OpenGLES/ES2/gl.h>
196 # include <OpenGLES/ES2/glext.h>
197 # else
198 # include <OpenGL/gl.h>
199 # include <OpenGL/glu.h>
200 # include <OpenGL/glext.h>
201 # endif
202 #elif defined(__ANDROID__) || defined(ANDROID)
203 # include <GLES2/gl2.h>
204 # include <GLES2/gl2ext.h>
205 #elif defined(__linux__) || defined(__unix__) || defined(__posix__)
206 # include <GL/gl.h>
207 # include <GL/glu.h>
208 # include <GL/glext.h>
209 #else
210 # error platform not supported.
211 #endif
212 */
213 
214 
215 #ifdef __OCPN__ANDROID__
216 #include "qdebug.h"
217 #endif
218 
219 #endif // __FILE__