[Mapserver-users] RE: Draw Circle via PHP/MS

YC Nyon ycnyon at pd.jaring.my
Mon Jan 20 20:58:20 PST 2003


I'm trying to draw a circle using the code below. However it gave an error
on the last line.
I'm modify it from a snippet I found in the archieves. The map file contains
a 'circle' layer.

// DRAW CIRCLE
  $p=ms_newPointObj();
     $circle=ms_newShapeObj(MS_SHAPE_LINE);
     $line=ms_newlineObj();
     $clayer = $map->getLayerByName('Circle');
     $class = $clayer->getClass(0);

     $pi=3.141592654;
  $radius = 10;
     for($i=0;$i<2.1*$pi;$i=$i+$pi/100)
       {
          $p->{x} = $real_geo_width + $radius * cos($i);
          $p->{y} = $real_geo_height + $radius * sin($i);
          $p->setXY(($real_geo_width + $radius * cos($i)),($real_geo_height
+ $radius * sin($i)));
           $line->add($p);
       }
     $circle->add($line);
     $circle->draw($map,$clayer,$image,0,"");


Regards
Nyon


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 10/01/2003




More information about the MapServer-users mailing list