@opengeoweb/webmap 2.1.1 → 2.1.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/lib/components/WMDrawMarker.d.ts +1 -1
- package/lib/components/WMJSMap.d.ts +1 -0
- package/package.json +1 -1
- package/webmap.esm.js +40 -22
- package/webmap.umd.js +30 -15
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const WMDrawMarker: (context: CanvasRenderingContext2D, coordx: number, coordy: number, fillColor?: string
|
|
1
|
+
declare const WMDrawMarker: (context: CanvasRenderingContext2D, coordx: number, coordy: number, fillColor?: string) => void;
|
|
2
2
|
export default WMDrawMarker;
|
package/package.json
CHANGED
package/webmap.esm.js
CHANGED
|
@@ -3399,7 +3399,6 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3399
3399
|
* */
|
|
3400
3400
|
var WMDrawMarker = function WMDrawMarker(context, coordx, coordy) {
|
|
3401
3401
|
var fillColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '#FFF';
|
|
3402
|
-
var outlineColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '#000';
|
|
3403
3402
|
var ctx = context;
|
|
3404
3403
|
var coord = {
|
|
3405
3404
|
x: parseInt(coordx.toString(), 10),
|
|
@@ -3408,8 +3407,8 @@ var WMDrawMarker = function WMDrawMarker(context, coordx, coordy) {
|
|
|
3408
3407
|
ctx.fillStyle = fillColor;
|
|
3409
3408
|
ctx.globalAlpha = 1.0;
|
|
3410
3409
|
ctx.beginPath();
|
|
3411
|
-
var topRadius =
|
|
3412
|
-
var topHeight = 2
|
|
3410
|
+
var topRadius = 7;
|
|
3411
|
+
var topHeight = 2 * topRadius;
|
|
3413
3412
|
ctx.arc(coord.x, coord.y - topHeight, topRadius, Math.PI, Math.PI * 2);
|
|
3414
3413
|
ctx.bezierCurveTo(coord.x + topRadius, coord.y - topHeight, coord.x + topRadius / 1.6, coord.y - topRadius, coord.x, coord.y);
|
|
3415
3414
|
ctx.bezierCurveTo(coord.x, coord.y, coord.x - topRadius / 1.6, coord.y - topRadius, coord.x - topRadius, coord.y - topHeight);
|
|
@@ -3419,13 +3418,7 @@ var WMDrawMarker = function WMDrawMarker(context, coordx, coordy) {
|
|
|
3419
3418
|
|
|
3420
3419
|
ctx.fillStyle = '#FFF';
|
|
3421
3420
|
ctx.beginPath();
|
|
3422
|
-
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2, Math.PI * 2, 0);
|
|
3423
|
-
ctx.fill();
|
|
3424
|
-
/* Fill marker exact location */
|
|
3425
|
-
|
|
3426
|
-
ctx.fillStyle = outlineColor;
|
|
3427
|
-
ctx.beginPath();
|
|
3428
|
-
ctx.arc(coord.x, coord.y, 2, Math.PI * 2, 0);
|
|
3421
|
+
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
|
|
3429
3422
|
ctx.fill();
|
|
3430
3423
|
};
|
|
3431
3424
|
|
|
@@ -3506,7 +3499,7 @@ var MapPin = /*#__PURE__*/function () {
|
|
|
3506
3499
|
key: "drawMarker",
|
|
3507
3500
|
value: function drawMarker(ctx) {
|
|
3508
3501
|
if (isDefined(this.x) && isDefined(this.y)) {
|
|
3509
|
-
WMDrawMarker(ctx, this.x, this.y, '#
|
|
3502
|
+
WMDrawMarker(ctx, this.x, this.y, '#051039');
|
|
3510
3503
|
}
|
|
3511
3504
|
}
|
|
3512
3505
|
}]);
|
|
@@ -4419,6 +4412,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4419
4412
|
|
|
4420
4413
|
ctx.font = '10px Helvetica';
|
|
4421
4414
|
ctx.textBaseline = 'middle';
|
|
4415
|
+
ctx.textAlign = 'left';
|
|
4422
4416
|
|
|
4423
4417
|
if (isDefined(this.mouseGeoCoordXY)) {
|
|
4424
4418
|
var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
|
|
@@ -4453,6 +4447,30 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4453
4447
|
|
|
4454
4448
|
ctx.fillStyle = '#000000';
|
|
4455
4449
|
ctx.fillText("Map projection: ".concat(this.srs), 5, this.height - 26);
|
|
4450
|
+
/* Show layer metadata */
|
|
4451
|
+
|
|
4452
|
+
if (this.showLayerInfo === true) {
|
|
4453
|
+
var metadataX = 100;
|
|
4454
|
+
var metadataY = 100;
|
|
4455
|
+
var dimStartX = 150;
|
|
4456
|
+
var rowHeight = 26;
|
|
4457
|
+
var rowNumber = 0;
|
|
4458
|
+
drawTextBG(ctx, 'Layer name', metadataX, metadataY + rowNumber * rowHeight, 10);
|
|
4459
|
+
drawTextBG(ctx, 'Dimensions', metadataX + dimStartX, metadataY + rowNumber * rowHeight, 10);
|
|
4460
|
+
rowNumber += 1;
|
|
4461
|
+
|
|
4462
|
+
for (var _j3 = 0; _j3 < this.layers.length; _j3 += 1) {
|
|
4463
|
+
var layer = this.layers[_j3];
|
|
4464
|
+
drawTextBG(ctx, "#".concat(_j3, ":").concat(layer.name), metadataX, metadataY + rowNumber * rowHeight, 10);
|
|
4465
|
+
|
|
4466
|
+
for (var d = 0; d < layer.dimensions.length; d += 1) {
|
|
4467
|
+
var dimension = layer.dimensions[d];
|
|
4468
|
+
drawTextBG(ctx, "".concat(dimension.name, " = ").concat(dimension.currentValue), metadataX + d * 200 + dimStartX, metadataY + rowNumber * rowHeight, 10);
|
|
4469
|
+
}
|
|
4470
|
+
|
|
4471
|
+
rowNumber += 1;
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4456
4474
|
}
|
|
4457
4475
|
/* Is called when the WebMapJS object is created */
|
|
4458
4476
|
|
|
@@ -4604,8 +4622,8 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4604
4622
|
}
|
|
4605
4623
|
|
|
4606
4624
|
for (var i = 0; i < this.layers.length; i += 1) {
|
|
4607
|
-
for (var
|
|
4608
|
-
var dim = this.layers[i].dimensions[
|
|
4625
|
+
for (var _j4 = 0; _j4 < this.layers[i].dimensions.length; _j4 += 1) {
|
|
4626
|
+
var dim = this.layers[i].dimensions[_j4];
|
|
4609
4627
|
var mapdim = this.getDimension(dim.name);
|
|
4610
4628
|
|
|
4611
4629
|
if (isDefined(mapdim)) {
|
|
@@ -4618,10 +4636,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4618
4636
|
}
|
|
4619
4637
|
}
|
|
4620
4638
|
|
|
4621
|
-
for (var
|
|
4622
|
-
if (this.mapdimensions[
|
|
4623
|
-
this.mapdimensions.splice(
|
|
4624
|
-
|
|
4639
|
+
for (var _j5 = 0; _j5 < this.mapdimensions.length; _j5 += 1) {
|
|
4640
|
+
if (this.mapdimensions[_j5].used === false) {
|
|
4641
|
+
this.mapdimensions.splice(_j5, 1);
|
|
4642
|
+
_j5 -= 1;
|
|
4625
4643
|
}
|
|
4626
4644
|
}
|
|
4627
4645
|
|
|
@@ -6659,17 +6677,17 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6659
6677
|
this.WMProjectionTempUndo[j] = this.WMProjectionUndo[j];
|
|
6660
6678
|
}
|
|
6661
6679
|
|
|
6662
|
-
for (var
|
|
6663
|
-
this.WMProjectionUndo[
|
|
6680
|
+
for (var _j6 = 0; _j6 <= this.UndoPointer; _j6 += 1) {
|
|
6681
|
+
this.WMProjectionUndo[_j6] = this.WMProjectionTempUndo[this.UndoPointer - _j6];
|
|
6664
6682
|
}
|
|
6665
6683
|
|
|
6666
6684
|
this.UndoPointer = 0;
|
|
6667
6685
|
}
|
|
6668
6686
|
|
|
6669
|
-
for (var
|
|
6670
|
-
this.WMProjectionUndo[
|
|
6687
|
+
for (var _j7 = this.MaxUndos - 1; _j7 > 0; _j7 -= 1) {
|
|
6688
|
+
this.WMProjectionUndo[_j7].bbox.setBBOX(this.WMProjectionUndo[_j7 - 1].bbox);
|
|
6671
6689
|
|
|
6672
|
-
this.WMProjectionUndo[
|
|
6690
|
+
this.WMProjectionUndo[_j7].srs = this.WMProjectionUndo[_j7 - 1].srs;
|
|
6673
6691
|
}
|
|
6674
6692
|
|
|
6675
6693
|
this.WMProjectionUndo[0].bbox.setBBOX(this.bbox);
|
package/webmap.umd.js
CHANGED
|
@@ -3433,15 +3433,11 @@
|
|
|
3433
3433
|
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3434
3434
|
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
3435
3435
|
* */
|
|
3436
|
-
var WMDrawMarker = function WMDrawMarker(context, coordx, coordy, fillColor
|
|
3436
|
+
var WMDrawMarker = function WMDrawMarker(context, coordx, coordy, fillColor) {
|
|
3437
3437
|
if (fillColor === void 0) {
|
|
3438
3438
|
fillColor = '#FFF';
|
|
3439
3439
|
}
|
|
3440
3440
|
|
|
3441
|
-
if (outlineColor === void 0) {
|
|
3442
|
-
outlineColor = '#000';
|
|
3443
|
-
}
|
|
3444
|
-
|
|
3445
3441
|
var ctx = context;
|
|
3446
3442
|
var coord = {
|
|
3447
3443
|
x: parseInt(coordx.toString(), 10),
|
|
@@ -3450,8 +3446,8 @@
|
|
|
3450
3446
|
ctx.fillStyle = fillColor;
|
|
3451
3447
|
ctx.globalAlpha = 1.0;
|
|
3452
3448
|
ctx.beginPath();
|
|
3453
|
-
var topRadius =
|
|
3454
|
-
var topHeight = 2
|
|
3449
|
+
var topRadius = 7;
|
|
3450
|
+
var topHeight = 2 * topRadius;
|
|
3455
3451
|
ctx.arc(coord.x, coord.y - topHeight, topRadius, Math.PI, Math.PI * 2);
|
|
3456
3452
|
ctx.bezierCurveTo(coord.x + topRadius, coord.y - topHeight, coord.x + topRadius / 1.6, coord.y - topRadius, coord.x, coord.y);
|
|
3457
3453
|
ctx.bezierCurveTo(coord.x, coord.y, coord.x - topRadius / 1.6, coord.y - topRadius, coord.x - topRadius, coord.y - topHeight);
|
|
@@ -3461,13 +3457,7 @@
|
|
|
3461
3457
|
|
|
3462
3458
|
ctx.fillStyle = '#FFF';
|
|
3463
3459
|
ctx.beginPath();
|
|
3464
|
-
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2, Math.PI * 2, 0);
|
|
3465
|
-
ctx.fill();
|
|
3466
|
-
/* Fill marker exact location */
|
|
3467
|
-
|
|
3468
|
-
ctx.fillStyle = outlineColor;
|
|
3469
|
-
ctx.beginPath();
|
|
3470
|
-
ctx.arc(coord.x, coord.y, 2, Math.PI * 2, 0);
|
|
3460
|
+
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
|
|
3471
3461
|
ctx.fill();
|
|
3472
3462
|
};
|
|
3473
3463
|
|
|
@@ -3563,7 +3553,7 @@
|
|
|
3563
3553
|
|
|
3564
3554
|
MapPin.prototype.drawMarker = function (ctx) {
|
|
3565
3555
|
if (isDefined(this.x) && isDefined(this.y)) {
|
|
3566
|
-
WMDrawMarker(ctx, this.x, this.y, '#
|
|
3556
|
+
WMDrawMarker(ctx, this.x, this.y, '#051039');
|
|
3567
3557
|
}
|
|
3568
3558
|
};
|
|
3569
3559
|
|
|
@@ -4474,6 +4464,7 @@
|
|
|
4474
4464
|
|
|
4475
4465
|
ctx.font = '10px Helvetica';
|
|
4476
4466
|
ctx.textBaseline = 'middle';
|
|
4467
|
+
ctx.textAlign = 'left';
|
|
4477
4468
|
|
|
4478
4469
|
if (isDefined(this.mouseGeoCoordXY)) {
|
|
4479
4470
|
var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
|
|
@@ -4505,6 +4496,30 @@
|
|
|
4505
4496
|
|
|
4506
4497
|
ctx.fillStyle = '#000000';
|
|
4507
4498
|
ctx.fillText("Map projection: " + this.srs, 5, this.height - 26);
|
|
4499
|
+
/* Show layer metadata */
|
|
4500
|
+
|
|
4501
|
+
if (this.showLayerInfo === true) {
|
|
4502
|
+
var metadataX = 100;
|
|
4503
|
+
var metadataY = 100;
|
|
4504
|
+
var dimStartX = 150;
|
|
4505
|
+
var rowHeight = 26;
|
|
4506
|
+
var rowNumber = 0;
|
|
4507
|
+
drawTextBG(ctx, 'Layer name', metadataX, metadataY + rowNumber * rowHeight, 10);
|
|
4508
|
+
drawTextBG(ctx, 'Dimensions', metadataX + dimStartX, metadataY + rowNumber * rowHeight, 10);
|
|
4509
|
+
rowNumber += 1;
|
|
4510
|
+
|
|
4511
|
+
for (var j = 0; j < this.layers.length; j += 1) {
|
|
4512
|
+
var layer = this.layers[j];
|
|
4513
|
+
drawTextBG(ctx, "#" + j + ":" + layer.name, metadataX, metadataY + rowNumber * rowHeight, 10);
|
|
4514
|
+
|
|
4515
|
+
for (var d = 0; d < layer.dimensions.length; d += 1) {
|
|
4516
|
+
var dimension = layer.dimensions[d];
|
|
4517
|
+
drawTextBG(ctx, dimension.name + " = " + dimension.currentValue, metadataX + d * 200 + dimStartX, metadataY + rowNumber * rowHeight, 10);
|
|
4518
|
+
}
|
|
4519
|
+
|
|
4520
|
+
rowNumber += 1;
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4508
4523
|
};
|
|
4509
4524
|
/* Is called when the WebMapJS object is created */
|
|
4510
4525
|
|