bbj-screen-widget 2.4.75 → 2.4.77
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/bbj-screen-widget.metadata.json +1 -1
- package/bundles/bbj-screen-widget-core.umd.js +20 -0
- package/bundles/bbj-screen-widget-core.umd.js.map +1 -1
- package/bundles/bbj-screen-widget-core.umd.min.js +1 -1
- package/bundles/bbj-screen-widget-core.umd.min.js.map +1 -1
- package/bundles/bbj-screen-widget.umd.js +270 -121
- package/bundles/bbj-screen-widget.umd.js.map +1 -1
- package/bundles/bbj-screen-widget.umd.min.js +1 -1
- package/bundles/bbj-screen-widget.umd.min.js.map +1 -1
- package/core/bbj-screen-widget-core.metadata.json +1 -1
- package/core/util/map.util.d.ts +10 -0
- package/esm2015/core/util/map.util.js +20 -1
- package/esm2015/lib/custom-baidu-map/baidu-fence/baidu-fence.component.js +164 -63
- package/fesm2015/bbj-screen-widget-core.js +20 -1
- package/fesm2015/bbj-screen-widget-core.js.map +1 -1
- package/fesm2015/bbj-screen-widget.js +164 -63
- package/fesm2015/bbj-screen-widget.js.map +1 -1
- package/lib/custom-baidu-map/baidu-fence/baidu-fence.component.d.ts +7 -0
- package/package.json +1 -1
|
@@ -16088,7 +16088,7 @@
|
|
|
16088
16088
|
], exports.ɵdd);
|
|
16089
16089
|
|
|
16090
16090
|
var EARTH_RADIUS$1 = 6371393;
|
|
16091
|
-
var ɵ0$c = { type: 'string', title: 'ID' };
|
|
16091
|
+
var ɵ0$c = { type: 'string', title: 'ID' }, ɵ1$c = { type: 'string', title: 'ID' };
|
|
16092
16092
|
exports.ɵde = /** @class */ (function (_super_1) {
|
|
16093
16093
|
__extends(BaiduFenceComponent, _super_1);
|
|
16094
16094
|
function BaiduFenceComponent(parent, zone, message) {
|
|
@@ -16125,6 +16125,7 @@
|
|
|
16125
16125
|
},
|
|
16126
16126
|
];
|
|
16127
16127
|
_this.create = new i0.EventEmitter();
|
|
16128
|
+
_this.update = new i0.EventEmitter();
|
|
16128
16129
|
_this.editData = [];
|
|
16129
16130
|
_this.stopEdit$ = new rxjs.Subject();
|
|
16130
16131
|
return _this;
|
|
@@ -16167,80 +16168,96 @@
|
|
|
16167
16168
|
return [this.layer];
|
|
16168
16169
|
};
|
|
16169
16170
|
BaiduFenceComponent.prototype.updateData = function () {
|
|
16171
|
+
var e_1, _b;
|
|
16170
16172
|
var data = [];
|
|
16171
|
-
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
16173
|
+
try {
|
|
16174
|
+
for (var _c = __values(this.data), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
16175
|
+
var r = _d.value;
|
|
16176
|
+
if (r.id && r.id === this.editId) {
|
|
16177
|
+
continue;
|
|
16175
16178
|
}
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
//
|
|
16188
|
-
var
|
|
16189
|
-
//
|
|
16190
|
-
var
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16179
|
+
if (r.type === 'circle') {
|
|
16180
|
+
if (!r.radius || !r.lnglat) {
|
|
16181
|
+
continue;
|
|
16182
|
+
}
|
|
16183
|
+
var pointsCount = 90;
|
|
16184
|
+
var radius = r.radius;
|
|
16185
|
+
var lnglat = r.lnglat.split(',');
|
|
16186
|
+
var centerLng = +lnglat[0];
|
|
16187
|
+
var centerLat = +lnglat[1];
|
|
16188
|
+
// 转换中心点纬度为弧度
|
|
16189
|
+
var centerLatRad = (centerLat * Math.PI) / 180;
|
|
16190
|
+
// 存储轨迹点的数组
|
|
16191
|
+
var coordinates = [];
|
|
16192
|
+
// 遍历 0~360°,生成等间隔的点
|
|
16193
|
+
for (var i = 0; i < pointsCount; i++) {
|
|
16194
|
+
// 计算当前点的方位角(弧度):从0°到360°,均分pointsCount份
|
|
16195
|
+
var angleRad = (((i * 360) / pointsCount) * Math.PI) / 180;
|
|
16196
|
+
// 计算当前点相对于中心点的经纬度增量(弧度)
|
|
16197
|
+
var deltaLatRad = (radius * Math.cos(angleRad)) / EARTH_RADIUS$1;
|
|
16198
|
+
var deltaLngRad = (radius * Math.sin(angleRad)) / (EARTH_RADIUS$1 * Math.cos(centerLatRad));
|
|
16199
|
+
// 转换为角度,并计算新坐标
|
|
16200
|
+
var newLat = centerLat + (deltaLatRad * 180) / Math.PI;
|
|
16201
|
+
var newLng = centerLng + (deltaLngRad * 180) / Math.PI;
|
|
16202
|
+
// 添加到轨迹数组(保留6位小数,经纬度常规精度)
|
|
16203
|
+
coordinates.push([parseFloat(newLng.toFixed(6)), parseFloat(newLat.toFixed(6))]);
|
|
16204
|
+
}
|
|
16205
|
+
data.push({
|
|
16206
|
+
geometry: {
|
|
16207
|
+
type: 'Polygon',
|
|
16208
|
+
coordinates: [coordinates],
|
|
16209
|
+
},
|
|
16210
|
+
});
|
|
16197
16211
|
}
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
|
|
16203
|
-
|
|
16204
|
-
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16212
|
+
else {
|
|
16213
|
+
if (!r.lnglat) {
|
|
16214
|
+
continue;
|
|
16215
|
+
}
|
|
16216
|
+
// const coordinates = r.lnglat.split(';').map((r) => {
|
|
16217
|
+
// const lnglat = r.split(',');
|
|
16218
|
+
// return [+lnglat[0], +lnglat[1]];
|
|
16219
|
+
// });
|
|
16220
|
+
var coordinates = r.lnglat.split('\n').map(function (r) { return r.split(';').map(function (r) {
|
|
16221
|
+
var lnglat = r.split(',');
|
|
16222
|
+
return [+lnglat[0], +lnglat[1]];
|
|
16223
|
+
}); });
|
|
16224
|
+
data.push({
|
|
16225
|
+
id: r.id,
|
|
16226
|
+
geometry: {
|
|
16227
|
+
type: 'Polygon',
|
|
16228
|
+
coordinates: coordinates,
|
|
16229
|
+
},
|
|
16230
|
+
});
|
|
16208
16231
|
}
|
|
16209
|
-
// const coordinates = r.lnglat.split(';').map((r) => {
|
|
16210
|
-
// const lnglat = r.split(',');
|
|
16211
|
-
// return [+lnglat[0], +lnglat[1]];
|
|
16212
|
-
// });
|
|
16213
|
-
var coordinates = r.lnglat.split('\n').map(function (r) { return r.split(';').map(function (r) {
|
|
16214
|
-
var lnglat = r.split(',');
|
|
16215
|
-
return [+lnglat[0], +lnglat[1]];
|
|
16216
|
-
}); });
|
|
16217
|
-
data.push({
|
|
16218
|
-
geometry: {
|
|
16219
|
-
type: 'Polygon',
|
|
16220
|
-
coordinates: coordinates,
|
|
16221
|
-
},
|
|
16222
|
-
});
|
|
16223
16232
|
}
|
|
16224
|
-
}
|
|
16233
|
+
}
|
|
16234
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
16235
|
+
finally {
|
|
16236
|
+
try {
|
|
16237
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
16238
|
+
}
|
|
16239
|
+
finally { if (e_1) throw e_1.error; }
|
|
16240
|
+
}
|
|
16225
16241
|
this.layer.setData(data);
|
|
16226
16242
|
};
|
|
16227
|
-
BaiduFenceComponent.prototype.
|
|
16243
|
+
BaiduFenceComponent.prototype.createScene = function () {
|
|
16228
16244
|
return __awaiter(this, void 0, void 0, function () {
|
|
16229
|
-
var _b, DrawScene,
|
|
16245
|
+
var _b, DrawScene, OperateEventType;
|
|
16230
16246
|
var _this = this;
|
|
16231
16247
|
return __generator(this, function (_c) {
|
|
16232
16248
|
switch (_c.label) {
|
|
16233
16249
|
case 0: return [4 /*yield*/, import('bmap-draw')];
|
|
16234
16250
|
case 1:
|
|
16235
|
-
_b = _c.sent(), DrawScene = _b.DrawScene,
|
|
16251
|
+
_b = _c.sent(), DrawScene = _b.DrawScene, OperateEventType = _b.OperateEventType;
|
|
16236
16252
|
if (!this.scene) {
|
|
16237
16253
|
this.scene = new DrawScene(this.parent.map, { noLimit: true });
|
|
16238
16254
|
this.scene.addEventListener(OperateEventType.COMPLETE, function (e) {
|
|
16239
16255
|
console.log(e);
|
|
16256
|
+
var data;
|
|
16240
16257
|
if (e.target.overlay.radius) {
|
|
16241
16258
|
var radius = e.target.overlay.radius;
|
|
16242
16259
|
var lnglat = e.target.overlay.latLng;
|
|
16243
|
-
|
|
16260
|
+
data = {
|
|
16244
16261
|
type: 'circle',
|
|
16245
16262
|
lnglat: lnglat.lng + "," + lnglat.lat,
|
|
16246
16263
|
radius: radius,
|
|
@@ -16249,14 +16266,12 @@
|
|
|
16249
16266
|
// this.parent.map.removeOverlay(r);
|
|
16250
16267
|
// });
|
|
16251
16268
|
_this.create.emit(data);
|
|
16252
|
-
_this.editOverlay = null;
|
|
16253
16269
|
}
|
|
16254
16270
|
else {
|
|
16255
16271
|
var points = e.target.overlay.getPoints();
|
|
16256
16272
|
if (!_this.data) {
|
|
16257
16273
|
_this.data = [];
|
|
16258
16274
|
}
|
|
16259
|
-
var data = void 0;
|
|
16260
16275
|
if (points.length && Array.isArray(points[0])) {
|
|
16261
16276
|
data = {
|
|
16262
16277
|
type: 'polygon',
|
|
@@ -16266,20 +16281,64 @@
|
|
|
16266
16281
|
else {
|
|
16267
16282
|
data = {
|
|
16268
16283
|
type: 'polygon',
|
|
16269
|
-
lnglat: points
|
|
16284
|
+
lnglat: points
|
|
16285
|
+
.map(function (p) {
|
|
16286
|
+
var latLng = p.latLng;
|
|
16287
|
+
if (!latLng) {
|
|
16288
|
+
var _b = __read(_this.parent.map.mercatorToLnglat(p.lng, p.lat), 2), lng = _b[0], lat = _b[1];
|
|
16289
|
+
return lng + "," + lat;
|
|
16290
|
+
}
|
|
16291
|
+
else {
|
|
16292
|
+
return latLng.lng + "," + latLng.lat;
|
|
16293
|
+
}
|
|
16294
|
+
})
|
|
16295
|
+
.join(';'),
|
|
16270
16296
|
};
|
|
16271
16297
|
}
|
|
16298
|
+
}
|
|
16299
|
+
_this.editOverlay = null;
|
|
16300
|
+
_this.parent.map.removeOverlay(e.target.overlay);
|
|
16301
|
+
if (_this.editId) {
|
|
16302
|
+
data.id = _this.editId;
|
|
16303
|
+
var index = _this.data.findIndex(function (r) { return r.id === _this.editId; });
|
|
16304
|
+
if (index !== -1) {
|
|
16305
|
+
_this.data[index] = data;
|
|
16306
|
+
}
|
|
16307
|
+
_this.editId = null;
|
|
16308
|
+
_this.updateData();
|
|
16309
|
+
}
|
|
16310
|
+
else {
|
|
16311
|
+
_this.data.push(data);
|
|
16312
|
+
_this.updateData();
|
|
16272
16313
|
_this.create.emit(data);
|
|
16273
16314
|
}
|
|
16274
16315
|
});
|
|
16275
16316
|
this.scene.addEventListener(OperateEventType.CANCEL, function (e) {
|
|
16276
|
-
console.log(e);
|
|
16277
16317
|
if (_this.editOverlay) {
|
|
16278
16318
|
_this.parent.map.removeOverlay(_this.editOverlay);
|
|
16279
16319
|
_this.editOverlay = null;
|
|
16280
16320
|
}
|
|
16321
|
+
if (_this.editId) {
|
|
16322
|
+
_this.editId = null;
|
|
16323
|
+
_this.updateData();
|
|
16324
|
+
}
|
|
16281
16325
|
});
|
|
16282
16326
|
}
|
|
16327
|
+
return [2 /*return*/];
|
|
16328
|
+
}
|
|
16329
|
+
});
|
|
16330
|
+
});
|
|
16331
|
+
};
|
|
16332
|
+
BaiduFenceComponent.prototype.startDraw = function (type) {
|
|
16333
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16334
|
+
var _b, PolygonDraw, CircleDraw;
|
|
16335
|
+
return __generator(this, function (_c) {
|
|
16336
|
+
switch (_c.label) {
|
|
16337
|
+
case 0:
|
|
16338
|
+
this.createScene();
|
|
16339
|
+
return [4 /*yield*/, import('bmap-draw')];
|
|
16340
|
+
case 1:
|
|
16341
|
+
_b = _c.sent(), PolygonDraw = _b.PolygonDraw, CircleDraw = _b.CircleDraw;
|
|
16283
16342
|
switch (type) {
|
|
16284
16343
|
case 'polygon':
|
|
16285
16344
|
if (!this.polygon) {
|
|
@@ -16375,47 +16434,79 @@
|
|
|
16375
16434
|
// }
|
|
16376
16435
|
// this.editData = null;
|
|
16377
16436
|
};
|
|
16378
|
-
BaiduFenceComponent.prototype.
|
|
16437
|
+
BaiduFenceComponent.prototype.editPolygon = function (boundaries) {
|
|
16379
16438
|
return __awaiter(this, void 0, void 0, function () {
|
|
16380
|
-
var PolygonEdit,
|
|
16381
|
-
var _this = this;
|
|
16439
|
+
var PolygonEdit, points, overlay;
|
|
16382
16440
|
return __generator(this, function (_b) {
|
|
16383
16441
|
switch (_b.label) {
|
|
16384
16442
|
case 0: return [4 /*yield*/, import('bmap-draw')];
|
|
16385
16443
|
case 1:
|
|
16386
16444
|
PolygonEdit = (_b.sent()).PolygonEdit;
|
|
16387
|
-
|
|
16388
|
-
|
|
16389
|
-
|
|
16390
|
-
boundary.get(this.areaName, function (results) {
|
|
16391
|
-
console.log('边界坐标数组:', results);
|
|
16392
|
-
// 检查状态是否成功
|
|
16393
|
-
if (results && results.boundaries && results.boundaries.length) {
|
|
16394
|
-
_this.stopDraw();
|
|
16395
|
-
if (!_this.polygonEdit) {
|
|
16396
|
-
_this.polygonEdit = new PolygonEdit(_this.scene);
|
|
16397
|
-
}
|
|
16398
|
-
var points = results.boundaries.map(function (boundary) { return boundary.split(';').map(function (p) {
|
|
16399
|
-
var _b = __read(p.split(','), 2), lng = _b[0], lat = _b[1];
|
|
16400
|
-
return new BMapGL.Point(Number(lng), Number(lat));
|
|
16401
|
-
}); });
|
|
16402
|
-
var overlay = new BMapGL.Polygon(points, _this.getOptions());
|
|
16403
|
-
console.log(overlay);
|
|
16404
|
-
_this.editOverlay = overlay;
|
|
16405
|
-
_this.parent.map.addOverlay(overlay);
|
|
16406
|
-
_this.parent.map.setViewport([].concat.apply([], points));
|
|
16407
|
-
_this.polygonEdit.edit(overlay);
|
|
16408
|
-
}
|
|
16409
|
-
else {
|
|
16410
|
-
_this.message.error('行政区域不存在');
|
|
16411
|
-
}
|
|
16412
|
-
});
|
|
16445
|
+
this.stopDraw();
|
|
16446
|
+
if (!this.polygonEdit) {
|
|
16447
|
+
this.polygonEdit = new PolygonEdit(this.scene);
|
|
16413
16448
|
}
|
|
16449
|
+
points = boundaries.map(function (boundary) { return boundary.split(';').map(function (p) {
|
|
16450
|
+
var _b = __read(p.split(','), 2), lng = _b[0], lat = _b[1];
|
|
16451
|
+
return new BMapGL.Point(Number(lng), Number(lat));
|
|
16452
|
+
}); });
|
|
16453
|
+
overlay = new BMapGL.Polygon(points, this.getOptions());
|
|
16454
|
+
console.log(overlay);
|
|
16455
|
+
this.editOverlay = overlay;
|
|
16456
|
+
this.parent.map.addOverlay(overlay);
|
|
16457
|
+
this.parent.map.setViewport([].concat.apply([], points));
|
|
16458
|
+
this.polygonEdit.edit(overlay);
|
|
16414
16459
|
return [2 /*return*/];
|
|
16415
16460
|
}
|
|
16416
16461
|
});
|
|
16417
16462
|
});
|
|
16418
16463
|
};
|
|
16464
|
+
BaiduFenceComponent.prototype.editCircle = function (lng, lat, r) {
|
|
16465
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16466
|
+
var CircleEdit, center, overlay;
|
|
16467
|
+
return __generator(this, function (_b) {
|
|
16468
|
+
switch (_b.label) {
|
|
16469
|
+
case 0: return [4 /*yield*/, import('bmap-draw')];
|
|
16470
|
+
case 1:
|
|
16471
|
+
CircleEdit = (_b.sent()).CircleEdit;
|
|
16472
|
+
if (!this.circleEdit) {
|
|
16473
|
+
this.circleEdit = new CircleEdit(this.scene);
|
|
16474
|
+
}
|
|
16475
|
+
center = new BMapGL.Point(lng, lat);
|
|
16476
|
+
this.moveCircleToView(lng, lat, r);
|
|
16477
|
+
overlay = new BMapGL.Circle(center, r, this.getOptions());
|
|
16478
|
+
this.editOverlay = overlay;
|
|
16479
|
+
this.parent.map.addOverlay(overlay);
|
|
16480
|
+
this.circleEdit.open(overlay);
|
|
16481
|
+
return [2 /*return*/];
|
|
16482
|
+
}
|
|
16483
|
+
});
|
|
16484
|
+
});
|
|
16485
|
+
};
|
|
16486
|
+
BaiduFenceComponent.prototype.search = function () {
|
|
16487
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16488
|
+
var boundary;
|
|
16489
|
+
var _this = this;
|
|
16490
|
+
return __generator(this, function (_b) {
|
|
16491
|
+
// 如果正在绘制多边形围栏,获取地名边界并绘制
|
|
16492
|
+
if (this.areaName) {
|
|
16493
|
+
boundary = new BMapGL.Boundary();
|
|
16494
|
+
// 百度地图 Geocoder.getLocation 回调签名:(results, status)
|
|
16495
|
+
boundary.get(this.areaName, function (results) {
|
|
16496
|
+
console.log('边界坐标数组:', results);
|
|
16497
|
+
// 检查状态是否成功
|
|
16498
|
+
if (results && results.boundaries && results.boundaries.length) {
|
|
16499
|
+
_this.editPolygon(results.boundaries);
|
|
16500
|
+
}
|
|
16501
|
+
else {
|
|
16502
|
+
_this.message.error('行政区域不存在');
|
|
16503
|
+
}
|
|
16504
|
+
});
|
|
16505
|
+
}
|
|
16506
|
+
return [2 /*return*/];
|
|
16507
|
+
});
|
|
16508
|
+
});
|
|
16509
|
+
};
|
|
16419
16510
|
BaiduFenceComponent.prototype.initSearch = function () {
|
|
16420
16511
|
return __awaiter(this, void 0, void 0, function () {
|
|
16421
16512
|
var _b, PolygonEdit, CircleEdit, ac;
|
|
@@ -16435,15 +16526,7 @@
|
|
|
16435
16526
|
console.log(e);
|
|
16436
16527
|
// 如果正在绘制圆形围栏
|
|
16437
16528
|
if (_this.circle) {
|
|
16438
|
-
|
|
16439
|
-
_this.circleEdit = new CircleEdit(_this.scene);
|
|
16440
|
-
}
|
|
16441
|
-
var center = new BMapGL.Point(value.location.lng, value.location.lat);
|
|
16442
|
-
_this.parent.map.centerAndZoom(center, 16);
|
|
16443
|
-
var overlay = new BMapGL.Circle(center, 300, _this.getOptions());
|
|
16444
|
-
_this.editOverlay = overlay;
|
|
16445
|
-
_this.parent.map.addOverlay(overlay);
|
|
16446
|
-
_this.circleEdit.open(overlay);
|
|
16529
|
+
_this.editCircle(value.location.lng, value.location.lat, 300);
|
|
16447
16530
|
_this.searchText = null;
|
|
16448
16531
|
}
|
|
16449
16532
|
});
|
|
@@ -16462,27 +16545,7 @@
|
|
|
16462
16545
|
}
|
|
16463
16546
|
if (data.type === 'circle') {
|
|
16464
16547
|
var _b = __read(data.lnglat.split(','), 2), lng = _b[0], lat = _b[1];
|
|
16465
|
-
|
|
16466
|
-
var centerLat = Number(lat);
|
|
16467
|
-
var radius = Number(data.radius);
|
|
16468
|
-
// 转换中心点纬度为弧度
|
|
16469
|
-
var centerLatRad = (centerLat * Math.PI) / 180;
|
|
16470
|
-
// 计算经度方向的偏移(弧度)
|
|
16471
|
-
var deltaLngRad = radius / (EARTH_RADIUS$1 * Math.cos(centerLatRad));
|
|
16472
|
-
// 计算纬度方向的偏移(弧度)
|
|
16473
|
-
var deltaLatRad = radius / EARTH_RADIUS$1;
|
|
16474
|
-
// 转换为角度偏移
|
|
16475
|
-
var deltaLng = (deltaLngRad * 180) / Math.PI;
|
|
16476
|
-
var deltaLat = (deltaLatRad * 180) / Math.PI;
|
|
16477
|
-
// 计算圆形的四个边界点(上、下、左、右)
|
|
16478
|
-
var points = [
|
|
16479
|
-
new BMapGL.Point(centerLng, centerLat + deltaLat),
|
|
16480
|
-
new BMapGL.Point(centerLng, centerLat - deltaLat),
|
|
16481
|
-
new BMapGL.Point(centerLng - deltaLng, centerLat),
|
|
16482
|
-
new BMapGL.Point(centerLng + deltaLng, centerLat),
|
|
16483
|
-
];
|
|
16484
|
-
// 使用 setViewport 方法调整视图,使整个圆形可见
|
|
16485
|
-
this.parent.map.setViewport(points);
|
|
16548
|
+
this.moveCircleToView(Number(lng), Number(lat), Number(data.radius));
|
|
16486
16549
|
}
|
|
16487
16550
|
else {
|
|
16488
16551
|
this.parent.map.setViewport(data.lnglat.split(/[;\n\r]+/).map(function (p) {
|
|
@@ -16491,12 +16554,78 @@
|
|
|
16491
16554
|
}));
|
|
16492
16555
|
}
|
|
16493
16556
|
};
|
|
16557
|
+
BaiduFenceComponent.prototype.moveCircleToView = function (lng, lat, r) {
|
|
16558
|
+
var centerLng = Number(lng);
|
|
16559
|
+
var centerLat = Number(lat);
|
|
16560
|
+
var radius = Number(r);
|
|
16561
|
+
// 转换中心点纬度为弧度
|
|
16562
|
+
var centerLatRad = (centerLat * Math.PI) / 180;
|
|
16563
|
+
// 计算经度方向的偏移(弧度)
|
|
16564
|
+
var deltaLngRad = radius / (EARTH_RADIUS$1 * Math.cos(centerLatRad));
|
|
16565
|
+
// 计算纬度方向的偏移(弧度)
|
|
16566
|
+
var deltaLatRad = radius / EARTH_RADIUS$1;
|
|
16567
|
+
// 转换为角度偏移
|
|
16568
|
+
var deltaLng = (deltaLngRad * 180) / Math.PI;
|
|
16569
|
+
var deltaLat = (deltaLatRad * 180) / Math.PI;
|
|
16570
|
+
// 计算圆形的四个边界点(上、下、左、右)
|
|
16571
|
+
var points = [
|
|
16572
|
+
new BMapGL.Point(centerLng, centerLat + deltaLat),
|
|
16573
|
+
new BMapGL.Point(centerLng, centerLat - deltaLat),
|
|
16574
|
+
new BMapGL.Point(centerLng - deltaLng, centerLat),
|
|
16575
|
+
new BMapGL.Point(centerLng + deltaLng, centerLat),
|
|
16576
|
+
];
|
|
16577
|
+
// 使用 setViewport 方法调整视图,使整个圆形可见
|
|
16578
|
+
this.parent.map.setViewport(points);
|
|
16579
|
+
};
|
|
16580
|
+
BaiduFenceComponent.prototype.edit = function (id) {
|
|
16581
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16582
|
+
var item, _b, _c, lng, lat;
|
|
16583
|
+
return __generator(this, function (_d) {
|
|
16584
|
+
switch (_d.label) {
|
|
16585
|
+
case 0:
|
|
16586
|
+
if (!this.data) {
|
|
16587
|
+
console.log('没有数据');
|
|
16588
|
+
return [2 /*return*/];
|
|
16589
|
+
}
|
|
16590
|
+
item = this.data.find(function (item) { return item.id === id; });
|
|
16591
|
+
if (!item) {
|
|
16592
|
+
console.log('找不到id', id);
|
|
16593
|
+
return [2 /*return*/];
|
|
16594
|
+
}
|
|
16595
|
+
if (!item.lnglat) {
|
|
16596
|
+
console.log('没有经纬度', item);
|
|
16597
|
+
return [2 /*return*/];
|
|
16598
|
+
}
|
|
16599
|
+
this.createScene();
|
|
16600
|
+
_b = item.type;
|
|
16601
|
+
switch (_b) {
|
|
16602
|
+
case 'circle': return [3 /*break*/, 1];
|
|
16603
|
+
}
|
|
16604
|
+
return [3 /*break*/, 3];
|
|
16605
|
+
case 1:
|
|
16606
|
+
_c = __read(item.lnglat.split(','), 2), lng = _c[0], lat = _c[1];
|
|
16607
|
+
return [4 /*yield*/, this.editCircle(Number(lng), Number(lat), Number(item.radius))];
|
|
16608
|
+
case 2:
|
|
16609
|
+
_d.sent();
|
|
16610
|
+
return [3 /*break*/, 5];
|
|
16611
|
+
case 3: return [4 /*yield*/, this.editPolygon(item.lnglat.split('\r'))];
|
|
16612
|
+
case 4:
|
|
16613
|
+
_d.sent();
|
|
16614
|
+
_d.label = 5;
|
|
16615
|
+
case 5:
|
|
16616
|
+
this.editId = id;
|
|
16617
|
+
this.updateData();
|
|
16618
|
+
return [2 /*return*/];
|
|
16619
|
+
}
|
|
16620
|
+
});
|
|
16621
|
+
});
|
|
16622
|
+
};
|
|
16494
16623
|
return BaiduFenceComponent;
|
|
16495
16624
|
}(BaseLayer));
|
|
16496
16625
|
exports.ɵde.decorators = [
|
|
16497
16626
|
{ type: i0.Component, args: [{
|
|
16498
16627
|
selector: 'sc-baidu-fence',
|
|
16499
|
-
template: "<ng-container *ngIf=\"showDrawButton\">\n <button nz-button (click)=\"startDraw('polygon')\">\u7ED8\u5236\u591A\u8FB9\u5F62</button>\n <button nz-button (click)=\"startDraw('circle')\">\u7ED8\u5236\u5706\u5F62</button>\n <button nz-button (click)=\"stopDraw()\">\u7ED3\u675F\u7ED8\u5236</button>\n <button nz-button (click)=\"
|
|
16628
|
+
template: "<ng-container *ngIf=\"showDrawButton\">\n <button nz-button (click)=\"startDraw('polygon')\">\u7ED8\u5236\u591A\u8FB9\u5F62</button>\n <button nz-button (click)=\"startDraw('circle')\">\u7ED8\u5236\u5706\u5F62</button>\n <button nz-button (click)=\"stopDraw()\">\u7ED3\u675F\u7ED8\u5236</button>\n <!-- <button nz-button (click)=\"edit('1')\">\u7F16\u8F91</button>\n <button nz-button (click)=\"edit('2')\">\u7F16\u8F912</button> -->\n</ng-container>\n<input\n nz-input\n [ngClass]=\"{ hidden: !circle?.isOpen }\"\n #suggest\n type=\"text\"\n [(ngModel)]=\"searchText\"\n placeholder=\"\u8BF7\u8F93\u5165\u4E2D\u5FC3\u70B9\u4F4D\u7F6E\"\n class=\"input\"\n/>\n<ng-container *ngIf=\"polygon?.isOpen\">\n <input nz-input type=\"text\" placeholder=\"\u8BF7\u8F93\u5165\u884C\u653F\u533A\u540D\u79F0\" [(ngModel)]=\"areaName\" class=\"input\" />\n <button nz-button (click)=\"search()\" style=\"margin-left: 12px\">\u786E\u8BA4</button>\n</ng-container>\n<!-- <input type=\"text\" placeholder=\"\u8BF7\u8F93\u5165\u5730\u70B9\" [(ngModel)]=\"searchText\" />\n<button nz-button (click)=\"search()\">\u67E5\u8BE2</button> -->\n",
|
|
16500
16629
|
styles: [":host{position:absolute;display:block;left:0;top:0;z-index:100;padding:12px;pointer-events:auto}button{transition:none}.hidden{display:none}.input{width:300px;margin-left:12px}"]
|
|
16501
16630
|
},] }
|
|
16502
16631
|
];
|
|
@@ -16560,6 +16689,19 @@
|
|
|
16560
16689
|
}),
|
|
16561
16690
|
__metadata("design:type", Object)
|
|
16562
16691
|
], exports.ɵde.prototype, "create", void 0);
|
|
16692
|
+
__decorate([
|
|
16693
|
+
bbjWidgetBase.Event('编辑围栏', {
|
|
16694
|
+
params: {
|
|
16695
|
+
properties: {
|
|
16696
|
+
id: ɵ1$c,
|
|
16697
|
+
type: { type: 'string', title: '围栏类型' },
|
|
16698
|
+
lnglat: { type: 'string', title: '经纬度' },
|
|
16699
|
+
radius: { type: 'number', title: '半径' },
|
|
16700
|
+
},
|
|
16701
|
+
},
|
|
16702
|
+
}),
|
|
16703
|
+
__metadata("design:type", Object)
|
|
16704
|
+
], exports.ɵde.prototype, "update", void 0);
|
|
16563
16705
|
__decorate([
|
|
16564
16706
|
bbjWidgetBase.Method('开始绘制'),
|
|
16565
16707
|
__param(0, bbjWidgetBase.Param('类型', {
|
|
@@ -16586,6 +16728,13 @@
|
|
|
16586
16728
|
__metadata("design:paramtypes", [String]),
|
|
16587
16729
|
__metadata("design:returntype", void 0)
|
|
16588
16730
|
], exports.ɵde.prototype, "moveToView", null);
|
|
16731
|
+
__decorate([
|
|
16732
|
+
bbjWidgetBase.Method('编辑'),
|
|
16733
|
+
__param(0, bbjWidgetBase.Param('id')),
|
|
16734
|
+
__metadata("design:type", Function),
|
|
16735
|
+
__metadata("design:paramtypes", [String]),
|
|
16736
|
+
__metadata("design:returntype", Promise)
|
|
16737
|
+
], exports.ɵde.prototype, "edit", null);
|
|
16589
16738
|
exports.ɵde = __decorate([
|
|
16590
16739
|
bbjWidgetBase.Widget('电子围栏', {
|
|
16591
16740
|
group: 'component',
|
|
@@ -21014,7 +21163,7 @@
|
|
|
21014
21163
|
{ type: i0.NgZone }
|
|
21015
21164
|
]; };
|
|
21016
21165
|
|
|
21017
|
-
var ɵ0$e = { type: 'string', title: 'id' }, ɵ1$
|
|
21166
|
+
var ɵ0$e = { type: 'string', title: 'id' }, ɵ1$d = { type: 'string', title: 'id' }, ɵ2$a = { type: 'string', title: 'id' };
|
|
21018
21167
|
exports.ɵec = /** @class */ (function (_super_1) {
|
|
21019
21168
|
__extends(TiandituMarkerComponent, _super_1);
|
|
21020
21169
|
function TiandituMarkerComponent(parent, zone, fileUrlService, nzContextMenuService) {
|
|
@@ -21649,7 +21798,7 @@
|
|
|
21649
21798
|
bbjWidgetBase.Event('选中值改变', {
|
|
21650
21799
|
params: {
|
|
21651
21800
|
properties: {
|
|
21652
|
-
id: ɵ1$
|
|
21801
|
+
id: ɵ1$d,
|
|
21653
21802
|
address: { type: 'string', title: '地点' },
|
|
21654
21803
|
lng: { type: 'number', title: '经度' },
|
|
21655
21804
|
lat: { type: 'number', title: '纬度' },
|