~ubuntu-branches/ubuntu/saucy/mapserver/saucy-security

« back to all changes in this revision

Viewing changes to mapscript/php/php_mapscript.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-12-23 14:02:06 UTC
  • mfrom: (26.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111223140206-n3h9t2hsa8hyslmu
Tags: 6.0.1-2
Added missed stuff for libmapscript-perl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************************************
 
2
 * $Id: php_mapscript.h 11619 2011-04-27 15:23:07Z aboudreault $
 
3
 *
 
4
 * Project:  MapServer
 
5
 * Purpose:  PHP/MapScript extension for MapServer. Header file 
 
6
 *           - prototypes / module definitions
 
7
 * Author:   Daniel Morissette, DM Solutions Group (dmorissette@dmsolutions.ca)
 
8
 *
 
9
 **********************************************************************
 
10
 * Copyright (c) 2000-2005, Daniel Morissette, DM Solutions Group Inc.
 
11
 *
 
12
 * Permission is hereby granted, free of charge, to any person obtaining a
 
13
 * copy of this software and associated documentation files (the "Software"),
 
14
 * to deal in the Software without restriction, including without limitation
 
15
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
16
 * and/or sell copies of the Software, and to permit persons to whom the
 
17
 * Software is furnished to do so, subject to the following conditions:
 
18
 * 
 
19
 * The above copyright notice and this permission notice shall be included in 
 
20
 * all copies of this Software or works derived from this Software.
 
21
 * 
 
22
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
23
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
24
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
25
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
26
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
27
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 
28
 * DEALINGS IN THE SOFTWARE.
 
29
 **********************************************************************/
 
30
 
 
31
 
 
32
#ifndef PHP_MAPSCRIPT_H
 
33
#define PHP_MAPSCRIPT_H
 
34
 
 
35
#include "php.h"
 
36
#include "zend_interfaces.h"
 
37
#include "php_mapscript_util.h"
 
38
 
 
39
#ifdef USE_PHP_REGEX
 
40
#include <stdio.h>
 
41
#include <stdlib.h>
 
42
#include <string.h>
 
43
#include <math.h>
 
44
 
 
45
#if defined(_WIN32) && !defined(__CYGWIN__)
 
46
#include <direct.h>
 
47
#include <memory.h>
 
48
#include <malloc.h>
 
49
#else
 
50
#include <unistd.h>
 
51
#endif
 
52
 
 
53
#include "mapserver.h"
 
54
#include "mapregex.h"
 
55
#endif /* USE_PHP_REGEX */
 
56
 
 
57
 
 
58
#include "maptemplate.h"
 
59
#include "mapogcsld.h"
 
60
 
 
61
#define MAPSCRIPT_VERSION "($Revision: 11619 $ $Date: 2011-04-27 11:23:07 -0400 (Wed, 27 Apr 2011) $)"
 
62
 
 
63
extern zend_module_entry mapscript_module_entry;
 
64
#define phpext_mapscript_ptr &mapscript_module_entry
 
65
 
 
66
#ifndef zend_parse_parameters_none
 
67
#define zend_parse_parameters_none()                      \
 
68
        zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "")
 
69
#endif
 
70
 
 
71
#ifndef Z_ADDREF_P
 
72
#define Z_ADDREF_P(pz)                (pz)->refcount++
 
73
#endif
 
74
 
 
75
#ifndef Z_DELREF_P
 
76
#define Z_DELREF_P(pz)                (pz)->refcount--
 
77
#endif
 
78
 
 
79
#ifndef Z_SET_REFCOUNT_P
 
80
#define Z_SET_REFCOUNT_P(pz, rc)      (pz)->refcount = rc
 
81
#endif
 
82
 
 
83
/* Taken from the CAIRO php extension */
 
84
/* turn error handling to exception mode and restore */
 
85
#if defined(PHP_VERSION_ID) && PHP_VERSION_ID >= 50300
 
86
/* 5.3 version of the macros */
 
87
#define PHP_MAPSCRIPT_ERROR_HANDLING(force_exceptions) \
 
88
        zend_error_handling error_handling; \
 
89
        if(force_exceptions || getThis()) { \
 
90
                zend_replace_error_handling(EH_THROW, mapscript_ce_mapscriptexception, &error_handling TSRMLS_CC); \
 
91
        }
 
92
 
 
93
#define PHP_MAPSCRIPT_RESTORE_ERRORS(force_exceptions) \
 
94
        if(force_exceptions || getThis()) { \
 
95
                zend_restore_error_handling(&error_handling TSRMLS_CC); \
 
96
        }
 
97
 
 
98
#else
 
99
/* 5.2 versions of the macros */
 
100
#define PHP_MAPSCRIPT_ERROR_HANDLING(force_exceptions) \
 
101
        if(force_exceptions || getThis()) { \
 
102
                php_set_error_handling(EH_THROW, mapscript_ce_mapscriptexception TSRMLS_CC); \
 
103
        }
 
104
 
 
105
#define PHP_MAPSCRIPT_RESTORE_ERRORS(force_exceptions) \
 
106
        if(force_exceptions || getThis()) { \
 
107
                php_std_error_handling(); \
 
108
        }
 
109
 
 
110
#endif
 
111
 
 
112
/* MapScript objects */
 
113
typedef struct _parent_object {
 
114
    zval *val; // the zval of the parent
 
115
    zval **child_ptr; // a ptr to a parent property, which point to the child object.
 
116
                           // should be set to NULL when the child is destroyed
 
117
} parent_object;
 
