From 3345a9a3945f9b557708b4f6213f581b0b958cbd Mon Sep 17 00:00:00 2001 From: mbehrlich Date: Thu, 20 Aug 2020 19:15:23 -0700 Subject: [PATCH] feat(google-maps): Add Layer components. (#19604) * feat(google-maps): Add Layer components. Implement components to easily add a traffic, transit or bicycling layer to an Angular Google Map. * feat(google-maps): Add Layer components. Fix comment for autoRefresh property of Traffic Layer. * feat(google-maps): Add layer components Add a base class for the transit and bicycling layers. * feat(google-maps): Add Layer components. Fix circleci error with MapBaseLayer not being part of a module. * feat(google-maps): Add Layer components Update public api with base layer class. --- src/dev-app/google-map/google-map-demo.html | 24 +++++ src/dev-app/google-map/google-map-demo.ts | 15 +++ src/google-maps/google-maps-module.ts | 8 ++ src/google-maps/map-base-layer.ts | 48 +++++++++ .../map-bicycling-layer.spec.ts | 54 +++++++++++ .../map-bicycling-layer.ts | 55 +++++++++++ .../map-traffic-layer.spec.ts | 58 +++++++++++ .../map-traffic-layer/map-traffic-layer.ts | 97 +++++++++++++++++++ .../map-transit-layer.spec.ts | 54 +++++++++++ .../map-transit-layer/map-transit-layer.ts | 55 +++++++++++ src/google-maps/public-api.ts | 6 +- .../testing/fake-google-map-utils.ts | 87 +++++++++++++++++ .../google-maps/google-maps.d.ts | 43 +++++++- 13 files changed, 602 insertions(+), 2 deletions(-) create mode 100644 src/google-maps/map-base-layer.ts create mode 100644 src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts create mode 100644 src/google-maps/map-bicycling-layer/map-bicycling-layer.ts create mode 100644 src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts create mode 100644 src/google-maps/map-traffic-layer/map-traffic-layer.ts create mode 100644 src/google-maps/map-transit-layer/map-transit-layer.spec.ts create mode 100644 src/google-maps/map-transit-layer/map-transit-layer.ts diff --git a/src/dev-app/google-map/google-map-demo.html b/src/dev-app/google-map/google-map-demo.html index 680b6a9b6e22..8c755642e8d4 100644 --- a/src/dev-app/google-map/google-map-demo.html +++ b/src/dev-app/google-map/google-map-demo.html @@ -26,6 +26,9 @@ [bounds]="groundOverlayBounds"> + + +

{{display?.lat}}

@@ -125,4 +128,25 @@ +
+ +
+ +
+ +
+ +
+ +
+ diff --git a/src/dev-app/google-map/google-map-demo.ts b/src/dev-app/google-map/google-map-demo.ts index 40543f6f196f..f72e1e704657 100644 --- a/src/dev-app/google-map/google-map-demo.ts +++ b/src/dev-app/google-map/google-map-demo.ts @@ -83,6 +83,9 @@ export class GoogleMapDemo { isKmlLayerDisplayed = false; demoKml = 'https://developers.google.com/maps/documentation/javascript/examples/kml/westcampus.kml'; + isTrafficLayerDisplayed = false; + isTransitLayerDisplayed = false; + isBicyclingLayerDisplayed = false; mapTypeId: google.maps.MapTypeId; mapTypeIds = [ @@ -172,4 +175,16 @@ export class GoogleMapDemo { toggleKmlLayerDisplay() { this.isKmlLayerDisplayed = !this.isKmlLayerDisplayed; } + + toggleTrafficLayerDisplay() { + this.isTrafficLayerDisplayed = !this.isTrafficLayerDisplayed; + } + + toggleTransitLayerDisplay() { + this.isTransitLayerDisplayed = !this.isTransitLayerDisplayed; + } + + toggleBicyclingLayerDisplay() { + this.isBicyclingLayerDisplayed = !this.isBicyclingLayerDisplayed; + } } diff --git a/src/google-maps/google-maps-module.ts b/src/google-maps/google-maps-module.ts index 1b1d22516b0e..20b889319529 100644 --- a/src/google-maps/google-maps-module.ts +++ b/src/google-maps/google-maps-module.ts @@ -9,6 +9,8 @@ import {NgModule} from '@angular/core'; import {GoogleMap} from './google-map/google-map'; +import {MapBaseLayer} from './map-base-layer'; +import {MapBicyclingLayer} from './map-bicycling-layer/map-bicycling-layer'; import {MapCircle} from './map-circle/map-circle'; import {MapGroundOverlay} from './map-ground-overlay/map-ground-overlay'; import {MapInfoWindow} from './map-info-window/map-info-window'; @@ -17,9 +19,13 @@ import {MapMarker} from './map-marker/map-marker'; import {MapPolygon} from './map-polygon/map-polygon'; import {MapPolyline} from './map-polyline/map-polyline'; import {MapRectangle} from './map-rectangle/map-rectangle'; +import {MapTrafficLayer} from './map-traffic-layer/map-traffic-layer'; +import {MapTransitLayer} from './map-transit-layer/map-transit-layer'; const COMPONENTS = [ GoogleMap, + MapBaseLayer, + MapBicyclingLayer, MapCircle, MapGroundOverlay, MapInfoWindow, @@ -28,6 +34,8 @@ const COMPONENTS = [ MapPolygon, MapPolyline, MapRectangle, + MapTrafficLayer, + MapTransitLayer, ]; @NgModule({ diff --git a/src/google-maps/map-base-layer.ts b/src/google-maps/map-base-layer.ts new file mode 100644 index 000000000000..ec46c6502caf --- /dev/null +++ b/src/google-maps/map-base-layer.ts @@ -0,0 +1,48 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265 +/// + +import {Directive, NgZone, OnDestroy, OnInit} from '@angular/core'; + +import {GoogleMap} from './google-map/google-map'; + +@Directive({ + selector: 'map-base-layer', + exportAs: 'mapBaseLayer', +}) +export class MapBaseLayer implements OnInit, OnDestroy { + constructor(protected readonly _map: GoogleMap, protected readonly _ngZone: NgZone) {} + + ngOnInit() { + if (this._map._isBrowser) { + this._ngZone.runOutsideAngular(() => { + this._initializeObject(); + }); + this._assertInitialized(); + this._setMap(); + } + } + + ngOnDestroy() { + this._unsetMap(); + } + + private _assertInitialized() { + if (!this._map.googleMap) { + throw Error( + 'Cannot access Google Map information before the API has been initialized. ' + + 'Please wait for the API to load before trying to interact with it.'); + } + } + + protected _initializeObject() {} + protected _setMap() {} + protected _unsetMap() {} +} diff --git a/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts b/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts new file mode 100644 index 000000000000..eed0044a9bd7 --- /dev/null +++ b/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts @@ -0,0 +1,54 @@ +import {Component} from '@angular/core'; +import {async, TestBed} from '@angular/core/testing'; + +import {DEFAULT_OPTIONS} from '../google-map/google-map'; +import {GoogleMapsModule} from '../google-maps-module'; +import { + createBicyclingLayerConstructorSpy, + createBicyclingLayerSpy, + createMapConstructorSpy, + createMapSpy, +} from '../testing/fake-google-map-utils'; + +describe('MapBicyclingLayer', () => { + let mapSpy: jasmine.SpyObj; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [GoogleMapsModule], + declarations: [TestApp], + }); + })); + + beforeEach(() => { + TestBed.compileComponents(); + + mapSpy = createMapSpy(DEFAULT_OPTIONS); + createMapConstructorSpy(mapSpy).and.callThrough(); + }); + + afterEach(() => { + delete window.google; + }); + + it('initializes a Google Map Bicycling Layer', () => { + const bicyclingLayerSpy = createBicyclingLayerSpy(); + const bicyclingLayerConstructorSpy = + createBicyclingLayerConstructorSpy(bicyclingLayerSpy).and.callThrough(); + + const fixture = TestBed.createComponent(TestApp); + fixture.detectChanges(); + + expect(bicyclingLayerConstructorSpy).toHaveBeenCalled(); + expect(bicyclingLayerSpy.setMap).toHaveBeenCalledWith(mapSpy); + }); +}); + +@Component({ + selector: 'test-app', + template: ` + + `, +}) +class TestApp { +} diff --git a/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts b/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts new file mode 100644 index 000000000000..96bf2994f06e --- /dev/null +++ b/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265 +/// + +import {Directive} from '@angular/core'; + +import {MapBaseLayer} from '../map-base-layer'; + +/** + * Angular component that renders a Google Maps Bicycling Layer via the Google Maps JavaScript API. + * + * See developers.google.com/maps/documentation/javascript/reference/map#BicyclingLayer + */ +@Directive({ + selector: 'map-bicycling-layer', + exportAs: 'mapBicyclingLayer', +}) +export class MapBicyclingLayer extends MapBaseLayer { + /** + * The underlying google.maps.BicyclingLayer object. + * + * See developers.google.com/maps/documentation/javascript/reference/map#BicyclingLayer + */ + bicyclingLayer?: google.maps.BicyclingLayer; + + protected _initializeObject() { + this.bicyclingLayer = new google.maps.BicyclingLayer(); + } + + protected _setMap() { + this._assertLayerInitialized(); + this.bicyclingLayer.setMap(this._map.googleMap!); + } + + protected _unsetMap() { + if (this.bicyclingLayer) { + this.bicyclingLayer.setMap(null); + } + } + + private _assertLayerInitialized(): asserts this is {bicyclingLayer: google.maps.BicyclingLayer} { + if (!this.bicyclingLayer) { + throw Error( + 'Cannot interact with a Google Map Bicycling Layer before it has been initialized. ' + + 'Please wait for the Transit Layer to load before trying to interact with it.'); + } + } +} diff --git a/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts b/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts new file mode 100644 index 000000000000..85e5c350af3a --- /dev/null +++ b/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts @@ -0,0 +1,58 @@ +import {Component} from '@angular/core'; +import {async, TestBed} from '@angular/core/testing'; + +import {DEFAULT_OPTIONS} from '../google-map/google-map'; +import {GoogleMapsModule} from '../google-maps-module'; +import { + createMapConstructorSpy, + createMapSpy, + createTrafficLayerConstructorSpy, + createTrafficLayerSpy, +} from '../testing/fake-google-map-utils'; + +describe('MapTrafficLayer', () => { + let mapSpy: jasmine.SpyObj; + const trafficLayerOptions: google.maps.TrafficLayerOptions = {autoRefresh: false}; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [GoogleMapsModule], + declarations: [TestApp], + }); + })); + + beforeEach(() => { + TestBed.compileComponents(); + + mapSpy = createMapSpy(DEFAULT_OPTIONS); + createMapConstructorSpy(mapSpy).and.callThrough(); + }); + + afterEach(() => { + delete window.google; + }); + + it('initializes a Google Map Traffic Layer', () => { + const trafficLayerSpy = createTrafficLayerSpy(trafficLayerOptions); + const trafficLayerConstructorSpy = + createTrafficLayerConstructorSpy(trafficLayerSpy).and.callThrough(); + + const fixture = TestBed.createComponent(TestApp); + fixture.componentInstance.autoRefresh = false; + fixture.detectChanges(); + + expect(trafficLayerConstructorSpy).toHaveBeenCalledWith(trafficLayerOptions); + expect(trafficLayerSpy.setMap).toHaveBeenCalledWith(mapSpy); + }); +}); + +@Component({ + selector: 'test-app', + template: ` + + + `, +}) +class TestApp { + autoRefresh?: boolean; +} diff --git a/src/google-maps/map-traffic-layer/map-traffic-layer.ts b/src/google-maps/map-traffic-layer/map-traffic-layer.ts new file mode 100644 index 000000000000..47c6988aa98e --- /dev/null +++ b/src/google-maps/map-traffic-layer/map-traffic-layer.ts @@ -0,0 +1,97 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265 +/// + +import {Directive, Input, NgZone, OnDestroy, OnInit} from '@angular/core'; +import {BehaviorSubject, Observable, Subject} from 'rxjs'; +import {map, take, takeUntil} from 'rxjs/operators'; + +import {GoogleMap} from '../google-map/google-map'; + +/** + * Angular component that renders a Google Maps Traffic Layer via the Google Maps JavaScript API. + * + * See developers.google.com/maps/documentation/javascript/reference/map#TrafficLayer + */ +@Directive({ + selector: 'map-traffic-layer', + exportAs: 'mapTrafficLayer', +}) +export class MapTrafficLayer implements OnInit, OnDestroy { + private readonly _autoRefresh = new BehaviorSubject(true); + private readonly _destroyed = new Subject(); + + /** + * The underlying google.maps.TrafficLayer object. + * + * See developers.google.com/maps/documentation/javascript/reference/map#TrafficLayer + */ + trafficLayer?: google.maps.TrafficLayer; + + /** + * Whether the traffic layer refreshes with updated information automatically. + */ + @Input() + set autoRefresh(autoRefresh: boolean) { + this._autoRefresh.next(autoRefresh); + } + + constructor(private readonly _map: GoogleMap, private readonly _ngZone: NgZone) {} + + ngOnInit() { + if (this._map._isBrowser) { + this._combineOptions().pipe(take(1)).subscribe(options => { + // Create the object outside the zone so its events don't trigger change detection. + this._ngZone.runOutsideAngular(() => { + this.trafficLayer = new google.maps.TrafficLayer(options); + }); + this._assertInitialized(); + this.trafficLayer.setMap(this._map.googleMap!); + }); + + this._watchForAutoRefreshChanges(); + } + } + + ngOnDestroy() { + this._destroyed.next(); + this._destroyed.complete(); + if (this.trafficLayer) { + this.trafficLayer.setMap(null); + } + } + + private _combineOptions(): Observable { + return this._autoRefresh.pipe(map(autoRefresh => { + const combinedOptions: google.maps.TrafficLayerOptions = {autoRefresh}; + return combinedOptions; + })); + } + + private _watchForAutoRefreshChanges() { + this._combineOptions().pipe(takeUntil(this._destroyed)).subscribe(options => { + this._assertInitialized(); + this.trafficLayer.setOptions(options); + }); + } + + private _assertInitialized(): asserts this is {trafficLayer: google.maps.TrafficLayer} { + if (!this._map.googleMap) { + throw Error( + 'Cannot access Google Map information before the API has been initialized. ' + + 'Please wait for the API to load before trying to interact with it.'); + } + if (!this.trafficLayer) { + throw Error( + 'Cannot interact with a Google Map Traffic Layer before it has been initialized. ' + + 'Please wait for the Traffic Layer to load before trying to interact with it.'); + } + } +} diff --git a/src/google-maps/map-transit-layer/map-transit-layer.spec.ts b/src/google-maps/map-transit-layer/map-transit-layer.spec.ts new file mode 100644 index 000000000000..1cbb26825671 --- /dev/null +++ b/src/google-maps/map-transit-layer/map-transit-layer.spec.ts @@ -0,0 +1,54 @@ +import {Component} from '@angular/core'; +import {async, TestBed} from '@angular/core/testing'; + +import {DEFAULT_OPTIONS} from '../google-map/google-map'; +import {GoogleMapsModule} from '../google-maps-module'; +import { + createMapConstructorSpy, + createMapSpy, + createTransitLayerConstructorSpy, + createTransitLayerSpy, +} from '../testing/fake-google-map-utils'; + +describe('MapTransitLayer', () => { + let mapSpy: jasmine.SpyObj; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [GoogleMapsModule], + declarations: [TestApp], + }); + })); + + beforeEach(() => { + TestBed.compileComponents(); + + mapSpy = createMapSpy(DEFAULT_OPTIONS); + createMapConstructorSpy(mapSpy).and.callThrough(); + }); + + afterEach(() => { + delete window.google; + }); + + it('initializes a Google Map Transit Layer', () => { + const transitLayerSpy = createTransitLayerSpy(); + const transitLayerConstructorSpy = + createTransitLayerConstructorSpy(transitLayerSpy).and.callThrough(); + + const fixture = TestBed.createComponent(TestApp); + fixture.detectChanges(); + + expect(transitLayerConstructorSpy).toHaveBeenCalled(); + expect(transitLayerSpy.setMap).toHaveBeenCalledWith(mapSpy); + }); +}); + +@Component({ + selector: 'test-app', + template: ` + + `, +}) +class TestApp { +} diff --git a/src/google-maps/map-transit-layer/map-transit-layer.ts b/src/google-maps/map-transit-layer/map-transit-layer.ts new file mode 100644 index 000000000000..620f1b15d7a1 --- /dev/null +++ b/src/google-maps/map-transit-layer/map-transit-layer.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1265 +/// + +import {Directive} from '@angular/core'; + +import {MapBaseLayer} from '../map-base-layer'; + +/** + * Angular component that renders a Google Maps Transit Layer via the Google Maps JavaScript API. + * + * See developers.google.com/maps/documentation/javascript/reference/map#TransitLayer + */ +@Directive({ + selector: 'map-transit-layer', + exportAs: 'mapTransitLayer', +}) +export class MapTransitLayer extends MapBaseLayer { + /** + * The underlying google.maps.TransitLayer object. + * + * See developers.google.com/maps/documentation/javascript/reference/map#TransitLayer + */ + transitLayer?: google.maps.TransitLayer; + + protected _initializeObject() { + this.transitLayer = new google.maps.TransitLayer(); + } + + protected _setMap() { + this._assertLayerInitialized(); + this.transitLayer.setMap(this._map.googleMap!); + } + + protected _unsetMap() { + if (this.transitLayer) { + this.transitLayer.setMap(null); + } + } + + private _assertLayerInitialized(): asserts this is {transitLayer: google.maps.TransitLayer} { + if (!this.transitLayer) { + throw Error( + 'Cannot interact with a Google Map Transit Layer before it has been initialized. ' + + 'Please wait for the Transit Layer to load before trying to interact with it.'); + } + } +} diff --git a/src/google-maps/public-api.ts b/src/google-maps/public-api.ts index 010e668b11cf..754d01fcbf3b 100644 --- a/src/google-maps/public-api.ts +++ b/src/google-maps/public-api.ts @@ -8,6 +8,9 @@ export {GoogleMap} from './google-map/google-map'; export {GoogleMapsModule} from './google-maps-module'; +export {MapAnchorPoint} from './map-anchor-point'; +export {MapBaseLayer} from './map-base-layer'; +export {MapBicyclingLayer} from './map-bicycling-layer/map-bicycling-layer'; export {MapCircle} from './map-circle/map-circle'; export {MapGroundOverlay} from './map-ground-overlay/map-ground-overlay'; export {MapInfoWindow} from './map-info-window/map-info-window'; @@ -16,4 +19,5 @@ export {MapMarker} from './map-marker/map-marker'; export {MapPolygon} from './map-polygon/map-polygon'; export {MapPolyline} from './map-polyline/map-polyline'; export {MapRectangle} from './map-rectangle/map-rectangle'; -export {MapAnchorPoint} from './map-anchor-point'; +export {MapTrafficLayer} from './map-traffic-layer/map-traffic-layer'; +export {MapTransitLayer} from './map-transit-layer/map-transit-layer'; diff --git a/src/google-maps/testing/fake-google-map-utils.ts b/src/google-maps/testing/fake-google-map-utils.ts index acaa99d763b4..be3b3fde8d88 100644 --- a/src/google-maps/testing/fake-google-map-utils.ts +++ b/src/google-maps/testing/fake-google-map-utils.ts @@ -25,6 +25,9 @@ export interface TestingWindow extends Window { Circle?: jasmine.Spy; GroundOverlay?: jasmine.Spy; KmlLayer?: jasmine.Spy; + TrafficLayer?: jasmine.Spy; + TransitLayer?: jasmine.Spy; + BicyclingLayer?: jasmine.Spy; }; }; } @@ -326,3 +329,87 @@ export function createKmlLayerConstructorSpy(kmlLayerSpy: jasmine.SpyObj { + const trafficLayerSpy = jasmine.createSpyObj('google.maps.TrafficLayer', [ + 'setOptions', + 'setMap', + ]); + return trafficLayerSpy; +} + +/** Creates a jasmine.Spy to watch for the constructor of a google.maps.TrafficLayer */ +export function createTrafficLayerConstructorSpy( + trafficLayerSpy: jasmine.SpyObj): jasmine.Spy { + const trafficLayerConstructorSpy = + jasmine.createSpy('TrafficLayer constructor', (_options: google.maps.TrafficLayerOptions) => { + return trafficLayerSpy; + }); + const testingWindow: TestingWindow = window; + if (testingWindow.google && testingWindow.google.maps) { + testingWindow.google.maps['TrafficLayer'] = trafficLayerConstructorSpy; + } else { + testingWindow.google = { + maps: { + 'TrafficLayer': trafficLayerConstructorSpy, + }, + }; + } + return trafficLayerConstructorSpy; +} + +/** Creates a jasmine.SpyObj for a google.maps.TransitLayer */ +export function createTransitLayerSpy(): jasmine.SpyObj { + const transitLayerSpy = jasmine.createSpyObj('google.maps.TransitLayer', [ + 'setMap', + ]); + return transitLayerSpy; +} + +/** Creates a jasmine.Spy to watch for the constructor of a google.maps.TransitLayer */ +export function createTransitLayerConstructorSpy( + transitLayerSpy: jasmine.SpyObj): jasmine.Spy { + const transitLayerConstructorSpy = jasmine.createSpy('TransitLayer constructor', () => { + return transitLayerSpy; + }); + const testingWindow: TestingWindow = window; + if (testingWindow.google && testingWindow.google.maps) { + testingWindow.google.maps['TransitLayer'] = transitLayerConstructorSpy; + } else { + testingWindow.google = { + maps: { + 'TransitLayer': transitLayerConstructorSpy, + }, + }; + } + return transitLayerConstructorSpy; +} + +/** Creates a jasmine.SpyObj for a google.maps.BicyclingLayer */ +export function createBicyclingLayerSpy(): jasmine.SpyObj { + const bicylingLayerSpy = jasmine.createSpyObj('google.maps.BicyclingLayer', [ + 'setMap', + ]); + return bicylingLayerSpy; +} + +/** Creates a jasmine.Spy to watch for the constructor of a google.maps.BicyclingLayer */ +export function createBicyclingLayerConstructorSpy( + bicylingLayerSpy: jasmine.SpyObj): jasmine.Spy { + const bicylingLayerConstructorSpy = jasmine.createSpy('BicyclingLayer constructor', () => { + return bicylingLayerSpy; + }); + const testingWindow: TestingWindow = window; + if (testingWindow.google && testingWindow.google.maps) { + testingWindow.google.maps['BicyclingLayer'] = bicylingLayerConstructorSpy; + } else { + testingWindow.google = { + maps: { + 'BicyclingLayer': bicylingLayerConstructorSpy, + }, + }; + } + return bicylingLayerConstructorSpy; +} diff --git a/tools/public_api_guard/google-maps/google-maps.d.ts b/tools/public_api_guard/google-maps/google-maps.d.ts index 77dac1b75eef..5df3db16e9d8 100644 --- a/tools/public_api_guard/google-maps/google-maps.d.ts +++ b/tools/public_api_guard/google-maps/google-maps.d.ts @@ -53,13 +53,35 @@ export declare class GoogleMap implements OnChanges, OnInit, OnDestroy { export declare class GoogleMapsModule { static ɵinj: i0.ɵɵInjectorDef; - static ɵmod: i0.ɵɵNgModuleDefWithMeta; + static ɵmod: i0.ɵɵNgModuleDefWithMeta; } export interface MapAnchorPoint { getAnchor(): google.maps.MVCObject; } +export declare class MapBaseLayer implements OnInit, OnDestroy { + protected readonly _map: GoogleMap; + protected readonly _ngZone: NgZone; + constructor(_map: GoogleMap, _ngZone: NgZone); + protected _initializeObject(): void; + protected _setMap(): void; + protected _unsetMap(): void; + ngOnDestroy(): void; + ngOnInit(): void; + static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDef; +} + +export declare class MapBicyclingLayer extends MapBaseLayer { + bicyclingLayer?: google.maps.BicyclingLayer; + protected _initializeObject(): void; + protected _setMap(): void; + protected _unsetMap(): void; + static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDef; +} + export declare class MapCircle implements OnInit, OnDestroy { set center(center: google.maps.LatLng | google.maps.LatLngLiteral); centerChanged: Observable; @@ -276,3 +298,22 @@ export declare class MapRectangle implements OnInit, OnDestroy { static ɵdir: i0.ɵɵDirectiveDefWithMeta; static ɵfac: i0.ɵɵFactoryDef; } + +export declare class MapTrafficLayer implements OnInit, OnDestroy { + set autoRefresh(autoRefresh: boolean); + trafficLayer?: google.maps.TrafficLayer; + constructor(_map: GoogleMap, _ngZone: NgZone); + ngOnDestroy(): void; + ngOnInit(): void; + static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDef; +} + +export declare class MapTransitLayer extends MapBaseLayer { + transitLayer?: google.maps.TransitLayer; + protected _initializeObject(): void; + protected _setMap(): void; + protected _unsetMap(): void; + static ɵdir: i0.ɵɵDirectiveDefWithMeta; + static ɵfac: i0.ɵɵFactoryDef; +}