Reporter: havatv
Date: 2011/05/11 - 12:27
Trac URL: http://trac.osgeo.org/mapserver/ticket/3867
STYLE->GAP shall specify the spacing between symbols (for instance for styling of lines).
The exact definition of GAP can not be found in the documentation
(the documentation says that: "This defines a distance between symbols").
For symbol construction purposes, the most useful definition would be that "GAP defines the centre to centre distance between symbols". In my opinion, it is also the most logical, so I assume that this is what is intended (this is also what I have currently documented for 6.0).
Current trunk behaviour is that GAP specifies the distance between the outer edges of the symbol bounding boxes. This is also a possible interpretation of the documentation, but not as useful.
Another argument for fixing this is that for STYLE->PATTERN, the gap length will be "correct" with BUTT linecaps. If linecap is round or square, the observed gaps will appear smaller (proportional to the width of the line).
Here is an svn diff of a quick and dirty fix that works for me (it turns out that this change actually simplify things).
svn diff mapserver/maprendering.c
Index: mapserver/maprendering.c
===================================================================
--- mapserver/maprendering.c (revisjon 11672)
+++ mapserver/maprendering.c (arbeidskopi)
@@ -281,7 +281,7 @@
for(i=0; i<p->numlines; i++)
{
int line_in = 0;
- double current_length = (spacing+symbol_width)/2.0; // initial padding fo
r each line
+ double current_length = (spacing)/2.0; // placing of first symbol
double line_length=0;
for(j=1; j<p->line[i].numpoints; j++)
{
@@ -322,14 +322,14 @@
}
if( ret != MS_SUCCESS)
return ret;
- current_length += symbol_width + spacing;
+ current_length += spacing;
in = 1;
line_in=1;
}
if (in)
{
- current_length -= length + symbol_width/2.0;
+ current_length -= length;
}
else current_length -= length;
}
@@ -650,11 +650,11 @@
}
if(s.scale != 1) {
- pw = MS_NINT(symbol->sizex * s.scale + s.gap)+1;
- ph = MS_NINT(symbol->sizey * s.scale + s.gap)+1;
+ pw = MS_NINT(s.gap)+1;
+ ph = MS_NINT(s.gap)+1;
} else {
- pw = symbol->sizex + s.gap;
- ph = symbol->sizey + s.gap;
+ pw = s.gap;
+ ph = s.gap;
}
if(pw<1) pw=1;
if(ph<1) ph=1;