Opened 19 years ago

Closed 19 years ago

#1137 closed defect (fixed)

setpoints method of the symbolobj ignores decimal places

Reported by: mapserver@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.4
Severity: normal Keywords:
Cc:

Description

Hi List,

i noticed a problem with the symbolObj of php mapscript.
When i set the point values like this:
$sympoints[0] = 0;
$sympoints[1] = 1;
$sympoints[2] = 0.5;
$sympoints[3] = 1.5;
$symbolobj->setpoints($sympoints);

i get back the following array when i execute
print_r ($symbolobj->getpointsarray());

Array
(
    [0] => 0
    [1] => 1
    [2] => 0
    [3] => 1
)

The decimal places of the last two values (2 and 3) get lost.
According to the docs
(http://www2.dmsolutions.ca/mapserver/dl/mapserver-4.x-PHP-MAPSCRIPT-README.txt)
setpoints expects double values.
To me it seems as they are treated as int.

Is this a bug?

I also noticed that numpoints is still zero after the
$symbolobj->setpoints($sympoints);
call.

I use mapserver 4.4 on a debian sarge box.

Change History (12)

comment:1 by assefa, 19 years ago

Resolution: fixed
Status: newclosed
This is fixed in cvs php_mapscipt.c (r 1.220). It was effectivly using integers
instead of doubles. Please give it a try and update the bug if things are ok.
Making it as Fixed. 

comment:2 by dmorissette, 19 years ago

Did you fix this in the 4.4 branch too?

comment:3 by assefa, 19 years ago

Fixed in branch-4-4.

comment:4 by mapserver@…, 19 years ago

i could confirm that the problem is gone. Thanks for the fix!
But there is still a problem with numpoints. It is NULL when i build the
ms_newsymbolobj from the scratch even so a add points with the setpoints method.
Should i open a new bug report on this?

comment:5 by assefa, 19 years ago

I have also corrected the numpoints on the main branch and the 4.4 branch. I do
not think there was a need to enter a new bug so I just did it through this bug.

comment:6 by mapserver@…, 19 years ago

Thanks again. numpoints and numstyles works for me too.

comment:7 by mapserver@…, 19 years ago

Hi Assefa,
i found a new problem with a simple circle symbol which works with the official
version of 4.4.0 (without your int/double patch) but do not appear correct with
your patched version. Only a line appears.

My object definition looks like that:

  $nId = ms_newsymbolobj($map, "point");
  $oSymbol = $map->getsymbolobjectbyid($nId);
  $oSymbol->set("filled", MS_TRUE);
  $oSymbol->set("type", MS_SYMBOL_ELLIPSE);
  $oSymbol->set("sizex", 1);
  $oSymbol->set("sizey", 1);
  $oSymbol->set("inmapfile", MS_TRUE);

  $aPoints[0] = 1;
  $aPoints[1] = 1;
  $oSymbol->setpoints($aPoints);

  $poClass = ms_newClassObj($Layer);
  $styleObj = ms_newStyleObj($poClass);
  $styleObj -> color -> setRGB ( 255, 0, 255 );
  $styleObj -> outlinecolor -> setRGB ( 0 , 0, 0);
  $styleObj -> set("symbolname", "point");
  $styleObj -> set("size", 5);

Do i miss something?

comment:8 by assefa, 19 years ago

Resolution: fixed
Status: closedreopened
reopened per comment #7. Not sure right noe what is the problem

comment:9 by mapserver@…, 19 years ago

For me the problem was disappeared when Steve did the following change in map.h

* $Log: map.h,v $
* Revision 1.385  2004/12/22 03:57:42  sdlime
* Added thickness related parameters to the styleObj in map.h.

but i did not check it with the current cvs version.

comment:10 by assefa, 19 years ago

When you have time, please check it against current CVS. If there is no problem
with the current cvs, we can then re-close the bug.

comment:11 by mapserver@…, 19 years ago

i checked the current cvs and stable (4.4.1) version with the script posted in
comment #7. Both versions works fine. I think you could re-close the bug.

comment:12 by assefa, 19 years ago

Resolution: fixed
Status: reopenedclosed
Closing bug as per comment #11.
Note: See TracTickets for help on using tickets.