/// import { Coord, NativePath, CoordPath, MultiPath, NativeGeometry, BoundsLike, FlatCoord, Path } from '../../abstraction/types/geometry.type'; import { IBounds } from '../../abstraction/base/i-bounds'; /** * Provides flexible methods for converting and analyzing geometry types. * * @see [Geometry Types](/docs/additional-documentation/geometry-types.html) for more info. * * @export * @class GeometryTransformService */ export declare class GeometryTransformService { /** * Converts a coord object of a known type to a flat coord array. * * @param {Coord} coord The coord to convert. * @returns {[number, number]} The flat coord representation of the coord. */ toFlatCoord(coord: Coord): FlatCoord; /** * Converts a coord object of a known type to a native `LatLngLiteral` object. * * @param {Coord} coord The coord to convert. * @returns {google.maps.LatLngLiteral} The native literal representation of the coord. */ toLiteralCoord(coord: Coord): google.maps.LatLngLiteral; /** * Converts a path object of a known type to native multi-path of type `LatLngLiteral[][]`. * * @param {CoordPath} path The path to convert. Can be a single or multi-path. * @returns {google.maps.LatLngLiteral[][]} The multi-path native literal representation of the given path. */ toLiteralMultiPath(path: CoordPath): google.maps.LatLngLiteral[][]; /** * Ensures that a path is represented as a multipath. * Similar to lodash's `castArray()` but takes care of native google types. * * @param {CoordPath} path The path to cast as a multi-path. * @returns {MultiPath} The multi-path representation of the given path. */ castMultiPath(path: CoordPath): MultiPath; /** * (Type Guard) Determines if the given path is a flat coord path (e.g. `[[0, 0], [1, 1]]`). * * @param {CoordPath} path The path to test. * @returns {path is FlatCoord[]} `true` if the given path is a flat coord path; otherwise `false`. */ isFlatCoordPath(path: CoordPath): path is FlatCoord[]; /** * (Type Guard) Determines if the given path is a native coord path (i.e. `[]`). * * @param {CoordPath} path The path to test. * @returns {path is NativePath} `true` if the given path is a native coord path; otherwise `false`. */ isNativeCoordPath(path: CoordPath): path is Coord[]; /** * (Type Guard) Determines if the given path is a native path. * * @param {CoordPath} path The path to test. * @returns {path is NativePath} `true` if the given path is a native path; otherwise `false`. */ isNativePath(path: CoordPath): path is NativePath; private isEmptyArray; /** * (Type Guard) Determines if the given path is a single path. * * @param {CoordPath} path The path to test. * @returns {path is Path} `true` if the given path is a single path; otherwise `false`. */ isSinglePath(path: CoordPath): path is Path; /** * (Type Guard) Determines if the given path is a multi-path. * * @param {CoordPath} path The path to test. * @returns {path is MultiPath} `true` if the given path is a multi-path; otherwise `false`. */ isMultiPath(path: CoordPath): path is MultiPath; /** * (Type Guard) Determines if the given object is any of the supported path types. * * @param {*} object The object to test. * @returns {path is MultiPath} `true` if the given object is any of the supported path types; otherwise `false`. */ isCoordPath(object: any): object is CoordPath; /** * (Type Guard) Checks whether the given object is a native literal coord object (i.e. `google.maps.LatLngLiteral`). * * @param {*} object The object to test. * @returns {object is google.maps.LatLngLiteral} `true` if the object is a native literal coord object; otherwise `false`. */ isLiteralCoord(object: any): object is google.maps.LatLngLiteral; /** * (Type Guard) Checks whether the given object is either a native literal coord object or a native coord object (i.e. `google.maps.LatLngLiteral` or `google.maps.LatLng`). * * @param {*} object The object to test. * @returns {object is google.maps.LatLngLiteral} `true` if the object is either a native literal coord object or a native coord object; otherwise `false`. */ isNativeCoord(object: any): object is google.maps.LatLngLiteral | google.maps.LatLng; /** * (Type Guard) Checks whether the given object is a flat coord array. * * @param {*} coord The object to test. * @returns {coord is FlatCoord} `true` if the object is a flat coord array; otherwise `false`. */ isFlatCoord(coord: any): coord is FlatCoord; private isLatitude; private isLongitude; /** * (Type Guard) Checks whether the given object is any of the supported coord types. * * @param {*} object The object to test. * @returns {object is Coord} `true` if the object is any of the supported coord types; otherwise `false`. */ isCoord(object: any): object is Coord; /** * (Type Guard) Checks whether an object is a native bounds object (i.e. `google.maps.LatLngBounds`, `google.maps.LatLngBoundsLiteral`). * * @param {*} object The object to test. * @returns {object is google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral} `true` if the object is a native bounds object; otherwise `false`. */ isNativeBounds(object: any): object is google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral; /** * (Type Guard) Checks whether the object implements the `google.maps.LatLngBoundsLiteral` interface.. * * @param {*} object The object to test. * @returns {object is google.maps.LatLngBoundsLiteral} `true` if the object implements `google.maps.LatLngBoundsLiteral`; otherwise `false`. */ isBoundsLiteral(object: any): object is google.maps.LatLngBoundsLiteral; /** * (Type Guard) Checks whether the object implements the IBounds interface (i.e. The object is an overlay object). * * @param {*} object The object to test. * @returns {object is IBounds} `true` if the object implements IBounds; otherwise `false`. */ isIBounds(object: any): object is IBounds; /** * (Type Guard) Checks whether the object is supported by the `BoundsLike` type and its users. * * @param {*} object The object to test. * @returns {object is IBounds} `true` if the object is supported by the `BoundsLike` type and its users; otherwise `false`. */ isBoundsLike(object: any): object is BoundsLike; /** * (Type Guard) Checks whether an object is a native data layer geometry object. * * @param {*} object The object to test. * @returns {object is google.maps.Data.Geometry} `true` if the object is a native data layer geometry object; otherwise `false`. */ isDataLayerGeometry(object: any): object is google.maps.Data.Geometry; /** * Creates a native data layer geometry for a point (google.maps.Data.Point). * * @param {Coord} position The point coordinates. * @returns {google.maps.Data.Point} The point geometry. */ createDataPoint(position: Coord): google.maps.Data.Point; /** * Creates a native data layer geometry for a polygon (google.maps.Data.Polygon). * * @param {CoordPath} path The path of the polygon. * @returns {google.maps.Data.Polygon} The polygon geometry. */ createDataPolygon(path: CoordPath): google.maps.Data.Polygon; /** * Creates a native data layer geometry for a polyline (google.maps.Data.Polyline). * * @param {Path} path The path of the polyline. * @returns {google.maps.Data.LineString} The polyline geometry. */ createDataPolyline(path: Path): google.maps.Data.LineString; /** * Defines the bounds of the given coordinate. * * @param {Coord} coord The coordinate for which bounds should be defined. * @returns {google.maps.LatLngBounds} The bounds of the specified coordinate. */ defineCoordBounds(coord: Coord): google.maps.LatLngBounds; /** * Defines the bounds of a given path (or multipath). * * @param {CoordPath} path The path for which bounds should be defined. * @returns {google.maps.LatLngBounds} The bounds of the specified path. */ definePathBounds(path: CoordPath): google.maps.LatLngBounds; /** * Defines the bound of the given data layer geometry. * * @param {NativeGeometry} geometry The geometry for which bounds should be defined. * @returns {google.maps.LatLngBounds} The bounds of the specified data layer geometry. */ defineGeometryBounds(geometry: NativeGeometry): google.maps.LatLngBounds; /** * Defines the containing bounds of all specified elements combined. * * @param {(...BoundsLike[])} elements The elements for which bounds should be defined. * @returns {google.maps.LatLngBounds} The containing bounds of all specified elements combined. */ defineBounds(...elements: BoundsLike[]): google.maps.LatLngBounds; /** * Calculates the center of the given elements by constructing their bounds and extracting its center. * * @param {...BoundsLike[]} elements The elements for which center should be calculated. * @returns {google.maps.LatLngLiteral} The center of the bounding box for the given elements. */ centerOf(...elements: BoundsLike[]): google.maps.LatLngLiteral; }