mapdummyrenderer.c 9.37 KB
Newer Older
1
/******************************************************************************
2
 * $Id$
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * Project:  MapServer
 * Purpose:  Dummy functions to implement when using a pluggable renderer
 * Author:   Thomas Bonfort, thomas.bonfort@gmail.com
 *
 ******************************************************************************
 * 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:
 *
18
 * The above copyright notice and this permission notice shall be included in
19 20 21 22 23 24 25 26 27 28 29 30 31
 * 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"

32 33 34 35
int renderLineDummy(imageObj *img, shapeObj *p, strokeStyleObj *style)
{
  msSetError(MS_RENDERERERR,"renderLine not implemented","renderLine()");
  return MS_FAILURE;
36 37
}

38 39 40 41
int renderPolygonDummy(imageObj *img, shapeObj *p, colorObj *color)
{
  msSetError(MS_RENDERERERR,"renderPolygon not implemented","renderPolygon()");
  return MS_FAILURE;
42 43
}

44 45 46 47
int renderPolygonTiledDummy(imageObj *img, shapeObj *p, imageObj *tile)
{
  msSetError(MS_RENDERERERR,"renderPolygonTiled not implemented","renderPolygonTiled()");
  return MS_FAILURE;
48 49
}

50 51 52 53
int renderLineTiledDummy(imageObj *img, shapeObj *p, imageObj *tile)
{
  msSetError(MS_RENDERERERR,"renderLineTiled not implemented","renderLineTiled()");
  return MS_FAILURE;
54 55 56
}

int renderRasterGlyphsDummy(imageObj *img, double x, double y, int fontIndex,
57 58 59 60
                            colorObj *color, char* text)
{
  msSetError(MS_RENDERERERR,"renderRasterGlyphs not implemented","renderRasterGlyphs()");
  return MS_FAILURE;
61 62 63
}

int renderGlyphsLineDummy(imageObj *img,labelPathObj *labelpath,
64 65 66 67
                          labelStyleObj *style, char *text)
{
  msSetError(MS_RENDERERERR,"renderGlyphsLine not implemented","renderGlyphsLine()");
  return MS_FAILURE;
68 69 70
}

int renderVectorSymbolDummy(imageObj *img, double x, double y,
71 72 73 74
                            symbolObj *symbol, symbolStyleObj *style)
{
  msSetError(MS_RENDERERERR,"renderVectorSymbol not implemented","renderVectorSymbol()");
  return MS_FAILURE;
75 76 77
}

void* createVectorSymbolTileDummy(int width, int height,
78 79 80 81
                                  symbolObj *symbol, symbolStyleObj *style)
{
  msSetError(MS_RENDERERERR,"createVectorSymbolTile not implemented","createVectorSymbolTile()");
  return NULL;
82 83 84
}

int renderPixmapSymbolDummy(imageObj *img, double x, double y,
85 86
                            symbolObj *symbol, symbolStyleObj *style)
{
87
  msSetError(MS_RENDERERERR,"renderPixmapSymbol not implemented","renderPixmapSymbol()");
88
  return MS_FAILURE;
89 90 91
}

void* createPixmapSymbolTileDummy(int width, int height,
92 93
                                  symbolObj *symbol, symbolStyleObj *style)
{
94
  msSetError(MS_RENDERERERR,"createPixmapSymbolTile not implemented","createPixmapSymbolTile()");
95
  return NULL;
96 97
}

98 99 100
int renderEllipseSymbolDummy(imageObj *image, double x, double y,
                             symbolObj *symbol, symbolStyleObj *style)
{
101
  msSetError(MS_RENDERERERR,"renderEllipseSymbol not implemented","renderEllipseSymbol()");
102
  return MS_FAILURE;
103 104 105
}

void* createEllipseSymbolTileDummy(int width, int height,
106 107
                                   symbolObj *symbol, symbolStyleObj *style)
{
108
  msSetError(MS_RENDERERERR,"createEllipseSymbolTile not implemented","createEllipseSymbolTile()");
109
  return NULL;
110 111 112
}

int renderTruetypeSymbolDummy(imageObj *img, double x, double y,
113 114
                              symbolObj *symbol, symbolStyleObj *style)
{
115
  msSetError(MS_RENDERERERR,"renderTruetypeSymbol not implemented","renderTruetypeSymbol()");
116
  return MS_FAILURE;
117 118 119
}

void* createTruetypeSymbolTileDummy(int width, int height,
120 121
                                    symbolObj *symbol, symbolStyleObj *style)
{
122
  msSetError(MS_RENDERERERR,"createTruetypeSymbolTile not implemented","createTruetypeSymbolTile()");
123
  return NULL;
124 125
}

126 127
int renderTileDummy(imageObj *img, imageObj *tile, double x, double y)
{
128
  msSetError(MS_RENDERERERR,"renderTile not implemented","renderTile()");
129
  return MS_FAILURE;
130 131
}

132 133 134 135
rasterBufferObj* loadImageFromFileDummy(char *path)
{
  msSetError(MS_RENDERERERR,"loadImageFromFile not implemented","loadImageFromFile()");
  return NULL;
136 137 138
}


139 140
int getRasterBufferHandleDummy(imageObj *img, rasterBufferObj *rb)
{
141
  msSetError(MS_RENDERERERR,"getRasterBufferHandle not implemented","getRasterBufferHandle()");
142
  return MS_FAILURE;
143 144
}

145 146 147 148
int getRasterBufferCopyDummy(imageObj *img, rasterBufferObj *rb)
{
  msSetError(MS_RENDERERERR,"getRasterBufferCopy not implemented","getRasterBufferCopy()");
  return MS_FAILURE;
149 150
}

151 152 153 154
rasterBufferObj* createRasterBufferDummy(int width, int height)
{
  msSetError(MS_RENDERERERR,"createRasterBuffer not implemented","createRasterBuffer()");
  return NULL;
155 156
}

157 158 159 160
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;
161 162
}

163 164 165 166
int initializeRasterBufferDummy(rasterBufferObj *rb, int width, int height, int mode)
{
  msSetError(MS_RENDERERERR,"initializeRasterBuffer not implemented","initializeRasterBuffer()");
  return MS_FAILURE;
167 168 169 170 171
}



/* image i/o */
172 173 174 175
imageObj* createImageDummy(int width, int height, outputFormatObj *format, colorObj* bg)
{
  msSetError(MS_RENDERERERR,"createImage not implemented","createImage()");
  return NULL;
176 177
}

178 179 180 181
int saveImageDummy(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *format)
{
  msSetError(MS_RENDERERERR,"saveImage not implemented","saveImage()");
  return MS_FAILURE;
182 183 184 185
}
/*...*/

/* helper functions */
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
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)
{
219
  msSetError(MS_RENDERERERR,"setClip not implemented","setClip()");
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
  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;
256
  renderer->compositeRasterBuffer = NULL;
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
  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;
282
  renderer->renderGlyphs = NULL;
283
  return MS_SUCCESS;
284 285 286
}