118
 
 
119
typedef struct _php_color_object {
 
120
    zend_object std;
 
121
    parent_object parent;
 
122
    colorObj *color;
 
123
} php_color_object;
 
124
 
 
125
typedef struct _php_rect_object {
 
126
    zend_object std;
 
127
    parent_object parent;
 
128
    int is_ref;
 
129
    rectObj *rect;
 
130
} php_rect_object;
 
131
 
 
132
typedef struct _php_hashtable_object {
 
133
    zend_object std;
 
134
    parent_object parent;
 
135
    hashTableObj *hashtable;
 
136
} php_hashtable_object;
 
137
 
 
138
typedef struct _php_symbol_object {
 
139
    zend_object std;
 
140
    parent_object parent;
 
141
    symbolObj *symbol;
 
142
} php_symbol_object;
 
143
 
 
144
typedef struct _php_class_object {
 
145
    zend_object std;
 
146
    parent_object parent; //old layer
 
147
    zval *metadata;
 
148
    zval *label;
 
149
    classObj *class;
 
150
} php_class_object;
 
151
 
 
152
typedef struct _php_image_object {
 
153
    zend_object std;
 
154
    imageObj *image;
 
155
} php_image_object;
 
156
 
 
157
typedef struct _php_web_object {
 
158
    zend_object std;
 
159
    parent_object parent;
 
160
    zval *extent;
 
161
    zval *metadata;
 
162
    webObj *web;
 
163
} php_web_object;
 
164
 
 
165
typedef struct _php_legend_object {
 
166
    zend_object std;
 
167
    parent_object parent;
 
168
    zval *outlinecolor;
 
169
    zval *label;
 
170
    zval *imagecolor;
 
171
    legendObj *legend;
 
172
} php_legend_object;
 
173
 
 
174
typedef struct _php_outputformat_object {
 
175
    zend_object std;
 
176
    parent_object parent;
 
177
    outputFormatObj *outputformat;
 
178
} php_outputformat_object;
 
179
 
 
180
typedef struct _php_querymap_object {
 
181
    zend_object std;
 
182
    parent_object parent;
 
183
    zval *color;
 
184
    queryMapObj *querymap;
 
185
} php_querymap_object;
 
186
 
 
187
typedef struct _php_grid_object {
 
188
    zend_object std;
 
189
    parent_object parent;
 
190
    graticuleObj *grid;
 
191
} php_grid_object;
 
192
 
 
193
typedef struct _php_error_object {
 
194
    zend_object std;
 
195
    errorObj *error;
 
196
} php_error_object;
 
197
 
 
198
typedef struct _php_referencemap_object {
 
199
    zend_object std;
 
200
    parent_object parent;
 
201
    zval *extent;
 
202
    zval *color;
 
203
    zval *outlinecolor;
 
204
    referenceMapObj *referencemap;
 
205
} php_referencemap_object;
 
206
 
 
207
typedef struct _php_label_object {
 
208
    zend_object std;
 
209
    parent_object parent;
 
210
    zval *color;
 
211
    zval *outlinecolor;
 
212
    zval *shadowcolor;
 
213
    zval *backgroundcolor;
 
214
    zval *backgroundshadowcolor;
 
215
    labelObj *label;
 
216
} php_label_object;
 
217
 
 
218
typedef struct _php_style_object {
 
219
    zend_object std;
 
220
    parent_object parent;
 
221
    zval *color;
 
222
    zval *outlinecolor;
 
223
    zval *backgroundcolor;
 
224
    styleObj *style;
 
225
} php_style_object;
 
226
 
 
227
typedef struct _php_projection_object {
 
228
    zend_object std;
 
229
    parent_object parent;
 
230
    int is_ref;
 
231
    projectionObj *projection;
 
232
} php_projection_object;
 
233
 
 
234
typedef struct _php_point_object {
 
235
    zend_object std;
 
236
    parent_object parent;
 
237
    int is_ref;
 
238
    pointObj *point;
 
239
} php_point_object;
 
240
 
 
241
typedef struct _php_line_object {
 
242
    zend_object std;
 
243
    parent_object parent;
 
244
    int is_ref;
 
245
    lineObj *line;
 
246
} php_line_object;
 
247
 
 
248
typedef struct _php_shape_object {
 
249
    zend_object std;
 
250
    parent_object parent;
 
251
    zval *bounds;
 
252
    zval *values;
 
253
    int is_ref;
 
254
    shapeObj *shape;
 
255
} php_shape_object;
 
256
 
 
257
typedef struct _php_shapefile_object {
 
258
    zend_object std;
 
259
    zval *bounds;
 
260
    shapefileObj *shapefile;
 
261
} php_shapefile_object;
 
262
 
 
263
typedef struct _php_labelcache_object {
 
264
    zend_object std;
 
265
    parent_object parent;
 
266
    labelCacheObj *labelcache;
 
267
} php_labelcache_object;
 
268
 
 
269
typedef struct _php_labelcachemember_object {
 
270
    zend_object std;
 
271
    parent_object parent;
 
272
    zval *label; /* should be immutable */
 
273
    zval *point; /* should be immutable */
 
274
    zval *styles; /* should be immutable */
 
275
    zval *poly; /* should be immutable */
 
276
    labelCacheMemberObj *labelcachemember;
 
277
} php_labelcachemember_object;
 
