*GMap2 [class]
http://www.google.com/apis/maps/documentation/
**Version 2 (2006.4) &font(Red){新規};
>Instantiate class GMap2 in order to create a map. This is the central class in the API. Everything else is auxiliary.
***Constructor
|TLEFT:97%||c
|Constructor|Description|h
|GMap2(container, opts?)|Creates a new map inside of the given HTML container, which is typically a DIV element. If no set of map types is given in the optional argument opts.mapTypes, the default set G_DEFAULT_MAP_TYPES is used. If no size is given in the optional argument opts.size, then the size of the container is used. If opts.size is given, then the container element of the map is resized accordingly. See class &font(Red){GMapOptions};.|
***Methods
****Configuration
|TLEFT:97%||c
|Methods|Return Value|Description|h
|enableDragging()|none|Enables the dragging of the map (enabled by default).|
|disableDragging()|none|Disables the dragging of the map.|
|draggingEnabled()|Boolean|Returns true &font(Blue){iff}; the dragging of the map is enabled.|
|enableInfoWindow()|none|Enables info window operations on the map (enabled by default).|
|disableInfoWindow()|none|Closes the info window, if it is open, and disables the opening of a new info window.|
|infoWindowEnabled()|Boolean|Returns true &font(Blue){iff}; the info window is enabled.|
|enableDoubleClickZoom()|none|Enables double click to zoom in and out (disabled by default). (Since &font(Fuchsia){2.58};)|
|disableDoubleClickZoom()|none|Disables double click to zoom in and out. (Since &font(Fuchsia){2.58};)|
|doubleClickZoomEnabled()|Boolean|Returns true iff double click to zoom is enabled. (Since &font(Fuchsia){2.58};)|
|enableContinuousZoom()|none|Enables continuous smooth zooming for select browsers (disabled by default). (Since &font(Fuchsia){2.58};)|
|disableContinuousZoom()|none|Disables continuous smooth zooming. (Since &font(Fuchsia){2.58};)|
|continuousZoomEnabled()|Boolean|Returns true iff continuous smooth zooming is enabled. (Since &font(Fuchsia){2.58};)|
&font(Blue){iff};(いふふ)って?~
****Controls
|TLEFT:97%||c
|Methods|Return Value|Description|h
|addControl(control, &font(Red){position?};)|none|Adds the control to the map. The position on the map is determined by the optional position argument. If this argument is absent, the default position of the control is used, as determined by the &font(Blue){GControl.getDefaultPosition()}; method. A control instance must not be added more than once to the map.|
|removeControl(control)|none|Removes the control from the map. It does nothing if the control was never added to the map.|
|&font(Red){getContainer()};|Node|Returns the DOM object that contains the map. Used by GControl.initialize().|
****Map Types
|TLEFT:97%||c
|Methods|Return Value|Description|h
|getMapTypes()|Array of GMapType|Returns the array of map types registered with this map.|
|getCurrentMapType()|GMapType |Returns the currently selected map type.|
|setMapType(type)|none|Selects the given new map type. The type must be known to the map. See the constructor, and the method addMapType().|
|&font(Red){addMapType(type)};|none|Adds a new map type to the map. See section &font(Blue){GMapType}; for how to define custom map types.|
|&font(Red){removeMapType(type)};|none|Removes the map type from the map. Will update the set of buttons displayed by the GMapTypeControl and fire the removemaptype event.|
****Map State
|TLEFT:97%||c
|Methods|Return Value|Description|h
|&font(Red){isLoaded()};|Boolean|Returns true iff the map was initialized by setCenter() since it was created.|
|&font(Red){getCenter()};|GLatLng |Returns the geographical coordinates of the center point of the map view.|
|&font(Red){getBounds()};|GLatLngBounds |Returns the the visible rectangular region of the map view in geographical coordinates.|
|&font(Red){getBoundsZoomLevel(bounds)};|Number|Returns the zoom level at which the given rectangular region fits in the map view. The zoom level is computed for the currently selected map type. If no map type is selected yet, the first on the list of map types is used.|
|&font(Red){getSize()};|GSize |Returns the size of the map view in pixels.|
|&font(Red){getZoom()};|Number|Returns the current zoom level.|
&font(Red){getBoundsZoomLevel(bounds)}; 領域がおさまるズームレベルを返してくれる。 :)
****Modify the Map State
|TLEFT:97%||c
|Methods|Return Value|Description|h
|&font(Red){setCenter};(center, zoom?, &font(Blue){type?};)|none|Sets the map view to the given center. Optionally, also sets zoom level and map type. The map type must be known to the map. See the constructor, and the method addMapType(). This method must be called first after construction to set the initial state of the map. It is an error to call other operations on the map after construction.|
|&font(Red){panTo};(center)|none|Changes the center point of the map to the given point. If the point is already visible in the current map view, change the center in a smooth animation.|
|&font(Red){panBy(distance)};|none|Starts a pan animation by the given &font(Blue){distance in pixels};.|
|&font(Red){panDirection};(dx, dy)|none|Starts a pan animation by half the width of the map in the indicated directions. +1 is right and down, -1 is left and up, respectively.|
|&font(Red){setZoom};(level)|none|Sets the zoom level to the given new value.|
|&font(Red){zoomIn};()|none|Increments zoom level by one.|
|&font(Red){zoomOut};()|none|Decrements zoom level by one.|
|&font(Red){savePosition};()|none|Stores the current map position and zoom level for later recall by &font(Red){returnToSavedPosition};().|
|&font(Red){returnToSavedPosition};()|none|Restores the map view that was saved by &font(Red){savePosition};().|
|&font(Red){checkResize};()|none|Notifies the map of a change of the size of its container. Call this method after the size of the container DOM object has changed, so that the map can adjust itself to fit the new size.|
&font(Red){setCenter};(center, zoom?, &font(Blue){type?};) ← centerAndZoom(latLng, zoomLevel)[Ver1]~
&font(Red){panTo};(center) ← recenterOrPanToLatLng(latLng)[Ver1]
テスト:~
panBy(distance) → http://never-ever.info/googlemaps/ver2/panby.html
****Overlays
|TLEFT:97%||c
|Methods|Return Value|Description|h
|addOverlay(overlay)|none|Adds an overlay to the map and fires the addoverlay event.|
|removeOverlay(overlay)|none|Removes the overlay from the map. If the overlay was on the map, it fires the removeoverlay event.|
|clearOverlays()|none|Removes all overlay from the map, and fires the clearoverlays event.|
|&font(Red){getPane(pane)};|Node|Returns a DIV that holds the object in the layer identified by pane. Used by &font(Red){GOverlay}; instances in method &font(Red){GOverlay.initialize};() instances to draw themselves on the map|
~
****Info Window
|TLEFT:97%||c
|Methods|Return Value|Description|h
|openInfoWindow(point, node, opts?)|none|Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as a DOM node.|
|openInfoWindowHtml(point, html, opts?)|none|Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text.|
|&font(Red){openInfoWindowTabs};(point, tabs, opts?)|none|Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as DOM nodes.|
|&font(Red){openInfoWindowTabsHtml};(point, tabs, opts?)|none|Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text.|
|showMapBlowup(point, opts?)|none|Opens an info window at the given point that contains a closeup view on the map around this point.|
|closeInfoWindow()|none|Closes the currently open info window.|
|&font(Red){getInfoWindow};()|GInfoWindow |Returns the info window object of this map. If no info window exists yet, it is created, but not displayed. This operation is not influenced by enableInfoWindow().|
****Coordinate Transformations
|TLEFT:97%||c
|Methods|Return Value|Description|h
|&font(Red){fromLatLngToDivPixel};(latlng)|GPoint |Computes the pixel coordinates of the given geographical point in the DOM element that holds the draggable map. You need this method to position a custom overlay when you implement the &font(Red){GOverlay.redraw};() method for a custom overlay.|
|&font(Red){fromDivPixelToLatLng};(pixel)|GLatLng |Computes the geographical coordinates from pixel coordinates in the div that holds the draggable map. You need this when you implement interaction with custom overlays.|
|&font(Red){fromContainerPixelToLatLng};(pixel)|GLatLng |Computes the geographical coordinates of the point at the given pixel coordinates in the DOM element that contains the map on the page. You need this when you implement interaction of custom controls with the map.|
テスト:~
fromLatLngToDivPixel → http://never-ever.info/googlemaps/ver2/fromlatlngtodivpixel.html~
fromDivPixelToLatLng → http://never-ever.info/googlemaps/ver2/fromdivpixeltolatlng.html~
fromContainerPixelToLatLng → http://never-ever.info/googlemaps/ver2/fromcontainerpixeltolatlng.html (fromContainerPixelToLatLng と fromDivPixelToLatLng との違い)
参考:~
Google Maps API Tutorial : http://www.econym.demon.co.uk/googlemaps/reference.htm~
***Events
|TLEFT:97%||c
|Events|Arguments|Description|h
|&font(Red){addmaptype};|type|This event is fired when a map type is added to the map.|
|&font(Red){removemaptype};|type|This event is fired when a map type is removed from the map.|
|click|overlay, point|This event is fired when the map is clicked with the mouse. If the click was on a marker, then the marker is passed to the event handler in the overlay argument, and a click event is also fired on the marker. Otherwise, the geographical coordinates of the point that was clicked are passed in the point argument.|
|movestart|none|This event is fired when the map view starts changing. This can be caused by dragging, in which case a dragstart event is also fired, or by invocation of a method that changes the map view.|
|move|none|This event is fired, possibly repeatedly, while the map view is changing.|
|moveend|none|This event is fired when the change of the map view ends.|
|&font(Blue){zoomend};|oldLevel, newLevel|This event is fired when the map reaches a new zoom level. The event handler receives the previous and the new zoom level as arguments.|
|maptypechanged|none|This event is fired when another map type is selected.|
|infowindowopen|none|This event is fired when the info window opens.|
|infowindowclose|none|This event is fired when the info window closes. If a currently open info window is reopened at a different point using another call to openInfoWindow*(), then infowindowclose will fire first.|
|addoverlay|overlay|This event is fired when a single overlay is added to the map by the method addOverlay(). The new overlay is passed as an argument overlay to the event handler.|
|removeoverlay|overlay|This event is fired when a single overlay is removed by the method removeOverlay(). The overlay that was removed is passed as an argument overlay to the event handler.|
|clearoverlays|none|This event is fired when all overlays are removed at once by the method clearOverlays().|
|&font(Red){mouseover};|latlng|This event is fired when the user moves the mouse over the map from outside the map.|
|&font(Red){mouseout};|latlng|This event is fired when the user moves the mouse off the map.|
|&font(Red){mousemove};|latlng|This event is fired when the user moves the mouse inside the map.|
|&font(Red){dragstart};|none|This event is fired when the user starts dragging the map.|
|&font(Red){drag};|none|This event is repeatedly fired while the user drags the map.|
|&font(Red){dragend};|none|This event is fired when the user stops dragging the map.|
|&font(Red){load};|none|This event is fired when the map setup is complete, and isLoaded() would return true. This means position, zoom, and map type are all initialized, but tile images may still be loading. &font(Fuchsia){(Since 2.52)};|