Polygons | Maps JavaScript API - Google Developers

文章推薦指數: 80 %
投票人數:10人

A polygon (like a polyline) defines a series of connected coordinates in an ordered sequence. Additionally, polygons form a closed loop and define a filled ... Google MapsPlatform Overview Products Pricing Documentation GetStarted GetStartedwithGoogleMapsPlatform APIPicker Billing&Pricing Reporting&Monitoring MapIDs FAQ SupportandResources IncidentManagement Maps MapsJavaScriptAPI MapsSDKforAndroid MapsSDKforiOS MapsStaticAPI StreetViewStaticAPI MapsEmbedAPI MapsURLs MapsElevationAPI Routes DirectionsAPI DistanceMatrixAPI RoadsAPI Solutions IndustrySolutions GamingServices TransportationandLogistics Places PlacesAPI PlacesSDKforAndroid PlacesSDKforiOS PlacesLibrary,MapsJavaScriptAPI GeocodingAPI GeolocationAPI TimeZoneAPI AdditionalResources APISecurityBestPractices MapCoverageDetails OptimizationGuide MobileOSandsoftwaresupport Deprecations AssetTrackingPlan RootCAMigrationFAQ URLEncoding WordPressUsers Blog Community StackOverflow GitHub YouTube Discord Twitter IssueTracker Language English BahasaIndonesia Deutsch Español Français Português–Brasil Русский 中文–简体 日本語 한국어 Signin Web MapsJavaScriptAPI GetStarted Contactsales Guides Reference Samples Support Google MapsPlatform Overview Products Pricing Documentation More Guides Reference Samples Support Blog Community More APIReferencev3.49(weeklychannel) Overview Maps MapsWebGLCoordinatesData-drivenstylingEventsystemControlsGeometryLibrary Drawingonthemap MarkerInfoWindowPolygonsDataDOMelementsKMLImageoverlaysDrawingLibraryHeatmapsMaxZoom StreetView RenderingService Places PlacesWidgetsPlacesServicePlacesAutocompleteServiceGeocoder Routes DirectionsDistanceMatrixElevation LocalContext(beta) MapView JourneySharing(beta) MapViewAuthenticationUICustomizationFleetEngineEntitiesTripandOrderProgressFleetTrackingShipmentTracking GlobalConcepts Settings(beta)Errors APIReferencev3.48(quarterlychannel) Overview Maps MapsWebGLCoordinatesEventsystemControlsGeometryLibrary Drawingonthemap MarkerInfoWindowPolygonsDataDOMelementsKMLImageoverlaysDrawingLibraryHeatmapsMaxZoom StreetView RenderingService Places PlacesWidgetsPlacesServicePlacesAutocompleteServiceGeocoder Routes DirectionsDistanceMatrixElevation LocalContext(beta) MapView JourneySharing(beta) MapViewAuthenticationUICustomizationFleetEngineEntitiesTripandOrderProgressFleetTrackingShipmentTracking GlobalConfiguration(beta) Settings APIReferencev3.47 Overview Maps MapsWebGL(Beta)CoordinatesEventsystemControlsGeometryLibrary Drawingonthemap MarkerInfoWindowPolygonsDataDOMelementsKMLImageoverlaysDrawingLibraryHeatmapsMaxZoom StreetView RenderingService Places PlacesWidgetsPlacesServicePlacesAutocompleteServiceGeocoder Routes DirectionsDistanceMatrixElevation LocalContext(beta) MapView APIReferencev3.46 Overview Maps MapsWebGL(Beta)CoordinatesEventsystemControlsGeometryLibrary Drawingonthemap MarkerInfoWindowPolygonsDataDOMelementsKMLImageoverlaysDrawingLibraryHeatmapsMaxZoom StreetView RenderingService Places PlacesWidgetsPlacesServicePlacesAutocompleteServiceGeocoder Routes DirectionsDistanceMatrixElevation LocalContext(beta) MapView GetStarted GetStartedwithGoogleMapsPlatform APIPicker Billing&Pricing Reporting&Monitoring MapIDs FAQ SupportandResources IncidentManagement Maps MapsJavaScriptAPI MapsSDKforAndroid MapsSDKforiOS MapsStaticAPI StreetViewStaticAPI MapsEmbedAPI MapsURLs MapsElevationAPI Routes DirectionsAPI DistanceMatrixAPI RoadsAPI Solutions IndustrySolutions GamingServices TransportationandLogistics Places PlacesAPI PlacesSDKforAndroid PlacesSDKforiOS PlacesLibrary,MapsJavaScriptAPI GeocodingAPI GeolocationAPI TimeZoneAPI AdditionalResources APISecurityBestPractices MapCoverageDetails OptimizationGuide MobileOSandsoftwaresupport Deprecations AssetTrackingPlan RootCAMigrationFAQ URLEncoding WordPressUsers StackOverflow GitHub YouTube Discord Twitter IssueTracker Home Products GoogleMapsPlatform Documentation Web MapsJavaScriptAPI Reference Sendfeedback Polygons Polyline class google.maps.Polyline class Apolylineisalinearoverlayofconnectedlinesegmentsonthemap. Thisclassextends MVCObject. Constructor Polyline Polyline([opts]) Parameters:  opts: PolylineOptionsoptional CreateapolylineusingthepassedPolylineOptions,whichspecifyboththepathofthepolylineandthestrokestyletousewhendrawingthepolyline.YoumaypasseitheranarrayofLatLngsoranMVCArrayofLatLngswhenconstructingapolyline,thoughsimplearraysareconvertedtoMVCArrayswithinthepolylineuponinstantiation. Methods getDraggable getDraggable() Parameters: None ReturnValue: boolean Returnswhetherthisshapecanbedraggedbytheuser. getEditable getEditable() Parameters: None ReturnValue: boolean Returnswhetherthisshapecanbeeditedbytheuser. getMap getMap() Parameters: None ReturnValue: Map|null Returnsthemaponwhichthisshapeisattached. getPath getPath() Parameters: None ReturnValue: MVCArray Retrievesthepath. getVisible getVisible() Parameters: None ReturnValue: boolean Returnswhetherthispolyisvisibleonthemap. setDraggable setDraggable(draggable) Parameters:  draggable: boolean ReturnValue: None Ifsettotrue,theusercandragthisshapeoverthemap.Thegeodesicpropertydefinesthemodeofdragging. setEditable setEditable(editable) Parameters:  editable: boolean ReturnValue: None Ifsettotrue,theusercaneditthisshapebydraggingthecontrolpointsshownattheverticesandoneachsegment. setMap setMap(map) Parameters:  map: Mapoptional ReturnValue: None Rendersthisshapeonthespecifiedmap.Ifmapissettonull,theshapewillberemoved. setOptions setOptions(options) Parameters:  options: PolylineOptionsoptional ReturnValue: None setPath setPath(path) Parameters:  path: MVCArray|Array ReturnValue: None Setsthepath.SeePolylineOptionsformoredetails. setVisible setVisible(visible) Parameters:  visible: boolean ReturnValue: None Hidesthispolyifsettofalse. Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll Events click function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMclickeventisfiredonthePolyline. contextmenu function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMcontextmenueventisfiredonPoyline. dblclick function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMdblclickeventisfiredonthePolyline. drag function(event) Arguments:  event: MapMouseEvent Thiseventisrepeatedlyfiredwhiletheuserdragsthepolyline. dragend function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstopsdraggingthepolyline. dragstart function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstartsdraggingthepolyline. mousedown function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMmousedowneventisfiredonthePolyline. mousemove function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMmousemoveeventisfiredonthePolyline. mouseout function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredonPolylinemouseout. mouseover function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredonPolylinemouseover. mouseup function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMmouseupeventisfiredonthePolyline. rightclick Deprecated:UsethePolyline.contextmenueventinsteadinordertosupportusagepatternslikecontrol-clickonmacOS.function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhenthePolylineisright-clickedon. PolylineOptions interface google.maps.PolylineOptions interface PolylineOptionsobjectusedtodefinethepropertiesthatcanbesetonaPolyline. Properties clickableoptional Type: booleanoptional Default:true IndicateswhetherthisPolylinehandlesmouseevents. draggableoptional Type: booleanoptional Default:false Ifsettotrue,theusercandragthisshapeoverthemap.Thegeodesicpropertydefinesthemodeofdragging. editableoptional Type: booleanoptional Default:false Ifsettotrue,theusercaneditthisshapebydraggingthecontrolpointsshownattheverticesandoneachsegment. geodesicoptional Type: booleanoptional Default:false Whentrue,edgesofthepolygonareinterpretedasgeodesicandwillfollowthecurvatureoftheEarth.Whenfalse,edgesofthepolygonarerenderedasstraightlinesinscreenspace.Notethattheshapeofageodesicpolygonmayappeartochangewhendragged,asthedimensionsaremaintainedrelativetothesurfaceoftheearth. iconsoptional Type: Arrayoptional Theiconstoberenderedalongthepolyline. mapoptional Type: Mapoptional MaponwhichtodisplayPolyline. pathoptional Type: MVCArray|Arrayoptional TheorderedsequenceofcoordinatesofthePolyline.ThispathmaybespecifiedusingeitherasimplearrayofLatLngs,oranMVCArrayofLatLngs.Notethatifyoupassasimplearray,itwillbeconvertedtoanMVCArrayInsertingorremovingLatLngsintheMVCArraywillautomaticallyupdatethepolylineonthemap. strokeColoroptional Type: stringoptional Thestrokecolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. strokeOpacityoptional Type: numberoptional Thestrokeopacitybetween0.0and1.0. strokeWeightoptional Type: numberoptional Thestrokewidthinpixels. visibleoptional Type: booleanoptional Default:true Whetherthispolylineisvisibleonthemap. zIndexoptional Type: numberoptional ThezIndexcomparedtootherpolys. IconSequence interface google.maps.IconSequence interface Describeshowiconsaretoberenderedonaline.Ifyourpolylineisgeodesic,thenthedistancesspecifiedforbothoffsetandrepeatarecalculatedinmetersbydefault.Settingeitheroffsetorrepeattoapixelvaluewillcausethedistancestobecalculatedinpixelsonthescreen. Properties fixedRotationoptional Type: booleanoptional Default:false Iftrue,eachiconinthesequencehasthesamefixedrotationregardlessoftheangleoftheedgeonwhichitlies.Iffalse,caseeachiconinthesequenceisrotatedtoalignwithitsedge. iconoptional Type: Symboloptional Theicontorenderontheline. offsetoptional Type: stringoptional Default:'100%' Thedistancefromthestartofthelineatwhichaniconistoberendered.Thisdistancemaybeexpressedasapercentageofline'slength(e.g.'50%')orinpixels(e.g.'50px'). repeatoptional Type: stringoptional Default:0 Thedistancebetweenconsecutiveiconsontheline.Thisdistancemaybeexpressedasapercentageoftheline'slength(e.g.'50%')orinpixels(e.g.'50px').Todisablerepeatingoftheicon,specify'0'. Polygon class google.maps.Polygon class Apolygon(likeapolyline)definesaseriesofconnectedcoordinatesinanorderedsequence.Additionally,polygonsformaclosedloopanddefineafilledregion.Seethesamplesinthedeveloper'sguide,startingwithasimplepolygon,apolygonwithahole,andmore.NotethatyoucanalsousetheDatalayertocreateapolygon.TheDatalayeroffersasimplerwayofcreatingholesbecauseithandlestheorderoftheinnerandouterpathsforyou. Thisclassextends MVCObject. Constructor Polygon Polygon([opts]) Parameters:  opts: PolygonOptionsoptional CreateapolygonusingthepassedPolygonOptions,whichspecifythepolygon'spath,thestrokestyleforthepolygon'sedges,andthefillstyleforthepolygon'sinteriorregions.Apolygonmaycontainoneormorepaths,whereeachpathconsistsofanarrayofLatLngs.YoumaypasseitheranarrayofLatLngsoranMVCArrayofLatLngswhenconstructingthesepaths.ArraysareconvertedtoMVCArrayswithinthepolygonuponinstantiation. Methods getDraggable getDraggable() Parameters: None ReturnValue: boolean Returnswhetherthisshapecanbedraggedbytheuser. getEditable getEditable() Parameters: None ReturnValue: boolean Returnswhetherthisshapecanbeeditedbytheuser. getMap getMap() Parameters: None ReturnValue: Map|null Returnsthemaponwhichthisshapeisattached. getPath getPath() Parameters: None ReturnValue: MVCArray Retrievesthefirstpath. getPaths getPaths() Parameters: None ReturnValue: MVCArray> Retrievesthepathsforthispolygon. getVisible getVisible() Parameters: None ReturnValue: boolean Returnswhetherthispolyisvisibleonthemap. setDraggable setDraggable(draggable) Parameters:  draggable: boolean ReturnValue: None Ifsettotrue,theusercandragthisshapeoverthemap.Thegeodesicpropertydefinesthemodeofdragging. setEditable setEditable(editable) Parameters:  editable: boolean ReturnValue: None Ifsettotrue,theusercaneditthisshapebydraggingthecontrolpointsshownattheverticesandoneachsegment. setMap setMap(map) Parameters:  map: Mapoptional ReturnValue: None Rendersthisshapeonthespecifiedmap.Ifmapissettonull,theshapewillberemoved. setOptions setOptions(options) Parameters:  options: PolygonOptionsoptional ReturnValue: None setPath setPath(path) Parameters:  path: MVCArray|Array ReturnValue: None Setsthefirstpath.SeePolygonOptionsformoredetails. setPaths setPaths(paths) Parameters:  paths: MVCArray>|MVCArray|Array>|Array ReturnValue: None Setsthepathforthispolygon. setVisible setVisible(visible) Parameters:  visible: boolean ReturnValue: None Hidesthispolyifsettofalse. Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll Events click function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMclickeventisfiredonthePolygon. contextmenu function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMcontextmenueventisfiredonthePolygon. dblclick function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMdblclickeventisfiredonthePolygon. drag function(event) Arguments:  event: MapMouseEvent Thiseventisrepeatedlyfiredwhiletheuserdragsthepolygon. dragend function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstopsdraggingthepolygon. dragstart function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstartsdraggingthepolygon. mousedown function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMmousedowneventisfiredonthePolygon. mousemove function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMmousemoveeventisfiredonthePolygon. mouseout function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredonPolygonmouseout. mouseover function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredonPolygonmouseover. mouseup function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhentheDOMmouseupeventisfiredonthePolygon. rightclick Deprecated:UsethePolygon.contextmenueventinsteadinordertosupportusagepatternslikecontrol-clickonmacOS.function(event) Arguments:  event: PolyMouseEvent ThiseventisfiredwhenthePolygonisright-clickedon. PolygonOptions interface google.maps.PolygonOptions interface PolygonOptionsobjectusedtodefinethepropertiesthatcanbesetonaPolygon. Properties clickableoptional Type: booleanoptional Default:true IndicateswhetherthisPolygonhandlesmouseevents. draggableoptional Type: booleanoptional Default:false Ifsettotrue,theusercandragthisshapeoverthemap.Thegeodesicpropertydefinesthemodeofdragging. editableoptional Type: booleanoptional Default:false Ifsettotrue,theusercaneditthisshapebydraggingthecontrolpointsshownattheverticesandoneachsegment. fillColoroptional Type: stringoptional Thefillcolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. fillOpacityoptional Type: numberoptional Thefillopacitybetween0.0and1.0 geodesicoptional Type: booleanoptional Default:false Whentrue,edgesofthepolygonareinterpretedasgeodesicandwillfollowthecurvatureoftheEarth.Whenfalse,edgesofthepolygonarerenderedasstraightlinesinscreenspace.Notethattheshapeofageodesicpolygonmayappeartochangewhendragged,asthedimensionsaremaintainedrelativetothesurfaceoftheearth. mapoptional Type: Mapoptional MaponwhichtodisplayPolygon. pathsoptional Type: MVCArray>|MVCArray|Array>|Arrayoptional Theorderedsequenceofcoordinatesthatdesignatesaclosedloop.Unlikepolylines,apolygonmayconsistofoneormorepaths.Asaresult,thepathspropertymayspecifyoneormorearraysofLatLngcoordinates.Pathsareclosedautomatically;donotrepeatthefirstvertexofthepathasthelastvertex.SimplepolygonsmaybedefinedusingasinglearrayofLatLngs.Morecomplexpolygonsmayspecifyanarrayofarrays.AnysimplearraysareconvertedintoMVCArrays.InsertingorremovingLatLngsfromtheMVCArraywillautomaticallyupdatethepolygononthemap. strokeColoroptional Type: stringoptional Thestrokecolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. strokeOpacityoptional Type: numberoptional Thestrokeopacitybetween0.0and1.0 strokePositionoptional Type: StrokePositionoptional Default:StrokePosition.CENTER Thestrokeposition. strokeWeightoptional Type: numberoptional Thestrokewidthinpixels. visibleoptional Type: booleanoptional Default:true Whetherthispolygonisvisibleonthemap. zIndexoptional Type: numberoptional ThezIndexcomparedtootherpolys. PolyMouseEvent interface google.maps.PolyMouseEvent interface Thisobjectisreturnedfrommouseeventsonpolylinesandpolygons. Thisinterfaceextends MapMouseEvent. Properties edgeoptional Type: numberoptional Theindexoftheedgewithinthepathbeneaththecursorwhentheeventoccurred,iftheeventoccurredonamid-pointonaneditablepolygon. pathoptional Type: numberoptional Theindexofthepathbeneaththecursorwhentheeventoccurred,iftheeventoccurredonavertexandthepolygoniseditable.Otherwiseundefined. vertexoptional Type: numberoptional Theindexofthevertexbeneaththecursorwhentheeventoccurred,iftheeventoccurredonavertexandthepolylineorpolygoniseditable.Iftheeventdoesnotoccuronavertex,thevalueisundefined. Inherited: domEvent, latLng Methods Inherited: stop Rectangle class google.maps.Rectangle class Arectangleoverlay. Thisclassextends MVCObject. Constructor Rectangle Rectangle([opts]) Parameters:  opts: RectangleOptionsoptional CreatearectangleusingthepassedRectangleOptions,whichspecifytheboundsandstyle. Methods getBounds getBounds() Parameters: None ReturnValue: LatLngBounds Returnstheboundsofthisrectangle. getDraggable getDraggable() Parameters: None ReturnValue: boolean Returnswhetherthisrectanglecanbedraggedbytheuser. getEditable getEditable() Parameters: None ReturnValue: boolean Returnswhetherthisrectanglecanbeeditedbytheuser. getMap getMap() Parameters: None ReturnValue: Map Returnsthemaponwhichthisrectangleisdisplayed. getVisible getVisible() Parameters: None ReturnValue: boolean Returnswhetherthisrectangleisvisibleonthemap. setBounds setBounds(bounds) Parameters:  bounds: LatLngBounds|LatLngBoundsLiteral ReturnValue: None Setstheboundsofthisrectangle. setDraggable setDraggable(draggable) Parameters:  draggable: boolean ReturnValue: None Ifsettotrue,theusercandragthisrectangleoverthemap. setEditable setEditable(editable) Parameters:  editable: boolean ReturnValue: None Ifsettotrue,theusercaneditthisrectanglebydraggingthecontrolpointsshownatthecornersandoneachedge. setMap setMap(map) Parameters:  map: Map ReturnValue: None Renderstherectangleonthespecifiedmap.Ifmapissettonull,therectanglewillberemoved. setOptions setOptions(options) Parameters:  options: RectangleOptions ReturnValue: None setVisible setVisible(visible) Parameters:  visible: boolean ReturnValue: None Hidesthisrectangleifsettofalse. Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll Events bounds_changed function() Arguments: None Thiseventisfiredwhentherectangle'sboundsarechanged. click function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMclickeventisfiredontherectangle. contextmenu function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMcontextmenueventisfiredontherectangle. dblclick function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMdblclickeventisfiredontherectangle. drag function(event) Arguments:  event: MapMouseEvent Thiseventisrepeatedlyfiredwhiletheuserdragstherectangle. dragend function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstopsdraggingtherectangle. dragstart function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstartsdraggingtherectangle. mousedown function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMmousedowneventisfiredontherectangle. mousemove function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMmousemoveeventisfiredontherectangle. mouseout function(event) Arguments:  event: MapMouseEvent Thiseventisfiredonrectanglemouseout. mouseover function(event) Arguments:  event: MapMouseEvent Thiseventisfiredonrectanglemouseover. mouseup function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMmouseupeventisfiredontherectangle. rightclick Deprecated:UsetheRectangle.contextmenueventinsteadinordertosupportusagepatternslikecontrol-clickonmacOS.function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentherectangleisright-clickedon. RectangleOptions interface google.maps.RectangleOptions interface RectangleOptionsobjectusedtodefinethepropertiesthatcanbesetonaRectangle. Properties boundsoptional Type: LatLngBounds|LatLngBoundsLiteraloptional Thebounds. clickableoptional Type: booleanoptional Default:true IndicateswhetherthisRectanglehandlesmouseevents. draggableoptional Type: booleanoptional Default:false Ifsettotrue,theusercandragthisrectangleoverthemap. editableoptional Type: booleanoptional Default:false Ifsettotrue,theusercaneditthisrectanglebydraggingthecontrolpointsshownatthecornersandoneachedge. fillColoroptional Type: stringoptional Thefillcolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. fillOpacityoptional Type: numberoptional Thefillopacitybetween0.0and1.0 mapoptional Type: Mapoptional MaponwhichtodisplayRectangle. strokeColoroptional Type: stringoptional Thestrokecolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. strokeOpacityoptional Type: numberoptional Thestrokeopacitybetween0.0and1.0 strokePositionoptional Type: StrokePositionoptional Default:StrokePosition.CENTER Thestrokeposition. strokeWeightoptional Type: numberoptional Thestrokewidthinpixels. visibleoptional Type: booleanoptional Default:true Whetherthisrectangleisvisibleonthemap. zIndexoptional Type: numberoptional ThezIndexcomparedtootherpolys. Circle class google.maps.Circle class AcircleontheEarth'ssurface;alsoknownasa"sphericalcap". Thisclassextends MVCObject. Constructor Circle Circle([circleOrCircleOptions]) Parameters:  circleOrCircleOptions: Circle|CircleLiteral|CircleOptionsoptional CreateacircleusingthepassedCircleOptions,whichspecifythecenter,radius,andstyle. Methods getBounds getBounds() Parameters: None ReturnValue: LatLngBounds GetstheLatLngBoundsofthisCircle. getCenter getCenter() Parameters: None ReturnValue: LatLng Returnsthecenterofthiscircle. getDraggable getDraggable() Parameters: None ReturnValue: boolean Returnswhetherthiscirclecanbedraggedbytheuser. getEditable getEditable() Parameters: None ReturnValue: boolean Returnswhetherthiscirclecanbeeditedbytheuser. getMap getMap() Parameters: None ReturnValue: Map Returnsthemaponwhichthiscircleisdisplayed. getRadius getRadius() Parameters: None ReturnValue: number Returnstheradiusofthiscircle(inmeters). getVisible getVisible() Parameters: None ReturnValue: boolean Returnswhetherthiscircleisvisibleonthemap. setCenter setCenter(center) Parameters:  center: LatLng|LatLngLiteral ReturnValue: None Setsthecenterofthiscircle. setDraggable setDraggable(draggable) Parameters:  draggable: boolean ReturnValue: None Ifsettotrue,theusercandragthiscircleoverthemap. setEditable setEditable(editable) Parameters:  editable: boolean ReturnValue: None Ifsettotrue,theusercaneditthiscirclebydraggingthecontrolpointsshownatthecenterandaroundthecircumferenceofthecircle. setMap setMap(map) Parameters:  map: Map ReturnValue: None Rendersthecircleonthespecifiedmap.Ifmapissettonull,thecirclewillberemoved. setOptions setOptions(options) Parameters:  options: CircleOptions ReturnValue: None setRadius setRadius(radius) Parameters:  radius: number ReturnValue: None Setstheradiusofthiscircle(inmeters). setVisible setVisible(visible) Parameters:  visible: boolean ReturnValue: None Hidesthiscircleifsettofalse. Inherited: addListener, bindTo, get, notify, set, setValues, unbind, unbindAll Events center_changed function() Arguments: None Thiseventisfiredwhenthecircle'scenterischanged. click function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMclickeventisfiredonthecircle. dblclick function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMdblclickeventisfiredonthecircle. drag function(event) Arguments:  event: MapMouseEvent Thiseventisrepeatedlyfiredwhiletheuserdragsthecircle. dragend function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstopsdraggingthecircle. dragstart function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhentheuserstartsdraggingthecircle. mousedown function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMmousedowneventisfiredonthecircle. mousemove function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMmousemoveeventisfiredonthecircle. mouseout function(event) Arguments:  event: MapMouseEvent Thiseventisfiredoncirclemouseout. mouseover function(event) Arguments:  event: MapMouseEvent Thiseventisfiredoncirclemouseover. mouseup function(event) Arguments:  event: MapMouseEvent ThiseventisfiredwhentheDOMmouseupeventisfiredonthecircle. radius_changed function() Arguments: None Thiseventisfiredwhenthecircle'sradiusischanged. rightclick function(event) Arguments:  event: MapMouseEvent Thiseventisfiredwhenthecircleisright-clickedon. CircleOptions interface google.maps.CircleOptions interface CircleOptionsobjectusedtodefinethepropertiesthatcanbesetonaCircle. Properties centeroptional Type: LatLng|LatLngLiteraloptional ThecenteroftheCircle. clickableoptional Type: booleanoptional Default:true IndicateswhetherthisCirclehandlesmouseevents. draggableoptional Type: booleanoptional Default:false Ifsettotrue,theusercandragthiscircleoverthemap. editableoptional Type: booleanoptional Default:false Ifsettotrue,theusercaneditthiscirclebydraggingthecontrolpointsshownatthecenterandaroundthecircumferenceofthecircle. fillColoroptional Type: stringoptional Thefillcolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. fillOpacityoptional Type: numberoptional Thefillopacitybetween0.0and1.0. mapoptional Type: Mapoptional MaponwhichtodisplaytheCircle. radiusoptional Type: numberoptional TheradiusinmetersontheEarth'ssurface. strokeColoroptional Type: stringoptional Thestrokecolor.AllCSS3colorsaresupportedexceptforextendednamedcolors. strokeOpacityoptional Type: numberoptional Thestrokeopacitybetween0.0and1.0. strokePositionoptional Type: StrokePositionoptional Default:StrokePosition.CENTER Thestrokeposition. strokeWeightoptional Type: numberoptional Thestrokewidthinpixels. visibleoptional Type: booleanoptional Default:true Whetherthiscircleisvisibleonthemap. zIndexoptional Type: numberoptional ThezIndexcomparedtootherpolys. StrokePosition constants google.maps.StrokePosition constants Thepossiblepositionsofthestrokeonapolygon. Constants CENTER Thestrokeiscenteredonthepolygon'spath,withhalfthestrokeinsidethepolygonandhalfthestrokeoutsidethepolygon. INSIDE Thestrokeliesinsidethepolygon. OUTSIDE Thestrokeliesoutsidethepolygon. Sendfeedback Exceptasotherwisenoted,thecontentofthispageislicensedundertheCreativeCommonsAttribution4.0License,andcodesamplesarelicensedundertheApache2.0License.Fordetails,seetheGoogleDevelopersSitePolicies.JavaisaregisteredtrademarkofOracleand/oritsaffiliates. Lastupdated2022-06-23UTC. [{ "type":"thumb-down", "id":"missingTheInformationINeed", "label":"MissingtheinformationIneed" },{ "type":"thumb-down", "id":"tooComplicatedTooManySteps", "label":"Toocomplicated/toomanysteps" },{ "type":"thumb-down", "id":"outOfDate", "label":"Outofdate" },{ "type":"thumb-down", "id":"samplesCodeIssue", "label":"Samples/codeissue" },{ "type":"thumb-down", "id":"otherDown", "label":"Other" }] [{ "type":"thumb-up", "id":"easyToUnderstand", "label":"Easytounderstand" },{ "type":"thumb-up", "id":"solvedMyProblem", "label":"Solvedmyproblem" },{ "type":"thumb-up", "id":"otherUp", "label":"Other" }] Needtotellusmore? StackOverflow Askaquestionunderthegoogle-mapstag. GitHub Forkoursamplesandtrythemyourself. Discord ChatwithfellowdevelopersaboutGoogleMapsPlatform. IssueTracker Somethingwrong?Sendusabugreport! LearnMore FAQ APIPicker Tutorials Platforms Android iOS Web WebServices ProductInfo PricingandPlans ContactSales Support TermsofService Android Chrome Firebase GoogleCloudPlatform Allproducts Terms Privacy SignupfortheGoogleDevelopersnewsletter Subscribe Language English BahasaIndonesia Deutsch Español Français Português–Brasil Русский 中文–简体 日本語 한국어



請為這篇文章評分?