Coverage Report

Created: 2026-04-10 07:04

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