@artstesh/maps 1.0.0 → 1.0.2
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 +182 -65
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +182 -65
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/map-plate/layers/tile-layer/tile-layer.component.js +40 -6
- package/dist/esm2015/map/map-plate/layers/tile-layer/tile-layer.factory.js +50 -0
- package/dist/esm2015/map/map-plate/layers/tile-layer/tile-layer.settings.js +14 -8
- package/dist/esm2015/map/map.module.js +3 -3
- package/dist/esm2015/map/messages/commands/add-tile.command.js +12 -0
- package/dist/esm2015/map/messages/commands/remove-tile.command.js +12 -0
- package/dist/esm2015/map/services/map-management.service.js +19 -9
- package/dist/esm2015/map/services/message-registrator.service.js +5 -3
- package/dist/esm2015/src/map/map-plate/layers/tile-layer/tile-layer.component.js +40 -6
- package/dist/esm2015/src/map/map-plate/layers/tile-layer/tile-layer.factory.js +50 -0
- package/dist/esm2015/src/map/map-plate/layers/tile-layer/tile-layer.settings.js +14 -8
- package/dist/esm2015/src/map/map.module.js +3 -3
- package/dist/esm2015/src/map/messages/commands/add-tile.command.js +12 -0
- package/dist/esm2015/src/map/messages/commands/remove-tile.command.js +12 -0
- package/dist/esm2015/src/map/services/map-management.service.js +19 -9
- package/dist/esm2015/src/map/services/message-registrator.service.js +5 -3
- package/dist/fesm2015/maps-components-src-map.js +159 -60
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +159 -60
- package/dist/fesm2015/maps-components.js.map +1 -1
- package/dist/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +14 -5
- package/dist/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +11 -0
- package/dist/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +3 -2
- package/dist/map/map.module.d.ts +1 -1
- package/dist/map/messages/commands/add-tile.command.d.ts +9 -0
- package/dist/map/messages/commands/remove-tile.command.d.ts +9 -0
- package/dist/map/services/map-management.service.d.ts +2 -1
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +14 -5
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +11 -0
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +3 -2
- package/dist/src/map/map.module.d.ts +1 -1
- package/dist/src/map/messages/commands/add-tile.command.d.ts +9 -0
- package/dist/src/map/messages/commands/remove-tile.command.d.ts +9 -0
- package/dist/src/map/services/map-management.service.d.ts +2 -1
- package/package.json +1 -1
- package/dist/esm2015/map/messages/commands/clear-layer.command.js +0 -12
- package/dist/esm2015/src/map/messages/commands/clear-layer.command.js +0 -12
- package/dist/map/messages/commands/clear-layer.command.d.ts +0 -7
- package/dist/src/map/messages/commands/clear-layer.command.d.ts +0 -7
|
@@ -729,23 +729,41 @@
|
|
|
729
729
|
}(GenericMessage));
|
|
730
730
|
RemoveLayerCommand.ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
731
731
|
|
|
732
|
-
var
|
|
733
|
-
__extends(
|
|
734
|
-
function
|
|
732
|
+
var AddTileCommand = /** @class */ (function (_super) {
|
|
733
|
+
__extends(AddTileCommand, _super);
|
|
734
|
+
function AddTileCommand(layer) {
|
|
735
735
|
var _this = _super.call(this) || this;
|
|
736
736
|
_this.layer = layer;
|
|
737
737
|
return _this;
|
|
738
738
|
}
|
|
739
|
-
Object.defineProperty(
|
|
739
|
+
Object.defineProperty(AddTileCommand.prototype, "id", {
|
|
740
740
|
get: function () {
|
|
741
|
-
return
|
|
741
|
+
return AddTileCommand.ID;
|
|
742
742
|
},
|
|
743
743
|
enumerable: false,
|
|
744
744
|
configurable: true
|
|
745
745
|
});
|
|
746
|
-
return
|
|
746
|
+
return AddTileCommand;
|
|
747
747
|
}(GenericMessage));
|
|
748
|
-
|
|
748
|
+
AddTileCommand.ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
749
|
+
|
|
750
|
+
var RemoveTileCommand = /** @class */ (function (_super) {
|
|
751
|
+
__extends(RemoveTileCommand, _super);
|
|
752
|
+
function RemoveTileCommand(layer) {
|
|
753
|
+
var _this = _super.call(this) || this;
|
|
754
|
+
_this.layer = layer;
|
|
755
|
+
return _this;
|
|
756
|
+
}
|
|
757
|
+
Object.defineProperty(RemoveTileCommand.prototype, "id", {
|
|
758
|
+
get: function () {
|
|
759
|
+
return RemoveTileCommand.ID;
|
|
760
|
+
},
|
|
761
|
+
enumerable: false,
|
|
762
|
+
configurable: true
|
|
763
|
+
});
|
|
764
|
+
return RemoveTileCommand;
|
|
765
|
+
}(GenericMessage));
|
|
766
|
+
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
749
767
|
|
|
750
768
|
var MapPostboyService = /** @class */ (function () {
|
|
751
769
|
function MapPostboyService() {
|
|
@@ -778,7 +796,8 @@
|
|
|
778
796
|
service.register(AddLayerCommand.ID, new rxjs.Subject());
|
|
779
797
|
service.register(PlaceLayerFeaturesCommand.ID, new rxjs.ReplaySubject(1));
|
|
780
798
|
service.register(RemoveLayerCommand.ID, new rxjs.Subject());
|
|
781
|
-
service.register(
|
|
799
|
+
service.register(AddTileCommand.ID, new rxjs.Subject());
|
|
800
|
+
service.register(RemoveTileCommand.ID, new rxjs.Subject());
|
|
782
801
|
}
|
|
783
802
|
return MessageRegistratorService;
|
|
784
803
|
}());
|
|
@@ -810,19 +829,29 @@
|
|
|
810
829
|
this.observeAddLayer();
|
|
811
830
|
this.observeRemoveLayer();
|
|
812
831
|
this.observePlaceFeatures();
|
|
813
|
-
this.
|
|
832
|
+
this.observeAddTile();
|
|
833
|
+
this.observeRemoveTile();
|
|
814
834
|
}
|
|
815
|
-
MapManagementService.prototype.
|
|
835
|
+
MapManagementService.prototype.observeRemoveTile = function () {
|
|
816
836
|
var _this = this;
|
|
817
|
-
this.postboy.subscribe(
|
|
818
|
-
_this.map
|
|
837
|
+
this.postboy.subscribe(RemoveTileCommand.ID).subscribe(function (c) {
|
|
838
|
+
if (!_this.map)
|
|
839
|
+
return;
|
|
840
|
+
_this.map.removeLayer(c.layer);
|
|
819
841
|
});
|
|
820
842
|
};
|
|
821
|
-
MapManagementService.prototype.
|
|
843
|
+
MapManagementService.prototype.observeAddTile = function () {
|
|
822
844
|
var _this = this;
|
|
823
|
-
this.postboy.subscribe(
|
|
824
|
-
|
|
825
|
-
|
|
845
|
+
this.postboy.subscribe(AddTileCommand.ID).subscribe(function (c) {
|
|
846
|
+
if (!_this.map)
|
|
847
|
+
return;
|
|
848
|
+
_this.map.addLayer(c.layer);
|
|
849
|
+
});
|
|
850
|
+
};
|
|
851
|
+
MapManagementService.prototype.observeMapRender = function () {
|
|
852
|
+
var _this = this;
|
|
853
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (m) {
|
|
854
|
+
_this.map = m.map;
|
|
826
855
|
});
|
|
827
856
|
};
|
|
828
857
|
MapManagementService.prototype.observeAddLayer = function () {
|
|
@@ -1023,15 +1052,143 @@
|
|
|
1023
1052
|
type: i0.Input
|
|
1024
1053
|
}] } });
|
|
1025
1054
|
|
|
1055
|
+
var TileLayerSettings = /** @class */ (function () {
|
|
1056
|
+
function TileLayerSettings() {
|
|
1057
|
+
this.maxZoom = 19;
|
|
1058
|
+
this.minZoom = 0;
|
|
1059
|
+
this.opacity = 0.6;
|
|
1060
|
+
this.url = '';
|
|
1061
|
+
this.projection = 'EPSG:3857';
|
|
1062
|
+
}
|
|
1063
|
+
TileLayerSettings.copy = function (model) {
|
|
1064
|
+
var result = new TileLayerSettings();
|
|
1065
|
+
result.maxZoom = model.maxZoom;
|
|
1066
|
+
result.minZoom = model.minZoom;
|
|
1067
|
+
result.projection = model.projection;
|
|
1068
|
+
result.opacity = model.opacity;
|
|
1069
|
+
result.url = model.url;
|
|
1070
|
+
return result;
|
|
1071
|
+
};
|
|
1072
|
+
TileLayerSettings.prototype.setUrl = function (url) {
|
|
1073
|
+
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { url: url }));
|
|
1074
|
+
};
|
|
1075
|
+
TileLayerSettings.prototype.setMaxZoom = function (maxZoom) {
|
|
1076
|
+
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
|
|
1077
|
+
};
|
|
1078
|
+
TileLayerSettings.prototype.setMinZoom = function (minZoom) {
|
|
1079
|
+
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
|
|
1080
|
+
};
|
|
1081
|
+
TileLayerSettings.prototype.setOpacity = function (opacity) {
|
|
1082
|
+
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity: opacity }));
|
|
1083
|
+
};
|
|
1084
|
+
TileLayerSettings.prototype.setProjection = function (projection) {
|
|
1085
|
+
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { projection: projection }));
|
|
1086
|
+
};
|
|
1087
|
+
TileLayerSettings.prototype.isSame = function (model) {
|
|
1088
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1089
|
+
return false;
|
|
1090
|
+
if (this.minZoom !== model.minZoom)
|
|
1091
|
+
return false;
|
|
1092
|
+
if (this.url !== model.url)
|
|
1093
|
+
return false;
|
|
1094
|
+
if (this.projection !== model.projection)
|
|
1095
|
+
return false;
|
|
1096
|
+
if (this.opacity !== model.opacity)
|
|
1097
|
+
return false;
|
|
1098
|
+
return true;
|
|
1099
|
+
};
|
|
1100
|
+
return TileLayerSettings;
|
|
1101
|
+
}());
|
|
1102
|
+
|
|
1103
|
+
var TileLayerFactory = /** @class */ (function () {
|
|
1104
|
+
function TileLayerFactory() {
|
|
1105
|
+
}
|
|
1106
|
+
TileLayerFactory.prototype.build = function (settings) {
|
|
1107
|
+
var source$1 = new source.XYZ({
|
|
1108
|
+
tileSize: 256,
|
|
1109
|
+
maxZoom: settings.maxZoom || 14,
|
|
1110
|
+
minZoom: settings.minZoom || 1,
|
|
1111
|
+
projection: proj.get(settings.projection),
|
|
1112
|
+
tileUrlFunction: this.getTileFunc(settings),
|
|
1113
|
+
crossOrigin: 'Anonymous',
|
|
1114
|
+
});
|
|
1115
|
+
return new TileLayer__default["default"]({ source: source$1, opacity: settings.opacity });
|
|
1116
|
+
};
|
|
1117
|
+
TileLayerFactory.prototype.getTileFunc = function (settings) {
|
|
1118
|
+
var _this = this;
|
|
1119
|
+
return function (tileCoord) {
|
|
1120
|
+
var zoom = tileCoord[0];
|
|
1121
|
+
var x = tileCoord[1];
|
|
1122
|
+
var y = tileCoord[2];
|
|
1123
|
+
var normalizedCoord = _this.getNormalizedCoord({ x: x, y: y }, zoom);
|
|
1124
|
+
var bound = 1 << zoom;
|
|
1125
|
+
return settings.url
|
|
1126
|
+
.replace('{x}', String((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.x) || x))
|
|
1127
|
+
.replace('{z}', String(zoom))
|
|
1128
|
+
.replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
TileLayerFactory.prototype.getNormalizedCoord = function (coord, zoom) {
|
|
1132
|
+
var y = coord.y;
|
|
1133
|
+
var x = coord.x;
|
|
1134
|
+
var tileRange = 1 << zoom;
|
|
1135
|
+
if (y < 0 || y >= tileRange)
|
|
1136
|
+
return null;
|
|
1137
|
+
if (x < 0 || x >= tileRange)
|
|
1138
|
+
x = ((x % tileRange) + tileRange) % tileRange;
|
|
1139
|
+
return { x: x, y: y };
|
|
1140
|
+
};
|
|
1141
|
+
return TileLayerFactory;
|
|
1142
|
+
}());
|
|
1143
|
+
TileLayerFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TileLayerFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1144
|
+
TileLayerFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TileLayerFactory, providedIn: 'root' });
|
|
1145
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TileLayerFactory, decorators: [{
|
|
1146
|
+
type: i0.Injectable,
|
|
1147
|
+
args: [{
|
|
1148
|
+
providedIn: 'root',
|
|
1149
|
+
}]
|
|
1150
|
+
}] });
|
|
1151
|
+
|
|
1026
1152
|
var TileLayerComponent = /** @class */ (function (_super) {
|
|
1027
1153
|
__extends(TileLayerComponent, _super);
|
|
1028
|
-
function TileLayerComponent() {
|
|
1029
|
-
|
|
1154
|
+
function TileLayerComponent(postboy, factory) {
|
|
1155
|
+
var _this = _super.call(this) || this;
|
|
1156
|
+
_this.postboy = postboy;
|
|
1157
|
+
_this.factory = factory;
|
|
1158
|
+
_this._settings = new TileLayerSettings();
|
|
1159
|
+
_this.onDestroy = function () { return _this.removeLayer(); };
|
|
1160
|
+
return _this;
|
|
1030
1161
|
}
|
|
1162
|
+
TileLayerComponent.prototype.ngOnInit = function () {
|
|
1163
|
+
var _this = this;
|
|
1164
|
+
this.postboy
|
|
1165
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1166
|
+
.pipe(operators.filter(function (m) { return !!m; }), operators.first())
|
|
1167
|
+
.subscribe(function (m) { return _this.initLayer(); });
|
|
1168
|
+
};
|
|
1169
|
+
Object.defineProperty(TileLayerComponent.prototype, "settings", {
|
|
1170
|
+
set: function (value) {
|
|
1171
|
+
if (!value || this._settings.isSame(value))
|
|
1172
|
+
return;
|
|
1173
|
+
this._settings = value;
|
|
1174
|
+
this.initLayer();
|
|
1175
|
+
},
|
|
1176
|
+
enumerable: false,
|
|
1177
|
+
configurable: true
|
|
1178
|
+
});
|
|
1179
|
+
TileLayerComponent.prototype.initLayer = function () {
|
|
1180
|
+
this.removeLayer();
|
|
1181
|
+
this.layer = this.factory.build(this._settings);
|
|
1182
|
+
this.postboy.fire(new AddTileCommand(this.layer));
|
|
1183
|
+
};
|
|
1184
|
+
TileLayerComponent.prototype.removeLayer = function () {
|
|
1185
|
+
if (this.layer)
|
|
1186
|
+
this.postboy.fire(new RemoveTileCommand(this.layer));
|
|
1187
|
+
};
|
|
1031
1188
|
return TileLayerComponent;
|
|
1032
1189
|
}(DestructibleComponent));
|
|
1033
|
-
TileLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TileLayerComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1034
|
-
TileLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TileLayerComponent, selector: "lib-tile-layer", usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1190
|
+
TileLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TileLayerComponent, deps: [{ token: MapPostboyService }, { token: TileLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1191
|
+
TileLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TileLayerComponent, selector: "lib-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1035
1192
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TileLayerComponent, decorators: [{
|
|
1036
1193
|
type: i0.Component,
|
|
1037
1194
|
args: [{
|
|
@@ -1040,7 +1197,9 @@
|
|
|
1040
1197
|
styleUrls: [],
|
|
1041
1198
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1042
1199
|
}]
|
|
1043
|
-
}], ctorParameters: function () { return []; }
|
|
1200
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: TileLayerFactory }]; }, propDecorators: { settings: [{
|
|
1201
|
+
type: i0.Input
|
|
1202
|
+
}] } });
|
|
1044
1203
|
|
|
1045
1204
|
var FeatureLayerSettings = /** @class */ (function () {
|
|
1046
1205
|
function FeatureLayerSettings() {
|
|
@@ -1228,7 +1387,7 @@
|
|
|
1228
1387
|
TileLayerComponent,
|
|
1229
1388
|
OsmTileLayerComponent,
|
|
1230
1389
|
FeatureLayerComponent,
|
|
1231
|
-
MarkersComponent], imports: [i5.CommonModule], exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent] });
|
|
1390
|
+
MarkersComponent], imports: [i5.CommonModule], exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent] });
|
|
1232
1391
|
MapModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, imports: [[i5.CommonModule]] });
|
|
1233
1392
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, decorators: [{
|
|
1234
1393
|
type: i0.NgModule,
|
|
@@ -1242,52 +1401,10 @@
|
|
|
1242
1401
|
FeatureLayerComponent,
|
|
1243
1402
|
MarkersComponent,
|
|
1244
1403
|
],
|
|
1245
|
-
exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent],
|
|
1404
|
+
exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent],
|
|
1246
1405
|
}]
|
|
1247
1406
|
}] });
|
|
1248
1407
|
|
|
1249
|
-
var TileLayerSettings = /** @class */ (function () {
|
|
1250
|
-
function TileLayerSettings() {
|
|
1251
|
-
this.name = 'tiles';
|
|
1252
|
-
this.maxZoom = 19;
|
|
1253
|
-
this.minZoom = 0;
|
|
1254
|
-
this.opacity = 1;
|
|
1255
|
-
this.url = '';
|
|
1256
|
-
}
|
|
1257
|
-
TileLayerSettings.copy = function (model) {
|
|
1258
|
-
var result = new TileLayerSettings();
|
|
1259
|
-
result.name = model.name;
|
|
1260
|
-
result.maxZoom = model.maxZoom;
|
|
1261
|
-
result.minZoom = model.minZoom;
|
|
1262
|
-
result.url = model.url;
|
|
1263
|
-
return result;
|
|
1264
|
-
};
|
|
1265
|
-
TileLayerSettings.prototype.setUrl = function (url) {
|
|
1266
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { url: url }));
|
|
1267
|
-
};
|
|
1268
|
-
TileLayerSettings.prototype.setName = function (name) {
|
|
1269
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { name: name }));
|
|
1270
|
-
};
|
|
1271
|
-
TileLayerSettings.prototype.setMaxZoom = function (maxZoom) {
|
|
1272
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
|
|
1273
|
-
};
|
|
1274
|
-
TileLayerSettings.prototype.setMinZoom = function (minZoom) {
|
|
1275
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
|
|
1276
|
-
};
|
|
1277
|
-
TileLayerSettings.prototype.isSame = function (model) {
|
|
1278
|
-
if (this.maxZoom !== model.maxZoom)
|
|
1279
|
-
return false;
|
|
1280
|
-
if (this.minZoom !== model.minZoom)
|
|
1281
|
-
return false;
|
|
1282
|
-
if (this.url !== model.url)
|
|
1283
|
-
return false;
|
|
1284
|
-
if (this.name !== model.name)
|
|
1285
|
-
return false;
|
|
1286
|
-
return true;
|
|
1287
|
-
};
|
|
1288
|
-
return TileLayerSettings;
|
|
1289
|
-
}());
|
|
1290
|
-
|
|
1291
1408
|
var MarkerStyleHelper = /** @class */ (function () {
|
|
1292
1409
|
function MarkerStyleHelper() {
|
|
1293
1410
|
}
|