mapfile.h // add these defines. I added them near the bottom. About line 222. #define COLORITEM 1200 #define OUTLINECOLORITEM 1201 #define SYMBOLITEM 1202 ---------------------------------------------------------------------------------------- mapsymbol.h #define MS_MAXSYMBOLS 1024 //change line 59 to allow for more symbols Obviously this is a little overboard... ---------------------------------------------------------------------------------------- maplexer.l // add items to maplexer.l line 136~. I added them above the COLORRANGE items. coloritem { return(COLORITEM); } outlinecoloritem { return(OUTLINECOLORITEM); } symbolitem { return(SYMBOLITEM); } When make is run maplexer.c will be remade. But flex (Fast Lexical Analyzer) must be installed on the system before running make or these changes occur. ---------------------------------------------------------------------------------------- maplayer.c //line 451 for(i=0; inumclasses; i++) { for(j=0; jclass[i].numstyles; j++) { if(layer->class[i].styles[j].angleitem) nt++; if(layer->class[i].styles[j].sizeitem) nt++; if(layer->class[i].styles[j].rangeitem) nt++; if(layer->class[i].styles[j].coloritem) nt++; //<------Append this if(layer->class[i].styles[j].outlinecoloritem) nt++; //<------Append this if(layer->class[i].styles[j].symbolitem) nt++; //<------Append this } } //line 535 replace the for loop with this one for(i=0; inumclasses; i++) { for(j=0; jclass[i].numstyles; j++) { styleObj *style = &(layer->class[i].styles[j]); if(style->angleitem) style->angleitemindex = string2list(layer->items, &(layer->numitems), style->angleitem); if(style->sizeitem) style->sizeitemindex = string2list(layer->items, &(layer->numitems), style->sizeitem); if(style->rangeitem) style->rangeitemindex = string2list(layer->items, &(layer->numitems), style->rangeitem); if(style->coloritem) style->coloritemindex = string2list(layer->items, &(layer->numitems), style->coloritem); if(style->outlinecoloritem) style->outlinecoloritemindex = string2list(layer->items, &(layer->numitems), style->outlinecoloritem); if(style->symbolitem) style->symbolitemindex = string2list(layer->items, &(layer->numitems), style->symbolitem); } } ---------------------------------------------------------------------------------------- mapfile.c // initStyle(styleObj *style) append the following at about line 1843 style->coloritem = NULL; style->coloritemindex = -1; style->outlinecoloritem = NULL; style->outlinecoloritemindex = -1; style->symbolitem = NULL; style->symbolitemindex = -1; // loadStyle(styleObj *style) append the following at about line 1882 case(COLORITEM): if(getString(&style->coloritem) == MS_FAILURE) return(-1); break; case(OUTLINECOLORITEM): if(getString(&style->outlinecoloritem) == MS_FAILURE) return(-1); break; case(SYMBOLITEM): if(getString(&style->symbolitem) == MS_FAILURE) return(-1); break; // freeStyle() append the following at about line 1970 msFree(style->coloritem); msFree(style->outlinecoloritem); msFree(style->symbolitem); // writeStyle(styleObj *style, FILE *stream) append the following at about line 2004 if(style->coloritem) { fprintf(stream, " COLORITEM \"%s\"\n", style->coloritem); } if(style->outlinecoloritem) { fprintf(stream, " OUTLINECOLORITEM \"%s\"\n", style->outlinecoloritem); } if(style->symbolitem) { fprintf(stream, " SYMBOLITEM \"%s\"\n", style->symbolitem); } ---------------------------------------------------------------------------------------- mappostgis.c //About Line 1179 //Change this: case MS_LAYER_CIRCLE: msDebug( "Ignoring MS_LAYER_RASTER in mappostgis.c\n" ); break; //To this: case MS_LAYER_CIRCLE: result = force_to_lines(wkb, shape); break; ---------------------------------------------------------------------------------------- mapdraw.c //At about line 1353 added a new variable. This variable is a point guaranteed to be on the circle. //I use this to calculate the radius pointObj center, pntOnCircle; /* circle origin */ // msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image, int style) // line 1378 replace the for loop with this one for(s=0; sclass[c].numstyles; s++) { styleObj *style = &(layer->class[c].styles[s]); if (style->rangeitem != NULL) { msShapeToRange(style, shape); } if (style->coloritem != NULL) { msShapeToColor(style->coloritemindex, &(style->color), shape); } if (style->outlinecoloritem != NULL) { msShapeToColor(style->outlinecoloritemindex, &(style->outlinecolor), shape); } if (style->symbolitem != NULL) { if((style->symbol = msGetSymbolIndex(&(map->symbolset), shape->values[style->symbolitemindex], MS_TRUE)) == -1) { msSetError(MS_EOFERR, "Undefined symbol.", "loadClassString()"); } } } //At line about line 1393 I changed the hard != to < //This allows the line to be a multilinestring and also the line can contain the bounding information if you want if(shape->numlines < 1) return(MS_SUCCESS); /* invalid shape */ if(shape->line[0].numpoints < 2) return(MS_SUCCESS); /* invalid shape */ //Removed this line and placed it into the else case below r = MS_ABS(center.x - shape->line[0].point[0].x); //Add this. This sets the point on the circle to the X coordinate of the first //point on the line and the Y coordinate to the same as the center Y coordinate. pntOnCircle.x = shape->line[0].point[0].x; pntOnCircle.y = center.y; //Changed this: if(layer->project && msProjectionsDiffer(&(layer->projection), &(map->projection))) msProjectPoint(&layer->projection, &map->projection, ¢er); else layer->project = MS_FALSE; //To this: if(layer->project && msProjectionsDiffer(&(layer->projection), &(map->projection))) { msProjectPoint(&layer->projection, &map->projection, ¢er); msProjectPoint(&layer->projection, &map->projection, &pntOnCircle); } else { layer->project = MS_FALSE; } //The added code projects the point on the circle if there is a projection object. //Before this the radius was never projected and therefore screwed if there was a projection. //Replace this: r /= map->cellsize; //With this: pntOnCircle.x = MS_MAP2IMAGE_X(pntOnCircle.x, map->extent.minx, map->cellsize); r = MS_ABS(center.x-pntOnCircle.x); //This transforms the translated point on the circle into image coordinates and calculates the radius using those values. //Append these 2 functions. I appended at line about line 2176 int msValueToColor(colorObj *color, char *fieldStr) { char *rgb[3]={0, 0, 0}, flg=0; int i=0, cIndex=0, r, g, b; while(fieldStr[i]) { if(!flg && fieldStr[i] >= '0' && fieldStr[i] <= '9') { if(cIndex > 2) break; rgb[cIndex++] = &fieldStr[i]; flg = 1; } else if(flg && (fieldStr[i] < '0' || fieldStr[i] > '9')) { fieldStr[i] = 0; flg = 0; } i++; } r = rgb[0]?(int)atof(rgb[0]):0; if(r > 255) r = 255; if(r < 0) r = 0; g = rgb[1]?(int)atof(rgb[1]):0; if(g > 255) g = 255; if(g < 0) g = 0; b = rgb[2]?(int)atof(rgb[2]):0; if(b > 255) b = 255; if(b < 0) b = 0; color->red = r; color->green = g; color->blue = b; color->pen = MS_PEN_UNSET; /*so it will recalculate pen*/ return MS_SUCCESS; } int msShapeToColor(int index, colorObj *color, shapeObj *shape) { char* fieldStr; fieldStr = shape->values[index]; if (fieldStr == NULL) {/*if there's not value, bail*/ return MS_FAILURE; } return msValueToColor(color, fieldStr); } ---------------------------------------------------------------------------------------- map.h // at about line 663 append the following char *coloritem; int coloritemindex; char *outlinecoloritem; int outlinecoloritemindex; char *symbolitem; int symbolitemindex; // line 1679 append the following MS_DLL_EXPORT int msShapeToColor(int index, colorObj *color, shapeObj *shape); MS_DLL_EXPORT int msValueToColor(colorObj *color, char *fieldStr); ----------------------------------------------------------------------------------------