[mapserver-users] How TO: Flashing / Blinking Polygon?
Daniel Morissette
morissette at dmsolutions.ca
Mon Aug 20 13:52:49 PDT 2001
"Hankley, Chip" wrote:
>
> I'd like to figure out a way to make the polygon "blink" or "flash" a number
> of times in rapid succession, but have absolutely no idea how to do it.
>
> Anyone have any suggestions / examples?
>
> Thanks!
>
> Chip
>
> (MapServer 3.4, PHP MapScript for PHP Version 4.0.4pl1, WIN NT 4, PWS)
You could use animated GIFs... I never tried this specifically, but did
similar things before so it should work:
1- You'll need to download and install the whirlgif executable in your
path. Get it from http://www.danbbs.dk/~dino/whirlgif/
2- In your script, draw the map once with default layers, and once with
the highlighted polygon. Make sure background is opaque. Then combine
the images into an animated GIF using whirlgif:
// Draw the 2 map slides to the imagepath directory
$img1 = $map->draw();
$img2 = $map->drawQuery();
$imgURL1 = $img1->saveWebImage(...);
$imgURL2 = $img2->saveWebImage(...);
$filePath1 = map->web->imagepath . substr(strrchr($imgURL1, "/"),1);
$filePath2 = map->web->imagepath . substr(strrchr($imgURL2, "/"),1);
// Create a unique filename and URL for the animated GIF output
$animName = "anim".substr(strrchr($imgURL1, "/"),1);
$animPath = $map->web->imagepath . $animName;
$animURL = $map->web->imageurl . $animName;
// Run whirlgif to generate the animated GIF
system("whirlgif -o $animPath -loop -time 500 $filePath1 -time 500
$filePath2");
// $animURL now points to an animated GIF with the flashing polygon
print "<IMG SRC=\"$animURL\" WIDTH=... HEIGHT=...>\n";
Note: a possible optimization could be to draw only the layer containing
the polygon to highlight with a transparent background in the second
pass. I let you figure out how to do that.
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list