Coverage Report

Created: 2025-11-16 06:25

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