Coverage Report

Created: 2025-08-28 06:57

/src/MapServer/src/mapserver.h
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 * $Id$
3
 *
4
 * Project:  MapServer
5
 * Purpose:  Primary MapServer include file.
6
 * Author:   Steve Lime and the MapServer team.
7
 *
8
 ******************************************************************************
9
 * Copyright (c) 1996-2005 Regents of the University of Minnesota.
10
 *
11
 * copy of this software and associated documentation files (the "Software"),
12
 * to deal in the Software without restriction, including without limitation
13
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14
 * and/or sell copies of the Software, and to permit persons to whom the
15
 * Software is furnished to do so, subject to the following conditions:
16
 *
17
 * The above copyright notice and this permission notice shall be included in
18
 * all copies of this Software or works derived from this Software.
19
 *
20
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26
 * DEALINGS IN THE SOFTWARE.
27
 *****************************************************************************/
28
29
#ifndef MAP_H
30
#define MAP_H
31
32
#include "mapserver-config.h"
33
34
/*
35
** Main includes. If a particular header was needed by several .c files then
36
** I just put it here. What the hell, it works and it's all right here. -SDL-
37
*/
38
#if defined(HAVE_STRCASESTR) && !defined(_GNU_SOURCE)
39
#define _GNU_SOURCE /* Required for <string.h> strcasestr() defn */
40
#endif
41
42
#include <stdbool.h>
43
#include <stdio.h>
44
#include <stdlib.h>
45
#include <string.h>
46
#include <math.h>
47
#include <time.h>
48
49
#if defined(_WIN32) && !defined(__CYGWIN__)
50
#include <direct.h>
51
#include <memory.h>
52
#include <malloc.h>
53
#include <process.h>
54
#include <float.h>
55
#else
56
#include <unistd.h>
57
#endif
58
59
#if defined(_WIN32) && !defined(__CYGWIN__)
60
#define MS_DLL_EXPORT __declspec(dllexport)
61
#define USE_MSFREE
62
#else
63
#define MS_DLL_EXPORT
64
#endif
65
66
#if defined(__GNUC__)
67
#define WARN_UNUSED __attribute__((warn_unused_result))
68
0
#define MS_LIKELY(x) __builtin_expect((x), 1)
69
369k
#define MS_UNLIKELY(x) __builtin_expect((x), 0)
70
#else
71
#define WARN_UNUSED
72
#define MS_LIKELY(x) (x)
73
#define MS_UNLIKELY(x) (x)
74
#endif
75
76
/* definition of  ms_int32/ms_uint32 */
77
#include <limits.h>
78
#ifndef _WIN32
79
#include <stdint.h>
80
#endif
81
82
#ifdef _WIN32
83
#ifndef SIZE_MAX
84
#ifdef _WIN64
85
#define SIZE_MAX _UI64_MAX
86
#else
87
#define SIZE_MAX UINT_MAX
88
#endif
89
#endif
90
#endif
91
92
#if ULONG_MAX == 0xffffffff
93
typedef long ms_int32;
94
typedef unsigned long ms_uint32;
95
#elif UINT_MAX == 0xffffffff
96
typedef int ms_int32;
97
typedef unsigned int ms_uint32;
98
#else
99
typedef int32_t ms_int32;
100
typedef uint32_t ms_uint32;
101
#endif
102
103
#if defined(_WIN32) && !defined(__CYGWIN__)
104
/* Need to use _vsnprintf() with VS2003 */
105
#define vsnprintf _vsnprintf
106
#endif
107
108
#include "mapserver-api.h"
109
110
#ifndef SWIG
111
/*forward declaration of rendering object*/
112
typedef struct rendererVTableObj rendererVTableObj;
113
typedef struct tileCacheObj tileCacheObj;
114
typedef struct textPathObj textPathObj;
115
typedef struct textRunObj textRunObj;
116
typedef struct glyph_element glyph_element;
117
typedef struct face_element face_element;
118
#endif
119
120
/* ms_bitarray is used by the bit mask in mapbit.c */
121
typedef ms_uint32 *ms_bitarray;
122
typedef const ms_uint32 *ms_const_bitarray;
123
124
#include "maperror.h"
125
#include "mapprimitive.h"
126
#include "mapshape.h"
127
#include "mapflatgeobuf.h"
128
#include "mapsymbol.h"
129
#include "maptree.h" /* quadtree spatial index */
130
#include "maphash.h"
131
#include "mapio.h"
132
#include <assert.h>
133
#include "mapproject.h"
134
#include "cgiutil.h"
135
#include "mapserv-config.h"
136
137
#include <sys/types.h> /* regular expression support */
138
139
/* The regex lib from the system and the regex lib from PHP needs to
140
 * be separated here. We separate here via its directory location.
141
 */
142
#include "mapregex.h"
143
144
#define CPL_SUPRESS_CPLUSPLUS
145
#include "ogr_api.h"
146
147
/* EQUAL and EQUALN are defined in cpl_port.h, so add them in here if ogr was
148
 * not included */
149
150
#ifndef EQUAL
151
#if defined(_WIN32) || defined(WIN32CE)
152
#define EQUAL(a, b) (stricmp(a, b) == 0)
153
#else
154
#define EQUAL(a, b) (strcasecmp(a, b) == 0)
155
#endif
156
#endif
157
158
#ifndef EQUALN
159
#if defined(_WIN32) || defined(WIN32CE)
160
#define EQUALN(a, b, n) (strnicmp(a, b, n) == 0)
161
#else
162
#define EQUALN(a, b, n) (strncasecmp(a, b, n) == 0)
163
#endif
164
#endif
165
166
#if defined(_WIN32) && !defined(__CYGWIN__)
167
#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || !defined(_MSC_VER)
168
#define snprintf _snprintf
169
#endif
170
#endif
171
172
#ifdef __cplusplus
173
#include <string>
174
#include <vector>
175
extern "C" {
176
#endif
177
178
// hide from swig or ruby will choke on the __FUNCTION__ name
179
#ifndef SWIG
180
/* Memory allocation check utility */
181
#ifndef __FUNCTION__
182
0
#define __FUNCTION__ "MapServer"
183
#endif
184
#endif
185
186
#define MS_CHECK_ALLOC(var, size, retval)                                      \
187
580k
  if (!var) {                                                                  \
188
0
    msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n",      \
189
0
               __FUNCTION__, __FILE__, __LINE__, (unsigned int)(size));        \
190
0
    return retval;                                                             \
191
0
  }
192
193
#define MS_CHECK_ALLOC_NO_RET(var, size)                                       \
194
49.9k
  if (!var) {                                                                  \
195
0
    msSetError(MS_MEMERR, "%s: %d: Out of memory allocating %u bytes.\n",      \
196
0
               __FUNCTION__, __FILE__, __LINE__, (unsigned int)(size));        \
197
0
    return;                                                                    \
198
0
  }
199
200
/* General defines, wrapable */
201
202
363k
#define MS_TRUE 1 /* logical control variables */
203
2.40M
#define MS_FALSE 0
204
0
#define MS_UNKNOWN -1
205
68.2k
#define MS_ON 1
206
168k
#define MS_OFF 0
207
404
#define MS_DEFAULT 2
208
187
#define MS_EMBED 3
209
0
#define MS_DELETE 4
210
#define MS_YES 1
211
#define MS_NO 0
212
213
/* Number of layer, class and style ptrs to alloc at once in the
214
   corresponding msGrow...() functions. Replaces former MS_MAXLAYERS,
215
   MS_MAXCLASSES and MS_MAXSTYLES with dynamic allocation (see RFC-17). */
216
8.22k
#define MS_LAYER_ALLOCSIZE 64
217
827
#define MS_CLASS_ALLOCSIZE 8
218
1.65k
#define MS_STYLE_ALLOCSIZE 4
219
1.97k
#define MS_LABEL_ALLOCSIZE 2 /* not too common */
220
221
424k
#define MS_MAX_LABEL_PRIORITY 10
222
#define MS_MAX_LABEL_FONTS 5
223
42.1k
#define MS_DEFAULT_LABEL_PRIORITY 1
224
0
#define MS_LABEL_FORCE_GROUP 2 /* other values are MS_ON/MS_OFF */
225
226
/* General defines, not wrapable */
227
#ifndef SWIG
228
#ifdef USE_XMLMAPFILE
229
#define MS_DEFAULT_MAPFILE_PATTERN "\\.(map|xml)$"
230
#define MS_DEFAULT_XMLMAPFILE_PATTERN "\\.xml$"
231
#else
232
19.2k
#define MS_DEFAULT_MAPFILE_PATTERN "\\.map$"
233
#endif
234
#define MS_DEFAULT_CONTEXTFILE_PATTERN "\\.[Xx][Mm][Ll]$"
235
0
#define MS_TEMPLATE_MAGIC_STRING "MapServer Template"
236
0
#define MS_TEMPLATE_EXPR "\\.(xml|wml|html|htm|svg|kml|gml|js|tmpl)$"
237
238
0
#define MS_INDEX_EXTENSION ".qix"
239
240
0
#define MS_QUERY_RESULTS_MAGIC_STRING "MapServer Query Results"
241
0
#define MS_QUERY_PARAMS_MAGIC_STRING "MapServer Query Params"
242
0
#define MS_QUERY_EXTENSION ".qy"
243
244
0
#define MS_DEG_TO_RAD .0174532925199432958
245
0
#define MS_RAD_TO_DEG 57.29577951
246
247
38.5k
#define MS_DEFAULT_RESOLUTION 72
248
249
#define MS_RED 0
250
#define MS_GREEN 1
251
#define MS_BLUE 2
252
253
#define MS_MAXCOLORS 256
254
255
0
#define MS_MISSING_DATA_IGNORE 0
256
0
#define MS_MISSING_DATA_FAIL 1
257
0
#define MS_MISSING_DATA_LOG 2
258
259
0
#define MS_BUFFER_LENGTH 2048 /* maximum input line length */
260
#define MS_URL_LENGTH 1024
261
70.3k
#define MS_MAXPATHLEN 1024
262
263
19.2k
#define MS_MAXIMAGESIZE_DEFAULT 4096
264
265
264k
#define MS_MAXPROJARGS 20
266
46.3k
#define MS_MAXJOINS 20
267
#define MS_ITEMNAMELEN 32
268
#define MS_NAMELEN 20
269
270
4.46k
#define MS_MINSYMBOLSIZE 0 /* in pixels */
271
4.46k
#define MS_MAXSYMBOLSIZE 500
272
273
4.46k
#define MS_MINSYMBOLWIDTH 0 /* in pixels */
274
4.46k
#define MS_MAXSYMBOLWIDTH 32
275
276
0
#define MS_URL 0 /* template types */
277
0
#define MS_FILE 1
278
279
42.1k
#define MS_MINFONTSIZE 4
280
42.1k
#define MS_MAXFONTSIZE 256
281
282
0
#define MS_LABELCACHEINITSIZE 100
283
0
#define MS_LABELCACHEINCREMENT 10
284
285
#define MS_RESULTCACHEINITSIZE 10
286
0
#define MS_RESULTCACHEINCREMENT 10
287
288
#define MS_FEATUREINITSIZE                                                     \
289
64
  10 /* how many points initially can a feature have                           \
290
      */
291
0
#define MS_FEATUREINCREMENT 10
292
293
5.40k
#define MS_EXPRESSION 2000 /* todo: make this an enum */
294
921k
#define MS_REGEX 2001
295
2.74M
#define MS_STRING 2002
296
68.9k
#define MS_NUMBER 2003
297
0
#define MS_COMMENT 2004
298
1.14k
#define MS_IREGEX 2005
299
1.16k
#define MS_ISTRING 2006
300
24.8k
#define MS_BINDING 2007
301
583
#define MS_LIST 2008
302
303
/* string split flags */
304
2.46k
#define MS_HONOURSTRINGS 0x0001
305
4.93k
#define MS_ALLOWEMPTYTOKENS 0x0002
306
0
#define MS_PRESERVEQUOTES 0x0004
307
0
#define MS_PRESERVEESCAPES 0x0008
308
2.46k
#define MS_STRIPLEADSPACES 0x0010
309
2.46k
#define MS_STRIPENDSPACES 0x0020
310
311
/* boolean options for the expression object. */
312
1
#define MS_EXP_INSENSITIVE 1
313
314
/* General macro definitions */
315
0
#define MS_MIN(a, b) (((a) < (b)) ? (a) : (b))
316
2.98k
#define MS_MAX(a, b) (((a) > (b)) ? (a) : (b))
317
0
#define MS_ABS(a) (((a) < 0) ? -(a) : (a))
318
#define MS_SGN(a) (((a) < 0) ? -1 : 1)
319
320
#define MS_STRING_IS_NULL_OR_EMPTY(s)                                          \
321
0
  ((!s || s[0] == '\0') ? MS_TRUE : MS_FALSE)
322
323
#define MS_NINT_GENERIC(x) ((x) >= 0.0 ? ((long)((x) + .5)) : ((long)((x)-.5)))
324
325
#ifdef _MSC_VER
326
#define msIsNan(x) _isnan(x)
327
#else
328
0
#define msIsNan(x) isnan(x)
329
#endif
330
331
/* see http://mega-nerd.com/FPcast/ for some discussion of fast
332
   conversion to nearest int.  We avoid lrint() for now because it
333
   would be hard to include math.h "properly". */
334
335
#if defined(HAVE_LRINT) && !defined(USE_GENERIC_MS_NINT)
336
0
#define MS_NINT(x) lrint(x)
337
/*#   define MS_NINT(x) lround(x) */
338
/* note that lrint rounds .5 to the nearest *even* integer, i.e.
339
 * lrint(0.5)=0,lrint(1.5)=2 */
340
#elif defined(_MSC_VER) && defined(_WIN32) && !defined(USE_GENERIC_MS_NINT)
341
static __inline long int MS_NINT(double flt) {
342
  int intgr;
343
344
  _asm {
345
      fld flt
346
      fistp intgr
347
  }
348
  ;
349
350
  return intgr;
351
}
352
#elif defined(i386) && defined(__GNUC_PREREQ) && !defined(USE_GENERIC_MS_NINT)
353
static __inline long int MS_NINT(double __x) {
354
  long int __lrintres;
355
  __asm__ __volatile__("fistpl %0" : "=m"(__lrintres) : "t"(__x) : "st");
356
  return __lrintres;
357
}
358
#else
359
#define MS_NINT(x) MS_NINT_GENERIC(x)
360
#endif
361
362
/* #define MS_VALID_EXTENT(minx, miny, maxx, maxy)  (((minx<maxx) &&
363
 * (miny<maxy))?MS_TRUE:MS_FALSE) */
364
#define MS_VALID_EXTENT(rect)                                                  \
365
738
  ((((rect).minx < (rect).maxx && (rect).miny < (rect).maxy)) ? MS_TRUE        \
366
738
                                                              : MS_FALSE)
367
#define MS_VALID_SEARCH_EXTENT(rect)                                           \
368
  ((((rect).minx <= (rect).maxx && (rect).miny <= (rect).maxy)) ? MS_TRUE      \
369
                                                                : MS_FALSE)
370
371
#define MS_INIT_COLOR(color, r, g, b, a)                                       \
372
383k
  {                                                                            \
373
383k
    (color).red = r;                                                           \
374
383k
    (color).green = g;                                                         \
375
383k
    (color).blue = b;                                                          \
376
383k
    (color).alpha = a;                                                         \
377
383k
  }
378
#define MS_VALID_COLOR(color)                                                  \
379
0
  (((color).red == -1 || (color).green == -1 || (color).blue == -1) ? MS_FALSE \
380
0
                                                                    : MS_TRUE)
381
#define MS_COMPARE_COLOR(color1, color2)                                       \
382
0
  (((color2).red == (color1).red && (color2).green == (color1).green &&        \
383
0
    (color2).blue == (color1).blue)                                            \
384
0
       ? MS_TRUE                                                               \
385
0
       : MS_FALSE)
386
#define MS_TRANSPARENT_COLOR(color)                                            \
387
0
  (((color).alpha == 0 || (color).red == -255 || (color).green == -255 ||      \
388
0
    (color).blue == -255)                                                      \
389
0
       ? MS_TRUE                                                               \
390
0
       : MS_FALSE)
391
#define MS_COMPARE_COLORS(a, b)                                                \
392
0
  (((a).red != (b).red || (a).green != (b).green || (a).blue != (b).blue)      \
393
0
       ? MS_FALSE                                                              \
394
0
       : MS_TRUE)
395
#define MS_COLOR_GETRGB(color)                                                 \
396
0
  (MS_VALID_COLOR(color)                                                       \
397
0
       ? ((color).red * 0x10000 + (color).green * 0x100 + (color).blue)        \
398
0
       : -1)
399
400
#define MS_IMAGE_MIME_TYPE(format)                                             \
401
0
  (format->mimetype ? format->mimetype : "unknown")
402
#define MS_IMAGE_EXTENSION(format)                                             \
403
0
  (format->extension ? format->extension : "unknown")
404
#define MS_DRIVER_SWF(format) (strncasecmp((format)->driver, "swf", 3) == 0)
405
0
#define MS_DRIVER_GDAL(format) (strncasecmp((format)->driver, "gdal/", 5) == 0)
406
#define MS_DRIVER_IMAGEMAP(format)                                             \
407
0
  (strncasecmp((format)->driver, "imagemap", 8) == 0)
408
#define MS_DRIVER_AGG(format) (strncasecmp((format)->driver, "agg/", 4) == 0)
409
#define MS_DRIVER_MVT(format) (strncasecmp((format)->driver, "mvt", 3) == 0)
410
#define MS_DRIVER_CAIRO(format)                                                \
411
0
  (strncasecmp((format)->driver, "cairo/", 6) == 0)
412
#define MS_DRIVER_OGL(format) (strncasecmp((format)->driver, "ogl/", 4) == 0)
413
#define MS_DRIVER_TEMPLATE(format)                                             \
414
  (strncasecmp((format)->driver, "template", 8) == 0)
415
416
#endif /*SWIG*/
417
418
#define MS_RENDER_WITH_SWF 2
419
0
#define MS_RENDER_WITH_RAWDATA 3
420
0
#define MS_RENDER_WITH_IMAGEMAP 5
421
0
#define MS_RENDER_WITH_TEMPLATE 8 /* query results only */
422
0
#define MS_RENDER_WITH_OGR 16
423
424
3.66k
#define MS_RENDER_WITH_PLUGIN 100
425
0
#define MS_RENDER_WITH_CAIRO_RASTER 101
426
#define MS_RENDER_WITH_CAIRO_PDF 102
427
#define MS_RENDER_WITH_CAIRO_SVG 103
428
#define MS_RENDER_WITH_OGL 104
429
3.66k
#define MS_RENDER_WITH_AGG 105
430
0
#define MS_RENDER_WITH_KML 106
431
0
#define MS_RENDER_WITH_UTFGRID 107
432
#define MS_RENDER_WITH_MVT 108
433
434
#ifndef SWIG
435
436
#define MS_RENDERER_SWF(format) ((format)->renderer == MS_RENDER_WITH_SWF)
437
#define MS_RENDERER_RAWDATA(format)                                            \
438
0
  ((format)->renderer == MS_RENDER_WITH_RAWDATA)
439
#define MS_RENDERER_IMAGEMAP(format)                                           \
440
0
  ((format)->renderer == MS_RENDER_WITH_IMAGEMAP)
441
#define MS_RENDERER_TEMPLATE(format)                                           \
442
0
  ((format)->renderer == MS_RENDER_WITH_TEMPLATE)
443
#define MS_RENDERER_KML(format) ((format)->renderer == MS_RENDER_WITH_KML)
444
0
#define MS_RENDERER_OGR(format) ((format)->renderer == MS_RENDER_WITH_OGR)
445
#define MS_RENDERER_MVT(format) ((format)->renderer == MS_RENDER_WITH_MVT)
446
447
5.49k
#define MS_RENDERER_PLUGIN(format) ((format)->renderer > MS_RENDER_WITH_PLUGIN)
448
449
#define MS_CELLSIZE(min, max, d)                                               \
450
0
  (((max) - (min)) / ((d)-1)) /* where min/max are from an MapServer pixel     \
451
                                 center-to-pixel center extent */
452
#define MS_OWS_CELLSIZE(min, max, d)                                           \
453
  (((max) - (min)) / (d)) /* where min/max are from an OGC pixel outside       \
454
                             edge-to-pixel outside edge extent */
455
0
#define MS_MAP2IMAGE_X(x, minx, cx) (MS_NINT(((x) - (minx)) / (cx)))
456
0
#define MS_MAP2IMAGE_Y(y, maxy, cy) (MS_NINT(((maxy) - (y)) / (cy)))
457
0
#define MS_IMAGE2MAP_X(x, minx, cx) ((minx) + (cx) * (x))
458
0
#define MS_IMAGE2MAP_Y(y, maxy, cy) ((maxy) - (cy) * (y))
459
460
/* these versions of MS_MAP2IMAGE takes 1/cellsize and is much faster */
461
0
#define MS_MAP2IMAGE_X_IC(x, minx, icx) (MS_NINT(((x) - (minx)) * (icx)))
462
0
#define MS_MAP2IMAGE_Y_IC(y, maxy, icy) (MS_NINT(((maxy) - (y)) * (icy)))
463
0
#define MS_MAP2IMAGE_XCELL_IC(x, minx, icx) ((int)(((x) - (minx)) * (icx)))
464
0
#define MS_MAP2IMAGE_YCELL_IC(y, maxy, icy) ((int)(((maxy) - (y)) * (icy)))
465
466
0
#define MS_MAP2IMAGE_X_IC_DBL(x, minx, icx) (((x) - (minx)) * (icx))
467
0
#define MS_MAP2IMAGE_Y_IC_DBL(y, maxy, icy) (((maxy) - (y)) * (icy))
468
469
#define MS_MAP2IMAGE_X_IC_SNAP(x, minx, icx, res)                              \
470
0
  ((MS_NINT(((x) - (minx)) * (icx) * (res))) / (res))
471
#define MS_MAP2IMAGE_Y_IC_SNAP(y, maxy, icy, res)                              \
472
0
  ((MS_NINT(((maxy) - (y)) * (icy) * (res))) / (res))
473
474
/* For CARTO symbols */
475
629
#define MS_PI 3.14159265358979323846
476
0
#define MS_PI2 1.57079632679489661923  /* (MS_PI / 2) */
477
#define MS_3PI2 4.71238898038468985769 /* (3 * MS_PI2) */
478
#define MS_2PI 6.28318530717958647693  /* (2 * MS_PI) */
479
480
0
#define MS_ENCRYPTION_KEY_SIZE 16 /* Key size: 128 bits = 16 bytes */
481
482
835k
#define GET_LAYER(map, pos) map->layers[pos]
483
0
#define GET_CLASS(map, lid, cid) map->layers[lid]->class[cid]
484
485
#ifdef USE_THREAD
486
#if defined(HAVE_SYNC_FETCH_AND_ADD)
487
#define MS_REFCNT_INCR(obj) __sync_fetch_and_add(&obj->refcount, +1)
488
#define MS_REFCNT_DECR(obj) __sync_sub_and_fetch(&obj->refcount, +1)
489
#define MS_REFCNT_INIT(obj) obj->refcount = 1, __sync_synchronize()
490
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
491
#include <intrin.h>
492
#pragma intrinsic(_InterlockedExchangeAdd)
493
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
494
#define MS_REFCNT_INCR(obj)                                                    \
495
  (_InterlockedExchangeAdd((long *)(&obj->refcount), (long)(+1)) + 1)
496
#define MS_REFCNT_DECR(obj)                                                    \
497
  (_InterlockedExchangeAdd((long *)(&obj->refcount), (long)(-1)) - 1)
498
#define MS_REFCNT_INIT(obj) obj->refcount = 1
499
#else
500
#define MS_REFCNT_INCR(obj)                                                    \
501
  (_InterlockedExchangeAdd((volatile long *)(&obj->refcount), (long)(+1)) + 1)
502
#define MS_REFCNT_DECR(obj)                                                    \
503
  (_InterlockedExchangeAdd((volatile long *)(&obj->refcount), (long)(-1)) - 1)
504
#define MS_REFCNT_INIT(obj) obj->refcount = 1
505
#endif
506
#elif defined(__MINGW32__) && defined(__i386__)
507
#define MS_REFCNT_INCR(obj)                                                    \
508
  (InterlockedExchangeAdd((long *)(&obj->refcount), (long)(+1)) + 1)
509
#define MS_REFCNT_DECR(obj)                                                    \
510
  (InterlockedExchangeAdd((long *)(&obj->refcount), (long)(-1)) - 1)
511
#define MS_REFCNT_INIT(obj) obj->refcount = 1
512
#else
513
// unsafe fallback
514
#define MS_REFCNT_INCR(obj) obj->refcount++
515
#define MS_REFCNT_DECR(obj) (--(obj->refcount))
516
#define MS_REFCNT_INIT(obj) obj->refcount = 1
517
#endif // close if defined(_MSC..
518
#else  /*USE_THREAD*/
519
0
#define MS_REFCNT_INCR(obj) obj->refcount++
520
136k
#define MS_REFCNT_DECR(obj) (--(obj->refcount))
521
135k
#define MS_REFCNT_INIT(obj) obj->refcount = 1
522
#endif /*USE_THREAD*/
523
524
136k
#define MS_REFCNT_DECR_IS_NOT_ZERO(obj) (MS_REFCNT_DECR(obj)) > 0
525
0
#define MS_REFCNT_DECR_IS_ZERO(obj) (MS_REFCNT_DECR(obj)) <= 0
526
527
#define MS_IS_VALID_ARRAY_INDEX(index, size)                                   \
528
0
  ((index < 0 || index >= size) ? MS_FALSE : MS_TRUE)
529
530
#define MS_CONVERT_UNIT(src_unit, dst_unit, value)                             \
531
0
  (value * msInchesPerUnit(src_unit, 0) / msInchesPerUnit(dst_unit, 0))
532
533
#define MS_INIT_INVALID_RECT                                                   \
534
0
  { -1e300, -1e300, 1e300, 1e300 }
