Skip to content

Commit

Permalink
Merge branch 'branch-6-2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schpidi committed Sep 12, 2012
2 parents d6c4e23 + 9531df6 commit 758f9f6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
40 changes: 21 additions & 19 deletions maprendering.c
Expand Up @@ -31,7 +31,7 @@
#include "mapcopy.h"

int computeLabelStyle(labelStyleObj *s, labelObj *l, fontSetObj *fontset,
double scalefactor)
double scalefactor, double resolutionfactor)
{
INIT_LABEL_STYLE(*s);
if(!MS_VALID_COLOR(l->color))
Expand All @@ -42,8 +42,8 @@ int computeLabelStyle(labelStyleObj *s, labelObj *l, fontSetObj *fontset,
s->size = l->size;
if(l->type == MS_TRUETYPE) {
s->size *= scalefactor;
s->size = MS_MAX(s->size, l->minsize);
s->size = MS_MIN(s->size, l->maxsize);
s->size = MS_MAX(s->size, l->minsize*resolutionfactor);
s->size = MS_MIN(s->size, l->maxsize*resolutionfactor);
if (!fontset) {
msSetError(MS_TTFERR, "No fontset defined.","computeLabelStyle()");
return (MS_FAILURE);
Expand All @@ -61,7 +61,9 @@ int computeLabelStyle(labelStyleObj *s, labelObj *l, fontSetObj *fontset,
s->antialias = l->antialias;
return MS_SUCCESS;
}
void computeSymbolStyle(symbolStyleObj *s, styleObj *src, symbolObj *symbol, double scalefactor)

void computeSymbolStyle(symbolStyleObj *s, styleObj *src, symbolObj *symbol, double scalefactor,
double resolutionfactor)
{
double default_size;
double target_size;
Expand Down Expand Up @@ -92,15 +94,15 @@ void computeSymbolStyle(symbolStyleObj *s, styleObj *src, symbolObj *symbol, dou
}

target_size = style_size * scalefactor;
target_size = MS_MAX(target_size, src->minsize);
target_size = MS_MIN(target_size, src->maxsize);
target_size = MS_MAX(target_size, src->minsize*resolutionfactor);
target_size = MS_MIN(target_size, src->maxsize*resolutionfactor);
s->scale = target_size / default_size;
s->gap = src->gap * target_size / style_size;

if(s->outlinecolor) {
s->outlinewidth = src->width * scalefactor;
s->outlinewidth = MS_MAX(s->outlinewidth, src->minwidth);
s->outlinewidth = MS_MIN(s->outlinewidth, src->maxwidth);
s->outlinewidth = MS_MAX(s->outlinewidth, src->minwidth*resolutionfactor);
s->outlinewidth = MS_MIN(s->outlinewidth, src->maxwidth*resolutionfactor);
} else {
s->outlinewidth = 0;
}
Expand Down Expand Up @@ -481,8 +483,8 @@ int msDrawLineSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p,
symbol->renderer = renderer;

width = style->width * scalefactor;
width = MS_MIN(width,style->maxwidth);
width = MS_MAX(width,style->minwidth);
width = MS_MIN(width,style->maxwidth*image->resolutionfactor);
width = MS_MAX(width,style->minwidth*image->resolutionfactor);
if(style->width != 0) {
finalscalefactor = width / style->width;
} else {
Expand Down Expand Up @@ -539,7 +541,7 @@ int msDrawLineSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p,
}

INIT_SYMBOL_STYLE(s);
computeSymbolStyle(&s,style,symbol,scalefactor);
computeSymbolStyle(&s,style,symbol,scalefactor,image->resolutionfactor);
s.style = style;
if(symbol->type == MS_SYMBOL_TRUETYPE) {
if(!symbol->full_font_path)
Expand Down Expand Up @@ -665,11 +667,11 @@ int msDrawShadeSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p, sty
if(ret != MS_SUCCESS) goto cleanup;
}
width = (style->width <= 0)?scalefactor:style->width*scalefactor;
width = MS_MIN(width, style->maxwidth);
width = MS_MAX(width, style->minwidth);
width = MS_MIN(width, style->maxwidth*image->resolutionfactor);
width = MS_MAX(width, style->minwidth*image->resolutionfactor);
spacing = (style->size <= 0)?scalefactor:style->size*scalefactor;
spacing = MS_MIN(spacing, style->maxsize);
spacing = MS_MAX(spacing, style->minsize);
spacing = MS_MIN(spacing, style->maxsize*image->resolutionfactor);
spacing = MS_MAX(spacing, style->minsize*image->resolutionfactor);

/* scale the pattern by the factor applied to the width */
for(i=0; i<style->patternlength; i++) {
Expand Down Expand Up @@ -723,7 +725,7 @@ int msDrawShadeSymbol(symbolSetObj *symbolset, imageObj *image, shapeObj *p, sty
}

INIT_SYMBOL_STYLE(s);
computeSymbolStyle(&s,style,symbol,scalefactor);
computeSymbolStyle(&s,style,symbol,scalefactor,image->resolutionfactor);
s.style = style;

if (!s.color && !s.outlinecolor && symbol->type != MS_SYMBOL_PIXMAP && symbol->type != MS_SYMBOL_SVG) {
Expand Down Expand Up @@ -832,7 +834,7 @@ int msDrawMarkerSymbol(symbolSetObj *symbolset,imageObj *image, pointObj *p, sty
}

s.style = style;
computeSymbolStyle(&s,style,symbol,scalefactor);
computeSymbolStyle(&s,style,symbol,scalefactor,image->resolutionfactor);
s.style = style;
if (!s.color && !s.outlinecolor && symbol->type != MS_SYMBOL_PIXMAP &&
symbol->type != MS_SYMBOL_SVG) {
Expand Down Expand Up @@ -953,7 +955,7 @@ int msDrawText(imageObj *image, pointObj labelPnt, char *string,
return (0); /* not errors, just don't want to do anything */


if(computeLabelStyle(&s,label,fontset,scalefactor) == MS_FAILURE) {
if(computeLabelStyle(&s,label,fontset,scalefactor,image->resolutionfactor) == MS_FAILURE) {
return MS_FAILURE;
}
if(s.rotation == 0 && !MS_RENDERER_KML(image->format)) {
Expand Down Expand Up @@ -1004,7 +1006,7 @@ int msDrawTextLine(imageObj *image, char *string, labelObj *label, labelPathObj
labelStyleObj s;
if (!string || !strlen(string))
return (MS_SUCCESS); /* not errors, just don't want to do anything */
if(computeLabelStyle(&s, label, fontset, scalefactor) != MS_SUCCESS) return MS_FAILURE;
if(computeLabelStyle(&s, label, fontset, scalefactor,image->resolutionfactor) != MS_SUCCESS) return MS_FAILURE;
if (label->type == MS_TRUETYPE) {
if(renderer->renderGlyphsLine) {
if(MS_VALID_COLOR(label->outlinecolor)) {
Expand Down
4 changes: 2 additions & 2 deletions mapwms.c
Expand Up @@ -2023,7 +2023,7 @@ int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_
const char *pszLegendURL=NULL;
char *pszMetadataName=NULL, *mimetype=NULL;
char **classgroups = NULL;
int iclassgroups=0 ,j=0;
int iclassgroups=0;
char szVersionBuf[OWS_VERSION_MAXLEN];
size_t bufferSize = 0;
const char *pszDimensionlist=NULL;
Expand Down Expand Up @@ -2355,7 +2355,7 @@ int msDumpLayer(mapObj *map, layerObj *lp, int nVersion, const char *script_url_
}
}
if (classnameset) {
int k, l, size_x=0, size_y=0, num_layers=0;
int j=0, k=0, l=0, size_x=0, size_y=0, num_layers=0;
int *group_layers = (int *)msSmallMalloc(sizeof(int)*map->numlayers);
char ***nestedGroups = NULL;
int *numNestedGroups = NULL;
Expand Down

0 comments on commit 758f9f6

Please sign in to comment.