Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mapserver/mapserver
Browse files Browse the repository at this point in the history
  • Loading branch information
tbonfort committed Sep 10, 2012
2 parents 902da92 + 5bf7c50 commit 1f0e7df
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 37 deletions.
10 changes: 9 additions & 1 deletion mapdraw.c
Expand Up @@ -1038,6 +1038,10 @@ int msDrawVectorLayer(mapObj *map, layerObj *layer, imageObj *image)
}
}

if (layer->type == MS_LAYER_LINE && msLayerGetProcessingKey(layer, "POLYLINE_NO_CLIP")) {
drawmode |= MS_DRAWMODE_UNCLIPPEDLINES;
}

if (cache) {
styleObj *pStyle = layer->class[shape.classindex]->styles[0];
colorObj tmp;
Expand Down Expand Up @@ -2020,11 +2024,15 @@ int msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image,
shape->bounds.maxy > map->extent.maxy) {
bShapeNeedsClipping = MS_TRUE;
}

if(MS_DRAW_LABELS(drawmode) && MS_DRAW_UNCLIPPED_LABELS(drawmode)) {
bNeedUnclippedAnnoShape = MS_TRUE;
bNeedUnclippedShape = MS_TRUE;
}

if(MS_DRAW_UNCLIPPED_LINES(drawmode)) {
bShapeNeedsClipping = MS_FALSE;
}
} else {
bShapeNeedsClipping = MS_FALSE;
}
Expand Down
9 changes: 9 additions & 0 deletions maprendering.c
Expand Up @@ -367,6 +367,15 @@ int msImagePolylineMarkers(imageObj *image, shapeObj *p, symbolObj *symbol,
point.y += oy;
}
}

/* if the point is not in the map extent, skip it. (POLYLINE_NO_CLIP) */
if ( (point.x < -(symbol_width) || point.x > (image->width+symbol_width)) ||
(point.y < -(symbol_height) || point.y > (image->height+symbol_height)) ) {
current_length += spacing;
line_in=1;
continue;
}