535
536
#endif
537
538
enum MS_NUM_CHECK_TYPES {
539
  MS_NUM_CHECK_NONE = 0,
540
  MS_NUM_CHECK_RANGE,
541
  MS_NUM_CHECK_GT,
542
  MS_NUM_CHECK_GTE
543
};
544
545
/* General enumerated types - needed by scripts */
546
enum MS_FILE_TYPE { MS_FILE_MAP, MS_FILE_SYMBOL };
547
enum MS_UNITS {
548
  MS_INCHES,
549
  MS_FEET,
550
  MS_MILES,
551
  MS_METERS,
552
  MS_KILOMETERS,
553
  MS_DD,
554
  MS_PIXELS,
555
  MS_PERCENTAGES,
556
  MS_NAUTICALMILES,
557
  MS_INHERIT = -1
558
};
559
enum MS_SHAPE_TYPE {
560
  MS_SHAPE_POINT,
561
  MS_SHAPE_LINE,
562
  MS_SHAPE_POLYGON,
563
  MS_SHAPE_NULL
564
};
565
enum MS_LAYER_TYPE {
566
  MS_LAYER_POINT,
567
  MS_LAYER_LINE,
568
  MS_LAYER_POLYGON,
569
  MS_LAYER_RASTER,
570
  MS_LAYER_ANNOTATION /* only used for parser backwards compatibility */,
571
  MS_LAYER_QUERY,
572
  MS_LAYER_CIRCLE,
573
  MS_LAYER_TILEINDEX,
574
  MS_LAYER_CHART
575
};
576
enum MS_FONT_TYPE { MS_TRUETYPE, MS_BITMAP };
577
enum MS_RENDER_MODE { MS_FIRST_MATCHING_CLASS, MS_ALL_MATCHING_CLASSES };
578
579
#define MS_POSITIONS_LENGTH 14
580
enum MS_POSITIONS_ENUM {
581
  MS_UL = 101,
582
  MS_LR,
583
  MS_UR,
584
  MS_LL,
585
  MS_CR,
586
  MS_CL,
587
  MS_UC,
588
  MS_LC,
589
  MS_CC,
590
  MS_AUTO,
591
  MS_XY,
592
  MS_NONE,
593
  MS_AUTO2,
594
  MS_FOLLOW
595
};
596
694
#define MS_TINY 5
597
694
#define MS_SMALL 7
598
46.5k
#define MS_MEDIUM 10
599
694
#define MS_LARGE 13
600
694
#define MS_GIANT 16
601
enum MS_QUERYMAP_STYLES { MS_NORMAL, MS_HILITE, MS_SELECTED };
602
enum MS_CONNECTION_TYPE {
603
  MS_INLINE,
604
  MS_SHAPEFILE,
605
  MS_TILED_SHAPEFILE,
606
  MS_UNUSED_2,
607
  MS_OGR,
608
  MS_UNUSED_1,
609
  MS_POSTGIS,
610
  MS_WMS,
611
  MS_ORACLESPATIAL,
612
  MS_WFS,
613
  MS_GRATICULE,
614
  MS_MYSQL,
615
  MS_RASTER,
616
  MS_PLUGIN,
617
  MS_UNION,
618
  MS_UVRASTER,
619
  MS_CONTOUR,
620
  MS_KERNELDENSITY,
621
  MS_IDW,
622
  MS_FLATGEOBUF,
623
  MS_RASTER_LABEL
624
};
625
#define IS_THIRDPARTY_LAYER_CONNECTIONTYPE(type)                               \
626
0
  ((type) == MS_UNION || (type) == MS_KERNELDENSITY || (type) == MS_IDW)
627
enum MS_JOIN_CONNECTION_TYPE {
628
  MS_DB_XBASE,
629
  MS_DB_CSV,
630
  MS_DB_MYSQL,
631
  MS_DB_ORACLE,
632
  MS_DB_POSTGRES
633
};
634
enum MS_JOIN_TYPE { MS_JOIN_ONE_TO_ONE, MS_JOIN_ONE_TO_MANY };
635
636
#define MS_SINGLE 0 /* modes for searching (spatial/database) */
637
102
#define MS_MULTIPLE 1
638
639
enum MS_QUERY_MODE { MS_QUERY_SINGLE, MS_QUERY_MULTIPLE };
640
enum MS_QUERY_TYPE {
641
  MS_QUERY_IS_NULL,
642
  MS_QUERY_BY_POINT,
643
  MS_QUERY_BY_RECT,
644
  MS_QUERY_BY_SHAPE,
645
  MS_QUERY_BY_ATTRIBUTE,
646
  MS_QUERY_BY_INDEX,
647
  MS_QUERY_BY_FILTER
648
};
649
650
enum MS_ALIGN_VALUE {
651
  MS_ALIGN_DEFAULT,
652
  MS_ALIGN_LEFT,
653
  MS_ALIGN_CENTER,
654
  MS_ALIGN_RIGHT
655
};
656
657
enum MS_CAPS_JOINS_AND_CORNERS {
658
  MS_CJC_NONE,
659
  MS_CJC_BEVEL,
660
  MS_CJC_BUTT,
661
  MS_CJC_MITER,
662
  MS_CJC_ROUND,
663
  MS_CJC_SQUARE,
664
  MS_CJC_TRIANGLE
665
};
666
667
4.46k
#define MS_CJC_DEFAULT_CAPS MS_CJC_ROUND
668
4.46k
#define MS_CJC_DEFAULT_JOINS MS_CJC_NONE
669
4.46k
#define MS_CJC_DEFAULT_JOIN_MAXSIZE 3
670
671
enum MS_RETURN_VALUE { MS_SUCCESS, MS_FAILURE, MS_DONE };
672
enum MS_IMAGEMODE {
673
  MS_IMAGEMODE_PC256,
674
  MS_IMAGEMODE_RGB,
675
  MS_IMAGEMODE_RGBA,
676
  MS_IMAGEMODE_INT16,
677
  MS_IMAGEMODE_FLOAT32,
678
  MS_IMAGEMODE_BYTE,
679
  MS_IMAGEMODE_FEATURE,
680
  MS_IMAGEMODE_NULL
681
};
682
683
enum MS_GEOS_OPERATOR {
684
  MS_GEOS_EQUALS,
685
  MS_GEOS_DISJOINT,
686
  MS_GEOS_TOUCHES,
687
  MS_GEOS_OVERLAPS,
688
  MS_GEOS_CROSSES,
689
  MS_GEOS_INTERSECTS,
690
  MS_GEOS_WITHIN,
691
  MS_GEOS_CONTAINS,
692
  MS_GEOS_BEYOND,
693
  MS_GEOS_DWITHIN
694
};
695
#define MS_FILE_DEFAULT MS_FILE_MAP
696
697
#if defined(_MSC_VER) && (_MSC_VER <= 1310)
698
#define MS_DEBUG msDebug2
699
#else
700
#ifdef USE_EXTENDED_DEBUG
701
#define MS_DEBUG(level, elt, fmt, ...)                                         \
702
0
  if ((elt)->debug >= (level))                                                 \
703
0
  msDebug(fmt, ##__VA_ARGS__)
704
#else
705
#define MS_DEBUG(level, elt, fmt, ...) /* no-op */
706
#endif
707
#endif
708
709
/* coordinate to pixel simplification modes, used in msTransformShape */
710
enum MS_TRANSFORM_MODE {
711
  MS_TRANSFORM_NONE,  /* no geographic to pixel transformation */
712
  MS_TRANSFORM_ROUND, /* round to integer, might create degenerate geometries
713
                         (used for GD)*/
714
  MS_TRANSFORM_SNAPTOGRID, /* snap to a grid, should be user configurable in the
715
                              future*/
716
  MS_TRANSFORM_FULLRESOLUTION, /* keep full resolution */
717
  MS_TRANSFORM_SIMPLIFY        /* keep full resolution */
718
};
719
720
typedef enum {
721
  MS_COMPOP_CLEAR,
722
  MS_COMPOP_SRC,
723
  MS_COMPOP_DST,
724
  MS_COMPOP_SRC_OVER,
725
  MS_COMPOP_DST_OVER,
726
  MS_COMPOP_SRC_IN,
727
  MS_COMPOP_DST_IN,
728
  MS_COMPOP_SRC_OUT,
729
  MS_COMPOP_DST_OUT,
730
  MS_COMPOP_SRC_ATOP,
731
  MS_COMPOP_DST_ATOP,
732
  MS_COMPOP_XOR,
733
  MS_COMPOP_PLUS,
734
  MS_COMPOP_MINUS,
735
  MS_COMPOP_MULTIPLY,
736
  MS_COMPOP_SCREEN,
737
  MS_COMPOP_OVERLAY,
738
  MS_COMPOP_DARKEN,
739
  MS_COMPOP_LIGHTEN,
740
  MS_COMPOP_COLOR_DODGE,
741
  MS_COMPOP_COLOR_BURN,
742
  MS_COMPOP_HARD_LIGHT,
743
  MS_COMPOP_SOFT_LIGHT,
744
  MS_COMPOP_DIFFERENCE,
745
  MS_COMPOP_EXCLUSION,
746
  MS_COMPOP_CONTRAST,
747
  MS_COMPOP_INVERT,
748
  MS_COMPOP_INVERT_RGB,
749
  MS_COMPOP_HSL_HUE,
750
  MS_COMPOP_HSL_LUMINOSITY,
751
  MS_COMPOP_HSL_SATURATION,
752
  MS_COMPOP_HSL_COLOR,
753
} CompositingOperation;
754
755
typedef struct _CompositingFilter {
756
  char *filter;
757
  struct _CompositingFilter *next;
758
} CompositingFilter;
759
760
typedef struct _LayerCompositer {
761
  CompositingOperation comp_op;
762
  int opacity;
763
  CompositingFilter *filter;
764
  struct _LayerCompositer *next;
765
} LayerCompositer;
766
767
#ifndef SWIG
768
/* Filter object */
769
typedef enum {
770
  FILTER_NODE_TYPE_UNDEFINED = -1,
771
  FILTER_NODE_TYPE_LOGICAL = 0,
772
  FILTER_NODE_TYPE_SPATIAL = 1,
773
  FILTER_NODE_TYPE_COMPARISON = 2,
774
  FILTER_NODE_TYPE_PROPERTYNAME = 3,
775
  FILTER_NODE_TYPE_BBOX = 4,
776
  FILTER_NODE_TYPE_LITERAL = 5,
777
  FILTER_NODE_TYPE_BOUNDARY = 6,
778
  FILTER_NODE_TYPE_GEOMETRY_POINT = 7,
779
  FILTER_NODE_TYPE_GEOMETRY_LINE = 8,
780
  FILTER_NODE_TYPE_GEOMETRY_POLYGON = 9,
781
  FILTER_NODE_TYPE_FEATUREID = 10,
782
  FILTER_NODE_TYPE_TEMPORAL = 11,
783
  FILTER_NODE_TYPE_TIME_PERIOD = 12
784
} FilterNodeType;
785
786
/************************************************************************/
787
/*                          FilterEncodingNode                          */
788
/************************************************************************/
789
790
typedef struct _FilterNode {
791
  FilterNodeType eType;
792
  char *pszValue;
793
  void *pOther;
794
  char *pszSRS;
795
  struct _FilterNode *psLeftNode;
796
  struct _FilterNode *psRightNode;
797
} FilterEncodingNode;
798
#endif /*SWIG*/
799
800
/* Define supported bindings here (only covers existing bindings at first). Not
801
 * accessible directly using MapScript. */
802
116k
#define MS_STYLE_BINDING_LENGTH 12
803
enum MS_STYLE_BINDING_ENUM {
804
  MS_STYLE_BINDING_SIZE,
805
  MS_STYLE_BINDING_WIDTH,
806
  MS_STYLE_BINDING_ANGLE,
807
  MS_STYLE_BINDING_COLOR,
808
  MS_STYLE_BINDING_OUTLINECOLOR,
809
  MS_STYLE_BINDING_SYMBOL,
810
  MS_STYLE_BINDING_OUTLINEWIDTH,
811
  MS_STYLE_BINDING_OPACITY,
812
  MS_STYLE_BINDING_OFFSET_X,
813
  MS_STYLE_BINDING_OFFSET_Y,
814
  MS_STYLE_BINDING_POLAROFFSET_PIXEL,
815
  MS_STYLE_BINDING_POLAROFFSET_ANGLE
816
};
817
1.09M
#define MS_LABEL_BINDING_LENGTH 12
818
enum MS_LABEL_BINDING_ENUM {
819
  MS_LABEL_BINDING_SIZE,
820
  MS_LABEL_BINDING_ANGLE,
821
  MS_LABEL_BINDING_COLOR,
822
  MS_LABEL_BINDING_OUTLINECOLOR,
823
  MS_LABEL_BINDING_FONT,
824
  MS_LABEL_BINDING_PRIORITY,
825
  MS_LABEL_BINDING_POSITION,
826
  MS_LABEL_BINDING_SHADOWSIZEX,
827
  MS_LABEL_BINDING_SHADOWSIZEY,
828
  MS_LABEL_BINDING_OFFSET_X,
829
  MS_LABEL_BINDING_OFFSET_Y,
830
  MS_LABEL_BINDING_ALIGN
831
};
832
833
/************************************************************************/
834
/*                         attributeBindingObj                          */
835
/************************************************************************/
836
#ifndef SWIG
837
typedef struct {
838
  char *item;
839
  int index;
840
} attributeBindingObj;
841
#endif /*SWIG*/
842
843
/************************************************************************/
844
/*                             labelPathObj                             */
845
/*                                                                      */
846
/*      Label path object - used to hold path and bounds of curved      */
847
/*      labels - Bug #1620 implementation.                              */
848
/************************************************************************/
849
#ifndef SWIG
850
typedef struct {
851
  multipointObj path;
852
  shapeObj bounds;
853
  double *angles;
854
} labelPathObj;
855
#endif /*SWIG*/
856
857
/************************************************************************/
858
/*                              fontSetObj                              */
859
/*                                                                      */
860
/*      used to hold aliases for TRUETYPE fonts                         */
861
/************************************************************************/
862
863
/**
864
The :ref:`FONTSET <fontset>` object
865
*/
866
typedef struct {
867
#ifdef SWIG
868
    %immutable;
869
#endif
870
  char *filename;     ///< The filename of the fonset
871
  int numfonts;       ///< The number of fonts in the fontset
872
  hashTableObj fonts; ///< Key, value pairs of font name and font file
873
#ifdef SWIG
874
    %mutable;
875
#endif
876
877
#ifndef SWIG
878
  struct mapObj *map;
879
#endif
880
} fontSetObj;
881
882
/************************************************************************/
883
/*                         featureListNodeObj                           */
884
/*                                                                      */
885
/*      for inline features, shape caches and queries                   */
886
/************************************************************************/
887
#ifndef SWIG
888
typedef struct listNode {
889
  shapeObj shape;
890
  struct listNode *next;
891
  struct listNode *tailifhead; /* this is the tail node in the list, if this is
892
                                  the head element, otherwise NULL */
893
} featureListNodeObj;
894
895
typedef featureListNodeObj *featureListNodeObjPtr;
896
#endif
897
898
/************************************************************************/
899
/*                              paletteObj                              */
900
/*                                                                      */
901
/*      used to hold colors while a map file is read                    */
902
/************************************************************************/
903
#ifndef SWIG
904
typedef struct {
905
  colorObj colors[MS_MAXCOLORS - 1];
906
  int colorvalue[MS_MAXCOLORS - 1];
907
  int numcolors;
908
} paletteObj;
909
#endif
910
911
/************************************************************************/
912
/*                     expressionObj & tokenObj                         */
913
/************************************************************************/
914
915
enum MS_TOKEN_LOGICAL_ENUM {
916
  MS_TOKEN_LOGICAL_AND = 300,
917
  MS_TOKEN_LOGICAL_OR,
918
  MS_TOKEN_LOGICAL_NOT
919
};
920
enum MS_TOKEN_LITERAL_ENUM {
921
  MS_TOKEN_LITERAL_NUMBER = 310,
922
  MS_TOKEN_LITERAL_STRING,
923
  MS_TOKEN_LITERAL_TIME,
924
  MS_TOKEN_LITERAL_SHAPE,
925
  MS_TOKEN_LITERAL_BOOLEAN
926
};
927
enum MS_TOKEN_COMPARISON_ENUM {
928
  MS_TOKEN_COMPARISON_EQ = 320,
929
  MS_TOKEN_COMPARISON_NE,
930
  MS_TOKEN_COMPARISON_GT,
931
  MS_TOKEN_COMPARISON_LT,
932
  MS_TOKEN_COMPARISON_LE,
933
  MS_TOKEN_COMPARISON_GE,
934
  MS_TOKEN_COMPARISON_IEQ,
935
  MS_TOKEN_COMPARISON_RE,
936
  MS_TOKEN_COMPARISON_IRE,
937
  MS_TOKEN_COMPARISON_IN,
938
#ifdef MAPSERVER_BUILD
939
  MS_TOKEN_COMPARISON_LIKE_is_unused,
940
#else
941
  MS_TOKEN_COMPARISON_LIKE,
942
#endif
943
  MS_TOKEN_COMPARISON_INTERSECTS,
944
  MS_TOKEN_COMPARISON_DISJOINT,
945
  MS_TOKEN_COMPARISON_TOUCHES,
946
  MS_TOKEN_COMPARISON_OVERLAPS,
947
  MS_TOKEN_COMPARISON_CROSSES,
948
  MS_TOKEN_COMPARISON_WITHIN,
949
  MS_TOKEN_COMPARISON_CONTAINS,
950
  MS_TOKEN_COMPARISON_EQUALS,
951
  MS_TOKEN_COMPARISON_BEYOND,
952
  MS_TOKEN_COMPARISON_DWITHIN
953
};
954
enum MS_TOKEN_FUNCTION_ENUM {
955
  MS_TOKEN_FUNCTION_LENGTH = 350,
956
  MS_TOKEN_FUNCTION_TOSTRING,
957
  MS_TOKEN_FUNCTION_COMMIFY,
958
  MS_TOKEN_FUNCTION_AREA,
959
  MS_TOKEN_FUNCTION_ROUND,
960
  MS_TOKEN_FUNCTION_FROMTEXT,
961
  MS_TOKEN_FUNCTION_BUFFER,
962
  MS_TOKEN_FUNCTION_DIFFERENCE,
963
  MS_TOKEN_FUNCTION_SIMPLIFY,
964
  MS_TOKEN_FUNCTION_SIMPLIFYPT,
965
  MS_TOKEN_FUNCTION_GENERALIZE,
966
  MS_TOKEN_FUNCTION_SMOOTHSIA,
967
  MS_TOKEN_FUNCTION_CENTERLINE,
968
  MS_TOKEN_FUNCTION_DENSIFY,
969
  MS_TOKEN_FUNCTION_OUTER,
970
  MS_TOKEN_FUNCTION_INNER,
971
  MS_TOKEN_FUNCTION_JAVASCRIPT,
972
  MS_TOKEN_FUNCTION_UPPER,
973
  MS_TOKEN_FUNCTION_LOWER,
974
  MS_TOKEN_FUNCTION_INITCAP,
975
  MS_TOKEN_FUNCTION_FIRSTCAP
976
};
977
enum MS_TOKEN_BINDING_ENUM {
978
  MS_TOKEN_BINDING_DOUBLE = 380,
979
  MS_TOKEN_BINDING_INTEGER,
980
  MS_TOKEN_BINDING_STRING,
981
  MS_TOKEN_BINDING_TIME,
982
  MS_TOKEN_BINDING_SHAPE,
983
  MS_TOKEN_BINDING_MAP_CELLSIZE,
984
  MS_TOKEN_BINDING_DATA_CELLSIZE
985
};
986
enum MS_PARSE_TYPE_ENUM {
987
  MS_PARSE_TYPE_BOOLEAN,
988
  MS_PARSE_TYPE_STRING,
989
  MS_PARSE_TYPE_SHAPE,
990
  MS_PARSE_TYPE_SLD
991
};
992
993
#ifndef SWIG
994
typedef union {
995
  int intval;
996
  char *strval;
997
  shapeObj *shpval;
998
} parseResultObj;
999
1000
typedef union {
1001
  double dblval;
1002
  int intval;
1003
  char *strval;
1004
  struct tm tmval;
1005
  shapeObj *shpval;
1006
  attributeBindingObj bindval;
1007
} tokenValueObj;
1008
1009
typedef struct tokenListNode {
1010
  int token;
1011
  tokenValueObj tokenval;
1012
  char *tokensrc; /* on occasion we may want to access to the original source
1013
                     string (e.g. date/time) */
1014
  struct tokenListNode *next;
1015
  struct tokenListNode *tailifhead; /* this is the tail node in the list if this
1016
                                       is the head element, otherwise NULL */
1017
} tokenListNodeObj;
1018
1019
typedef tokenListNodeObj *tokenListNodeObjPtr;
1020
1021
typedef struct {
1022
  char *string;
1023
  int type;
1024
  /* container for expression options such as case-insensitiveness */
1025
  /* This is a boolean container. */
1026
  int flags;
1027
1028
  /* logical expression options */
1029
  tokenListNodeObjPtr tokens;
1030
  tokenListNodeObjPtr curtoken;
1031
1032
  /* regular expression options */
1033
  ms_regex_t regex; /* compiled regular expression to be matched */
1034
  int compiled;
1035
1036
  char *native_string; /* RFC 91 */
1037
} expressionObj;
1038
1039
typedef struct {
1040
  colorObj *pixel;     /* for raster layers */
1041
  shapeObj *shape;     /* for vector layers */
1042
  double dblval;       /* for map cellsize used by simplify */
1043
  double dblval2;      /* for data cellsize */
1044
  expressionObj *expr; /* expression to be evaluated (contains tokens) */
1045
  int type; /* type of parse: boolean, string/text or shape/geometry */
1046
  parseResultObj result; /* parse result */
1047
} parseObj;
1048
#endif
1049
1050
/************************************************************************/
1051
/*                          clusterObj                                  */
1052
/************************************************************************/
1053
1054
/**
1055
The :ref:`CLUSTER <cluster>` object. See :ref:`RFC 69 <rfc69>`.
1056
*/
1057
typedef struct {
1058
  double maxdistance; ///< Maximum distance between clusters - see
1059
                      ///< :ref:`MAXDISTANCE <mapfile-cluster-maxdistance>`
1060
  double buffer;      ///< The buffer size around the selection area - see
1061
                      ///< :ref:`BUFFER <mapfile-cluster-buffer>`
1062
  char *region; ///< The type of the cluster region (rectangle or ellipse) - see
1063
                ///< :ref:`REGION <mapfile-cluster-region>`
1064
#ifndef SWIG
1065
  expressionObj group;  /* expression to identify the groups */
1066
  expressionObj filter; /* expression for filtering the shapes */
1067
#endif
1068
} clusterObj;
1069
1070
/************************************************************************/
1071
/*                          processingParams                            */
1072
/************************************************************************/
1073
1074
#ifndef SWIG
1075
/* Used by idw.c and kerneldensity.c */
1076
typedef struct {
1077
  float normalization_scale;
1078
  int expand_searchrect;
1079
  int radius;
1080
  float power;
1081
} interpolationProcessingParams;
1082
#endif
1083
1084
/************************************************************************/
1085
/*                               joinObj                                */
1086
/*                                                                      */
1087
/*      simple way to access other XBase files, one-to-one or           */
1088
/*      one-to-many supported                                           */
1089
/************************************************************************/
1090
1091
#ifndef SWIG
1092
typedef struct {
1093
  char *name;
1094
  char **items, **values; /* items/values (process 1 record at a time) */
1095
  int numitems;
1096
1097
  char *table;
1098
  char *from, *to; /* item names */
1099
1100
  void *joininfo; /* vendor specific (i.e. XBase, MySQL, etc.) stuff to allow
1101
                     for persistent access */
1102
1103
  char *header, *footer;
1104
#ifndef __cplusplus
1105
  char *template;
1106
#else
1107
  char *_template;
1108
#endif
1109
1110
  enum MS_JOIN_TYPE type;
1111
  char *connection;
1112
  enum MS_JOIN_CONNECTION_TYPE connectiontype;
1113
} joinObj;
1114
#endif
1115
1116
/************************************************************************/
1117
/*                           outputFormatObj                            */
1118
/*                                                                      */
1119
/*      see mapoutput.c for most related code.                          */
1120
/************************************************************************/
1121
1122
/**
1123
The :ref:`OUTPUTFORMAT <outputformat>` object
1124
*/
1125
typedef struct {
1126
#ifndef SWIG
1127
  int refcount;
1128
  char **formatoptions;
1129
  rendererVTableObj *vtable;
1130
  void *device; /* for supporting direct rendering onto a device context */
1131
#endif          /* SWIG */
1132
#ifdef SWIG
1133
    %immutable;
1134
#endif /* SWIG */
1135
1136
  /**
1137
  The number of option values set on this format - can be used to
1138
  iterate over the options array in conjunction with
1139
  :func:`outputFormatObj.getOptionAt`
1140
  */
1141
  int numformatoptions;
1142
1143
#ifdef SWIG
1144
    %mutable;
1145
#endif             /* SWIG */
1146
  char *name;      ///< See :ref:`NAME <mapfile-outputformat-name>`
1147
  char *mimetype;  ///< See :ref:`MIMETYPE <mapfile-outputformat-mimetype>`
1148
  char *driver;    ///< See :ref:`DRIVER <mapfile-outputformat-driver>`
1149
  char *extension; ///< See :ref:`EXTENSION <mapfile-outputformat-extension>`
1150
  int renderer;  ///< A :ref:`render mode constant<mapfile-constants-render>` -
1151
                 ///< normally set internally based on the driver and some other
1152
                 ///< setting in the constructor.
1153
  int imagemode; ///< An :ref:`Image mode constant<mapfile-constants-imagemode>`
1154
                 ///< - see :ref:`IMAGEMODE <mapfile-outputformat-imagemode>`
1155
  int transparent; ///< See :ref:`TRANSPARENT
1156
                   ///< <mapfile-outputformat-transparent>`
1157
  int bands;       ///< The number of bands in the raster, normally set via the
1158
             ///< BAND_COUNT formatoption - this field should be considered
1159
             ///< read-only Only used for the "raw" modes, MS_IMAGEMODE_BYTE,
1160
             ///< MS_IMAGEMODE_INT16, and MS_IMAGEMODE_FLOAT32
1161
  int inmapfile; ///< Boolean value indicating if the format is in the Mapfile
1162
} outputFormatObj;
1163
1164
/* The following is used for "don't care" values in transparent, interlace and
1165
   imagequality values. */
1166
44.0k
#define MS_NOOVERRIDE -1111
1167
1168
/************************************************************************/
1169
/*                             queryObj                                 */
1170
/*                                                                      */
1171
/*      encapsulates the information necessary to perform a query       */
1172
/************************************************************************/
1173
#ifndef SWIG
1174
typedef struct {
1175
  int type; /* MS_QUERY_TYPE */
1176
  int mode; /* MS_QUERY_MODE */
1177
1178
  int layer;
1179
1180
  pointObj point; /* by point */
1181
  double buffer;
1182
  int maxresults;
1183
1184
  rectObj rect;    /* by rect */
1185
  shapeObj *shape; /* by shape & operator (OGC filter) */
1186
1187
  long shapeindex; /* by index */
1188
  long tileindex;
1189
  int clear_resultcache;
1190
1191
  int maxfeatures; /* global maxfeatures */
1192
  int startindex;
1193
  int only_cache_result_count; /* set to 1 sometimes by WFS 2.0 GetFeature
1194
                                  request */
1195
1196
  expressionObj filter; /* by filter */
1197
  char *filteritem;
1198
1199
  int slayer; /* selection layer, used for msQueryByFeatures() (note this is not
1200
                 a query mode per se) */
1201
1202
  int cache_shapes;           /* whether to cache shapes in resultCacheObj */
1203
  int max_cached_shape_count; /* maximum number of shapes cached in the total
1204
                                 number of resultCacheObj */
1205
  int max_cached_shape_ram_amount; /* maximum number of bytes taken by shapes
1206
                                      cached in the total number of
1207
                                      resultCacheObj */
1208
} queryObj;
1209
#endif
1210
1211
/************************************************************************/
1212
/*                             queryMapObj                              */
1213
/*                                                                      */
1214
/*      used to visualize query results                                 */
1215
/************************************************************************/
1216
1217
/**
1218
The :ref:`QUERYMAP <querymap>` object.
1219
Instances of querymapObj are always are always embedded inside the
1220
:class:`mapObj`.
1221
*/
1222
typedef struct {
1223
#ifdef SWIG
1224
    %immutable;
1225
#endif                /* SWIG */
1226
  struct mapObj *map; ///< Reference to parent :class:`mapObj`
1227
#ifdef SWIG
1228
    %mutable;
1229
#endif            /* SWIG */
1230
  int height;     ///< See :ref:`SIZE <mapfile-querymap-size>`
1231
  int width;      ///< See :ref:`SIZE <mapfile-querymap-size>`
1232
  int status;     ///< See :ref:`STATUS <mapfile-querymap-status>`
1233
  int style;      ///< ``HILITE``, ``SELECTED`` or ``NORMAL`` - see :ref:`STYLE
1234
                  ///< <mapfile-querymap-style>`
1235
  colorObj color; ///< See :ref:`COLOR <mapfile-querymap-color>`
1236
} queryMapObj;
1237
1238
/************************************************************************/
1239
/*                                webObj                                */
1240
/*                                                                      */
1241
/*      holds parameters for a mapserver/mapscript interface            */
1242
/************************************************************************/
1243
1244
/**
1245
The :ref:`WEB <web>` object.
1246
Has no other existence than as an attribute of a :class:`mapObj`.
1247
Serves as a container for various run-time web application definitions like
1248
temporary file paths, template paths, etc.
1249
*/
1250
typedef struct {
1251
1252
#ifdef SWIG
1253
      %immutable;
1254
#endif                     /* SWIG */
1255
  hashTableObj metadata;   ///< Metadata hash table - see :ref:`METADATA
1256
                           ///< <mapfile-web-metadata>`
1257
  hashTableObj validation; ///< See :ref:`VALIDATION <mapfile-web-validation>`
1258
  struct mapObj *map;      ///< Reference to parent :class:`mapObj`
1259
1260
#ifdef SWIG
1261
      %mutable;
1262
#endif /* SWIG */
1263
1264
  char *imagepath; ///< Filesystem path to temporary image location - see
1265
                   ///< :ref:`IMAGEPATH <mapfile-web-imagepath>`
1266
  char *imageurl;  ///< URL to temporary image location - see :ref:`IMAGEURL
1267
                   ///< <mapfile-web-imageurl>`
1268
  char *temppath;  ///< See :ref:`TEMPPATH <mapfile-web-temppath>`
1269
  char *header;    ///< Path to header document - see :ref:`HEADER
1270
                   ///< <mapfile-web-header>`
1271
  char *footer;    ///< Path to footer document - see :ref:`FOOTER
1272
                   ///< <mapfile-web-footer>`
1273
  char *empty;     ///< See :ref:`EMPTY <mapfile-web-empty>`
1274
  char *error;     ///< Error handling - see :ref:`ERROR <mapfile-web-error>`
1275
1276
  double minscaledenom; ///< Maximum map scale - see :ref:`MINSCALEDENOM
1277
                        ///< <mapfile-web-minscaledenom>`
1278
  double maxscaledenom; ///< Minimum map scale - see :ref:`MAXSCALEDENOM
1279
                        ///< <mapfile-web-maxscaledenom>`
1280
  char *mintemplate;    ///< See :ref:`MINTEMPLATE <mapfile-web-mintemplate>`
1281
  char *maxtemplate;    ///< See :ref:`MAXTEMPLATE <mapfile-web-maxtemplate>`
1282
1283
  char *queryformat;  ///< See :ref:`QUERYFORMAT <mapfile-web-queryformat>` /*
1284
                      ///< what format is the query to be returned, given as a
1285
                      ///< MIME type */
1286
  char *legendformat; ///< See :ref:`LEGENDFORMAT <mapfile-web-legendformat>`
1287
  char *browseformat; ///< See :ref:`BROWSEFORMAT <mapfile-web-browseformat>`
1288
1289
#ifndef __cplusplus
1290
  char *template; ///< Path to template document - see :ref:`TEMPLATE
1291
                  ///< <mapfile-web-template>`
1292
#else
1293
  char *_template;
1294
#endif
1295
1296
} webObj;
1297
1298
/************************************************************************/
1299
/*                               styleObj                               */
1300
/*                                                                      */
1301
/*      holds parameters for symbolization, multiple styles may be      */
1302
/*      applied within a classObj                                       */
1303
/************************************************************************/
1304
1305
/**
1306
The :ref:`STYLE <style>` object. An instance of styleObj is associated with one
1307
instance of :class:`classObj`.
1308
*/
1309
struct styleObj {
1310
1311
#ifndef SWIG
1312
  /* private vars for rfc 48 & 64 */
1313
  expressionObj _geomtransform;
1314
  double scalefactor; // computed, not set
1315
  attributeBindingObj bindings[MS_STYLE_BINDING_LENGTH];
1316
  int numbindings;
1317
  expressionObj exprBindings[MS_STYLE_BINDING_LENGTH];
1318
  int nexprbindings;
1319
#endif
1320
1321
#ifdef SWIG
1322
    %immutable;
1323
#endif /* SWIG */
1324
1325
  int refcount;     ///< number of references to this object
1326
  char *symbolname; ///< Name of the style's symbol - see :ref:`symbolname
1327
                    ///< <mapfile-style-symbol>`
1328
1329
#ifdef SWIG
1330
    %mutable;
1331
#endif /* SWIG */
1332
1333
#if defined(SWIG) && defined(SWIGPYTHON)
1334
  /* would probably make sense to mark it immutable for other binding languages
1335
   * than Python */
1336
  // clang-format off
1337
  %immutable;
1338
// clang-format on
1339
#endif
1340
  int patternlength; ///< Number of elements in the pattern attribute
1341
#if defined(SWIG) && defined(SWIGPYTHON)
1342
  // clang-format off
1343
  %mutable;
1344
// clang-format on
1345
#endif
1346
1347
#if !(defined(SWIG) &&                                                         \
1348
      defined(SWIGPYTHON)) /* in Python we use a special typemap for this */
1349
  double pattern[MS_MAXPATTERNLENGTH]; ///< List of on, off values to define a
1350
                                       ///< dash pattern for line work (lines,
1351
                                       ///< polygon outlines, hatch lines)
1352
#endif
1353
1354
  double angle; ///< Angle, given in degrees, to draw the line work, default is
1355
                ///< 0, for symbols of Type HATCH, this is the angle of the
1356
                ///< hatched lines - see :ref:`ANGLE <mapfile-style-angle>`
1357
  /*should an angle be automatically computed*/
1358
  int autoangle; ///< If the angle is set to ``AUTO`` - see :ref:`ANGLE
1359
                 ///< <mapfile-style-angle>`
1360
1361
  /* should lines be drawn with antialiasing (default)? */
1362
  int antialiased; ///< See :ref:`ANTIALIAS <mapfile-style-antialias>`
1363
1364
  colorObj color;        ///< Foreground or fill pen color - see :ref:`COLOR
1365
                         ///< <mapfile-style-color>`
1366
  colorObj outlinecolor; ///< Outline pen color - see :ref:`OUTLINECOLOR
1367
                         ///< <mapfile-style-outlinecolor>`
1368
1369
  int opacity; ///< See :ref:`OPACITY <mapfile-style-opacity>`
1370
1371
  /* Stuff to handle Color Range Styles */
1372
  colorObj mincolor; ///< Minimum color in the :ref:`COLORRANGE
1373
                     ///< <mapfile-style-colorrange>`
1374
  colorObj maxcolor; ///< Maximum color in the :ref:`COLORRANGE
1375
                     ///< <mapfile-style-colorrange>`
1376
  double minvalue;   ///< related to color ranges
1377
  double maxvalue;   ///< related to color ranges
1378
  char *
1379
      rangeitem; ///< Attribute/field that stores the values for the Color Range
1380
                 ///< Mapping  - see :ref:`RANGEITEM <mapfile-style-rangeitem>`
1381
  int rangeitemindex; ///< The index of the range item - see :ref:`RANGEITEM
1382
                      ///< <mapfile-style-rangeitem>`
1383
1384
  int symbol;  ///< The index within the map symbolset of the style's symbol -
1385
               ///< see :ref:`SYMBOL <mapfile-style-symbol>`
1386
  double size; ///< Pixel width of the style's pen or symbol - see :ref:`SIZE
1387
               ///< <mapfile-style-size>`
1388
  double minsize; ///< Minimum pen or symbol width for scaling styles - see
1389
                  ///< :ref:`MINSIZE <mapfile-style-minsize>`
1390
  double maxsize; ///< Maximum pen or symbol width for scaling - see
1391
                  ///< :ref:`MAXSIZE <mapfile-style-maxsize>`
1392
1393
  double gap; ///< See :ref:`GAP <mapfile-style-gap>` - moved from symbolObj in
1394
              ///< version 6.0
1395
  double initialgap; ///< See :ref:`INITIALGAP <mapfile-style-initialgap>`
1396
1397
  int linecap;  ///< See :ref:`LINECAP <mapfile-style-linecap>`
1398
  int linejoin; ///< See :ref:`LINEJOIN <mapfile-style-linejoin>` - moved from
1399
                ///< symbolObj in version 6.0
1400
  double linejoinmaxsize; ///< See :ref:`LINEJOINMAXSIZE
1401
                          ///< <mapfile-style-linejoinmaxsize>` - moved from
1402
                          ///< symbolObj in version 6.0
1403
1404
  double width; ///< Width refers to the thickness of line work drawn, in pixels
1405
                ///< - default is 1, for symbols of type ``HATCH``, the with is
1406
                ///< how thick the hatched lines are - see :ref:`WIDTH
1407
                ///< <mapfile-style-width>`
1408
  double outlinewidth; ///< See :ref:`OUTLINEWIDTH <mapfile-style-outlinewidth>`
1409
  double minwidth;     ///< Minimum width of the symbol - see :ref:`MINWIDTH
1410
                       ///< <mapfile-style-minwidth>`
1411
  double maxwidth;     ///< Maximum width of the symbol - see :ref:`MAXWIDTH
1412
                       ///< <mapfile-style-maxwidth>`
1413
1414
  double offsetx; ///< Draw with pen or symbol offset from map data, for
1415
                  ///< shadows, hollow symbols, etc - see :ref:`OFFSET
1416
                  ///< <mapfile-style-offset>`
1417
  double offsety; ///< Draw with pen or symbol offset from map data, for
1418
                  ///< shadows, hollow symbols, etc - see :ref:`OFFSET
1419
                  ///< <mapfile-style-offset>`
1420
  double polaroffsetpixel; ///< Specifies the radius/distance - see
1421
                           ///< :ref:`POLAROFFSET <mapfile-style-polaroffset>`
1422
  double polaroffsetangle; ///< Specified the angle - see :ref:`POLAROFFSET
1423
                           ///< <mapfile-style-polaroffset>`
1424
1425
  double
1426
      minscaledenom; ///< See :ref:`MINSCALEDENOM <mapfile-style-minscaledenom>`
1427
  double
1428
      maxscaledenom; ///< See :ref:`MAXSCALEDENOM <mapfile-style-maxscaledenom>`
1429
  int sizeunits;     ///< Supersedes class's :ref:`SIZEUNITS
1430
                 ///< <mapfile-layer-sizeunits>` to allow fine-grained sizing
1431
                 ///< for improved SLD (RFC 124)
1432
};
1433
1434
0
#define MS_STYLE_SINGLE_SIDED_OFFSET -99
1435
0
#define MS_STYLE_DOUBLE_SIDED_OFFSET -999
1436
#define IS_PARALLEL_OFFSET(offsety)                                            \
1437
0
  ((offsety) == MS_STYLE_SINGLE_SIDED_OFFSET ||                                \
1438
0
   (offsety) == MS_STYLE_DOUBLE_SIDED_OFFSET)