278
 
 
279
typedef struct _php_result_object {
 
280
    zend_object std;
 
281
    parent_object parent;
 
282
    resultObj *result;
 
283
} php_result_object;
 
284
 
 
285
typedef struct _php_scalebar_object {
 
286
    zend_object std;
 
287
    parent_object parent;
 
288
    zval *color;
 
289
    zval *backgroundcolor;
 
290
    zval *outlinecolor;
 
291
    zval *label;
 
292
    zval *imagecolor;
 
293
    scalebarObj *scalebar;
 
294
} php_scalebar_object;
 
295
 
 
296
typedef struct _php_owsrequest_object {
 
297
    zend_object std;
 
298
    cgiRequestObj *cgirequest;
 
299
} php_owsrequest_object;
 
300
 
 
301
typedef struct _php_layer_object {
 
302
    zend_object std;
 
303
    parent_object parent; //old map
 
304
    zval *offsite;
 
305
    zval *grid;
 
306
    zval *metadata;
 
307
    zval *bindvals;
 
308
    zval *projection;
 
309
    zval *cluster;
 
310
    int is_ref;
 
311
    layerObj *layer;
 
312
} php_layer_object;
 
313
 
 
314
typedef struct _php_map_object {
 
315
    zend_object std;
 
316
    zval *outputformat;
 
317
    zval *extent;
 
318
    zval *web;
 
319
    zval *reference;
 
320
    zval *imagecolor;
 
321
    zval *scalebar;
 
322
    zval *legend;
 
323
    zval *querymap;
 
324
    zval *labelcache;
 
325
    zval *projection;
 
326
    zval *metadata;
 
327
    mapObj *map;
 
328
} php_map_object;
 
329
 
 
330
typedef struct _php_cluster_object {
 
331
    zend_object std;
 
332
    parent_object parent;
 
333
    int is_ref;
 
334
    clusterObj *cluster;
 
335
} php_cluster_object;
 
336
 
 
337
/* Lifecyle functions*/
 
338
PHP_MINIT_FUNCTION(mapscript);
 
339
PHP_MINFO_FUNCTION(mapscript);
 
340
PHP_MSHUTDOWN_FUNCTION(mapscript);
 
341
PHP_RINIT_FUNCTION(mapscript);
 
342
PHP_RSHUTDOWN_FUNCTION(mapscript);
 
343
 
 
344
PHP_MINIT_FUNCTION(mapscript_error);
 
345
PHP_MINIT_FUNCTION(color);
 
346
PHP_MINIT_FUNCTION(label);
 
347
PHP_MINIT_FUNCTION(style);
 
348
PHP_MINIT_FUNCTION(symbol);
 
349
PHP_MINIT_FUNCTION(image);
 
350
PHP_MINIT_FUNCTION(web);
 
351
PHP_MINIT_FUNCTION(legend);
 
352
PHP_MINIT_FUNCTION(outputformat);
 
353
PHP_MINIT_FUNCTION(querymap);
 
354
PHP_MINIT_FUNCTION(grid);
 
355
PHP_MINIT_FUNCTION(error);
 
356
PHP_MINIT_FUNCTION(referencemap);
 
357
PHP_MINIT_FUNCTION(class);
 
358
PHP_MINIT_FUNCTION(projection);
 
359
PHP_MINIT_FUNCTION(labelcachemember);
 
360
PHP_MINIT_FUNCTION(labelcache);
 
361
PHP_MINIT_FUNCTION(result);
 
362
PHP_MINIT_FUNCTION(scalebar);
 
363
PHP_MINIT_FUNCTION(owsrequest);
 
364
PHP_MINIT_FUNCTION(point);
 
365
PHP_MINIT_FUNCTION(rect);
 
366
PHP_MINIT_FUNCTION(hashtable);
 
367
PHP_MINIT_FUNCTION(line);
 
368
PHP_MINIT_FUNCTION(shape);
 
369
PHP_MINIT_FUNCTION(shapefile);
 
370
PHP_MINIT_FUNCTION(layer);
 
371
PHP_MINIT_FUNCTION(map);
 
372
PHP_MINIT_FUNCTION(cluster);
 
373
 
 
374
/* mapscript functions */
 
375
PHP_FUNCTION(ms_GetVersion);
 
376
PHP_FUNCTION(ms_GetVersionInt);
 
377
PHP_FUNCTION(ms_GetErrorObj);
 
378
PHP_FUNCTION(ms_ResetErrorList);
 
379
PHP_FUNCTION(ms_getCwd);
 
380
PHP_FUNCTION(ms_getPid);
 
381
PHP_FUNCTION(ms_getScale);
 
382
PHP_FUNCTION(ms_tokenizeMap);
 
383
PHP_FUNCTION(ms_ioInstallStdoutToBuffer);
 
384
PHP_FUNCTION(ms_ioInstallStdinFromBuffer);
 
385
PHP_FUNCTION(ms_ioGetStdoutBufferString);
 
386
PHP_FUNCTION(ms_ioResetHandlers);
 
387
PHP_FUNCTION(ms_ioStripStdoutBufferContentType);
 
388
PHP_FUNCTION(ms_ioGetStdoutBufferBytes);
 
389
 
 
390
/* object constructors */
 
391
PHP_FUNCTION(ms_newLineObj);
 
392
PHP_FUNCTION(ms_newRectObj);
 
