Customized Functions for Google Maps with JavaScript

I'm sorry about delaying to submit new posts since I've been busy with other matters such as going out with ladies (actually in my dream), attending social events, talking and storming at tea shop with my friends about current world business and political issues :P and blah blah blah.
OK... let's get to the point. My previous assignment was to create the functions to use google maps with vb windows form program. Today, I'm going to present about the javascript functions to map display and map scrolling.

//*************************Map Display

/*
* GBrowserIsCompatible() is to check if the browser is compatible to use gmap.
*/
function zoomIn() {
if (GBrowserIsCompatible()) {
if (map.getZoom() < 17){ map.setCenter(map.getCenter(),map.getZoom()+1); } } } /* * GBrowserIsCompatible() is to check if the browser is compatible to use gmap. */ function zoomOut() { if (GBrowserIsCompatible()) { if (map.getZoom() > 0 ){
map.setCenter(map.getCenter(),map.getZoom()-1);
}
}
}

/*
* GBrowserIsCompatible() is to check if the browser is compatible to use gmap. 5 indicate the zoom level.
*/
function zoomExtend() {
if (GBrowserIsCompatible()) {
map.setCenter(new GLatLng(lat, lng), 5);
}
}

/*
* GBrowserIsCompatible() is to check if the browser is compatible to use gmap.
* map.returnToSavedPosition() to return to the saved position point. In order to use this function you will need to save the position first by using this function * map.savePosition();
*/
function setZoomPrevious()
{
map.returnToSavedPosition();
}

/*
* To set the scale of the map.
*/
function setScale(scaleLevel)
{
if(scaleLevel<=17 && scaleLevel>=0)
{
map.setZoom(scaleLevel);
}
}

/*
* To get the scale of the map.
*/
function getScale()
{
return map.getZoom();
}
//==================================================================

//********* Map Scrolling

// ** To move the map upward.
function setPanUp()
{
map.panBy(new GSize (0,100));
}

// ** To move the map downward.
function setPanDown()
{
map.panBy(new GSize(0,-100));// (x,y)
}

// ** To move the map to the left.
function setPanLeft()
{
map.panBy(new GSize (-100,0)); // (x,y)
}

// ** To move the map to the right.
function setPanRight()
{
map.panBy(new GSize (100,0)); // (x,y)
}

// ** To move the map upward and left.
function setPanLeftUp()
{
map.panBy(new GSize(50,100));
}

// ** To move the map upward and right.
function setPanRightUp()
{
map.panBy(new GSize(50,-100));
}

// ** To move the map downward and right.
function setPanRightDown()
{
map.panBy(new GSize(-100,50));
}

// ** To move the map downward and left.
function setPanLeftDown()
{
map.panBy(new GSize(-50,-100));
}

//******************************************************************************************//

The above functions are created by myself using google map's built-in functions.

Thank you.

lynnnay@2009

Popular posts from this blog

npm refusing to install as a dependency of itself

How to call javascript functions from VB.NET and using WebBrowser Control