-
-
Notifications
You must be signed in to change notification settings - Fork 359
/
map.h
1983 lines (1628 loc) · 77.5 KB
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
* $Id$
*
* Project: MapServer
* Purpose: Primary MapServer include file.
* Author: Steve Lime and the MapServer team.
*
******************************************************************************
* Copyright (c) 1996-2005 Regents of the University of Minnesota.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of this Software or works derived from this Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************
*
* $Log$
* Revision 1.454 2006/06/08 07:51:11 umberto
* webObj constructor and destructor (bug 1798)
*
* Revision 1.453 2006/06/04 16:46:10 hobu
* trim log so it only goes back to the beginning of 4.8
*
* Revision 1.452 2006/06/04 16:39:32 hobu
* remove old SDE Raster cruft (was commented out anyway)
*
* Revision 1.451 2006/06/01 20:08:04 dan
* Added missing prototype for msGenerateEncryptionKey() (bug 1792)
*
* Revision 1.450 2006/06/01 19:56:31 dan
* Added ability to encrypt tokens (passwords, etc.) in database connection
* strings (MS-RFC-18, bug 1792)
*
* Revision 1.449 2006/05/26 21:46:27 tamas
* Moving layerObj.sameconnection and msCheckConnection() internal to the MYGIS data provider.
*
* Revision 1.448 2006/05/19 20:53:27 dan
* Use lp->layerinfo for OGR connections (instead of ogrlayerinfo) (bug 331)
*
* Revision 1.447 2006/05/11 14:10:35 sdlime
* Added GEOS Union, difference and intersection methods.
*
* Revision 1.446 2006/04/27 04:05:17 sdlime
* Initial support for relative coordinates. (bug 1547)
*
* Revision 1.445 2006/03/22 23:31:20 sdlime
* Applied latest patch for curved labels. (bug 1620)
*
* Revision 1.444 2006/02/22 05:04:34 sdlime
* Applied patch for bug 1660 to hide certain structures from Swig-based MapScript.
*
* Revision 1.443 2006/02/18 20:59:12 sdlime
* Initial code for curved labels. (bug 1620)
*
* Revision 1.442 2006/01/31 17:09:28 sdlime
* Added function to 'commify' a number stored as a string. (supports bug 1636)
*
* Revision 1.441 2006/01/30 15:06:57 dan
* Treat classindex as an int instead of a char in resultCacheMemberObj to
* prevent problems with more than 128 classes (bug 1633)
*
* Revision 1.440 2006/01/20 06:06:53 sdlime
* Added contains operator to mapgeos.cpp and the Swig-based MapScript interface.
*
* Revision 1.439 2006/01/16 20:21:18 sdlime
* Fixed error with image legends (shifted text) introduced by the 1449 bug fix. (bug 1607)
*
* Revision 1.438 2006/01/10 03:10:32 dan
* Update version, this is now 4.9 (dev)
*
* Revision 1.437 2006/01/10 03:01:01 dan
* Update for 4.8.0-rc2
*
* Revision 1.436 2005/12/23 06:20:50 sdlime
* Updated files for 4.8.0-rc1.
*
* Revision 1.435 2005/12/16 13:28:33 dan
* Update version to 4.8.0-beta3
*
* Revision 1.434 2005/12/14 19:06:31 sdlime
* Added browseformat and legendformat to webObj. (bug 1518)
*
* Revision 1.433 2005/12/08 19:05:32 hobu
* switch off SDE raster support
*
* Revision 1.432 2005/11/24 04:38:57 dan
* Update version for 4.8.0-beta2
*
* Revision 1.431 2005/11/22 22:14:43 sean
* expose maximum length of layer, class, and style arrays in mapscript (bug 1522)
*
* Revision 1.430 2005/11/04 20:58:35 dan
* Updated MS_VERSION to 4.8.0-beta1
*
* Revision 1.429 2005/11/01 05:35:50 frank
* added preliminary implementation of OGR based WKT translation, still untested
*
* Revision 1.428 2005/10/30 05:05:07 sdlime
* Initial support for WKT via GEOS. The reader is only integrated via the map file reader, with MapScript, CGI and URL support following ASAP. (bug 1466)
*
* Revision 1.427 2005/10/29 02:03:43 jani
* MS RFC 8: Pluggable External Feature Layer Providers (bug 1477).
*
* Revision 1.426 2005/10/28 02:08:14 frank
* a few mapogr.cpp funcs used from WFS code, exposed in map.h
*
* Revision 1.425 2005/10/28 01:09:41 jani
* MS RFC 3: Layer vtable architecture (bug 1477)
*
* Revision 1.424 2005/10/20 19:37:03 frank
* added msAddPointToLine
*
* Revision 1.423 2005/10/18 03:10:45 frank
* added msShapeDeleteLine
*
* Revision 1.422 2005/10/14 05:04:12 sdlime
* Added msRotateSymbol(), changed freeSymbol to a public function called msFreeSymbol() in mapsymbol.c. Added to map.h as well.
*
* Revision 1.421 2005/09/23 21:18:58 assefa
* Remove call to ming.h inside map.h (Bug 1479)
*
* Revision 1.420 2005/08/25 14:20:16 sdlime
* Applied patch for bug 1440.
*
* Revision 1.419 2005/07/16 19:07:38 jerryp
* Bug 1420: PostGIS connector no longer needs two layer close functions.
*
* Revision 1.418 2005/07/13 19:35:08 julien
* Bug 1381: Support for case-insensitive Expression
*
*/
#ifndef MAP_H
#define MAP_H
/* $Id$
**
** Main includes. If a particular header was needed by several .c files then
** I just put it here. What the hell, it works and it's all right here. -SDL-
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <direct.h>
#include <memory.h>
#include <malloc.h>
#else
#include <unistd.h>
#endif
#ifndef DISABLE_CVSID
# define MS_CVSID(string) static char ms_cvsid[] = string; \
static char *cvsid_aw(void) { return( cvsid_aw() ? ((char *) NULL) : ms_cvsid ); }
#else
# define MS_CVSID(string)
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
# define MS_DLL_EXPORT __declspec(dllexport)
#else
#define MS_DLL_EXPORT
#endif
#if UINT_MAX == 65535
typedef long ms_int32;
#else
typedef int ms_int32;
#endif
#ifdef USE_MPATROL
#include "mpatrol.h"
#endif
#include "maperror.h"
#include "mapprimitive.h"
#include "mapshape.h"
#include "mapsymbol.h"
#include "maptree.h" /* quadtree spatial index */
#include "maphash.h"
#include "mapio.h"
#include "mapproject.h"
#include "cgiutil.h"
#include <gd.h>
#if defined USE_PDF
#include <pdflib.h>
#endif
#include <sys/types.h> /* regular expression support */
/* The regex lib from the system and the regex lib from PHP needs to
* be separated here. We separate here via its directory location.
*/
#include "mapregex.h"
#ifdef USE_OGR
#include "ogr_api.h"
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#define snprintf _snprintf
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* General defines, wrapable */
#define MS_VERSION "4.9"
#define MS_TRUE 1 /* logical control variables */
#define MS_FALSE 0
#define MS_ON 1
#define MS_OFF 0
#define MS_DEFAULT 2
#define MS_EMBED 3
#define MS_DELETE 4
#define MS_YES 1
#define MS_NO 0
#define MS_SINGLE 0 /* modes for searching (spatial/database) */
#define MS_MULTIPLE 1
/* For layer transparency, allows alpha transparent pixmaps to be used
with RGB map images */
#define MS_GD_ALPHA 1000
/* Bounds on the lengths of layer, class, and style arrays are now exposed
to mapscript (bug 1522) */
#define MS_MAXCLASSES 250
#define MS_MAXSTYLES 5
#define MS_MAXLAYERS 200
/* General defines, not wrapable */
#ifndef SWIG
#define MS_DEFAULT_MAPFILE_PATTERN "\\.map$"
#define MS_TEMPLATE_EXPR "\\.(jsp|asp|cfm|xml|wml|html|htm|shtml|phtml|php|svg)$"
#define MS_INDEX_EXTENSION ".qix"
#define MS_QUERY_EXTENSION ".qy"
#define MS_DEG_TO_RAD .0174532925199432958
#define MS_RAD_TO_DEG 57.29577951
#define MS_RED 0
#define MS_GREEN 1
#define MS_BLUE 2
#define MS_MAXCOLORS 256
#define MS_BUFFER_LENGTH 2048 /* maximum input line length */
#define MS_URL_LENGTH 1024
#define MS_MAXPATHLEN 1024
#define MS_MAXIMAGESIZE_DEFAULT 2048
#define MS_MAXPROJARGS 20
#define MS_MAXJOINS 20
#define MS_ITEMNAMELEN 32
#define MS_NAMELEN 20
#define MS_MINSYMBOLSIZE 1 /* in pixels */
#define MS_MAXSYMBOLSIZE 500
#define MS_MINSYMBOLWIDTH 1 /* in pixels */
#define MS_MAXSYMBOLWIDTH 32
#define MS_URL 0 /* template types */
#define MS_FILE 1
#define MS_MINFONTSIZE 4
#define MS_MAXFONTSIZE 256
#define MS_LABELCACHEINITSIZE 100
#define MS_LABELCACHEINCREMENT 10
#define MS_RESULTCACHEINITSIZE 10
#define MS_RESULTCACHEINCREMENT 10
#define MS_FEATUREINITSIZE 10 /* how many points initially can a feature have */
#define MS_FEATUREINCREMENT 10
#define MS_EXPRESSION 2000
#define MS_REGEX 2001
#define MS_STRING 2002
#define MS_NUMBER 2003
#define MS_COMMENT 2004
#define MS_IREGEX 2005
#define MS_ISTRING 2006
/* boolean options for the expression object. */
#define MS_EXP_INSENSITIVE 1
/* General macro definitions */
#define MS_MIN(a,b) (((a)<(b))?(a):(b))
#define MS_MAX(a,b) (((a)>(b))?(a):(b))
#define MS_ABS(a) (((a)<0) ? -(a) : (a))
#define MS_SGN(a) (((a)<0) ? -1 : 1)
/* see http://mega-nerd.com/FPcast/ for some discussion of fast
conversion to nearest int. We avoid lrint() for now because it
would be hard to include math.h "properly". */
#if defined(WE_HAVE_THE_C99_LRINT)
# define MS_NINT(x) lrint(x)
#elif defined(_MSC_VER) && defined(_WIN32) && !defined(USE_GENERIC_MS_NINT)
static __inline long int MS_NINT (double flt)
{ int intgr;
_asm
{ fld flt
fistp intgr
} ;
return intgr ;
}
#elif defined(i386) && defined(__GNUC_PREREQ) && !defined(USE_GENERIC_MS_NINT)
static __inline long int MS_NINT( double __x )
{
long int __lrintres;
__asm__ __volatile__
("fistpl %0"
: "=m" (__lrintres) : "t" (__x) : "st");
return __lrintres;
}
#else
# define MS_NINT(x) ((x) >= 0.0 ? ((long) ((x)+.5)) : ((long) ((x)-.5)))
#endif
#define MS_PEN_TRANSPARENT -1
#define MS_PEN_UNSET -4
/* #define MS_VALID_EXTENT(minx, miny, maxx, maxy) (((minx<maxx) && (miny<maxy))?MS_TRUE:MS_FALSE) */
#define MS_VALID_EXTENT(rect) (((rect.minx < rect.maxx && rect.miny < rect.maxy))?MS_TRUE:MS_FALSE)
#define MS_INIT_COLOR(color,r,g,b) { (color).red = r; (color).green = g; (color).blue = b; (color).pen = MS_PEN_UNSET; }
#define MS_VALID_COLOR(color) (((color).red==-1 || (color).green==-1 || (color).blue==-1)?MS_FALSE:MS_TRUE)
#define MS_TRANSPARENT_COLOR(color) (((color).red==-255 || (color).green==-255 || (color).blue==-255)?MS_TRUE:MS_FALSE)
#define MS_COMPARE_COLORS(a,b) (((a).red!=(b).red || (a).green!=(b).green || (a).blue!=(b).blue)?MS_FALSE:MS_TRUE)
#define MS_IMAGE_MIME_TYPE(format) (format->mimetype ? format->mimetype : "unknown")
#define MS_IMAGE_EXTENSION(format) (format->extension ? format->extension : "unknown")
#define MS_DRIVER_GD(format) (strncasecmp((format)->driver,"gd/",3)==0)
#define MS_DRIVER_SWF(format) (strncasecmp((format)->driver,"swf",3)==0)
#define MS_DRIVER_GDAL(format) (strncasecmp((format)->driver,"gdal/",5)==0)
#define MS_DRIVER_PDF(format) (strncasecmp((format)->driver,"pdf",3)==0)
#define MS_DRIVER_IMAGEMAP(format) (strncasecmp((format)->driver,"imagemap",8)==0)
#define MS_DRIVER_SVG(format) (strncasecmp((format)->driver,"svg",3)==0)
#define MS_RENDER_WITH_GD 1
#define MS_RENDER_WITH_SWF 2
#define MS_RENDER_WITH_RAWDATA 3
#define MS_RENDER_WITH_PDF 4
#define MS_RENDER_WITH_IMAGEMAP 5
#define MS_RENDER_WITH_SVG 6
#define MS_RENDERER_GD(format) ((format)->renderer == MS_RENDER_WITH_GD)
#define MS_RENDERER_SWF(format) ((format)->renderer == MS_RENDER_WITH_SWF)
#define MS_RENDERER_RAWDATA(format) ((format)->renderer == MS_RENDER_WITH_RAWDATA)
#define MS_RENDERER_PDF(format) ((format)->renderer == MS_RENDER_WITH_PDF)
#define MS_RENDERER_IMAGEMAP(format) ((format)->renderer == MS_RENDER_WITH_IMAGEMAP)
#define MS_RENDERER_SVG(format) ((format)->renderer == MS_RENDER_WITH_SVG)
/* ok, we'll switch to an UL cell model to make this work with WMS */
#define MS_CELLSIZE(min,max,d) ((max - min)/d)
#define MS_MAP2IMAGE_X(x,minx,cx) (MS_NINT((x - minx)/cx))
#define MS_MAP2IMAGE_Y(y,maxy,cy) (MS_NINT((maxy - y)/cy))
#define MS_IMAGE2MAP_X(x,minx,cx) (minx + cx*x)
#define MS_IMAGE2MAP_Y(y,maxy,cy) (maxy - cy*y)
/* this version of MS_MAP2IMAGE takes 1/cellsize and is much faster */
#define MS_MAP2IMAGE_X_IC(x,minx,icx) (MS_NINT((x - minx)*icx))
#define MS_MAP2IMAGE_Y_IC(y,maxy,icy) (MS_NINT((maxy - y)*icy))
/* For CARTO symbols */
#define MS_PI 3.14159265358979323846
#define MS_PI2 1.57079632679489661923 /* (MS_PI / 2) */
#define MS_3PI2 4.71238898038468985769 /* (3 * MS_PI2) */
#define MS_2PI 6.28318530717958647693 /* (2 * MS_PI) */
#define MS_ENCRYPTION_KEY_SIZE 16 /* Key size: 128 bits = 16 bytes */
#endif
/* General enumerated types - needed by scripts */
enum MS_FILE_TYPE {MS_FILE_MAP, MS_FILE_SYMBOL};
enum MS_UNITS {MS_INCHES, MS_FEET, MS_MILES, MS_METERS, MS_KILOMETERS, MS_DD, MS_PIXELS, MS_PERCENTAGES};
enum MS_SHAPE_TYPE {MS_SHAPE_POINT, MS_SHAPE_LINE, MS_SHAPE_POLYGON, MS_SHAPE_NULL};
enum MS_LAYER_TYPE {MS_LAYER_POINT, MS_LAYER_LINE, MS_LAYER_POLYGON, MS_LAYER_RASTER, MS_LAYER_ANNOTATION, MS_LAYER_QUERY, MS_LAYER_CIRCLE, MS_LAYER_TILEINDEX};
enum MS_FONT_TYPE {MS_TRUETYPE, MS_BITMAP};
#define MS_POSITIONS_LENGTH 12
enum MS_POSITIONS_ENUM {MS_UL=101, MS_LR, MS_UR, MS_LL, MS_CR, MS_CL, MS_UC, MS_LC, MS_CC, MS_AUTO, MS_XY, MS_FOLLOW}; /* arrangement matters for auto placement, don't change it. Added MS_FOLLOW for bug #1620 implementation */
enum MS_BITMAP_FONT_SIZES {MS_TINY , MS_SMALL, MS_MEDIUM, MS_LARGE, MS_GIANT};
enum MS_QUERYMAP_STYLES {MS_NORMAL, MS_HILITE, MS_SELECTED};
enum MS_CONNECTION_TYPE {MS_INLINE, MS_SHAPEFILE, MS_TILED_SHAPEFILE, MS_SDE, MS_OGR, MS_UNUSED_1, MS_POSTGIS, MS_WMS, MS_ORACLESPATIAL, MS_WFS, MS_GRATICULE, MS_MYGIS, MS_RASTER, MS_PLUGIN };
enum MS_JOIN_CONNECTION_TYPE {MS_DB_XBASE, MS_DB_CSV, MS_DB_MYSQL, MS_DB_ORACLE, MS_DB_POSTGRES};
enum MS_JOIN_TYPE {MS_JOIN_ONE_TO_ONE, MS_JOIN_ONE_TO_MANY};
enum MS_CAPS_JOINS_AND_CORNERS {MS_CJC_NONE, MS_CJC_BEVEL, MS_CJC_BUTT, MS_CJC_MITER, MS_CJC_ROUND, MS_CJC_SQUARE, MS_CJC_TRIANGLE};
enum MS_RETURN_VALUE {MS_SUCCESS, MS_FAILURE, MS_DONE};
enum MS_IMAGEMODE { MS_IMAGEMODE_PC256, MS_IMAGEMODE_RGB, MS_IMAGEMODE_RGBA, MS_IMAGEMODE_INT16, MS_IMAGEMODE_FLOAT32, MS_IMAGEMODE_BYTE, MS_IMAGEMODE_NULL };
#define MS_FILE_DEFAULT MS_FILE_MAP
#ifndef SWIG
/* Filter object */
typedef enum
{
FILTER_NODE_TYPE_UNDEFINED = -1,
FILTER_NODE_TYPE_LOGICAL = 0,
FILTER_NODE_TYPE_SPATIAL = 1,
FILTER_NODE_TYPE_COMPARISON = 2,
FILTER_NODE_TYPE_PROPERTYNAME = 3,
FILTER_NODE_TYPE_BBOX = 4,
FILTER_NODE_TYPE_LITERAL = 5,
FILTER_NODE_TYPE_BOUNDARY = 6,
FILTER_NODE_TYPE_GEOMETRY_POINT = 7,
FILTER_NODE_TYPE_GEOMETRY_LINE = 8,
FILTER_NODE_TYPE_GEOMETRY_POLYGON = 9
} FilterNodeType;
typedef struct _FilterNode
{
FilterNodeType eType;
char *pszValue;
void *pOther;
struct _FilterNode *psLeftNode;
struct _FilterNode *psRightNode;
}FilterEncodingNode;
#endif /*SWIG*/
/* Label path object - used to hold path and bounds of curved labels - Bug #1620 implementation. */
typedef struct {
multipointObj path;
shapeObj bounds;
double *angles;
} labelPathObj;
/* FONTSET OBJECT - used to hold aliases for TRUETYPE fonts */
typedef struct {
#ifdef SWIG
%immutable;
#endif
char *filename;
int numfonts;
#ifdef SWIG
%mutable;
#endif
hashTableObj fonts;
#ifndef SWIG
struct map_obj *map;
#endif
} fontSetObj;
/* FEATURE LIST OBJECT - for inline features, shape caches and queries */
#ifndef SWIG
typedef struct listNode {
shapeObj shape;
struct listNode *next;
struct listNode *tailifhead; /* this is the tail node in the list, if this is the head element, otherwise NULL */
} featureListNodeObj;
typedef featureListNodeObj * featureListNodeObjPtr;
#endif
#ifndef SWIG
/* PALETTE OBJECT - used to hold colors while a map file is read */
typedef struct {
colorObj colors[MS_MAXCOLORS-1];
int colorvalue[MS_MAXCOLORS-1];
int numcolors;
} paletteObj;
#endif
/* EXPRESSION OBJECT */
#ifndef SWIG
typedef struct {
char *string;
int type;
/* container for expression options such as case-insensitiveness */
/* This is a boolean container. */
int flags;
/* logical expression options */
char **items;
int *indexes;
int numitems;
/* regular expression options */
ms_regex_t regex; /* compiled regular expression to be matched */
int compiled;
} expressionObj;
#endif
#ifndef SWIG
/* JOIN OBJECT - simple way to access other XBase files, one-to-one or one-to-many supported */
typedef struct {
char *name;
char **items, **values; /* items/values (process 1 record at a time) */
int numitems;
char *table;
char *from, *to; /* item names */
void *joininfo; /* vendor specific (i.e. XBase, MySQL, etc.) stuff to allow for persistant access */
char *header, *footer;
#ifndef __cplusplus
char *template;
#else
char *_template;
#endif
enum MS_JOIN_TYPE type;
char *connection;
enum MS_JOIN_CONNECTION_TYPE connectiontype;
} joinObj;
#endif
/* OUTPUT FORMAT OBJECT - see mapoutput.c for most related code. */
typedef struct {
char *name;
char *mimetype;
char *driver;
char *extension;
int renderer; /* MS_RENDER_WITH_* */
int imagemode; /* MS_IMAGEMODE_* value. */
int transparent;
int bands;
int numformatoptions;
char **formatoptions;
int refcount;
int inmapfile; /* boolean value for writing */
} outputFormatObj;
/* The following is used for "don't care" values in transparent, interlace and
imagequality values. */
#define MS_NOOVERRIDE -1111
/* QUERY MAP OBJECT - used to visualize query results */
typedef struct {
int height, width;
int status;
int style; /* HILITE, SELECTED or NORMAL */
colorObj color;
} queryMapObj;
/* LABEL OBJECT - parameters needed to annotate a layer, legend or scalebar */
typedef struct {
char *font;
enum MS_FONT_TYPE type;
colorObj color;
colorObj outlinecolor;
colorObj shadowcolor;
int shadowsizex, shadowsizey;
colorObj backgroundcolor;
colorObj backgroundshadowcolor;
int backgroundshadowsizex, backgroundshadowsizey;
int size;
int minsize, maxsize;
int position;
int offsetx, offsety;
double angle;
int autoangle; /* true or false */
int angle_follow; /* true or false, bug #1620 implementation */
int buffer; /* space to reserve around a label */
int antialias;
char wrap;
int minfeaturesize; /* minimum feature size (in pixels) to label */
int autominfeaturesize; /* true or false */
int mindistance;
int partials; /* can labels run of an image */
int force; /* labels *must* be drawn */
char *encoding;
} labelObj;
/* WEB OBJECT - holds parameters for a mapserver/mapscript interface */
typedef struct {
char *log;
char *imagepath, *imageurl;
struct map_obj *map;
#ifndef __cplusplus
char *template;
#else
char *_template;
#endif
char *header, *footer;
char *empty, *error; /* error handling */
rectObj extent; /* clipping extent */
double minscale, maxscale;
char *mintemplate, *maxtemplate;
char *queryformat; /* what format is the query to be returned, given as a MIME type */
char *legendformat;
char *browseformat;
hashTableObj metadata;
} webObj;
/* STYLE OBJECT - holds parameters for symbolization, multiple styles may be applied within a classObj */
typedef struct {
colorObj color;
colorObj backgroundcolor;
colorObj outlinecolor;
/* Stuff to handle Color Range Styles */
colorObj mincolor;
colorObj maxcolor;
double minvalue;
double maxvalue;
char *rangeitem;
int rangeitemindex;
int symbol;
char *symbolname;
int size;
int minsize, maxsize;
int width;
int minwidth, maxwidth;
int offsetx, offsety; /* for shadows, hollow symbols, etc... */
double angle; /* for future use */
int antialias;
#ifndef SWIG
/* Whether the style is within a class MS_TRUE or MS_FALSE.
* If true, then memory deallocation is handled by the class
* if false, then memory deallocation must be handled by the
* application.
*/
int isachild;
#endif
char *angleitem, *sizeitem;
#ifndef SWIG
int angleitemindex, sizeitemindex;
#endif
} styleObj;
/* CLASS OBJECT - basic symbolization and classification information */
typedef struct class_obj{
#ifndef SWIG
expressionObj expression; /* the expression to be matched */
#endif
int status;
#ifndef SWIG
styleObj *styles;
#endif
int numstyles;
labelObj label;
char *name; /* should be unique within a layer */
char *title; /* used for legend labeling */
#ifndef SWIG
expressionObj text;
#endif /* not SWIG */
#ifndef __cplusplus
char *template;
#else /* __cplusplus */
char *_template;
#endif /* __cplusplus */
int type;
hashTableObj metadata;
double minscale, maxscale;
struct layer_obj *layer;
int debug;
char *keyimage;
} classObj;
/* LABELCACHE OBJECTS - structures to implement label caching and collision avoidance etc
Note: These are scriptable, but are read only. */
#ifdef SWIG
%immutable;
#endif /* SWIG */
typedef struct {
char *text;
double featuresize;
styleObj *styles; /* copied from the classObj, only present if there is a marker to be drawn */
int numstyles;
labelObj label; /* copied from the classObj */
int layerindex; /* indexes */
int classindex;
int tileindex;
int shapeindex;
pointObj point; /* label point */
shapeObj *poly; /* label bounding box */
int status; /* has this label been drawn or not */
labelPathObj *labelpath; /* Path & bounds of curved labels. Bug #1620 implementation */
} labelCacheMemberObj;
typedef struct {
int id; /* corresponding label */
shapeObj *poly; /* marker bounding box (POINT layers only) */
} markerCacheMemberObj;
typedef struct {
labelCacheMemberObj *labels;
int numlabels;
int cachesize;
markerCacheMemberObj *markers;
int nummarkers;
int markercachesize;
} labelCacheObj;
typedef struct {
long shapeindex;
int tileindex;
int classindex;
} resultCacheMemberObj;
#ifdef SWIG
%mutable;
#endif /* SWIG */
typedef struct {
#ifndef SWIG
resultCacheMemberObj *results;
int cachesize;
#endif /* not SWIG */
#ifdef SWIG
%immutable;
#endif /* SWIG */
int numresults;
rectObj bounds;
#ifdef SWIG
%mutable;
#endif /* SWIG */
} resultCacheObj;
/* SYMBOLSET OBJECT */
typedef struct {
char *filename;
int imagecachesize;
#ifdef SWIG
%immutable;
#endif /* SWIG */
int numsymbols;
#ifdef SWIG
%mutable;
#endif /* SWIG */
symbolObj symbol[MS_MAXSYMBOLS];
#ifndef SWIG
struct map_obj *map;
fontSetObj *fontset; /* a pointer to the main mapObj version */
struct imageCacheObj *imagecache;
#endif /* not SWIG */
} symbolSetObj;
/* REFERENCE MAP OBJECT */
typedef struct {
rectObj extent;
int height, width;
colorObj color;
colorObj outlinecolor;
char *image;
int status;
int marker;
char *markername;
int markersize;
int minboxsize;
int maxboxsize;
struct map_obj *map;
} referenceMapObj;
/* SCALEBAR OBJECT */
typedef struct {
colorObj imagecolor;
int height, width;
int style;
int intervals;
labelObj label;
colorObj color;
colorObj backgroundcolor;
colorObj outlinecolor;
int units;
int status; /* ON, OFF or EMBED */
int position; /* for embeded scalebars */
#ifndef SWIG
int transparent;
int interlace;
#endif /* not SWIG */
int postlabelcache;
} scalebarObj;
/* LEGEND OBJECT */
typedef struct {
colorObj imagecolor;
labelObj label;
int keysizex, keysizey;
int keyspacingx, keyspacingy;
colorObj outlinecolor; /* Color of outline of box, -1 for no outline */
int status; /* ON, OFF or EMBED */
int height, width;
int position; /* for embeded legends */
#ifndef SWIG
int transparent;
int interlace;
#endif /* not SWIG */
int postlabelcache;
#ifndef __cplusplus
char *template;
#else /* __cplusplus */
char *_template;
#endif /* __cplusplus */
struct map_obj *map;
} legendObj;
#ifndef SWIG
typedef struct
{
double dwhichlatitude;
double dwhichlongitude;
double dstartlatitude;
double dstartlongitude;
double dendlatitude;
double dendlongitude;
double dincrementlatitude;
double dincrementlongitude;
double minarcs;
double maxarcs;
double minincrement;
double maxincrement;
double minsubdivides;
double maxsubdivides;
int bvertical;
int blabelaxes;
int ilabelstate;
int ilabeltype;
rectObj extent;
lineObj *pboundinglines;
pointObj *pboundingpoints;
char *labelformat;
} graticuleObj;
struct layerVTable;
typedef struct layerVTable layerVTableObj;
#endif /*SWIG*/
/* LAYER OBJECT - basic unit of a map */
typedef struct layer_obj {
char *classitem; /* .DBF item to be used for symbol lookup */
#ifndef SWIG
int classitemindex;
resultCacheObj *resultcache; /* holds the results of a query against this layer */
int annotate; /* boolean flag for annotation */
double scalefactor; /* computed, not set */
#ifndef __cplusplus
classObj *class; /* always at least 1 class */
#else /* __cplusplus */
classObj *_class;
#endif /* __cplusplus */
#endif /* not SWIG */
#ifdef SWIG
%immutable;
#endif /* SWIG */
int numclasses;
int index;
struct map_obj *map;
#ifdef SWIG
%mutable;
#endif /* SWIG */
char *header, *footer; /* only used with multi result queries */
#ifndef __cplusplus
char *template; /* global template, used across all classes */
#else /* __cplusplus */
char *_template;
#endif /* __cplusplus */
char *name; /* should be unique */
char *group; /* shouldn't be unique it's supposed to be a group right? */
int status; /* on or off */
char *data; /* filename, can be relative or full path */
enum MS_LAYER_TYPE type;
double tolerance; /* search buffer for point and line queries (in toleranceunits) */
int toleranceunits;
double symbolscale; /* scale at which symbols are default size */
double minscale, maxscale;
double labelminscale, labelmaxscale;
int sizeunits; /* applies to all classes */
int maxfeatures;
colorObj offsite; /* transparent pixel value for raster images */
int transform; /* does this layer have to be transformed to file coordinates */
int labelcache, postlabelcache; /* on or off */
char *labelitem, *labelsizeitem, *labelangleitem;
int labelitemindex, labelsizeitemindex, labelangleitemindex;
char *tileitem;
char *tileindex; /* layer index file for tiling support */
#ifndef SWIG
int tileitemindex;
projectionObj projection; /* projection information for the layer */
int project; /* boolean variable, do we need to project this layer or not */
#endif /* not SWIG */
int units; /* units of the projection */
#ifndef SWIG
featureListNodeObjPtr features; /* linked list so we don't need a counter */
featureListNodeObjPtr currentfeature; /* pointer to the current feature */
#endif /* SWIG */
char *connection;
char *plugin_library;
char *plugin_library_original; /* this is needed for mapfile writing */
enum MS_CONNECTION_TYPE connectiontype;