1439
1440
/********************************************************************/
1441
/*                          labelLeaderObj                          */
1442
/*                                                                  */
1443
/*  parameters defining how a label or a group of labels may be     */
1444
/*  offsetted from its original position                            */
1445
/********************************************************************/
1446
1447
/**
1448
The :ref:`LEADER <leader>` object
1449
*/
1450
typedef struct {
1451
#ifndef SWIG
1452
  styleObj **styles;
1453
  int maxstyles;
1454
#endif
1455
#ifdef SWIG
1456
    %immutable;
1457
#endif
1458
  int numstyles; ///< Number of styles used
1459
#ifdef SWIG
1460
    %mutable;
1461
#endif
1462
  int maxdistance; ///< See :ref:`MAXDISTANCE <mapfile-leader-maxdistance>`
1463
  int gridstep;    ///< See :ref:`GRIDSTEP <mapfile-leader-gridstep>`
1464
} labelLeaderObj;
1465
1466
/************************************************************************/
1467
/*                               labelObj                               */
1468
/*                                                                      */
1469
/*      parameters needed to annotate a layer, legend or scalebar       */
1470
/************************************************************************/
1471
1472
/**
1473
The :ref:`LABEL <label>` object
1474
*/
1475
struct labelObj {
1476
#ifdef SWIG
1477
    %immutable;
1478
#endif /* SWIG */
1479
  int refcount;
1480
#ifdef SWIG
1481
    %mutable;
1482
#endif /* SWIG */
1483
1484
  char *font; ///< Name of TrueType font  see :ref:`FONT <mapfile-label-font>`
1485
  colorObj color; ///< Foreground color - see :ref:`COLOR <mapfile-label-color>`
1486
  colorObj outlinecolor; ///< Color of one point outline - see
1487
                         ///< :ref:`OUTLINECOLOR <mapfile-label-outlinecolor>`
1488
  int outlinewidth; ///< See :ref:`OUTLINEWIDTH <mapfile-label-outlinewidth>`
1489
1490
  colorObj shadowcolor; ///< See :ref:`SHADOWCOLOR <mapfile-label-shadowcolor>`
1491
  int shadowsizex;      ///< See :ref:`SHADOWSIZE <mapfile-label-shadowsize>`
1492
  int shadowsizey;      ///< See :ref:`SHADOWSIZE <mapfile-label-shadowsize>`
1493
1494
  int size;    ///< Annotation height in pixels - see :ref:`SIZE
1495
               ///< <mapfile-label-size>`
1496
  int minsize; ///< Minimum height in pixels - see :ref:`MINSIZE
1497
               ///< <mapfile-label-minsize>`
1498
  int maxsize; ///< Maximum height in pixels for scaled labels. See
1499
               ///< :ref:`MAXSIZE <mapfile-label-maxsize>`
1500
1501
  int position; ///< See :ref:`POSITION <mapfile-label-position>`
1502
  int offsetx;  ///< Horizontal offset of label - see :ref:`OFFSET
1503
                ///< <mapfile-label-offset>`
1504
  int offsety;  ///< Vertical offset of label - see :ref:`OFFSET
1505
                ///< <mapfile-label-offset>`
1506
1507
  double angle; ///< See :ref:`ANGLE <mapfile-label-angle>`
1508
  enum MS_POSITIONS_ENUM
1509
      anglemode; ///< One of :data:`AUTO` :data:`AUTO2`, or :data:`FOLLOW` - see
1510
                 ///< :ref:`ANGLE <mapfile-label-angle>`
1511
1512
  int buffer; ///< Space to reserve around a label (padding) - see :ref:`BUFFER
1513
              ///< <mapfile-label-buffer>`
1514
1515
  int align; ///< See :ref:`ALIGN <mapfile-label-align>`
1516
1517
  char wrap;            ///< See :ref:`WRAP <mapfile-label-wrap>`
1518
  int maxlength;        ///< See :ref:`MAXLENGTH <mapfile-label-maxlength>`
1519
  double space_size_10; ///< Cached size of a single space character used for
1520
                        ///< label text alignment of rfc40
1521
1522
  /**
1523
  Minimum feature size (in pixels) to label, features of this size or greater
1524
  will be labeled - see :ref:`MINFEATURESIZE  <mapfile-label-minfeaturesize>`
1525
  */
1526
  int minfeaturesize;
1527
  int autominfeaturesize; ///< :data:`MS_TRUE` or :data:`MS_FALSE`
1528
1529
  double
1530
      minscaledenom; ///< See :ref:`MINSCALEDENOM <mapfile-label-minscaledenom>`
1531
  double
1532
      maxscaledenom; ///< See :ref:`MAXSCALEDENOM <mapfile-label-maxscaledenom>`
1533
1534
  int mindistance;    ///< Minimum distance in pixels between duplicate labels -
1535
                      ///< see :ref:`MINDISTANCE <mapfile-label-mindistance>`
1536
  int repeatdistance; ///< See :ref:`REPEATDISTANCE
1537
                      ///< <mapfile-label-repeatdistance>`
1538
  double maxoverlapangle; ///< See :ref:`MAXOVERLAPANGLE
1539
                          ///< <mapfile-label-maxoverlapangle>`
1540
1541
  /**
1542
  Indicates if labels can run off the edge of an image, either :data:`MS_TRUE`
1543
  or :data:`MS_FALSE` (default) - see :ref:`PARTIALS <mapfile-label-partials>`
1544
  */
1545
  int partials;
1546
1547
  int force; ///< Indicates if labels **must** be drawn - see :ref:`FORCE
1548
             ///< <mapfile-label-force>`
1549
1550
  char *encoding; ///< Supported encoding format to be used for labels - see
1551
                  ///< :ref:`ENCODING <mapfile-label-encoding>`
1552
1553
  int priority;  ///< Priority level 1 to :data:`MS_MAX_LABEL_PRIORITY`,
1554
                 ///< default=1 - see :ref:`PRIORITY <mapfile-label-priority>`
1555
  int numstyles; ///< The number of styles associated with the label
1556
1557
  int sizeunits; ///< Supersedes class's sizeunits, defaults to
1558
                 ///< :data:`MS_INHERIT`.
1559
1560
#ifndef SWIG
1561
  styleObj **styles;
1562
  int maxstyles;
1563
1564
  expressionObj expression;
1565
  expressionObj text;
1566
1567
  labelLeaderObj *leader;
1568
1569
  attributeBindingObj bindings[MS_LABEL_BINDING_LENGTH];
1570
  int numbindings;
1571
  expressionObj exprBindings[MS_LABEL_BINDING_LENGTH];
1572
  int nexprbindings;
1573
1574
  double scalefactor; // computed, not set
1575
#endif                /* not SWIG */
1576
};
1577
1578
#ifdef SWIG
1579
#ifdef __cplusplus
1580
extern "C" {
1581
#endif
1582
typedef struct labelObj labelObj;
1583
#ifdef __cplusplus
1584
}
1585
#endif
1586
#endif
1587
1588
#ifndef SWIG
1589
/* lightweight structure containing information to render a labelObj */
1590
typedef struct {
1591
  lineObj *poly;
1592
  rectObj bbox;
1593
} label_bounds;
1594
1595
typedef struct {
1596
  labelObj *label;
1597
  char *annotext;
1598
  double scalefactor, resolutionfactor;
1599
  pointObj annopoint;
1600
  double rotation;
1601
  textPathObj *textpath;
1602
  // rectObj bbox;
1603
  label_bounds **style_bounds;
1604
} textSymbolObj;
1605
#endif
1606
1607
0
#define MS_LABEL_PERPENDICULAR_OFFSET -99
1608
0
#define MS_LABEL_PERPENDICULAR_TOP_OFFSET 99
1609
#define IS_PERPENDICULAR_OFFSET(offsety)                                       \
1610
0
  ((offsety) == MS_LABEL_PERPENDICULAR_OFFSET ||                               \
1611
0
   (offsety) == MS_LABEL_PERPENDICULAR_TOP_OFFSET)
1612
1613
/************************************************************************/
1614
/*                          classObj                                    */
1615
/************************************************************************/
1616
1617
/**
1618
 * The :ref:`CLASS <class>` object. Used for symbolization and classification
1619
 * information.
1620
 *
1621
 */
1622
struct classObj {
1623
1624
#ifdef SWIG
1625
    %immutable;
1626
#endif /* SWIG */
1627
1628
  hashTableObj metadata;   ///< see :ref:`METADATA <mapfile-class-metadata>`
1629
  hashTableObj validation; ///< see :ref:`VALIDATION <mapfile-class-validation>`
1630
  int numstyles;           ///< number of styles for class
1631
  int numlabels;           ///< number of labels for class
1632
  int refcount;            ///< number of references to this object
1633
  struct layerObj *layer;  ///< reference to the parent layer
1634
  labelLeaderObj *leader;  ///< see :ref:`LEADER <mapfile-class-leader>`
1635
1636
#ifdef SWIG
1637
    %mutable;
1638
#endif
1639
1640
  int status; ///< :data:`MS_ON` or :data:`MS_OFF` - draw features of this class
1641
              ///< or do not - see :ref:`STATUS <mapfile-class-status>`
1642
  int isfallback; ///< :data:`MS_TRUE` or :data:`MS_FALSE` use :data:`MS_TRUE`
1643
                  ///< if this class should be applied if and only if no other
1644
                  ///< class is applicable
1645
  char *name;  ///< See :ref:`NAME <mapfile-class-name>` should be unique within
1646
               ///< a layer
1647
  char *title; ///< See :ref:`TITLE <mapfile-class-title>`
1648
  double
1649
      minscaledenom; ///< See :ref:`MINSCALEDENOM <mapfile-class-minscaledenom>`
1650
  double
1651
      maxscaledenom; ///< See :ref:`MAXSCALEDENOM <mapfile-CLASS-maxscaledenom>`
1652
  int minfeaturesize; ///< See :ref:`MINFEATURESIZE
1653
                      ///< <mapfile-class-minfeaturesize>` minimum feature size
1654
                      ///< in pixels
1655
  int debug;          ///< :data:`MS_TRUE` or :data:`MS_FALSE` - see :ref:`DEBUG
1656
                      ///< <mapfile-class-debug>`
1657
  char *keyimage;     ///< See :ref:`KEYIMAGE <mapfile-class-keyimage>`
1658
  char *group;        ///< See :ref:`GROUP <mapfile-class-group>`
1659
  int sizeunits; ///< Supersedes layer's sizeunits and applies to all styles and
1660
                 ///< labels - see :ref:`LAYER SIZEUNITS
1661
                 ///< <mapfile-layer-sizeunits>`
1662
1663
#ifndef __cplusplus
1664
  char *template; ///< See :ref:`TEMPLATE <mapfile-class-template>`
1665
#else             /* __cplusplus */
1666
  char *_template; // keyword in cplusplus
1667
#endif            /* __cplusplus */
1668
1669
#ifndef SWIG
1670
  expressionObj text;
1671
  expressionObj expression; /* the expression to be matched */
1672
  labelObj **labels;
1673
  int maxlabels;
1674
  int maxstyles;
1675
  styleObj **styles;
1676
  double scalefactor; // computed, not set
1677
#endif                /* not SWIG */
1678
};
1679
1680
/************************************************************************/
1681
/*                         labelCacheMemberObj                          */
1682
/*                                                                      */
1683
/*      structures to implement label caching and collision             */
1684
/*      avoidance etc                                                   */
1685
/*                                                                      */
1686
/*        Note: These are scriptable, but are read only.                */
1687
/************************************************************************/
1688
1689
#ifdef SWIG
1690
  %immutable;
