[Mapserver-users] Not producing the number of points in a Line Object

Jan Hartmann jhart at frw.uva.nl
Wed Feb 5 11:28:14 PST 2003


Got this message from Nicol Hermann (mapserver at geochem.de) (thanks). It 
was a bug after all.

Hi Jan,

me again. Now i works for me too, but the result is:
0
0

I found the following Change Log in the CVS Version of 3.7 so i assume
you are running this version, right?

* Revision 1.138  2003/01/13 20:37:50  dan
* Set $line->numpoints and $shape->numlines after add() calls (bug 69)

Thanks
Nicol



Jan Hartmann wrote:
> 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
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 





More information about the MapServer-users mailing list