Description

Represents the functionality that a geometry feature should provide.

Extends

IGoogleMapsNativeObjectEmittingWrapper

Index

overlays/modules/data/feature/i-google-maps-feature.ts

Properties
Methods

Methods

getId
getId()

Gets the id assigned to the feature.

Even though the @NativeObjectWrapper decorator can take care of delegating this method, the interface needs to declare it so it may be used throughout the library to identify features using interface abstraction access. See FeatureTracker source code.

Returns: string | number

The id assigned to the feature.

Even though the

getProperties
getProperties()

Gets a map of all properties assigned to the feature.

The map of properties assigned to the feature.

setMarker
setMarker(position: Coord)

Replaces the geometry of this feature with a marker geometry.

Parameters:
Name Type Optional Description
position Coord No

The position of the marker on the map.

Returns: void
setPolygon
setPolygon(path: CoordPath)

Replaces the geometry of this feature with a polygon geometry.

Parameters:
Name Type Optional Description
path CoordPath No

The polygon's path.

Returns: void
setPolyline
setPolyline(path: Path)

Replaces the geometry of this feature with a polyline geometry.

Parameters:
Name Type Optional Description
path Path No

The polyline's path.

Returns: void
setProperties
setProperties(properties: FeatureProperties)

Assignes properties to the feature. Any existing properties will be overriten. Non specified properties will not be touched.

Parameters:
Name Type Optional Description
properties FeatureProperties No

The properties to assigne to the feature.

Returns: void
toGeoJson
toGeoJson()

Should create the GeoJson representation of the feature and provide it as an object when the promise resolves. Will automatically take care of the callback required by Google Maps Api internally.

Returns: Promise<any>

A promise for the GeoJson object.

Properties

data
data: IGoogleMapsData
Type: IGoogleMapsData

The data object this feature was added to.

import { IGoogleMapsNativeObjectEmittingWrapper, Coord, CoordPath, IBounds, WrappedNativeFunctions, Path } from '@bespunky/angular-google-maps/core';
import { IGoogleMapsData } from '../i-google-maps-data';

/** A type for the native functions of geometry feature which should be wrapped. Used along with the extension interface for the wrapper. */
export type WrappedFeatureFunctions = WrappedNativeFunctions<google.maps.Data.Feature>;

/** A type for stongly typing geometry feature properties. */
export type FeatureProperties = { [name: string]: any };

/**
 * Represents the functionality that a geometry feature should provide.
 *
 * @export
 * @interface IGoogleMapsFeature
 * @extends {IGoogleMapsNativeObjectEmittingWrapper<google.maps.Data.Feature>}
 * @extends {WrappedFeatureFunctions}
 * @extends {IBounds}
 */
export interface IGoogleMapsFeature extends IGoogleMapsNativeObjectEmittingWrapper<google.maps.Data.Feature>, WrappedFeatureFunctions, IBounds
{
    /** The data object this feature was added to. */
    readonly data: IGoogleMapsData;

    /**
     * Gets the id assigned to the feature.
     *
     * @returns {(string | number)} The id assigned to the feature.
     * 
     * Even though the @NativeObjectWrapper decorator can take care of delegating this method, the interface
     * needs to declare it so it may be used throughout the library to identify features using interface abstraction access.
     * @see FeatureTracker source code.
     */
    getId(): string | number;
    
    /**
     * Replaces the geometry of this feature with a marker geometry.
     *
     * @param {Coord} position The position of the marker on the map.
     */
    setMarker(position: Coord): void;
    /**
     * Replaces the geometry of this feature with a polygon geometry.
     *
     * @param {CoordPath} path The polygon's path.
     */
    setPolygon(path: CoordPath): void;
    /**
     * Replaces the geometry of this feature with a polyline geometry.
     *
     * @param {Path} path The polyline's path.
     */
    setPolyline(path: Path): void;

    /**
     * Gets a map of all properties assigned to the feature.
     *
     * @returns {FeatureProperties} The map of properties assigned to the feature.
     */
    getProperties(): FeatureProperties;

    /**
     * Assignes properties to the feature.
     * Any existing properties will be overriten. Non specified properties will not be touched.
     *
     * @param {FeatureProperties} properties The properties to assigne to the feature.
     */
    setProperties(properties: FeatureProperties): void;

    /**
     * Should create the GeoJson representation of the feature and provide it as an object when the promise resolves.
     * Will automatically take care of the callback required by Google Maps Api internally.
     *
     * @returns {Promise<any>} A promise for the GeoJson object.
     */
    toGeoJson(): Promise<any>;
}

results matching ""

    No results matching ""