393
PHP_FUNCTION(ms_newShapeObj);
 
394
PHP_FUNCTION(ms_shapeObjFromWkt);
 
395
PHP_FUNCTION(ms_newOWSRequestObj);
 
396
PHP_FUNCTION(ms_newShapeFileObj);
 
397
PHP_FUNCTION(ms_newMapObj);
 
398
PHP_FUNCTION(ms_newMapObjFromString);
 
399
PHP_FUNCTION(ms_newLayerObj);
 
400
PHP_FUNCTION(ms_newPointObj);
 
401
PHP_FUNCTION(ms_newProjectionObj);
 
402
PHP_FUNCTION(ms_newStyleObj);
 
403
PHP_FUNCTION(ms_newSymbolObj);
 
404
PHP_FUNCTION(ms_newClassObj);
 
405
PHP_FUNCTION(ms_newGridObj);
 
406
 
 
407
/* mapscript zend class entries */
 
408
extern zend_object_handlers mapscript_std_object_handlers;
 
409
extern zend_class_entry *mapscript_ce_mapscriptexception;
 
410
extern zend_class_entry *mapscript_ce_color;
 
411
extern zend_class_entry *mapscript_ce_label;
 
412
extern zend_class_entry *mapscript_ce_projection;
 
413
extern zend_class_entry *mapscript_ce_point;
 
414
extern zend_class_entry *mapscript_ce_rect;
 
415
extern zend_class_entry *mapscript_ce_hashtable;
 
416
extern zend_class_entry *mapscript_ce_style;
 
417
extern zend_class_entry *mapscript_ce_class;
 
418
extern zend_class_entry *mapscript_ce_symbol;
 
419
extern zend_class_entry *mapscript_ce_image;
 
420
extern zend_class_entry *mapscript_ce_web;
 
421
extern zend_class_entry *mapscript_ce_legend;
 
422
extern zend_class_entry *mapscript_ce_outputformat;
 
423
extern zend_class_entry *mapscript_ce_querymap;
 
424
extern zend_class_entry *mapscript_ce_grid;
 
425
extern zend_class_entry *mapscript_ce_error;
 
426
extern zend_class_entry *mapscript_ce_referencemap;
 
427
extern zend_class_entry *mapscript_ce_line;
 
428
extern zend_class_entry *mapscript_ce_shape;
 
429
extern zend_class_entry *mapscript_ce_shapefile;
 
430
extern zend_class_entry *mapscript_ce_labelcachemember;
 
431
extern zend_class_entry *mapscript_ce_labelcache;
 
432
extern zend_class_entry *mapscript_ce_result;
 
433
extern zend_class_entry *mapscript_ce_scalebar;
 
434
extern zend_class_entry *mapscript_ce_owsrequest;
 
435
extern zend_class_entry *mapscript_ce_layer;
 
436
extern zend_class_entry *mapscript_ce_map;
 
437
extern zend_class_entry *mapscript_ce_cluster;
 
438
 
 
439
/* PHP Object constructors */
 
440
extern zend_object_value mapscript_object_new(zend_object *zobj, zend_class_entry *ce,
 
441
                                              void (*zend_objects_free_object) TSRMLS_DC);
 
442
extern zend_object_value mapscript_object_new_ex(zend_object *zobj, zend_class_entry *ce,
 
443
                                                 void (*zend_objects_free_object),
 
444
                                                 zend_object_handlers *object_handlers TSRMLS_DC);
 
445
extern void mapscript_fetch_object(zend_class_entry *ce, zval* zval_parent, php_layer_object* layer, 
 
446
                                   void *internal_object, zval **php_object_storage, 
 
447
                                   zval ***return_value_ptr TSRMLS_DC);
 
448
extern void mapscript_create_color(colorObj *color, parent_object parent, zval *return_value TSRMLS_DC);
 
449
extern void mapscript_create_rect(rectObj *rect, parent_object php_parent, zval *return_value TSRMLS_DC);
 
450
extern void mapscript_create_hashtable(hashTableObj *hashtable, parent_object parent, zval *return_value TSRMLS_DC);
 
451
extern void mapscript_create_label(labelObj *label, parent_object parent, zval *return_value TSRMLS_DC);
 
452
extern void mapscript_create_style(styleObj *style, parent_object parent, zval *return_value TSRMLS_DC);
 
453
extern void mapscript_create_symbol(symbolObj *symbol, parent_object parent, zval *return_value TSRMLS_DC);
 
454
extern void mapscript_create_class(classObj *class, parent_object parent, zval *return_value TSRMLS_DC);
 
455
extern void mapscript_create_labelcachemember(labelCacheMemberObj *labelcachemember, 
 
456
                                              parent_object parent, zval *return_value TSRMLS_DC);
 
457
extern void mapscript_create_labelcache(labelCacheObj *labelcache, 
 
458
                                              parent_object parent, zval *return_value TSRMLS_DC);
 
459
extern void mapscript_create_result(resultObj *result, 
 
460
                                    parent_object parent, zval *return_value TSRMLS_DC);
 
461
extern void mapscript_create_scalebar(scalebarObj *scalebar, parent_object parent, zval *return_value TSRMLS_DC);
 
462
extern void mapscript_create_owsrequest(cgiRequestObj *cgirequest, zval *return_value TSRMLS_DC);
 
463
extern void mapscript_create_image(imageObj *image, zval *return_value TSRMLS_DC);
 
