GMarker [class]-GoogleMaps/API/doc/ClassReference/03-GMarker-N☆E 学習帳

[ リロード ]   [ ソース ]  [ トップ | 一覧 | 単語検索 | 最新 | バックアップ | ヘルプ ]

Counter: 3444, today: 2, yesterday: 1

GMarker [class]

http://www.google.com/apis/maps/docu­mentation/

Version 2 (2006.4)

A GMarker marks a position on the map. It implements the GOverlay interface and thus is added to the map using the GMap2.addOverlay() method.

A marker object has a point, which is the geographical position where the marker is anchored on the map, and an icon. If the icon is not set in the constructor, the default icon G_DEFAULT_ICON is used.

After it is added to a map, the info window of that map can be opened through the marker. The marker object will fire mouse events and infowindow events.

Constructor

Constructor Description
GMarker(point, icon?, inert?) Creates a marker at point with icon or the G_DEFAULT_ICON. If the inert flag is true, then the marker is not clickable and will not fire any events.(Deprecated since 2.50)
GMarker(point, opts?) Creates a marker at point with options specified in GMarkerOptions. By default markers are clickable & have the default icon G_DEFAULT_ICON. (Since 2.50)

Rivision 2.50a 以降、上段( GMarker(point, icon?, inert?) )の引数は非推奨になる。(2006.5.15現在、API v2 Current: 2.50a ・ Default: 2.48)
GMarkerOptions
 

Methods

Before these methods can be invoked, the marker must be added to a map.

Methods Return Value Description
openInfoWindow(content, opts?) none Opens the map info window over the icon of the marker. The content of the info window is given as a DOM node. Only option GInfoWindowOptions.maxWidth is applicable.
openInfoWindowHtml(content, opts?) none Opens the map info window over the icon of the marker. The content of the info window is given as a string that contains HTML text. Only option GInfoWindowOptions.maxWidth is applicable.
openInfoWindowTabs(tabs, opts?) none Opens the tabbed map info window over the icon of the marker. The content of the info window is given as an array of tabs that contain the tab content as DOM nodes. Only options GInfoWindowOptions.maxWidth and InfoWindowOptions.selectedTab are applicable.
openInfoWindowTabsHtml(tabs, opts?) none Opens the tabbed map info window over the icon of the marker. The content of the info window is given as an array of tabs that contain the tab content as Strings that contain HTML text. Only options InfoWindowOptions.maxWidth and InfoWindowOptions.selectedTab are applicable.
showMapBlowup(opts?) none Opens the map info window over the icon of the marker. The content of the info window is a closeup map around the marker position. Only options InfoWindowOptions.zoomLevel and InfoWindowOptions.mapType are applicable.
getIcon() GIcon Returns the icon of this marker, as set by the constructor.
getPoint() GLatLng Returns the geographical coordinates of the point at which this marker is anchored, as set by the constructor or by setPoint().
setPoint(point) none Sets the geographical coordinates of the point at which this marker is anchored.

 

Events

All these events fire only if the marker is not inert (see constructor).

Events Arguments Description
click none This event is fired when the marker icon was clicked. Notice that this event will also fire for the map, with the marker passed as the first argument to the event handler there.
dblclick none This event is fired when the marker icon was double-clicked. Notice that this event will not fire for the map, because the map centers on double-click as a hardwired behavior.
mousedown none This event is fired when the DOM mousedown event is fired on the marker icon. Notice that the marker will stop the mousedown DOM event, so that it doesn't cause the map to start dragging.
mouseup none This event is fired for the DOM mouseup on the marker. Notice that the marker will not stop the mousedown DOM event, because it will not confuse the drag handler of the map.
mouseover none This event is fired when the mouse enters the area of the marker icon.
mouseout none This event is fired when the mouse leaves the area of the marker icon.
infowindowopen none This event is fired when the info window of the map was opened through this marker.
infowindowclose none This event is fired when the info window of the map that was opened through this marker is closed again. This happens when either the info window was closed, or when it was opened on another marker, or on the map.
remove none This event is fired when the marker is removed from the map, using GMap2.removeOverlay() or GMap2.clearOverlays().

 

Version 1

GMarker is a type of map overlay that shows an icon at a single point on the map. The constructor takes an instance of GIcon, which can be shared among many markers, and the point at which it should be displayed. GMarker also includes some convenience methods to open info windows over the marker, which is common for Google Maps hacks.

Constructor

Constructor Description
GMarker(point, icon?) Creates a marker with the given icon at the given point. If no icon is given, we use the default Google Maps icon.

 

Methods

Method Description
openInfoWindow(htmlElem) Opens an info window with the given HTML content over this marker. htmlElem should be an HTML DOM element.
openInfoWindowHtml(htmlStr) Like openInfoWindow, but takes an HTML string rather than an HTML DOM element
openInfoWindowXslt(xmlElem, xsltUri) Like openInfoWindow, but takes an XML element and the URI of an XSLT document to produce the content of the info window. The first time a URI is given, it is downloaded with GXmlHttp and subsequently cached.
showMapBlowup(zoomLevel?, mapType?) Shows a blowup of the map over this marker. We use a default zoom level of 1 and the current map type if the zoomLevel and mapType parameters are not given.

 

Events

Event Arguments Description
click none Triggered when the user clicks on this marker
infowindowopen none Triggered when the info window is opened above this marker with one of the methods above
infowindowclose none Triggered when the info window above this marker is closed