1691
#endif /* SWIG */
1692
/**
1693
An individual feature label. The labelCacheMemberObj class is associated with
1694
labelCacheObj.
1695
*/
1696
typedef struct {
1697
  int numtextsymbols; ///< Number of text symbols found in textsymbols
1698
  int layerindex;     ///< The index of the layer of the labelled feature
1699
  int classindex;     ///< Index of the class of the labelled feature
1700
  int status;         ///< Has this label been drawn or not?
1701
  int markerid;       ///< Corresponding marker (POINT layers only)
1702
1703
  pointObj point; ///< Label point
1704
  rectObj bbox;   ///< Bounds of the whole cachePtr. Individual text and symbol
1705
                  ///< sub bounds are found in textsymbols
1706
1707
  lineObj *leaderline; ///< Leader lineObj
1708
  rectObj *leaderbbox; ///< Leader rectObj
1709
1710
#ifndef SWIG
1711
  textSymbolObj **textsymbols;
1712
#endif
1713
1714
} labelCacheMemberObj;
1715
1716
/************************************************************************/
1717
/*                         markerCacheMemberObj                         */
1718
/************************************************************************/
1719
/**
1720
An individual marker. The markerCacheMemberObj class is associated with
1721
labelCacheObj.
1722
*/
1723
typedef struct {
1724
  int id;         ///< Corresponding label
1725
  rectObj bounds; ///< Bounds of the markerCacheMemberObj
1726
} markerCacheMemberObj;
1727
1728
/************************************************************************/
1729
/*                          labelCacheSlotObj                           */
1730
/************************************************************************/
1731
/**
1732
A cache slot to hold labels grouped by priority
1733
*/
1734
typedef struct {
1735
  int numlabels;       ///< Number of label members
1736
  int cachesize;       ///< TODO
1737
  int nummarkers;      ///< Number of marker members
1738
  int markercachesize; ///< TODO
1739
  labelCacheMemberObj *labels;
1740
  markerCacheMemberObj *markers;
1741
} labelCacheSlotObj;
1742
1743
/************************************************************************/
1744
/*                            labelCacheObj                             */
1745
/************************************************************************/
1746
/**
1747
Set of a map's cached labels. Has no other existence other than as a labelcache
1748
attribute of a mapObj. Associated with labelCacheMemberObj and
1749
markerCacheMemberObj.
1750
*/
1751
typedef struct {
1752
  int num_rendered_members; ///< Number of rendered labels
1753
#ifndef SWIG
1754
  /* One labelCacheSlotObj for each priority level */
1755
  labelCacheSlotObj slots[MS_MAX_LABEL_PRIORITY];
1756
  int gutter; /* space in pixels around the image where labels cannot be placed
1757
               */
1758
  labelCacheMemberObj **rendered_text_symbols;
1759
  int num_allocated_rendered_members;
1760
#endif
1761
} labelCacheObj;
1762
1763
/************************************************************************/
1764
/*                         resultObj                                    */
1765
/************************************************************************/
1766
/**
1767
The result object is a handle, of sorts, for a feature of the layer
1768
*/
1769
typedef struct {
1770
#ifndef SWIG
1771
  shapeObj *shape;
1772
#endif
1773
  long shapeindex; ///< The shape index of the result
1774
  int tileindex;   ///< The tile index of the result
1775
  int resultindex; ///< The index of the result
1776
  int classindex;  ///< The class index of the result
1777
} resultObj;
1778
1779
/************************************************************************/
1780
/*                            resultCacheObj                            */
1781
/************************************************************************/
1782
/**
1783
A cached result object
1784
*/
1785
typedef struct {
1786
1787
#ifndef SWIG
1788
  resultObj *results;
1789
  int cachesize;
1790
  rectObj previousBounds; /* bounds at previous iteration */
1791
#endif                    /* not SWIG */
1792
1793
#ifdef SWIG
1794
    %immutable;
1795
#endif            /* SWIG */
1796
  int numresults; ///< Length of result set
1797
  rectObj bounds; ///< Bounding box of query results
1798
1799
#ifdef SWIG
1800
    %mutable;
1801
#endif /* SWIG */
1802
} resultCacheObj;
1803
1804
/************************************************************************/
1805
/*                             symbolSetObj                             */
1806
/************************************************************************/
1807
/**
1808
A :class:`symbolSetObj` is an attribute of a :class:`mapObj` and is associated
1809
with instances of :class:`symbolObj`.
1810
*/
1811
typedef struct {
1812
#ifndef SWIG
1813
  int refcount;
1814
  symbolObj **symbol;
1815
  struct mapObj *map;
1816
  fontSetObj *fontset; /* a pointer to the main mapObj version */
1817
  struct imageCacheObj *imagecache;
1818
#endif /* not SWIG */
1819
1820
#ifdef SWIG
1821
    %immutable;
1822
#endif            /* SWIG */
1823
  int numsymbols; ///< Number of symbols in the set
1824
  int maxsymbols; ///< Maximum number of allowed symbols
1825
#ifdef SWIG
1826
    %mutable;
1827
#endif /* SWIG */
1828
1829
  char *filename;     ///< Symbolset filename
1830
  int imagecachesize; ///< Symbols in the cache
1831
1832
} symbolSetObj;
1833
1834
/************************************************************************/
1835
/*                           referenceMapObj                            */
1836
/************************************************************************/
1837
1838
/**
1839
The :ref:`REFERENCE <reference>` object
1840
*/
1841
typedef struct {
1842
#ifdef SWIG
1843
      %immutable;
1844
#endif                /* SWIG */
1845
  struct mapObj *map; ///< Reference to parent :class:`mapObj`
1846
#ifdef SWIG
1847
      %mutable;
1848
#endif            /* SWIG */
1849
  rectObj extent; ///< Spatial extent of reference in units of parent map - see
1850
                  ///< :ref:`EXTENT <mapfile-reference-extent>`
1851
  int height;     ///< Height of reference map in pixels - see :ref:`SIZE
1852
                  ///< <mapfile-reference-size>`
1853
  int width;      ///< Width of reference map in pixels - see :ref:`SIZE
1854
                  ///< <mapfile-reference-size>`
1855
  colorObj color; ///< Color of reference box - see :ref:`COLOR
1856
                  ///< <mapfile-reference-color>`
1857
  colorObj
1858
      outlinecolor; ///< Outline color of reference box - see :ref:`OUTLINECOLOR
1859
                    ///< <mapfile-reference-outlinecolor>`
1860
  char *image;      ///< Filename of reference map image - see :ref:`IMAGE
1861
                    ///< <mapfile-reference-image>`
1862
  int status;       ///< :data:`MS_ON` or :data:`MS_OFF` - see :ref:`STATUS
1863
                    ///< <mapfile-reference-status>`
1864
  int marker; ///< Index of a symbol in the map symbol set to use for marker -
1865
              ///< see :ref:`MARKER <mapfile-reference-marker>`
1866
  char *markername; ///< Name of a symbol - see :ref:`MARKER
1867
                    ///< <mapfile-reference-marker>`
1868
  int markersize;   ///< Size of marker - see :ref:`MARKERSIZE
1869
                    ///< <mapfile-reference-markersize>`
1870
  int minboxsize;   ///< In pixels - see :ref:`MINBOXSIZE
1871
                    ///< <mapfile-reference-minboxsize>`
1872
  int maxboxsize;   ///< In pixels - see :ref:`MAXBOXSIZE
1873
                    ///< <mapfile-reference-maxboxsize>`
1874
} referenceMapObj;
1875
1876
/************************************************************************/
1877
/*                             scalebarObj                              */
1878
/************************************************************************/
1879
1880
0
#define MS_SCALEBAR_INTERVALS_MIN 1
1881
0
#define MS_SCALEBAR_INTERVALS_MAX 100
1882
1883
162
#define MS_SCALEBAR_WIDTH_MIN 5
1884
162
#define MS_SCALEBAR_WIDTH_MAX 1000
1885
158
#define MS_SCALEBAR_HEIGHT_MIN 2
1886
158
#define MS_SCALEBAR_HEIGHT_MAX 100
1887
1888
1
#define MS_SCALEBAR_OFFSET_MIN -50
1889
1
#define MS_SCALEBAR_OFFSET_MAX 50
1890
1891
/**
1892
The :ref:`SCALEBAR <scalebar>` object
1893
*/
1894
typedef struct {
1895
1896
  int transparent;     ///< Allows transparency for an embedded scalebar - see
1897
                       ///< :ref:`TRANSPARENT <mapfile-scalebar-transparent>`
1898
  colorObj imagecolor; ///< Background color of scalebar - see :ref:`IMAGECOLOR
1899
                       ///< <mapfile-scalebar-imagecolor>`
1900
  int height;    ///< Height in pixels - see :ref:`SIZE <mapfile-scalebar-size>`
1901
  int width;     ///< Height in pixels - see :ref:`SIZE <mapfile-scalebar-size>`
1902
  int style;     ///< 0 or 1 - see :ref:`STYLE <mapfile-scalebar-style>`
1903
  int intervals; ///< Number of intervals - see :ref:`INTERVALS
1904
                 ///< <mapfile-scalebar-intervals>`
1905
  labelObj
1906
      label; ///< Scalebar label - see :ref:`LABEL <mapfile-scalebar-label>`
1907
  colorObj color;           ///< Scalebar foreground color - see :ref:`COLOR
1908
                            ///< <mapfile-scalebar-color>`
1909
  colorObj backgroundcolor; ///< Scalebar background color - see
1910
                            ///< :ref:`BACKGROUNDCOLOR
1911
                            ///< <mapfile-scalebar-backgroundcolor>`
1912
  colorObj outlinecolor; ///< Foreground outline color - see :ref:`OUTLINECOLOR
1913
                         ///< <mapfile-scalebar-outlinecolor>`
1914
  int units;             ///< See :ref:`UNITS <mapfile-scalebar-units>`
1915
  int status;            ///< ON, OFF or EMBED - see :ref:`STATUS
1916
              ///< <mapfile-scalebar-status>` - :data:`MS_ON`, :data:`MS_OFF`,
1917
              ///< or :data:`MS_EMBED`.
1918
  int position; ///< For embedded scalebars - see :ref:`POSITION
1919
                ///< <mapfile-scalebar-position>` - :data:`MS_UL`,
1920
                ///< :data:`MS_UC`, :data:`MS_UR`, :data:`MS_LL`, :data:`MS_LC`,
1921
                ///< or :data:`MS_LR`
1922
1923
  int postlabelcache; ///< See :ref:`POSTLABELCACHE
1924
                      ///< <mapfile-scalebar-postlabelcache>` - :data:`MS_TRUE`
1925
                      ///< or :data:`MS_FALSE`
1926
  int align;          ///< See :ref:`ALIGN <mapfile-scalebar-align>`
1927
  int offsetx;        ///< See :ref:`OFFSET <mapfile-scalebar-offset>`
1928
  int offsety;        ///< See :ref:`OFFSET <mapfile-scalebar-offset>`
1929
} scalebarObj;
1930
1931
/************************************************************************/
1932
/*                              legendObj                               */
1933
/************************************************************************/
1934
1935
0
#define MS_LEGEND_KEYSIZE_MIN 5
1936
0
#define MS_LEGEND_KEYSIZE_MAX 1000
1937
0
#define MS_LEGEND_KEYSPACING_MIN 0
1938
0
#define MS_LEGEND_KEYSPACING_MAX 50
1939
1940
/**
1941
The :ref:`LEGEND <legend>` object
1942
*/
1943
typedef struct {
1944
1945
#ifdef SWIG
1946
    %immutable;
1947
#endif
1948
  labelObj label;     ///< See :ref:`LABEL <mapfile-legend-label>`
1949
  struct mapObj *map; ///< Instances of legendObj are always are always embedded
1950
                      ///< inside the mapObj
1951
#ifdef SWIG
1952
    %mutable;
1953
#endif
1954
  int transparent;     ///< Allows transparency for an embedded legend - see
1955
                       ///< :ref:`TRANSPARENT <mapfile-legend-transparent>`
1956
  colorObj imagecolor; ///< Legend background color - see :ref:`IMAGECOLOR
1957
                       ///< <mapfile-legend-imagecolor>`
1958
  int keysizex;        ///< Width in pixels of legend keys - see :ref:`KEYSIZE
1959
                       ///< <mapfile-legend-keysize>`
1960
  int keysizey;        ///< Height in pixels of legend keys - see :ref:`KEYSIZE
1961
                       ///< <mapfile-legend-keysize>`
1962
  int keyspacingx;     ///< Horizontal padding around keys in pixels - see
1963
                       ///< :ref:`KEYSPACING <mapfile-legend-keyspacing>`
1964
  int keyspacingy;     ///< Vertical padding around keys in pixels - see
1965
                       ///< :ref:`KEYSPACING <mapfile-legend-keyspacing>`
1966
  colorObj outlinecolor; ///< Key outline color, -1 for no outline - see
1967
                         ///< :ref:`OUTLINECOLOR <mapfile-legend-outlinecolor>`
1968
  int status;   ///< :data:`MS_ON`, :data:`MS_OFF` or :data:`MS_EMBED`- see
1969
                ///< :ref:`STATUS <mapfile-legend-status>`
1970
  int height;   ///< Legend height
1971
  int width;    ///< Legend width
1972
  int position; ///< Used for embedded legends, see :ref:`POSITION
1973
                ///< <mapfile-legend-position>`
1974
  int postlabelcache; ///< :data:`MS_TRUE`, :data:`MS_FALSE` - see
1975
                      ///< :ref:`POSTLABELCACHE <mapfile-legend-postlabelcache>`
1976
#ifndef __cplusplus
1977
  char *template; ///< See :ref:`TEMPLATE <mapfile-legend-template>`
1978
#else             /* __cplusplus */
1979
  char *_template;
1980
#endif            /* __cplusplus */
1981
} legendObj;
1982
1983
/************************************************************************/
1984
/*                             graticuleObj                             */
1985
/************************************************************************/
1986
#ifndef SWIG
1987
typedef struct {
1988
  double dwhichlatitude;
1989
  double dwhichlongitude;
1990
  double dstartlatitude;
1991
  double dstartlongitude;
1992
  double dendlatitude;
1993
  double dendlongitude;
1994
  double dincrementlatitude;
1995
  double dincrementlongitude;
1996
  double minarcs;
1997
  double maxarcs;
1998
  double minincrement;
1999
  double maxincrement;
2000
  double minsubdivides;
2001
  double maxsubdivides;
2002
  int bvertical;
2003
  int blabelaxes;
2004
  int ilabelstate;
2005
  int ilabeltype;
2006
  rectObj extent;
2007
  lineObj *pboundinglines;
2008
  pointObj *pboundingpoints;
2009
  char *labelformat;
2010
} graticuleObj;
2011
2012
typedef struct {
2013
  int nTop;
2014
  pointObj *pasTop;
2015
  char **papszTopLabels;
2016
  int nBottom;
2017
  pointObj *pasBottom;
2018
  char **papszBottomLabels;
2019
  int nLeft;
2020
  pointObj *pasLeft;
2021
  char **papszLeftLabels;
2022
  int nRight;
2023
  pointObj *pasRight;
2024
  char **papszRightLabels;
2025
2026
} graticuleIntersectionObj;
2027
2028
struct layerVTable;
2029
typedef struct layerVTable layerVTableObj;
2030
2031
#endif /*SWIG*/
2032
2033
/************************************************************************/
2034
/*                               imageObj                               */
2035
/************************************************************************/
2036
2037
/**
2038
 * An image object is a wrapper for images generated by MapServer.
2039
 *
2040
 */
2041
struct imageObj {
2042
#ifdef SWIG
2043
    %immutable;
2044
#endif
2045
  int width;               ///< image width in pixels
2046
  int height;              ///< image height in pixels
2047
  double resolution;       ///< image resolution in pixels per inch
2048
  double resolutionfactor; ///< resolution factor
2049
2050
  char *imagepath;         ///< if image is drawn by :func:`mapObj.draw` this is
2051
                           ///< :ref:`IMAGEPATH <mapfile-web-imagepath>`
2052
  char *imageurl;          ///< if image is drawn by :func:`mapObj.draw` this is
2053
                           ///< :ref:`IMAGEURL <mapfile-web-imageurl>`
2054
  outputFormatObj *format; ///< an :class:`outputFormatObj` representing the
2055
                           ///< output format of the image
2056
2057
#ifndef SWIG
2058
  tileCacheObj *tilecache;
2059
  int ntiles;
2060
  int size;
2061
#endif
2062
#ifdef SWIG
2063
    %mutable;
2064
#endif
2065
2066
#ifndef SWIG
2067
  union {
2068
    void *plugin;
2069
2070
    char *imagemap;
2071
    short *raw_16bit;
2072
    float *raw_float;
2073
    unsigned char *raw_byte;
2074
  } img;
2075
  ms_bitarray img_mask;
2076
  pointObj refpt;
2077
  mapObj *map;
2078
#endif
2079
};
2080
2081
/************************************************************************/
2082
/*                               layerObj                               */
2083
/*                                                                      */
2084
/*      base unit of a map.                                             */
2085
/************************************************************************/
2086
2087
/**
2088
An individual value within the :ref:`SCALETOKEN <mapfile-layer-scaletoken>`
2089
object
2090
*/
2091
typedef struct {
2092
  double minscale; ///< The minimum scale for the replacement
2093
  double maxscale; ///< The maximum scale for the replacement
2094
  char *value;     ///< The token replacement value
2095
} scaleTokenEntryObj;
2096
2097
/**
2098
The :ref:`SCALETOKEN <mapfile-layer-scaletoken>` object
2099
*/
2100
typedef struct {
2101
  char *name;    ///< The name of the token to replace in the :ref:`DATA
2102
                 ///< <mapfile-layer-data>` statement
2103
  int n_entries; ///< The number of values within the scaletoken
2104
  scaleTokenEntryObj *tokens; ///< A reference to the values
2105
} scaleTokenObj;
2106
2107
#ifndef SWIG
2108
typedef enum { SORT_ASC, SORT_DESC } sortOrderEnum;
2109
2110
typedef struct {
2111
  char *item;
2112
  sortOrderEnum sortOrder;
2113
} sortByProperties;
2114
2115
typedef struct {
2116
  int nProperties;
2117
  sortByProperties *properties;
2118
} sortByClause;
2119
2120
typedef struct {
2121
  /* The following store original members if they have been modified at runtime
2122
   * by a rfc86 scaletoken */
2123
  char *data;
2124
  char *tileitem;
2125
  char *tileindex;
2126
  char *filteritem;
2127
  char *filter;
2128
  char **processing;
2129
} originalScaleTokenStrings;
2130
#endif
2131
2132
/**
2133
The :ref:`LAYER <layer>` object
2134
*/
2135
struct layerObj {
2136
2137
#ifndef SWIG
2138
  /* RFC86 Scale-dependent token replacements */
2139
  scaleTokenObj *scaletokens;
2140
  int numscaletokens;
2141
  originalScaleTokenStrings *orig_st;
2142
  int labelitemindex;
2143
2144
  int tileitemindex;
2145
  projectionObj projection; /* projection information for the layer */
2146
  int project; /* boolean variable, do we need to project this layer or not */
2147
  reprojectionObj *reprojectorLayerToMap;
2148
  reprojectionObj *reprojectorMapToLayer;
2149
2150
  featureListNodeObjPtr features; /* linked list so we don't need a counter */
2151
  featureListNodeObjPtr currentfeature; /* pointer to the current feature */
2152
2153
  layerVTableObj *vtable;
2154
2155
  /* SDL has converted OracleSpatial, SDE, Graticules */
2156
  void *layerinfo; /* all connection types should use this generic pointer to a
2157
                      vendor specific structure */
2158
  void *wfslayerinfo; /* For WFS layers, will contain a msWFSLayerInfo struct */
2159
2160
  char **items;
2161
  void *iteminfo;       /* connection specific information necessary to retrieve
2162
                           values */
2163
  expressionObj filter; /* connection specific attribute filter */
2164
  int bandsitemindex;
2165
  int filteritemindex;
2166
  int styleitemindex;
2167
2168
  char **processing;
2169
  joinObj *joins;
2170
2171
  imageObj *maskimage;
2172
  graticuleObj *grid;
2173
  expressionObj _geomtransform;
2174
  sortByClause sortBy;
2175
2176
#endif
2177
2178
#ifndef SWIG
2179
  int classitemindex;
2180
  resultCacheObj
2181
      *resultcache;   /* holds the results of a query against this layer */
2182
  double scalefactor; /* computed, not set */
2183
#ifndef __cplusplus
2184
  classObj **class; /* always at least 1 class */
2185
#else               /* __cplusplus */
2186
  classObj **_class;
2187
#endif              /* __cplusplus */
2188
#endif              /* not SWIG */
2189
2190
#ifdef SWIG
2191
    %immutable;
2192
#endif                /* SWIG */
2193
  int refcount;       ///< reference counting, RFC24
2194
  int numclasses;     ///< Number of layer classes
2195
  int maxclasses;     ///< Used to track of the maximum number of classes - see
2196
                      ///< RFC-17
2197
  int index;          ///< Index of layer within parent map's layers array
2198
  struct mapObj *map; ///< Reference to parent map
2199
  int numitems;       ///< Number of layer feature attributes (items)
2200
  hashTableObj metadata;   ///< See :ref:`METADATA <mapfile-layer-metadata>`
2201
  hashTableObj validation; ///< See :ref:`VALIDATION <mapfile-layer-validation>`
2202
  hashTableObj bindvals;   ///< Relates to RFC59
2203
  hashTableObj connectionoptions; ///< See :ref:`CONNECTIONOPTIONS
2204
                                  ///< <mapfile-layer-connectionoptions>`
2205
2206
  clusterObj cluster; ///< See :ref:`CLUSTER <mapfile-layer-cluster>`
2207
  rectObj extent;     ///< optional limiting extent for layer features - see
2208
                      ///< :ref:`EXTENT <mapfile-layer-extent>`
2209
  int numjoins;       ///< Number of layer joins
2210
2211
  expressionObj utfdata; ///< See :ref:`UTFDATA <mapfile-layer-utfdata>`
2212
  LayerCompositer
2213
      *compositer; ///< See :ref:`COMPOSITE <mapfile-layer-composite>`
2214
2215
#ifdef SWIG
2216
    %mutable;
2217
#endif /* SWIG */
2218
2219
  char *classitem; ///< the attribute used to classify layer data - see
2220
                   ///< :ref:`CLASSITEM <mapfile-layer-classitem>`
2221
  char *header;    ///< filename to a template for result's header - see
2222
                   ///< :ref:`HEADER <mapfile-layer-header>`
2223
  char *footer;    ///< filename to a template for result's footer - see
2224
                   ///< :ref:`FOOTER <mapfile-layer-footer>`
2225
2226
#ifndef __cplusplus
2227
  char *template; ///< See :ref:`TEMPLATE <mapfile-layer-template>` - global
2228
                  ///< template, used across all classes
2229
#else             /* __cplusplus */
2230
  char *_template;
2231
#endif            /* __cplusplus */
2232
2233
  char *name;  ///< See :ref:`NAME <mapfile-layer-name>` - should be unique
2234
  char *group; ///< Name of a group of layers - see :ref:`GROUP
2235
               ///< <mapfile-layer-group>`
2236
  int status;  ///< See :ref:`STATUS <mapfile-layer-status>`:data:`MS_ON`,
2237
               ///< :data:`MS_OFF` or :data:`MS_DEFAULT`
2238
  enum MS_RENDER_MODE
2239
      rendermode; ///< :data:`MS_FIRST_MATCHING_CLASS` - default and historic
2240
                  ///< MapServer behavior, :data:`MS_ALL_MATCHING_CLASSES` - SLD
2241
                  ///< behavior
2242
  char *data; ///< Layer data definition, values depend upon connectiontype -
2243
              ///< see :ref:`DATA <mapfile-layer-data>`
2244
  enum MS_LAYER_TYPE
2245
      type; ///< the layer type - see :ref:`TYPE <mapfile-layer-type>`
2246
  enum MS_CONNECTION_TYPE
2247
      connectiontype; ///< the layer connection type - see :ref:`CONNECTIONTYPE
2248
                      ///< <mapfile-layer-connectiontype>`
2249
2250
  double tolerance;   ///< search buffer for point and line queries (in
2251
                      ///< toleranceunits) - see :ref:`TOLERANCE
2252
                      ///< <mapfile-layer-tolerance>`
2253
  int toleranceunits; ///< See :ref:`TOLERANCEUNITS
2254
                      ///< <mapfile-layer-toleranceunits>`
2255
2256
  double symbolscaledenom; ///< scale at which symbols are default size - see
2257
                           ///< :ref:`SYMBOLSCALEDENOM
2258
                           ///< <mapfile-layer-symbolscaledenom>`
2259
  double minscaledenom;    ///< Maximum scale at which layer will be drawn - see
2260
                        ///< :ref:`MINSCALEDENOM <mapfile-layer-minscaledenom>`
2261
  double maxscaledenom; ///< Minimum scale at which layer will be drawn - see
2262
                        ///< :ref:`MAXSCALEDENOM <mapfile-layer-maxscaledenom>`
2263
  int minfeaturesize;   ///< minimum feature size (in pixels) for shape
2264
  double labelminscaledenom; ///< See :ref:`LABELMINSCALEDENOM
2265
                             ///< <mapfile-layer-labelminscaledenom>`
2266
  double labelmaxscaledenom; ///< See :ref:`LABELMAXSCALEDENOM
2267
                             ///< <mapfile-layer-labelmaxscaledenom>`
2268
  double mingeowidth; ///< min map width (in map units) at which the layer
2269
                      ///< should be drawn - see :ref:`MAXGEOWIDTH
2270
                      ///< <mapfile-layer-maxgeowidth>`
2271
  double maxgeowidth; ///< max map width (in map units) at which the layer
2272
                      ///< should be drawn - see :ref:`MAXGEOWIDTH
2273
                      ///< <mapfile-layer-maxgeowidth>`
2274
2275
  int sizeunits; ///< applies to all classes - see :ref:`SIZEUNITS
2276
                 ///< <mapfile-layer-sizeunits>`
2277
2278
  int maxfeatures; ///< Maximum number of layer features that will be drawn -
2279
                   ///< see :ref:`MAXFEATURES <mapfile-layer-maxfeatures>`
2280
  int startindex;  ///< Feature start index - used for paging
2281
2282
  colorObj offsite; ///< transparent pixel value for raster images - see
2283
                    ///< :ref:`OFFSITE <mapfile-layer-offsite>`
2284
2285
  /**
2286
  :data:`MS_TRUE` (default) or :data:`MS_FALSE` whether or not layer data is to
2287
  be transformed to image units - see :ref:`TRANSFORM <mapfile-layer-transform>`
2288
  */
2289
  int transform;
2290
2291
  int labelcache;     ///< :data:`MS_ON` (default) or :data:`MS_OFF` - see
2292
                      ///< :ref:`LABELCACHE <mapfile-layer-labelcache>`
2293
  int postlabelcache; ///< :data:`MS_ON` or :data:`MS_OFF` (default) - see
2294
                      ///< :ref:`POSTLABELCACHE <mapfile-layer-postlabelcache>`
2295
2296
  char *labelitem; ///< attribute defining feature label text - see
2297
                   ///< :ref:`LABELITEM <mapfile-layer-labelitem>`
2298
  char *tileitem;  ///< attribute defining tile paths - see :ref:`TILEITEM
2299
                   ///< <mapfile-layer-tileitem>`
2300
  char *tileindex; ///< layer index file for tiling support - see
2301
                   ///< :ref:`TILEINDEX <mapfile-layer-tileindex>`
2302
  char *
2303
      tilesrs; ///< name of the attribute that contains the SRS of an individual
2304
               ///< tile - see :ref:`TILESRS <mapfile-layer-tilesrs>`
2305
  int units;   ///< units of the layer - see :ref:`UNITS <mapfile-layer-units>`
2306
2307
  char *connection;     ///< layer connection or data source name - see
2308
                        ///< :ref:`CONNECTION <mapfile-layer-connection>`
2309
  char *plugin_library; ///< Used to select the library to load by MapServer
2310
  char *plugin_library_original; ///< this is needed for Mapfile writing
2311
2312
  /**
2313
  The attribute from the index file used to select the source raster band(s) to
2314
  be used - normally NULL for default bands processing
2315
  */
2316
  char *bandsitem;
2317
2318
  char *filteritem; ///< Attribute defining filter - see :ref:`FILTERITEM
2319
                    ///< <mapfile-layer-filteritem>`
2320
  char *styleitem;  ///< item to be used for style lookup - can also be 'AUTO' -
2321
                    ///< see :ref:`STYLEITEM <mapfile-layer-styleitem>`
2322
2323
#ifndef __cplusplus
2324
  char *
2325
    requires; ///< Context expressions, simple enough to not use expressionObj -
2326
              ///< see :ref:`REQUIRES <mapfile-layer-requires>`
2327
#else
2328
  char *_requires;
2329
#endif
2330
  char *labelrequires; ///< Simple logical expression - see :ref:`LABELREQUIRES
2331
                       ///< <mapfile-layer-labelrequires>`
2332
2333
  int debug; ///< Enable debugging of layer-  :data:`MS_ON` or :data:`MS_OFF`
2334
             ///< (default) - see :ref:`DEBUG <mapfile-layer-debug>`
2335
  char *classgroup; ///< See :ref:`CLASSGROUP <mapfile-layer-classgroup>`
2336
  char *mask;       ///< See :ref:`MASK <mapfile-layer-mask>`
2337
  char *encoding; ///< For iconving shape attributes, ignored if NULL or "utf-8"
2338
                  ///< - see :ref:`ENCODING <mapfile-layer-encoding>`
2339
2340
  /* RFC93 UTFGrid support */
2341
  char *utfitem;    ///< See :ref:`UTFITEM <mapfile-layer-utfitem>`
2342
  int utfitemindex; ///< See :ref:`CLASSITEM <mapfile-layer-classitem>`
2343
};
2344
2345
#ifndef SWIG
2346
void msFontCacheSetup();
2347
void msFontCacheCleanup();
2348
2349
typedef struct {
2350
  double minx, miny, maxx, maxy, advance;
2351
} glyph_metrics;
2352
2353
typedef struct {
2354
  glyph_element *glyph;
2355
  face_element *face;
2356
  pointObj pnt;
2357
  double rot;
2358
} glyphObj;
2359
2360
struct textPathObj {
2361
  int numglyphs;
2362
  int numlines;
2363
  int line_height;
2364
  int glyph_size;
2365
  int absolute; /* are the glyph positions absolutely placed, or relative to the
2366
                   origin */
2367
  glyphObj *glyphs;
2368
  label_bounds bounds;
2369
};
2370
2371
typedef enum {
2372
  duplicate_never,
2373
  duplicate_always,
2374
  duplicate_if_needed
2375
} label_cache_mode;
2376
2377
void initTextPath(textPathObj *tp);
2378
int WARN_UNUSED msComputeTextPath(mapObj *map, textSymbolObj *ts);
2379
void msCopyTextPath(textPathObj *dst, textPathObj *src);
2380
void freeTextPath(textPathObj *tp);
2381
void initTextSymbol(textSymbolObj *ts);
2382
void freeTextSymbol(textSymbolObj *ts);
2383
void freeTextSymbolEx(textSymbolObj *ts, int doFreeLabel);
2384
void copyLabelBounds(label_bounds *dst, label_bounds *src);
2385
void msCopyTextSymbol(textSymbolObj *dst, textSymbolObj *src);
2386
void msPopulateTextSymbolForLabelAndString(textSymbolObj *ts, labelObj *l,
2387
                                           char *string, double scalefactor,
2388
                                           double resolutionfactor,
2389
                                           label_cache_mode cache);