464
extern void mapscript_create_web(webObj *web, parent_object parent, zval *return_value TSRMLS_DC);
 
465
extern void mapscript_create_legend(legendObj *legend, parent_object parent, zval *return_value TSRMLS_DC);
 
466
extern void mapscript_create_outputformat(outputFormatObj *outputformat, parent_object parent, zval *return_value TSRMLS_DC);
 
467
extern void mapscript_create_querymap(queryMapObj *querymap, parent_object parent, zval *return_value TSRMLS_DC);
 
468
extern void mapscript_create_grid(graticuleObj *grid, parent_object parent, zval *return_value TSRMLS_DC);
 
469
extern void mapscript_create_error(errorObj *error, zval *return_value TSRMLS_DC);
 
470
extern void mapscript_create_referencemap(referenceMapObj *referenceMap, parent_object parent, zval *return_value TSRMLS_DC);
 
471
extern void mapscript_create_point(pointObj *point, parent_object parent, zval *return_value TSRMLS_DC);
 
472
extern void mapscript_create_projection(projectionObj *projection, 
 
473
                                        parent_object parent, zval *return_value TSRMLS_DC);
 
474
extern void mapscript_create_line(lineObj *line, parent_object parent, zval *return_value TSRMLS_DC);
 
475
extern void mapscript_create_shape(shapeObj *shape, parent_object parent, php_layer_object *php_layer, zval *return_value TSRMLS_DC);
 
476
extern void mapscript_create_shapefile(shapefileObj *shapefile, zval *return_value TSRMLS_DC);
 
477
extern void mapscript_create_layer(layerObj *layer, parent_object parent, zval *return_value TSRMLS_DC);
 
478
extern void mapscript_create_map(mapObj *map, zval *return_value TSRMLS_DC);
 
479
extern void mapscript_create_cluster(clusterObj *cluster, parent_object php_parent, zval *return_value TSRMLS_DC);
 
480
 
 
481
/* Exported functions for PHP Mapscript API */
 
482
/* throw a MapScriptException */
 
483
extern zval * mapscript_throw_exception(char *format TSRMLS_DC, ...);
 
484
/* print all MapServer errors (as Warning) and throw a MapScriptException */
 
485
extern zval* mapscript_throw_mapserver_exception(char *format TSRMLS_DC, ...);
 
486
extern void mapscript_report_mapserver_error(int error_type TSRMLS_DC);
 
487
extern void mapscript_report_php_error(int error_type, char *format TSRMLS_DC, ...);
 
488
 
 
489
/*=====================================================================
 
490
 *                   Internal functions from mapscript_i.c
 
491
 *====================================================================*/
 
492
 
 
493
mapObj         *mapObj_new(char *filename, char *new_path);
 
494
mapObj         *mapObj_newFromString(char *map_text, char *new_path);
 
495
void            mapObj_destroy(mapObj* self);
 
496
mapObj         *mapObj_clone(mapObj* self);
 
497
int             mapObj_setRotation(mapObj* self, double rotation_angle );
 
498
layerObj       *mapObj_getLayer(mapObj* self, int i);
 
499
layerObj       *mapObj_getLayerByName(mapObj* self, char *name);
 
500
int             *mapObj_getLayersIndexByGroup(mapObj* self, char *groupname, 
 
501
                                             int *pnCount);
 
502
int             mapObj_getSymbolByName(mapObj* self, char *name);
 
503
void            mapObj_prepareQuery(mapObj* self);
 
504
imageObj        *mapObj_prepareImage(mapObj* self);
 
505
imageObj        *mapObj_draw(mapObj* self);
 
506
imageObj        *mapObj_drawQuery(mapObj* self);
 
507
imageObj        *mapObj_drawLegend(mapObj* self);
 
508
imageObj        *mapObj_drawScalebar(mapObj* self);
 
509
imageObj        *mapObj_drawReferenceMap(mapObj* self);
 
510
int             mapObj_embedScalebar(mapObj* self, imageObj *img);
 
511
int             mapObj_embedLegend(mapObj* self, imageObj *img);
 
512
int             mapObj_drawLabelCache(mapObj* self, imageObj *img);
 
513
labelCacheMemberObj *mapObj_getLabel(mapObj* self, int i);
 
514
int             mapObj_queryByPoint(mapObj* self, pointObj *point, 
 
515
                                    int mode, double buffer);
 
516
int             mapObj_queryByRect(mapObj* self, rectObj rect);
 
517
int             mapObj_queryByFeatures(mapObj* self, int slayer);
 
518
int             mapObj_queryByShape(mapObj *self, shapeObj *shape);
 
519
int              mapObj_queryByIndex(mapObj *self, int qlayer, 
 
520
                                     int tileindex, int shapeindex,
 
521
                                     int bAddToQuery);
 
522
int             mapObj_saveQuery(mapObj *self, char *filename, int results);
 
523
int             mapObj_loadQuery(mapObj *self, char *filename);
 
524
 
 
525
int             mapObj_setWKTProjection(mapObj *self, char *string);
 
526
char*           mapObj_getProjection(mapObj* self);
 
527
int             mapObj_setProjection(mapObj* self, char *string);
 
528
int             mapObj_save(mapObj* self, char *filename);
 
529
char            *mapObj_getMetaData(mapObj *self, char *name);
 
530
int             mapObj_setMetaData(mapObj *self, char *name, char *value);
 
531
int             mapObj_removeMetaData(mapObj *self, char *name);
 
