[mapserver-users] RE: drawing acetate shapes with PHP/Mapscript
Puneet Kishor
pkishor@GeoAnalytics.com
Thu, 25 Apr 2002 20:04:04 -0500
ok... I figured it out... the code below works for drawing a triangle on an
"acetate" layer...
questions...
1. this worked for me...
$lineObj1->addXY($x1, $y1);
But this did not...
$pointObj1 = setXY($x1, $y1);
$lineObj1->add($pointObj1);
why not?
2. How do I draw a circle around a given point?
free beer at the mapserver users meeting in the twin cities (if and when it
happens) to the first person who answers this. my eyes are hurting.
tia,
pk/
1. have an "acetate" layer with 'STATUS off' in my map file like so...
LAYER
NAME "acetate"
TYPE polygon
STATUS off
CLASS
OUTLINECOLOR 255 0 0 # red outline
COLOR 0 255 0 # green fill
END
END
2. and use Mapscript like so...
$x1 = 250; $y1 = 250;
$x2 = $x1 + 5000; $y2 = $y1 + 7000;
$x3 = $x1 + 3000; $y3 = $y1;
$x4 = $x1; $y4 = $y1;
$layerObj = $mapObj->getlayerbyname("acetate");
$classObj = $layerObj->getClass(0);
$imgObj = $mapObj->prepareImage();
$shpObj = ms_newShapeObj(2);
$lineObj1 = ms_newLineObj();
$lineObj1->addXY($x1, $y1);
$lineObj1->addXY($x2, $y2);
$lineObj1->addXY($x2, $y2);
$lineObj1->addXY($x3, $y3);
$lineObj1->addXY($x3, $y3);
$lineObj1->addXY($x4, $y4);
$shpObj->add($lineObj1);
$shpObj->draw($mapObj, $layerObj, $imgObj, 0, "foo");
$acUrl = $imgObj->saveWebImage(MS_PNG, 0, 0, -1);
$layerObj->set("status", 1);
$lineObj1->free();
$imgObj->free();
$shpObj->free();