The angular-ready wrapper for the native google.maps.Polygon
class.
overlays/modules/polygon/google-maps-polygon.ts
Properties |
Methods |
|
constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any)
|
||||||||||||
Parameters:
|
||||||||||||
Public map |
Type: IGoogleMap
|
Inherited from
GoogleMapsDrawableOverlay
|
The map to which this overlay should be added.
|
Public Readonly type |
Type: OverlayType
|
Inherited from
GoogleMapsDrawableOverlay
|
The type of overlay this wrapper holds. Used by the `OverlayTracker` to distinguish between types.
|
Public custom |
Type: any
|
Inherited from
GoogleMapsNativeObjectWrapper
|
Public Readonly native |
Type: TNative
|
Inherited from
GoogleMapsNativeObjectWrapper
|
The instantiated native object to be wrapped.
|
Public getBounds |
getBounds()
|
Inherited from
GoogleMapsDrawableOverlay
|
Returns:
google.maps.LatLngBounds
|
Public getPath |
getPath()
|
Returns:
[][]
|
setClickable | ||||||
setClickable(clickable: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
setFillColor | ||||||
setFillColor(fillColor: string)
|
||||||
Parameters:
Returns:
void
|
||||||
setFillOpacity | ||||||
setFillOpacity(fillOpacity: number)
|
||||||
Parameters:
Returns:
void
|
||||||
setGeodesic | ||||||
setGeodesic(geodesic: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setPath | ||||||
setPath(coords: CoordPath)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
setStrokeColor | ||||||
setStrokeColor(strokeColor: string)
|
||||||
Parameters:
Returns:
void
|
||||||
setStrokeOpacity | ||||||
setStrokeOpacity(strokeOpacity: number)
|
||||||
Parameters:
Returns:
void
|
||||||
setStrokePosition | ||||||
setStrokePosition(strokePosition: google.maps.StrokePosition)
|
||||||
Parameters:
Returns:
void
|
||||||
setStrokeWeight | ||||||
setStrokeWeight(strokeWeight: number)
|
||||||
Parameters:
Returns:
void
|
||||||
setZIndex | ||||||
setZIndex(zIndex: number)
|
||||||
Parameters:
Returns:
void
|
||||||
Public attach | ||||||||
attach(map: IGoogleMap)
|
||||||||
Inherited from
GoogleMapsDrawableOverlay
|
||||||||
Assigns the overlay to the specified map. If possible, prefer using the appropriate
Parameters:
Returns:
void
|
||||||||
Public detach |
detach()
|
Inherited from
GoogleMapsDrawableOverlay
|
Removes the overlay from the map it is attached to. If possible, prefer using the
Returns:
void
|
Public clearListeners |
clearListeners()
|
Inherited from
GoogleMapsNativeObjectEmittingWrapper
|
Unregisters all handlers of any previously registered native event.
Returns:
void
|
Public listenTo | ||||||||||||
listenTo(eventName: string, handleEvent: (args: any[]) => void)
|
||||||||||||
Inherited from
GoogleMapsNativeObjectEmittingWrapper
|
||||||||||||
Registers a handler to a specific event of the native object and takes care of executing the handler inside angular's zone.
Parameters:
Returns:
void
An function for unregistering the handler from the event. |
||||||||||||
Public stopListeningTo | ||||||||
stopListeningTo(eventName: string)
|
||||||||
Inherited from
GoogleMapsNativeObjectEmittingWrapper
|
||||||||
Unregisters all handlers previously registered to handle a specific event.
Parameters:
Returns:
void
|
||||||||
Public setCustom | ||||||
setCustom(custom: any)
|
||||||
Inherited from
GoogleMapsNativeObjectWrapper
|
||||||
Parameters:
Returns:
void
|
||||||
import { CoordPath, NativeObjectWrapper, OutsideAngular, GoogleMapsApiService, IGoogleMap, Delegation } from '@bespunky/angular-google-maps/core';
import { GoogleMapsDrawableOverlay } from '../../abstraction/base/google-maps-drawable-overlay';
import { OverlayType } from '../../abstraction/base/overlay-type.enum';
import { IGoogleMapsPolygon, WrappedPolygonFunctions } from './i-google-maps-polygon';
/** Extends intellisense for `GoogleMapsPolygon` with native polygon functions. */
export interface GoogleMapsPolygon extends WrappedPolygonFunctions { }
/**
* The angular-ready wrapper for the native `google.maps.Polygon` class.
*
* @export
* @class GoogleMapsPolygon
* @extends {GoogleMapsDrawableOverlay<google.maps.Polygon>}
* @implements {IGoogleMapsPolygon}
*/
// @dynamic
@NativeObjectWrapper<GoogleMapsPolygon>({
getMap: Delegation.Exclude,
setMap: Delegation.Exclude
})
export class GoogleMapsPolygon extends GoogleMapsDrawableOverlay<google.maps.Polygon> implements IGoogleMapsPolygon
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any /* See super for docs on `any` */)
{
super(OverlayType.Polygon, map, api, native);
}
public getBounds(): google.maps.LatLngBounds
{
return this.api.geometry.definePathBounds(this.getPath());
}
public getPath(): google.maps.LatLngLiteral[][]
{
return this.api.geometry.toLiteralMultiPath(this.native.getPaths());
}
@OutsideAngular
public setPath(coords: CoordPath): void
{
this.native.setPaths(this.api.geometry.toLiteralMultiPath(coords));
}
setClickable (clickable: boolean) : void { this.setOptions({ clickable }); }
setFillColor (fillColor: string) : void { this.setOptions({ fillColor }); }
setFillOpacity (fillOpacity: number) : void { this.setOptions({ fillOpacity }); }
setStrokeColor (strokeColor: string) : void { this.setOptions({ strokeColor }); }
setStrokeOpacity (strokeOpacity: number) : void { this.setOptions({ strokeOpacity }); }
setStrokePosition(strokePosition: google.maps.StrokePosition): void { this.setOptions({ strokePosition }); }
setStrokeWeight (strokeWeight: number) : void { this.setOptions({ strokeWeight }); }
setZIndex (zIndex: number) : void { this.setOptions({ zIndex }); }
setGeodesic (geodesic: boolean) : void { this.setOptions({ geodesic }); }
}