Difference between revisions of "Linden Lab Official:Map API Reference"

From Second Life Wiki
Jump to navigation Jump to search
Line 14: Line 14:
=== Methods ===
=== Methods ===


{| border="2" cellspacing="0" cellpadding="3" rules="all" style="margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse; background-color:#F9F9F9; font-size:90%; empty-cells:show; "
{| border="2" cellspacing="0" cellpadding="3" rules="all" class="apitable"
|- bgcolor="#A7C1F2"
|- bgcolor="#A7C1F2"
!valign="top"| Method
!valign="top"| Method
Line 21: Line 21:


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0; white-space: pre;"|addMapWindow (
|valign="top" style="signature"|
addMapWindow(  
MapWindow mapWindow,  
MapWindow mapWindow,  
XYPoint coord)  
XYPoint coord )  
|valign="top"| None
|valign="top"| None
|valign="top"| Adds a MapWindow to the map at specified coordinate.  
|valign="top"| Adds a MapWindow to the map at specified coordinate.  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin: 0; white-space: pre;"|addMarker (
|valign="top" style="signature"|
addMarker(
Marker marker,  
Marker marker,  
MapWindow mapWindow )
MapWindow mapWindow )
Line 35: Line 37:


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0; white-space:pre;"|clickMarker (
|valign="top" style="signature"|
clickMarker(
Marker marker)  
Marker marker)  
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Simulates a clicking a marker. Will recenter the pan if its not currently in the viewport of the map.  
Simulates a clicking a marker. Will recenter the pan if its not currently in the viewport of the map.  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|disableDragging ()
|valign="top" style="signature"|
disableDragging()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Disables all dragging on the map. Note: panning controls will still work.  
Disables all dragging on the map. Note: panning controls will still work.  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|enableDragging ()
|valign="top" style="signature"|
enableDragging()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Re-enables dragging on the map if it was disabled.  
Re-enables dragging on the map if it was disabled.  
 


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin: 0; white-space: pre;"|enterAndZoomAtSLCoord(  
|valign="top" style="signature"|
enterAndZoomAtSLCoord(  
XYPoint coordinate,  
XYPoint coordinate,  
int zoom)
int zoom)
Line 61: Line 65:


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|getCurrentZoomLevel ()
|valign="top" style="signature"|
getCurrentZoomLevel()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Gets the current zoom level (1-6). See [http://secondlife.com/developers/mapapi/index.html#about_zoom about zoom levels].
Gets the current zoom level (1-6). See [http://secondlife.com/developers/mapapi/index.html#about_zoom about zoom levels].


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|getMapCenter ()  
|valign="top" style="signature"|
getMapCenter()  
|valign="top"|XYPoint
|valign="top"|XYPoint
|valign="top"|  
|valign="top"| Returns the current map center. See [http://secondlife.com/developers/mapapi/index.html#about_coords about coordinates].
Returns the current map center. See [http://secondlife.com/developers/mapapi/index.html#about_coords about coordinates].


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|getViewportBounds ()  
|valign="top" style="signature"|
getViewportBounds()  
|valign="top"|Bounds
|valign="top"|Bounds
|valign="top"|  
|valign="top"| Gets the viewport bounds. See [http://secondlife.com/developers/mapapi/index.html#about_coords about coordinates].  
Gets the viewport bounds. See [http://secondlife.com/developers/mapapi/index.html#about_coords about coordinates].  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|panDown ()  
|valign="top" style="signature"|
panDown()  
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Pans the map to the down by half its width.
Pans the map to the down by half its width.


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|panLeft ()
|valign="top" style="signature"|
panLeft()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Pans the map to the left by 1/2 its width.
Pans the map to the left by 1/2 its width.


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0; white-space: pre;"|panOrRecenterToSLCoord (
|valign="top" style="signature"|
panOrRecenterToSLCoord(
XYPoint coord,  
XYPoint coord,  
Boolean recenter )  
Boolean recenter )  
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Pans the map to the given coordinate if it is currently in the viewport (in the user's view). Otherwise, recenters the map to the given coordinate. The optional recenter argument  specifies whether to center the given coordinate even it if is currently in the viewport. Its default value is false.  
Pans the map to the given coordinate if it is currently in the viewport (in the user's view). Otherwise, recenters the map to the given coordinate.
 
The optional recenter argument  specifies whether to center the given coordinate even it if is currently in the viewport. Its default value is false.  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|panRight ()
|valign="top" style="signature"|
panRight()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Pans the map to the right by 1/2 its width.  
Pans the map to the right by 1/2 its width.  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|panUp ()
|valign="top" style="signature"|
panUp()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Pans the map to the up by 1/2 its width.  
Pans the map to the up by 1/2 its width.  


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|removeAllMarkers ()   
|valign="top" style="signature"|
removeAllMarkers()   
|valign="top"| None
|valign="top"| None
|valign="top"|  
|valign="top"| Removes all markers.
Removes all markers.


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0; white-space: pre;"|removeMarker (
|valign="top" style="signature"|
removeMarker(
Marker marker)   
Marker marker)   
|valign="top"| None
|valign="top"| None
Line 125: Line 128:


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0; white-space: pre;"|setCurrentZoomLevel (
|valign="top" style="signature"|
setCurrentZoomLevel(
int zoom)  
int zoom)  
|valign="top"| None
|valign="top"| None
Line 131: Line 135:


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|zoomIn ()  
|valign="top" style="signature"|
zoomIn()  
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Zooms in on the map if the map is not already all the way zoomed in.
Zooms in on the map if the map is not already all the way zoomed in.


|-
|-
|valign="top" style="font: 10pt courier; padding: 10px 10px 0 10px; margin:0;"|zoomOut ()
|valign="top" style="signature"|
zoomOut()
|valign="top"| None
|valign="top"| None
|valign="top"|
|valign="top"| Zooms out on the map if the map is not already all the way zoomed out.  
Zooms out on the map if the map is not already all the way zoomed out.  
|}
|}

Revision as of 17:07, 22 January 2009

SLMap

This class represents the map.

Constructor

Constructor

SLMap ( HTMLElement container, SLMapOptions options )

Creates the map. The SLMapOptions argument is optional.

Methods

Method Return Value Description

addMapWindow( MapWindow mapWindow, XYPoint coord )

None Adds a MapWindow to the map at specified coordinate.

addMarker( Marker marker, MapWindow mapWindow )

None Adds a marker. If the optional mapWindow argument is null, then clicking on the marker will not open a window.

clickMarker( Marker marker)

None Simulates a clicking a marker. Will recenter the pan if its not currently in the viewport of the map.

disableDragging()

None Disables all dragging on the map. Note: panning controls will still work.

enableDragging()

None Re-enables dragging on the map if it was disabled.


enterAndZoomAtSLCoord( XYPoint coordinate, int zoom)

None Centers and zooms the map to the specified location.

getCurrentZoomLevel()

None Gets the current zoom level (1-6). See about zoom levels.

getMapCenter()

XYPoint Returns the current map center. See about coordinates.

getViewportBounds()

Bounds Gets the viewport bounds. See about coordinates.

panDown()

None Pans the map to the down by half its width.

panLeft()

None Pans the map to the left by 1/2 its width.

panOrRecenterToSLCoord( XYPoint coord, Boolean recenter )

None Pans the map to the given coordinate if it is currently in the viewport (in the user's view). Otherwise, recenters the map to the given coordinate. The optional recenter argument specifies whether to center the given coordinate even it if is currently in the viewport. Its default value is false.

panRight()

None Pans the map to the right by 1/2 its width.

panUp()

None Pans the map to the up by 1/2 its width.

removeAllMarkers()

None Removes all markers.

removeMarker( Marker marker)

None Removes a marker.

setCurrentZoomLevel( int zoom)

None Sets the zoom level to specified zoom.

zoomIn()

None Zooms in on the map if the map is not already all the way zoomed in.

zoomOut()

None Zooms out on the map if the map is not already all the way zoomed out.