2390
#endif /* SWIG */
2391
2392
/************************************************************************/
2393
/*                                mapObj                                */
2394
/*                                                                      */
2395
/*      encompasses everything used in an Internet mapping              */
2396
/*      application.                                                    */
2397
/************************************************************************/
2398
2399
1
#define MS_RESOLUTION_MAX 1000 /* applies to resolution and defresolution */
2400
1
#define MS_RESOLUTION_MIN 10
2401
2402
/**
2403
The :ref:`MAP <map>` object
2404
*/
2405
struct mapObj { /* structure for a map */
2406
2407
#ifndef SWIG
2408
  layerObj **layers;
2409
  geotransformObj gt; /* rotation / geotransform */
2410
  rectObj saved_extent;
2411
  paletteObj palette; /* holds a map palette */
2412
  outputFormatObj **outputformatlist;
2413
  projectionObj projection; /* projection information for output map */
2414
  projectionObj latlon;     /* geographic projection definition */
2415
2416
  /* Private encryption key information - see mapcrypto.c */
2417
  int encryption_key_loaded; /* MS_TRUE once key has been loaded */
2418
  unsigned char
2419
      encryption_key[MS_ENCRYPTION_KEY_SIZE]; /* 128bits encryption key */
2420
  queryObj query;
2421
  projectionContext *projContext;
2422
2423
#endif /* SWIG */
2424
2425
#ifdef SWIG
2426
      %immutable;
2427
#endif           /* SWIG */
2428
  int refcount;  ///< Used for reference counting see RFC24
2429
  int numlayers; ///< Number of layers in mapfile
2430
  int maxlayers; ///< Allocated size of layers[] array
2431
2432
  /**
2433
  A hash table of configuration options from CONFIG keywords
2434
  in the map - see :ref:`CONFIG <mapfile-map-config>`
2435
  */
2436
  hashTableObj configoptions;
2437
2438
  symbolSetObj symbolset; ///< See :ref:`SYMBOLSET <mapfile-map-symbolset>`
2439
  fontSetObj fontset;     ///< See :ref:`FONTSET <mapfile-map-fontset>`
2440
2441
  labelCacheObj labelcache; ///< We need this here so multiple feature
2442
                            ///< processors can access it
2443
  int numoutputformats;     ///< Number of output formats available in the map
2444
  outputFormatObj
2445
      *outputformat; ///< See :ref:`OUTPUTFORMAT <mapfile-map-outputformat>`
2446
  char *imagetype;   ///< Name of current outputformat
2447
2448
  referenceMapObj reference; ///< See :ref:`SCALEBAR <mapfile-map-scalebar>`
2449
  scalebarObj scalebar;      ///< See :ref:`SCALEBAR <mapfile-map-scalebar>`
2450
  legendObj legend;          ///< See :ref:`LEGEND <mapfile-map-legend>`
2451
  queryMapObj querymap;      ///< See :ref:`QUERYMAP <mapfile-map-querymap>`
2452
  webObj web;                ///< See :ref:`WEB <mapfile-map-web>`
2453
2454
  const configObj *config;
2455
#ifdef SWIG
2456
    %mutable;
2457
#endif /* SWIG */
2458
2459
  char *datapattern; ///< TODO - Deprecated use VALIDATION ... END block instead
2460
  char *templatepattern; ///< TODO - Deprecated use VALIDATION ... END block
2461
                         ///< instead
2462
2463
  char *name;  ///< Small identifier for naming etc - see :ref:`NAME
2464
               ///< <mapfile-map-name>`
2465
  int status;  ///< Is map creation on or off - see :ref:`STATUS
2466
               ///< <mapfile-map-status>`
2467
  int height;  ///< See :ref:`SIZE <mapfile-map-size>`
2468
  int width;   ///< See :ref:`SIZE <mapfile-map-size>`
2469
  int maxsize; ///< See :ref:`MAXSIZE  <mapfile-map-maxsize>`
2470
2471
  rectObj extent; ///< Map extent array - see :ref:`EXTENT <mapfile-map-extent>`
2472
  double cellsize; ///< Pixel size in map units
2473
2474
  enum MS_UNITS
2475
      units; ///< Units of the projection - see :ref:`UNITS <mapfile-map-units>`
2476
  double scaledenom; ///< The nominal map scale, a value of 25000 means 1:25000
2477
                     ///< scale - see :ref:`SCALEDENOM <mapfile-map-scaledenom>`
2478
  double resolution; ///< See :ref:`RESOLUTION <mapfile-map-resolution>`
2479
  double defresolution; ///< Default resolution - used to calculate the
2480
                        ///< scalefactor, see :ref:`DEFRESOLUTION
2481
                        ///< <mapfile-map-defresolution>`
2482
2483
  char *shapepath; ///< Where are the shape files located - see :ref:`SHAPEPATH
2484
                   ///< <mapfile-map-shapepath>`
2485
  char *mappath;   ///< Path of the mapfile, all paths are relative to this path
2486
2487
  /**
2488
  URL of SLD document as specified with "&SLD=..." WMS parameter d- currently
2489
  this reference is used only in mapogcsld.c and has a NULL value outside that
2490
  context
2491
  */
2492
  char *sldurl;
2493
2494
  colorObj imagecolor; ///< Holds the initial image color value - see
2495
                       ///< :ref:`IMAGECOLOR <mapfile-map-imagecolor>`
2496
2497
  int *layerorder; ///< Used to modify the order in which the layers are drawn -
2498
                   ///< TODO should be immutable?
2499
  int debug;       ///< See :ref:`DEBUG <mapfile-map-debug>`
2500
2501
#ifdef USE_V8_MAPSCRIPT
2502
  void *v8context;
2503
#endif
2504
};
2505
2506
/************************************************************************/
2507
/*                             layerVTable                              */
2508
/*                                                                      */
2509
/*      contains function pointers to the layer operations.  If you     */
2510
/*      add new functions to here, remember to update                   */
2511
/*      populateVirtualTable in maplayer.c                              */
2512
/************************************************************************/
2513
#ifndef SWIG
2514
struct layerVTable {
2515
  int (*LayerTranslateFilter)(layerObj *layer, expressionObj *filter,
2516
                              char *filteritem);
2517
  int (*LayerSupportsCommonFilters)(layerObj *layer);
2518
  int (*LayerInitItemInfo)(layerObj *layer);
2519
  void (*LayerFreeItemInfo)(layerObj *layer);
2520
  int (*LayerOpen)(layerObj *layer);
2521
  int (*LayerIsOpen)(layerObj *layer);
2522
  int (*LayerWhichShapes)(layerObj *layer, rectObj rect, int isQuery);
2523
  int (*LayerNextShape)(layerObj *layer, shapeObj *shape);
2524
  int (*LayerGetShape)(layerObj *layer, shapeObj *shape, resultObj *record);
2525
  int (*LayerGetShapeCount)(layerObj *layer, rectObj rect,
2526
                            projectionObj *rectProjection);
2527
  int (*LayerClose)(layerObj *layer);
2528
  int (*LayerGetItems)(layerObj *layer);
2529
  int (*LayerGetExtent)(layerObj *layer, rectObj *extent);
2530
  int (*LayerGetAutoStyle)(mapObj *map, layerObj *layer, classObj *c,
2531
                           shapeObj *shape);
2532
  int (*LayerCloseConnection)(layerObj *layer);
2533
  int (*LayerSetTimeFilter)(layerObj *layer, const char *timestring,
2534
                            const char *timefield);
2535
  int (*LayerApplyFilterToLayer)(FilterEncodingNode *psNode, mapObj *map,
2536
                                 int iLayerIndex);
2537
  int (*LayerCreateItems)(layerObj *layer, int nt);
2538
  int (*LayerGetNumFeatures)(layerObj *layer);
2539
  int (*LayerGetAutoProjection)(layerObj *layer, projectionObj *projection);
2540
  char *(*LayerEscapeSQLParam)(layerObj *layer, const char *pszString);
2541
  char *(*LayerEscapePropertyName)(layerObj *layer, const char *pszString);
2542
  void (*LayerEnablePaging)(layerObj *layer, int value);
2543
  int (*LayerGetPaging)(layerObj *layer);
2544
};
2545
#endif /*SWIG*/
2546
2547
/* Function prototypes, wrapable */
2548
2549
/**
2550
Saves a map image to a file
2551
*/
2552
MS_DLL_EXPORT int msSaveImage(mapObj *map, imageObj *img, const char *filename);
2553
2554
/**
2555
Generic function to free a imageObj
2556
*/
2557
MS_DLL_EXPORT void msFreeImage(imageObj *img);
2558
2559
/**
2560
Sets up threads and font cache - called when MapScript is initialized
2561
*/
2562
MS_DLL_EXPORT int msSetup(void);
2563
2564
/**
2565
Attempts to recover all dynamically allocated resources allocated by MapServer
2566
code and dependent libraries. It is used primarily for final clean-up in scripts
2567
that need to do memory leak testing to get rid of "noise" one-time allocations.
2568
It should not normally be used by production code.
2569
*/
2570
MS_DLL_EXPORT void msCleanup(void);
2571
2572
/**
2573
Sets up string-based mapfile loading and calls loadMapInternal to do the work
2574
*/
2575
MS_DLL_EXPORT mapObj *msLoadMapFromString(char *buffer, char *new_mappath,
2576
                                          const configObj *config);
2577
2578
/* Function prototypes, not wrapable */
2579
2580
#ifndef SWIG
2581
2582
/*
2583
** helper functions not part of the general API but needed in
2584
** a few other places (like mapscript)... found in mapfile.c
2585
*/
2586
int getString(char **s);
2587
int getDouble(double *d, int num_check_type, double value1,
2588
              double value2); // getDouble(double *d);
2589
int getInteger(int *i, int num_check_type, int value1,
2590
               int value2); // getInteger(int *i);
2591
int getSymbol(int n, ...);
2592
int getCharacter(char *c);
2593
2594
int msBuildPluginLibraryPath(char **dest, const char *lib_str, mapObj *map);
2595
2596
MS_DLL_EXPORT int hex2int(char *hex);
2597
2598
MS_DLL_EXPORT void initJoin(joinObj *join);
2599
MS_DLL_EXPORT void initSymbol(symbolObj *s);
2600
MS_DLL_EXPORT int initMap(mapObj *map);
2601
MS_DLL_EXPORT layerObj *msGrowMapLayers(mapObj *map);
2602
MS_DLL_EXPORT int initLayer(layerObj *layer, mapObj *map);
2603
MS_DLL_EXPORT int freeLayer(layerObj *);
2604
MS_DLL_EXPORT classObj *msGrowLayerClasses(layerObj *layer);
2605
MS_DLL_EXPORT scaleTokenObj *msGrowLayerScaletokens(layerObj *layer);
2606
MS_DLL_EXPORT int initScaleToken(scaleTokenObj *scaleToken);
2607
MS_DLL_EXPORT int initClass(classObj *_class);
2608
MS_DLL_EXPORT int freeClass(classObj *);
2609
MS_DLL_EXPORT styleObj *msGrowClassStyles(classObj *_class);
2610
MS_DLL_EXPORT labelObj *msGrowClassLabels(classObj *_class);
2611
MS_DLL_EXPORT styleObj *msGrowLabelStyles(labelObj *label);
2612
MS_DLL_EXPORT styleObj *msGrowLeaderStyles(labelLeaderObj *leader);
2613
MS_DLL_EXPORT int msMaybeAllocateClassStyle(classObj *c, int idx);
2614
MS_DLL_EXPORT void initLabel(labelObj *label);
2615
MS_DLL_EXPORT int freeLabel(labelObj *label);
2616
MS_DLL_EXPORT int freeLabelLeader(labelLeaderObj *leader);
2617
MS_DLL_EXPORT void resetClassStyle(classObj *_class);
2618
MS_DLL_EXPORT int initStyle(styleObj *style);
2619
MS_DLL_EXPORT int freeStyle(styleObj *style);
2620
MS_DLL_EXPORT void initReferenceMap(referenceMapObj *ref);
2621
MS_DLL_EXPORT void initScalebar(scalebarObj *scalebar);
2622
MS_DLL_EXPORT void initGrid(graticuleObj *pGraticule);
2623
MS_DLL_EXPORT void initWeb(webObj *web);
2624
MS_DLL_EXPORT void freeWeb(webObj *web);
2625
MS_DLL_EXPORT void initResultCache(resultCacheObj *resultcache);
2626
void cleanupResultCache(resultCacheObj *resultcache);
2627
MS_DLL_EXPORT int initLayerCompositer(LayerCompositer *compositer);
2628
MS_DLL_EXPORT void initLeader(labelLeaderObj *leader);
2629
MS_DLL_EXPORT void freeGrid(graticuleObj *pGraticule);
2630
int loadHashTable(hashTableObj *ptable); // used by other file loading code
2631
2632
MS_DLL_EXPORT featureListNodeObjPtr
2633
insertFeatureList(featureListNodeObjPtr *list, shapeObj *shape);
2634
MS_DLL_EXPORT void freeFeatureList(featureListNodeObjPtr list);
2635
2636
/* To be used *only* within the mapfile loading phase */
2637
MS_DLL_EXPORT int loadExpressionString(expressionObj *exp, const char *value);
2638
/* Use this next, thread safe wrapper, function everywhere else */
2639
MS_DLL_EXPORT int msLoadExpressionString(expressionObj *exp, const char *value);
2640
MS_DLL_EXPORT char *msGetExpressionString(expressionObj *exp);
2641
MS_DLL_EXPORT void msInitExpression(expressionObj *exp);
2642
MS_DLL_EXPORT void msFreeExpressionTokens(expressionObj *exp);
2643
MS_DLL_EXPORT void msFreeExpression(expressionObj *exp);
2644
2645
MS_DLL_EXPORT void msApplySubstitutions(mapObj *map, char **names,
2646
                                        char **values, int npairs);
2647
MS_DLL_EXPORT void msApplyDefaultSubstitutions(mapObj *map);
2648
2649
MS_DLL_EXPORT int getClassIndex(layerObj *layer, char *str);
2650
2651
/* For maplabel */
2652
int intersectLabelPolygons(lineObj *p1, rectObj *r1, lineObj *p2, rectObj *r2);
2653
int intersectTextSymbol(textSymbolObj *ts, label_bounds *lb);
2654
pointObj get_metrics(pointObj *p, int position, textPathObj *tp, int ox, int oy,
2655
                     double rotation, int buffer, label_bounds *metrics);
2656
double dist(pointObj a, pointObj b);
2657
void fastComputeBounds(lineObj *line, rectObj *bounds);
2658
2659
/*
2660
** Main API Functions
2661
*/
2662
2663
/* mapobject.c */
2664
2665
MS_DLL_EXPORT void msFreeMap(mapObj *map);
2666
MS_DLL_EXPORT mapObj *msNewMapObj(void);
2667
MS_DLL_EXPORT const char *msGetConfigOption(mapObj *map, const char *key);
2668
MS_DLL_EXPORT int msSetConfigOption(mapObj *map, const char *key,
2669
                                    const char *value);
2670
MS_DLL_EXPORT int msTestConfigOption(mapObj *map, const char *key,
2671
                                     int default_result);
2672
MS_DLL_EXPORT void msApplyMapConfigOptions(mapObj *map);
2673
MS_DLL_EXPORT int msMapComputeGeotransform(mapObj *map);
2674
int msMapComputeGeotransformEx(mapObj *map, double resolutionX,
2675
                               double resolutionY);
2676
2677
MS_DLL_EXPORT void msMapPixelToGeoref(mapObj *map, double *x, double *y);
2678
MS_DLL_EXPORT void msMapGeorefToPixel(mapObj *map, double *x, double *y);
2679
2680
MS_DLL_EXPORT int msMapSetExtent(mapObj *map, double minx, double miny,
2681
                                 double maxx, double maxy);
2682
MS_DLL_EXPORT int msMapOffsetExtent(mapObj *map, double x, double y);
2683
MS_DLL_EXPORT int msMapScaleExtent(mapObj *map, double zoomfactor,
2684
                                   double minscaledenom, double maxscaledenom);
2685
MS_DLL_EXPORT int msMapSetCenter(mapObj *map, pointObj *center);
2686
MS_DLL_EXPORT int msMapSetRotation(mapObj *map, double rotation_angle);
2687
MS_DLL_EXPORT int msMapSetSize(mapObj *map, int width, int height);
2688
MS_DLL_EXPORT int msMapSetSize(mapObj *map, int width, int height);
2689
MS_DLL_EXPORT int msMapSetFakedExtent(mapObj *map);
2690
MS_DLL_EXPORT int msMapRestoreRealExtent(mapObj *map);
2691
MS_DLL_EXPORT int msMapLoadOWSParameters(mapObj *map, cgiRequestObj *request,
2692
                                         const char *wmtver_string);
2693
MS_DLL_EXPORT int msMapIgnoreMissingData(mapObj *map);
2694
2695
/* mapfile.c */
2696
2697
MS_DLL_EXPORT int msValidateParameter(const char *value, const char *pattern1,
2698
                                      const char *pattern2,
2699
                                      const char *pattern3,
2700
                                      const char *pattern4);
2701
MS_DLL_EXPORT int msGetLayerIndex(mapObj *map, const char *name);
2702
MS_DLL_EXPORT int msGetSymbolIndex(symbolSetObj *set, const char *name,
2703
                                   int try_addimage_if_notfound);
2704
MS_DLL_EXPORT mapObj *msLoadMap(const char *filename, const char *new_mappath,
2705
                                const configObj *config);
2706
MS_DLL_EXPORT int msTransformXmlMapfile(const char *stylesheet,
2707
                                        const char *xmlMapfile, FILE *tmpfile);
2708
MS_DLL_EXPORT int msSaveMap(mapObj *map, char *filename);
2709
MS_DLL_EXPORT int msSaveConfig(configObj *map, const char *filename);
2710
MS_DLL_EXPORT void msFreeCharArray(char **array, int num_items);
2711
MS_DLL_EXPORT int msUpdateScalebarFromString(scalebarObj *scalebar,
2712
                                             char *string);
2713
MS_DLL_EXPORT int msUpdateQueryMapFromString(queryMapObj *querymap,
2714
                                             char *string);
2715
MS_DLL_EXPORT int msUpdateLabelFromString(labelObj *label, char *string);
2716
MS_DLL_EXPORT int msUpdateClusterFromString(clusterObj *cluster, char *string);
2717
MS_DLL_EXPORT int msUpdateReferenceMapFromString(referenceMapObj *ref,
2718
                                                 char *string);
2719
MS_DLL_EXPORT int msUpdateLegendFromString(legendObj *legend, char *string);
2720
MS_DLL_EXPORT int msUpdateWebFromString(webObj *web, char *string);
2721
MS_DLL_EXPORT int msUpdateStyleFromString(styleObj *style, char *string);
2722
MS_DLL_EXPORT int msUpdateClassFromString(classObj *_class, char *string);
2723
MS_DLL_EXPORT int msUpdateLayerFromString(layerObj *layer, char *string);
2724
MS_DLL_EXPORT char *msWriteLayerToString(layerObj *layer);
2725
MS_DLL_EXPORT char *msWriteMapToString(mapObj *map);
2726
MS_DLL_EXPORT char *msWriteClassToString(classObj *_class);
2727
MS_DLL_EXPORT char *msWriteStyleToString(styleObj *style);
2728
MS_DLL_EXPORT char *msWriteLabelToString(labelObj *label);
2729
MS_DLL_EXPORT char *msWriteWebToString(webObj *web);
2730
MS_DLL_EXPORT char *msWriteScalebarToString(scalebarObj *scalebar);
2731
MS_DLL_EXPORT char *msWriteQueryMapToString(queryMapObj *querymap);
2732
MS_DLL_EXPORT char *msWriteReferenceMapToString(referenceMapObj *ref);
2733
MS_DLL_EXPORT char *msWriteLegendToString(legendObj *legend);
2734
MS_DLL_EXPORT char *msWriteClusterToString(clusterObj *cluster);
2735
MS_DLL_EXPORT int msIsValidRegex(const char *e);
2736
MS_DLL_EXPORT int msEvalRegex(const char *e, const char *s);
2737
MS_DLL_EXPORT int msCaseEvalRegex(const char *e, const char *s);
2738
#ifdef USE_MSFREE
2739
MS_DLL_EXPORT void msFree(void *p);
2740
#else
2741
5.36M
#define msFree free
2742
#endif
2743
void msReplaceFreeableStr(char **ppszStr, char *pszNewStr);
2744
MS_DLL_EXPORT char **msTokenizeMap(char *filename, int *numtokens);
2745
MS_DLL_EXPORT int msInitLabelCache(labelCacheObj *cache);
2746
MS_DLL_EXPORT int msFreeLabelCache(labelCacheObj *cache);
2747
MS_DLL_EXPORT int msCheckConnection(
2748
    layerObj *layer); /* connection pooling functions (mapfile.c) */
2749
MS_DLL_EXPORT void msCloseConnections(mapObj *map);
2750
2751
MS_DLL_EXPORT void msOGRInitialize(void);
2752
MS_DLL_EXPORT void msOGRCleanup(void);
2753
MS_DLL_EXPORT void msGDALCleanup(void);
2754
MS_DLL_EXPORT void msGDALInitialize(void);
2755
2756
MS_DLL_EXPORT imageObj *msDrawScalebar(mapObj *map); /* in mapscale.c */
2757
MS_DLL_EXPORT int msCalculateScale(rectObj extent, int units, int width,
2758
                                   int height, double resolution,
2759
                                   double *scaledenom);
2760
MS_DLL_EXPORT double GetDeltaExtentsUsingScale(double scale, int units,
2761
                                               double centerLat, int width,
2762
                                               double resolution);
2763
MS_DLL_EXPORT double Pix2Georef(int nPixPos, int nPixMin, int nPixMax,
2764
                                double dfGeoMin, double dfGeoMax,
2765
                                int bULisYOrig);
2766
MS_DLL_EXPORT double Pix2LayerGeoref(mapObj *map, layerObj *layer, int value);
2767
MS_DLL_EXPORT double msInchesPerUnit(int units, double center_lat);
2768
MS_DLL_EXPORT int msEmbedScalebar(mapObj *map, imageObj *img);
2769
2770
MS_DLL_EXPORT int msPointInRect(const pointObj *p,
2771
                                const rectObj *rect); /* in mapsearch.c */
2772
MS_DLL_EXPORT int msRectOverlap(const rectObj *a, const rectObj *b);
2773
MS_DLL_EXPORT int msRectContained(const rectObj *a, const rectObj *b);
2774
MS_DLL_EXPORT int msRectIntersect(rectObj *a, const rectObj *b);
2775
2776
MS_DLL_EXPORT void msRectToFormattedString(rectObj *rect, char *format,
2777
                                           char *buffer, int buffer_length);
2778
MS_DLL_EXPORT void msPointToFormattedString(pointObj *point, const char *format,
2779
                                            char *buffer, int buffer_length);
2780
MS_DLL_EXPORT int msIsDegenerateShape(shapeObj *shape);
2781
2782
MS_DLL_EXPORT void msMergeRect(rectObj *a, rectObj *b);
2783
MS_DLL_EXPORT double msDistancePointToPoint(pointObj *a, pointObj *b);
2784
MS_DLL_EXPORT double msSquareDistancePointToPoint(pointObj *a, pointObj *b);
2785
MS_DLL_EXPORT double msDistancePointToSegment(pointObj *p, pointObj *a,
2786
                                              pointObj *b);
2787
MS_DLL_EXPORT double msSquareDistancePointToSegment(pointObj *p, pointObj *a,
2788
                                                    pointObj *b);
2789
MS_DLL_EXPORT double msDistancePointToShape(pointObj *p, shapeObj *shape);
2790
MS_DLL_EXPORT double msSquareDistancePointToShape(pointObj *p, shapeObj *shape);
2791
MS_DLL_EXPORT double msDistanceSegmentToSegment(pointObj *pa, pointObj *pb,
2792
                                                pointObj *pc, pointObj *pd);
2793
MS_DLL_EXPORT double msDistanceShapeToShape(shapeObj *shape1, shapeObj *shape2);
2794
MS_DLL_EXPORT int msIntersectSegments(const pointObj *a, const pointObj *b,
2795
                                      const pointObj *c, const pointObj *d);
2796
MS_DLL_EXPORT int msPointInPolygon(pointObj *p, lineObj *c);
2797
MS_DLL_EXPORT int msIntersectMultipointPolygon(shapeObj *multipoint,
2798
                                               shapeObj *polygon);
2799
MS_DLL_EXPORT int msIntersectPointPolygon(pointObj *p, shapeObj *polygon);
2800
MS_DLL_EXPORT int msIntersectPolylinePolygon(shapeObj *line, shapeObj *poly);
2801
MS_DLL_EXPORT int msIntersectPolygons(shapeObj *p1, shapeObj *p2);
2802
MS_DLL_EXPORT int msIntersectPolylines(shapeObj *line1, shapeObj *line2);
2803
2804
MS_DLL_EXPORT int msInitQuery(queryObj *query); /* in mapquery.c */
2805
MS_DLL_EXPORT void msFreeQuery(queryObj *query);
2806
MS_DLL_EXPORT int msSaveQuery(mapObj *map, char *filename, int results);
2807
MS_DLL_EXPORT int msLoadQuery(mapObj *map, char *filename);
2808
MS_DLL_EXPORT int msExecuteQuery(mapObj *map);
2809
2810
MS_DLL_EXPORT int
2811
msQueryByIndex(mapObj *map); /* various query methods, all rely on the queryObj
2812
                                hung off the mapObj */
