Ticket #1684 (reopened defect)

Opened 3 years ago

Last modified 2 years ago

can't control pixmap symbol size

Reported by: akrherz@iastate.edu Assigned to: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.8
Severity: normal Keywords:
Cc: mapserver@geochem.de

Description

Back in the 4.6.1 days, this code would work:

$logokey = ms_newLayerObj($map);
$logokey->set("type", MS_SHP_POINT);
$logokey->set("transform", MS_FALSE);
$logokey->set("status", MS_ON);
$logokey->set("labelcache", MS_ON);

$logokey_c3 = ms_newClassObj($logokey);
$logokey_c3s0 = ms_newStyleObj($logokey_c3);
$logokey_c3s0->set("symbolname", "iem");
$logokey_c3s0->set("size", 45);
$logokey_c3->label->set("buffer", 10);
$logokey_c3->label->set("type", MS_BITMAP);
$logokey_c3->label->set("size", MS_MEDIUM);
$logokey_c3->label->color->setRGB(0,0,0);
$bpt = ms_newpointobj();
$bpt->setXY(300, 300);
$bpt->draw($map, $logokey, $img, 0 , "      ");

Now in 4.8.1, I can't controll the size of the symbol:

$logokey_c3s0->set("size", 45);

does nothing.  Am I doing something wrong?

Change History

03/01/06 21:03:04 changed by javerbach@extendthereach.com

  • status changed from new to closed.
  • resolution set to fixed.
  • summary changed from can't control pixmap symbol size to can't control pixmap symbol size.
 * Revision 1.93  2006/03/02 01:51:13  jani
 * When we add a pixmap symbol, be sure to initialize sizex,sizey fields of
 * symbol. These fields are used later (e.g.mapgd.c:msDrawMarkerSymbolGD)
 * to calculate scaling factor.  If they are uninitialized (0.0),
 * the scaling factor will be 1. This worked before with the old code because
 * msDrawMarkerSymbolGD used directly img->sy when it calculated
 * d (the scaling factor).
 *
 * This fixes bug #1684
 *
 * * msAddImageSymbol: Initialize sizex, sizey
 *

03/02/06 01:03:29 changed by akrherz@iastate.edu

  • status changed from closed to reopened.
  • resolution deleted.
Hi,

Sorry, I just checked out CVS and the problem still exists with PHP mapscript.

daryl

03/02/06 02:26:39 changed by mapserver@geochem.de

  • cc set to mapserver@geochem.de.

03/02/06 11:57:06 changed by javerbach@extendthereach.com

mapsymbol.c: 1.94: 
Fixed second code path when same thing happens (Image loaded by symbol file). 

Daryl, could you test cvs-head and close this bug, if it is now fixed.

Thanks, 
Jani

03/02/06 12:10:31 changed by akrherz@iastate.edu

Hi,

Thanks.  You are getting closer, but something is still funky.  In 4.6.1, the
SIZE setting seemed to control the pixmap height.  Now in CVS HEAD, it appears
to control the pixmap width.  Is that correct?

daryl

03/22/06 20:43:30 changed by benjcarson@digitaljunkies.ca

Part of the current fix for this bug seems to break scalebar embedding.  I think
the problem is that the scalebar is added as a symbol to the symbolset but that
the sizey member of the sclaebar's symbolObj is set to zero.  When the scale
factor is calculated (d = size / symbol->sizey in mapgd.c:1745), d then becomes
+inf.

Adding these lines to mapscale.c:339 seems to fix this:

  map->symbolset.symbol[s].sizey = image->img.gd->sy;
  map->symbolset.symbol[s].sizex = image->img.gd->sx;


Benj