forked from dmorissette/mapserver
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mapdummyrenderer.c
286 lines (245 loc) · 9.37 KB
/
mapdummyrenderer.c
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
/******************************************************************************
* $Id$
*
* Project: MapServer
* Purpose: Dummy functions to implement when using a pluggable renderer
* Author: Thomas Bonfort, [email protected]
*
******************************************************************************
* Copyright (c) 2010, Thomas Bonfort
*
* 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.
*****************************************************************************/
#include "mapserver.h"
int renderLineDummy(imageObj *img, shapeObj *p, strokeStyleObj *style)
{
msSetError(MS_RENDERERERR,"renderLine not implemented","renderLine()");
return MS_FAILURE;
}
int renderPolygonDummy(imageObj *img, shapeObj *p, colorObj *color)
{
msSetError(MS_RENDERERERR,"renderPolygon not implemented","renderPolygon()");
return MS_FAILURE;
}
int renderPolygonTiledDummy(imageObj *img, shapeObj *p, imageObj *tile)
{
msSetError(MS_RENDERERERR,"renderPolygonTiled not implemented","renderPolygonTiled()");
return MS_FAILURE;
}
int renderLineTiledDummy(imageObj *img, shapeObj *p, imageObj *tile)
{
msSetError(MS_RENDERERERR,"renderLineTiled not implemented","renderLineTiled()");
return MS_FAILURE;
}
int renderRasterGlyphsDummy(imageObj *img, double x, double y, int fontIndex,
colorObj *color, char* text)
{
msSetError(MS_RENDERERERR,"renderRasterGlyphs not implemented","renderRasterGlyphs()");
return MS_FAILURE;
}
int renderGlyphsLineDummy(imageObj *img,labelPathObj *labelpath,
labelStyleObj *style, char *text)
{
msSetError(MS_RENDERERERR,"renderGlyphsLine not implemented","renderGlyphsLine()");
return MS_FAILURE;
}
int renderVectorSymbolDummy(imageObj *img, double x, double y,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"renderVectorSymbol not implemented","renderVectorSymbol()");
return MS_FAILURE;
}
void* createVectorSymbolTileDummy(int width, int height,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"createVectorSymbolTile not implemented","createVectorSymbolTile()");
return NULL;
}
int renderPixmapSymbolDummy(imageObj *img, double x, double y,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"renderPixmapSymbol not implemented","renderPixmapSymbol()");
return MS_FAILURE;
}
void* createPixmapSymbolTileDummy(int width, int height,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"createPixmapSymbolTile not implemented","createPixmapSymbolTile()");
return NULL;
}
int renderEllipseSymbolDummy(imageObj *image, double x, double y,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"renderEllipseSymbol not implemented","renderEllipseSymbol()");
return MS_FAILURE;
}
void* createEllipseSymbolTileDummy(int width, int height,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"createEllipseSymbolTile not implemented","createEllipseSymbolTile()");
return NULL;
}
int renderTruetypeSymbolDummy(imageObj *img, double x, double y,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"renderTruetypeSymbol not implemented","renderTruetypeSymbol()");
return MS_FAILURE;
}
void* createTruetypeSymbolTileDummy(int width, int height,
symbolObj *symbol, symbolStyleObj *style)
{
msSetError(MS_RENDERERERR,"createTruetypeSymbolTile not implemented","createTruetypeSymbolTile()");
return NULL;
}
int renderTileDummy(imageObj *img, imageObj *tile, double x, double y)
{
msSetError(MS_RENDERERERR,"renderTile not implemented","renderTile()");
return MS_FAILURE;
}
rasterBufferObj* loadImageFromFileDummy(char *path)
{
msSetError(MS_RENDERERERR,"loadImageFromFile not implemented","loadImageFromFile()");
return NULL;
}
int getRasterBufferHandleDummy(imageObj *img, rasterBufferObj *rb)
{
msSetError(MS_RENDERERERR,"getRasterBufferHandle not implemented","getRasterBufferHandle()");
return MS_FAILURE;
}
int getRasterBufferCopyDummy(imageObj *img, rasterBufferObj *rb)
{
msSetError(MS_RENDERERERR,"getRasterBufferCopy not implemented","getRasterBufferCopy()");
return MS_FAILURE;
}
rasterBufferObj* createRasterBufferDummy(int width, int height)
{
msSetError(MS_RENDERERERR,"createRasterBuffer not implemented","createRasterBuffer()");
return NULL;
}
int mergeRasterBufferDummy(imageObj *dest, rasterBufferObj *overlay, double opacity, int srcX, int srcY, int dstX, int dstY, int width, int height)
{
msSetError(MS_RENDERERERR,"mergeRasterBuffer not implemented","mergeRasterBuffer()");
return MS_FAILURE;
}
int initializeRasterBufferDummy(rasterBufferObj *rb, int width, int height, int mode)
{
msSetError(MS_RENDERERERR,"initializeRasterBuffer not implemented","initializeRasterBuffer()");
return MS_FAILURE;
}
/* image i/o */
imageObj* createImageDummy(int width, int height, outputFormatObj *format, colorObj* bg)
{
msSetError(MS_RENDERERERR,"createImage not implemented","createImage()");
return NULL;
}
int saveImageDummy(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *format)
{
msSetError(MS_RENDERERERR,"saveImage not implemented","saveImage()");
return MS_FAILURE;
}
/*...*/
/* helper functions */
int getTruetypeTextBBoxDummy(rendererVTableObj *renderer, char **fonts, int numfonts, double size,
char *string,rectObj *rect, double **advances, int bAdjustBaseline)
{
msSetError(MS_RENDERERERR,"getTruetypeTextBBox not implemented","getTruetypeTextBBox()");
return MS_FAILURE;
}
int startLayerDummy(imageObj *img, mapObj *map, layerObj *layer)
{
msSetError(MS_RENDERERERR,"startLayer not implemented","startLayer()");
return MS_FAILURE;
}
int endLayerDummy(imageObj *img, mapObj *map, layerObj *layer)
{
msSetError(MS_RENDERERERR,"endLayer not implemented","endLayer()");
return MS_FAILURE;
}
int startShapeDummy(imageObj *img, shapeObj *shape)
{
msSetError(MS_RENDERERERR,"startShape not implemented","startShape()");
return MS_FAILURE;
}
int endShapeDummy(imageObj *img, shapeObj *shape)
{
msSetError(MS_RENDERERERR,"endShape not implemented","endShape()");
return MS_FAILURE;
}
int setClipDummy(imageObj *img, rectObj clipRect)
{
msSetError(MS_RENDERERERR,"setClip not implemented","setClip()");
return MS_FAILURE;
}
int resetClipDummy(imageObj *img)
{
msSetError(MS_RENDERERERR,"resetClip not implemented","resetClip()");
return MS_FAILURE;
}
int freeImageDummy(imageObj *image)
{
msSetError(MS_RENDERERERR,"freeImage not implemented","freeImage()");
return MS_FAILURE;
}
int freeTileDummy(imageObj *tile)
{
msSetError(MS_RENDERERERR,"freeTile not implemented","freeTile()");
return MS_FAILURE;
}
int freeSymbolDummy(symbolObj *symbol)
{
msSetError(MS_RENDERERERR,"freeSymbol not implemented","freeSymbol()");
return MS_FAILURE;
}
int cleanupDummy(void *renderer_data)
{
return MS_SUCCESS;
}
int msInitializeDummyRenderer(rendererVTableObj *renderer)
{
renderer->use_imagecache = 0;
renderer->supports_pixel_buffer = 0;
renderer->compositeRasterBuffer = NULL;
renderer->supports_clipping = 0;
renderer->supports_svg = 0;
renderer->renderer_data = NULL;
renderer->transform_mode = MS_TRANSFORM_SIMPLIFY;
renderer->startLayer = &startLayerDummy;
renderer->endLayer = &endLayerDummy;
renderer->renderLine=&renderLineDummy;
renderer->renderLineTiled = NULL;
renderer->createImage=&createImageDummy;
renderer->saveImage=&saveImageDummy;
renderer->getRasterBufferHandle=&getRasterBufferHandleDummy;
renderer->getRasterBufferCopy=getRasterBufferCopyDummy;
renderer->initializeRasterBuffer=initializeRasterBufferDummy;
renderer->renderPolygon=&renderPolygonDummy;
renderer->freeImage=&freeImageDummy;
renderer->renderEllipseSymbol = &renderEllipseSymbolDummy;
renderer->renderVectorSymbol = &renderVectorSymbolDummy;
renderer->renderPixmapSymbol = &renderPixmapSymbolDummy;
renderer->mergeRasterBuffer = &mergeRasterBufferDummy;
renderer->renderTile = &renderTileDummy;
renderer->renderPolygonTiled = &renderPolygonTiledDummy;
renderer->freeSymbol = &freeSymbolDummy;
renderer->cleanup = &cleanupDummy;
renderer->startShape = NULL;
renderer->endShape = NULL;
renderer->renderGlyphs = NULL;
return MS_SUCCESS;
}