@artstesh/maps 1.0.6 → 1.0.7
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/dist/bundles/maps-components-src-map.umd.js +306 -19
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +306 -19
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/helpers/index.js +2 -1
- package/dist/esm2015/map/helpers/marker-style.helper.js +5 -1
- package/dist/esm2015/map/helpers/text-style.helper.js +14 -0
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.js +60 -0
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.component.js +56 -0
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.manager.js +19 -0
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.settings.js +61 -0
- package/dist/esm2015/map/map-plate/layers/index.js +3 -1
- package/dist/esm2015/map/map-plate/map-plate.component.js +4 -3
- package/dist/esm2015/map/map.module.js +8 -3
- package/dist/esm2015/map/messages/commands/add-layer.command.js +1 -1
- package/dist/esm2015/map/messages/commands/fit-to-features.command.js +13 -0
- package/dist/esm2015/map/messages/events/map-click.event.js +3 -2
- package/dist/esm2015/map/models/i-identified.js +2 -0
- package/dist/esm2015/map/models/map.constants.js +4 -0
- package/dist/esm2015/map/models/marker-model.js +3 -2
- package/dist/esm2015/map/services/map-click.service.js +7 -3
- package/dist/esm2015/map/services/map-feature.service.js +39 -0
- package/dist/esm2015/map/services/map-management.service.js +7 -4
- package/dist/esm2015/map/services/message-registrator.service.js +9 -6
- package/dist/esm2015/src/map/helpers/index.js +2 -1
- package/dist/esm2015/src/map/helpers/marker-style.helper.js +5 -1
- package/dist/esm2015/src/map/helpers/text-style.helper.js +14 -0
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.js +60 -0
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.component.js +56 -0
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.js +19 -0
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.js +61 -0
- package/dist/esm2015/src/map/map-plate/layers/index.js +3 -1
- package/dist/esm2015/src/map/map-plate/map-plate.component.js +4 -3
- package/dist/esm2015/src/map/map.module.js +8 -3
- package/dist/esm2015/src/map/messages/commands/add-layer.command.js +1 -1
- package/dist/esm2015/src/map/messages/commands/fit-to-features.command.js +13 -0
- package/dist/esm2015/src/map/messages/events/map-click.event.js +3 -2
- package/dist/esm2015/src/map/models/i-identified.js +2 -0
- package/dist/esm2015/src/map/models/map.constants.js +4 -0
- package/dist/esm2015/src/map/models/marker-model.js +3 -2
- package/dist/esm2015/src/map/services/map-click.service.js +7 -3
- package/dist/esm2015/src/map/services/map-feature.service.js +39 -0
- package/dist/esm2015/src/map/services/map-management.service.js +7 -4
- package/dist/esm2015/src/map/services/message-registrator.service.js +9 -6
- package/dist/fesm2015/maps-components-src-map.js +273 -18
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +273 -18
- package/dist/fesm2015/maps-components.js.map +1 -1
- package/dist/map/helpers/index.d.ts +1 -0
- package/dist/map/helpers/marker-style.helper.d.ts +2 -0
- package/dist/map/helpers/text-style.helper.d.ts +4 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +21 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +11 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +20 -0
- package/dist/map/map-plate/layers/index.d.ts +2 -0
- package/dist/map/map.module.d.ts +3 -2
- package/dist/map/messages/commands/add-layer.command.d.ts +3 -2
- package/dist/map/messages/commands/fit-to-features.command.d.ts +10 -0
- package/dist/map/messages/events/map-click.event.d.ts +10 -2
- package/dist/map/models/i-identified.d.ts +3 -0
- package/dist/map/models/map.constants.d.ts +3 -0
- package/dist/map/services/map-feature.service.d.ts +14 -0
- package/dist/map/services/message-registrator.service.d.ts +2 -1
- package/dist/src/map/helpers/index.d.ts +1 -0
- package/dist/src/map/helpers/marker-style.helper.d.ts +2 -0
- package/dist/src/map/helpers/text-style.helper.d.ts +4 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +21 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +11 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +20 -0
- package/dist/src/map/map-plate/layers/index.d.ts +2 -0
- package/dist/src/map/map.module.d.ts +3 -2
- package/dist/src/map/messages/commands/add-layer.command.d.ts +3 -2
- package/dist/src/map/messages/commands/fit-to-features.command.d.ts +10 -0
- package/dist/src/map/messages/events/map-click.event.d.ts +10 -2
- package/dist/src/map/models/i-identified.d.ts +3 -0
- package/dist/src/map/models/map.constants.d.ts +3 -0
- package/dist/src/map/services/map-feature.service.d.ts +14 -0
- package/dist/src/map/services/message-registrator.service.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/proj'), require('rxjs'), require('@artstesh/postboy'), require('ol/Map'), require('ol/View'), require('ol/layer/Tile'), require('ol/source/OSM'), require('rxjs/operators'), require('ol/source'), require('ol/layer'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('maps-components', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/proj', 'rxjs', '@artstesh/postboy', 'ol/Map', 'ol/View', 'ol/layer/Tile', 'ol/source/OSM', 'rxjs/operators', 'ol/source', 'ol/layer', 'ol/Overlay', 'ol/style/Style', 'ol/style'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["maps-components"] = {}, global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.proj, global.rxjs, global.postboy, global.Map, global.View, global.TileLayer, global.OSM, global.rxjs.operators, global.source, global.layer, global.Overlay, global.Style, global.style));
|
|
5
|
-
})(this, (function (exports, i0, i5, ol, geom, format, extent, proj, rxjs, postboy, Map, View, TileLayer, OSM, operators, source, layer, Overlay, Style, style) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/proj'), require('rxjs'), require('@artstesh/postboy'), require('ol/Map'), require('ol/View'), require('ol/layer/Tile'), require('ol/source/OSM'), require('rxjs/operators'), require('ol/source'), require('ol/layer'), require('ol/Overlay'), require('ol/loadingstrategy'), require('ol/geom/Polygon'), require('ol/source/Cluster'), require('ol/style/Style'), require('ol/style')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('maps-components', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/proj', 'rxjs', '@artstesh/postboy', 'ol/Map', 'ol/View', 'ol/layer/Tile', 'ol/source/OSM', 'rxjs/operators', 'ol/source', 'ol/layer', 'ol/Overlay', 'ol/loadingstrategy', 'ol/geom/Polygon', 'ol/source/Cluster', 'ol/style/Style', 'ol/style'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["maps-components"] = {}, global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.proj, global.rxjs, global.postboy, global.Map, global.View, global.TileLayer, global.OSM, global.rxjs.operators, global.source, global.layer, global.Overlay, global.loadingstrategy, global.Polygon, global.Cluster, global.Style, global.style));
|
|
5
|
+
})(this, (function (exports, i0, i5, ol, geom, format, extent, proj, rxjs, postboy, Map, View, TileLayer, OSM, operators, source, layer, Overlay, loadingstrategy, Polygon, Cluster, Style, style) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
var TileLayer__default = /*#__PURE__*/_interopDefaultLegacy(TileLayer);
|
|
32
32
|
var OSM__default = /*#__PURE__*/_interopDefaultLegacy(OSM);
|
|
33
33
|
var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
|
|
34
|
+
var Cluster__default = /*#__PURE__*/_interopDefaultLegacy(Cluster);
|
|
34
35
|
var Style__default = /*#__PURE__*/_interopDefaultLegacy(Style);
|
|
35
36
|
|
|
36
37
|
var DestructibleComponent = /** @class */ (function () {
|
|
@@ -608,6 +609,13 @@
|
|
|
608
609
|
}());
|
|
609
610
|
IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
610
611
|
|
|
612
|
+
var MapConstants = /** @class */ (function () {
|
|
613
|
+
function MapConstants() {
|
|
614
|
+
}
|
|
615
|
+
return MapConstants;
|
|
616
|
+
}());
|
|
617
|
+
MapConstants.FeatureInfo = 'f-info';
|
|
618
|
+
|
|
611
619
|
var MarkerModel = /** @class */ (function () {
|
|
612
620
|
function MarkerModel(lat, lng, id, info) {
|
|
613
621
|
this.lat = lat;
|
|
@@ -627,7 +635,7 @@
|
|
|
627
635
|
var feature = new ol.Feature(new geom.Point([this.lng, this.lat]));
|
|
628
636
|
feature.setId(this.id);
|
|
629
637
|
if (this.info)
|
|
630
|
-
feature.set(
|
|
638
|
+
feature.set(MapConstants.FeatureInfo, this.info);
|
|
631
639
|
return feature;
|
|
632
640
|
};
|
|
633
641
|
return MarkerModel;
|
|
@@ -702,10 +710,11 @@
|
|
|
702
710
|
|
|
703
711
|
var MapClickEvent = /** @class */ (function (_super) {
|
|
704
712
|
__extends(MapClickEvent, _super);
|
|
705
|
-
function MapClickEvent(coordinates, entities) {
|
|
713
|
+
function MapClickEvent(coordinates, entities, features) {
|
|
706
714
|
var _this = _super.call(this) || this;
|
|
707
715
|
_this.coordinates = coordinates;
|
|
708
716
|
_this.entities = entities;
|
|
717
|
+
_this.features = features;
|
|
709
718
|
return _this;
|
|
710
719
|
}
|
|
711
720
|
Object.defineProperty(MapClickEvent.prototype, "id", {
|
|
@@ -828,6 +837,26 @@
|
|
|
828
837
|
}(GenericMessage));
|
|
829
838
|
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
830
839
|
|
|
840
|
+
var FitToFeaturesCommand = /** @class */ (function (_super) {
|
|
841
|
+
__extends(FitToFeaturesCommand, _super);
|
|
842
|
+
function FitToFeaturesCommand(features, zoomAfter) {
|
|
843
|
+
if (zoomAfter === void 0) { zoomAfter = 0; }
|
|
844
|
+
var _this = _super.call(this) || this;
|
|
845
|
+
_this.features = features;
|
|
846
|
+
_this.zoomAfter = zoomAfter;
|
|
847
|
+
return _this;
|
|
848
|
+
}
|
|
849
|
+
Object.defineProperty(FitToFeaturesCommand.prototype, "id", {
|
|
850
|
+
get: function () {
|
|
851
|
+
return FitToFeaturesCommand.ID;
|
|
852
|
+
},
|
|
853
|
+
enumerable: false,
|
|
854
|
+
configurable: true
|
|
855
|
+
});
|
|
856
|
+
return FitToFeaturesCommand;
|
|
857
|
+
}(GenericMessage));
|
|
858
|
+
FitToFeaturesCommand.ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
859
|
+
|
|
831
860
|
var MapPostboyService = /** @class */ (function (_super) {
|
|
832
861
|
__extends(MapPostboyService, _super);
|
|
833
862
|
function MapPostboyService() {
|
|
@@ -890,11 +919,14 @@
|
|
|
890
919
|
MapManagementService.prototype.observePlaceFeatures = function () {
|
|
891
920
|
var _this = this;
|
|
892
921
|
this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe(function (c) {
|
|
893
|
-
var _a, _b
|
|
922
|
+
var _a, _b;
|
|
894
923
|
if (!_this.layers[c.layer])
|
|
895
924
|
return;
|
|
896
|
-
|
|
897
|
-
(
|
|
925
|
+
var source = (_a = _this.layers[c.layer]) === null || _a === void 0 ? void 0 : _a.getSource();
|
|
926
|
+
if (!!source['getSource'])
|
|
927
|
+
source = (_b = source) === null || _b === void 0 ? void 0 : _b.getSource();
|
|
928
|
+
source === null || source === void 0 ? void 0 : source.clear();
|
|
929
|
+
source === null || source === void 0 ? void 0 : source.addFeatures(c.features);
|
|
898
930
|
});
|
|
899
931
|
};
|
|
900
932
|
MapManagementService.prototype.observeRemoveLayer = function () {
|
|
@@ -930,6 +962,42 @@
|
|
|
930
962
|
type: i0.Injectable
|
|
931
963
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
932
964
|
|
|
965
|
+
var MapFeatureService = /** @class */ (function () {
|
|
966
|
+
function MapFeatureService(postboy) {
|
|
967
|
+
this.postboy = postboy;
|
|
968
|
+
}
|
|
969
|
+
MapFeatureService.prototype.up = function () {
|
|
970
|
+
this.observeMapRender();
|
|
971
|
+
this.observeFitToFeatures();
|
|
972
|
+
};
|
|
973
|
+
MapFeatureService.prototype.observeMapRender = function () {
|
|
974
|
+
var _this = this;
|
|
975
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (m) {
|
|
976
|
+
_this.map = m.map;
|
|
977
|
+
});
|
|
978
|
+
};
|
|
979
|
+
MapFeatureService.prototype.observeFitToFeatures = function () {
|
|
980
|
+
var _this = this;
|
|
981
|
+
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe(function (m) {
|
|
982
|
+
_this.fitToGeometries(m.features.map(function (f) { return f.getGeometry(); }), m.zoomAfter);
|
|
983
|
+
});
|
|
984
|
+
};
|
|
985
|
+
MapFeatureService.prototype.fitToGeometries = function (geometries, zoomAfter) {
|
|
986
|
+
if (!(geometries === null || geometries === void 0 ? void 0 : geometries.length) || !this.map)
|
|
987
|
+
return;
|
|
988
|
+
var extent$1 = extent.createEmpty();
|
|
989
|
+
geometries.forEach(function (g) { return extent.extend(extent$1, g.getExtent()); });
|
|
990
|
+
this.map.getView().fit(extent$1);
|
|
991
|
+
this.map.getView().setZoom(this.map.getView().getZoom() + zoomAfter);
|
|
992
|
+
};
|
|
993
|
+
return MapFeatureService;
|
|
994
|
+
}());
|
|
995
|
+
MapFeatureService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapFeatureService, deps: [{ token: MapPostboyService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
996
|
+
MapFeatureService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapFeatureService });
|
|
997
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapFeatureService, decorators: [{
|
|
998
|
+
type: i0.Injectable
|
|
999
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
1000
|
+
|
|
933
1001
|
var MapClickService = /** @class */ (function () {
|
|
934
1002
|
function MapClickService(postboy) {
|
|
935
1003
|
this.postboy = postboy;
|
|
@@ -950,7 +1018,7 @@
|
|
|
950
1018
|
MapClickService.prototype.onClick = function (ev) {
|
|
951
1019
|
var _this = this;
|
|
952
1020
|
var _a;
|
|
953
|
-
var model = new MapClickEvent(ev.coordinate, {});
|
|
1021
|
+
var model = new MapClickEvent(ev.coordinate, {}, {});
|
|
954
1022
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.forEachFeatureAtPixel(ev.pixel, function (f, l) {
|
|
955
1023
|
_this.getFeatureCollectionWithInner([f])
|
|
956
1024
|
.filter(function (f) { return f.getId() != null; })
|
|
@@ -958,7 +1026,10 @@
|
|
|
958
1026
|
var layerName = l.get('name');
|
|
959
1027
|
if (!model.entities[layerName])
|
|
960
1028
|
model.entities[layerName] = [];
|
|
961
|
-
model.
|
|
1029
|
+
if (!model.features[layerName])
|
|
1030
|
+
model.features[layerName] = [];
|
|
1031
|
+
model.entities[layerName].push(Object.assign({ id: fs.getId() }, fs.get(MapConstants.FeatureInfo)));
|
|
1032
|
+
model.features[layerName].push(fs);
|
|
962
1033
|
});
|
|
963
1034
|
});
|
|
964
1035
|
return model;
|
|
@@ -981,9 +1052,9 @@
|
|
|
981
1052
|
|
|
982
1053
|
var MessageRegistratorService = /** @class */ (function (_super) {
|
|
983
1054
|
__extends(MessageRegistratorService, _super);
|
|
984
|
-
function MessageRegistratorService(service, management, state, interaction) {
|
|
1055
|
+
function MessageRegistratorService(service, management, state, feature, interaction) {
|
|
985
1056
|
var _this = _super.call(this, service) || this;
|
|
986
|
-
_this.registerServices([management, state, interaction]);
|
|
1057
|
+
_this.registerServices([management, state, interaction, feature]);
|
|
987
1058
|
return _this;
|
|
988
1059
|
}
|
|
989
1060
|
MessageRegistratorService.prototype._up = function () {
|
|
@@ -995,14 +1066,15 @@
|
|
|
995
1066
|
this.registerSubject(RemoveTileCommand.ID);
|
|
996
1067
|
this.registerSubject(MapClickEvent.ID);
|
|
997
1068
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
1069
|
+
this.registerSubject(FitToFeaturesCommand.ID);
|
|
998
1070
|
};
|
|
999
1071
|
return MessageRegistratorService;
|
|
1000
1072
|
}(postboy.PostboyAbstractRegistrator));
|
|
1001
|
-
MessageRegistratorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapClickService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1073
|
+
MessageRegistratorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1002
1074
|
MessageRegistratorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService });
|
|
1003
1075
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService, decorators: [{
|
|
1004
1076
|
type: i0.Injectable
|
|
1005
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapClickService }]; } });
|
|
1077
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }]; } });
|
|
1006
1078
|
|
|
1007
1079
|
var MapPlateFactory = /** @class */ (function () {
|
|
1008
1080
|
function MapPlateFactory() {
|
|
@@ -1146,7 +1218,7 @@
|
|
|
1146
1218
|
return MapPlateComponent;
|
|
1147
1219
|
}(DestructibleComponent));
|
|
1148
1220
|
MapPlateComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateComponent, deps: [{ token: i0__namespace.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1149
|
-
MapPlateComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService], usesInheritance: true, ngImport: i0__namespace, template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1221
|
+
MapPlateComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], usesInheritance: true, ngImport: i0__namespace, template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1150
1222
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateComponent, decorators: [{
|
|
1151
1223
|
type: i0.Component,
|
|
1152
1224
|
args: [{
|
|
@@ -1154,7 +1226,7 @@
|
|
|
1154
1226
|
templateUrl: './map-plate.component.html',
|
|
1155
1227
|
styleUrls: ['./map-plate.component.scss'],
|
|
1156
1228
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1157
|
-
providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService],
|
|
1229
|
+
providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService],
|
|
1158
1230
|
}]
|
|
1159
1231
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1160
1232
|
type: i0.Input
|
|
@@ -1647,6 +1719,194 @@
|
|
|
1647
1719
|
type: i0.Input
|
|
1648
1720
|
}] } });
|
|
1649
1721
|
|
|
1722
|
+
var ClusterLayerSettings = /** @class */ (function () {
|
|
1723
|
+
function ClusterLayerSettings() {
|
|
1724
|
+
this.name = IdGenerator.get();
|
|
1725
|
+
this.zIndex = 1;
|
|
1726
|
+
this.maxZoom = 19;
|
|
1727
|
+
this.minZoom = 0;
|
|
1728
|
+
this.distance = 20;
|
|
1729
|
+
this.bbox = false;
|
|
1730
|
+
}
|
|
1731
|
+
ClusterLayerSettings.copy = function (model) {
|
|
1732
|
+
var result = new ClusterLayerSettings();
|
|
1733
|
+
result.name = model.name;
|
|
1734
|
+
result.maxZoom = model.maxZoom;
|
|
1735
|
+
result.minZoom = model.minZoom;
|
|
1736
|
+
result.zIndex = model.zIndex;
|
|
1737
|
+
result.bbox = model.bbox;
|
|
1738
|
+
result.distance = model.distance;
|
|
1739
|
+
result.style = model.style;
|
|
1740
|
+
return result;
|
|
1741
|
+
};
|
|
1742
|
+
ClusterLayerSettings.prototype.setZIndex = function (zIndex) {
|
|
1743
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex: zIndex }));
|
|
1744
|
+
};
|
|
1745
|
+
ClusterLayerSettings.prototype.setDistance = function (distance) {
|
|
1746
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { distance: distance }));
|
|
1747
|
+
};
|
|
1748
|
+
ClusterLayerSettings.prototype.setName = function (name) {
|
|
1749
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { name: name }));
|
|
1750
|
+
};
|
|
1751
|
+
ClusterLayerSettings.prototype.setMaxZoom = function (maxZoom) {
|
|
1752
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
|
|
1753
|
+
};
|
|
1754
|
+
ClusterLayerSettings.prototype.setMinZoom = function (minZoom) {
|
|
1755
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
|
|
1756
|
+
};
|
|
1757
|
+
ClusterLayerSettings.prototype.setBbox = function (bbox) {
|
|
1758
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox: bbox }));
|
|
1759
|
+
};
|
|
1760
|
+
ClusterLayerSettings.prototype.setStyle = function (style) {
|
|
1761
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { style: style }));
|
|
1762
|
+
};
|
|
1763
|
+
ClusterLayerSettings.prototype.isSame = function (model) {
|
|
1764
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1765
|
+
return false;
|
|
1766
|
+
if (this.minZoom !== model.minZoom)
|
|
1767
|
+
return false;
|
|
1768
|
+
if (this.zIndex !== model.zIndex)
|
|
1769
|
+
return false;
|
|
1770
|
+
if (this.name !== model.name)
|
|
1771
|
+
return false;
|
|
1772
|
+
if (this.distance !== model.distance)
|
|
1773
|
+
return false;
|
|
1774
|
+
if (this.bbox !== model.bbox)
|
|
1775
|
+
return false;
|
|
1776
|
+
if (this.style !== model.style)
|
|
1777
|
+
return false;
|
|
1778
|
+
return true;
|
|
1779
|
+
};
|
|
1780
|
+
return ClusterLayerSettings;
|
|
1781
|
+
}());
|
|
1782
|
+
|
|
1783
|
+
var ClusterLayerManager = /** @class */ (function () {
|
|
1784
|
+
function ClusterLayerManager(settings, layer, postboy) {
|
|
1785
|
+
this.settings = settings;
|
|
1786
|
+
this.layer = layer;
|
|
1787
|
+
this.postboy = postboy;
|
|
1788
|
+
this.observeClick();
|
|
1789
|
+
}
|
|
1790
|
+
ClusterLayerManager.prototype.observeClick = function () {
|
|
1791
|
+
var _this = this;
|
|
1792
|
+
this.postboy.subscribe(MapClickEvent.ID).subscribe(function (m) {
|
|
1793
|
+
var _a, _b;
|
|
1794
|
+
if (((_b = (_a = m.features[_this.settings.name]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1) {
|
|
1795
|
+
_this.postboy.fire(new FitToFeaturesCommand(m.features[_this.settings.name], -1));
|
|
1796
|
+
}
|
|
1797
|
+
});
|
|
1798
|
+
};
|
|
1799
|
+
return ClusterLayerManager;
|
|
1800
|
+
}());
|
|
1801
|
+
|
|
1802
|
+
var ClusterLayerFactory = /** @class */ (function () {
|
|
1803
|
+
function ClusterLayerFactory() {
|
|
1804
|
+
}
|
|
1805
|
+
ClusterLayerFactory.prototype.build = function (settings, postboy) {
|
|
1806
|
+
var source$1 = new source.Vector({
|
|
1807
|
+
strategy: settings.bbox ? loadingstrategy.bbox : undefined,
|
|
1808
|
+
});
|
|
1809
|
+
var cluster = new Cluster__default["default"]({
|
|
1810
|
+
distance: settings.distance,
|
|
1811
|
+
source: source$1,
|
|
1812
|
+
geometryFunction: function (feature) {
|
|
1813
|
+
var _a, _b;
|
|
1814
|
+
var geom = feature.getGeometry();
|
|
1815
|
+
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Point') {
|
|
1816
|
+
return geom;
|
|
1817
|
+
}
|
|
1818
|
+
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Polygon') {
|
|
1819
|
+
return (_a = geom) === null || _a === void 0 ? void 0 : _a.getInteriorPoint();
|
|
1820
|
+
}
|
|
1821
|
+
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'MultiPolygon') {
|
|
1822
|
+
return (_b = Polygon.fromExtent(geom.getExtent())) === null || _b === void 0 ? void 0 : _b.getInteriorPoint();
|
|
1823
|
+
}
|
|
1824
|
+
return undefined;
|
|
1825
|
+
},
|
|
1826
|
+
});
|
|
1827
|
+
var layer$1 = new layer.Vector({
|
|
1828
|
+
source: cluster,
|
|
1829
|
+
maxZoom: settings.maxZoom || undefined,
|
|
1830
|
+
minZoom: settings.minZoom || undefined,
|
|
1831
|
+
zIndex: settings.zIndex || 0,
|
|
1832
|
+
});
|
|
1833
|
+
layer$1.setStyle(this.styleFunc(settings));
|
|
1834
|
+
layer$1.set('name', settings.name);
|
|
1835
|
+
return new ClusterLayerManager(settings, layer$1, postboy);
|
|
1836
|
+
};
|
|
1837
|
+
ClusterLayerFactory.prototype.styleFunc = function (settings) {
|
|
1838
|
+
return function (feature) {
|
|
1839
|
+
var features = feature.get('features');
|
|
1840
|
+
if (!settings.style)
|
|
1841
|
+
return undefined;
|
|
1842
|
+
return settings.style(features.map(function (f) { return (Object.assign({ id: f.getId() }, f.get(MapConstants.FeatureInfo))); }));
|
|
1843
|
+
};
|
|
1844
|
+
};
|
|
1845
|
+
return ClusterLayerFactory;
|
|
1846
|
+
}());
|
|
1847
|
+
ClusterLayerFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1848
|
+
ClusterLayerFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1849
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, decorators: [{
|
|
1850
|
+
type: i0.Injectable,
|
|
1851
|
+
args: [{
|
|
1852
|
+
providedIn: 'root',
|
|
1853
|
+
}]
|
|
1854
|
+
}] });
|
|
1855
|
+
|
|
1856
|
+
var ClusterLayerComponent = /** @class */ (function (_super) {
|
|
1857
|
+
__extends(ClusterLayerComponent, _super);
|
|
1858
|
+
function ClusterLayerComponent(postboy, factory) {
|
|
1859
|
+
var _this = _super.call(this) || this;
|
|
1860
|
+
_this.postboy = postboy;
|
|
1861
|
+
_this.factory = factory;
|
|
1862
|
+
_this.manager = null;
|
|
1863
|
+
_this._settings = new ClusterLayerSettings();
|
|
1864
|
+
_this.onDestroy = function () { return _this.removeLayer(); };
|
|
1865
|
+
return _this;
|
|
1866
|
+
}
|
|
1867
|
+
ClusterLayerComponent.prototype.ngOnInit = function () {
|
|
1868
|
+
var _this = this;
|
|
1869
|
+
this.postboy
|
|
1870
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1871
|
+
.pipe(operators.filter(function (m) { return !!m; }), operators.first())
|
|
1872
|
+
.subscribe(function (m) { return _this.initLayer(); });
|
|
1873
|
+
};
|
|
1874
|
+
Object.defineProperty(ClusterLayerComponent.prototype, "settings", {
|
|
1875
|
+
set: function (value) {
|
|
1876
|
+
if (!value || this._settings.isSame(value))
|
|
1877
|
+
return;
|
|
1878
|
+
this._settings = value;
|
|
1879
|
+
this.initLayer();
|
|
1880
|
+
},
|
|
1881
|
+
enumerable: false,
|
|
1882
|
+
configurable: true
|
|
1883
|
+
});
|
|
1884
|
+
ClusterLayerComponent.prototype.initLayer = function () {
|
|
1885
|
+
this.removeLayer();
|
|
1886
|
+
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1887
|
+
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1888
|
+
};
|
|
1889
|
+
ClusterLayerComponent.prototype.removeLayer = function () {
|
|
1890
|
+
var _a;
|
|
1891
|
+
if ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.layer)
|
|
1892
|
+
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1893
|
+
};
|
|
1894
|
+
return ClusterLayerComponent;
|
|
1895
|
+
}(DestructibleComponent));
|
|
1896
|
+
ClusterLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1897
|
+
ClusterLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1898
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerComponent, decorators: [{
|
|
1899
|
+
type: i0.Component,
|
|
1900
|
+
args: [{
|
|
1901
|
+
selector: 'lib-cluster-layer',
|
|
1902
|
+
template: '',
|
|
1903
|
+
styleUrls: [],
|
|
1904
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1905
|
+
}]
|
|
1906
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
|
|
1907
|
+
type: i0.Input
|
|
1908
|
+
}] } });
|
|
1909
|
+
|
|
1650
1910
|
var MapModule = /** @class */ (function () {
|
|
1651
1911
|
function MapModule() {
|
|
1652
1912
|
}
|
|
@@ -1660,12 +1920,14 @@
|
|
|
1660
1920
|
FeatureLayerComponent,
|
|
1661
1921
|
MarkersComponent,
|
|
1662
1922
|
TooltipComponent,
|
|
1663
|
-
PolygonsComponent
|
|
1923
|
+
PolygonsComponent,
|
|
1924
|
+
ClusterLayerComponent], imports: [i5.CommonModule], exports: [MapPlateComponent,
|
|
1664
1925
|
FeatureLayerComponent,
|
|
1665
1926
|
MarkersComponent,
|
|
1666
1927
|
TileLayerComponent,
|
|
1667
1928
|
TooltipComponent,
|
|
1668
|
-
PolygonsComponent
|
|
1929
|
+
PolygonsComponent,
|
|
1930
|
+
ClusterLayerComponent] });
|
|
1669
1931
|
MapModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, imports: [[i5.CommonModule]] });
|
|
1670
1932
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, decorators: [{
|
|
1671
1933
|
type: i0.NgModule,
|
|
@@ -1680,6 +1942,7 @@
|
|
|
1680
1942
|
MarkersComponent,
|
|
1681
1943
|
TooltipComponent,
|
|
1682
1944
|
PolygonsComponent,
|
|
1945
|
+
ClusterLayerComponent,
|
|
1683
1946
|
],
|
|
1684
1947
|
exports: [
|
|
1685
1948
|
MapPlateComponent,
|
|
@@ -1688,6 +1951,7 @@
|
|
|
1688
1951
|
TileLayerComponent,
|
|
1689
1952
|
TooltipComponent,
|
|
1690
1953
|
PolygonsComponent,
|
|
1954
|
+
ClusterLayerComponent,
|
|
1691
1955
|
],
|
|
1692
1956
|
}]
|
|
1693
1957
|
}] });
|
|
@@ -1718,6 +1982,10 @@
|
|
|
1718
1982
|
}),
|
|
1719
1983
|
});
|
|
1720
1984
|
};
|
|
1985
|
+
MarkerStyleHelper.withText = function (style, text) {
|
|
1986
|
+
style.setText(text);
|
|
1987
|
+
return style;
|
|
1988
|
+
};
|
|
1721
1989
|
return MarkerStyleHelper;
|
|
1722
1990
|
}());
|
|
1723
1991
|
|
|
@@ -1739,6 +2007,22 @@
|
|
|
1739
2007
|
return PolygonStyleHelper;
|
|
1740
2008
|
}());
|
|
1741
2009
|
|
|
2010
|
+
var TextStyleHelper = /** @class */ (function () {
|
|
2011
|
+
function TextStyleHelper() {
|
|
2012
|
+
}
|
|
2013
|
+
TextStyleHelper.get = function (text, font, color) {
|
|
2014
|
+
return new style.Text({
|
|
2015
|
+
text: text,
|
|
2016
|
+
font: font,
|
|
2017
|
+
textAlign: 'center',
|
|
2018
|
+
fill: new style.Fill({
|
|
2019
|
+
color: color,
|
|
2020
|
+
}),
|
|
2021
|
+
});
|
|
2022
|
+
};
|
|
2023
|
+
return TextStyleHelper;
|
|
2024
|
+
}());
|
|
2025
|
+
|
|
1742
2026
|
/*
|
|
1743
2027
|
* Public API Surface of maps
|
|
1744
2028
|
*/
|
|
@@ -1753,6 +2037,8 @@
|
|
|
1753
2037
|
|
|
1754
2038
|
exports.CallbackMessage = CallbackMessage;
|
|
1755
2039
|
exports.CloseTooltipCommand = CloseTooltipCommand;
|
|
2040
|
+
exports.ClusterLayerComponent = ClusterLayerComponent;
|
|
2041
|
+
exports.ClusterLayerSettings = ClusterLayerSettings;
|
|
1756
2042
|
exports.FeatureLayerComponent = FeatureLayerComponent;
|
|
1757
2043
|
exports.FeatureLayerSettings = FeatureLayerSettings;
|
|
1758
2044
|
exports.GenericMessage = GenericMessage;
|
|
@@ -1771,6 +2057,7 @@
|
|
|
1771
2057
|
exports.PolygonModel = PolygonModel;
|
|
1772
2058
|
exports.PolygonStyleHelper = PolygonStyleHelper;
|
|
1773
2059
|
exports.PolygonsComponent = PolygonsComponent;
|
|
2060
|
+
exports.TextStyleHelper = TextStyleHelper;
|
|
1774
2061
|
exports.TileLayerComponent = TileLayerComponent;
|
|
1775
2062
|
exports.TileLayerSettings = TileLayerSettings;
|
|
1776
2063
|
exports.TooltipComponent = TooltipComponent;
|