The angular-ready wrapper for the native google.maps.Data.Feature
class.
GoogleMapsNativeObjectEmittingWrapper
overlays/modules/data/feature/google-maps-feature.ts
Properties |
Methods |
|
constructor(data: IGoogleMapsData, api: GoogleMapsApiService, native: any)
|
||||||||||||
Parameters:
|
||||||||||||
Public Readonly data |
Type: IGoogleMapsData
|
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()
|
Returns:
google.maps.LatLngBounds
|
Public getId |
getId()
|
Returns:
string | number
|
Public getProperties |
getProperties()
|
Returns:
FeatureProperties
|
Public setMarker | ||||||
setMarker(position: Coord)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public setPolygon | ||||||
setPolygon(path: CoordPath)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public setPolyline | ||||||
setPolyline(path: Path)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public setProperties | ||||||
setProperties(properties: FeatureProperties)
|
||||||
Decorators :
@OutsideAngular()
|
||||||
Parameters:
Returns:
void
|
||||||
Public toGeoJson |
toGeoJson()
|
Returns:
Promise<any>
|
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 { GoogleMapsApiService, GoogleMapsNativeObjectEmittingWrapper, NativeObjectWrapper, Coord, CoordPath, OutsideAngular, Path } from '@bespunky/angular-google-maps/core';
import { IGoogleMapsData } from '../i-google-maps-data';
import { IGoogleMapsFeature, WrappedFeatureFunctions, FeatureProperties } from './i-google-maps-feature';
/** Extends intellisense for `GoogleMapsFeature` with native geometry feature functions. */
export interface GoogleMapsFeature extends WrappedFeatureFunctions { }
/**
* The angular-ready wrapper for the native `google.maps.Data.Feature` class.
*
* @export
* @class GoogleMapsFeature
* @extends {GoogleMapsNativeObjectEmittingWrapper<google.maps.Data.Feature>}
* @implements {IGoogleMapsFeature}
*/
// @dynamic
@NativeObjectWrapper<GoogleMapsFeature>()
export class GoogleMapsFeature extends GoogleMapsNativeObjectEmittingWrapper<google.maps.Data.Feature> implements IGoogleMapsFeature
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(public readonly data: IGoogleMapsData, api: GoogleMapsApiService, native: any /* See super for docs on `any` */)
{
super(api, native);
}
public getBounds(): google.maps.LatLngBounds
{
return this.api.geometry.defineGeometryBounds(this.getGeometry());
}
public getId(): string | number
{
return this.native.getId();
}
public getProperties(): FeatureProperties
{
const properties = {};
this.native.forEachProperty((value, name) => properties[name] = value);
return properties;
}
@OutsideAngular
public setProperties(properties: FeatureProperties): void
{
Object.keys(properties).forEach(name => this.native.setProperty(name, properties[name]));
}
@OutsideAngular
public setMarker(position: Coord): void
{
this.native.setGeometry(this.api.geometry.createDataPoint(position));
}
@OutsideAngular
public setPolygon(path: CoordPath): void
{
this.native.setGeometry(this.api.geometry.createDataPolygon(path));
}
@OutsideAngular
public setPolyline(path: Path): void
{
this.native.setGeometry(this.api.geometry.createDataPolyline(path));
}
public toGeoJson(): Promise<any>
{
return new Promise(resolve => this.native.toGeoJson(resolve));
}
}