The angular-ready wrapper for the native google.maps.DirectionsRenderer
class.
directions/google-maps-directions.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 getPanel |
getPanel()
|
Returns:
ElementRef<any>
|
Public setDraggable | ||||||
setDraggable(draggable: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setHideRouteList | ||||||
setHideRouteList(hideRouteList: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setInfoWindow | ||||||
setInfoWindow(infoWindow: GoogleMapsComponentBase<IGoogleMapsInfoWindow> | IGoogleMapsInfoWindow)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setMarkerOptions | ||||||
setMarkerOptions(markerOptions: google.maps.MarkerOptions)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setPanel | ||||||
setPanel(element: ElementRef
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public setPolylineOptions | ||||||
setPolylineOptions(polylineOptions: google.maps.PolylineOptions)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setPreserveViewport | ||||||
setPreserveViewport(preserveViewport: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setSuppressBicyclingLayer | ||||||
setSuppressBicyclingLayer(suppressBicyclingLayer: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setSuppressInfoWindows | ||||||
setSuppressInfoWindows(suppressInfoWindows: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setSuppressMarkers | ||||||
setSuppressMarkers(suppressMarkers: boolean)
|
||||||
Parameters:
Returns:
void
|
||||||
Public setSuppressPolylines | ||||||
setSuppressPolylines(suppressPolylines: boolean)
|
||||||
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 { 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});}
}