1 | import { ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChange } from '@angular/core';
|
2 | import { MouseEvent } from '../map-types';
|
3 | import { GoogleMapsAPIWrapper } from '../services/google-maps-api-wrapper';
|
4 | import { LatLngLiteral } from '../services/google-maps-types';
|
5 | import { LatLngBounds, LatLngBoundsLiteral, MapTypeStyle } from '../services/google-maps-types';
|
6 | /**
|
7 | * SebMGoogleMap renders a Google Map.
|
8 | * **Important note**: To be able see a map in the browser, you have to define a height for the CSS
|
9 | * class `sebm-google-map-container`.
|
10 | *
|
11 | * ### Example
|
12 | * ```typescript
|
13 | * import { Component } from '@angular/core';
|
14 | * import { SebmGoogleMap } from 'angular2-google-maps/core';
|
15 | *
|
16 | * @Component({
|
17 | * selector: 'my-map-cmp',
|
18 | * directives: [SebmGoogleMap],
|
19 | * styles: [`
|
20 | * .sebm-google-map-container {
|
21 | * height: 300px;
|
22 | * }
|
23 | * `],
|
24 | * template: `
|
25 | * <sebm-google-map [latitude]="lat" [longitude]="lng" [zoom]="zoom">
|
26 | * </sebm-google-map>
|
27 | * `
|
28 | * })
|
29 | * ```
|
30 | */
|
31 | export declare class SebmGoogleMap implements OnChanges, OnInit, OnDestroy {
|
32 | private _elem;
|
33 | private _mapsWrapper;
|
34 | /**
|
35 | * The longitude that defines the center of the map.
|
36 | */
|
37 | longitude: number;
|
38 | /**
|
39 | * The latitude that defines the center of the map.
|
40 | */
|
41 | latitude: number;
|
42 | /**
|
43 | * The zoom level of the map. The default zoom level is 8.
|
44 | */
|
45 | zoom: number;
|
46 | /**
|
47 | * The minimal zoom level of the map allowed. When not provided, no restrictions to the zoom level
|
48 | * are enforced.
|
49 | */
|
50 | minZoom: number;
|
51 | /**
|
52 | * The maximal zoom level of the map allowed. When not provided, no restrictions to the zoom level
|
53 | * are enforced.
|
54 | */
|
55 | maxZoom: number;
|
56 | /**
|
57 | * Enables/disables if map is draggable.
|
58 | */
|
59 | draggable: boolean;
|
60 | /**
|
61 | * Enables/disables zoom and center on double click. Enabled by default.
|
62 | */
|
63 | disableDoubleClickZoom: boolean;
|
64 | /**
|
65 | * Enables/disables all default UI of the Google map. Please note: When the map is created, this
|
66 | * value cannot get updated.
|
67 | */
|
68 | disableDefaultUI: boolean;
|
69 | /**
|
70 | * If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default.
|
71 | */
|
72 | scrollwheel: boolean;
|
73 | /**
|
74 | * Color used for the background of the Map div. This color will be visible when tiles have not
|
75 | * yet loaded as the user pans. This option can only be set when the map is initialized.
|
76 | */
|
77 | backgroundColor: string;
|
78 | /**
|
79 | * The name or url of the cursor to display when mousing over a draggable map. This property uses
|
80 | * the css * cursor attribute to change the icon. As with the css property, you must specify at
|
81 | * least one fallback cursor that is not a URL. For example:
|
82 | * [draggableCursor]="'url(http://www.example.com/icon.png), auto;'"
|
83 | */
|
84 | draggableCursor: string;
|
85 | /**
|
86 | * The name or url of the cursor to display when the map is being dragged. This property uses the
|
87 | * css cursor attribute to change the icon. As with the css property, you must specify at least
|
88 | * one fallback cursor that is not a URL. For example:
|
89 | * [draggingCursor]="'url(http://www.example.com/icon.png), auto;'"
|
90 | */
|
91 | draggingCursor: string;
|
92 | /**
|
93 | * If false, prevents the map from being controlled by the keyboard. Keyboard shortcuts are
|
94 | * enabled by default.
|
95 | */
|
96 | keyboardShortcuts: boolean;
|
97 | /**
|
98 | * The enabled/disabled state of the Zoom control.
|
99 | */
|
100 | zoomControl: boolean;
|
101 | /**
|
102 | * Styles to apply to each of the default map types. Note that for Satellite/Hybrid and Terrain
|
103 | * modes, these styles will only apply to labels and geometry.
|
104 | */
|
105 | styles: MapTypeStyle[];
|
106 | /**
|
107 | * When true and the latitude and/or longitude values changes, the Google Maps panTo method is
|
108 | * used to
|
109 | * center the map. See: https://developers.google.com/maps/documentation/javascript/reference#Map
|
110 | */
|
111 | usePanning: boolean;
|
112 | /**
|
113 | * The initial enabled/disabled state of the Street View Pegman control.
|
114 | * This control is part of the default UI, and should be set to false when displaying a map type
|
115 | * on which the Street View road overlay should not appear (e.g. a non-Earth map type).
|
116 | */
|
117 | streetViewControl: boolean;
|
118 | /**
|
119 | * Sets the viewport to contain the given bounds.
|
120 | */
|
121 | fitBounds: LatLngBoundsLiteral | LatLngBounds;
|
122 | /**
|
123 | * The initial enabled/disabled state of the Scale control. This is disabled by default.
|
124 | */
|
125 | scaleControl: boolean;
|
126 | /**
|
127 | * The initial enabled/disabled state of the Map type control.
|
128 | */
|
129 | mapTypeControl: boolean;
|
130 | /**
|
131 | * Map option attributes that can change over time
|
132 | */
|
133 | private static _mapOptionsAttributes;
|
134 | private _observableSubscriptions;
|
135 | /**
|
136 | * This event emitter gets emitted when the user clicks on the map (but not when they click on a
|
137 | * marker or infoWindow).
|
138 | */
|
139 | mapClick: EventEmitter<MouseEvent>;
|
140 | /**
|
141 | * This event emitter gets emitted when the user right-clicks on the map (but not when they click
|
142 | * on a marker or infoWindow).
|
143 | */
|
144 | mapRightClick: EventEmitter<MouseEvent>;
|
145 | /**
|
146 | * This event emitter gets emitted when the user double-clicks on the map (but not when they click
|
147 | * on a marker or infoWindow).
|
148 | */
|
149 | mapDblClick: EventEmitter<MouseEvent>;
|
150 | /**
|
151 | * This event emitter is fired when the map center changes.
|
152 | */
|
153 | centerChange: EventEmitter<LatLngLiteral>;
|
154 | /**
|
155 | * This event is fired when the viewport bounds have changed.
|
156 | */
|
157 | boundsChange: EventEmitter<LatLngBounds>;
|
158 | /**
|
159 | * This event is fired when the map becomes idle after panning or zooming.
|
160 | */
|
161 | idle: EventEmitter<void>;
|
162 | /**
|
163 | * This event is fired when the zoom level has changed.
|
164 | */
|
165 | zoomChange: EventEmitter<number>;
|
166 | constructor(_elem: ElementRef, _mapsWrapper: GoogleMapsAPIWrapper);
|
167 | /** @internal */
|
168 | ngOnInit(): void;
|
169 | private _initMapInstance(el);
|
170 | /** @internal */
|
171 | ngOnDestroy(): void;
|
172 | ngOnChanges(changes: {
|
173 | [propName: string]: SimpleChange;
|
174 | }): void;
|
175 | private _updateMapOptionsChanges(changes);
|
176 | /**
|
177 | * Triggers a resize event on the google map instance.
|
178 | * Returns a promise that gets resolved after the event was triggered.
|
179 | */
|
180 | triggerResize(): Promise<void>;
|
181 | private _updatePosition(changes);
|
182 | private _fitBounds();
|
183 | private _handleMapCenterChange();
|
184 | private _handleBoundsChange();
|
185 | private _handleMapZoomChange();
|
186 | private _handleIdleEvent();
|
187 | private _handleMapMouseEvents();
|
188 | }
|