Permalink
Browse files

initial setup for the layer geomtransform implementation

  • Loading branch information...
Alan Boudreault
Alan Boudreault committed Jan 30, 2013
1 parent 72db35e commit 9bbbfda020143cc4d5d52869856a10a2f6babb55
Showing with 40 additions and 1 deletion.
  1. +16 −1 mapfile.c
  2. +14 −0 mapgeomtransform.c
  3. +10 −0 mapserver.h
View
@@ -3788,6 +3788,9 @@ int initLayer(layerObj *layer, mapObj *map)
layer->mask = NULL;
layer->maskimage = NULL;
initExpression(&(layer->_geomtransform));
layer->_geomtransform.type = MS_GEOMTRANSFORM_NONE;
return(0);
}
@@ -3845,7 +3848,8 @@ int freeLayer(layerObj *layer)
msFree(layer->classgroup);
msFreeProjection(&(layer->projection));
freeExpression(&layer->_geomtransform);
freeCluster(&layer->cluster);
for(i=0; i<layer->maxclasses; i++) {
@@ -4192,6 +4196,12 @@ int loadLayer(layerObj *layer, mapObj *map)
}
}
break;
case(GEOMTRANSFORM): {
int s;
if((s = getSymbol(1, MS_STRING)) == -1) return(MS_FAILURE);
msLayerSetGeomTransform(layer, msyystring_buffer);
}
break;
case(HEADER):
if(getString(&layer->header) == MS_FAILURE) return(-1); /* getString() cleans up previously allocated string */
if(msyysource == MS_URL_TOKENS) {
@@ -4488,6 +4498,11 @@ static void writeLayer(FILE *stream, int indent, layerObj *layer)
writeString(stream, indent, "FILTERITEM", NULL, layer->filteritem);
writeString(stream, indent, "FOOTER", NULL, layer->footer);
writeString(stream, indent, "GROUP", NULL, layer->group);
if(layer->_geomtransform.type != MS_GEOMTRANSFORM_NONE) {
writeKeyword(stream, indent, "GEOMTRANSFORM", layer->_geomtransform.type, 1,
MS_LAYER_GEOMTRANSFORM_SIMPLIFY, "\"simplify\""
);
}
writeString(stream, indent, "HEADER", NULL, layer->header);
/* join - see below */
writeKeyword(stream, indent, "LABELCACHE", layer->labelcache, 1, MS_OFF, "OFF");
View
@@ -202,3 +202,17 @@ int msDrawTransformedShape(mapObj *map, symbolSetObj *symbolset, imageObj *image
}
return MS_SUCCESS;
}
void msLayerSetGeomTransform(layerObj *layer, char *transform)
{
msFree(layer->_geomtransform.string);
layer->_geomtransform.string = msStrdup(transform);
if(!strncasecmp("simplify",transform,8)) {
layer->_geomtransform.type = MS_LAYER_GEOMTRANSFORM_SIMPLIFY;
} else {
layer->_geomtransform.type = MS_LAYER_GEOMTRANSFORM_NONE;
msSetError(MS_MISCERR,"unknown transform expression","msLayerSetGeomTransform()");
msFree(layer->_geomtransform.string);
layer->_geomtransform.string = NULL;
}
}
View
@@ -1639,6 +1639,9 @@ extern "C" {
#endif
char *mask;
#ifndef SWIG
expressionObj _geomtransform;
#endif
} layerObj;
/************************************************************************/
@@ -2653,9 +2656,16 @@ extern "C" {
MS_GEOMTRANSFORM_LABELPOLY
};
enum MS_LAYER_GEOMTRANSFORM_TYPE {
MS_LAYER_GEOMTRANSFORM_NONE,
MS_LAYER_GEOMTRANSFORM_SIMPLIFY,
};
MS_DLL_EXPORT int msDrawTransformedShape(mapObj *map, symbolSetObj *symbolset, imageObj *image, shapeObj *shape, styleObj *style, double scalefactor);
MS_DLL_EXPORT void msStyleSetGeomTransform(styleObj *style, char *transform);
MS_DLL_EXPORT char *msStyleGetGeomTransform(styleObj *style);
MS_DLL_EXPORT void msLayerSetGeomTransform(layerObj *layer, char *transform);
/* ==================================================================== */
/* end of prototypes for functions in mapgeomtransform.c */
/* ==================================================================== */

0 comments on commit 9bbbfda

Please sign in to comment.