Class Index | File Index

Classes


Class khtml.maplib.base.Map

The center of everything
Defined in: Map.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
THIS IS THE MAIN CLASS This Class draws to map to a html div.
Field Summary
Field Attributes Field Name and Description
 
Spezial overlay for geoJson
Method Summary
Method Attributes Method Name and Description
 
A callback function fires if zoom, latitute or longitude is changed.
 
Adds an Overlay and activates it.
 
Add multiple overlays to the map - calls {khtml.maplib.base.Map.addOverlay} for each element.
 
add an overlay like opensemap, hillshade, hikemap
 
animatedGoto(newCenter, newZoom, time)
Time based animation.
 
bounds(arg1)
Set or Read the bounds.
 
center(center)
Set center of map a coordinate.
 
centerAndZoom(center, zoom)
Set the map coordinates and zoom
 
centerAndZoomXY(center, zoom, x, y)
same as centerAndZoom but zoom center is not map center
 
Panik method if rendering makes problems.
 
draw(map, lat, lng, moveX, moveY, intZoom, zoom, tileFunc)
This Method is used internally.
<inner>  
getTileNumber(lat, lon, zoom)
<inner>  
lat2y(a)
 
latlngToXY(point)
WGS84 to x,y at the div calculation
 
layer(map, lat, lng, moveX, moveY, zoom)
LAYERMANAGER (which layer is visible).
 
mouse coordinates to lat, lng
 
moveXY(x, y)
Use this method to move the map in pixel.
 
pageX(evt)
mouse events (distance measure code not in use anymore)
 
pageY(evt)
 
play(i)
 
for undo,redo
 
If the size of the html div is changed, the redraw method has to be called.
 
 
Calls {clear()} on all objects in "this.overlays" and removes them from "this.overlays".
 
Remove tile overlays.
 
 
Used Internal.
 
Calls {render()} on all objects in "this.overlays".
 
for iPhone to make page fullscreen (maybe not working)
 
setCenter2(center, zoom)
same as setCenter but moveX,moveY are not reset (for internal use)
 
setCenterNoLog(center, zoom)
same as setCenter but no history item is generated (for undo, redo)
 
Internaly used to stop rendering of slow overlays to prevent browser stall.
<inner>  
 
