Google Maps API非官方参考(未完成)(http://www.econym.demon.co.uk/googlemaps) - kukukuan的开发专栏 - 博客园

来源:百度文库 编辑:神马文学网 时间:2024/04/28 05:02:52
Google Maps API非官方参考(未完成)(http://www.econym.demon.co.uk/googlemaps) 本页包含了Google Maps API中所有对象, 类, 属性和方法信息. 参见 官方Google Maps API文档.以下所有对象和类以字母表顺序列出G_ANCHOR_BOTTOM_LEFT变量, 值为2, 可用于设置GControlPosition() --------------------------------------------------------------------------------G_ANCHOR_BOTTOM_RIGHT变量, 值为3, 可用于设置GControlPosition() --------------------------------------------------------------------------------G_ANCHOR_TOP_LEFT变量, 值为0, 可用于设置GControlPosition() --------------------------------------------------------------------------------G_ANCHOR_TOP_RIGHT变量, 值为1, 可用于设置GControlPosition() --------------------------------------------------------------------------------G_DEFAULT_ICON默认的GIcon()图标对象, 拥有GIcon类的所有属性和方法 --------------------------------------------------------------------------------G_DEFAULT_MAP_TYPES一组GMapType()对象, 用于描述默认可用的地图类型 --------------------------------------------------------------------------------G_GEO_BAD_KEY一个代表由于不正确的API Key造成GClientGeocoder失败的变量 --------------------------------------------------------------------------------G_GEO_MISSING_ADDRESS一个代表由于无地址信息造成GClientGeocoder失败的变量 --------------------------------------------------------------------------------G_GEO_SERVER_ERROR一个代表由于未知原因造成GClientGeocoder失败的变量 --------------------------------------------------------------------------------G_GEO_SUCCESS一个代表GClientGeocoder成功的变量 --------------------------------------------------------------------------------G_GEO_TOO_MANY_QUERIES未公开 一个代表由于查询次数超出限制造成GClientGeocoder失败的变量 --------------------------------------------------------------------------------G_GEO_UNAVAILABLE_ADDRESS一个代表由于法律或契约限制造成GClientGeocoder失败的变量 --------------------------------------------------------------------------------G_GEO_UNKNOWN_ADDRESS一个代表由于无法找到匹配地址造成GClientGeocoder失败的变量 --------------------------------------------------------------------------------G_HYBRID_MAPGMapType()地图类型对象, 混合型, 拥有GMapType()类的所有属性和方法 --------------------------------------------------------------------------------G_HYBRID_TYPEG_HYBRID_MAP的别名, 向后兼容API V1 --------------------------------------------------------------------------------G_MAP_FLOAT_PANE在GMap2.getPane()方法中被用于获取pane的变量, 值为7 --------------------------------------------------------------------------------G_MAP_FLOAT_SHADOW_PANE在GMap2.getPane()方法中被用于获取pane的变量, 值为5 --------------------------------------------------------------------------------G_MAP_MAP_PANE在GMap2.getPane()方法中被用于获取pane的变量, 值为0 --------------------------------------------------------------------------------G_MAP_MARKER_MOUSE_TARGET_PANE在GMap2.getPane()方法中被用于获取pane的变量, 值为6 --------------------------------------------------------------------------------G_MAP_MARKER_PANE在GMap2.getPane()方法中被用于获取pane的变量, 值为4 --------------------------------------------------------------------------------G_MAP_MARKER_SHADOW_PANE在GMap2.getPane()方法中被用于获取pane的变量, 值为2 --------------------------------------------------------------------------------G_MAP_TYPEG_NORMAL_MAP的别名, 向后兼容API V1 --------------------------------------------------------------------------------G_NORMAL_MAPGMapType()地图类型对象, 普通型, 拥有GMapType() 类的所有属性和方法 --------------------------------------------------------------------------------G_SATELLITE_MAPGMapType()地图类型对象, 卫星型, 拥有GMapType() 类的所有属性和方法 --------------------------------------------------------------------------------G_SATELLITE_TYPEG_SATELLITE_MAP的别名, 向后兼容API V1 --------------------------------------------------------------------------------GAddCopyright()未公开 用于在地图内添加版权信息参数 a string the getUrlArg() of the maptype to which the copyright applies. b string 编号 c float 最小纬度 d float 最小经度 e float 最大纬度 f float 最大经度 g integer 最小缩放尺寸 h string 版权文字 --------------------------------------------------------------------------------GBounds()用于以API VI的方法定义一个矩形地理区域, 或者用像素来定义一个矩形区域构造函数可以采用两种形式 未公开 new GBounds(minX, minY, maxX, maxY) 或 公开 new GBounds(array) 如果传递了四个参数, 它们会被认为是四个角的经度和纬度, 如果数组GPoint()或GLatLng ()被传递, 包含这些点GBounds对象就会被创建.属性 minX 坐标系西边 maxX 坐标系东边 minY 坐标系南边 maxY 坐标系被边 方法containsBounds(bounds) 如果本GBounds完全包含另一个Gbounds时返回真值 copy() 未公开 返回此GBounds的一个副本 equals(bounds) 未公开 V2.63及以上版本 当两个GBounds相等时返回真值 extend(point) 扩展此GBounds至包含原始区域和新点的最小区域 toString() 以如下格式返回((33.123, -120.123), (45.123, -100.234)).字符串 max() 返回东北角的GPoint() min() 返回西南角的GPoint() 静态方法GBounds().intersection(bounds, bounds) 返回两GBounds()的交叉部分 --------------------------------------------------------------------------------GBrowserIsCompatible()用于检测当前浏览器是否支持Google Maps --------------------------------------------------------------------------------GClientGeocoder用于调用Google Geocoder.构造函数new GClientGeocoder(gcache).参数可选, 如果存在, 则被用于确定哪个 GGeocodeCache或 GFactualGeocodeCache将被使用, 否则就创建新的 GGeocodeCache.方法 getCache() 返回当前使用的缓存 getLatLng(address, function) 向function传递最近的符合要求的地址的GLatLng值.如果没有地址符合要求, "null"将被传递个 function getLocations(address, function) 试图解析地址, 并传递一个包含返回信息细节的匿名结构给function reset() 重置缓存并清空其中条目 setCache(gcache) 改变geocoder的缓存.如果参数被忽略, 缓存将被关闭 --------------------------------------------------------------------------------GControl()用于创建一个"控件"的结构, 比如GMapTypeControl() 或 GLargeMapControl(), 可通过添加自定义方法创建新的控件.构造函数new GControl(a, b); a bool 如果为真, 则在打印地图时同时打印此控件, 如果为假或忽略, 控件的结构将被附以属性class="gmnoprint" b bool 如果设为假, 则控件上的文字不可被选中(原文对此存疑, 不过经测试, 官方手册上的说法准确) 方法clear() 未公开 ????? getDefaultPosition() 设置此值为设定自定义控件默认位置的函数, 该函数返回值应为GControlPosition()对象 initialize(a) 设置此值为自定义控件初始化的函数.可选参数可以是任何需要的值, 该值会在你使用map.addControl()时被传递给该函数 printable() 返回构造函数的第一个布尔参数 selectable() 返回构造函数的第二个布尔参数 --------------------------------------------------------------------------------GControlPosition()用于控制 GControl()对象的位置.构造函数new GControlPosition(anchor, offset); anchor integer 指定Map的一个角作为锚点.用 G_ANCHOR_BOTTOM_LEFT类型的变量. offset GSize() 指定控件层离锚点最近的那一点的坐标 方法apply(element) 对元素使用样式属性使之被置于一特定位置.该元素可以不是GControl()对象 示例假定我们有一个id属性为"message"的HTML元素, 则可以通过以下方法将其置于左上角 var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(100, 10)); pos.apply(document.getElementById("control")); document.getElementById("map").appendChild(document.getElementById("control"));此示例之时将该元素至于地图的左上角, 而并没有将其转化为GControl()对象.信息窗口会从下方穿过该层, 而控件会被信息窗口遮住. --------------------------------------------------------------------------------GCopyrightAdded in v2.50 用于存储版权信息的文本, 地区及其缩放范围.构造函数GCopyright(id, bounds, minZoom, text) id integer 每个GCopyright必须拥有不同的编号 bounds GLatLngBounds 指定放置版权信息的位置 minZoom integer 最小缩放尺寸 text string 版权信息的文本 属性和方法GCopyright没有属性或方法.-------------------------------------------------------------------------------- GCopyrightCollection()用于存储与某一GTileLayer()相关的所有GCopyright()对象.初始化时, 此集合为空, 但一旦地图发生改变并显示信息未被收集的地区, 一个新的GAddCopyright()对象会从服务器取出, 并被加到该集合. 构造函数GCopyrightCollection(prefix)参数 prefix text 在版权所有者之前显示的文本 方法addCopyright(gcopyright) 添加GCopyright对象到该集合 getCopyrightNotice(latlngbounds, zoom) API V2.50的新特性 返回指定地区和指定缩放尺寸的的版权说明 getCopyrights(latlngbounds, zoom) 返回指定地区和指定缩放尺寸的的版权说明字符串数组 --------------------------------------------------------------------------------GDownloadUrl()用于处理 GXmlHttp()中获取的文本, 指定的文本会被异步读取, 当读取结束, 数据会被作为一个长字符串传递个指定函数 .你可以使用该函数读取指定文本文件, 并用String.split()方法分割字符串.你也可以使用该函数从服务器读取指定 HTML代码片断, 并把它们放到side panel里. loadPanel = function(a) { document.getElementById("sidePanel").innerHTML = a; } GDownloadUrl("server.php?query=getdetials&id=fred", loadPanel);参数a string 被加载文件的URL b function 加载完成后被调用的函数 c string (Optional) 未公开 用POST方法发送请求到服务器.如果忽略该参数, 就会使用GET方法发送数据 d string (Optional) 未公开 POST请求的MIME类型, 默认为"application/x-www-form-urlencoded" 如果使用GET方法, 附加在URL后作为参数的数据将被限制在512byte之内. 如果使用POST方法, 则可以发送大量请求的数据到服务器, 同时MIME类型可以被指定. --------------------------------------------------------------------------------GDraggableObjectAdded in v2.59构造函数new GDraggableObject(HTMLElement, opts) 选项 container HTML Element 作为存放可拖动对象的HTML容器 draggableCursor string 鼠标经过时显示的光标 draggingCurosr string 拖动时显示的光标 left Number 对象的左边距 top Number 对象的上边距 属性left Sort-of 未公开 对象的水平位置 top Sort-of 未公开 对象的垂直位置 注意 设定GDraggableObject()的top和left属性并不会立即移动该HTML元素.该元素会在下次被拖动时跳到指定的位置. 静态方法getDraggingCursor() 未公开 返回当前拖动对象时光标的文本名称 setDraggableCursor(string) 设定鼠标移动到下一个可拖动对象上方时的光标 setDraggingCursor(string) 设定拖动对象时的光标 标准的光标为"auto", "crosshair", "default", "help", "move", "pointer", "text", "wait", 在某些浏览器中"hand"也是(我想原文做这指的是IE) 我想以上制定自定义光标的句法是依赖浏览器的. 实例方法 disable() 禁用拖动 dragging() 返回对象是否正在被拖动 enable() 启用拖动 enabled() 返回拖动是否被起用 --------------------------------------------------------------------------------GEvent用于注册和激发事件.以下是事件类型及可使用该事件的对象 GCopyrightCollection newcopyright GMap2 addmaptype, addoverlay, clearoverlays, click, dblclick, drag, dragend, dragstart, infowindowbeforeclose, infowindowclose, infowindowopen, infowindowprepareopen, load, maptypechanged, move, moveend, movestart, mousemove, mouseout, mouseover, mousewheel, removemaptype, removeoverlay, resize, zoomend, zooming, zoomstart DOMMouseScroll GMap [all the GMap2 events], zoom GMapType newcopyright GMarker click, changed, dblclick, infowindowbeforeclose, infowindowclose, infowindowopen, infowindowprepareopen, mousedown, mouseout, mouseover, mouseup, remove GMarkerManager changed GPolygon remove GPolyline remove GTileLayer newcopyright GKeyboardHandler moveend, movestart GInfoWindow animate, closeclick, maximizeclick, maximizeend, restoreclick, restoreend anything clearlisteners document logclick GDraggableObject click, dblclick, drag, dragend, dragstart, mousedown, mouseup, move GEvent.addDomListener() 用于向HTML元素添加事件监听器 参数 a object 可产生事件的HTML元素, 如document.getElementById("button") b string 事件名称, 如"click" or "moveend" c function 处理事件的函数, 可以使匿名函数或函数名称 GEvent.addListener() 用于添加事件监听器参数 a object 可产生事件的对象, 如标记或地图 b string 事件名称, 如"click" or "moveend" c function 处理事件的函数, 可以使匿名函数或函数名称 GEvent.bind() 用于为指定对象绑定事件及其触发的函数方法 参数 a object 可产生事件的对象, 如标记或地图 b string 事件名称, 如"click" or "moveend" c object 调用事件处理方法的对象 d method 处理事件的函数方法 GEvent.bindDom() 用于为指定HTML元素绑定事件及其触发的函数方法 参数 a object 可产生事件的HTML元素, 如document.getElementById("button") b string 事件名称, 如"click" or "moveend" c object 调用事件处理方法的对象 d method 处理事件的函数方法 GEvent.callback() Returns a function that calls the second parameter as a method of the first parameter. 参数 a object the object to which the method is to be applied b function the function to be used as a method of the object GEvent.callbackArgs() Returns a function that calls the second parameter as a method of the first parameter. 参数 a object the object to which the method is to be applied b function the function to be used as a method of the object c anything default first parameter to be passed to the method d anything default second parameter to be passed to the method e anything default third parameter to be passed to the method GEvent.clearInstanceListeners() 用于清除指定对象实例的所有事件监听器 参数 a object 可产生事件的对象, 如标记或地图 GEvent.clearListeners() 用于清除指定对象的指定事件监听器 参数 a object 可产生事件的对象, 如标记或地图 b string 事件名称, 如"click" or "moveend" GEvent.clearNode()未公开 用于清除指定对象及其子节点上的所有事件监听器 参数 a object 可产生事件的对象, 如标记或地图 GEvent.removeListener() 用于清除一个已命名的件监听器 参数 a listener 要被清除的件监听器, 此标记为GEvent.addListener()的返回值 GEvent.trigger() Triggers an event. 参数 a object 触发事件的对象, 如标记或地图 b string 事件名称, 如"click" or "moveend" c as required 被传递给事件处理函数的参数 d as required 被传递给事件处理函数的参数 e as required 被传递给事件处理函数的参数 --------------------------------------------------------------------------------GFactualGeocodeCache用于存储Geocode信息. 构造函数new GFactualGeocodeCache() 除了isCacheable()方法更为严格外, GFactualGeocodeCache类和GGeocodeCache类是一样的. --------------------------------------------------------------------------------GGeocodeCache用于存储Geocode信息.构造函数new GGeocodeCache()方法 get(address) 返回存储此地址的信息 isCacheable(reply) 返回GClientGeocoder.getLocations()是否可以被缓存 put(address, reply) 如果可以缓存信息, 存储地址及其信息到缓存 reset() 清空缓存里的内容 toCanonical(address) 返回canonical形式的地址, 使用标准化的标点和小写字母 --------------------------------------------------------------------------------GIcon()构造函数 new GIcon(gicon, image, label, shadow) 所有参数都可选如果第一个参数存在, 那么第一个参数gicon对象的所有属性将被拷贝到新的GIcon()中. 如果第二个参数存在, 那么它将使用GIcon().image属性. 如果第四个未公开参数存在, 那么它将使用GIcon().shadow属性. 比如var myIcon = new GIcon(G_DEFAULT_ICON, "mymarker.png")会创建一个和默认图标具有一样形状和大小, 但具有不同图像的GIcon()对象. 如果第三个未公开参数存在, 那么它作为label使用 label是一个额外覆盖在主图标上的图片.此特性允许创建一个同时拥有前景和背景的标签.在引入此特性前, 为了使用有不同的字母和背景颜色的标记, 用你必须为每种组合创建单独的图标图片. label是一个为命名的类, 拥有如下属性: label 未公开 url label图片文件的URL字符串 size 用于定义label图片像素大小的GSize()对象 anchor 用于确定label图片和主图片相对位置的GPoint()对象 属性 image 主图片文件的URL字符串 iconSize 用于定义主图片像素大小的GSize()对象 shadow 阴影文件的URL字符串 shadowSize 用于定义阴影像素大小的可选GSize()对象 iconAnchor 指定地理坐标的GPoint()对象, 可以被认为是住图片指向的位置 infoWindowAnchor 用于指定信息窗口尖端位置的GPoint()对象 label 未公开 (可选) 见上文 transparent (可选) 用于在IE中捕捉点击和鼠标经过事件的透明图片的名称 printImage (可选) 指定用以打印主图片的GIF文件 mozPrintImage (可选) 在Mozilla或Firefox浏览器中指定用于打印的GIF文件 printShadow (可选) 指定用以打印阴影图片的GIF文件 imageMap (可选) 一个用于在非IE浏览器中捕捉代表捕捉点击和鼠标经过事件的透明图片x/y坐标的数组 dragCrossAnchor 未公开 GPoint(): indicates the hot spot of the drag cross image, but with the x coordinate negated. E.g. if you want the anchor point of your image to be the pixel (4, 9) then you need to specify "new GPoint(-4, 9)" dragCrossImage 未公开 String: indicates an image to be used as the drag cross. If you set it to the null string, you get the default drag_cross_67_16.png image. dragCrossSize 未公开 GSize(): indicates the size of the drag cross. maxHeight 未公开 integer: The maximum difference in height between the marker anchor and the drag cross anchor during dragging. Setting the maxHeight to zero causes it to use the default 13. --------------------------------------------------------------------------------GInfoWindow()GInfoWindow类中只有一个对象.你可以通过map.getInfoWindow()获得该对象并使用其方法.本类并不提供外部接口, 所以不能够创建新的对象.属性 API V2.59及以上版本, GInfoWindow没有可用属性方法 create(pane1, pane2) 未公开 在initialize()中被调用以创建新的Div层.两个参数分别是信息窗口及其阴影所在的区域 getContentContainers() 返回一组HTML元素的数组, 其中包含了每个标签页的内容 getTabs() 返回当前信息窗口中GInfoWindowTab()对象的数组 maximize(a) 未公开 执行最大化窗口, 只有在信息窗口有maxUrl属性时有效 restore(a) 未公开 执行还原窗口, 只有在信息窗口有maxUrl属性时有效 reposition(latlng, pixeloffset) 未公开 移动窗口. 参数分别是新的地理位置和信息窗口相对该位置的像素距离 getPixelOffset() 返回信息窗口相对地理位置的像素距离 getPoint() 返回代表地理位置的GLatLng getSelectedTab() 返回第几个标签页被选中, 从0开始计算 hide() 使信息窗口不可见 initialize(map) 未公开 被openInfoWIndow调用一创建新的信息窗口, 如果不存在信息窗口的话 isHidden() 返回信息窗口是否被隐藏(关闭) redraw(force) 未公开 如果参数为真, 则重绘信息窗口 remove() 未公开 销毁信息窗口 reset(point, tabs, size, offset, selectedTab) 改变信息窗口的全部后部分属性.第四和第五个参数可选. point: 新地理位置的GLatLng() tabs: array of GInfoWindowTab()s with HTML DOM elements (not HTML text strings) in the contentElem. size: 制定信息窗口显示区域的大小GSize().当使用reset()时, API不会自动为你计算窗口大小, 不过它会阻止你设定小于最小尺寸的区域 offset: (可选) 距离地理位置的像素距离GSize() selectedTab: (可选) an integer indicating which tab is selected. selectTab(i) 激活指定标签页 show() 使信息窗口可见 GInfoWindowTab()These are used to hold information about the tabs of tabbed info windows. 属性 contentElem HTML elements representing the contents of the info window corresponding to this tab It must be a HTML DOM element if using .openInfoWindow(), and must be a HTML string if using .openInfoWindowHtml(). name text displayed in the tab to identify it onclick 未公开 Possibly an optional function to be called when the tab is clicked. --------------------------------------------------------------------------------GKeyboardHandler()Create one of these if you want your map to respond to keyboard input like Google Local does. 构造函数new GKeyboardHandler(map, window) (The second parameter is 未公开) The GKeyboardHandler has no accessible 属性 or methods. GLargeMapControl()A GControl() object controlling zooming an panning Has all the 属性 and methods of the GControl() class. --------------------------------------------------------------------------------GLatLng()Identifies a geographical location. Constructor new GLatLng(latitude, longitude, nofix) (Note that the latitude and longitude are in the opposite order from GPoint) If the optional nofix parameter is absent or false, the latitude is restricted to the range -90 to +90, and the longitude is wrapped round the globe to the value in the range -180 to +180. E.g. (-100, 270) would become (-90, -90) The constructor initially creates the x and y 参数 as copies of the hidden 参数 that control the location. Changing the values of the x and y 参数 does not change the location of the GLatLng object. 属性 y Latitude expressed in degrees (read only, deprecated) x Longitude expressed in degrees (read only, deprecated) 方法 lat() Returns the latitude lng() Returns the longitude latRadians() Returns the latitude expressed in radians lngRadians() Returns the longitude expressed in radians distanceFrom(latlng) Returns the distance expressed in metres from the specified location. equals(latlng) Returns true if the two latlngs identify the same location toString() 未公开 Returns a string in the format "(1.123456789, -1.123456789)" toUrlValue() Returns a string in the format "1.123457, -1.123457". The values are rounded to 6 decimal places. 静态方法 GLatLng.fromRadians(lat, lng, nofix) 未公开 Contructs a GLatLng from radian values instead of degrees GLatLng.fromUrlValue(string) 未公开 Constructs a GLatLng from a string in the format "1.123457, -1.123457". --------------------------------------------------------------------------------GLatLngBounds()Identifies a rectangular geographical region 构造函数 new GLatLngBounds(latlng, latlng) If two 参数 are passed, they are taken to represent the SouthWest and NorthEast corners of the rectangle. The corners must be in the right order for it to work correctly. If one parameter is passed, the region contains just that point. If no 参数 are passed, the regions is set to the empty region GLatLngBounds(new GLatLng(57.29577951308232, 180), GLatLng(-57.29577951308232, -180)). (The corners are in the wrong order). All the coordinates are normalized into the range -90 to +90 for the latitudes and -180 to +180 for the longitudes. 属性: GLatLngBounds has no accessible 属性 (made inacessible in v2.50) 方法 contains(latlng) Returns true if the bounds contain the location containsBounds(latlngbounds) Returns true if it fully contains the other bounds equals(latlngbounds) Returns true if the bounds are equal extend(latlng) Enlarges the bounds to be the smallest rectangle containing the previous area plus the specified location getCenter() Returns a GLatLng representing the centre getNorthEast() Returns a GLatLng representing the NorthEast corner getSouthWest() Returns a GLatLng representing the SouthWest corner intersects(latlngbounds) Returns true if the two bounds intersect isEmpty() Returns true if the bounds specify a negative region (i.e. the corners are specified in the wrong order) isFullLat() Returns true if the latitude range covers the whole Earth from -90 to +90 isFullLng() Returns true if the longitude range covers the whole Earth -180 to +180 toSpan() Returns a GLatLng object which represents the width and height of the region. toString() 未公开 Returns a string in the format ((33.123, -120.123), (45.123, -100.23399999999998)). The values may differ slightly from what you originally specified due to being converted to radians and back to degrees. --------------------------------------------------------------------------------GLoad()未公开 This function is used during the API loading sequence, to load the API. --------------------------------------------------------------------------------GLoadApi()未公开 This function is used during the API loading sequence, to pass information from the loader code to the API. 参数 a array of strings List of server paths for MAP tiles b array of strings List of server paths for SATELLITE tiles c array of strings List of server paths for HYBRID overlay tiles d string API key information --------------------------------------------------------------------------------GLoadMapsScript()未公开 This function is used during the API loading sequence to load the selected API Javascript file. --------------------------------------------------------------------------------GLog()A system that allows debugging information to be displayed. The GLog() methods are all static. You call them like 'GLog.write(text);' rather than using 'var log = new GLog(); log.write(text)' 方法 write(txt, colour) Writes the text to a log window that appears at the bottom of the screen. The optional colour parameter can be a string containing a colour specification, like "blue" or "#FF8888". writeHtml(txt) Writes the text to a log window that appears at the bottom of the screen, applying any HTML formatting. writeUrl(txt) Writes the text to a log window that appears at the bottom of the screen, formatted as a clickable link. --------------------------------------------------------------------------------GMap()A Gmap() object is a GMap2() object with a few extra methods layered on top, to provide backward compatibility. 构造函数 new GMap(a, b, c, d) 参数 a html element The map container, usually a b[ ] array of maptypes (optional) list of map types allowed on this map c integer (optional) Width of map d integer (optional) Height of map 属性 GMap() has no accessible properties additional methods centerAndZoom(point, zoom) Centres and zooms the map centerAtLatLng(point) Centres the map getBoundsLatLng() Returns a GBounds() object identifying the map bounds. getCenterLatLng() Returns a GPoint() identifying the centre getSpanLatLng() Returns a GSize() identifying the width and height of the map in lng and lat degrees getZoomLevel() Returns the APIv1 type zoom level. Note that this can be a negative value when the new deep v2 zoom levels are active. openInfoWindowXslt() Does nothing recenterOrPanToLatLng(point) Centres the map, doing a fluid pan to the point if it is within the current viewport zoomTo(zoom) overwritten methods These methods overwrite the GMap2() methods of the same name setMapType(a) Sets the map type. The parameter is a GMapType() object. openInfoWindow(a, b, c, d, e) Opens the info window, see below for parameters openInfoWindowHtml(a, b, c, d, e) Opens the info window, see below for parameters --------------------------------------------------------------------------------GMap2()构造函数 new GMap2(container, opts) 参数 container html element The map container, usually a opts (optional)Anonymous object may contain more information 选项 If you want to set up any of the other internal properties of your GMap2() you have to bundle them into an anonymous object. The constructor copies the named properties of this anonymous object into the hidden internal properties of the GMap2. E.g. var map = new GMap2(document.getElementById("map"), {mapTypes:[G_SATELLITE_TYPE]});property type purpose mapTypes Array of GMapType()s List of map types allowed on this map size GSize() Size of map draggableCursor string Specifies a cursor to use when the map is draggable draggingCursor string Specifies a cursor to use when the map is being dragged noResize bool undocumented Suppresses "resize" events suppressCopyright bool undocumented Set true to suppress the copyright message (e.g. for overview maps and blowup maps) usageType string undocumented Possible values are "o" for overview maps and "p" for blowup maps. Standard cursors are "auto", "crosshair", "default", "help", "move", "pointer", "text", "wait", and in some browsers "hand". I believe that the syntax for specifying custom cursors is browser specific. 属性 windo undocumented A reference to the Window() object which contains the map. 方法 addControl(control, controlposition) Causes the GControl() object to be added to the map If a GControlPosition() is not specified, the getDefaultPosition() is used. addMapType(maptype) Adds a map type to the map addOverlay(overlay) Causes the overlay to be added to the map. checkResize() Checks to see if the map container has changed size, and if so resizes the map clearOverlays() Removes all overlays except GTileLayerOverlay()s. closeInfoWindow() Closes the info window continuousZoomEnabled() Returns true if "continuous zoom" animations are enabled. disableContinuousZoom() Disables the "continuous zoom" animations. disableDoubleClickZoom() Causes double-click to just centre the map. disableDragging() Disables map dragging disableInfoWindow() Disables the info window doubleClickZoomEnabled() Returns true if double click zoom is enabled. draggingEnabled() Returns true if map dragging is enabled. enableContinuousZoom() Enables the "continuous zoom" animations - zooming in or out by one level is then amimated. enableDragging() Enables map dragging. enableDoubleClickZoom() Causes double-click to zoom in by one level and centre the map. enableInfoWindow() Enables the info window focus() Undocumented If the info window is open, returns its location as a GLatLng(). fromContainerPixelToLatLng(point) Converts a container pixel to a GLatLng() fromDivPixelToLatLng(latlng, nofix) Converts a "dragObject" div pixel to a GLatLng() If the optional second undocumented parameter is true, then the output is not normalized. Note: The values for ContainerPixel and DivPixel are initially the same, but the div moves when the map pans and the container doesn't. Markers keep the same DivPixel position when the map moves, and only get a new value when it zooms. fromLatLngToDivPixel(latlng, point) Converts a GLatLng() to a "dragObject" div pixel The optional second parameter is for resolving normalization ambiguities. When zoomed out, the same latlng position can be present on more than one tile. Without the second parameter, the copy nearest the centre is chosen. If the second parameter is present, its .x value controls which copy is chosen. getBounds() Returns a GLatLngBounds which indicates the bounds of the region covered by the map. getBoundsZoomLevel(latlngbounds) Returns the number of the deepest permitted zoom level of the current map type which is large enough to contain the specified region. getCenter() Returns a GLatLng() indicating the centre point of the map. getContainer() Returns a reference to the map getCurrentMapType() Returns a reference to the current GMapType() getInfoWindow() Returns a reference to the info window object. getMapTypes() Returns an array of GMapType()s that are allowed on this map. getPane(i) Returns a reference to one of the map panes. The draggable part of the map consists of seven html elements referred to as "panes". Different types of map elements are placed in different panes, e.g. the map tiles are placed in the lowest pane, markers are placed on a higher plane. The values G_MAP_MARKER_SHADOW_PANE, G_MAP_MARKER_PANE, G_MAP_FLOAT_SHADOW_PANE, G_MAP_MARKER_MOUSE_TARGET_PANE, G_MAP_FLOAT_PANE can be used to specify a specific pane. getSize() Returns a GSize() object indicating the size of the map in pixels. getZoom() Returns the current zoom level number. hideControls() undocumented Hides all hideable controls. The Logo, copyright and Terms are not hideable, all other controls are hideable. infoWindowEnabled() Returns true if the info window is enabled isLoaded() Returns true if the map has a map type. When initially created, a map has no map type. It will be given a map type the first time that setCenter() or setMapType() or setZoom() is used. openInfoWindow(a, b, c) Opens the info window, see below for parameters openInfoWindowHtml(a, b, c) Opens the info window, see below for parameters openInfoWindowTabs(a, b, c) Opens the info window, see below for parameters openInfoWindowTabsHtml(a, b, c) Opens the info window, see below for parameters panBy(gsize) Pans the map by the specified number of pixels in the x and y directions. panDirection(a, b) Pans in the direction specified by (a, b) e.g. map.panDirection(2, -1) causes the screen to pan two units North and one unit West Each pan unit is equal to half a screen. panTo(a) Recentres or pans to the specified GLatLng() position removeControl(a) Removes a GControl(). The parameter is the token returned from addControl() removeMapType(maptype) Removes a map type removeOverlay(a) Removes an overlay. returnToSavedPosition() Resets the map to the values saved by map.savePosition() savePosition() Saves the map centre and zoom level information which gets used when the user clicks on the "Return to last result" icon setCenter(a, b, c) If "a" is present, it is a GLatLng() specifying the new map centre. If "b" is present, it is n integer specifying the new zoom level. If "c" is present, it is a GMapType() specifying the new map type. All three parameters are optional. setFocus(a) undocumented setMapType(a) Sets the map type. The parameter is a GMapType() object. setZoom(a) Sets the zoom level. The parameter is an integer. showControls() undocumented Makes hidden controls visible. showMapBlowup(a, b) Opens the info window with a blowup maplet, see below for parameters zoomIn(latlng, bool, bool) Zooms in by one zoom level If the first undocumented parameter is present and the second parameter is present and true, then the map is centred at the specified GLatLng If the first undocumented parameter is present and the second parameter is absent or false, then the map centre is shifted in such a way that the specified GLatLng remains in the same position relative to the map container If the third undocumented parameter (new in v2.60) is present and set to true, then an animated zoom is performed if continuous zoom is enabled. zoomOut(latlng, bool) Zooms out by one zoom level If the first undocumented parameter is present then the map centre is shifted in such a way that the specified GLatLng remains in the same position relative to the map container If the second undocumented parameter (new in v2.60) is present and set to true, then an animated zoom is performed if continuous zoom is enabled. --------------------------------------------------------------------------------openInfoWindow() MethodsThere are a set of 15 methods for opening info windows, 5 methods each for GMap(), GMap2() and GMarker() objects. Some of the methods are inherited by the GMap() class from the GMap2() class, and some are overwritten with different parameters. I'm documenting them all in one chunk here, rather than repeating all the details 15 times. The different methods take slightly different parameters. Chosen from this list: point GLatLng() Geographical location. htmlElem HTML DOM element Info Window contents expressed as a DOM Element. htmlStr HTML string Info Window contents expressed as a string. tabElemArray array of GInfoWindowTab()s One for each tab, with a HTML DOM element in the contentElem tabStrArray array of GInfoWindowTab()s One for each tab, with a HTML string in the contentElem offset GSize() (Optional) Pixel offset from the point. selectedTab integer (Optional) Specifies the number of the tab to be initially selected. Counting from zero. If omitted, tab zero is selected. maxWidth integer (Optional) (Possibly) Maximum width that can be considered for info window contents size calculations. If omitted, the screen.width is used. The height calculations go wrong if this is set less than 217, the minimum infoWindow contents width. openFn function (Optional) Function to be called when the info window opens. closeFn function (Optional) Function to be called when the info window closes. opts anonymous object (Optional) may contain some or all of the following object properties: undocumented pixelOffset: GSize() selectedTab: integer maxWidth: integer undocumented maxUrl: string onOpenFn: function undocumented onPrepareOpenFn: function onCloseFn: function undocumented onBeforeCloseFn: function mapType: GMapType() undocumented suppressMapPan: boolean zoomLevel: integer for example: {pixelOffset:new GSize(32, 5), maxWidth: 540} Note: The onOpenFn, onPrepareOpenFn, onCloseFn and onBeforeCloseFn options only work for the map methods. When using marker.infoWindowOpen*(), those options are hijacked and replaced by calls to API internal functions that throw the corresponding events on the marker. zoom integer (Optional) Zoom level for the contained map. maptype GMapType() (Optional) Map type for the contained map The individual methods take the following parameters: GMap2().openInfoWindow(point, htmlElem, opts) GMap2().openInfoWindowHtml(point, htmlStr, opts) GMap2().openInfoWindowTabs(point, tabElemArray, opts) GMap2().openInfoWindowTabsHtml(point, tabStrArray, opts) GMap().openInfoWindow(point, htmlElem, offset, openFn, closeFn) GMap().openInfoWindowHtml(point, htmlStr, offset, openFn, closeFn) GMap().openInfoWindowTabs(point, tabElemArray, opts) GMap().openInfoWindowTabsHtml(point, tabStrArray, opts) marker.openInfoWindow(htmlElem, opts) marker.openInfoWindowHtml(htmlStr, opts) marker.openInfoWindowTabs(tabElemArray, opts) marker.openInfoWindowTabsHtml(tabStrArray, opts) GMap2().showMapBlowup(point, opts) GMap().showMapBlowup(point, zoom, maptype, offset, openFn, closeFn) marker.showMapBlowup(opts) In addition there is GMap().openInfoWindowXslt() and marker.openInfoWindowXslt(). These methods do nothing. They do not open an info window. They exist only so that maps written using this documented v1 syntax don't crash. --------------------------------------------------------------------------------GMapType()Holds the information about a map type. 构造函数 new GMapType(tileLayers, projection, name, opts) 参数 tilelayers An array of GTileLayer() objects projection A reference to the projection function, e.g. new GMercatorProjection(22) name The long name for the map type opts (optional)An anonymous object which may contain more information 选项 If you want to set up any of the other internal properties of your GMapType() you have to bundle them into an anonymous object. The constructor copies the named properties of this anonymous object into the hidden internal properties of the GMapType. property purpose default shortName Name to be used if GMapTypeControl() is in "tiny" mode "" urlArg A string which can be used to identify the map type. It can be used to link copyright information to map types. "c" maxResolution Maximum zoom level supported The highest zoom level supported by any of the GTileLayers minResolution Minimum zoom level supported The lowest zoom level supported by any of the GTileLayers textColor the text colour to by used for any text drawn above the map (e.g. the copyright text, and the numbers in GScaleControl). Can use a named colour, like "black", or a hex value like "#ffffff". "black" linkColor the text colour to be used for any links that are drawn above the map (e.g. "Terms of Use"). It can use a named colour, like "black", or a hex value like "#ffffff". "#7777cc" tileSize an integer that specifies the size of the tiles. Tiles are always square. 256 errorMessge a string containing the error message to be used if no tile can be served. "" 方法 getBoundsZoomLevel(latlngbounds, viewsize) Returns the highest supported zoom level for which the latlngbounds will fit in the specified viewsize. getErrorMessage() Returns a string containing the error message to be used if no tile can be served. getLinkColor() Returns the text colour to be used for any links that are drawn above the map (e.g. "Terms of Use"). It can use a named colour, like "black", or a hex value like "#ffffff". getMaximumResolution(a) Returns the number of the highest Zoom level that the map type supports. The function is coded to accept an optional parameter, but that parameter is always void. getMinimumResolution(a) Returns the number of the lowest Zoom level that the map type supports. The function is coded to accept an optional parameter, but that parameter is always void. getName(bool) Returns the name to be used in GMapTypeControl(). If the optional parameter is present and true, returns the short name to be used on tiny maps. getProjection() Returns the GProjection() object associated with the map type. getSpanZoomLevel(latlng, latlng, viewsize) (Possibly) Returns the highest supported zoom level for which a map centred at the first latlng will have a span greater than or equal to that specified by the second latlng. If no supported zoom level achieves that, it will return zero, even if that's not supported by this map type. getTextColor() Returns the text colour to by used for any text drawn above the map (e.g. the copyright text, and the numbers in GScaleControl). Can use a named colour, like "black", or a hex value like "#ffffff". getTileLayers() Returns an array of GTileLayer() objects. A map type can have more than one layer (as does G_HYBRID_MAP) getTileSize() Returns an integer that specifies the size of the tiles. Tiles are always square. getUrlArg() Returns a (one-character) string which can be used to identify the map type. It is used to identify the map type in the &t= parameter of Google Local. --------------------------------------------------------------------------------GMapTypeControl()A GControl() structure that manages map type switching, typically in the top right corner of the map. Has all the properties and methods of the GControl() class. It additionally accepts an optional parameter. 参数 a bool If present and true, the control will use short names in the map type buttons. --------------------------------------------------------------------------------GMarker()A GMarker() object plots an icon at a specified point on a map. 构造函数 format 1 new GMarker(point, icon, inert) deprecated point GLatLng() Specifies the geographical location where the marker is to be plotted. icon GIcon() (Optional) Icon to be plotted. If omitted, G_DEFAULT_ICON is used. inert bool (Optional) If true, the .clickable property is set false. 构造函数 format 2 new GMarker(point, opts) point GLatLng() Specifies the geographical location where the marker is to be plotted. opts (optional)Anonymous object may contain more information 选项 You can use either format for the GMarker constructor. The "draggable" option can only be set using format 2. E.g. var marker = new GMarker(point, {icon: myIcon, draggable:true}); property type purpose bouncy boolean Set false to disable the silly bounce animation of draggable markers. bounceGravity float Controls the downward acceleration of a released draggable marker bounceTimeout integer undocumented Controls the time between animation frames of a released draggable marker (and hence the velocity) icon GIcon() Icon to be plotted. If omitted, G_DEFAULT_ICON is used. clickable bool false to make the marker inert draggable bool true to make the marker draggable dragCrossMove bool true to make the cross move downwards rather than the icon move upwards during dragging. title string tooltip text id string undocumented sets the marker.id property A GMarker() has no accessible properties 方法 copy() undocumented Returns a new GMarker that is a copy of this one. disableDragging() Disables marker dragging. dragabble() Returns true if this marker was created as a draggable marker dragging() undocumented returns true if this marker is currently being dragged draggingEnabled() Returns true if dragging is enabled on this marker enable Dragging() Enables dragging, if the marker was created as a draggable marker getIcon() Returns the GIcon() associated with the marker getPoint() Returns the GLatLng() where the marker is located hide() undocumented Hides the marker initialize(map) Used by map.addOverlay() to set up the marker. openInfoWindow(a, b) Opens the info window, see above for parameters openInfoWindowHtml(a, b) Opens the info window, see above for parameters openInfoWindowTabs(a, b) Opens the info window, see above for parameters openInfoWindowTabsHtml(a, b) Opens the info window, see above for parameters redraw(bool) If the optional parameter is present and true, the marker is redrawn. remove() Destroys the images[ ]. Used by map.removeOverlay() to recover memory. setPoint(latlng) Changes the location of the marker, recalculates the z-index and redraws it. show() undocumented Makes a hidden marker visible showMapBlowup(a, b) Opens the info window with a blowup maplet, see above for parameters --------------------------------------------------------------------------------GMarkerManager()Undocumented A GMarkerManager() can be used to manage large numbers of markers efficiently as long as you're careful to only have a modest number of markers visible in the viewport at any one time. 构造函数 new GMarkerManager(map, options) 属性 There are no accessible properties Options borderPadding integer I think this specifies the size of a region around the viewport for which markers are processed. increasing the value makes it more likely that a marker will be already rendered when the map pans, but decreases the efficiency of redrawing the markers (e.g. when the zoom level changes). maxZoom integer The maximum zoom level to be managed. trackMarkers boolean Automatically refresh the marker display when a managed marker changes position with .setPoint(). 方法 addMarker(marker, minzoom, maxzoom) Adds a marker to be displayed when the zoom number is in the specified range. addMarkers(markerArray, minzoom, maxzoom) Adds an array of markers to be displayed when the zoom number is in the specified range. getMarkerCount(zoom) Returns the number of managed markers for the specified zoom level. refresh() Redraws the managed markers. --------------------------------------------------------------------------------GMercatorProjection()Handles the translation between geographical locations and pixel positions for a map type that uses Mercator maps. The GMercatorProjection() constructor and methods assume a tile size of 256 by 256. The getTileSize() information from the GMapType() is not used. 构造函数 new GMercatorProjection(maxResolution) 属性 There are no accessible properties 方法 fromLatLngToPixel(latlng, zoom) Returns a GPoint() containing the pixel position (in the tilespace) corresponding to the geographical location. fromPixelToLatLng(point, zoom, nofix) Returns a GLatLng() containing the geographical location corresponding to the point in tilespace. If the optional nofix parameter is not present, out of range latitudes are fixed to +-90, and out of range longitudes are wrapped around the globe into the range +-180. getWrapWidth(zoom) Returns the wrap width of the tile space in pixels. tileCheckRange(point, zoom, tilesize) Returns true if point.y is within the tilespace for the specified zoom level, and wraps point.x around the globe to a value that is within the tilespace. If point.y is outside the tilespace, then it returns false without wrapping point.x. The tilespace is a square array of tiles that cover the Earth. The Mercator projection never actually reaches the poles. In this implementation, the mapping stops at about latitude 85.0511. The pixel represented by GPoint(0, 0) always represents the geographical location GLatLng(85.0511, -180). At zoom level 0, there is one tile, tileBounds[0] is 1, pixelOrigo[0] is GPoint(128, 128) - the distance from a corner of that tile to the centre. At zoom level 1, there are four tiles in a 2*2 grid, tileBounds[1] is 2, pixelOrigo[1] is GPoint(256, 256). At zoom level 17, there are 17, 179, 869, 184 tiles in a 131072*131072 grid, tileBounds[17] is 131072, pixelOrigo[17] is GPoint(16777216, 16777216). --------------------------------------------------------------------------------GOverlay()This class holds the common methods that are inherited by GMarker(), GPolyline() , GPolygon() and GTileLayerOverlay() This class can also be used to create custom overlays, in which case you may need to create your own copies of the methods. 方法 copy() Returns a new GOverlay that is a copy of this one. initialize(map) Used by map.addOverlay() to set up the overlay. redraw(bool) If the optional parameter is present and true, the overlay is redrawn. remove() Used by map.removeOverlay() to recover memory. Static Method GOverlay.getZIndex(lat) Returns a z-index value for a given latitude. It computes a z index such that overlays further south are on top of overlays further north, thus creating the 3D appearance of marker overlays. --------------------------------------------------------------------------------GOverviewMapControl()A GControl() object providing an overview map Has all the properties and methods of the GControl() class plus the methods described below. 参数 a GSize() undocumented Specifies the size of the overview map. b GCopyrightControl undocumented Reference to a GCopyrightControl object which is to have its position adjusted as the overview expands and contracts. Unfortunately, within the API there's no way to obtain such a reference. This parameter is only usable within the real maps.google.com version of the code. 方法 getOverviewMap() undocumented Returns a pointer to the overview map div. hide(instant) Reduces the overview map to a small icon. If the undocumented parameter is set true then the overview closes instantly, otherwise there's a short animation. show(instant) Expands a hidden overview map. If the undocumented parameter is set true then the overview opens instantly, otherwise there's a short animation. --------------------------------------------------------------------------------GPoint()Identifies a pixel position or a pixel offset. 构造函数 new GPoint(x, y) 属性 x horizontal position y vertical position 方法 equals(point) Returns true if the two points are equal. toString Returns a string in the format "(123, 123)" GPolyline()Describes a vector polyline. Constructor new GPolyline(points, color, weight, opacity) Where "points" is an array of GLatLng() or GPoint() objects. 属性 A GPolyline() has no accessible properties methods copy() Returns a new GPolyline that is a copy of this one. getVertex(N) Returns a GLatLng() object specifying the location of the Nth point. getVertexCount() Returns the number of points in the polyline. initialize(map) Used by map.addOverlay() to set up the polyline. redraw(bool) If the optional parameter is present and true, the polyline is redrawn. remove() Used by map.removeOverlay() to recover memory. defaults If you omit the colour, weight or opacity, the default values will be used: "#0000ff", 5, 0.45 Static methods fromEncoded() Creates a polyline from an encoded string. See The official documentation GPolygon() undocumented Describes a filled polygon. 构造函数 new GPolygon(points, strokeColour, strokeWeight, strokeOpacity, fillColour, fillOpacity) Where "points" is an array of GLatLng() objects. 属性 A GPolygon() has no accessible properties 方法 copy() Returns a new GPolygon that is a copy of this one. getVertex(N) Returns a GLatLng() object specifying the location of the Nth point. getVertexCount() Returns the number of points in the polyline. initialize(map) Used by map.addOverlay() to set up the polyline. redraw(bool) If the optional parameter is present and true, the polygon is redrawn. remove() Used by map.removeOverlay() to recover memory. defaults Although GPolygon defines defaults for strokeWeight and fillColour, it never uses them. If you omit the strokeWeight, the stroke is not performed. If you omit the fillColor, GPolygon sets the fill colour to the default value, "#0055ff", but then doesn't perform the fill. The default fillOpacity is 0.25. The defaults for strokeColour and strokeOpacity are the same as those for GPolyline: "#0000ff" and 0.45 GProjection()This class provides a general structure for projection calculations. It is only used internally by GMercatorProjection() since that's the projection system that Google maps use. The methods provided by GProjection() are empty stubs. Any real GProjection() object would have to overwrite them with its own methods that perform the relevant calculations. It is possible to write your own GProjection() instance that uses a non-Mercator projection, such as Gall-Peters or Mollweide, or to write a flat projection for mapping non-spherical domains by writing suitable code to replace the method stubs. 方法 fromLatLngToPixel(latlng, zoom) Stub: Throws a an error "Required interface method not implemented" fromPixelToLatLng(point, zoom, nofix) Stub: Throws a an error "Required interface method not implemented" getWrapWidth(zoom) Returns Infinity. tileCheckRange(point, zoom, tilesize) Returns true. --------------------------------------------------------------------------------GScaleControl()A GControl() structure that displays a map scale, typically in the bottom left corner of the map. Has all the properties and methods of the GControl() class, and additionally has the properties shown below. If _mPreferMetric is set to true, then the metric scale is on top instead of below the feet/miles scale. It additionally accepts an optional parameter. 参数 a integer (Optional) Max length of the scale in pixels. 属性 bar A div containing part of the graphics cap A div containing part of the graphics container A div containing all the other divs fpsBar A div containing part of the graphics fpsLbl A div containing the text for non-metric measurements map A reference to the map that contains this Scale maxLength Max length of the scale in pixels metricBar A div containing part of the graphics metricLbl A div containing the text for metric measurements --------------------------------------------------------------------------------GSize()Represents the pixel size of a region or object. 构造函数 new GSize(width, height) 属性 width Width in pixels. height Height in pixels 方法 equals(gsize) Returns true if the GSize() objects are equal. toString() Returns a string in the format "(123, 123)" There is also a class property GSize.ZERO, which constructs a new GSize() object with zero height and width. --------------------------------------------------------------------------------GSmallMapControl()A GControl() structure that provides zoom and pan controls, typically in the top left corner of the map. Has all the properties and methods of the GControl() class. --------------------------------------------------------------------------------GSmallZoomControl()A GControl() structure that provides zoom controls, typically in the top left corner of the map. Has all the properties and methods of the GControl() class. --------------------------------------------------------------------------------GScript()undocumented This function loads a Javscript file into the current page. 参数 url URL of the .js file to be loaded --------------------------------------------------------------------------------GTileLayer()A GMapType() can have more than one layer of tiles. For example the G_HYBRID_MAP has one GTileLayer() that contains the satellite imagery, and a second GTileLayer() that contains the roads and town names. Some or all of the methods provided by the GMapType() class need to be overwritten by code specific to the tile layer when defining the GTileLayer() object. 构造函数 new GTileLayer(copyCollection, minResolution, maxResolution) 参数 copyCollection A GCopyrightCollection() object minResolution The minimum zoom level maxResolution The maximum zoom level The API code seems to be intended to allow you to omit the copyCollection parameter, but if you do, the code will crash later, so you need to create some sort of GCopyrightCollection(), even if you never use it. E.g. new GTileLayer(new GCopyrightCollection(""), 7, 14) sets up a tile layer which supports zoom levels 7 to 14. 方法 getCopyright(latlngbounds, zoom) undocumented Reads data from the GCopyrightCollection getOpacity() Returns 1 getTileUrl(tile, zoom) Stub: Throws a an error "Required interface method not implemented" The "tile" parameter is a GPoint(x, y) object, but the x and y represent tile numbers, not pixels. isPng() Returns false maxResolution() Returns the maximum resolution of the layer minResolution() Returns the minimum resolution of the layer --------------------------------------------------------------------------------GTileLayerOverlay()Places a tilelayer above a base map as a separate object rather than as part of a map type. 构造函数 new GTileLayerOverlay(tilelayer) 属性 A GTileLayerOverlay() has no accessible properties 方法 copy() Returns a new GTileLayerOverlay that is a copy of this one. initialize(map) Used by map.addOverlay() to set up the GTileLayerOverlay. redraw(bool) Does nothing. remove() Used by map.removeOverlay() to recover memory. GUnload()Call this function to destroy the structures created by the API, so that the memory can be recovered. Typically, use to avoid memory leaks. --------------------------------------------------------------------------------GUnloadApi()Function called by GUnload() to destroy the structures created by the API. GUnload() is included in the API loader, rather than the main API code, and behaves sensibly in situations where the main API code has not been laoded, e.g. if the browser was found to be not compatible. --------------------------------------------------------------------------------GValidateKey()undocumented This function performs API key validation. Hashes various subsets and variations of the current windows.location information. If one of the hashes matches the key has it returns true. 参数 a string Key hash (typically provided by the API loader code) --------------------------------------------------------------------------------GXmlHttp()GXmlHttp() just provides the .create() method, which accesses browser-specific XML request mechanisms. 方法 create() Creates a new ActiveXObject("Microsoft.XMLHTTP") or a new XMLHttpRequest() depending on the browser environment. GXml()GXml provides methods for processing XML content. 方法 parse(text) Performs XML parsing on a text string and returns the corresponding XML DOM. This can be used if your webserver is unable to set the MIME type correctly on your XML data file. value(xmlNode) Returns the text content of an XML node. This can be used to obtain data from an XML file where the data structured like this content rather than . GXslt()构造函数 new GXslt(xslt) 参数 xslt DOM element The DOM element that describes the XSLT document 方法 transformToHtml(xmlDoc, container) Transforms the XML to HTML DOM elements, placing the result into the HTML container posted on 2006-11-27 23:42 kukukuan 阅读(2174) 评论(1) 编辑 收藏 所属分类: Google API