Description

The angular-ready wrapper for the native google.maps.Circle class.

Extends

GoogleMapsDrawableOverlay

Implements

IGoogleMapsCircle

Index

overlays/modules/circle/google-maps-circle.ts

Properties
Methods

Constructor

constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any)
Parameters:
Name Type Optional
map IGoogleMap No
api GoogleMapsApiService No
native any No

Properties

Public map
Type: IGoogleMap
The map to which this overlay should be added.
Public Readonly type
Type: OverlayType
The type of overlay this wrapper holds. Used by the `OverlayTracker` to distinguish between types.
Public custom
Type: any
Public Readonly native
Type: TNative
The instantiated native object to be wrapped.

Methods

Public getCenter
getCenter()
Returns: google.maps.LatLngLiteral
Public setCenter
setCenter(element: BoundsLike)
Decorators :
@OutsideAngular()
Parameters:
Name Type Optional
element BoundsLike No
Returns: void
setClickable
setClickable(clickable: boolean)
Parameters:
Name Type Optional
clickable boolean No
Returns: void
setFillColor
setFillColor(fillColor: string)
Parameters:
Name Type Optional
fillColor string No
Returns: void
setFillOpacity
setFillOpacity(fillOpacity: number)
Parameters:
Name Type Optional
fillOpacity number No
Returns: void
setStrokeColor
setStrokeColor(strokeColor: string)
Parameters:
Name Type Optional
strokeColor string No
Returns: void
setStrokeOpacity
setStrokeOpacity(strokeOpacity: number)
Parameters:
Name Type Optional
strokeOpacity number No
Returns: void
setStrokePosition
setStrokePosition(strokePosition: google.maps.StrokePosition)
Parameters:
Name Type Optional
strokePosition google.maps.StrokePosition No
Returns: void
setStrokeWeight
setStrokeWeight(strokeWeight: number)
Parameters:
Name Type Optional
strokeWeight number No
Returns: void
setZIndex
setZIndex(zIndex: number)
Parameters:
Name Type Optional
zIndex number No
Returns: void
Public attach
attach(map: IGoogleMap)

Assigns the overlay to the specified map. If possible, prefer using the appropriate GoogleMap.createXXX() method instead. If not possible, it is the responsability of the caller to add the overlay to the OverlayTracker in the GoogleMap.overlays object. Otherwise, inconsistencies and unexpected behaviours might occur.

Parameters:
Name Type Optional Description
map IGoogleMap No

The map to dispaly the overlay on.

Returns: void
Public detach
detach()

Removes the overlay from the map it is attached to. If possible, prefer using the GoogleMap.removeOverlay() method instead. If not possible, it is the responsability of the caller to remove the overlay from the OverlayTracker in the GoogleMap.overlays object. Otherwise, inconsistencies and unexpected behaviours might occur.

Returns: void
Public Abstract getBounds
getBounds()
Returns: google.maps.LatLngBounds
Public clearListeners
clearListeners()

Unregisters all handlers of any previously registered native event.

Returns: void
Public listenTo
listenTo(eventName: string, handleEvent: (args: any[]) => void)

Registers a handler to a specific event of the native object and takes care of executing the handler inside angular's zone.

Parameters:
Name Type Optional Description
eventName string No

The name of the native event to register the handler for.

handleEvent function No

The function to execute when the event is triggered by the native object.

Returns: void

An function for unregistering the handler from the event.

Public stopListeningTo
stopListeningTo(eventName: string)

Unregisters all handlers previously registered to handle a specific event.

Parameters:
Name Type Optional Description
eventName string No

The name of the native event for which to unregister all handlers.

Returns: void
Public setCustom
setCustom(custom: any)
Parameters:
Name Type Optional
custom any No
Returns: void
import { NativeObjectWrapper, OutsideAngular, GoogleMapsApiService, IGoogleMap, Delegation, BoundsLike } from '@bespunky/angular-google-maps/core';
import { GoogleMapsDrawableOverlay                   } from '../../abstraction/base/google-maps-drawable-overlay';
import { OverlayType                                 } from '../../abstraction/base/overlay-type.enum';
import { IGoogleMapsCircle, WrappedCircleFunctions   } from './i-google-maps-circle';

/** Extends intellisense for `GoogleMapsCircle` with native circle functions. */
export interface GoogleMapsCircle extends WrappedCircleFunctions { }

/**
 * The angular-ready wrapper for the native `google.maps.Circle` class.
 *
 * @export
 * @class GoogleMapsCircle
 * @extends {GoogleMapsDrawableOverlay<google.maps.Circle>}
 * @implements {IGoogleMapsCircle}
 */
// @dynamic
@NativeObjectWrapper<GoogleMapsCircle>({
    getMap: Delegation.Exclude,
    setMap: Delegation.Exclude
})
export class GoogleMapsCircle extends GoogleMapsDrawableOverlay<google.maps.Circle> implements IGoogleMapsCircle
{
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any /* See super for docs on `any` */)
    {
        super(OverlayType.Circle, map, api, native);
    }
    
    public getCenter(): google.maps.LatLngLiteral
    {
        return this.api.geometry.toLiteralCoord(this.native.getCenter());
    }
    
    @OutsideAngular
    public setCenter(element: BoundsLike): void
    {
        this.native.setCenter(this.api.geometry.centerOf(element));
    }

    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 }); }
}

results matching ""

    No results matching ""