[Mapserver-users] Not producing the number of points in a Line Object
Jan Hartmann
jhart at frw.uva.nl
Wed Feb 5 08:04:33 PST 2003
Terrence,
I don't think this is a bug. I ran the following script in my browser:
<?
$line = ms_newLineObj();
$point1 = ms_newPointObj();
$point1->setXY(0,0);
$line->addPoint($point1);
echo ($line->numpoints);
echo ("<br>");
$point2 = ms_newPointObj();
$point2->setXY(10,10);
$line->add($point2);
echo ($line->numpoints);
?>
and got as a result:
1
2
I guess this is because Mapscript member variables behave different from
normal PHP ones. E.g. you cannot assign directly to $point->x and
$point->y; you have to use $point->setXY(). Something like that could
prevent var_dump from seeing the numpoints member of $line. I wonder why
it does see the x and y members of $point though. I'm not sure about
this, so perhaps someone from DM can say something about the interaction
between PHP and MapScript variables?
Jan Hartmann
> Hello all,
>
> When i use $point->setXY(double x,double y,double m) and then
> var_dump($point) the output shows the correct coordinates of the point.
>
> However, when i use $line->add(pointObject point) or $line->addXY(double
> x,double y, double m) and then var_dump($line) the member variable
> numpoints of $line says that there are 0 points in the line.
>
> How can i correct this?
>
> Thanks
>
> Terrence.
>
Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl
More information about the MapServer-users
mailing list