switch (symbol->type) {
case MS_SYMBOL_PIXMAP:
ret = renderer->renderPixmapSymbol(image, point.x, point.y, symbol, style);
Expand Down
2 changes: 2 additions & 0 deletions mapserver.h
Expand Up @@ -2262,6 +2262,8 @@ extern "C" {
#define MS_DRAW_QUERY(mode) (MS_DRAWMODE_QUERY&(mode))
#define MS_DRAWMODE_UNCLIPPEDLABELS 0x00010
#define MS_DRAW_UNCLIPPED_LABELS(mode) (MS_DRAWMODE_UNCLIPPEDLABELS&(mode))
#define MS_DRAWMODE_UNCLIPPEDLINES 0x00020
#define MS_DRAW_UNCLIPPED_LINES(mode) (MS_DRAWMODE_UNCLIPPEDLINES&(mode))

MS_DLL_EXPORT int msDrawShape(mapObj *map, layerObj *layer, shapeObj *shape, imageObj *image, int style, int mode);
MS_DLL_EXPORT int msDrawPoint(mapObj *map, layerObj *layer, pointObj *point, imageObj *image, int classindex, char *labeltext);
Expand Down
86 changes: 50 additions & 36 deletions mapwms.c
Expand Up @@ -1976,7 +1976,7 @@ void msWMSPrintKeywordlist(FILE *stream, const char *tabspace,

/* find out if there's a vocabulary list set */
vocabularylist = msOWSLookupMetadata(metadata, namespaces, vocname);
if ( vocabularylist ) {
if ( vocabularylist && nVersion >= OWS_1_3_0 ) {
tokens = msStringSplit(vocabularylist, ',', &ntokens);
if ( tokens && ntokens > 0 ) {
/* In order to do malloc only once, the length of the metadata*/
Expand Down Expand Up @@ -2355,16 +2355,34 @@ int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_
}
}
if (classnameset) {
int size_x=0, size_y=0;
int layer_index[1];
layer_index[0] = lp->index;
if (msLegendCalcSize(map, 1, &size_x, &size_y, layer_index, 1) == MS_SUCCESS) {
int k, l, size_x=0, size_y=0, num_layers=0;
int *group_layers = (int *)msSmallMalloc(sizeof(int)*map->numlayers);
char ***nestedGroups = NULL;
int *numNestedGroups = NULL;
int *isUsedInNestedGroup = NULL;

nestedGroups = (char***)msSmallCalloc(map->numlayers, sizeof(char**));
numNestedGroups = (int*)msSmallCalloc(map->numlayers, sizeof(int));
isUsedInNestedGroup = (int*)msSmallCalloc(map->numlayers, sizeof(int));
msWMSPrepareNestedGroups(map, nVersion, nestedGroups, numNestedGroups, isUsedInNestedGroup);

num_layers = 1;
group_layers[0] = lp->index;
if (isUsedInNestedGroup[lp->index]) {
for (j=0; j < map->numlayers; j++) {
for(k = 0; k < numNestedGroups[j]; k++) {
if (strcasecmp(lp->name, nestedGroups[j][k]) == 0) {
group_layers[num_layers++] = j;
break;
}
}
}
}
group_layers =(int *)msSmallRealloc(group_layers, sizeof(int)*num_layers);

if (msLegendCalcSize(map, 1, &size_x, &size_y, group_layers, num_layers) == MS_SUCCESS) {
const char *styleName = NULL;
char *pszEncodedStyleName = NULL;
const char *layerGroups;
char **nestedLayerGroups = NULL;
int k, l, numNestedLayerGroups = 0;
char* errorMsg;
layerObj *lp2 = NULL;

snprintf(width, sizeof(width), "%d", size_x);
Expand Down Expand Up @@ -2399,42 +2417,30 @@ int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_
if (styleName == NULL)
styleName = "default";
pszEncodedStyleName = msEncodeHTMLEntities(styleName);
layerGroups = msOWSLookupMetadata(&(lp->metadata), "MO", "layer_group");
nestedLayerGroups = (char**)msSmallMalloc(sizeof(char*));

for (i=0; i<lp->numclasses; i++) {
if (lp->class[i]->name && lp->class[i]->group) {
/* Check that style is not inherited from root layer (#4442). */
if (strcasecmp(pszEncodedStyleName, lp->class[i]->group) == 0)
break;
continue;
/* Check that style is not inherited from group layer(s) (#4442). */
if ((layerGroups != NULL) && (strlen(layerGroups) != 0)) {
if (layerGroups[0] != '/') {
errorMsg = "The WMS_LAYER_GROUP metadata does not start with a '/'";
msSetError(MS_WMSERR, errorMsg, "msDumpLayer()", NULL);
msIO_fprintf(stdout, "<!-- ERROR: %s -->\n", errorMsg);
/* cannot return exception at this point because we are already writing to stdout */
} else {
/* split into subgroups. Start at address + 1 because the first '/' would cause an extra empty group */
nestedLayerGroups = msStringSplit(layerGroups + 1, '/', &numNestedLayerGroups);
for (j=0; j < numNestedLayerGroups; j++) {
for(k = 0; k < map->numlayers; k++) {
if (GET_LAYER(map, k)->name && strcasecmp(GET_LAYER(map, k)->name, nestedLayerGroups[j]) == 0) {
lp2 = (GET_LAYER(map, k));
for (l=0; l < lp2->numclasses; l++) {
if (strcasecmp(lp2->class[l]->group, lp->class[i]->group) == 0)
break;
}
if (l < lp2->numclasses)
if (numNestedGroups[lp->index] > 0) {
for (j=0; j<numNestedGroups[lp->index]; j++) {
for (k=0; k < map->numlayers; k++) {
if (GET_LAYER(map, k)->name && strcasecmp(GET_LAYER(map, k)->name, nestedGroups[lp->index][j]) == 0) {
lp2 = (GET_LAYER(map, k));
for (l=0; l < lp2->numclasses; l++) {
if (strcasecmp(lp2->class[l]->group, lp->class[i]->group) == 0)
break;
}
}
if (k < map->numlayers)
break;
}
}
if (j < numNestedLayerGroups)
continue;
if (l < lp2->numclasses)
break;
}
if (j < numNestedGroups[lp->index])
continue;
}
if (!classgroups) {
classgroups = (char **)msSmallMalloc(sizeof(char *));
Expand Down Expand Up @@ -2518,9 +2524,17 @@ int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_
}
msFree(legendurl);
msFreeCharArray(classgroups, iclassgroups);
msFreeCharArray(nestedLayerGroups, numNestedLayerGroups);
msFree(mimetype);
}
/* free the stuff used for nested layers */
for (i = 0; i < map->numlayers; i++) {
if (numNestedGroups[i] > 0) {
msFreeCharArray(nestedGroups[i], numNestedGroups[i]);
}
}
free(nestedGroups);
free(numNestedGroups);
free(isUsedInNestedGroup);
}
}
}
Expand Down Expand Up @@ -3240,7 +3254,7 @@ int msWMSGetCapabilities(mapObj *map, int nVersion, cgiRequestObj *req, owsReque
int numtokens = 0;
char width[10], height[10];

group_layers =(int *)msSmallRealloc(group_layers, sizeof(int)*num_layers);
group_layers =(int *)msSmallRealloc(group_layers, sizeof(int)*num_layers);
if (msLegendCalcSize(map, 1, &size_x, &size_y, group_layers , num_layers) == MS_SUCCESS) {
bufferSize = strlen(script_url_encoded)+300;
pszLegendURL = (char*)msSmallMalloc(bufferSize);
Expand Down

0 comments on commit 1f0e7df

Please sign in to comment.