532
void            mapObj_freeQuery(mapObj *self, int qlayer);
 
533
int             mapObj_moveLayerup(mapObj *self, int layerindex);
 
534
int             mapObj_moveLayerdown(mapObj *self, int layerindex);
 
535
int             *mapObj_getLayersdrawingOrder(mapObj *self);
 
536
int             mapObj_setLayersdrawingOrder(mapObj *self, int *panIndexes);
 
537
 
 
538
char            *mapObj_processTemplate(mapObj *self, int bGenerateImages, 
 
539
                                        char **names, char **values, 
 
540
                                        int numentries);
 
541
char            *mapObj_processLegendTemplate(mapObj *self,
 
542
                                              char **names, char **values, 
 
543
                                              int numentries);
 
544
char            *mapObj_processQueryTemplate(mapObj *self,
 
545
                                             int bGenerateImages,
 
546
                                             char **names, char **values, 
 
547
                                             int numentries);
 
548
int             mapObj_setSymbolSet(mapObj *self, char *szFileName);
 
549
int             mapObj_getNumSymbols(mapObj *self);
 
550
int             mapObj_setFontSet(mapObj *self, char *szFileName);
 
551
int             mapObj_saveMapContext(mapObj *self, char *szFileName);
 
552
int             mapObj_loadMapContext(mapObj *self, char *szFileName,
 
553
                                      int bUniqueLayerName);
 
554
int             mapObj_selectOutputFormat(mapObj *self,
 
555
                                          const char *imagetype);
 
556
int             mapObj_applySLD(mapObj *self, char *sld);
 
557
int             mapObj_applySLDURL(mapObj *self, char *sld);
 
558
char            *mapObj_generateSLD(mapObj *self);
 
559
int             mapObj_loadOWSParameters(mapObj *self, cgiRequestObj *request, 
 
560
                                          char *wmtver_string);
 
561
int             mapObj_OWSDispatch(mapObj *self, cgiRequestObj *req );
 
562
int             mapObj_insertLayer(mapObj *self, layerObj *layer, int index);
 
563
layerObj        *mapObj_removeLayer(mapObj *self, int layerindex);
 
564
 
 
565
int             mapObj_setCenter(mapObj *self, pointObj *center);
 
566
int             mapObj_offsetExtent(mapObj *self, double x, double y);
 
567
int             mapObj_scaleExtent(mapObj *self, double zoomfactor, double minscaledenom, 
 
568
                                   double maxscaledenom);
 
569
 
 
570
layerObj       *layerObj_new(mapObj *map);
 
571
void            layerObj_destroy(layerObj* self);
 
572
int             layerObj_updateFromString(layerObj *self, char *snippet);
 
573
int             layerObj_open(layerObj *self);
 
574
int             layerObj_whichShapes(layerObj *self, rectObj *poRect);
 
575
shapeObj        *layerObj_nextShape(layerObj *self);
 
576
void            layerObj_close(layerObj *self);
 
577
int             layerObj_getShape(layerObj *self, shapeObj *shape,
 
578
                                  int tileindex, int shapeindex);
 
579
resultObj *layerObj_getResult(layerObj *self, int i);
 
580
classObj       *layerObj_getClass(layerObj *self, int i);
 
581
int layerObj_getClassIndex(layerObj *self, mapObj *map, shapeObj *shape, 
 
582
                           int *classgroup, int numclasses);
 
583
int             layerObj_draw(layerObj *self, mapObj *map, imageObj *img);
 
584
int             layerObj_drawQuery(layerObj *self, mapObj *map, imageObj *img);
 
585
int             layerObj_queryByAttributes(layerObj *self, mapObj *map, 
 
586
                                           char *qitem, char *qstring, 
 
587
                                           int mode);
 
588
int             layerObj_queryByPoint(layerObj *self, mapObj *map, 
 
589
                          pointObj *point, int mode, double buffer);
 
590
int             layerObj_queryByRect(layerObj *self, mapObj *map,rectObj rect);
 
591
int             layerObj_queryByFeatures(layerObj *self, mapObj *map, 
 
592
                                         int slayer);
 
593
int             layerObj_queryByShape(layerObj *self, mapObj *map, 
 
594
                                      shapeObj *shape);
 
595
int             layerObj_setFilter(layerObj *self, char *string);
 
596
char*           layerObj_getFilter(layerObj *self);
 
597
int             layerObj_setWKTProjection(layerObj *self, char *string);
 
598
char*           layerObj_getProjection(layerObj *self);
 
599
int             layerObj_setProjection(layerObj *self, char *string);
 
600
int             layerObj_addFeature(layerObj *self, shapeObj *shape);
 
601
char            *layerObj_getMetaData(layerObj *self, char *name);
 
602
int             layerObj_setMetaData(layerObj *self, char *name, char *value);
 
603
int             layerObj_removeMetaData(layerObj *self, char *name);
 
604
char            *layerObj_getWMSFeatureInfoURL(layerObj *self, mapObj *map, 
 
605
                                               int click_x, int click_y,     
 
606
                                               int feature_count, 
 
607
                                               char *info_format);
 
608
char            *layerObj_executeWFSGetFeature(layerObj *self);
 
609
int             layerObj_applySLD(layerObj *self, char *sld, char *stylelayer);
 
610
int             layerObj_applySLDURL(layerObj *self, char *sld, char *stylelayer);
 