2813
MS_DLL_EXPORT int msQueryByAttributes(mapObj *map);
2814
MS_DLL_EXPORT int msQueryByPoint(mapObj *map);
2815
MS_DLL_EXPORT int msQueryByRect(mapObj *map);
2816
MS_DLL_EXPORT int msQueryByFeatures(mapObj *map);
2817
MS_DLL_EXPORT int msQueryByShape(mapObj *map);
2818
MS_DLL_EXPORT int msQueryByFilter(mapObj *map);
2819
2820
MS_DLL_EXPORT int msGetQueryResultBounds(mapObj *map, rectObj *bounds);
2821
MS_DLL_EXPORT int msIsLayerQueryable(layerObj *lp);
2822
MS_DLL_EXPORT void msQueryFree(mapObj *map, int qlayer); /* todo: rename */
2823
MS_DLL_EXPORT int msRasterQueryByShape(mapObj *map, layerObj *layer,
2824
                                       shapeObj *selectshape);
2825
MS_DLL_EXPORT int msRasterQueryByRect(mapObj *map, layerObj *layer,
2826
                                      rectObj queryRect);
2827
MS_DLL_EXPORT int msRasterQueryByPoint(mapObj *map, layerObj *layer, int mode,
2828
                                       pointObj p, double buffer,
2829
                                       int maxresults);
2830
2831
/* in mapstring.c */
2832
MS_DLL_EXPORT void msStringTrim(char *str);
2833
MS_DLL_EXPORT void msStringTrimBlanks(char *string);
2834
MS_DLL_EXPORT char *msStringTrimLeft(char *string);
2835
MS_DLL_EXPORT char *msStringChop(char *string);
2836
MS_DLL_EXPORT void msStringTrimEOL(char *string);
2837
MS_DLL_EXPORT char *msReplaceSubstring(char *str, const char *old,
2838
                                       const char *sznew);
2839
MS_DLL_EXPORT void msReplaceChar(char *str, char old, char sznew);
2840
MS_DLL_EXPORT char *msCaseReplaceSubstring(char *str, const char *old,
2841
                                           const char *sznew);
2842
MS_DLL_EXPORT char *msStripPath(char *fn);
2843
MS_DLL_EXPORT char *msGetPath(const char *fn);
2844
MS_DLL_EXPORT char *msBuildPath(char *pszReturnPath, const char *abs_path,
2845
                                const char *path);
2846
MS_DLL_EXPORT char *msBuildPath3(char *pszReturnPath, const char *abs_path,
2847
                                 const char *path1, const char *path2);
2848
MS_DLL_EXPORT char *msTryBuildPath(char *szReturnPath, const char *abs_path,
2849
                                   const char *path);
2850
MS_DLL_EXPORT char *msTryBuildPath3(char *szReturnPath, const char *abs_path,
2851
                                    const char *path1, const char *path2);
2852
MS_DLL_EXPORT char **msStringSplit(const char *string, char cd,
2853
                                   int *num_tokens);
2854
MS_DLL_EXPORT char **msStringSplitComplex(const char *pszString,
2855
                                          const char *pszDelimiters,
2856
                                          int *num_tokens, int nFlags);
2857
MS_DLL_EXPORT int msStringArrayContains(char **array, const char *element,
2858
                                        int numElements);
2859
MS_DLL_EXPORT char **msStringTokenize(const char *pszLine, const char *pszDelim,
2860
                                      int *num_tokens, int preserve_quote);
2861
MS_DLL_EXPORT int msCountChars(char *str, char ch);
2862
MS_DLL_EXPORT char *msLongToString(long value);
2863
MS_DLL_EXPORT char *msDoubleToString(double value, int force_f);
2864
MS_DLL_EXPORT char *msIntToString(int value);
2865
MS_DLL_EXPORT void msStringToUpper(char *string);
2866
MS_DLL_EXPORT void msStringToLower(char *string);
2867
MS_DLL_EXPORT void msStringInitCap(char *string);
2868
MS_DLL_EXPORT void msStringFirstCap(char *string);
2869
MS_DLL_EXPORT int msEncodeChar(const char);
2870
MS_DLL_EXPORT char *msEncodeUrlExcept(const char *, const char);
2871
MS_DLL_EXPORT char *msEncodeUrl(const char *);
2872
MS_DLL_EXPORT char *msEscapeJSonString(const char *pszJSonString);
2873
MS_DLL_EXPORT char *msEncodeHTMLEntities(const char *string);
2874
MS_DLL_EXPORT void msDecodeHTMLEntities(const char *string);
2875
MS_DLL_EXPORT int msIsXMLTagValid(const char *string);
2876
MS_DLL_EXPORT char *msStringConcatenate(char *pszDest, const char *pszSrc);
2877
MS_DLL_EXPORT char *msJoinStrings(char **array, int arrayLength,
2878
                                  const char *delimiter);
2879
MS_DLL_EXPORT char *msHashString(const char *pszStr);
2880
MS_DLL_EXPORT char *msCommifyString(char *str);
2881
MS_DLL_EXPORT char *msToString(const char *format, double value);
2882
MS_DLL_EXPORT int msHexToInt(char *hex);
2883
MS_DLL_EXPORT char *msGetEncodedString(const char *string,
2884
                                       const char *encoding);
2885
MS_DLL_EXPORT char *msConvertWideStringToUTF8(const wchar_t *string,
2886
                                              const char *encoding);
2887
MS_DLL_EXPORT wchar_t *msConvertWideStringFromUTF8(const char *string,
2888
                                                   const char *encoding);
2889
MS_DLL_EXPORT int msGetNextGlyph(const char **in_ptr, char *out_string);
2890
MS_DLL_EXPORT int msGetNumGlyphs(const char *in_ptr);
2891
MS_DLL_EXPORT int msGetUnicodeEntity(const char *inptr, unsigned int *unicode);
2892
MS_DLL_EXPORT int msStringIsInteger(const char *string);
2893
MS_DLL_EXPORT int msUTF8ToUniChar(const char *str,
2894
                                  unsigned int *chPtr); /* maptclutf.c */
2895
MS_DLL_EXPORT char *msStringEscape(const char *pszString);
2896
MS_DLL_EXPORT int msStringInArray(const char *pszString, char **array,
2897
                                  int numelements);
2898
2899
typedef struct msStringBuffer msStringBuffer;
2900
MS_DLL_EXPORT msStringBuffer *msStringBufferAlloc(void);
2901
MS_DLL_EXPORT void msStringBufferFree(msStringBuffer *sb);
2902
MS_DLL_EXPORT const char *msStringBufferGetString(msStringBuffer *sb);
2903
MS_DLL_EXPORT char *msStringBufferReleaseStringAndFree(msStringBuffer *sb);
2904
MS_DLL_EXPORT int msStringBufferAppend(msStringBuffer *sb,
2905
                                       const char *pszAppendedString);
2906
2907
MS_DLL_EXPORT int msStringToInt(const char *str, int *value, int base);
2908
MS_DLL_EXPORT int msStringToDouble(const char *str, double *value);
2909
2910
#ifdef __cplusplus
2911
}
2912
std::string msStdStringEscape(const char *pszString);
2913
void msStringTrim(std::string &string);
2914
void msStringTrimBlanks(std::string &string);
2915
void msStringTrimLeft(std::string &string);
2916
std::vector<std::string> msStringSplit(const char *string, char cd);
2917
std::string msStringToLower(const std::string &s);
2918
bool msStringInArray(const char *pszString,
2919
                     const std::vector<std::string> &array);
2920
extern "C" {
2921
#endif
2922
2923
#ifndef HAVE_STRRSTR
2924
MS_DLL_EXPORT char *strrstr(const char *string, const char *find);
2925
#endif /* NEED_STRRSTR */
2926
2927
#ifndef HAVE_STRCASESTR
2928
MS_DLL_EXPORT char *strcasestr(const char *s, const char *find);
2929
#endif /* NEED_STRCASESTR */
2930
2931
#ifndef HAVE_STRNCASECMP
2932
MS_DLL_EXPORT int strncasecmp(const char *s1, const char *s2, size_t len);
2933
#endif /* NEED_STRNCASECMP */
2934
2935
#ifndef HAVE_STRCASECMP
2936
MS_DLL_EXPORT int strcasecmp(const char *s1, const char *s2);
2937
#endif /* NEED_STRCASECMP */
2938
2939
#ifndef HAVE_STRLCAT
2940
MS_DLL_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
2941
#endif /* NEED_STRLCAT */
2942
2943
#ifndef HAVE_STRLCPY
2944
MS_DLL_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
2945
#endif /* NEED_STRLCAT */
2946
2947
MS_DLL_EXPORT char *msStrdup(const char *pszString);
2948
2949
#include "hittest.h"
2950
2951
/* in mapsymbol.c */
2952
/* Use this function *only* with mapfile loading phase */
2953
MS_DLL_EXPORT int loadSymbolSet(symbolSetObj *symbolset, mapObj *map);
2954
/* Use this threadsafe wrapper everywhere else */
2955
MS_DLL_EXPORT int msLoadSymbolSet(symbolSetObj *symbolset, mapObj *map);
2956
MS_DLL_EXPORT int msCopySymbol(symbolObj *dst, const symbolObj *src,
2957
                               mapObj *map);
2958
MS_DLL_EXPORT int msCopySymbolSet(symbolSetObj *dst, const symbolSetObj *src,
2959
                                  mapObj *map);
2960
MS_DLL_EXPORT int msCopyHashTable(hashTableObj *dst, const hashTableObj *src);
2961
MS_DLL_EXPORT void msInitSymbolSet(symbolSetObj *symbolset);
2962
MS_DLL_EXPORT symbolObj *msGrowSymbolSet(symbolSetObj *symbolset);
2963
MS_DLL_EXPORT int msAddImageSymbol(symbolSetObj *symbolset,
2964
                                   const char *filename);
2965
MS_DLL_EXPORT int msFreeSymbolSet(symbolSetObj *symbolset);
2966
MS_DLL_EXPORT int msFreeSymbol(symbolObj *symbol);
2967
MS_DLL_EXPORT int msAddNewSymbol(mapObj *map, const char *name);
2968
MS_DLL_EXPORT int msAppendSymbol(symbolSetObj *symbolset, symbolObj *symbol);
2969
MS_DLL_EXPORT symbolObj *msRemoveSymbol(symbolSetObj *symbolset, int index);
2970
MS_DLL_EXPORT int msSaveSymbolSet(symbolSetObj *symbolset,
2971
                                  const char *filename);
2972
MS_DLL_EXPORT int msLoadImageSymbol(symbolObj *symbol, const char *filename);
2973
MS_DLL_EXPORT int msPreloadImageSymbol(rendererVTableObj *renderer,
2974
                                       symbolObj *symbol);
2975
MS_DLL_EXPORT int msPreloadSVGSymbol(symbolObj *symbol);
2976
MS_DLL_EXPORT symbolObj *msRotateSymbol(symbolObj *symbol, double angle);
2977
2978
MS_DLL_EXPORT int WARN_UNUSED msGetCharacterSize(mapObj *map, const char *font,
2979
                                                 int size,
2980
                                                 const char *character,
2981
                                                 rectObj *r);
2982
MS_DLL_EXPORT int WARN_UNUSED msGetMarkerSize(mapObj *map, styleObj *style,
2983
                                              double *width, double *height,
2984
                                              double scalefactor);
2985
/* MS_DLL_EXPORT int msGetCharacterSize(char *character, int size, char *font,
2986
 * rectObj *rect); */
2987
MS_DLL_EXPORT double msSymbolGetDefaultSize(symbolObj *s);
2988
MS_DLL_EXPORT void freeImageCache(struct imageCacheObj *ic);
2989
2990
MS_DLL_EXPORT imageObj WARN_UNUSED *
2991
msDrawLegend(mapObj *map, int scale_independent,
2992
             map_hittest *hittest); /* in maplegend.c */
2993
MS_DLL_EXPORT int WARN_UNUSED msLegendCalcSize(
2994
    mapObj *map, int scale_independent, int *size_x, int *size_y, int *alayers,
2995
    int numl_ayer, map_hittest *hittest, double resolutionfactor);
2996
MS_DLL_EXPORT int WARN_UNUSED msEmbedLegend(mapObj *map, imageObj *img);
2997
MS_DLL_EXPORT int WARN_UNUSED msDrawLegendIcon(mapObj *map, layerObj *lp,
2998
                                               classObj *myClass, int width,
2999
                                               int height, imageObj *img,
3000
                                               int dstX, int dstY,
3001
                                               int scale_independant,
3002
                                               class_hittest *hittest);
3003
MS_DLL_EXPORT imageObj WARN_UNUSED *
3004
msCreateLegendIcon(mapObj *map, layerObj *lp, classObj *myClass, int width,
3005
                   int height, int scale_independant);
3006
3007
MS_DLL_EXPORT int msLoadFontSet(fontSetObj *fontSet,
3008
                                mapObj *map); /* in maplabel.c */
3009
MS_DLL_EXPORT int msInitFontSet(fontSetObj *fontset);
3010
MS_DLL_EXPORT int msFreeFontSet(fontSetObj *fontset);
3011
3012
MS_DLL_EXPORT int WARN_UNUSED msGetTextSymbolSize(mapObj *map,
3013
                                                  textSymbolObj *ts,
3014
                                                  rectObj *r);
3015
MS_DLL_EXPORT int WARN_UNUSED msGetStringSize(mapObj *map, labelObj *label,
3016
                                              int size, char *string,
3017
                                              rectObj *r);
3018
3019
MS_DLL_EXPORT int WARN_UNUSED msAddLabel(mapObj *map, imageObj *image,
3020
                                         labelObj *label, int layerindex,
3021
                                         int classindex, shapeObj *shape,
3022
                                         pointObj *point, double featuresize,
3023
                                         textSymbolObj *ts);
3024
MS_DLL_EXPORT int WARN_UNUSED msAddLabelGroup(mapObj *map, imageObj *image,
3025
                                              layerObj *layer, int classindex,
3026
                                              shapeObj *shape, pointObj *point,
3027
                                              double featuresize);
3028
MS_DLL_EXPORT void insertRenderedLabelMember(mapObj *map,
3029
                                             labelCacheMemberObj *cachePtr);
3030
MS_DLL_EXPORT int msTestLabelCacheCollisions(mapObj *map,
3031
                                             labelCacheMemberObj *cachePtr,
3032
                                             label_bounds *lb,
3033
                                             int current_priority,
3034
                                             int current_label);
3035
MS_DLL_EXPORT int msTestLabelCacheLeaderCollision(mapObj *map, pointObj *lp1,
3036
                                                  pointObj *lp2);
3037
MS_DLL_EXPORT labelCacheMemberObj *
3038
msGetLabelCacheMember(labelCacheObj *labelcache, int i);
3039
3040
MS_DLL_EXPORT void msFreeShape(shapeObj *shape); /* in mapprimitive.c */
3041
int msGetShapeRAMSize(shapeObj *shape);          /* in mapprimitive.c */
3042
MS_DLL_EXPORT void msFreeLabelPathObj(labelPathObj *path);
3043
MS_DLL_EXPORT shapeObj *msShapeFromWKT(const char *string);
3044
MS_DLL_EXPORT char *msShapeToWKT(shapeObj *shape);
3045
MS_DLL_EXPORT void msInitShape(shapeObj *shape);
3046
MS_DLL_EXPORT void msShapeDeleteLine(shapeObj *shape, int line);
3047
MS_DLL_EXPORT int msCopyShape(const shapeObj *from, shapeObj *to);
3048
MS_DLL_EXPORT int msIsOuterRing(shapeObj *shape, int r);
3049
MS_DLL_EXPORT int *msGetOuterList(shapeObj *shape);
3050
MS_DLL_EXPORT int *msGetInnerList(shapeObj *shape, int r, int *outerlist);
3051
MS_DLL_EXPORT void msComputeBounds(shapeObj *shape);
3052
MS_DLL_EXPORT void msRectToPolygon(rectObj rect, shapeObj *poly);
3053
MS_DLL_EXPORT void msClipPolylineRect(shapeObj *shape, rectObj rect);
3054
MS_DLL_EXPORT void msClipPolygonRect(shapeObj *shape, rectObj rect);
3055
MS_DLL_EXPORT void msTransformShape(shapeObj *shape, rectObj extent,
3056
                                    double cellsize, imageObj *image);
3057
MS_DLL_EXPORT void msTransformPoint(pointObj *point, rectObj *extent,
3058
                                    double cellsize, imageObj *image);
3059
3060
MS_DLL_EXPORT void msOffsetPointRelativeTo(pointObj *point, layerObj *layer);
3061
MS_DLL_EXPORT void msOffsetShapeRelativeTo(shapeObj *shape, layerObj *layer);
3062
MS_DLL_EXPORT void msTransformShapeSimplify(shapeObj *shape, rectObj extent,
3063
                                            double cellsize);
3064
MS_DLL_EXPORT void msTransformShapeToPixelSnapToGrid(shapeObj *shape,
3065
                                                     rectObj extent,
3066
                                                     double cellsize,
3067
                                                     double grid_resolution);
3068
MS_DLL_EXPORT void msTransformShapeToPixelRound(shapeObj *shape, rectObj extent,
3069
                                                double cellsize);
3070
MS_DLL_EXPORT void msTransformShapeToPixelDoublePrecision(shapeObj *shape,
3071
                                                          rectObj extent,
3072
                                                          double cellsize);
3073
3074
MS_DLL_EXPORT shapeObj *msDensify(shapeObj *shape, double tolerance);
3075
MS_DLL_EXPORT shapeObj *msRings2Shape(shapeObj *shape, int outer);
3076
3077
#ifndef SWIG
3078
3079
struct line_lengths {
3080
  double *segment_lengths;
3081
  double total_length;
3082
  int longest_segment_index;
3083
};
3084
3085
struct polyline_lengths {
3086
  struct line_lengths *ll;
3087
  double total_length;
3088
  int longest_line_index;
3089
  int longest_segment_line_index, longest_segment_point_index;
3090
};
3091
3092
struct label_auto_result {
3093
  pointObj *label_points;
3094
  double *angles;
3095
  int num_label_points;
3096
};
3097
3098
struct label_follow_result {
3099
  textSymbolObj **follow_labels;
3100
  int num_follow_labels;
3101
  struct label_auto_result lar;
3102
};
3103
3104
#endif
3105
3106
MS_DLL_EXPORT void msTransformPixelToShape(shapeObj *shape, rectObj extent,
3107
                                           double cellsize);
3108
MS_DLL_EXPORT void msPolylineComputeLineSegments(shapeObj *shape,
3109
                                                 struct polyline_lengths *pll);
3110
MS_DLL_EXPORT int msPolylineLabelPath(mapObj *map, imageObj *image, shapeObj *p,
3111
                                      textSymbolObj *ts, labelObj *label,
3112
                                      struct label_follow_result *lfr);
3113
MS_DLL_EXPORT int WARN_UNUSED msPolylineLabelPoint(
3114
    mapObj *map, shapeObj *p, textSymbolObj *ts, labelObj *label,
3115
    struct label_auto_result *lar, double resolutionfactor);
3116
MS_DLL_EXPORT int WARN_UNUSED msLineLabelPath(mapObj *map, imageObj *img,
3117
                                              lineObj *p, textSymbolObj *ts,
3118
                                              struct line_lengths *ll,
3119
                                              struct label_follow_result *lfr,
3120
                                              labelObj *lbl);
3121
MS_DLL_EXPORT int WARN_UNUSED msLineLabelPoint(
3122
    mapObj *map, lineObj *p, textSymbolObj *ts, struct line_lengths *ll,
3123
    struct label_auto_result *lar, labelObj *lbl, double resolutionfactor);
3124
MS_DLL_EXPORT int msPolygonLabelPoint(shapeObj *p, pointObj *lp,
3125
                                      double min_dimension);
3126
MS_DLL_EXPORT int msAddLine(shapeObj *p, const lineObj *new_line);
3127
MS_DLL_EXPORT int msAddLineDirectly(shapeObj *p, lineObj *new_line);
3128
MS_DLL_EXPORT int msAddPointToLine(lineObj *line, pointObj *point);
3129
MS_DLL_EXPORT double msGetPolygonArea(shapeObj *p);
3130
MS_DLL_EXPORT int msGetPolygonCentroid(shapeObj *p, pointObj *lp, double *miny,
3131
                                       double *maxy);
3132
3133
MS_DLL_EXPORT int msDrawRasterLayer(mapObj *map, layerObj *layer,
3134
                                    imageObj *image); /* in mapraster.c */
3135
MS_DLL_EXPORT imageObj *msDrawReferenceMap(mapObj *map);
3136
3137
/* mapbits.c - bit array handling functions and macros */
3138
3139
2.11M
#define MS_ARRAY_BIT 32
3140
3141
0
#define MS_GET_BIT(array, i) ((array)[(i) >> 5] & (1 << ((i)&0x3f)))
3142
#define MS_SET_BIT(array, i)                                                   \
3143
0
  { (array)[(i) >> 5] |= (1 << ((i)&0x3f)); }
3144
#define MS_CLR_BIT(array, i)                                                   \
3145
  { (array)[(i) >> 5] &= (~(1 << ((i)&0x3f))); }
3146
3147
MS_DLL_EXPORT size_t msGetBitArraySize(int numbits); /* in mapbits.c */
3148
MS_DLL_EXPORT ms_bitarray msAllocBitArray(int numbits);
3149
MS_DLL_EXPORT int msGetBit(ms_const_bitarray array, int index);
3150
MS_DLL_EXPORT void msSetBit(ms_bitarray array, int index, int value);
3151
MS_DLL_EXPORT void msSetAllBits(ms_bitarray array, int index, int value);
3152
MS_DLL_EXPORT void msFlipBit(ms_bitarray array, int index);
3153
MS_DLL_EXPORT int msGetNextBit(ms_const_bitarray array, int index, int size);
3154
3155
/* maplayer.c - layerObj  api */
3156
3157
MS_DLL_EXPORT int msLayerInitItemInfo(layerObj *layer);
3158
MS_DLL_EXPORT void msLayerFreeItemInfo(layerObj *layer);
3159
3160
MS_DLL_EXPORT int msLayerOpen(layerObj *layer); /* in maplayer.c */
3161
MS_DLL_EXPORT int msLayerApplyScaletokens(layerObj *layer, double scale);
3162
MS_DLL_EXPORT int msLayerRestoreFromScaletokens(layerObj *layer);
3163
MS_DLL_EXPORT int msClusterLayerOpen(layerObj *layer); /* in mapcluster.c */
3164
MS_DLL_EXPORT int msLayerIsOpen(layerObj *layer);
3165
MS_DLL_EXPORT bool msLayerPropertyIsCharacter(layerObj *layer,
3166
                                              const char *property);
3167
MS_DLL_EXPORT bool msLayerPropertyIsNumeric(layerObj *layer,
3168
                                            const char *property);
3169
MS_DLL_EXPORT void msLayerClose(layerObj *layer);
3170
MS_DLL_EXPORT void msLayerFreeExpressions(layerObj *layer);
3171
MS_DLL_EXPORT int msLayerWhichShapes(layerObj *layer, rectObj rect,
3172
                                     int isQuery);
3173
MS_DLL_EXPORT int msLayerGetItemIndex(layerObj *layer, char *item);
3174
MS_DLL_EXPORT int msLayerWhichItems(layerObj *layer, int get_all,
3175
                                    const char *metadata);
3176
MS_DLL_EXPORT int msLayerNextShape(layerObj *layer, shapeObj *shape);
3177
MS_DLL_EXPORT int msLayerGetItems(layerObj *layer);
3178
MS_DLL_EXPORT int msLayerSetItems(layerObj *layer, char **items, int numitems);
3179
MS_DLL_EXPORT int msLayerGetShape(layerObj *layer, shapeObj *shape,
3180
                                  resultObj *record);
3181
MS_DLL_EXPORT int msLayerGetShapeCount(layerObj *layer, rectObj rect,
3182
                                       projectionObj *rectProjection);
3183
MS_DLL_EXPORT int msLayerGetExtent(layerObj *layer, rectObj *extent);
3184
MS_DLL_EXPORT int msLayerSetExtent(layerObj *layer, double minx, double miny,
3185
                                   double maxx, double maxy);
3186
MS_DLL_EXPORT int msLayerGetAutoStyle(mapObj *map, layerObj *layer, classObj *c,
3187
                                      shapeObj *shape);
3188
MS_DLL_EXPORT int msLayerGetFeatureStyle(mapObj *map, layerObj *layer,
3189
                                         classObj *c, shapeObj *shape);
3190
MS_DLL_EXPORT void msLayerAddProcessing(layerObj *layer, const char *directive);
3191
MS_DLL_EXPORT void msLayerSetProcessingKey(layerObj *layer, const char *key,
3192
                                           const char *value);
3193
MS_DLL_EXPORT const char *msLayerGetProcessing(const layerObj *layer,
3194
                                               int proc_index);
3195
MS_DLL_EXPORT int msLayerGetNumProcessing(const layerObj *layer);
3196
MS_DLL_EXPORT const char *msLayerGetProcessingKey(const layerObj *layer,
3197
                                                  const char *);
3198
MS_DLL_EXPORT int msLayerClearProcessing(layerObj *layer);
3199
MS_DLL_EXPORT void
3200
msLayerSubstituteProcessing(layerObj *layer, const char *from, const char *to);
3201
MS_DLL_EXPORT char *msLayerGetFilterString(layerObj *layer);
3202
MS_DLL_EXPORT int msLayerEncodeShapeAttributes(layerObj *layer,
3203
                                               shapeObj *shape);
3204
3205
MS_DLL_EXPORT int msLayerTranslateFilter(layerObj *layer, expressionObj *filter,
3206
                                         char *filteritem);
3207
MS_DLL_EXPORT int msLayerSupportsCommonFilters(layerObj *layer);
3208
MS_DLL_EXPORT const char *msExpressionTokenToString(int token);
3209
MS_DLL_EXPORT int msTokenizeExpression(expressionObj *expression, char **list,
3210
                                       int *listsize);
3211
3212
MS_DLL_EXPORT int msLayerSetTimeFilter(layerObj *lp, const char *timestring,
3213
                                       const char *timefield);
3214
MS_DLL_EXPORT int msLayerMakeBackticsTimeFilter(layerObj *lp,
3215
                                                const char *timestring,
3216
                                                const char *timefield);
3217
MS_DLL_EXPORT int msLayerMakePlainTimeFilter(layerObj *lp,
3218
                                             const char *timestring,
3219
                                             const char *timefield);
3220
3221
MS_DLL_EXPORT int msLayerApplyCondSQLFilterToLayer(FilterEncodingNode *psNode,
3222
                                                   mapObj *map,
3223
                                                   int iLayerIndex);
3224
MS_DLL_EXPORT int msLayerApplyPlainFilterToLayer(FilterEncodingNode *psNode,
3225
                                                 mapObj *map, int iLayerIndex);
3226
3227
/* maplayer.c */
3228
MS_DLL_EXPORT int msLayerGetNumFeatures(layerObj *layer);
3229
3230
MS_DLL_EXPORT int msLayerSupportsPaging(layerObj *layer);
3231
3232
MS_DLL_EXPORT void msLayerEnablePaging(layerObj *layer, int value);
3233
MS_DLL_EXPORT int msLayerGetPaging(layerObj *layer);
3234
3235
MS_DLL_EXPORT int msLayerGetMaxFeaturesToDraw(layerObj *layer,
3236
                                              outputFormatObj *format);
3237
3238
MS_DLL_EXPORT char *msLayerEscapeSQLParam(layerObj *layer,
3239
                                          const char *pszString);
3240
MS_DLL_EXPORT char *msLayerEscapePropertyName(layerObj *layer,
3241
                                              const char *pszString);
3242
3243
int msLayerSupportsSorting(layerObj *layer);
3244
void msLayerSetSort(layerObj *layer, const sortByClause *sortBy);
3245
MS_DLL_EXPORT char *msLayerBuildSQLOrderBy(layerObj *layer);
3246
3247
/* These are special because SWF is using these */
3248
int msOGRLayerNextShape(layerObj *layer, shapeObj *shape);
3249
int msOGRLayerGetItems(layerObj *layer);
3250
void msOGRLayerFreeItemInfo(layerObj *layer);
3251
int msOGRLayerGetShape(layerObj *layer, shapeObj *shape, resultObj *record);
3252
int msOGRLayerGetExtent(layerObj *layer, rectObj *extent);
3253
3254
reprojectionObj MS_DLL_EXPORT *msLayerGetReprojectorToMap(layerObj *layer,
3255
                                                          mapObj *map);
3256
3257
MS_DLL_EXPORT int msOGRGeometryToShape(OGRGeometryH hGeometry, shapeObj *shape,
3258
                                       OGRwkbGeometryType type);
3259
3260
MS_DLL_EXPORT int msInitializeVirtualTable(layerObj *layer);
3261
MS_DLL_EXPORT int msConnectLayer(layerObj *layer, const int connectiontype,
3262
                                 const char *library_str);
3263
3264
MS_DLL_EXPORT int msINLINELayerInitializeVirtualTable(layerObj *layer);
3265
MS_DLL_EXPORT int msSHPLayerInitializeVirtualTable(layerObj *layer);
3266
MS_DLL_EXPORT int msFlatGeobufLayerInitializeVirtualTable(layerObj *layer);
3267
MS_DLL_EXPORT int msTiledSHPLayerInitializeVirtualTable(layerObj *layer);
3268
MS_DLL_EXPORT int msOGRLayerInitializeVirtualTable(layerObj *layer);
3269
MS_DLL_EXPORT int msPostGISLayerInitializeVirtualTable(layerObj *layer);
3270
MS_DLL_EXPORT int msOracleSpatialLayerInitializeVirtualTable(layerObj *layer);
3271
MS_DLL_EXPORT int msWFSLayerInitializeVirtualTable(layerObj *layer);
3272
MS_DLL_EXPORT int msGraticuleLayerInitializeVirtualTable(layerObj *layer);
3273
MS_DLL_EXPORT int msRASTERLayerInitializeVirtualTable(layerObj *layer);
3274
MS_DLL_EXPORT int msUVRASTERLayerInitializeVirtualTable(layerObj *layer);
3275
MS_DLL_EXPORT int msContourLayerInitializeVirtualTable(layerObj *layer);
3276
MS_DLL_EXPORT int msPluginLayerInitializeVirtualTable(layerObj *layer);
3277
MS_DLL_EXPORT int msUnionLayerInitializeVirtualTable(layerObj *layer);
3278
MS_DLL_EXPORT int msRasterLabelLayerInitializeVirtualTable(layerObj *layer);
3279
MS_DLL_EXPORT void msPluginFreeVirtualTableFactory(void);
3280
3281
MS_DLL_EXPORT int LayerDefaultGetShapeCount(layerObj *layer, rectObj rect,
3282
                                            projectionObj *rectProjection);
3283
void msUVRASTERLayerUseMapExtentAndProjectionForNextWhichShapes(layerObj *layer,
3284
                                                                mapObj *map);
3285
rectObj msUVRASTERGetSearchRect(layerObj *layer, mapObj *map);
3286
3287
void msRasterLabelLayerUseMapExtentAndProjectionForNextWhichShapes(
3288
    layerObj *layer, mapObj *map);
3289
rectObj msRasterLabelGetSearchRect(layerObj *layer, mapObj *map);
3290
3291
/* ==================================================================== */
3292
/*      Prototypes for functions in mapdraw.c                           */
3293
/* ==================================================================== */
3294
3295
MS_DLL_EXPORT double msGetGeoCellSize(const mapObj *map);
3296
MS_DLL_EXPORT void msUpdateClassScaleFactor(double geo_cellsize,
3297
                                            const mapObj *map,
3298
                                            const layerObj *layer, classObj *c);
3299
MS_DLL_EXPORT imageObj *msPrepareImage(mapObj *map, int allow_nonsquare);
3300
MS_DLL_EXPORT imageObj *msDrawMap(mapObj *map, int querymap);
3301
MS_DLL_EXPORT int msLayerIsVisible(mapObj *map, layerObj *layer);
3302
MS_DLL_EXPORT int msDrawLayer(mapObj *map, layerObj *layer, imageObj *image);
3303
MS_DLL_EXPORT int msDrawVectorLayer(mapObj *map, layerObj *layer,
3304
                                    imageObj *image);
3305
MS_DLL_EXPORT int msDrawQueryLayer(mapObj *map, layerObj *layer,
3306
                                   imageObj *image);
3307
MS_DLL_EXPORT int msDrawWMSLayer(mapObj *map, layerObj *layer, imageObj *image);
3308
MS_DLL_EXPORT int msDrawWFSLayer(mapObj *map, layerObj *layer, imageObj *image);
3309
3310
0
#define MS_DRAWMODE_FEATURES 0x00001
3311
0
#define MS_DRAW_FEATURES(mode) (MS_DRAWMODE_FEATURES & (mode))
3312
0
#define MS_DRAWMODE_LABELS 0x00002
3313
0
#define MS_DRAW_LABELS(mode) (MS_DRAWMODE_LABELS & (mode))
3314
0
#define MS_DRAWMODE_SINGLESTYLE 0x00004
3315
0
#define MS_DRAW_SINGLESTYLE(mode) (MS_DRAWMODE_SINGLESTYLE & (mode))
3316
0
#define MS_DRAWMODE_QUERY 0x00008
3317
0
#define MS_DRAW_QUERY(mode) (MS_DRAWMODE_QUERY & (mode))
3318
0
#define MS_DRAWMODE_UNCLIPPEDLABELS 0x00010
3319
0
#define MS_DRAW_UNCLIPPED_LABELS(mode) (MS_DRAWMODE_UNCLIPPEDLABELS & (mode))
3320
0
#define MS_DRAWMODE_UNCLIPPEDLINES 0x00020
3321
0
#define MS_DRAW_UNCLIPPED_LINES(mode) (MS_DRAWMODE_UNCLIPPEDLINES & (mode))
3322
3323
MS_DLL_EXPORT int WARN_UNUSED msDrawShape(mapObj *map, layerObj *layer,
3324
                                          shapeObj *shape, imageObj *image,
3325
                                          int style, int mode);
3326
MS_DLL_EXPORT int WARN_UNUSED msDrawPoint(mapObj *map, layerObj *layer,
3327
                                          pointObj *point, imageObj *image,
3328
                                          int classindex, char *labeltext);
3329
3330
/*Range Support*/
3331
typedef enum { MS_COLORSPACE_RGB, MS_COLORSPACE_HSL } colorspace;
3332
MS_DLL_EXPORT int msShapeToRange(styleObj *style, shapeObj *shape);
3333
MS_DLL_EXPORT int msValueToRange(styleObj *style, double fieldVal,
3334
                                 colorspace cs);
3335
3336
MS_DLL_EXPORT int WARN_UNUSED msDrawMarkerSymbol(mapObj *map, imageObj *image,
3337
                                                 pointObj *p, styleObj *style,
3338
                                                 double scalefactor);
3339
MS_DLL_EXPORT int WARN_UNUSED msDrawLineSymbol(mapObj *map, imageObj *image,
3340
                                               shapeObj *p, styleObj *style,
3341
                                               double scalefactor);
3342
MS_DLL_EXPORT int WARN_UNUSED msDrawShadeSymbol(mapObj *map, imageObj *image,
3343
                                                shapeObj *p, styleObj *style,
3344
                                                double scalefactor);
3345
MS_DLL_EXPORT int WARN_UNUSED msCircleDrawLineSymbol(mapObj *map,
3346
                                                     imageObj *image,
3347
                                                     pointObj *p, double r,
3348
                                                     styleObj *style,
3349
                                                     double scalefactor);
3350
MS_DLL_EXPORT int WARN_UNUSED msCircleDrawShadeSymbol(mapObj *map,
3351
                                                      imageObj *image,
3352
                                                      pointObj *p, double r,
3353
                                                      styleObj *style,
3354
                                                      double scalefactor);
3355
MS_DLL_EXPORT int WARN_UNUSED msDrawPieSlice(mapObj *map, imageObj *image,
3356
                                             pointObj *p, styleObj *style,
3357
                                             double radius, double start,
3358
                                             double end);
3359
MS_DLL_EXPORT int WARN_UNUSED msDrawLabelBounds(mapObj *map, imageObj *image,
3360
                                                label_bounds *bnds,
3361
                                                styleObj *style,
3362
                                                double scalefactor);
3363
3364
MS_DLL_EXPORT void msOutlineRenderingPrepareStyle(styleObj *pStyle, mapObj *map,
3365
                                                  layerObj *layer,
3366
                                                  imageObj *image);
3367
MS_DLL_EXPORT void msOutlineRenderingRestoreStyle(styleObj *pStyle, mapObj *map,
3368
                                                  layerObj *layer,
3369
                                                  imageObj *image);
3370
3371
MS_DLL_EXPORT int WARN_UNUSED msDrawLabel(mapObj *map, imageObj *image,
3372
                                          pointObj labelPnt, char *string,
3373
                                          labelObj *label, double scalefactor);
3374
MS_DLL_EXPORT int WARN_UNUSED msDrawTextSymbol(mapObj *map, imageObj *image,
3375
                                               pointObj labelPnt,
3376
                                               textSymbolObj *ts);
3377
MS_DLL_EXPORT int WARN_UNUSED msDrawLabelCache(mapObj *map, imageObj *image);
3378
3379
MS_DLL_EXPORT void msImageStartLayer(mapObj *map, layerObj *layer,
3380
                                     imageObj *image);
3381
MS_DLL_EXPORT void msImageEndLayer(mapObj *map, layerObj *layer,
3382
                                   imageObj *image);
3383
3384
MS_DLL_EXPORT void msDrawStartShape(mapObj *map, layerObj *layer,
3385
                                    imageObj *image, shapeObj *shape);
3386
MS_DLL_EXPORT void msDrawEndShape(mapObj *map, layerObj *layer, imageObj *image,
3387
                                  shapeObj *shape);
3388
/* ==================================================================== */
3389
/*      End of Prototypes for functions in mapdraw.c                    */
3390
/* ==================================================================== */
3391
3392
/* ==================================================================== */
3393
/*      Prototypes for functions in mapgeomutil.cpp                       */
3394
/* ==================================================================== */
3395
MS_DLL_EXPORT shapeObj *msRasterizeArc(double x0, double y0, double radius,
3396
                                       double startAngle, double endAngle,
3397
                                       int isSlice);
3398
MS_DLL_EXPORT int msHatchPolygon(imageObj *img, shapeObj *poly, double spacing,
3399
                                 double width, double *pattern,
3400
                                 int patternlength, double angle,
3401
                                 colorObj *color);
3402
3403
/* ==================================================================== */
3404
/*      Prototypes for functions in mapimagemap.c                       */
3405
/* ==================================================================== */
3406
MS_DLL_EXPORT imageObj *
3407
msImageCreateIM(int width, int height, outputFormatObj *format, char *imagepath,
3408
                char *imageurl, double resolution, double defresolution);
3409
MS_DLL_EXPORT void msImageStartLayerIM(mapObj *map, layerObj *layer,
3410
                                       imageObj *image);
3411
MS_DLL_EXPORT int msSaveImageIM(imageObj *img, const char *filename,
3412
                                outputFormatObj *format);
3413
MS_DLL_EXPORT void msFreeImageIM(imageObj *img);
3414
MS_DLL_EXPORT void msDrawMarkerSymbolIM(mapObj *map, imageObj *img, pointObj *p,
3415
                                        styleObj *style, double scalefactor);
3416
MS_DLL_EXPORT void msDrawLineSymbolIM(mapObj *map, imageObj *img, shapeObj *p,
3417
                                      styleObj *style, double scalefactor);
3418
MS_DLL_EXPORT void msDrawShadeSymbolIM(mapObj *map, imageObj *img, shapeObj *p,
3419
                                       styleObj *style, double scalefactor);
3420
MS_DLL_EXPORT int msDrawTextIM(mapObj *map, imageObj *img, pointObj labelPnt,
3421
                               char *string, labelObj *label,
3422
                               double scalefactor);
3423
/* ==================================================================== */
3424
/*      End of Prototypes for functions in mapimagemap.c                */
3425
/* ==================================================================== */
3426
3427
/* various JOIN functions (in mapjoin.c) */
3428
MS_DLL_EXPORT int msJoinConnect(layerObj *layer, joinObj *join);
3429
MS_DLL_EXPORT int msJoinPrepare(joinObj *join, shapeObj *shape);
3430
MS_DLL_EXPORT int msJoinNext(joinObj *join);
3431
MS_DLL_EXPORT int msJoinClose(joinObj *join);
3432
3433
/*in mapraster.c */
3434
int msDrawRasterLayerLowCheckIfMustDraw(mapObj *map, layerObj *layer);
3435
void *msDrawRasterLayerLowOpenDataset(mapObj *map, layerObj *layer,
3436
                                      const char *filename,
3437
                                      char szPath[MS_MAXPATHLEN],
3438
                                      char **p_decrypted_path);
3439
void msDrawRasterLayerLowCloseDataset(layerObj *layer, void *hDataset);
3440
int msDrawRasterLayerLowWithDataset(mapObj *map, layerObj *layer,
3441
                                    imageObj *image, rasterBufferObj *rb,
3442
                                    void *hDatasetIn);
3443
3444
MS_DLL_EXPORT int msDrawRasterLayerLow(mapObj *map, layerObj *layer,
3445
                                       imageObj *image, rasterBufferObj *rb);
3446
MS_DLL_EXPORT int msGetClass(layerObj *layer, colorObj *color,
3447
                             int colormap_index);
3448
MS_DLL_EXPORT int msGetClass_FloatRGB(layerObj *layer, float fValue, int red,
3449
                                      int green, int blue);
3450
int msGetClass_FloatRGB_WithFirstClassToTry(layerObj *layer, float fValue,
3451
                                            int red, int green, int blue,
3452
                                            int firstClassToTry);
3453
3454
/* in mapdrawgdal.c */
3455
MS_DLL_EXPORT int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer,
3456
                                        imageObj *image, rasterBufferObj *rb,
3457
                                        void *hDSVoid);
