Description

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

Extends

GoogleMapsDrawableOverlay

Implements

IGoogleMapsDirections

Index

directions/google-maps-directions.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 getBounds
getBounds()
Returns: google.maps.LatLngBounds
Public getPanel
getPanel()
Returns: ElementRef<any>
Public setDraggable
setDraggable(draggable: boolean)
Parameters:
Name Type Optional
draggable boolean No
Returns: void
Public setHideRouteList
setHideRouteList(hideRouteList: boolean)
Parameters:
Name Type Optional
hideRouteList boolean No
Returns: void
Public setInfoWindow
setInfoWindow(infoWindow: GoogleMapsComponentBase<IGoogleMapsInfoWindow> | IGoogleMapsInfoWindow)
Parameters:
Name Type Optional
infoWindow GoogleMapsComponentBase<IGoogleMapsInfoWindow> | IGoogleMapsInfoWindow No
Returns: void
Public setMarkerOptions
setMarkerOptions(markerOptions: google.maps.MarkerOptions)
Parameters:
Name Type Optional
markerOptions google.maps.MarkerOptions No
Returns: void
Public setPanel
setPanel(element: ElementRef | HTMLElement)
Decorators :
@OutsideAngular()
Parameters:
Name Type Optional
element ElementRef<any> | HTMLElement No
Returns: void
Public setPolylineOptions
setPolylineOptions(polylineOptions: google.maps.PolylineOptions)
Parameters:
Name Type Optional
polylineOptions google.maps.PolylineOptions No
Returns: void
Public setPreserveViewport
setPreserveViewport(preserveViewport: boolean)
Parameters:
Name Type Optional
preserveViewport boolean No
Returns: void
Public setSuppressBicyclingLayer
setSuppressBicyclingLayer(suppressBicyclingLayer: boolean)
Parameters:
Name Type Optional
suppressBicyclingLayer boolean No
Returns: void
Public setSuppressInfoWindows
setSuppressInfoWindows(suppressInfoWindows: boolean)
Parameters:
Name Type Optional
suppressInfoWindows boolean No
Returns: void
Public setSuppressMarkers
setSuppressMarkers(suppressMarkers: boolean)
Parameters:
Name Type Optional
suppressMarkers boolean No
Returns: void
Public setSuppressPolylines
setSuppressPolylines(suppressPolylines: boolean)
Parameters:
Name Type Optional
suppressPolylines boolean 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 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 { ElementRef } from '@angular/core';

import { GoogleMapsApiService, NativeObjectWrapper, IGoogleMap, OutsideAngular, Delegation, GoogleMapsComponentBase } from '@bespunky/angular-google-maps/core';
import { GoogleMapsDrawableOverlay, IGoogleMapsInfoWindow, OverlayType                                              } from '@bespunky/angular-google-maps/overlays';
import { IGoogleMapsDirections, WrappedDirectionsFunctions                                                          } from './i-google-maps-directions';

/** Extends intellisense for `GoogleMapsDirections` with native directions functions. */
export interface GoogleMapsDirections extends WrappedDirectionsFunctions { }

/**
 * The angular-ready wrapper for the native `google.maps.DirectionsRenderer` class.
 *
 * @export
 * @class GoogleMapsDirections
 * @extends {GoogleMapsDrawableOverlay<google.maps.DirectionsRenderer>}
 * @implements {IGoogleMapsDirections}
 */
// @dynamic
@NativeObjectWrapper<GoogleMapsDirections>({
    getMap: Delegation.Exclude,
    setMap: Delegation.Exclude
})
export class GoogleMapsDirections extends GoogleMapsDrawableOverlay<google.maps.DirectionsRenderer> implements IGoogleMapsDirections
{
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    constructor(map: IGoogleMap, api: GoogleMapsApiService, native: any /* See super for docs on `any` */)
    {
        super(OverlayType.Directions, map, api, native);
    }
    
    public getBounds(): google.maps.LatLngBounds
    {
        return this.native.getDirections().routes.reduce((bounds, route) => bounds.union(route.bounds), new google.maps.LatLngBounds());
    }
    
    public getPanel(): ElementRef<any>
    {
        return new ElementRef(this.native.getPanel());
    }
    
    @OutsideAngular
    public setPanel(element: ElementRef<any> | HTMLElement): void
    {
        this.native.setPanel(element instanceof ElementRef ? element.nativeElement : element);
    }
    
    public setDraggable             (draggable: boolean                                                                ): void { this.setOptions({draggable});}
    public setHideRouteList         (hideRouteList: boolean                                                            ): void { this.setOptions({hideRouteList});}
    public setInfoWindow            (infoWindow: GoogleMapsComponentBase<IGoogleMapsInfoWindow> | IGoogleMapsInfoWindow): void { this.setOptions({ infoWindow: (infoWindow instanceof GoogleMapsComponentBase ? infoWindow.wrapper : infoWindow).native }); }
    public setMarkerOptions         (markerOptions: google.maps.MarkerOptions                                          ): void { this.setOptions({markerOptions});}
    public setPolylineOptions       (polylineOptions: google.maps.PolylineOptions                                      ): void { this.setOptions({polylineOptions});}
    public setPreserveViewport      (preserveViewport: boolean                                                         ): void { this.setOptions({preserveViewport});}
    public setSuppressBicyclingLayer(suppressBicyclingLayer: boolean                                                   ): void { this.setOptions({suppressBicyclingLayer});}
    public setSuppressInfoWindows   (suppressInfoWindows: boolean                                                      ): void { this.setOptions({suppressInfoWindows});}
    public setSuppressMarkers       (suppressMarkers: boolean                                                          ): void { this.setOptions({suppressMarkers});}
    public setSuppressPolylines     (suppressPolylines: boolean                                                        ): void { this.setOptions({suppressPolylines});}
}

results matching ""

    No results matching ""