611
char            *layerObj_generateSLD(layerObj *self);
 
612
int             layerObj_moveClassUp(layerObj *self, int index);
 
613
int             layerObj_moveClassDown(layerObj *self, int index);
 
614
classObj        *layerObj_removeClass(layerObj *self, int index);
 
615
int             layerObj_setConnectionType(layerObj *self, int connectiontype, 
 
616
                                           const char *library_str) ;
 
617
 
 
618
int             labelObj_updateFromString(labelObj *self, char *snippet);
 
619
 
 
620
int             legendObj_updateFromString(legendObj *self, char *snippet);
 
621
 
 
622
int             queryMapObj_updateFromString(queryMapObj *self, char *snippet);
 
623
 
 
624
int             referenceMapObj_updateFromString(referenceMapObj *self, char *snippet);
 
625
 
 
626
int             scalebarObj_updateFromString(scalebarObj *self, char *snippet);
 
627
 
 
628
int             webObj_updateFromString(webObj *self, char *snippet);
 
629
 
 
630
classObj       *classObj_new(layerObj *layer, classObj *class);
 
631
int             classObj_updateFromString(classObj *self, char *snippet);
 
632
void            classObj_destroy(classObj* self);
 
633
int             classObj_setExpression(classObj *self, char *string);
 
634
char            *classObj_getExpressionString(classObj *self);
 
635
int             classObj_setText(classObj *self,layerObj *layer,char *string);
 
636
char           *classObj_getTextString(classObj *self);
 
637
int             classObj_drawLegendIcon(classObj *self,
 
638
                                        mapObj *map,
 
639
                                        layerObj *layer, 
 
640
                                        int width, int height, 
 
641
                                        imageObj *im, 
 
642
                                        int dstX, int dstY);
 
643
imageObj       *classObj_createLegendIcon(classObj *self, 
 
644
                                          mapObj *map, 
 
645
                                          layerObj *layer, 
 
646
                                          int width, int height);
 
647
int             classObj_setSymbolByName(classObj *self,
 
648
                                         mapObj *map,
 
649
                                         char *pszSymbolName);
 
650
int             classObj_setOverlaySymbolByName(classObj *self,
 
651
                                                mapObj *map,
 
652
                                                char *pszOverlaySymbolName);
 
653
classObj        *classObj_clone(classObj *class, layerObj *layer);
 
654
int             classObj_moveStyleUp(classObj *self, int index);
 
655
int             classObj_moveStyleDown(classObj *self, int index);
 
656
int             classObj_deleteStyle(classObj *self, int index);
 
657
char            *classObj_getMetaData(classObj *self, char *name);
 
658
int             classObj_setMetaData(classObj *self, char *name, char *value);
 
659
int             classObj_removeMetaData(classObj *self, char *name);
 
660
 
 
661
pointObj       *pointObj_new();
 
662
void            pointObj_destroy(pointObj *self);
 
663
int             pointObj_project(pointObj *self, projectionObj *in, 
 
664
                                 projectionObj *out);
 
665
int             pointObj_draw(pointObj *self, mapObj *map, layerObj *layer, 
 
666
                              imageObj *img, int class_index, 
 
667
                              char *label_string);
 
668
double          pointObj_distanceToPoint(pointObj *self, pointObj *point);
 
669
double          pointObj_distanceToLine(pointObj *self, pointObj *a, 
 
670
                                        pointObj *b);
 
671
double          pointObj_distanceToShape(pointObj *self, shapeObj *shape);
 
672
 
 
673
 
 
674
lineObj        *lineObj_new();
 
675
void            lineObj_destroy(lineObj *self);
 
676
int             lineObj_project(lineObj *self, projectionObj *in, 
 
677
                                projectionObj *out);
 
678
pointObj       *lineObj_get(lineObj *self, int i);
 
679
int             lineObj_add(lineObj *self, pointObj *p);
 
680
 
 
681
 
 
682
shapeObj       *shapeObj_new(int type);
 
683
void            shapeObj_destroy(shapeObj *self);
 
684
int             shapeObj_project(shapeObj *self, projectionObj *in, 
 
685
                                 projectionObj *out);
 
686
lineObj        *shapeObj_get(shapeObj *self, int i);
 
687
int             shapeObj_add(shapeObj *self, lineObj *line);
 
688
int             shapeObj_draw(shapeObj *self, mapObj *map, layerObj *layer, 
 
689
                              imageObj *img);
 
690
void            shapeObj_setBounds(shapeObj *self);
 
691
int             shapeObj_copy(shapeObj *self, shapeObj *dest);
 
692
int             shapeObj_contains(shapeObj *self, pointObj *point);
 
693
int             shapeObj_intersects(shapeObj *self, shapeObj *shape);
 
694
pointObj        *shapeObj_getpointusingmeasure(shapeObj *self, double m);
 
695
pointObj        *shapeObj_getmeasureusingpoint(shapeObj *self, pointObj *point);
 
696
 
 
697
shapeObj        *shapeObj_buffer(shapeObj *self, double width);
 
698
shapeObj        *shapeObj_simplify(shapeObj *self, double tolerance);
 
699
shapeObj        *shapeObj_topologypreservingsimplify(shapeObj *self, double tolerance);
 
700
shapeObj        *shapeObj_convexHull(shapeObj *self);
 
701
shapeObj        *shapeObj_boundary(shapeObj *self);
 
702
int             shapeObj_contains_geos(shapeObj *self, shapeObj *poshape);
 
