[Mapserver-users] Using arrow buttons to pan...

Stephan Holl sholl at gmx.net
Thu Jun 5 22:22:19 PDT 2003


--=.u+IibP5wYbe:Hu
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

At Thu, 05 Jun 2003 13:42:13 +0100 (BST) AMC Story wrote:

Hello AMC,

> Does anyone have any examples of how this might be done?
here is a small code snippet with php/mapscript


/**********************************************************************
**/
/*                      function panarrow()                      
*/
/*                                     			  	        */
/*      Utility function pan when clicking on the arrows   	       
*/
/**********************************************************************
**/
function panarrow ()
{
	GLOBAL $map, $HTTP_POST_VARS ;

	//entsprechend nach w,e,s,n aufsplitten
	$xmax = intval($HTTP_POST_VARS[maxx]); 	// E
	$xmin = intval($HTTP_POST_VARS[minx]); 	// W
	$xinc = ($xmax - $xmin ) / 5; 	// pan-factor
	$ymax = intval($HTTP_POST_VARS[maxy]); 	// S
	$ymin = intval($HTTP_POST_VARS[miny]);	// N
	$yinc = ($ymax - $ymin ) / 5;	// pan-factor 

	// which button is pressed
	if ( isset($HTTP_POST_VARS["panN_x"])) {
		$map->setextent( $xmin, ($ymin + $yinc), $xmax, ($ymax +
$yinc));
	}
	elseif ( isset($HTTP_POST_VARS["panS_x"])) {
		$map->setextent( $xmin, ($ymin - $yinc), $xmax, ($ymax -
$yinc));
	}
	elseif ( isset($HTTP_POST_VARS["panW_x"])) {
		$map->setextent( ($xmin - $xinc), $ymin, ($xmax - $xinc),
$ymax);
	}
	elseif ( isset($HTTP_POST_VARS["panE_x"])) {
		$map->setextent( ($xmin + $xinc), $ymin, ($xmax + $xinc),
$ymax);
	}
} // end function panarrow()

insert some buttons and add the name panN, panS, panW, panE to it.

hth
Stephan Holl

-- 
Stephan Holl

GnuPG Key-ID: 11946A09 

--=.u+IibP5wYbe:Hu
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+4CUNEg9SKhGUagkRAkPhAJ45kFFyzUnNHDJWGpLG7CWhnlwGBQCgncSw
R+ettOXxdO4QTAL7kDQTA/I=
=b11/
-----END PGP SIGNATURE-----

--=.u+IibP5wYbe:Hu--



More information about the MapServer-users mailing list