[Mapserver-users] Perl Mapscript - equivalent of zoompointmethod..?
Lowell Filak
lfilak at medinaco.org
Thu Jul 10 08:32:56 PDT 2003
Actually I recall a discussion with a fellow PerlMapScript user at MUM
who was thinking of "packaging" some of these more frequently requested
routines.
Unfortunately I have a hard time remembering my own name when things are
busy so I have forgotten who it was.
Would the appropriate person be willing to comment on the status of such
a package?
Thanks.
Lowell
The following message was sent by Eric Bridger <eric at gomoos.org> on Thu,
10 Jul 2003 09:44:41 -0400.
> Ali,
> In the Wiki, mapquakes.pl example:
>
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples35ex2
there is a function called set_extent() which takes the users mouse
click and zooms the map to that point. Is that what you need?
> If no zoom is set, $zoom_dir == 0, then this functions as a pan tool,
recentering the map.
>
> Steve Lime wrote mapquakes.pl. I also adapted some javascript of his
into Perl to handle pan direction buttons. This just adjusts the mouse
click image coordinates which then must be passed to set_exent().
>
> sub pan_to_map {
> my ($map, $direction) = @_;
> my $pansize = .50;
> my ($x, $y) = (0,0);
> my $width = $map->{width};
> my $height = $map->{height};
>
> if($direction eq 'n') {
> $x = ($width-1)/2.0;
> $y = 0 - ($height * $pansize)/2.0;
> } elsif($direction eq 'nw') {
> $x = 0 - ($width * $pansize)/2.0;
> $y = 0 - ($height * $pansize)/2.0;
> } elsif($direction eq 'ne') {
> $x = ($width-1) + ($width * $pansize)/2.0;
> $y = 0 - ($height * $pansize)/2.0;
> } elsif($direction eq 's') {
> $x = ($width-1)/2.0;
> $y = ($height-1) + ($height * $pansize)/2.0;
> } elsif($direction eq 'sw') {
> $x = 0 - ($width * $pansize)/2.0;
> $y = ($height-1) + ($height * $pansize)/2.0;
> } elsif($direction eq 'se') {
> $x = ($width-1) + ($width * $pansize)/2.0;
> $y = ($height-1) + ($height * $pansize)/2.0;
> } elsif($direction eq 'e') {
> $x = ($width-1) + ($width * $pansize)/2.0;
> $y = ($height-1)/2.0;
> } elsif($direction eq 'w') {
> $x = 0 - ($width * $pansize)/2.0;
> $y = ($height-1)/2.0;
> }
> $x = int($x);
> $y = int($y);
>
> return($x, $y);
> }
>
> Eric
>
>
> At 12:37 PM 07/10/2003 +0100, AMC Story wrote:
> >Hi there everyone,
> >
> >I'm using Perl Mapscript to develop the interface of my application,
and have
> >very kindly been given some existing code to work from from another
member of
> >the list. The code that I am making reference to is written using PHP
> >Mapscript, so I'm having a little bit of trouble in that not all of
the methods
> >available with PHP Mapscript are available with the Perl version.
> >
> >I'm dealing with my panning buttons at the moment, and the example I
have
> >defines a point object which the new map will zoom to, and then uses the
> >zoompoint method of the map object. This method isn't available in
Perl, does
> >anyone have any suggestions as to how I might get around this?
Similarly,
> >their zoomin function makes use of the zoomrectangle method...
> >
> >Thanks for any light you can shed on this.
> >Ali
> >_______________________________________________
> >Mapserver-users mailing list
> >Mapserver-users at lists.gis.umn.edu
> >http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
> _______________________________________________
> 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