3458
MS_DLL_EXPORT int msGetGDALGeoTransform(void *hDS, mapObj *map, layerObj *layer,
3459
                                        double *padfGeoTransform);
3460
MS_DLL_EXPORT int *msGetGDALBandList(layerObj *layer, void *hDS, int max_bands,
3461
                                     int *band_count);
3462
MS_DLL_EXPORT double msGetGDALNoDataValue(layerObj *layer, void *hBand,
3463
                                          int *pbGotNoData);
3464
3465
/* in interpolation.c */
3466
MS_DLL_EXPORT int msInterpolationDataset(mapObj *map, imageObj *image,
3467
                                         layerObj *layer, void **hDSvoid,
3468
                                         void **cleanup_ptr);
3469
MS_DLL_EXPORT int msCleanupInterpolationDataset(mapObj *map, imageObj *image,
3470
                                                layerObj *layer,
3471
                                                void *cleanup_ptr);
3472
3473
/* in mapchart.c */
3474
MS_DLL_EXPORT int msDrawChartLayer(mapObj *map, layerObj *layer,
3475
                                   imageObj *image);
3476
3477
/* ==================================================================== */
3478
/*      End of prototypes for functions in mapgd.c                      */
3479
/* ==================================================================== */
3480
3481
/* ==================================================================== */
3482
/*      Prototypes for functions in maputil.c                           */
3483
/* ==================================================================== */
3484
3485
MS_DLL_EXPORT int msScaleInBounds(double scale, double minscale,
3486
                                  double maxscale);
3487
MS_DLL_EXPORT void *msSmallMalloc(size_t nSize);
3488
MS_DLL_EXPORT void *msSmallRealloc(void *pData, size_t nNewSize);
3489
MS_DLL_EXPORT void *msSmallCalloc(size_t nCount, size_t nSize);
3490
MS_DLL_EXPORT int msIntegerInArray(const int value, int *array,
3491
                                   int numelements);
3492
3493
MS_DLL_EXPORT int msExtentsOverlap(mapObj *map, layerObj *layer);
3494
MS_DLL_EXPORT char *msBuildOnlineResource(mapObj *map, cgiRequestObj *req);
3495
3496
/* For mapswf */
3497
MS_DLL_EXPORT int getRgbColor(mapObj *map, int i, int *r, int *g,
3498
                              int *b); /* maputil.c */
3499
3500
MS_DLL_EXPORT int msBindLayerToShape(layerObj *layer, shapeObj *shape,
3501
                                     int querymapMode);
3502
MS_DLL_EXPORT int msValidateContexts(mapObj *map);
3503
MS_DLL_EXPORT int msEvalContext(mapObj *map, layerObj *layer, char *context);
3504
MS_DLL_EXPORT int msEvalExpression(layerObj *layer, shapeObj *shape,
3505
                                   expressionObj *expression, int itemindex);
3506
MS_DLL_EXPORT int msShapeGetClass(layerObj *layer, mapObj *map, shapeObj *shape,
3507
                                  int *classgroup, int numclasses);
3508
MS_DLL_EXPORT int msShapeGetNextClass(int currentclass, layerObj *layer,
3509
                                      mapObj *map, shapeObj *shape,
3510
                                      int *classgroup, int numclasses);
3511
MS_DLL_EXPORT int msShapeCheckSize(shapeObj *shape, double minfeaturesize);
3512
MS_DLL_EXPORT char *msShapeGetLabelAnnotation(layerObj *layer, shapeObj *shape,
3513
                                              labelObj *lbl);
3514
MS_DLL_EXPORT int msGetLabelStatus(mapObj *map, layerObj *layer,
3515
                                   shapeObj *shape, labelObj *lbl);
3516
MS_DLL_EXPORT int msAdjustImage(rectObj rect, int *width, int *height);
3517
MS_DLL_EXPORT char *msEvalTextExpression(expressionObj *expr, shapeObj *shape);
3518
MS_DLL_EXPORT char *msEvalTextExpressionJSonEscape(expressionObj *expr,
3519
                                                   shapeObj *shape);
3520
MS_DLL_EXPORT double msEvalDoubleExpression(expressionObj *expr,
3521
                                            shapeObj *shape);
3522
MS_DLL_EXPORT double msAdjustExtent(rectObj *rect, int width, int height);
3523
MS_DLL_EXPORT int msConstrainExtent(rectObj *bounds, rectObj *rect,
3524
                                    double overlay);
3525
MS_DLL_EXPORT int *msGetLayersIndexByGroup(mapObj *map, char *groupname,
3526
                                           int *nCount);
3527
MS_DLL_EXPORT unsigned char *msSaveImageBuffer(imageObj *image, int *size_ptr,
3528
                                               outputFormatObj *format);
3529
MS_DLL_EXPORT shapeObj *msOffsetPolyline(shapeObj *shape, double offsetx,
3530
                                         double offsety);
3531
MS_DLL_EXPORT int msMapSetLayerProjections(mapObj *map);
3532
3533
/* Functions to change the drawing order of the layers. */
3534
/* Defined in mapobject.c */
3535
MS_DLL_EXPORT int msMoveLayerUp(mapObj *map, int nLayerIndex);
3536
MS_DLL_EXPORT int msMoveLayerDown(mapObj *map, int nLayerIndex);
3537
MS_DLL_EXPORT int msSetLayersdrawingOrder(mapObj *self, int *panIndexes);
3538
MS_DLL_EXPORT int msInsertLayer(mapObj *map, layerObj *layer, int nIndex);
3539
MS_DLL_EXPORT layerObj *msRemoveLayer(mapObj *map, int nIndex);
3540
3541
/* Defined in layerobject.c */
3542
MS_DLL_EXPORT int msInsertClass(layerObj *layer, classObj *classobj,
3543
                                int nIndex);
3544
MS_DLL_EXPORT classObj *msRemoveClass(layerObj *layer, int nIndex);
3545
MS_DLL_EXPORT int msMoveClassUp(layerObj *layer, int nClassIndex);
3546
MS_DLL_EXPORT int msMoveClassDown(layerObj *layer, int nClassIndex);
3547
3548
/* classobject.c */
3549
MS_DLL_EXPORT int msAddLabelToClass(classObj *classo, labelObj *label);
3550
MS_DLL_EXPORT labelObj *msRemoveLabelFromClass(classObj *classo,
3551
                                               int nLabelIndex);
3552
MS_DLL_EXPORT int msMoveStyleUp(classObj *classo, int nStyleIndex);
3553
MS_DLL_EXPORT int msMoveStyleDown(classObj *classo, int nStyleIndex);
3554
MS_DLL_EXPORT int msDeleteStyle(classObj *classo, int nStyleIndex);
3555
MS_DLL_EXPORT int msInsertStyle(classObj *classo, styleObj *style,
3556
                                int nStyleIndex);
3557
MS_DLL_EXPORT styleObj *msRemoveStyle(classObj *classo, int index);
3558
3559
/* maplabel.c */
3560
MS_DLL_EXPORT int msInsertLabelStyle(labelObj *label, styleObj *style,
3561
                                     int nStyleIndex);
3562
MS_DLL_EXPORT int msMoveLabelStyleUp(labelObj *label, int nStyleIndex);
3563
MS_DLL_EXPORT int msMoveLabelStyleDown(labelObj *label, int nStyleIndex);
3564
MS_DLL_EXPORT int msDeleteLabelStyle(labelObj *label, int nStyleIndex);
3565
MS_DLL_EXPORT styleObj *msRemoveLabelStyle(labelObj *label, int nStyleIndex);
3566
3567
/* Measured shape utility functions. */
3568
MS_DLL_EXPORT pointObj *msGetPointUsingMeasure(shapeObj *shape, double m);
3569
MS_DLL_EXPORT pointObj *msGetMeasureUsingPoint(shapeObj *shape,
3570
                                               pointObj *point);
3571
3572
MS_DLL_EXPORT char **msGetAllGroupNames(mapObj *map, int *numTok);
3573
MS_DLL_EXPORT char *msTmpFile(mapObj *map, const char *mappath,
3574
                              const char *tmppath, const char *ext);
3575
MS_DLL_EXPORT char *msTmpPath(mapObj *map, const char *mappath,
3576
                              const char *tmppath);
3577
MS_DLL_EXPORT char *msTmpFilename(const char *ext);
3578
MS_DLL_EXPORT void msForceTmpFileBase(const char *new_base);
3579
3580
MS_DLL_EXPORT imageObj *msImageCreate(int width, int height,
3581
                                      outputFormatObj *format, char *imagepath,
3582
                                      char *imageurl, double resolution,
3583
                                      double defresolution, colorObj *bg);
3584
3585
MS_DLL_EXPORT void msAlphaBlend(unsigned char red_src, unsigned char green_src,
3586
                                unsigned char blue_src, unsigned char alpha_src,
3587
                                unsigned char *red_dst,
3588
                                unsigned char *green_dst,
3589
                                unsigned char *blue_dst,
3590
                                unsigned char *alpha_dst);
3591
MS_DLL_EXPORT void
3592
msAlphaBlendPM(unsigned char red_src, unsigned char green_src,
3593
               unsigned char blue_src, unsigned char alpha_src,
3594
               unsigned char *red_dst, unsigned char *green_dst,
3595
               unsigned char *blue_dst, unsigned char *alpha_dst);
3596
3597
MS_DLL_EXPORT void msRGBtoHSL(colorObj *rgb, double *h, double *s, double *l);
3598
3599
MS_DLL_EXPORT void msHSLtoRGB(double h, double s, double l, colorObj *rgb);
3600
3601
MS_DLL_EXPORT int msCheckParentPointer(void *p, const char *objname);
3602
3603
MS_DLL_EXPORT int *msAllocateValidClassGroups(layerObj *lp, int *nclasses);
3604
3605
MS_DLL_EXPORT void msFreeRasterBuffer(rasterBufferObj *b);
3606
MS_DLL_EXPORT void msSetLayerOpacity(layerObj *layer, int opacity);
3607
3608
void msMapSetLanguageSpecificConnection(mapObj *map,
3609
                                        const char *validated_language);
3610
MS_DLL_EXPORT shapeObj *msGeneralize(shapeObj *shape, double tolerance);
3611
/* ==================================================================== */
3612
/*      End of prototypes for functions in maputil.c                    */
3613
/* ==================================================================== */
3614
3615
/* ==================================================================== */
3616
/*      prototypes for functions in mapoutput.c                         */
3617
/* ==================================================================== */
3618
3619
MS_DLL_EXPORT void msApplyDefaultOutputFormats(mapObj *);
3620
MS_DLL_EXPORT void msFreeOutputFormat(outputFormatObj *);
3621
MS_DLL_EXPORT int msGetOutputFormatIndex(mapObj *map, const char *imagetype);
3622
MS_DLL_EXPORT int msRemoveOutputFormat(mapObj *map, const char *imagetype);
3623
MS_DLL_EXPORT int msAppendOutputFormat(mapObj *map, outputFormatObj *format);
3624
MS_DLL_EXPORT outputFormatObj *msSelectOutputFormat(mapObj *map,
3625
                                                    const char *imagetype);
3626
MS_DLL_EXPORT void msApplyOutputFormat(outputFormatObj **target,
3627
                                       outputFormatObj *format,
3628
                                       int transparent);
3629
MS_DLL_EXPORT const char *msGetOutputFormatOption(outputFormatObj *format,
3630
                                                  const char *optionkey,
3631
                                                  const char *defaultresult);
3632
MS_DLL_EXPORT outputFormatObj *
3633
msCreateDefaultOutputFormat(mapObj *map, const char *driver, const char *name,
3634
                            const char *mimetype);
3635
MS_DLL_EXPORT int msPostMapParseOutputFormatSetup(mapObj *map);
3636
MS_DLL_EXPORT void msSetOutputFormatOption(outputFormatObj *format,
3637
                                           const char *key, const char *value);
3638
MS_DLL_EXPORT void msGetOutputFormatMimeList(mapObj *map, char **mime_list,
3639
                                             int max_mime);
