@inlog/inlog-maps 5.0.5 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DOCUMENTATION.md +1813 -1796
- package/_bundles/inlog-maps.js +2 -7239
- package/_bundles/inlog-maps.js.LICENSE.txt +20 -0
- package/_bundles/inlog-maps.js.map +1 -1
- package/_bundles/inlog-maps.min.js +2 -1
- package/_bundles/inlog-maps.min.js.LICENSE.txt +20 -0
- package/_bundles/inlog-maps.min.js.map +1 -1
- package/lib-esm/index.js +46 -45
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/map.js +1136 -1008
- package/lib-esm/map.js.map +1 -1
- package/lib-esm/models/apis/google/google-circles.js +133 -128
- package/lib-esm/models/apis/google/google-circles.js.map +1 -1
- package/lib-esm/models/apis/google/google-geojson.js +72 -69
- package/lib-esm/models/apis/google/google-geojson.js.map +1 -1
- package/lib-esm/models/apis/google/google-map.js +173 -88
- package/lib-esm/models/apis/google/google-map.js.map +1 -1
- package/lib-esm/models/apis/google/google-markers.js +324 -288
- package/lib-esm/models/apis/google/google-markers.js.map +1 -1
- package/lib-esm/models/apis/google/google-overlay.js +101 -94
- package/lib-esm/models/apis/google/google-overlay.js.map +1 -1
- package/lib-esm/models/apis/google/google-polygons.js +300 -225
- package/lib-esm/models/apis/google/google-polygons.js.map +1 -1
- package/lib-esm/models/apis/google/google-polylines.js +706 -594
- package/lib-esm/models/apis/google/google-polylines.js.map +1 -1
- package/lib-esm/models/apis/google/google-popup.js +58 -58
- package/lib-esm/models/apis/google/google-popup.js.map +1 -1
- package/lib-esm/models/apis/googleMaps.js +448 -352
- package/lib-esm/models/apis/googleMaps.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-circle.js +162 -132
- package/lib-esm/models/apis/leaflet/leaflet-circle.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-geojson.js +72 -66
- package/lib-esm/models/apis/leaflet/leaflet-geojson.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-map.js +139 -83
- package/lib-esm/models/apis/leaflet/leaflet-map.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-markers.js +293 -257
- package/lib-esm/models/apis/leaflet/leaflet-markers.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-overlay.js +34 -34
- package/lib-esm/models/apis/leaflet/leaflet-overlay.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-polygons.js +210 -210
- package/lib-esm/models/apis/leaflet/leaflet-polygons.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-polylines.js +705 -588
- package/lib-esm/models/apis/leaflet/leaflet-polylines.js.map +1 -1
- package/lib-esm/models/apis/leaflet/leaflet-popup.js +73 -73
- package/lib-esm/models/apis/leaflet/leaflet-popup.js.map +1 -1
- package/lib-esm/models/apis/leaflet.js +463 -358
- package/lib-esm/models/apis/leaflet.js.map +1 -1
- package/lib-esm/models/apis/mapFunctions.js +1 -0
- package/lib-esm/models/dto/event-type.js +38 -38
- package/lib-esm/models/dto/map-type.js +5 -5
- package/lib-esm/models/dto/polyline-type.js +6 -6
- package/lib-esm/models/features/circle/circle-alter-options.js +13 -13
- package/lib-esm/models/features/circle/circle-options.js +18 -18
- package/lib-esm/models/features/events/event-return.js +7 -7
- package/lib-esm/models/features/geojson/geojson-options.js +8 -8
- package/lib-esm/models/features/marker/circle-marker-options.js +11 -11
- package/lib-esm/models/features/marker/circle-marker-style.js +11 -11
- package/lib-esm/models/features/marker/marker-alter-options.js +9 -9
- package/lib-esm/models/features/marker/marker-icon.js +9 -9
- package/lib-esm/models/features/marker/marker-options.js +17 -17
- package/lib-esm/models/features/marker-clusterer/marker-clusterer-config.js +9 -9
- package/lib-esm/models/features/overlay/overlay-options.js +14 -14
- package/lib-esm/models/features/polygons/polygon-alter-options.js +13 -12
- package/lib-esm/models/features/polygons/polygon-alter-options.js.map +1 -1
- package/lib-esm/models/features/polygons/polygon-options.js +18 -17
- package/lib-esm/models/features/polygons/polygon-options.js.map +1 -1
- package/lib-esm/models/features/polyline/navigations-options.js +15 -13
- package/lib-esm/models/features/polyline/navigations-options.js.map +1 -1
- package/lib-esm/models/features/polyline/polyline-options.js +19 -19
- package/lib-esm/models/features/polyline/polyline-options.js.map +1 -1
- package/lib-esm/models/features/popup/popup-options.js +12 -12
- package/lib-esm/utils/maps-api-loader.service.js +88 -75
- package/lib-esm/utils/maps-api-loader.service.js.map +1 -1
- package/lib-esm/utils/url-builder.js +43 -43
- package/lib-esm/utils/url-builder.js.map +1 -1
- package/package.json +67 -63
- package/lib/index.d.ts +0 -46
- package/lib/index.js +0 -47
- package/lib/index.js.map +0 -1
- package/lib/map.d.ts +0 -513
- package/lib/map.js +0 -1011
- package/lib/map.js.map +0 -1
- package/lib/models/apis/google/google-circles.d.ts +0 -18
- package/lib/models/apis/google/google-circles.js +0 -131
- package/lib/models/apis/google/google-circles.js.map +0 -1
- package/lib/models/apis/google/google-geojson.d.ts +0 -9
- package/lib/models/apis/google/google-geojson.js +0 -72
- package/lib/models/apis/google/google-geojson.js.map +0 -1
- package/lib/models/apis/google/google-map.d.ts +0 -15
- package/lib/models/apis/google/google-map.js +0 -91
- package/lib/models/apis/google/google-map.js.map +0 -1
- package/lib/models/apis/google/google-markers.d.ts +0 -29
- package/lib/models/apis/google/google-markers.js +0 -291
- package/lib/models/apis/google/google-markers.js.map +0 -1
- package/lib/models/apis/google/google-overlay.d.ts +0 -11
- package/lib/models/apis/google/google-overlay.js +0 -97
- package/lib/models/apis/google/google-overlay.js.map +0 -1
- package/lib/models/apis/google/google-polygons.d.ts +0 -29
- package/lib/models/apis/google/google-polygons.js +0 -228
- package/lib/models/apis/google/google-polygons.js.map +0 -1
- package/lib/models/apis/google/google-polylines.d.ts +0 -55
- package/lib/models/apis/google/google-polylines.js +0 -597
- package/lib/models/apis/google/google-polylines.js.map +0 -1
- package/lib/models/apis/google/google-popup.d.ts +0 -10
- package/lib/models/apis/google/google-popup.js +0 -61
- package/lib/models/apis/google/google-popup.js.map +0 -1
- package/lib/models/apis/googleMaps.d.ts +0 -95
- package/lib/models/apis/googleMaps.js +0 -355
- package/lib/models/apis/googleMaps.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-circle.d.ts +0 -18
- package/lib/models/apis/leaflet/leaflet-circle.js +0 -135
- package/lib/models/apis/leaflet/leaflet-circle.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-geojson.d.ts +0 -9
- package/lib/models/apis/leaflet/leaflet-geojson.js +0 -69
- package/lib/models/apis/leaflet/leaflet-geojson.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-map.d.ts +0 -15
- package/lib/models/apis/leaflet/leaflet-map.js +0 -86
- package/lib/models/apis/leaflet/leaflet-map.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-markers.d.ts +0 -29
- package/lib/models/apis/leaflet/leaflet-markers.js +0 -260
- package/lib/models/apis/leaflet/leaflet-markers.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-overlay.d.ts +0 -10
- package/lib/models/apis/leaflet/leaflet-overlay.js +0 -37
- package/lib/models/apis/leaflet/leaflet-overlay.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-polygons.d.ts +0 -23
- package/lib/models/apis/leaflet/leaflet-polygons.js +0 -213
- package/lib/models/apis/leaflet/leaflet-polygons.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-polylines.d.ts +0 -54
- package/lib/models/apis/leaflet/leaflet-polylines.js +0 -591
- package/lib/models/apis/leaflet/leaflet-polylines.js.map +0 -1
- package/lib/models/apis/leaflet/leaflet-popup.d.ts +0 -11
- package/lib/models/apis/leaflet/leaflet-popup.js +0 -76
- package/lib/models/apis/leaflet/leaflet-popup.js.map +0 -1
- package/lib/models/apis/leaflet.d.ts +0 -97
- package/lib/models/apis/leaflet.js +0 -361
- package/lib/models/apis/leaflet.js.map +0 -1
- package/lib/models/apis/mapFunctions.d.ts +0 -84
- package/lib/models/apis/mapFunctions.js +0 -3
- package/lib/models/apis/mapFunctions.js.map +0 -1
- package/lib/models/dto/event-type.d.ts +0 -33
- package/lib/models/dto/event-type.js +0 -41
- package/lib/models/dto/event-type.js.map +0 -1
- package/lib/models/dto/map-type.d.ts +0 -4
- package/lib/models/dto/map-type.js +0 -8
- package/lib/models/dto/map-type.js.map +0 -1
- package/lib/models/dto/polyline-type.d.ts +0 -5
- package/lib/models/dto/polyline-type.js +0 -9
- package/lib/models/dto/polyline-type.js.map +0 -1
- package/lib/models/features/circle/circle-alter-options.d.ts +0 -12
- package/lib/models/features/circle/circle-alter-options.js +0 -16
- package/lib/models/features/circle/circle-alter-options.js.map +0 -1
- package/lib/models/features/circle/circle-options.d.ts +0 -15
- package/lib/models/features/circle/circle-options.js +0 -21
- package/lib/models/features/circle/circle-options.js.map +0 -1
- package/lib/models/features/events/event-return.d.ts +0 -4
- package/lib/models/features/events/event-return.js +0 -10
- package/lib/models/features/events/event-return.js.map +0 -1
- package/lib/models/features/geojson/geojson-options.d.ts +0 -5
- package/lib/models/features/geojson/geojson-options.js +0 -11
- package/lib/models/features/geojson/geojson-options.js.map +0 -1
- package/lib/models/features/marker/circle-marker-options.d.ts +0 -9
- package/lib/models/features/marker/circle-marker-options.js +0 -14
- package/lib/models/features/marker/circle-marker-options.js.map +0 -1
- package/lib/models/features/marker/circle-marker-style.d.ts +0 -8
- package/lib/models/features/marker/circle-marker-style.js +0 -14
- package/lib/models/features/marker/circle-marker-style.js.map +0 -1
- package/lib/models/features/marker/marker-alter-options.d.ts +0 -8
- package/lib/models/features/marker/marker-alter-options.js +0 -12
- package/lib/models/features/marker/marker-alter-options.js.map +0 -1
- package/lib/models/features/marker/marker-icon.d.ts +0 -6
- package/lib/models/features/marker/marker-icon.js +0 -12
- package/lib/models/features/marker/marker-icon.js.map +0 -1
- package/lib/models/features/marker/marker-options.d.ts +0 -11
- package/lib/models/features/marker/marker-options.js +0 -20
- package/lib/models/features/marker/marker-options.js.map +0 -1
- package/lib/models/features/marker-clusterer/marker-clusterer-config.d.ts +0 -6
- package/lib/models/features/marker-clusterer/marker-clusterer-config.js +0 -12
- package/lib/models/features/marker-clusterer/marker-clusterer-config.js.map +0 -1
- package/lib/models/features/overlay/overlay-options.d.ts +0 -11
- package/lib/models/features/overlay/overlay-options.js +0 -17
- package/lib/models/features/overlay/overlay-options.js.map +0 -1
- package/lib/models/features/polygons/polygon-alter-options.d.ts +0 -13
- package/lib/models/features/polygons/polygon-alter-options.js +0 -15
- package/lib/models/features/polygons/polygon-alter-options.js.map +0 -1
- package/lib/models/features/polygons/polygon-options.d.ts +0 -15
- package/lib/models/features/polygons/polygon-options.js +0 -20
- package/lib/models/features/polygons/polygon-options.js.map +0 -1
- package/lib/models/features/polyline/navigations-options.d.ts +0 -11
- package/lib/models/features/polyline/navigations-options.js +0 -16
- package/lib/models/features/polyline/navigations-options.js.map +0 -1
- package/lib/models/features/polyline/polyline-options.d.ts +0 -18
- package/lib/models/features/polyline/polyline-options.js +0 -22
- package/lib/models/features/polyline/polyline-options.js.map +0 -1
- package/lib/models/features/popup/popup-options.d.ts +0 -9
- package/lib/models/features/popup/popup-options.js +0 -15
- package/lib/models/features/popup/popup-options.js.map +0 -1
- package/lib/utils/maps-api-loader.service.d.ts +0 -9
- package/lib/utils/maps-api-loader.service.js +0 -78
- package/lib/utils/maps-api-loader.service.js.map +0 -1
- package/lib/utils/url-builder.d.ts +0 -11
- package/lib/utils/url-builder.js +0 -46
- package/lib/utils/url-builder.js.map +0 -1
- package/lib-esm/index.d.ts +0 -46
- package/lib-esm/map.d.ts +0 -513
- package/lib-esm/models/apis/google/google-circles.d.ts +0 -18
- package/lib-esm/models/apis/google/google-geojson.d.ts +0 -9
- package/lib-esm/models/apis/google/google-map.d.ts +0 -15
- package/lib-esm/models/apis/google/google-markers.d.ts +0 -29
- package/lib-esm/models/apis/google/google-overlay.d.ts +0 -11
- package/lib-esm/models/apis/google/google-polygons.d.ts +0 -29
- package/lib-esm/models/apis/google/google-polylines.d.ts +0 -55
- package/lib-esm/models/apis/google/google-popup.d.ts +0 -10
- package/lib-esm/models/apis/googleMaps.d.ts +0 -95
- package/lib-esm/models/apis/leaflet/leaflet-circle.d.ts +0 -18
- package/lib-esm/models/apis/leaflet/leaflet-geojson.d.ts +0 -9
- package/lib-esm/models/apis/leaflet/leaflet-map.d.ts +0 -15
- package/lib-esm/models/apis/leaflet/leaflet-markers.d.ts +0 -29
- package/lib-esm/models/apis/leaflet/leaflet-overlay.d.ts +0 -10
- package/lib-esm/models/apis/leaflet/leaflet-polygons.d.ts +0 -23
- package/lib-esm/models/apis/leaflet/leaflet-polylines.d.ts +0 -54
- package/lib-esm/models/apis/leaflet/leaflet-popup.d.ts +0 -11
- package/lib-esm/models/apis/leaflet.d.ts +0 -97
- package/lib-esm/models/apis/mapFunctions.d.ts +0 -84
- package/lib-esm/models/dto/event-type.d.ts +0 -33
- package/lib-esm/models/dto/map-type.d.ts +0 -4
- package/lib-esm/models/dto/polyline-type.d.ts +0 -5
- package/lib-esm/models/features/circle/circle-alter-options.d.ts +0 -12
- package/lib-esm/models/features/circle/circle-options.d.ts +0 -15
- package/lib-esm/models/features/events/event-return.d.ts +0 -4
- package/lib-esm/models/features/geojson/geojson-options.d.ts +0 -5
- package/lib-esm/models/features/marker/circle-marker-options.d.ts +0 -9
- package/lib-esm/models/features/marker/circle-marker-style.d.ts +0 -8
- package/lib-esm/models/features/marker/marker-alter-options.d.ts +0 -8
- package/lib-esm/models/features/marker/marker-icon.d.ts +0 -6
- package/lib-esm/models/features/marker/marker-options.d.ts +0 -11
- package/lib-esm/models/features/marker-clusterer/marker-clusterer-config.d.ts +0 -6
- package/lib-esm/models/features/overlay/overlay-options.d.ts +0 -11
- package/lib-esm/models/features/polygons/polygon-alter-options.d.ts +0 -13
- package/lib-esm/models/features/polygons/polygon-options.d.ts +0 -15
- package/lib-esm/models/features/polyline/navigations-options.d.ts +0 -11
- package/lib-esm/models/features/polyline/polyline-options.d.ts +0 -18
- package/lib-esm/models/features/popup/popup-options.d.ts +0 -9
- package/lib-esm/utils/maps-api-loader.service.d.ts +0 -9
- package/lib-esm/utils/url-builder.d.ts +0 -11
package/lib/map.js
DELETED
|
@@ -1,1011 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var googleMaps_1 = require("./models/apis/googleMaps");
|
|
4
|
-
var leaflet_1 = require("./models/apis/leaflet");
|
|
5
|
-
var map_type_1 = require("./models/dto/map-type");
|
|
6
|
-
var marker_clusterer_config_1 = require("./models/features/marker-clusterer/marker-clusterer-config");
|
|
7
|
-
var polyline_options_1 = require("./models/features/polyline/polyline-options");
|
|
8
|
-
var Map = /** @class */ (function () {
|
|
9
|
-
function Map() {
|
|
10
|
-
this.markersList = {};
|
|
11
|
-
this.polygonsList = {};
|
|
12
|
-
this.circlesList = {};
|
|
13
|
-
this.polylinesList = {};
|
|
14
|
-
this.infoWindowList = {};
|
|
15
|
-
this.overlayList = {};
|
|
16
|
-
this.markerClusterer = {};
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Use this to initialize map
|
|
20
|
-
* @param {InlogMaps.MapType} mapType
|
|
21
|
-
* @param {any} options
|
|
22
|
-
* @param {string} elementId default: 'inlog-map' [nullable]
|
|
23
|
-
* @returns {Promisse<any>}
|
|
24
|
-
*/
|
|
25
|
-
Map.prototype.initialize = function (mapType, options, elementId) {
|
|
26
|
-
if (elementId === void 0) { elementId = 'inlog-map'; }
|
|
27
|
-
this.map = mapType === map_type_1.MapType.Google ? new googleMaps_1.default() : new leaflet_1.default();
|
|
28
|
-
return this.map.initialize(mapType, options, elementId);
|
|
29
|
-
};
|
|
30
|
-
/* GEOJson */
|
|
31
|
-
/**
|
|
32
|
-
* Use this function to add GEOJSON to the currentMap
|
|
33
|
-
* @param {object} data Geojson
|
|
34
|
-
* @param {InlogMaps.GeoJsonOptions} options
|
|
35
|
-
* @param {any} eventClick is a function callback on click [nullable]
|
|
36
|
-
*/
|
|
37
|
-
Map.prototype.loadGEOJson = function (data, options, eventClick) {
|
|
38
|
-
this.map.loadGEOJson(data, options, eventClick);
|
|
39
|
-
};
|
|
40
|
-
/* Markers */
|
|
41
|
-
/**
|
|
42
|
-
* Use this function to draw markers in the currentMap
|
|
43
|
-
* @param {string} type
|
|
44
|
-
* @param {InlogMaps.MarkerOptions} options
|
|
45
|
-
* @param {any} eventClick is a function callback on click [nullable]
|
|
46
|
-
*/
|
|
47
|
-
Map.prototype.drawMarker = function (type, options, eventClick) {
|
|
48
|
-
var marker = this.map.drawMarker(options, eventClick);
|
|
49
|
-
if (!this.markersList[type]) {
|
|
50
|
-
this.markersList[type] = [];
|
|
51
|
-
}
|
|
52
|
-
marker.type = 'simple';
|
|
53
|
-
this.markersList[type].push(marker);
|
|
54
|
-
if (options.addClusterer) {
|
|
55
|
-
if (!this.markerClusterer[type]) {
|
|
56
|
-
this.addMarkerClusterer(type, new marker_clusterer_config_1.default(true, 1, 10));
|
|
57
|
-
}
|
|
58
|
-
this.map.addMarkerOnClusterer(marker, this.markerClusterer[type]);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Use this function to draw circle markers in the currentMap
|
|
63
|
-
* @param {string} type
|
|
64
|
-
* @param {InlogMaps.CircleMarkerOptions} options
|
|
65
|
-
* @param {any} eventClick is a function callback on click [nullable]
|
|
66
|
-
*/
|
|
67
|
-
Map.prototype.drawCircleMarker = function (type, options, eventClick) {
|
|
68
|
-
var marker = this.map.drawCircleMarker(options, eventClick);
|
|
69
|
-
if (!this.markersList[type]) {
|
|
70
|
-
this.markersList[type] = [];
|
|
71
|
-
}
|
|
72
|
-
marker.type = 'circle';
|
|
73
|
-
this.markersList[type].push(marker);
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Use this function to show/hide markers from a specific type
|
|
77
|
-
* @param {boolean} show
|
|
78
|
-
* @param {string} type
|
|
79
|
-
* @param {any} condition toogle markers with the condition [nullable]
|
|
80
|
-
*/
|
|
81
|
-
Map.prototype.toggleMarkers = function (show, type, condition) {
|
|
82
|
-
var markers = this.getMarkers(type, condition);
|
|
83
|
-
if (markers && markers.length) {
|
|
84
|
-
this.map.toggleMarkers(markers, show, this.markerClusterer[type]);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Remove markers from the map and from internal list
|
|
89
|
-
* @param {string} type
|
|
90
|
-
* @param {any} condition remove markers with the condition [nullable]
|
|
91
|
-
*/
|
|
92
|
-
Map.prototype.removeMarkers = function (type, condition) {
|
|
93
|
-
if (this.markersList[type] && condition) {
|
|
94
|
-
var markers = this.getMarkers(type, condition);
|
|
95
|
-
// Hide markers with the condition
|
|
96
|
-
this.map.toggleMarkers(markers, false, this.markerClusterer[type]);
|
|
97
|
-
// Keep markers that doesn't have the condition
|
|
98
|
-
this.markersList[type] = this.markersList[type].filter(function (marker) { return !condition(marker.object); });
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
if (this.markersList[type]) {
|
|
102
|
-
this.map.toggleMarkers(this.markersList[type], false, this.markerClusterer[type]);
|
|
103
|
-
}
|
|
104
|
-
this.markersList[type] = [];
|
|
105
|
-
}
|
|
106
|
-
if (this.markersList[type].length === 0) {
|
|
107
|
-
delete this.markersList[type];
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Remove all markers from the map and from the internal list
|
|
112
|
-
*/
|
|
113
|
-
Map.prototype.removeAllMarkers = function () {
|
|
114
|
-
for (var type in this.markersList) {
|
|
115
|
-
if (this.markersList.hasOwnProperty(type)) {
|
|
116
|
-
this.removeMarkers(type);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Use this function to alter marker style
|
|
122
|
-
* @param {string} type
|
|
123
|
-
* @param {InlogMaps.MarkerAlterOptions} options
|
|
124
|
-
* @param {any} condition alter markers with the condition [nullable]
|
|
125
|
-
*/
|
|
126
|
-
Map.prototype.alterMarkerOptions = function (type, options, condition) {
|
|
127
|
-
var markers = this.getMarkers(type, condition);
|
|
128
|
-
if (markers && markers.length) {
|
|
129
|
-
this.map.alterMarkerOptions(markers, options);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Use this functions to alterar marker position
|
|
134
|
-
* @param {string } type
|
|
135
|
-
* @param {number[]} position
|
|
136
|
-
* @param {boolean} addTransition [nullable]
|
|
137
|
-
* @param {any} condition [nullable]
|
|
138
|
-
*/
|
|
139
|
-
Map.prototype.alterMarkerPosition = function (type, position, addTransition, condition) {
|
|
140
|
-
var markers = this.getMarkers(type, condition);
|
|
141
|
-
if (markers && markers.length) {
|
|
142
|
-
this.map.alterMarkerPosition(markers, position, addTransition);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Use this function to fit bounds in the markers with the especified type
|
|
147
|
-
* @param {string} type
|
|
148
|
-
* @param {any} condition [nullable]
|
|
149
|
-
* @param {boolean} onlyMarkersOnMap default true
|
|
150
|
-
*/
|
|
151
|
-
Map.prototype.fitBoundsMarkers = function (type, condition, onlyMarkersOnMap) {
|
|
152
|
-
var _this = this;
|
|
153
|
-
if (onlyMarkersOnMap === void 0) { onlyMarkersOnMap = true; }
|
|
154
|
-
var markers = this.getMarkers(type, condition);
|
|
155
|
-
if (onlyMarkersOnMap) {
|
|
156
|
-
markers = markers.filter(function (x) { return _this.map.isMarkerOnMap(x); });
|
|
157
|
-
}
|
|
158
|
-
if (markers && markers.length) {
|
|
159
|
-
this.map.fitBoundsPositions(markers);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Use this functions to set the center of the map on marker
|
|
164
|
-
* @param {string} type
|
|
165
|
-
* @param {any} condition center on marker with the condition [nullable]
|
|
166
|
-
*/
|
|
167
|
-
Map.prototype.setCenterMarker = function (type, condition) {
|
|
168
|
-
if (this.markersList[type] && condition) {
|
|
169
|
-
var marker = this.markersList[type].find(function (marker) { return condition(marker.object); });
|
|
170
|
-
// Center on the marker with the condition
|
|
171
|
-
this.map.setCenterMarker(marker);
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
if (this.markersList[type] && this.markersList[type].length) {
|
|
175
|
-
this.map.setCenterMarker(this.markersList[type][0]);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* This functions returns if marker exists
|
|
181
|
-
* @param type
|
|
182
|
-
* @param condition [nullable]
|
|
183
|
-
* @returns {boolean}
|
|
184
|
-
*/
|
|
185
|
-
Map.prototype.markerExists = function (type, condition) {
|
|
186
|
-
var markers = this.getMarkers(type, condition);
|
|
187
|
-
return markers && markers.length > 0;
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* Use this function to count markers by type
|
|
191
|
-
* @param {string} type
|
|
192
|
-
* @param {boolean} onlyOnMap exclude hidden markers, default true
|
|
193
|
-
* @param {any} condition
|
|
194
|
-
* @returns {number}
|
|
195
|
-
*/
|
|
196
|
-
Map.prototype.countMarkers = function (type, onlyOnMap, condition) {
|
|
197
|
-
var _this = this;
|
|
198
|
-
if (onlyOnMap === void 0) { onlyOnMap = true; }
|
|
199
|
-
if (this.markerClusterer[type]) {
|
|
200
|
-
return this.map.countMarkersOnCluster(this.markerClusterer[type]);
|
|
201
|
-
}
|
|
202
|
-
var markers = this.getMarkers(type, condition);
|
|
203
|
-
if (onlyOnMap) {
|
|
204
|
-
markers = markers.filter(function (x) { return _this.map.isMarkerOnMap(x); });
|
|
205
|
-
}
|
|
206
|
-
return markers.length;
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* This function add new events on marker
|
|
210
|
-
* @param {string} type
|
|
211
|
-
* @param {InlogMaps.MarkerEventType} event
|
|
212
|
-
* @param {any} eventFunction
|
|
213
|
-
* @param {any} condition [nullable]
|
|
214
|
-
*/
|
|
215
|
-
Map.prototype.addMarkerEvent = function (type, event, eventFunction, condition) {
|
|
216
|
-
var markers = this.getMarkers(type, condition);
|
|
217
|
-
this.map.addMarkerEvent(markers, event, eventFunction);
|
|
218
|
-
};
|
|
219
|
-
/**
|
|
220
|
-
* This function remove events of marker
|
|
221
|
-
* @param {string} type
|
|
222
|
-
* @param {InlogMaps.MarkerEventType} event
|
|
223
|
-
* @param {any} condition [nullable]
|
|
224
|
-
*/
|
|
225
|
-
Map.prototype.removeMarkerEvent = function (type, event, condition) {
|
|
226
|
-
var markers = this.getMarkers(type, condition);
|
|
227
|
-
this.map.removeMarkerEvent(markers, event);
|
|
228
|
-
};
|
|
229
|
-
/* Marker Clusterer */
|
|
230
|
-
/**
|
|
231
|
-
* Use this function to add MarkerClusterer on the map
|
|
232
|
-
* @param {string} type same type of markers
|
|
233
|
-
* @param {InlogMaps.MarkerClusterConfig} config
|
|
234
|
-
*/
|
|
235
|
-
Map.prototype.addMarkerClusterer = function (type, config) {
|
|
236
|
-
this.markerClusterer[type] = this.map.addMarkerClusterer(config);
|
|
237
|
-
};
|
|
238
|
-
/**
|
|
239
|
-
* Use this function to alter clusterer options
|
|
240
|
-
* @param type same type of markers
|
|
241
|
-
* @param {InlogMaps.MarkerClusterConfig} config
|
|
242
|
-
*/
|
|
243
|
-
Map.prototype.alterMarkerClustererConfig = function (type, config) {
|
|
244
|
-
if (this.markerClusterer[type]) {
|
|
245
|
-
this.map.alterMarkerClustererConfig(this.markerClusterer[type], config);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Use this function to redraw marker clusterer
|
|
250
|
-
* @param type same type of markers
|
|
251
|
-
*/
|
|
252
|
-
Map.prototype.refreshClusterer = function (type) {
|
|
253
|
-
if (this.markerClusterer[type]) {
|
|
254
|
-
this.map.refreshClusterer(this.markerClusterer[type]);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Use this to clear markers on clusterer
|
|
259
|
-
* @param type same type of markers
|
|
260
|
-
*/
|
|
261
|
-
Map.prototype.clearMarkersClusterer = function (type) {
|
|
262
|
-
if (this.markerClusterer[type]) {
|
|
263
|
-
this.map.clearMarkersClusterer(this.markerClusterer[type]);
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
/* Polygons */
|
|
267
|
-
/**
|
|
268
|
-
* Use this function to draw polygons
|
|
269
|
-
* @param {string} type
|
|
270
|
-
* @param {InlogMaps.PolygonOptions} options
|
|
271
|
-
* @param {any} eventClick [nullable]
|
|
272
|
-
*/
|
|
273
|
-
Map.prototype.drawPolygon = function (type, options, eventClick) {
|
|
274
|
-
var polygon = this.map.drawPolygon(options, eventClick);
|
|
275
|
-
if (!this.polygonsList[type]) {
|
|
276
|
-
this.polygonsList[type] = [];
|
|
277
|
-
}
|
|
278
|
-
this.polygonsList[type].push(polygon);
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* Use this function to show/hide polygon from a especific type
|
|
282
|
-
* @param {boolean} show
|
|
283
|
-
* @param {string} type
|
|
284
|
-
* @param {any} condition toggle polygon with the condition [nullable]
|
|
285
|
-
*/
|
|
286
|
-
Map.prototype.togglePolygons = function (show, type, condition) {
|
|
287
|
-
var polygons = this.getPolygons(type, condition);
|
|
288
|
-
if (polygons && polygons.length) {
|
|
289
|
-
this.map.togglePolygons(polygons, show);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* Remove polygons from the map and from internal list
|
|
294
|
-
* @param {string} type
|
|
295
|
-
* @param {any} condition remove polygons with the condition [nullable]
|
|
296
|
-
*/
|
|
297
|
-
Map.prototype.removePolygons = function (type, condition) {
|
|
298
|
-
if (this.polygonsList[type] && condition) {
|
|
299
|
-
var polygons = this.getPolygons(type, condition);
|
|
300
|
-
// Hide markers with the condition
|
|
301
|
-
this.map.togglePolygons(polygons, false);
|
|
302
|
-
// Keep markers that doesn't have the condition
|
|
303
|
-
this.polygonsList[type] = this.polygonsList[type].filter(function (polygon) { return !condition(polygon.object); });
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
if (this.polygonsList[type]) {
|
|
307
|
-
this.map.togglePolygons(this.polygonsList[type], false);
|
|
308
|
-
}
|
|
309
|
-
this.polygonsList[type] = [];
|
|
310
|
-
}
|
|
311
|
-
if (this.polygonsList[type].length === 0) {
|
|
312
|
-
delete this.polygonsList[type];
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Remove all polygons from the map and from the internal list
|
|
317
|
-
*/
|
|
318
|
-
Map.prototype.removeAllPolygons = function () {
|
|
319
|
-
for (var type in this.polygonsList) {
|
|
320
|
-
if (this.polygonsList.hasOwnProperty(type)) {
|
|
321
|
-
this.removePolygons(type);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
/**
|
|
326
|
-
* Use this function to alter polygons options/style
|
|
327
|
-
* @param {string} type
|
|
328
|
-
* @param {InlogMaps.PolygonAlterOptions} options
|
|
329
|
-
* @param {any} condition alter polygon with the condition [nullable]
|
|
330
|
-
*/
|
|
331
|
-
Map.prototype.alterPolygonOptions = function (type, options, condition) {
|
|
332
|
-
var polygons = this.getPolygons(type, condition);
|
|
333
|
-
if (polygons && polygons.length) {
|
|
334
|
-
this.map.alterPolygonOptions(polygons, options);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
/**
|
|
338
|
-
* Use this function to fit bounds of a polygon
|
|
339
|
-
* @param {string} type
|
|
340
|
-
* @param {any} condition fit polygon bounds with the condition [nullable]
|
|
341
|
-
*/
|
|
342
|
-
Map.prototype.fitBoundsPolygons = function (type, condition) {
|
|
343
|
-
var _this = this;
|
|
344
|
-
var polygons = this.getPolygons(type, condition)
|
|
345
|
-
.filter(function (polygon) { return _this.map.isPolygonOnMap(polygon); });
|
|
346
|
-
if (polygons && polygons.length) {
|
|
347
|
-
this.map.fitBoundsPolygons(polygons);
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
/**
|
|
351
|
-
* Set center on polygon bounds
|
|
352
|
-
* @param {string} type
|
|
353
|
-
* @param {any} condition fit polygon bounds with the condition [nullable]
|
|
354
|
-
*/
|
|
355
|
-
Map.prototype.setCenterPolygons = function (type, condition) {
|
|
356
|
-
var _this = this;
|
|
357
|
-
var polygons = this.getPolygons(type, condition)
|
|
358
|
-
.filter(function (polygon) { return _this.map.isPolygonOnMap(polygon); });
|
|
359
|
-
if (polygons && polygons.length) {
|
|
360
|
-
this.map.setCenterPolygons(polygons);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
/**
|
|
364
|
-
* This functions returns if polygon exists
|
|
365
|
-
* @param type
|
|
366
|
-
* @param condition [nullable]
|
|
367
|
-
* @returns {boolean}
|
|
368
|
-
*/
|
|
369
|
-
Map.prototype.polygonExists = function (type, condition) {
|
|
370
|
-
var polygons = this.getPolygons(type, condition);
|
|
371
|
-
return polygons && polygons.length > 0;
|
|
372
|
-
};
|
|
373
|
-
/**
|
|
374
|
-
* Use this function to get the path of some polygon
|
|
375
|
-
* @param {string} type
|
|
376
|
-
* @param {any} condition
|
|
377
|
-
* @returns {number[]}
|
|
378
|
-
*/
|
|
379
|
-
Map.prototype.getPolygonPath = function (type, condition) {
|
|
380
|
-
var polygon = this.getPolygons(type, condition);
|
|
381
|
-
if (polygon && polygon.length) {
|
|
382
|
-
return this.map.getPolygonPath(polygon[0]);
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
/**
|
|
386
|
-
* This function add new events on polygon
|
|
387
|
-
* @param {string} type
|
|
388
|
-
* @param {InlogMaps.PolygonEventType} event
|
|
389
|
-
* @param {any} eventFunction
|
|
390
|
-
* @param {any} condition [nullable]
|
|
391
|
-
*/
|
|
392
|
-
Map.prototype.addPolygonEvent = function (type, event, eventFunction, condition) {
|
|
393
|
-
var polygons = this.getPolygons(type, condition);
|
|
394
|
-
this.map.addPolygonEvent(polygons, event, eventFunction);
|
|
395
|
-
};
|
|
396
|
-
/**
|
|
397
|
-
* This function remove events of polygon
|
|
398
|
-
* @param {string} type
|
|
399
|
-
* @param {InlogMaps.PolygonEventType} event
|
|
400
|
-
* @param {any} condition [nullable]
|
|
401
|
-
*/
|
|
402
|
-
Map.prototype.removePolygonEvent = function (type, event, condition) {
|
|
403
|
-
var polygons = this.getPolygons(type, condition);
|
|
404
|
-
this.map.removePolygonEvent(polygons, event);
|
|
405
|
-
};
|
|
406
|
-
/* Circles */
|
|
407
|
-
/**
|
|
408
|
-
* Use this function to draw circles on the currentMap
|
|
409
|
-
* @param {string} type
|
|
410
|
-
* @param {InlogMaps.CircleOptions} options
|
|
411
|
-
* @param {any} eventClick [nullable]
|
|
412
|
-
*/
|
|
413
|
-
Map.prototype.drawCircle = function (type, options, eventClick) {
|
|
414
|
-
var circle = this.map.drawCircle(options, eventClick);
|
|
415
|
-
if (!this.circlesList[type]) {
|
|
416
|
-
this.circlesList[type] = [];
|
|
417
|
-
}
|
|
418
|
-
this.circlesList[type].push(circle);
|
|
419
|
-
};
|
|
420
|
-
/**
|
|
421
|
-
* Use this function to show/hide circles from a especific type
|
|
422
|
-
* @param {boolean} show
|
|
423
|
-
* @param {string} type
|
|
424
|
-
* @param {any} condition toggle circles with the condition [nullable]
|
|
425
|
-
*/
|
|
426
|
-
Map.prototype.toggleCircles = function (show, type, condition) {
|
|
427
|
-
var circles = this.getCircles(type, condition);
|
|
428
|
-
if (circles && circles.length) {
|
|
429
|
-
this.map.toggleCircles(circles, show);
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
/**
|
|
433
|
-
* Remove circles from the map and from internal list
|
|
434
|
-
* @param {string} type
|
|
435
|
-
* @param {any} condition remove circles with the condition [nullable]
|
|
436
|
-
*/
|
|
437
|
-
Map.prototype.removeCircles = function (type, condition) {
|
|
438
|
-
if (this.circlesList[type] && condition) {
|
|
439
|
-
var circles = this.getCircles(type, condition);
|
|
440
|
-
// Hide circles with the condition
|
|
441
|
-
this.map.toggleCircles(circles, false);
|
|
442
|
-
// Keep circles that doesn't have the condition
|
|
443
|
-
this.circlesList[type] = this.circlesList[type].filter(function (circle) { return !condition(circle.object); });
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
if (this.circlesList[type]) {
|
|
447
|
-
this.map.toggleCircles(this.circlesList[type], false);
|
|
448
|
-
}
|
|
449
|
-
this.circlesList[type] = [];
|
|
450
|
-
}
|
|
451
|
-
if (this.circlesList[type].length === 0) {
|
|
452
|
-
delete this.circlesList[type];
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
/**
|
|
456
|
-
* Remove all circles from the map and from the internal list
|
|
457
|
-
*/
|
|
458
|
-
Map.prototype.removeAllCircles = function () {
|
|
459
|
-
for (var type in this.circlesList) {
|
|
460
|
-
if (this.circlesList.hasOwnProperty(type)) {
|
|
461
|
-
this.removeCircles(type);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
/**
|
|
466
|
-
* Use this function to alter circle options
|
|
467
|
-
* @param {string} type
|
|
468
|
-
* @param {InlogMaps.CircleAlterOptions} options
|
|
469
|
-
* @param {any} condition alter circle with the condition [nullable]
|
|
470
|
-
*/
|
|
471
|
-
Map.prototype.alterCircleOptions = function (type, options, condition) {
|
|
472
|
-
var circles = this.getCircles(type, condition);
|
|
473
|
-
if (circles && circles.length) {
|
|
474
|
-
this.map.alterCircleOptions(circles, options);
|
|
475
|
-
}
|
|
476
|
-
};
|
|
477
|
-
/**
|
|
478
|
-
* Use this function to fit bounds of a polygon
|
|
479
|
-
* @param {string} type
|
|
480
|
-
* @param {any} condition fit polygon bounds with the condition [nullable]
|
|
481
|
-
*/
|
|
482
|
-
Map.prototype.fitBoundsCircles = function (type, condition) {
|
|
483
|
-
var _this = this;
|
|
484
|
-
var circles = this.getCircles(type, condition)
|
|
485
|
-
.filter(function (circle) { return _this.map.isCircleOnMap(circle); });
|
|
486
|
-
if (circles && circles.length) {
|
|
487
|
-
this.map.fitBoundsCircles(circles);
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
/**
|
|
491
|
-
* This functions returns if circle exists
|
|
492
|
-
* @param {string} type
|
|
493
|
-
* @param {any} condition [nullable]
|
|
494
|
-
* @returns {boolean}
|
|
495
|
-
*/
|
|
496
|
-
Map.prototype.circleExists = function (type, condition) {
|
|
497
|
-
var circles = this.getCircles(type, condition);
|
|
498
|
-
return circles && circles.length > 0;
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* This function return circle center
|
|
502
|
-
* @param {string} type
|
|
503
|
-
* @param {any} condition [nullable]
|
|
504
|
-
* @returns {number[]}
|
|
505
|
-
*/
|
|
506
|
-
Map.prototype.getCircleCenter = function (type, condition) {
|
|
507
|
-
var circles = this.getCircles(type, condition);
|
|
508
|
-
if (circles && circles.length) {
|
|
509
|
-
return this.map.getCircleCenter(circles[0]);
|
|
510
|
-
}
|
|
511
|
-
return null;
|
|
512
|
-
};
|
|
513
|
-
/**
|
|
514
|
-
* This function return circle center
|
|
515
|
-
* @param {string} type
|
|
516
|
-
* @param {any} condition [nullable]
|
|
517
|
-
* @returns {number}
|
|
518
|
-
*/
|
|
519
|
-
Map.prototype.getCircleRadius = function (type, condition) {
|
|
520
|
-
var circles = this.getCircles(type, condition);
|
|
521
|
-
if (circles && circles.length) {
|
|
522
|
-
return this.map.getCircleRadius(circles[0]);
|
|
523
|
-
}
|
|
524
|
-
return null;
|
|
525
|
-
};
|
|
526
|
-
/**
|
|
527
|
-
* This function add new events on circle
|
|
528
|
-
* @param {string} type
|
|
529
|
-
* @param {InlogMaps.CircleEventType} event
|
|
530
|
-
* @param {any} eventFunction
|
|
531
|
-
* @param {any} condition [nullable]
|
|
532
|
-
*/
|
|
533
|
-
Map.prototype.addCircleEvent = function (type, event, eventFunction, condition) {
|
|
534
|
-
var circles = this.getCircles(type, condition);
|
|
535
|
-
this.map.addCircleEvent(circles, event, eventFunction);
|
|
536
|
-
};
|
|
537
|
-
/**
|
|
538
|
-
* This function remove events of circle
|
|
539
|
-
* @param {string} type
|
|
540
|
-
* @param {InlogMaps.CircleEventType} event
|
|
541
|
-
* @param {any} condition [nullable]
|
|
542
|
-
*/
|
|
543
|
-
Map.prototype.removeCircleEvent = function (type, event, condition) {
|
|
544
|
-
var circles = this.getCircles(type, condition);
|
|
545
|
-
this.map.removeCircleEvent(circles, event);
|
|
546
|
-
};
|
|
547
|
-
/* Polylines */
|
|
548
|
-
/**
|
|
549
|
-
* Use this function to draw polylines on the currentMap
|
|
550
|
-
* @param {string} type
|
|
551
|
-
* @param {InlogMaps.PolylineOptions} options
|
|
552
|
-
* @param {any} eventClick [nullable]
|
|
553
|
-
*/
|
|
554
|
-
Map.prototype.drawPolyline = function (type, options, eventClick) {
|
|
555
|
-
var polyline = this.map.drawPolyline(options, eventClick);
|
|
556
|
-
if (!this.polylinesList[type]) {
|
|
557
|
-
this.polylinesList[type] = [];
|
|
558
|
-
}
|
|
559
|
-
this.polylinesList[type].push(polyline);
|
|
560
|
-
};
|
|
561
|
-
/**
|
|
562
|
-
* Use this function to draw polylines with navigation on the currentMap
|
|
563
|
-
* @param {string} type
|
|
564
|
-
* @param {InlogMaps.PolylineOptions} options
|
|
565
|
-
*/
|
|
566
|
-
Map.prototype.drawPolylineWithNavigation = function (type, options, eventClick) {
|
|
567
|
-
var polyline = this.map.drawPolylineWithNavigation(options, eventClick);
|
|
568
|
-
if (!this.polylinesList[type]) {
|
|
569
|
-
this.polylinesList[type] = [];
|
|
570
|
-
}
|
|
571
|
-
this.polylinesList[type].push(polyline);
|
|
572
|
-
};
|
|
573
|
-
/**
|
|
574
|
-
* Use this function to toggle polylines
|
|
575
|
-
* @param {boolean} show
|
|
576
|
-
* @param {string} type
|
|
577
|
-
* @param {any} condition toggle polyline with the condition [nullable]
|
|
578
|
-
*/
|
|
579
|
-
Map.prototype.togglePolylines = function (show, type, condition) {
|
|
580
|
-
var polyline = this.getPolylines(type, condition);
|
|
581
|
-
if (polyline && polyline.length) {
|
|
582
|
-
this.map.togglePolylines(polyline, show);
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
/**
|
|
586
|
-
* Use this function to remove polylines
|
|
587
|
-
* @param {string} type
|
|
588
|
-
* @param {any} condition remove polyline with the condition [nullable]
|
|
589
|
-
*/
|
|
590
|
-
Map.prototype.removePolylines = function (type, condition) {
|
|
591
|
-
if (this.polylinesList[type] && condition) {
|
|
592
|
-
var polylines = this.getPolylines(type, condition);
|
|
593
|
-
// Hide markers with the condition
|
|
594
|
-
this.map.togglePolylines(polylines, false);
|
|
595
|
-
// Keep markers that doesn't have the condition
|
|
596
|
-
this.polylinesList[type] = this.polylinesList[type].filter(function (polyline) { return !condition(polyline.object); });
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
599
|
-
if (this.polylinesList[type]) {
|
|
600
|
-
this.map.togglePolylines(this.polylinesList[type], false);
|
|
601
|
-
}
|
|
602
|
-
this.polylinesList[type] = [];
|
|
603
|
-
}
|
|
604
|
-
if (this.polylinesList[type].length === 0) {
|
|
605
|
-
delete this.polylinesList[type];
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
/**
|
|
609
|
-
* Remove all polylines from the map and from the internal list
|
|
610
|
-
*/
|
|
611
|
-
Map.prototype.removeAllPolylines = function () {
|
|
612
|
-
for (var type in this.polylinesList) {
|
|
613
|
-
if (this.polylinesList.hasOwnProperty(type)) {
|
|
614
|
-
this.removePolylines(type);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
/**
|
|
619
|
-
* Use this function to alter polyline options
|
|
620
|
-
* @param {string} type
|
|
621
|
-
* @param {InlogMaps.PolylineOptions} options
|
|
622
|
-
* @param {any} condition alter polyline with the condition [nullable]
|
|
623
|
-
*/
|
|
624
|
-
Map.prototype.alterPolylineOptions = function (type, options, condition) {
|
|
625
|
-
var polyline = this.getPolylines(type, condition);
|
|
626
|
-
if (polyline && polyline.length) {
|
|
627
|
-
this.map.alterPolylineOptions(polyline, options);
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
/**
|
|
631
|
-
* Use this functions to fit polylines bounds
|
|
632
|
-
* @param {string} type
|
|
633
|
-
* @param {any} condition [nullable]
|
|
634
|
-
*/
|
|
635
|
-
Map.prototype.fitBoundsPolylines = function (type, condition) {
|
|
636
|
-
var _this = this;
|
|
637
|
-
var polylines = this.getPolylines(type, condition)
|
|
638
|
-
.filter(function (polyline) { return _this.map.isPolylineOnMap(polyline); });
|
|
639
|
-
if (polylines && polylines.length) {
|
|
640
|
-
this.map.fitBoundsPolylines(polylines);
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
/**
|
|
644
|
-
* This functions returns if polyline exists
|
|
645
|
-
* @param {string} type
|
|
646
|
-
* @param {any} condition [nullable]
|
|
647
|
-
* @returns {boolean}
|
|
648
|
-
*/
|
|
649
|
-
Map.prototype.polylineExists = function (type, condition) {
|
|
650
|
-
var polylines = this.getPolylines(type, condition);
|
|
651
|
-
return polylines && polylines.length > 0;
|
|
652
|
-
};
|
|
653
|
-
/**
|
|
654
|
-
* Use this function to add more paths to a polyline
|
|
655
|
-
* @param {string} type
|
|
656
|
-
* @param {number[]} position
|
|
657
|
-
* @param {any} condition [nullable]
|
|
658
|
-
*/
|
|
659
|
-
Map.prototype.addPolylinePath = function (type, position, condition) {
|
|
660
|
-
var polyline = this.getPolylines(type, condition);
|
|
661
|
-
if (polyline && polyline.length) {
|
|
662
|
-
this.map.addPolylinePath(polyline, position);
|
|
663
|
-
}
|
|
664
|
-
else {
|
|
665
|
-
var options = new polyline_options_1.default();
|
|
666
|
-
options.addToMap = true;
|
|
667
|
-
this.drawPolyline(type, options, null);
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
/**
|
|
671
|
-
* Use this function to get the path of some polyline
|
|
672
|
-
* @param {string} type
|
|
673
|
-
* @param {any} condition
|
|
674
|
-
* @returns {number[]}
|
|
675
|
-
*/
|
|
676
|
-
Map.prototype.getPolylinePath = function (type, condition) {
|
|
677
|
-
var polyline = this.getPolylines(type, condition);
|
|
678
|
-
if (polyline && polyline.length) {
|
|
679
|
-
return this.map.getPolylinePath(polyline[0]);
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
/**
|
|
683
|
-
* Use this function to clear polyline selected from the currentMap
|
|
684
|
-
*/
|
|
685
|
-
Map.prototype.removePolylineHighlight = function () {
|
|
686
|
-
this.map.removePolylineHighlight();
|
|
687
|
-
};
|
|
688
|
-
/**
|
|
689
|
-
* Use this function to add listeners on polyline
|
|
690
|
-
* @param {string} type
|
|
691
|
-
* @param {InlogMaps.PolylineEventType} event
|
|
692
|
-
* @param {any} eventFunction
|
|
693
|
-
* @param {any} condition [nullable]
|
|
694
|
-
*/
|
|
695
|
-
Map.prototype.addPolylineEvent = function (type, event, eventFunction, condition) {
|
|
696
|
-
var polyline = this.getPolylines(type, condition);
|
|
697
|
-
this.map.addPolylineEvent(polyline, event, eventFunction);
|
|
698
|
-
};
|
|
699
|
-
/**
|
|
700
|
-
* Use this function to remove listeners of polyline
|
|
701
|
-
* @param {string} type
|
|
702
|
-
* @param {InlogMaps.PolylineEventType} event
|
|
703
|
-
* @param {any} condition [nullable]
|
|
704
|
-
*/
|
|
705
|
-
Map.prototype.removePolylineEvent = function (type, event, condition) {
|
|
706
|
-
var polyline = this.getPolylines(type, condition);
|
|
707
|
-
this.map.removePolylineEvent(polyline, event);
|
|
708
|
-
};
|
|
709
|
-
/**
|
|
710
|
-
* Use this function to set position of polyline highlight
|
|
711
|
-
* @param {string} type
|
|
712
|
-
* @param {number} initialIndex
|
|
713
|
-
* @param {any} condition [nullable]
|
|
714
|
-
*/
|
|
715
|
-
Map.prototype.setIndexPolylineHighlight = function (type, initialIndex, condition) {
|
|
716
|
-
var polylines = this.getPolylines(type, condition);
|
|
717
|
-
if (polylines && polylines.length) {
|
|
718
|
-
this.map.setIndexPolylineHighlight(polylines[0], initialIndex);
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
/**
|
|
722
|
-
* Use this function to get the object of a polyline
|
|
723
|
-
* @param {string} type
|
|
724
|
-
* @param {any} condition
|
|
725
|
-
* @returns {object}
|
|
726
|
-
*/
|
|
727
|
-
Map.prototype.getObjectPolyline = function (type, condition) {
|
|
728
|
-
var polylines = this.getPolylines(type, condition);
|
|
729
|
-
if (polylines && polylines.length) {
|
|
730
|
-
return this.map.getObjectPolyline(polylines[0]);
|
|
731
|
-
}
|
|
732
|
-
else {
|
|
733
|
-
return null;
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
/**
|
|
737
|
-
* Use this function to get the object of the polyline highligth
|
|
738
|
-
* @returns {object}
|
|
739
|
-
*/
|
|
740
|
-
Map.prototype.getObjectPolylineHighlight = function () {
|
|
741
|
-
return this.map.getObjectPolylineHighlight();
|
|
742
|
-
};
|
|
743
|
-
/**
|
|
744
|
-
* Use this function to add events on polyline highligtht / selected polyline
|
|
745
|
-
* @param {InlogMaps.PolylineEventType} event
|
|
746
|
-
* @param {any} eventFunction
|
|
747
|
-
*/
|
|
748
|
-
Map.prototype.addPolylineHighlightEvent = function (event, eventFunction) {
|
|
749
|
-
this.map.addPolylineHighlightEvent(event, eventFunction);
|
|
750
|
-
};
|
|
751
|
-
/**
|
|
752
|
-
* Use this function to get initial and final index of the polyline highlight
|
|
753
|
-
* @returns {number[]} returns an array with initial index and final index
|
|
754
|
-
*/
|
|
755
|
-
Map.prototype.getPolylineHighlightIndex = function () {
|
|
756
|
-
return this.map.getPolylineHighlightIndex();
|
|
757
|
-
};
|
|
758
|
-
/* Info Windows */
|
|
759
|
-
/**
|
|
760
|
-
* Use this function to draw popups on the currentMap
|
|
761
|
-
* @param {string} type
|
|
762
|
-
* @param {InlogMaps.PopupOptions} options
|
|
763
|
-
*/
|
|
764
|
-
Map.prototype.drawPopup = function (type, options) {
|
|
765
|
-
var marker = null;
|
|
766
|
-
if (options.marker) {
|
|
767
|
-
var markers = this.getMarkers(options.marker, options.conditionMarker);
|
|
768
|
-
marker = markers[0];
|
|
769
|
-
}
|
|
770
|
-
var popup;
|
|
771
|
-
if (this.infoWindowList[type]) {
|
|
772
|
-
popup = this.map.alterPopup(this.infoWindowList[type], options, marker);
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
popup = this.map.drawPopup(options, marker);
|
|
776
|
-
}
|
|
777
|
-
this.infoWindowList[type] = popup;
|
|
778
|
-
};
|
|
779
|
-
/**
|
|
780
|
-
* Use this function to alter popups
|
|
781
|
-
* @param {string} type
|
|
782
|
-
* @param {InlogMaps.PopupOptions} options
|
|
783
|
-
*/
|
|
784
|
-
Map.prototype.alterPopup = function (type, options) {
|
|
785
|
-
var popups = this.infoWindowList[type];
|
|
786
|
-
var markers;
|
|
787
|
-
if (options.marker) {
|
|
788
|
-
markers = this.getMarkers(options.marker, options.conditionMarker);
|
|
789
|
-
}
|
|
790
|
-
if (popups) {
|
|
791
|
-
this.map.alterPopupContent(popups, options, markers ? markers[0] : null);
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
/**
|
|
795
|
-
*
|
|
796
|
-
* @param {string} type
|
|
797
|
-
* @returns {object}
|
|
798
|
-
*/
|
|
799
|
-
Map.prototype.getObjectOpenPopup = function (type) {
|
|
800
|
-
return this.infoWindowList[type] ? this.infoWindowList[type].object : null;
|
|
801
|
-
};
|
|
802
|
-
/**
|
|
803
|
-
* Use this function to close popup by type
|
|
804
|
-
* @param {string} type
|
|
805
|
-
*/
|
|
806
|
-
Map.prototype.closePopup = function (type) {
|
|
807
|
-
if (this.infoWindowList[type]) {
|
|
808
|
-
this.map.closePopup(this.infoWindowList[type]);
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
/**
|
|
812
|
-
* Use this function to close all popups
|
|
813
|
-
* @param {string} type
|
|
814
|
-
*/
|
|
815
|
-
Map.prototype.closeAllPopups = function () {
|
|
816
|
-
for (var type in this.infoWindowList) {
|
|
817
|
-
if (this.infoWindowList.hasOwnProperty(type)) {
|
|
818
|
-
this.closePopup(type);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
/* Map */
|
|
823
|
-
/**
|
|
824
|
-
* Resize de map based on html size
|
|
825
|
-
*/
|
|
826
|
-
Map.prototype.resizeMap = function () {
|
|
827
|
-
this.map.resizeMap();
|
|
828
|
-
};
|
|
829
|
-
/**
|
|
830
|
-
* Use this function to add event clicks on the currentMap
|
|
831
|
-
* @param {InlogMaps.MapEventType} eventType
|
|
832
|
-
* @param eventFunction function callback
|
|
833
|
-
*/
|
|
834
|
-
Map.prototype.addEventMap = function (eventType, eventFunction) {
|
|
835
|
-
this.map.addEventMap(eventType, eventFunction);
|
|
836
|
-
};
|
|
837
|
-
/**
|
|
838
|
-
* Use this function to remove event clicks from the currentMap
|
|
839
|
-
* @param {InlogMaps.MapEventType} eventType
|
|
840
|
-
*/
|
|
841
|
-
Map.prototype.removeEventMap = function (eventType) {
|
|
842
|
-
this.map.removeEventMap(eventType);
|
|
843
|
-
};
|
|
844
|
-
/**
|
|
845
|
-
* Returns the current zoom level of the map view
|
|
846
|
-
* @returns {number}
|
|
847
|
-
*/
|
|
848
|
-
Map.prototype.getZoom = function () {
|
|
849
|
-
return this.map.getZoom();
|
|
850
|
-
};
|
|
851
|
-
/**
|
|
852
|
-
* Set the current zoom level of the map view
|
|
853
|
-
* @param {number} zoom
|
|
854
|
-
*/
|
|
855
|
-
Map.prototype.setZoom = function (zoom) {
|
|
856
|
-
this.map.setZoom(zoom);
|
|
857
|
-
};
|
|
858
|
-
/**
|
|
859
|
-
* Returns the center position of the map
|
|
860
|
-
* @returns {number[]}
|
|
861
|
-
*/
|
|
862
|
-
Map.prototype.getCenter = function () {
|
|
863
|
-
return this.map.getCenter();
|
|
864
|
-
};
|
|
865
|
-
/**
|
|
866
|
-
* Set the position center of the map
|
|
867
|
-
* @param {number[]} position
|
|
868
|
-
*/
|
|
869
|
-
Map.prototype.setCenter = function (position) {
|
|
870
|
-
this.map.setCenter(position);
|
|
871
|
-
};
|
|
872
|
-
/**
|
|
873
|
-
* Returns the coordinates from pixels
|
|
874
|
-
* @param {number} offsetx
|
|
875
|
-
* @param {number} offsety
|
|
876
|
-
* @returns {number[]}
|
|
877
|
-
*/
|
|
878
|
-
Map.prototype.pixelsToLatLng = function (offsetx, offsety) {
|
|
879
|
-
return this.map.pixelsToLatLng(offsetx, offsety);
|
|
880
|
-
};
|
|
881
|
-
/**
|
|
882
|
-
* Use this functions to fit bounds on elements with same type and condition
|
|
883
|
-
* @param {string} type
|
|
884
|
-
* @param {any} condition [nullable]
|
|
885
|
-
*/
|
|
886
|
-
Map.prototype.fitBoundsElements = function (type, condition) {
|
|
887
|
-
var _this = this;
|
|
888
|
-
var markers = this.getMarkers(type, condition)
|
|
889
|
-
.filter(function (marker) { return _this.map.isMarkerOnMap(marker); });
|
|
890
|
-
var circles = this.getCircles(type, condition)
|
|
891
|
-
.filter(function (circle) { return _this.map.isCircleOnMap(circle); });
|
|
892
|
-
var polygons = this.getPolygons(type, condition)
|
|
893
|
-
.filter(function (polygon) { return _this.map.isPolygonOnMap(polygon); });
|
|
894
|
-
var polylines = this.getPolylines(type, condition)
|
|
895
|
-
.filter(function (polyline) { return _this.map.isPolylineOnMap(polyline); });
|
|
896
|
-
this.map.fitBoundsElements(markers, circles, polygons, polylines);
|
|
897
|
-
};
|
|
898
|
-
/* Overlay */
|
|
899
|
-
/**
|
|
900
|
-
* Use this function to dray overlays on the current map
|
|
901
|
-
* @param {string} type
|
|
902
|
-
* @param {InlogMaps.OverlayOptions} options
|
|
903
|
-
*/
|
|
904
|
-
Map.prototype.drawOverlay = function (type, options) {
|
|
905
|
-
var overlay = null;
|
|
906
|
-
if (options.polygon) {
|
|
907
|
-
var polygons = this.getPolygons(options.polygon, options.conditionPolygon);
|
|
908
|
-
if (polygons && polygons.length) {
|
|
909
|
-
overlay = this.map.drawOverlay(options, polygons);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
else {
|
|
913
|
-
overlay = this.map.drawOverlay(options);
|
|
914
|
-
}
|
|
915
|
-
if (overlay != null) {
|
|
916
|
-
if (!this.overlayList[type]) {
|
|
917
|
-
this.overlayList[type] = [];
|
|
918
|
-
}
|
|
919
|
-
this.overlayList[type].push(overlay);
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
/**
|
|
923
|
-
* Use this function to show or hide overlay
|
|
924
|
-
* @param {boolean} show
|
|
925
|
-
* @param {string} type
|
|
926
|
-
* @param {any} condition [nullable]
|
|
927
|
-
*/
|
|
928
|
-
Map.prototype.toggleOverlay = function (show, type, condition) {
|
|
929
|
-
var overlays = this.getOverlays(type, condition);
|
|
930
|
-
if (overlays && overlays.length) {
|
|
931
|
-
this.map.toggleOverlay(overlays, show);
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
/**
|
|
935
|
-
* Remove overlays from the map and from internal list
|
|
936
|
-
* @param {string} type
|
|
937
|
-
* @param {any} condition remove overlays with the condition [nullable]
|
|
938
|
-
*/
|
|
939
|
-
Map.prototype.removeOverlays = function (type, condition) {
|
|
940
|
-
if (this.overlayList[type] && condition) {
|
|
941
|
-
var overlays = this.getOverlays(type, condition);
|
|
942
|
-
// Hide markers with the condition
|
|
943
|
-
this.map.toggleOverlay(overlays, false);
|
|
944
|
-
// Keep markers that doesn't have the condition
|
|
945
|
-
this.overlayList[type] = this.overlayList[type].filter(function (overlay) { return !condition(overlay.object); });
|
|
946
|
-
}
|
|
947
|
-
else {
|
|
948
|
-
if (this.overlayList[type]) {
|
|
949
|
-
this.map.toggleOverlay(this.overlayList[type], false);
|
|
950
|
-
}
|
|
951
|
-
this.overlayList[type] = [];
|
|
952
|
-
}
|
|
953
|
-
if (this.overlayList[type].length === 0) {
|
|
954
|
-
delete this.overlayList[type];
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
/**
|
|
958
|
-
* Remove all overlays from the map and from the internal list
|
|
959
|
-
*/
|
|
960
|
-
Map.prototype.removeAllOverlays = function () {
|
|
961
|
-
for (var type in this.overlayList) {
|
|
962
|
-
if (this.overlayList.hasOwnProperty(type)) {
|
|
963
|
-
this.removeOverlays(type);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
/* Private Methods */
|
|
968
|
-
Map.prototype.getMarkers = function (type, condition) {
|
|
969
|
-
var markers = this.markersList[type];
|
|
970
|
-
if (markers && markers.length) {
|
|
971
|
-
return condition ? markers.filter(function (marker) { return condition(marker.object); }) : markers;
|
|
972
|
-
}
|
|
973
|
-
else
|
|
974
|
-
return [];
|
|
975
|
-
};
|
|
976
|
-
Map.prototype.getPolygons = function (type, condition) {
|
|
977
|
-
var polygons = this.polygonsList[type];
|
|
978
|
-
if (polygons && polygons.length) {
|
|
979
|
-
return condition ? polygons.filter(function (polygon) { return condition(polygon.object); }) : polygons;
|
|
980
|
-
}
|
|
981
|
-
else
|
|
982
|
-
return [];
|
|
983
|
-
};
|
|
984
|
-
Map.prototype.getCircles = function (type, condition) {
|
|
985
|
-
var circles = this.circlesList[type];
|
|
986
|
-
if (circles && circles.length) {
|
|
987
|
-
return condition ? circles.filter(function (circle) { return condition(circle.object); }) : circles;
|
|
988
|
-
}
|
|
989
|
-
else
|
|
990
|
-
return [];
|
|
991
|
-
};
|
|
992
|
-
Map.prototype.getPolylines = function (type, condition) {
|
|
993
|
-
var polylines = this.polylinesList[type];
|
|
994
|
-
if (polylines && polylines.length) {
|
|
995
|
-
return condition ? polylines.filter(function (polyline) { return condition(polyline.object); }) : polylines;
|
|
996
|
-
}
|
|
997
|
-
else
|
|
998
|
-
return [];
|
|
999
|
-
};
|
|
1000
|
-
Map.prototype.getOverlays = function (type, condition) {
|
|
1001
|
-
var overlays = this.overlayList[type];
|
|
1002
|
-
if (overlays && overlays.length) {
|
|
1003
|
-
return condition ? overlays.filter(function (overlay) { return condition(overlay.object); }) : overlays;
|
|
1004
|
-
}
|
|
1005
|
-
else
|
|
1006
|
-
return [];
|
|
1007
|
-
};
|
|
1008
|
-
return Map;
|
|
1009
|
-
}());
|
|
1010
|
-
exports.default = Map;
|
|
1011
|
-
//# sourceMappingURL=map.js.map
|