tiles(tileSource)
Defining the base layer The tile source must be in this format:
	map.tiles({
	  maxzoom:18,
	  minzoom:1,
	  src:function(x,y,z){
	     return "http://andy.sandbox.cloudmade.com/tiles/cycle/"+z+"/"+x+"/"+y+".png";
	  },
	  copyright:"osm"
	}
	
see also: Simple map API
 
XYTolatlng(x, y)
screen (map div) coordinates to lat,lng
<inner>  
y2lat(a)
 
zoom(zoom)
Set or get the zoomlevel.
Class Detail
khtml.maplib.base.Map(map)
THIS IS THE MAIN CLASS This Class draws to map to a html div. It handles mouse, mousewheel and touchscreen user actions. A simple overlay API is provided by this class
Parameters:
map
See:
Example: Base,
BitmapOverlays: seamap,
Combined overlays: osma,hikemap,hillshade
Field Detail
backend
Spezial overlay for geoJson
Method Detail
addCallbackFunction(func)
A callback function fires if zoom, latitute or longitude is changed. The callback funktion in defined in user space. You have to provide one. The callback can also be a method. The callback function will have set the "this" object whitch is the map object.
Parameters:
func
See:
Example: display coordinates

addOverlay(obj)
Adds an Overlay and activates it. An Overlay was an init and a render method. For detailed description see: Simple map API
Parameters:
obj

addOverlays(obj)
Add multiple overlays to the map - calls {khtml.maplib.base.Map.addOverlay} for each element.
Parameters:
{Array/Object} obj
every element in this array or object is passed to {khtml.maplib.base.Map.addOverlay}.

addTilesOverlay(t)
add an overlay like opensemap, hillshade, hikemap
Parameters:
t
See:
seamap,
hikemap + hillshade

animatedGoto(newCenter, newZoom, time)
Time based animation.
Parameters:
newCenter
newZoom
time
See:
Example: Time based Animation

bounds(arg1)
Set or Read the bounds. this method will put the map view to the coordinates and zoomlevel where the given bounds are visible. If you call the method without parameter, the return value contains the corners of the visible map. See also "khtml.maplib.geometry.Bounds" Class
Parameters:
arg1

center(center)
Set center of map a coordinate. It is also possible to get the current map center if method is called without parameter.
Parameters:
center

centerAndZoom(center, zoom)
Set the map coordinates and zoom
Parameters:
center
zoom

centerAndZoomXY(center, zoom, x, y)
same as centerAndZoom but zoom center is not map center
Parameters:
center
zoom
x
y

clearMap()
Panik method if rendering makes problems. Used internal.

draw(map, lat, lng, moveX, moveY, intZoom, zoom, tileFunc)
This Method is used internally. You can use this method for benchmark tests. DRAW (speed optimized!!!) This function draws one layer. It is highly opimized for iPhone. Please DO NOT CHANGE things except you want to increase speed! For opimization you need a benchmark test. How it works: The position of the images is fixed. The layer (not the images) is moved because of better performance Even zooming does not change position of the images, if 3D CSS is active (webkit). 3D CSS provides a hardware accelerated zoom of divs. this method uses "this.layers" , "this.oldIntZoom", "this.width", "this.height"; If you want to give better performance to a special rendering engine, be welcome to search milli seconds.
Parameters:
map
lat
lng
moveX
moveY
intZoom
zoom
tileFunc

<inner> getTileNumber(lat, lon, zoom)
Parameters:
lat
lon
zoom

<inner> lat2y(a)
Parameters:
a

latlngToXY(point)
WGS84 to x,y at the div calculation
Parameters:
point

layer(map, lat, lng, moveX, moveY, zoom)
LAYERMANAGER (which layer is visible). This is an internaly used method to switch the visiblity of tile sets. If you are looking for Vector or Marker layers see "khtml.maplib.geometrey.Feature". Description: This method desides witch zoom layer is visible at the moment. It has the same parameters as the "draw" method, but no "intZoom". This Layers are NOT tile or vector overlays
Parameters:
map
lat
lng
moveX
moveY
zoom

mouseToLatLng(evt)
mouse coordinates to lat, lng
Parameters:
evt
See:
Example: display coordinates

moveXY(x, y)
Use this method to move the map in pixel.
Parameters:
x
y
See:
Example: move

pageX(evt)
mouse events (distance measure code not in use anymore)
Parameters:
evt

pageY(evt)
Parameters:
evt

play(i)
Parameters:
i

record()
for undo,redo

redraw()
If the size of the html div is changed, the redraw method has to be called. For browser window size changes the map automaticaly calls the redraw. Otherwise the redraw has to be called be the application.
See:
Example:zoom + resize

removeOverlay(ov)
Parameters:
ov

removeOverlays()
Calls {clear()} on all objects in "this.overlays" and removes them from "this.overlays".

removeTilesOverlay(ov)
Remove tile overlays. Parameter is the returnvalue of addTileOverlay
Parameters:
ov

render()

renderOverlay(obj)
Used Internal. Calls {render()} on supplied object.
Parameters:
obj

renderOverlays()
Calls {render()} on all objects in "this.overlays".

reSize()
for iPhone to make page fullscreen (maybe not working)

setCenter2(center, zoom)
same as setCenter but moveX,moveY are not reset (for internal use)
Parameters:
center
zoom

setCenterNoLog(center, zoom)
same as setCenter but no history item is generated (for undo, redo)
Parameters:
center
zoom

stopRenderOverlays()
Internaly used to stop rendering of slow overlays to prevent browser stall. If an overlay needs more than 10ms it will not be rendered during animations.

<inner> tempFunction()

tiles(tileSource)
Defining the base layer The tile source must be in this format:
	map.tiles({
	  maxzoom:18,
	  minzoom:1,
	  src:function(x,y,z){
	     return "http://andy.sandbox.cloudmade.com/tiles/cycle/"+z+"/"+x+"/"+y+".png";
	  },
	  copyright:"osm"
	}
	
see also: Simple map API
Parameters:
tileSource

{khtml.maplib.LatLng} XYTolatlng(x, y)
screen (map div) coordinates to lat,lng
Parameters:
{int} x
{int} y
Returns:
{khtml.maplib.LatLng}

<inner> y2lat(a)
Parameters:
a

zoom(zoom)
Set or get the zoomlevel. Zoomlevel is a floating Point number. If Integer numbers are used the bitmap layer will displayed more clear than on non integer zoomlevels.
Parameters:
zoom

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Oct 09 2011 20:46:56 GMT+0200 (MESZ)