3640
MS_DLL_EXPORT void
3641
msGetOutputFormatMimeListImg(mapObj *map, const char **mime_list, int max_mime);
3642
MS_DLL_EXPORT void
3643
msGetOutputFormatMimeListWMS(mapObj *map, const char **mime_list, int max_mime);
3644
MS_DLL_EXPORT outputFormatObj *msCloneOutputFormat(outputFormatObj *format);
3645
MS_DLL_EXPORT int msOutputFormatValidate(outputFormatObj *format,
3646
                                         int issue_error);
3647
void msOutputFormatResolveFromImage(mapObj *map, imageObj *img);
3648
3649
/* ==================================================================== */
3650
/*      End of prototypes for functions in mapoutput.c                  */
3651
/* ==================================================================== */
3652
3653
/* ==================================================================== */
3654
/*      prototypes for functions in mapgdal.c                           */
3655
/* ==================================================================== */
3656
MS_DLL_EXPORT int msSaveImageGDAL(mapObj *map, imageObj *image,
3657
                                  const char *filename);
3658
MS_DLL_EXPORT int msInitDefaultGDALOutputFormat(outputFormatObj *format);
3659
void msCleanVSIDir(const char *pszDir);
3660
char **msGetStringListFromHashTable(hashTableObj *table);
3661
3662
/* ==================================================================== */
3663
/*      prototypes for functions in mapogroutput.c                      */
3664
/* ==================================================================== */
3665
MS_DLL_EXPORT int msInitDefaultOGROutputFormat(outputFormatObj *format);
3666
MS_DLL_EXPORT int msOGRWriteFromQuery(mapObj *map, outputFormatObj *format,
3667
                                      int sendheaders);
3668
3669
/* ==================================================================== */
3670
/*      Public prototype for mapogr.cpp functions.                      */
3671
/* ==================================================================== */
3672
int MS_DLL_EXPORT msOGRLayerWhichShapes(layerObj *layer, rectObj rect,
3673
                                        int isQuery);
3674
int MS_DLL_EXPORT msOGRLayerOpen(
3675
    layerObj *layer, const char *pszOverrideConnection); /* in mapogr.cpp */
3676
int MS_DLL_EXPORT msOGRLayerClose(layerObj *layer);
3677
3678
char MS_DLL_EXPORT *msOGRShapeToWKT(shapeObj *shape);
3679
shapeObj MS_DLL_EXPORT *msOGRShapeFromWKT(const char *string);
3680
int msOGRUpdateStyleFromString(mapObj *map, layerObj *layer, classObj *c,
3681
                               const char *stylestring);
3682
3683
/* ==================================================================== */
3684
/*      prototypes for functions in mapcopy                             */
3685
/* ==================================================================== */
3686
MS_DLL_EXPORT int msCopyMap(mapObj *dst, const mapObj *src);
3687
MS_DLL_EXPORT int msCopyLayer(layerObj *dst, const layerObj *src);
3688
MS_DLL_EXPORT int msCopyScaleToken(const scaleTokenObj *src,
3689
                                   scaleTokenObj *dst);
3690
MS_DLL_EXPORT int msCopyPoint(pointObj *dst, const pointObj *src);
3691
MS_DLL_EXPORT int msCopyFontSet(fontSetObj *dst, const fontSetObj *src,
3692
                                mapObj *map);
3693
MS_DLL_EXPORT void copyProperty(void *dst, const void *src, int size);
3694
MS_DLL_EXPORT char *copyStringProperty(char **dst, const char *src);
3695
MS_DLL_EXPORT int msCopyClass(classObj *dst, const classObj *src,
3696
                              layerObj *layer);
3697
MS_DLL_EXPORT int msCopyStyle(styleObj *dst, const styleObj *src);
3698
MS_DLL_EXPORT int msCopyLabel(labelObj *dst, const labelObj *src);
3699
MS_DLL_EXPORT int msCopyLabelLeader(labelLeaderObj *dst,
3700
                                    const labelLeaderObj *src);
3701
MS_DLL_EXPORT int msCopyLine(lineObj *dst, const lineObj *src);
3702
MS_DLL_EXPORT int msCopyProjection(projectionObj *dst,
3703
                                   const projectionObj *src);
3704
MS_DLL_EXPORT int msCopyProjectionExtended(projectionObj *dst,
3705
                                           const projectionObj *src,
3706
                                           char **args, int num_args);
3707
int msCopyExpression(expressionObj *dst, const expressionObj *src);
3708
int msCopyProjection(projectionObj *dst, const projectionObj *src);
3709
MS_DLL_EXPORT int msCopyRasterBuffer(rasterBufferObj *dst,
3710
                                     const rasterBufferObj *src);
3711
3712
/* ==================================================================== */
3713
/*      end prototypes for functions in mapcopy                         */
3714
/* ==================================================================== */
3715
3716
/* ==================================================================== */
3717
/*      mappool.c: connection pooling API.                              */
3718
/* ==================================================================== */
3719
MS_DLL_EXPORT void *msConnPoolRequest(layerObj *layer);
3720
MS_DLL_EXPORT void msConnPoolRelease(layerObj *layer, void *);
3721
MS_DLL_EXPORT void msConnPoolRegister(layerObj *layer, void *conn_handle,
3722
                                      void (*close)(void *));
3723
MS_DLL_EXPORT void msConnPoolCloseUnreferenced(void);
3724
MS_DLL_EXPORT void msConnPoolFinalCleanup(void);
3725
3726
/* ==================================================================== */
3727
/*      prototypes for functions in mapcpl.c                            */
3728
/* ==================================================================== */
3729
MS_DLL_EXPORT const char *msGetBasename(const char *pszFullFilename);
3730
MS_DLL_EXPORT void *msGetSymbol(const char *pszLibrary,
3731
                                const char *pszEntryPoint);
3732
3733
/* ==================================================================== */
3734
/*      prototypes for functions in mapgeos.c                         */
3735
/* ==================================================================== */
3736
MS_DLL_EXPORT void msGEOSSetup(void);
3737
MS_DLL_EXPORT void msGEOSCleanup(void);
3738
MS_DLL_EXPORT void msGEOSFreeGeometry(shapeObj *shape);
3739
3740
MS_DLL_EXPORT shapeObj *msGEOSShapeFromWKT(const char *string);
3741
MS_DLL_EXPORT char *msGEOSShapeToWKT(shapeObj *shape);
3742
MS_DLL_EXPORT void msGEOSFreeWKT(char *pszGEOSWKT);
3743
3744
MS_DLL_EXPORT shapeObj *msGEOSBuffer(shapeObj *shape, double width);
3745
MS_DLL_EXPORT shapeObj *msGEOSSimplify(shapeObj *shape, double tolerance);
3746
MS_DLL_EXPORT shapeObj *msGEOSTopologyPreservingSimplify(shapeObj *shape,
3747
                                                         double tolerance);
3748
MS_DLL_EXPORT shapeObj *msGEOSConvexHull(shapeObj *shape);
3749
MS_DLL_EXPORT shapeObj *msGEOSBoundary(shapeObj *shape);
3750
MS_DLL_EXPORT pointObj *msGEOSGetCentroid(shapeObj *shape);
3751
MS_DLL_EXPORT shapeObj *msGEOSUnion(shapeObj *shape1, shapeObj *shape2);
3752
MS_DLL_EXPORT shapeObj *msGEOSIntersection(shapeObj *shape1, shapeObj *shape2);
3753
MS_DLL_EXPORT shapeObj *msGEOSDifference(shapeObj *shape1, shapeObj *shape2);
3754
MS_DLL_EXPORT shapeObj *msGEOSSymDifference(shapeObj *shape1, shapeObj *shape2);
3755
MS_DLL_EXPORT shapeObj *msGEOSOffsetCurve(shapeObj *p, double offset);
3756
MS_DLL_EXPORT shapeObj *msGEOSVoronoiDiagram(shapeObj *shape, double tolerance,
3757
                                             int onlyEdges);
3758
MS_DLL_EXPORT shapeObj *msGEOSCenterline(shapeObj *shape);
3759
3760
MS_DLL_EXPORT int msGEOSContains(shapeObj *shape1, shapeObj *shape2);
3761
MS_DLL_EXPORT int msGEOSOverlaps(shapeObj *shape1, shapeObj *shape2);
3762
MS_DLL_EXPORT int msGEOSWithin(shapeObj *shape1, shapeObj *shape2);
3763
MS_DLL_EXPORT int msGEOSCrosses(shapeObj *shape1, shapeObj *shape2);
3764
MS_DLL_EXPORT int msGEOSIntersects(shapeObj *shape1, shapeObj *shape2);
3765
MS_DLL_EXPORT int msGEOSTouches(shapeObj *shape1, shapeObj *shape2);
3766
MS_DLL_EXPORT int msGEOSEquals(shapeObj *shape1, shapeObj *shape2);
3767
MS_DLL_EXPORT int msGEOSDisjoint(shapeObj *shape1, shapeObj *shape2);
3768
3769
MS_DLL_EXPORT double msGEOSArea(shapeObj *shape);
3770
MS_DLL_EXPORT double msGEOSLength(shapeObj *shape);
3771
MS_DLL_EXPORT double msGEOSDistance(shapeObj *shape1, shapeObj *shape2);
3772
3773
/* ==================================================================== */
3774
/*      prototypes for functions in mapcrypto.c                         */
3775
/* ==================================================================== */
3776
MS_DLL_EXPORT int msGenerateEncryptionKey(unsigned char *k);
3777
MS_DLL_EXPORT int msReadEncryptionKeyFromFile(const char *keyfile,
3778
                                              unsigned char *k,
3779
                                              const char *pszRelToPath);
3780
MS_DLL_EXPORT void msEncryptStringWithKey(const unsigned char *key,
3781
                                          const char *in, char *out);
3782
MS_DLL_EXPORT void msDecryptStringWithKey(const unsigned char *key,
3783
                                          const char *in, char *out);
3784
MS_DLL_EXPORT char *msDecryptStringTokens(mapObj *map, const char *in);
3785
MS_DLL_EXPORT void msHexEncode(const unsigned char *in, char *out,
3786
                               int numbytes);
3787
MS_DLL_EXPORT int msHexDecode(const char *in, unsigned char *out, int numchars);
3788
3789
/* ==================================================================== */
3790
/*      prototypes for functions in mapxmp.c                            */
3791
/* ==================================================================== */
3792
MS_DLL_EXPORT int msXmpPresent(mapObj *map);
3793
MS_DLL_EXPORT int msXmpWrite(mapObj *map, const char *filename);
3794
3795
/* ==================================================================== */
3796
/*      prototypes for functions in mapgeomtransform.c                  */
3797
/* ==================================================================== */
3798
enum MS_GEOMTRANSFORM_TYPE {
3799
  MS_GEOMTRANSFORM_NONE,
3800
  MS_GEOMTRANSFORM_EXPRESSION,
3801
  MS_GEOMTRANSFORM_START,
3802
  MS_GEOMTRANSFORM_END,
3803
  MS_GEOMTRANSFORM_VERTICES,
3804
  MS_GEOMTRANSFORM_BBOX,
3805
  MS_GEOMTRANSFORM_CENTROID,
3806
  MS_GEOMTRANSFORM_BUFFER,
3807
  MS_GEOMTRANSFORM_CONVEXHULL,
3808
  MS_GEOMTRANSFORM_LABELPOINT,
3809
  MS_GEOMTRANSFORM_LABELPOLY,
3810
  MS_GEOMTRANSFORM_LABELCENTER
3811
};
3812
3813
MS_DLL_EXPORT int msDrawTransformedShape(mapObj *map, imageObj *image,
3814
                                         shapeObj *shape, styleObj *style,
3815
                                         double scalefactor);
3816
MS_DLL_EXPORT void msStyleSetGeomTransform(styleObj *s, const char *transform);
3817
MS_DLL_EXPORT char *msStyleGetGeomTransform(styleObj *style);
3818
3819
MS_DLL_EXPORT int msGeomTransformShape(mapObj *map, layerObj *layer,
3820
                                       shapeObj *shape);
3821
3822
/* ==================================================================== */
3823
/*      end of prototypes for functions in mapgeomtransform.c                 */
3824
/* ==================================================================== */
3825
3826
/* ==================================================================== */
3827
/*      prototypes for functions in mapgraticule.c                      */
3828
/* ==================================================================== */
3829
MS_DLL_EXPORT graticuleIntersectionObj *
3830
msGraticuleLayerGetIntersectionPoints(mapObj *map, layerObj *layer);
3831
MS_DLL_EXPORT void
3832
msGraticuleLayerFreeIntersectionPoints(graticuleIntersectionObj *psValue);
3833
3834
/* ==================================================================== */
3835
/*      end of prototypes for functions in mapgraticule.c               */
3836
/* ==================================================================== */
3837
3838
/* ==================================================================== */
3839
/*      prototypes for functions in mapsmoothing.c                      */
3840
/* ==================================================================== */
3841
MS_DLL_EXPORT shapeObj *msSmoothShapeSIA(shapeObj *shape, int ss, int si,
3842
                                         char *preprocessing);
3843
3844
/* ==================================================================== */
3845
/*      end of prototypes for functions in mapsmoothing.c               */
3846
/* ==================================================================== */
3847
3848
/* ==================================================================== */
3849
/*      prototypes for functions in mapv8.cpp                           */
3850
/* ==================================================================== */
3851
#ifdef USE_V8_MAPSCRIPT
3852
MS_DLL_EXPORT void msV8CreateContext(mapObj *map);
3853
MS_DLL_EXPORT void msV8ContextSetLayer(mapObj *map, layerObj *layer);
3854
MS_DLL_EXPORT void msV8FreeContext(mapObj *map);
3855
MS_DLL_EXPORT char *msV8GetFeatureStyle(mapObj *map, const char *filename,
3856
                                        layerObj *layer, shapeObj *shape);
3857
MS_DLL_EXPORT shapeObj *msV8TransformShape(shapeObj *shape,
3858
                                           const char *filename);
3859
#endif
3860
/* ==================================================================== */
3861
/*      end of prototypes for functions in mapv8.cpp                    */
3862
/* ==================================================================== */
3863
3864
#endif
3865
3866
#ifndef SWIG
3867
/*
3868
 * strokeStyleObj
3869
 */
3870
typedef struct {
3871
  double width; /* line width in pixels */
3872
3873
  /* line pattern, e.g. dots, dashes, etc.. */
3874
  int patternlength;
3875
  double pattern[MS_MAXPATTERNLENGTH];
3876
  double patternoffset;
3877
3878
  /* must be a valid color if not NULL */
3879
  /* color.alpha must be used if supported by the renderer */
3880
  colorObj *color;
3881
3882
  int linecap;  /* MS_CJC_TRIANGLE, MS_CJC_SQUARE, MS_CJC_ROUND, MS_CJC_BUTT */
3883
  int linejoin; /* MS_CJC_BEVEL MS_CJC_ROUND MS_CJC_MITER */
3884
  double linejoinmaxsize;
3885
  int antialiased;
3886
} strokeStyleObj;
3887
3888
#define INIT_STROKE_STYLE(s)                                                   \
3889
0
  {                                                                            \
3890
0
    (s).width = 0;                                                             \
3891
0
    (s).patternlength = 0;                                                     \
3892
0
    (s).color = NULL;                                                          \
3893
0
    (s).linecap = MS_CJC_ROUND;                                                \
3894
0
    (s).linejoin = MS_CJC_ROUND;                                               \
3895
0
    (s).linejoinmaxsize = 0;                                                   \
3896
0
    (s).antialiased = MS_TRUE;                                                 \
3897
0
  }
3898
3899
/*
3900
 * symbolStyleObj
3901
 */
3902
typedef struct {
3903
  /* must be valid colors if not NULL */
3904
  /* color.alpha must be used if supported by the renderer */
3905
  colorObj *color;
3906
  colorObj *backgroundcolor;
3907
3908
  double outlinewidth;
3909
  colorObj *outlinecolor;
3910
3911
  /* scalefactor to be applied on the tile or symbol*/
3912
  double scale;
3913
3914
  /* rotation to apply on the symbol (and the tile?)
3915
   * in radians */
3916
  double rotation;
3917
3918
  /* the gap to space symbols apart when used as a polygon tile
3919
   */
3920
  double gap;
3921
3922
  /* style object, necessary for vector type renderers to be able
3923
   * to render symbols through other renders such as cairo/agg */
3924
  styleObj *style;
3925
} symbolStyleObj;
3926
3927
#define INIT_SYMBOL_STYLE(s)                                                   \
3928
0
  {                                                                            \
3929
0
    (s).color = NULL;                                                          \
3930
0
    (s).backgroundcolor = NULL;                                                \
3931
0
    (s).outlinewidth = 0;                                                      \
3932
0
    (s).outlinecolor = NULL;                                                   \
3933
0
    (s).scale = 1.0;                                                           \
3934
0
    (s).rotation = 0;                                                          \
3935
0
    (s).style = NULL;                                                          \
3936
0
  }
3937
3938
struct tileCacheObj {
3939
  symbolObj *symbol;
3940
  int width;
3941
  int height;
3942
  colorObj color, outlinecolor, backgroundcolor;
3943
  double outlinewidth, rotation, scale;
3944
  imageObj *image;
3945
  tileCacheObj *next;
3946
};
3947
3948
/*
3949
 * labelStyleObj
3950
 */
3951
typedef struct {
3952
  /* full paths to truetype font file */
3953
  char *fonts[MS_MAX_LABEL_FONTS];
3954
  int numfonts;
3955
  double size;
3956
  double rotation;
3957
  colorObj *color;
3958
  double outlinewidth;
3959
  colorObj *outlinecolor;
3960
} labelStyleObj;
3961
3962
#define INIT_LABEL_STYLE(s)                                                    \
3963
  { memset(&(s), '\0', sizeof(labelStyleObj)); }
3964
3965
#endif
3966
3967
#ifndef SWIG
3968
MS_DLL_EXPORT int msInitializeDummyRenderer(rendererVTableObj *vtable);
3969
MS_DLL_EXPORT int msInitializeRendererVTable(outputFormatObj *outputformat);
3970
MS_DLL_EXPORT int
3971
msPopulateRendererVTableCairoRaster(rendererVTableObj *renderer);
3972
MS_DLL_EXPORT int msPopulateRendererVTableCairoSVG(rendererVTableObj *renderer);
3973
MS_DLL_EXPORT int msPopulateRendererVTableCairoPDF(rendererVTableObj *renderer);
3974
MS_DLL_EXPORT int msPopulateRendererVTableOGL(rendererVTableObj *renderer);
3975
MS_DLL_EXPORT int msPopulateRendererVTableAGG(rendererVTableObj *renderer);
3976
MS_DLL_EXPORT int msPopulateRendererVTableUTFGrid(rendererVTableObj *renderer);
3977
MS_DLL_EXPORT int msPopulateRendererVTableKML(rendererVTableObj *renderer);
3978
MS_DLL_EXPORT int msPopulateRendererVTableOGR(rendererVTableObj *renderer);
3979
MS_DLL_EXPORT int msPopulateRendererVTableMVT(rendererVTableObj *renderer);
3980
3981
MS_DLL_EXPORT int msMVTWriteTile(mapObj *map, int sendheaders);
3982
3983
#ifdef USE_CAIRO
3984
MS_DLL_EXPORT void msCairoCleanup(void);
3985
#endif
3986
3987
/* allocate 50k for starters */
3988
0
#define MS_DEFAULT_BUFFER_ALLOC 50000
3989
3990
typedef struct _autobuffer {
3991
  unsigned char *data;
3992
  size_t size;
3993
  size_t available;
3994
  size_t _next_allocation_size;
3995
} bufferObj;
3996
3997
/* in mapimageio.c */
3998
int msQuantizeRasterBuffer(rasterBufferObj *rb, unsigned int *reqcolors,
3999
                           rgbaPixel *palette, rgbaPixel *forced_palette,
4000
                           int num_forced_palette_entries,
4001
                           unsigned int *palette_scaling_maxval);
4002
int msClassifyRasterBuffer(rasterBufferObj *rb, rasterBufferObj *qrb);
4003
int msSaveRasterBuffer(mapObj *map, rasterBufferObj *data, FILE *stream,
4004
                       outputFormatObj *format);
4005
int msSaveRasterBufferToBuffer(rasterBufferObj *data, bufferObj *buffer,
4006
                               outputFormatObj *format);
4007
int msLoadMSRasterBufferFromFile(char *path, rasterBufferObj *rb);
4008
4009
/* in mapagg.cpp */
4010
void msApplyBlurringCompositingFilter(rasterBufferObj *rb, unsigned int radius);
4011
4012
int WARN_UNUSED msApplyCompositingFilter(mapObj *map, rasterBufferObj *rb,
4013
                                         CompositingFilter *filter);
4014
4015
void msBufferInit(bufferObj *buffer);
4016
void msBufferResize(bufferObj *buffer, size_t target_size);
4017
MS_DLL_EXPORT void msBufferFree(bufferObj *buffer);
4018
MS_DLL_EXPORT void msBufferAppend(bufferObj *buffer, void *data, size_t length);
4019
4020
typedef struct {
4021
  int charWidth, charHeight;
4022
} fontMetrics;
4023
4024
struct rendererVTableObj {
4025
  int supports_pixel_buffer;
4026
  int supports_clipping;
4027
  int supports_svg;
4028
  int use_imagecache;
4029
  enum MS_TRANSFORM_MODE default_transform_mode;
4030
  enum MS_TRANSFORM_MODE transform_mode;
4031
  double default_approximation_scale;
4032
  double approximation_scale;
4033
4034
  void *renderer_data;
4035
4036
  int WARN_UNUSED (*renderLine)(imageObj *img, shapeObj *p,
4037
                                strokeStyleObj *style);
4038
  int WARN_UNUSED (*renderPolygon)(imageObj *img, shapeObj *p, colorObj *color);
4039
  int WARN_UNUSED (*renderPolygonTiled)(imageObj *img, shapeObj *p,
4040
                                        imageObj *tile);
4041
  int WARN_UNUSED (*renderLineTiled)(imageObj *img, shapeObj *p,
4042
                                     imageObj *tile);
4043
4044
  /* only ts->textpath is guaranteed to be populated. Other fields might be
4045
   * 0/NULL */
4046
  int WARN_UNUSED (*renderGlyphs)(imageObj *img, const textSymbolObj *ts,
4047
                                  colorObj *clr, colorObj *olcolor, int olwidth,
4048
                                  int isMarker);
4049
4050
  int WARN_UNUSED (*renderVectorSymbol)(imageObj *img, double x, double y,
4051
                                        symbolObj *symbol,
4052
                                        symbolStyleObj *style);
4053
4054
  int WARN_UNUSED (*renderPixmapSymbol)(imageObj *img, double x, double y,
4055
                                        symbolObj *symbol,
4056
                                        symbolStyleObj *style);
4057
4058
  int WARN_UNUSED (*renderEllipseSymbol)(imageObj *image, double x, double y,
4059
                                         symbolObj *symbol,
4060
                                         symbolStyleObj *style);
4061
4062
  int WARN_UNUSED (*renderSVGSymbol)(imageObj *img, double x, double y,
4063
                                     symbolObj *symbol, symbolStyleObj *style);
4064
4065
  int WARN_UNUSED (*renderTile)(imageObj *img, imageObj *tile, double x,
4066
                                double y);
4067
4068
  int WARN_UNUSED (*loadImageFromFile)(char *path, rasterBufferObj *rb);
4069
4070
  int WARN_UNUSED (*getRasterBufferHandle)(imageObj *img, rasterBufferObj *rb);
4071
  int WARN_UNUSED (*getRasterBufferCopy)(imageObj *img, rasterBufferObj *rb);
4072
  int WARN_UNUSED (*initializeRasterBuffer)(rasterBufferObj *rb, int width,
4073
                                            int height, int mode);
4074
4075
  int WARN_UNUSED (*mergeRasterBuffer)(imageObj *dest, rasterBufferObj *overlay,
4076
                                       double opacity, int srcX, int srcY,
4077
                                       int dstX, int dstY, int width,
4078
                                       int height);
4079
  int WARN_UNUSED (*compositeRasterBuffer)(imageObj *dest,
4080
                                           rasterBufferObj *overlay,
4081
                                           CompositingOperation comp_op,
4082
                                           int opacity);
4083
4084
  /* image i/o */
4085
  imageObj *WARN_UNUSED (*createImage)(int width, int height,
4086
                                       outputFormatObj *format, colorObj *bg);
4087
  int WARN_UNUSED (*saveImage)(imageObj *img, mapObj *map, FILE *fp,
4088
                               outputFormatObj *format);
4089
  unsigned char *WARN_UNUSED (*saveImageBuffer)(imageObj *img, int *size_ptr,
4090
                                                outputFormatObj *format);
4091
  /*...*/
4092
4093
  int (*startLayer)(imageObj *img, mapObj *map, layerObj *layer);
4094
  int (*endLayer)(imageObj *img, mapObj *map, layerObj *layer);
4095
4096
  int (*startShape)(imageObj *img, shapeObj *shape);
4097
  int (*endShape)(imageObj *img, shapeObj *shape);
4098
  int (*setClip)(imageObj *img, rectObj clipRect);
4099
  int (*resetClip)(imageObj *img);
4100
4101
  int (*freeImage)(imageObj *image);
4102
  int (*freeSymbol)(symbolObj *symbol);
4103
  int (*cleanup)(void *renderer_data);
4104
};
4105
MS_DLL_EXPORT int msRenderRasterizedSVGSymbol(imageObj *img, double x, double y,
4106
                                              symbolObj *symbol,
4107
                                              symbolStyleObj *style);
4108
4109
0
#define MS_IMAGE_RENDERER(im) ((im)->format->vtable)
4110
3.66k
#define MS_RENDERER_CACHE(renderer) ((renderer)->renderer_data)
4111
#define MS_IMAGE_RENDERER_CACHE(im) MS_RENDERER_CACHE(MS_IMAGE_RENDERER((im)))
4112
0
#define MS_MAP_RENDERER(map) ((map)->outputformat->vtable)
4113
4114
shapeObj *msOffsetCurve(shapeObj *p, double offset);
4115
#if defined USE_GEOS && (GEOS_VERSION_MAJOR > 3 ||                             \
4116
                         (GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR >= 3))
4117
shapeObj *msGEOSOffsetCurve(shapeObj *p, double offset);
4118
#endif
4119
4120
int msOGRSupportsIsNull(layerObj *layer);
4121
4122
#ifdef NEED_IGNORE_RET_VAL
4123
0
static inline void IGNORE_RET_VAL(int x) { (void)x; }
Unexecuted instantiation: mapflatgeobuf.c:IGNORE_RET_VAL
Unexecuted instantiation: mapwms.cpp:IGNORE_RET_VAL(int)
Unexecuted instantiation: mapshape.c:IGNORE_RET_VAL
Unexecuted instantiation: maptemplate.c:IGNORE_RET_VAL
4124
#endif
4125
4126
#endif /* SWIG */
4127
4128
#ifdef __cplusplus
4129
}
4130
#endif
4131
4132
#endif /* MAP_H */