703
shapeObj        *shapeObj_Union(shapeObj *self, shapeObj *poshape);
 
704
shapeObj        *shapeObj_intersection(shapeObj *self, shapeObj *poshape);
 
705
shapeObj        *shapeObj_difference(shapeObj *self, shapeObj *poshape);
 
706
shapeObj        *shapeObj_symdifference(shapeObj *self, shapeObj *poshape);
 
707
int             shapeObj_overlaps(shapeObj *self, shapeObj *shape);
 
708
int             shapeObj_within(shapeObj *self, shapeObj *shape);
 
709
int             shapeObj_crosses(shapeObj *self, shapeObj *shape);
 
710
int             shapeObj_touches(shapeObj *self, shapeObj *shape);
 
711
int             shapeObj_equals(shapeObj *self, shapeObj *shape);
 
712
int             shapeObj_disjoint(shapeObj *self, shapeObj *shape);
 
713
pointObj        *shapeObj_getcentroid(shapeObj *self);
 
714
double          shapeObj_getarea(shapeObj *self);
 
715
double          shapeObj_getlength(shapeObj *self);
 
716
pointObj        *shapeObj_getLabelPoint(shapeObj *self);
 
717
 
 
718
rectObj        *rectObj_new();
 
719
void            rectObj_destroy(rectObj *self);
 
720
int             rectObj_project(rectObj *self, projectionObj *in, 
 
721
                                projectionObj *out);
 
722
double          rectObj_fit(rectObj *self, int width, int height);
 
723
int             rectObj_draw(rectObj *self, mapObj *map, layerObj *layer,
 
724
                             imageObj *img, int classindex, char *text);
 
725
 
 
726
 
 
727
shapefileObj   *shapefileObj_new(char *filename, int type);
 
728
void            shapefileObj_destroy(shapefileObj *self);
 
729
int             shapefileObj_get(shapefileObj *self, int i, shapeObj *shape);
 
730
int             shapefileObj_getPoint(shapefileObj *self, int i, pointObj *point);
 
731
int             shapefileObj_getTransformed(shapefileObj *self, mapObj *map, 
 
732
                                            int i, shapeObj *shape);
 
733
void            shapefileObj_getExtent(shapefileObj *self, int i, 
 
734
                                       rectObj *rect);
 
735
int             shapefileObj_add(shapefileObj *self, shapeObj *shape);
 
736
int             shapefileObj_addPoint(shapefileObj *self, pointObj *point);
 
737
 
 
738
projectionObj   *projectionObj_new(char *string);
 
739
int             projectionObj_getUnits(projectionObj *self);
 
740
void            projectionObj_destroy(projectionObj *self);
 
741
 
 
742
void            labelCacheObj_freeCache(labelCacheObj *self);
 
743
 
 
744
char           *DBFInfo_getFieldName(DBFInfo *self, int iField);
 
745
int             DBFInfo_getFieldWidth(DBFInfo *self, int iField);
 
746
int             DBFInfo_getFieldDecimals(DBFInfo *self, int iField);
 
747
DBFFieldType    DBFInfo_getFieldType(DBFInfo *self, int iField);
 
748
 
 
749
styleObj       *styleObj_new(classObj *class, styleObj *style);
 
750
int             styleObj_updateFromString(styleObj *self, char *snippet);
 
751
int             styleObj_setSymbolByName(styleObj *self, mapObj *map, 
 
752
                                         char* pszSymbolName);
 
753
styleObj       *styleObj_clone(styleObj *style);
 
754
void           styleObj_setGeomTransform(styleObj *style, char *transform);
 
755
 
 
756
hashTableObj   *hashTableObj_new();
 
757
int             hashTableObj_set(hashTableObj *self, const char *key, 
 
758
                                 const char *value);
 
759
const char     *hashTableObj_get(hashTableObj *self, const char *key);
 
760
int            hashTableObj_remove(hashTableObj *self, const char *key);
 
761
void           hashTableObj_clear(hashTableObj *self);
 
762
char           *hashTableObj_nextKey(hashTableObj *self, const char *prevkey);
 
763
 
 
764
 
 
765
cgiRequestObj *cgirequestObj_new();
 
766
int cgirequestObj_loadParams(cgiRequestObj *self, 
 
767
                             char* (*getenv2)(const char*, void* thread_context), 
 
768
                             char *raw_post_data,
 
769
                             ms_uint32 raw_post_data_length,
 
770
                             void* thread_context);
 
771
void cgirequestObj_setParameter(cgiRequestObj *self, char *name, char *value);
 
772
char *cgirequestObj_getName(cgiRequestObj *self, int index);
 
773
char *cgirequestObj_getValue(cgiRequestObj *self, int index);
 
774
char *cgirequestObj_getValueByName(cgiRequestObj *self, const char *name);
 
775
void cgirequestObj_destroy(cgiRequestObj *self);
 
776
 
 
777
resultObj *resultObj_new();
 
778
 
 
779
int clusterObj_updateFromString(clusterObj *self, char *snippet);
 
780
int clusterObj_setGroup(clusterObj *self, char *string);
 
781
char *clusterObj_getGroupString(clusterObj *self);
 
782
int clusterObj_setFilter(clusterObj *self, char *string);
 
783
char *clusterObj_getFilterString(clusterObj *self);
 
784
 
 
785
#endif /* PHP_MAPSCRIPT_H */