Google Maps API Reference——Google 地图 API 文档之七-3
来源:互联网 发布:肠鸣 知乎 编辑:程序博客网 时间:2024/05/21 23:34
class GPolyline
This is a map overlay that draws a polyline on the map, using the vector drawing facilities of the browser if they are available, or an image overlay from Google servers otherwise.
Constructor
color
is given as a string that contains the color in hexadecimal numeric HTML style, i.e. #RRGGBB. The weight
is the width of the line in pixels. The opacity
is given as a number between 0 and 1. The line will be antialiased and semitransparent. Factory Methods
color
is a string that contains a hexadecimal numeric HTML style, i.e. #RRGGBB. weight
is the width of the line in pixels. opacity
is a number between 0 and 1. points
is a string containing the encoded latitude and longitude coordinates. levels
is a string containing the encoded polyline zoom level groups. numLevels
is the number of zoom levels contained in the encoded levels
string. zoomFactor
is the magnification between adjacent sets of zoom levels in the encoded levels
string. Together, these two values determine the precision of the levels
within an encoded polyline. The line will be antialiased and semitransparent. (Since 2.63) Methods
GPolyline.supportsHide()
returns true
. Note that this function triggers the event GPolyline.visibilitychanged
in case the polyline is currently visible. (Since 2.87) isHidden() Boolean Returns true
if the polyline is currently hidden. Otherwise returns false
. (Since 2.87) show() none Shows the polyline if it is currently hidden. Note that this function triggers the event GPolyline.visibilitychanged
in case the polyline is currently hidden. (Since 2.87) supportsHide() Boolean Returns true
if GPolyline.hide()
is supported in the current environment for GPolyline
objects. Otherwise returns false
. (Since 2.87) Events
GMap2.removeOverlay()
or GMap2.clearOverlays()
. visibilitychanged isVisible This event is fired when the visibility state of the polyline toggles from visible to hidden or vice versa. The isVisible
argument reflects the state of the polyline after completion of this visibility state. (Since 2.87) click latlng This event is fired when the polyline is clicked. Note that this event also subsequently triggers a "click" event on the map, where the polyline is passed as the overlay
argument within that event. (Since 2.88) class GPolylineOptions
Instances of this class are used in GPolyline
's constructor. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.
Properties
As the name of this class indicates, all properties are optional.
true
, i.e. if the option is not specified, the polyline will be clickable. (Since 2.91) geodesic Boolean Render each edge of the polyline as a geodesic (a segment of a "great circle"). A geodesic is the shortest path between two points along the surface of the Earth. (Since 2.84) class GPolygon
This is very similar to a GPolyline
, except that you can additionally specify a fill color and opacity.
Constructor
colors
are given as a string that contains the color in hexadecimal numeric HTML style, i.e. #RRGGBB. The weight
is the width of the line in pixels. The opacities
is given as a number between 0 and 1. The line will be antialiased and semitransparent. (Since 2.69) Factory Methods
polylines
contains an associative array of constituent polylines, encoded in the same format as described in the GPolyline.fromEncoded
documentation. fill
specifies whether to fill in the polygon with a certain color
. opacity
and outline
specifies whether to stroke the polygon with the polyline's color, weight and opacity. In case multiple values are specified in polylines, the first polyline's values are taken. (Since 2.78) Methods
GPolygon.supportsHide
returns true
. Note that this function triggers the event GPolygon.visibilitychanged
in case the polygon is currently visible. (Since 2.87) isHidden() Boolean Returns true
if the polygon is currently hidden. Otherwise returns false
. (Since 2.87) show() none Shows the polygon if it is currently hidden. Note that this function triggers the event GPolygon.visibilitychanged
in case the polygon is currently hidden. (Since 2.87) supportsHide() Boolean Returns true
if GPolygon.hide()
is supported in the current environment for GPolygon
objects. Otherwise returns false
. (Since 2.87) Events
GMap2.removeOverlay()
or GMap2.clearOverlays()
. visibilitychanged isVisible This event is fired when the visibility state of the polygon toggles from visible to hidden or vice versa. The isVisible
argument reflects the state of the polygon after completion of this visibility state. (Since 2.87) click latlng This event is fired when the polygon is clicked. Note that this event also subsequently triggers a "click" event on the map, where the polygon is passed as the overlay
argument within that event. (Since 2.88>) class GPolygonOptions
Instances of this class are used in GPolygon
's constructor. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.
Properties
As the name of this class indicates, all properties are optional.
true
, i.e. if the option is not specified, the polygon will be clickable. (Since 2.91) class GGroundOverlay
This object creates a rectangular image overlay on the map, whose boundaries are defined by GLatLngBounds
.
Constructor
Methods
GGroundOverlay.visibilitychanged
in case the ground overlay is currently visible. (Since 2.87) isHidden() Boolean Returns true
if the ground overlay is currently hidden. Otherwise returns false
. (Since 2.87) show() none Shows the ground overlay if it is currently hidden. Note that this function triggers the event GGroundOverlay.visibilitychanged
in case the ground overlay is currently hidden. (Since 2.87) supportsHide() Boolean Always returns true
. (Since 2.87) Events
isVisible
argument reflects the state of the ground overlay after completion of this visibility state. (Since 2.77) class GIcon
An icon specifies the images used to display a GMarker
on the map. For browser compatibility reasons, specifying an icon is actually quite complex. Note that you can use the default Maps icon G_DEFAULT_ICON
if you don't want to specify your own.
Constructor
copy
argument, its properties are copied, otherwise they are left empty. The optional argument image
sets the value of the image
property. Constants
Properties
image
. mozPrintImage String The URL of the foreground icon image used for printed maps in Firefox/Mozilla. It must be the same size as the main icon image given by image
. printShadow String The URL of the shadow image used for printed maps. It should be a GIF image since most browsers cannot print PNG images. transparent String The URL of a virtually transparent version of the foreground icon image used to capture click events in Internet Explorer. This image should be a 24-bit PNG version of the main icon image with 1% opacity, but the same shape and size as the main icon. imageMap Array of Number An array of integers representing the x/y coordinates of the image map we should use to specify the clickable part of the icon image in browsers other than Internet Explorer. maxHeight Integer Specifies the distance in pixels in which a marker will visually "rise" vertically when dragged. (Since 2.79) dragCrossImage String Specifies the cross image URL when an icon is dragged. (Since 2.79) dragCrossSize GSize Specifies the pixel size of the cross image when an icon is dragged. (Since 2.79) dragCrossAnchor GPoint Specifies the pixel coordinate offsets (relative to the iconAnchor) of the cross image when an icon is dragged. (Since 2.79) class GPoint
A GPoint
represents a point on the map by its pixel coordinates. Notice that in v2, it doesn't represent a point on the earth by its geographical coordinates anymore. Geographical coordinates are now represented by GLatLng
.
In the map coordinate system, the x
coordinate increases to the left, and the y
coordinate increases downwards.
Notice that while the two parameters of a GPoint
are accessible as properties x
and y
, it is better to never modify them, but to create a new object with different paramaters instead.
Constructor
GPoint
object. Properties
x
coordinate, increases to the left. y Number y
coordinate, increases downwards. Methods
true
iff the other point has equal coordinates. toString() String Returns a string that contains the x and y coordinates, in this order, separated by a comma. class GSize
A GSize
is the size in pixels of a rectangular area of the map. The size object has two parameters, width
and height
. Width is a difference in the x-coordinate; height is a difference in the y-coordinate, of points.
Notice that while the two parameters of a GSize
are accessible as properties width
and height
, it is better to never modify them, but to create a new object with different paramaters instead.
Constructor
GSize
object. Properties
Methods
true
iff the other size has exactly equal components. toString() String Returns a string that contains the wdith and height parameter, in this order, separated by a comma. class GBounds
GBounds
is a rectangular area of the map in pixel coordinates. Notice that a rectangle in geographical coordinates is represented by a GLatLngBounds
object.
Constructor
points
. Properties
Methods
true
if the passed rectangular area is entirely contained in this rectangular area. containsPoint(point) Boolean Returns true
if the rectangular area (inclusively) contains the pixel coordinates. (Since 2.88) extend(point) none Enlarges this box so that the point is also contained in this box. class GLatLng
GLatLng
is a point in geographical coordinates longitude and latitude.
Notice that although usual map projections associate longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude cooridnate is always written first, followed by the longitude, as it is custom in cartography.
Notice also that you cannot modify the coordinates of a GLatLng
. If you want to compute another point, you have to create a new one.
Constructor
unbounded
flag is true
, then the numbers will be used as passed, otherwise latitude will be clamped to lie between -90 degrees and +90 degrees, and longitude will be wrapped to lie between -180 degrees and +180 degrees. Methods
unbounded
flag was set in the constructor, this coordinate can be outside this interval. lng() Number Returns the longitude coordinate in degrees, as a number between -180 and +180. If the unbounded
flag was set in the constructor, this coordinate can be outside this interval. latRadians() Number Returns the latitude coordinate in radians, as a number between -PI/2 and +PI/2. If the unbounded
flag was set in the constructor, this coordinate can be outside this interval. lngRadians() Number Returns the longitude coordinate in radians, as a number between -PI and +PI. If the unbounded
flag was set in the constructor, this coordinate can be outside this interval. equals(other) Boolean Returns true
iff the other size has equal components, within certain roundoff margins. distanceFrom(other) Number Returns the distance, in meters, from this point to the given point. The earth is approximated as a sphere, hence the distance could be off by as much as 0.3%. See below. (Deprecated since 2.89) distanceFrom(other, radius?) Number Returns the distance, in meters, from this point to the given point. By default, this distance is calculated given the default equatorial earth radius of 6378137 meters. The earth is approximated as a sphere, hence the distance could be off as much as 0.3%, especially in the polar extremes. You may also pass an optional radius
argument to calculate distances between GLatLng
coordinates on spheres of a different radius than earth. (Since 2.89) toUrlValue() String This version of the method has been deprecated in favor of the revised version (shown below) which passes an optional precision
parameter. (Deprecated since 2.78) toUrlValue(precision?) String Returns a string that represents this point in a format suitable for use as a URL parameter value, separated by a comma, without whitespace. By default, precision is returned to 6 digits, which corresponds to a resolution to 4 inches/ 11 centimeters. An optional precision
parameter allows you to specify a lower precision to reduce server load. Note: prior to 2.78, this precision
parameter was not available. (Since 2.78) Properties
These properties exist for backwards compatibility with v1 event handler functions only. They should not be used.
These properties mirror the return values of the lng()
and lat()
accessor methods and they allow a GLatLng
to appear in places where a GPoint
is expected by a v1 client. This is necessary where GLatLng appears in event details (i.e. in arguments of event handler functions). In contrast to method wrappers, it is impossible in the current infrastructure to create event wrappers.
class GLatLngBounds
A GLatLngBounds
instance represents a rectangle in geographical coordinates, including one that crosses the 180 degrees meridian.
Constructor
Methods
true
iff all parameters in this rectangle are equal to the parameters of the other, within a certain roundoff margin. contains(latlng) Boolean Returns true
iff the geographical coordinates of the point lie within this rectangle. (Deprecated since 2.88) containsLatLng(latlng) Boolean Returns true
iff the geographical coordinates of the point lie within this rectangle. (Since 2.88) intersects(other) Boolean What the name says. containsBounds(other) Boolean What the name says. extend(latlng) none Enlarges this rectangle such that it contains the given point. In longitude direction, it is enlarged in the smaller of the two possible ways. If both are equal, it is enlarged at the eastern boundary. getSouthWest() GLatLng Returns the point at the south-west corner of the rectangle. getNorthEast() GLatLng Returns the point at the north-east corner of the rectangle. toSpan() GLatLng Returns a GLatLng
whose cordinates represent the size of this rectangle. isFullLat() Boolean Returns true
if this rectangle extends from the south pole to the north pole. isFullLng() Boolean Returns true
if this rectangle extends fully around the earth in the longitude direction. isEmpty() Boolean Returns true
if this rectangle is empty. getCenter() GLatLng Returns the point at the center of the rectangle. (Since 2.52) interface GControl
This interface is implemented by all controls. You can implement it in order to provide a custom control for the map. Controls are added to the map using the GMap2.addControl()
method.
In contrast to overlays, which are positioned relative to the map, controls are positioned relative to the map view, i.e. they don't move when the map moves.
Constructor
printable
indicates that the control should be visible in the print output of the map. Flag selectable
indicates that the control will contain text that should be selectable. Methods
These methods will be called by the map when the control is added to the map using GMap2.addControl()
. Thus, these methods will not be called by you, but they will be implemented by you.
GMap2.getContainer()
to get hold of the DOM element that contains the map, and add itself to it. It returns the added element. getDefaultPosition() GControlPosition Returns to the map the position in the map view at which the control appears by default. This will be overridden by the second argument to GMap2.addControl()
. class GControlPosition
This class described the position of a control in the map view. It consists of a corner relative to where the control is postioned, and an offset that determines this position. It can be passed as optional argument position
to the method GMap2.addControl()
, and it is returned from method GControl.getDefaultPosition()
.
Constructor
enum GControlAnchor
Constants
class GControl
These implementations of interface GControl
are available.
Constructor
GOverviewMapControl
creates an overview map with a one-pixel black border. class GMapType
Google provides some predefined map types - this class is used to define custom ones. In order to show them on the map, use the GMap2
constructor, or the GMap2.addMapType()
method. See also GTileLayerOverlay
to add to (rather than entirely replace) the map's tile layers.
This class can also be subclassed. Constructor arguments can be omitted if instantiated as a prototype. A subclass constructor must invoke the GMapType
constructor using call()
.
Constructor
Methods
These methods are mostly called by the map that this maptype is passed to, but some methods may also be called from outside the map, e.g. getBoundsZoomLevel()
.
GMapTypeControl
. getProjection() GProjection Returns to the map the projection of this map type. getTileSize() Number Returns to the map the map tile size in pixels of this map type. The tiles are assumed to be quadratic. All tile layers have the same tile size. getTileLayers() Array of GTileLayer Returns to the map the array of tile layers. getMinimumResolution() Number Returns to the map the lowest zoom level at which this map type is defined. getMaximumResolution() Number Returns to the map the highest zoom level at which this map type is defined. getTextColor() String Returns to the map the color that is best used for text that is overlaid on the map. Used for the color of the text of the copyright message displayed by the copyroght control. getLinkColor() String Returns to the map the color that is best used for a hyperlink that is overlaid on the map. Used for the color of the link to the terms of use displayed by the copyroght control. getErrorMessage() String Returns to the map the error message that is displayed in areas or on zoom level where this map type doesn't have map tiles. getCopyrights(bounds, zoom) Array of String Returns to the map the copyright messages appropriate for the region described by bounds
at the given zoom level. This is used by the copyright message on the map. getUrlArg() String Returns to the map a value that is used as a URL paramater value to identify this map type in permalinks to the current map view. This is currently only used by the maps application. getAlt() String Returns to the map the alternative text of this map type. (Since 2.86) Constants
Events
class GMapTypeOptions
Instances of this class are used as the opts?
argument to the GMapType
constructor. There is no constructor for this class. Instead, this class is instantiated as a javascript object literal.
Properties
GMapType.getName(true)
. Default is the same as the name
. urlArg String Sets the url argument of the map type that is returned from GMapType.getUrlArg()
. Default is the empty string. maxResolution Number Sets the maximum zoom level of this map type, returned by GMapType.getMaximumResolution()
. Default is the maximum of all tile layers. minResolution Number Sets the minimum zoom level of this map type, returned by GMapType.getMinimumResolution()
. Default is the minimum of all tile layers. tileSize Number Set the tile size returned by GMapType.getTileSize()
. Default is 256
. textColor String Sets the text color returned by GMapType.getTextColor()
. Default is "black"
. linkColor String Sets the text color returned by GMapType.getLinkColor()
. Default is "#7777cc"
. errorMessage String Sets the error message returned by GMapType.getErrorMessage()
. Default is the empty string. alt String Sets the alternative text to the map type returned by GMapType.getAlt()
. Default is the empty string. (Since 2.64) radius Number Sets the radius of the map type given the passed Number
measured in meters. The default value is 6378137, the equatorial radius of the Earth in meters. (Since 2.89)
- Google Maps API Reference——Google 地图 API 文档之七-3
- Google Maps API Reference——Google 地图 API 文档之七
- Google Maps API Reference——Google 地图 API 文档之七-1
- Google Maps API Reference——Google 地图 API 文档之七-2
- Google Maps API Reference——Google 地图 API 文档之七-4
- Google Maps——Google 地图 API 文档之八
- Sign Up for the Google Maps API——Google 地图 API 文档之四
- Google Maps API Exampless——Google 地图 API 文档之六
- Put Google Maps on Your Own Web Site——Google 地图 API 文档之三
- Google Maps API Concepts——Google 地图 API 文档之一
- Google Maps API 2 文档
- Google Maps API 2 文档
- Google Maps API 2 文档
- Google Maps API 2 文档
- Google Maps API 2 文档
- Drive More Search Traffic to Your Maps API Site by Including KML Files in a Sitemap——Google 地图 API 文档之五
- Google Maps Javascript API V3 Reference
- Using Google's AJAX APIs——Google 地图 API 文档之二
- Google Maps API Reference——Google 地图 API 文档之七-2
- 移植KDE4的KHTML到Windows平台(二)
- SoftICE安装配置一日谈
- windows下安装OpenSSL(把openssl编译成动态链接库)
- ASP 新建立SQLSERVER数据代码
- Google Maps API Reference——Google 地图 API 文档之七-3
- 龟兔赛跑,兔子加油!
- Google Maps API Reference——Google 地图 API 文档之七-4
- linux下写图形界面之iveney高见
- 用变态读书法学习JAVA的EE开发
- 软件测试过程模型的种类之--------H模型
- Google Maps——Google 地图 API 文档之八
- struts2+hibernate+spring配置管理(一)——配置文件
- 我的作业(四)