MapServer / MapServer-import

3 stars 2 forks source link

Legend icons off-center, so that top and left lines get cut off #251

Closed tbonfort closed 12 years ago

tbonfort commented 12 years ago

Reporter: keon@nacse.org Date: 2003/01/01 - 01:53

Using 3.7 CVS version from 12/31/02.  Legend icons are now off-center, at least
when produced using createLegendIcon().  The rectangular 20x10 image is being
produced, but the icon is shifted one pixel to the left, and one pixel to the
top, so that white lines appear on the right and bottom edges.  For polygon
layers with an outlinecolor, this means that no outline color appears on the
left and upper edges of the icon.  The problem also affects point and line
icons...the top line of each icon is visibly shaved off.

One more thing...for polygon layers that *do not* have an outlinecolor, the
bottom row of pixels is all white, except for the pixel at the bottom right
corner of the image.  This problem was already there, though (not new).

Examples of all these at http://www.nacse.org/~keon/temp/icons
tbonfort commented 12 years ago

Author: keon@nacse.org Date: 2003/01/30 - 01:24

I'm curious whether anyone else has noticed this same behavior (the URL
illustrates it pretty well).  I've tried it several times with different CVS
versions and it's consistent.  For now I'm using a static legend that I produced
using createLegendIcon() in 3.6.3.  I'm hoping to use 3.7 again to create
dynamic legends.  Thanks.
tbonfort commented 12 years ago

Author: dmorissette Date: 2003/01/30 - 02:50

I tried this on two systems with recent copies of MapServer 3.7, one of them 
running GD 1.8.4 and the other running GD 2.0.9 and in both cases the legend 
icons are centered properly.  In both cases I was using a PHP script that I'll 
copy below.  I also made a quick test with the mapserv CGI and things seemed 
fine as well.

Are there any other details you can provide to help reproduce this?  I saw your 
webpage but unfortunately I can't reproduce the problem.  I'll close the bug as 
WORKSFORME, please reopen it if you can provide more details to reproduce it.

Test script:

<?php
dl("php_mapscript_37.so");
$gpoMap = ms_newMapObj("gmap75.map");

// --------------
// Try with a point layer

$layer = $gpoMap->getLayerByName("popplace");
$myClass = $layer->GetClass(0);

$img = $myClass->createLegendIcon($gpoMap->keysizex, $gpoMap->keysizey);
$url = $img->saveWebImage();

echo "<img src=$url> ".$layer->name. "<br>\n";

// --------------
// Try with a polygon layer

$layer = $gpoMap->getLayerByName("park");
$myClass = $layer->GetClass(0);
$style = $myClass->getStyle(0);
$style->outlinecolor->setRGB(255, 0, 0);

$img = $myClass->createLegendIcon($gpoMap->keysizex, $gpoMap->keysizey);
$url = $img->saveWebImage();

echo "<img src=$url> ".$layer->name. "<br>\n";

?>
tbonfort commented 12 years ago

Author: keon@nacse.org Date: 2003/01/30 - 07:59

Daniel, thanks for looking into this.  I moved everything to a new server
yesterday and today, and I'm no longer seeing most of the problems.  Not sure
why they were occurring.

However, one small problem persists.  When creating legend icons for a polygon
layer that doesn't have an outlinecolor, the bottom line of the icon is not
filled in (except for the last pixel on the right).  You can see this example on
the URL that I gave you...it's the last example on the page.

I used part of your script against a layer of that type, and encountered the
same behavior.  I'm using MS CVS from today and GD 2.0.11.

<?php
dl("php_mapscript.cvs.01-29-03.so");
$map = ms_newMapObj("test.map");

// Try with a polygon layer with no outlinecolor

$layer = $map->getLayerByName("watersheds");
$myClass = $layer->GetClass(0);
//$style = $myClass->getStyle(0);
//$style->outlinecolor->setRGB(255, 0, 0);

$img = $myClass->createLegendIcon($map->keysizex, $map->keysizey);
$url = $img->saveWebImage();

echo "<img src=$url> ".$layer->name. "<br>\n";

?>
tbonfort commented 12 years ago

Author: dmorissette Date: 2003/07/10 - 05:28

The bottom line and corner pixel issue was fixed in bug 336 in version 4.0

*** This bug has been marked as a duplicate of 336 ***