@sapui5/sap.ui.vbm 1.139.0 → 1.140.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/package.json +1 -1
- package/src/sap/ui/vbm/.library +1 -1
- package/src/sap/ui/vbm/Adapter.js +1 -1
- package/src/sap/ui/vbm/Adapter3D.js +1 -1
- package/src/sap/ui/vbm/Viewport.js +1 -1
- package/src/sap/ui/vbm/adapter3d/ColladaBounds.js +1 -1
- package/src/sap/ui/vbm/adapter3d/DragDropHandler.js +1 -1
- package/src/sap/ui/vbm/adapter3d/ModelHandler.js +1 -1
- package/src/sap/ui/vbm/adapter3d/ObjectFactory.js +1 -1
- package/src/sap/ui/vbm/adapter3d/PolygonHandler.js +1 -1
- package/src/sap/ui/vbm/adapter3d/RectangleTracker.js +1 -1
- package/src/sap/ui/vbm/adapter3d/SceneBuilder.js +1 -1
- package/src/sap/ui/vbm/adapter3d/VBIJSONParser.js +1 -1
- package/src/sap/ui/vbm/library.js +2 -2
- package/src/sap/ui/vbm/vector/MapRenderer.js +66 -25
- package/src/sap/ui/vbm/vector/PayloadGenerator.js +1 -1
- package/src/sap/ui/vbm/vector/RectangularSelection.js +1 -1
- package/src/sap/ui/vbm/vector/VBITransformer.js +42 -3
- package/src/sap/ui/vbm/vector/VectorUtils.js +70 -4
package/package.json
CHANGED
package/src/sap/ui/vbm/.library
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<name>sap.ui.vbm</name>
|
|
4
4
|
<vendor>SAP SE</vendor>
|
|
5
5
|
<copyright>SAP UI development toolkit for HTML5 (SAPUI5) (c) Copyright 2009-2012 SAP AG. All rights reserved</copyright>
|
|
6
|
-
<version>1.
|
|
6
|
+
<version>1.140.0</version>
|
|
7
7
|
|
|
8
8
|
<documentation>SAP UI library: sap.ui.vbm</documentation>
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ sap.ui.define([
|
|
|
24
24
|
* @param {string} [sId] id for the new control, generated automatically if no id is given
|
|
25
25
|
* @param {object} [mSettings] initial settings for the new object
|
|
26
26
|
* @author SAP SE
|
|
27
|
-
* @version 1.
|
|
27
|
+
* @version 1.140.0
|
|
28
28
|
* @extends sap.ui.core.Element
|
|
29
29
|
* @constructor
|
|
30
30
|
* @public
|
|
@@ -47,7 +47,7 @@ sap.ui.define([
|
|
|
47
47
|
* @param {string} [sId] id for the new control, generated automatically if no id is given
|
|
48
48
|
* @param {object} [mSettings] initial settings for the new object
|
|
49
49
|
* @author SAP SE
|
|
50
|
-
* @version 1.
|
|
50
|
+
* @version 1.140.0
|
|
51
51
|
* @extends sap.ui.core.Element
|
|
52
52
|
* @constructor
|
|
53
53
|
* @public
|
|
@@ -22,7 +22,7 @@ sap.ui.define([
|
|
|
22
22
|
*
|
|
23
23
|
* @private
|
|
24
24
|
* @author SAP SE
|
|
25
|
-
* @version 1.
|
|
25
|
+
* @version 1.140.0
|
|
26
26
|
* @alias sap.ui.vbm.adapter3d.ColladaBounds
|
|
27
27
|
*/
|
|
28
28
|
var ColladaBounds = BaseObject.extend("sap.ui.vbm.adapter3d.ColladaBounds", /** @lends sap.ui.vbm.adapter3d.ColladaBounds.prototype */ {
|
|
@@ -83,7 +83,7 @@ sap.ui.define([
|
|
|
83
83
|
*
|
|
84
84
|
* @private
|
|
85
85
|
* @author SAP SE
|
|
86
|
-
* @version 1.
|
|
86
|
+
* @version 1.140.0
|
|
87
87
|
* @alias sap.ui.vbm.adapter3d.DragDropHandler
|
|
88
88
|
*/
|
|
89
89
|
var DragDropHandler = BaseObject.extend("sap.ui.vbm.adapter3d.DragDropHandler", /** @lends sap.ui.vbm.adapter3d.DragDropHandler.prototype */ {
|
|
@@ -29,7 +29,7 @@ sap.ui.define([
|
|
|
29
29
|
*
|
|
30
30
|
* @private
|
|
31
31
|
* @author SAP SE
|
|
32
|
-
* @version 1.
|
|
32
|
+
* @version 1.140.0
|
|
33
33
|
* @alias sap.ui.vbm.adapter3d.ModelHandler
|
|
34
34
|
*/
|
|
35
35
|
var ModelHandler = BaseObject.extend("sap.ui.vbm.adapter3d.ModelHandler", /** @lends sap.ui.vbm.adapter3d.ModelHandler.prototype */ {
|
|
@@ -377,7 +377,7 @@ sap.ui.define([
|
|
|
377
377
|
*
|
|
378
378
|
* @private
|
|
379
379
|
* @author SAP SE
|
|
380
|
-
* @version 1.
|
|
380
|
+
* @version 1.140.0
|
|
381
381
|
* @alias sap.ui.vbm.adapter3d.ObjectFactory
|
|
382
382
|
*/
|
|
383
383
|
var ObjectFactory = BaseObject.extend("sap.ui.vbm.adapter3d.ObjectFactory", /** @lends sap.ui.vbm.adapter3d.ObjectFactory.prototype */ {});
|
|
@@ -32,7 +32,7 @@ sap.ui.define([
|
|
|
32
32
|
*
|
|
33
33
|
* @private
|
|
34
34
|
* @author SAP SE
|
|
35
|
-
* @version 1.
|
|
35
|
+
* @version 1.140.0
|
|
36
36
|
* @alias sap.ui.vbm.adapter3d.PolygonHandler
|
|
37
37
|
*/
|
|
38
38
|
var PolygonHandler = BaseObject.extend("sap.ui.vbm.adapter3d.PolygonHandler", /** @lends sap.ui.vbm.adapter3d.PolygonHandler.prototype */ {
|
|
@@ -39,7 +39,7 @@ sap.ui.define([
|
|
|
39
39
|
*
|
|
40
40
|
* @private
|
|
41
41
|
* @author SAP SE
|
|
42
|
-
* @version 1.
|
|
42
|
+
* @version 1.140.0
|
|
43
43
|
* @alias sap.ui.vbm.adapter3d.RectangleTracker
|
|
44
44
|
*/
|
|
45
45
|
var RectangleTracker = BaseObject.extend("sap.ui.vbm.adapter3d.RectangleTracker", /** @lends sap.ui.vbm.adapter3d.RectangleTracker.prototype */ {
|
|
@@ -47,7 +47,7 @@ sap.ui.define([
|
|
|
47
47
|
*
|
|
48
48
|
* @private
|
|
49
49
|
* @author SAP SE
|
|
50
|
-
* @version 1.
|
|
50
|
+
* @version 1.140.0
|
|
51
51
|
* @alias sap.ui.vbm.adapter3d.SceneBuilder
|
|
52
52
|
*/
|
|
53
53
|
var SceneBuilder = BaseObject.extend("sap.ui.vbm.adapter3d.SceneBuilder", /** @lends sap.ui.vbm.adapter3d.SceneBuilder.prototype */ {
|
|
@@ -56,7 +56,7 @@ sap.ui.define([
|
|
|
56
56
|
*
|
|
57
57
|
* @private
|
|
58
58
|
* @author SAP SE
|
|
59
|
-
* @version 1.
|
|
59
|
+
* @version 1.140.0
|
|
60
60
|
* @alias sap.ui.vbm.adapter3d.VBIJSONParser
|
|
61
61
|
*/
|
|
62
62
|
var VBIJSONParser = BaseObject.extend("sap.ui.vbm.adapter3d.VBIJSONParser", /** @lends sap.ui.vbm.adapter3d.VBIJSONParser.prototype */ {
|
|
@@ -20,7 +20,7 @@ sap.ui.define([
|
|
|
20
20
|
* @namespace
|
|
21
21
|
* @alias sap.ui.vbm
|
|
22
22
|
* @author SAP SE
|
|
23
|
-
* @version 1.
|
|
23
|
+
* @version 1.140.0
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
26
|
|
|
@@ -46,7 +46,7 @@ sap.ui.define([
|
|
|
46
46
|
"sap.ui.vbm.ClusterBase", "sap.ui.vbm.ClusterTree", "sap.ui.vbm.ClusterGrid", "sap.ui.vbm.ClusterDistance", "sap.ui.vbm.Heatmap",
|
|
47
47
|
"sap.ui.vbm.HeatPoint", "sap.ui.vbm.ClusterContainer", "sap.ui.vbm.Adapter", "sap.ui.vbm.Adapter3D"
|
|
48
48
|
],
|
|
49
|
-
version: "1.
|
|
49
|
+
version: "1.140.0"
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
sap.ui.loader.config({
|
|
@@ -39,7 +39,7 @@ sap.ui.define([
|
|
|
39
39
|
let fixedBounds;
|
|
40
40
|
var containerID;
|
|
41
41
|
let previousCenter = null;
|
|
42
|
-
|
|
42
|
+
let previousZoom = null;
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
@@ -59,11 +59,11 @@ sap.ui.define([
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
VBI.MapRenderer.renderMap = () => {
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
if (this.map) {
|
|
64
64
|
previousCenter = this.map.getCenter();
|
|
65
65
|
previousZoom = this.map.getZoom();
|
|
66
|
-
this.map.remove();
|
|
66
|
+
this.map.remove();
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
let geoJSON = VBI.VBITransformer.getTransformedJSON();
|
|
@@ -76,6 +76,7 @@ sap.ui.define([
|
|
|
76
76
|
document.head.appendChild(styleSheet);
|
|
77
77
|
|
|
78
78
|
const map = VectorUtils.createMap(geoJSON, map_container);
|
|
79
|
+
map.doubleClickZoom.disable();
|
|
79
80
|
|
|
80
81
|
if (previousCenter && previousZoom !== null) {
|
|
81
82
|
map.jumpTo({
|
|
@@ -104,13 +105,13 @@ sap.ui.define([
|
|
|
104
105
|
map.on('load', () => {
|
|
105
106
|
|
|
106
107
|
map.getCanvas().style.cursor = 'default';
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
map.on('mouseup', function () {
|
|
109
|
+
map.getCanvas().style.cursor = 'default';
|
|
110
|
+
});
|
|
111
|
+
map.getCanvas().addEventListener('mousemove', function () {
|
|
112
|
+
map.getCanvas().style.cursor = 'default';
|
|
113
|
+
});
|
|
114
|
+
|
|
114
115
|
if (VBI.mapFlags.isLegendExists) {
|
|
115
116
|
// Legend control
|
|
116
117
|
VBI.VBITransformer._createLegend(map_container);
|
|
@@ -163,8 +164,12 @@ sap.ui.define([
|
|
|
163
164
|
if (marker.geometry.type === 'Point') {
|
|
164
165
|
// create a DOM element for the marker (parent div)
|
|
165
166
|
const el = VectorUtils.createSpotElement(marker);
|
|
167
|
+
if (marker.properties.Label) {
|
|
168
|
+
const child_e1 = VectorUtils.createMarkerLabel(marker.properties.Label, marker.properties.LabelBGColor);
|
|
169
|
+
el.appendChild(child_e1);
|
|
170
|
+
}
|
|
166
171
|
if (marker.properties.Icon) {
|
|
167
|
-
const iconColor = marker.properties.contentColor? marker.properties.contentColor : "#000000";
|
|
172
|
+
const iconColor = marker.properties.contentColor ? marker.properties.contentColor : "#000000";
|
|
168
173
|
// Create child element for the SAP icon (icon overlay)
|
|
169
174
|
const child_el = VectorUtils.createIconElement(marker.properties.Icon, iconColor);
|
|
170
175
|
child_el.id = '__mapspot' + spotid++;
|
|
@@ -477,6 +482,10 @@ sap.ui.define([
|
|
|
477
482
|
PayloadGenerator.objectClick('Spot', event, marker, clickCoordinates);
|
|
478
483
|
};
|
|
479
484
|
|
|
485
|
+
el.addEventListener('dblclick', (e) => {
|
|
486
|
+
triggerPayloadSpot(e, 'DOUBLE_CLICK');
|
|
487
|
+
});
|
|
488
|
+
|
|
480
489
|
el.addEventListener('click', (e) => {
|
|
481
490
|
//Trigger payload
|
|
482
491
|
triggerPayloadSpot(e, 'DETAIL_REQUEST');
|
|
@@ -504,6 +513,16 @@ sap.ui.define([
|
|
|
504
513
|
predefinedMarkers.push(markerCoordinates);
|
|
505
514
|
}
|
|
506
515
|
} else if (marker.geometry.type == "LineString") {
|
|
516
|
+
|
|
517
|
+
const colorStr = marker.properties.LineColor;
|
|
518
|
+
let textColor = '#000000'; // Default color
|
|
519
|
+
|
|
520
|
+
if (colorStr) {
|
|
521
|
+
const [r, g, b, a] = VectorUtils.parseRGBAString(colorStr);
|
|
522
|
+
textColor = VectorUtils.getContrastTextColor(r, g, b);
|
|
523
|
+
marker.properties.labelHaloColor = `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
524
|
+
}
|
|
525
|
+
marker.properties.textColor = textColor;
|
|
507
526
|
const coords = marker.geometry.coordinates;
|
|
508
527
|
const startCoord = coords[0]; // First coordinate
|
|
509
528
|
const endCoord = coords[coords.length - 1]; // Last coordinate
|
|
@@ -559,10 +578,10 @@ sap.ui.define([
|
|
|
559
578
|
}
|
|
560
579
|
|
|
561
580
|
});
|
|
562
|
-
if(VBI.mapFlags.automations){
|
|
581
|
+
if (VBI.mapFlags.automations) {
|
|
563
582
|
let automations = new SAPAutomationManager(map, maplibregl.LngLatBounds);
|
|
564
583
|
automations.load(VBI.mapFlags.automations);
|
|
565
|
-
|
|
584
|
+
}
|
|
566
585
|
map.addLayer({
|
|
567
586
|
'id': 'geojson-source-point',
|
|
568
587
|
'type': 'circle',
|
|
@@ -602,6 +621,30 @@ sap.ui.define([
|
|
|
602
621
|
},
|
|
603
622
|
'filter': ['==', '$type', 'LineString']
|
|
604
623
|
});
|
|
624
|
+
|
|
625
|
+
map.addLayer({
|
|
626
|
+
id: 'line-labels',
|
|
627
|
+
type: 'symbol',
|
|
628
|
+
source: 'geojson-source',
|
|
629
|
+
layout: {
|
|
630
|
+
'symbol-placement': 'line-center',
|
|
631
|
+
'text-field': ['get', 'Label'],
|
|
632
|
+
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'],
|
|
633
|
+
'text-size': 14,
|
|
634
|
+
'text-rotation-alignment': 'map',
|
|
635
|
+
'text-keep-upright': true
|
|
636
|
+
},
|
|
637
|
+
paint: {
|
|
638
|
+
'text-color': ['get', 'lineLabelTextColor'],
|
|
639
|
+
'text-halo-color': ['get', 'labelHaloColor'],
|
|
640
|
+
'text-halo-width': 4,
|
|
641
|
+
'text-halo-blur': 0.8,
|
|
642
|
+
'text-opacity': ['get', 'opacity']
|
|
643
|
+
},
|
|
644
|
+
|
|
645
|
+
filter: ['all', ['==', ['get', 'ShowLabel'], true]]
|
|
646
|
+
});
|
|
647
|
+
|
|
605
648
|
// Create a new FeatureCollection for the points
|
|
606
649
|
const pointGeoJSON = {
|
|
607
650
|
'type': 'FeatureCollection',
|
|
@@ -650,8 +693,8 @@ sap.ui.define([
|
|
|
650
693
|
}
|
|
651
694
|
});
|
|
652
695
|
});
|
|
653
|
-
|
|
654
696
|
});
|
|
697
|
+
|
|
655
698
|
// Change mouse cursor when hovering over the line
|
|
656
699
|
map.on('mouseenter', 'geojson-source-route', function (event) {
|
|
657
700
|
if (!that.Apressed && !that.Rpressed) {
|
|
@@ -715,14 +758,12 @@ sap.ui.define([
|
|
|
715
758
|
}
|
|
716
759
|
popupLink.remove();
|
|
717
760
|
});
|
|
761
|
+
|
|
718
762
|
map.on('click', 'geojson-source-route', function (e) {
|
|
719
763
|
//Trigger payload
|
|
720
764
|
triggerPayloadRoute(e, 'DETAIL_REQUEST');
|
|
721
765
|
});
|
|
722
|
-
|
|
723
|
-
// //Trigger payload
|
|
724
|
-
// triggerPayloadRoute(e, 'DETAIL_REQUEST');
|
|
725
|
-
// });
|
|
766
|
+
|
|
726
767
|
function triggerPayloadRoute(e, event) {
|
|
727
768
|
// Get the mouse coordinates within the map container
|
|
728
769
|
const offsetX = e.offsetX;
|
|
@@ -740,7 +781,7 @@ sap.ui.define([
|
|
|
740
781
|
function triggerPayloaddnd() {
|
|
741
782
|
PayloadGenerator.objectDrop(action, dropItems);
|
|
742
783
|
}
|
|
743
|
-
|
|
784
|
+
|
|
744
785
|
map.on('mousedown', 'geojson-source-route', (e) => {
|
|
745
786
|
dragInstance = map.queryRenderedFeatures(e.point, {
|
|
746
787
|
layers: ['geojson-source-route']
|
|
@@ -771,7 +812,7 @@ sap.ui.define([
|
|
|
771
812
|
map.on('mousemove', onMove);
|
|
772
813
|
map.on('mouseup', onUp);
|
|
773
814
|
|
|
774
|
-
|
|
815
|
+
|
|
775
816
|
if (!that.Apressed && !that.Rpressed) {
|
|
776
817
|
map.getCanvas().style.cursor = 'pointer';
|
|
777
818
|
}
|
|
@@ -826,10 +867,10 @@ sap.ui.define([
|
|
|
826
867
|
}
|
|
827
868
|
|
|
828
869
|
// Reset cursor and remove event listeners
|
|
829
|
-
map.getCanvas().style.cursor = 'default';
|
|
870
|
+
map.getCanvas().style.cursor = 'default';
|
|
830
871
|
setTimeout(() => {
|
|
831
|
-
map.getCanvas().style.cursor = 'default';
|
|
832
|
-
}, 100);
|
|
872
|
+
map.getCanvas().style.cursor = 'default';
|
|
873
|
+
}, 100);
|
|
833
874
|
map.off('mousemove', onMove);
|
|
834
875
|
map.off('mouseup', onUp);
|
|
835
876
|
lineDrag = false;
|
|
@@ -856,12 +897,12 @@ sap.ui.define([
|
|
|
856
897
|
map.getCanvas().style.cursor = validDrop ? 'copy' : 'not-allowed';
|
|
857
898
|
}
|
|
858
899
|
else {
|
|
859
|
-
|
|
900
|
+
|
|
860
901
|
map.getCanvas().style.cursor = 'default';
|
|
861
902
|
}
|
|
862
903
|
}
|
|
863
904
|
}
|
|
864
|
-
|
|
905
|
+
|
|
865
906
|
mapCanvas.oncontextmenu = (e) => {
|
|
866
907
|
e.preventDefault();
|
|
867
908
|
// Get the mouse coordinates within the map container
|
|
@@ -320,7 +320,6 @@ sap.ui.define([
|
|
|
320
320
|
let routeProperties = {
|
|
321
321
|
"GeoPosition": currRoute.A ? currRoute.A : "",
|
|
322
322
|
"ToolTip": currRoute.B ? currRoute.B : "",
|
|
323
|
-
"Label": currRoute.L ? currRoute.L : "",
|
|
324
323
|
"LabelBGColor": currRoute.LC ? currRoute.LC : "",
|
|
325
324
|
"LabelAlignment": currRoute.LA ? currRoute.LA : "",
|
|
326
325
|
"Color": currRoute.C ? VectorUtils.argbToRgba(currRoute.C) : "",
|
|
@@ -337,10 +336,30 @@ sap.ui.define([
|
|
|
337
336
|
"DotWidth": currRoute.DW ? currRoute.DW : "",
|
|
338
337
|
"DotColor": currRoute.DC ? currRoute.DC : "",
|
|
339
338
|
"LineDash": currRoute.LD ? currRoute.LD : "",
|
|
339
|
+
"LineColor": currRoute.F ? currRoute.F : "",
|
|
340
340
|
"DirectionIndicator": currRoute.DI ? currRoute.DI : "",
|
|
341
341
|
"DragData": currRoute.DD ? currRoute.DD : "",
|
|
342
342
|
"type": "{00100000-2012-0004-B001-C46BD7336A1A}"
|
|
343
343
|
};
|
|
344
|
+
let labeledRoutes = new Set();
|
|
345
|
+
if (currRoute.L) {
|
|
346
|
+
routeProperties["Label"] = currRoute.L;
|
|
347
|
+
// ✅ Only label the first route with this Label
|
|
348
|
+
if (!labeledRoutes.has(currRoute.L)) {
|
|
349
|
+
routeProperties["ShowLabel"] = true;
|
|
350
|
+
labeledRoutes.add(currRoute.L);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const colorStr = currRoute.F;
|
|
354
|
+
routeProperties["lineLabelTextColor"] = '#000000'; // Default color
|
|
355
|
+
|
|
356
|
+
if (colorStr) {
|
|
357
|
+
const [r, g, b, a] = VectorUtils.parseRGBAString(colorStr);
|
|
358
|
+
routeProperties["lineLabelTextColor"] = VectorUtils.getContrastTextColor(r, g, b);
|
|
359
|
+
const { hexColor, opacity } = VectorUtils.rgbaToHexAndOpacity(colorStr);
|
|
360
|
+
routeProperties["labelHaloColor"] = hexColor;
|
|
361
|
+
routeProperties["opacity"] = opacity;
|
|
362
|
+
}
|
|
344
363
|
|
|
345
364
|
//itearate through the route points and add the coordinates to the GeoJSON
|
|
346
365
|
let coord_array = currRoute.H.split(";");
|
|
@@ -360,7 +379,7 @@ sap.ui.define([
|
|
|
360
379
|
"properties": routeProperties,
|
|
361
380
|
"geometry": geometry,
|
|
362
381
|
// "id" : currRoute['VB:ix'],
|
|
363
|
-
"id": route_id
|
|
382
|
+
"id": route_id++
|
|
364
383
|
};
|
|
365
384
|
let indexNum = featureCollection.findIndex(item => item.properties.Key === route_data.properties.Key)
|
|
366
385
|
if (indexNum !== -1) {
|
|
@@ -378,7 +397,6 @@ sap.ui.define([
|
|
|
378
397
|
let routeProperties = {
|
|
379
398
|
"GeoPosition": currRoute.A ? currRoute.A : "",
|
|
380
399
|
"ToolTip": currRoute.B ? currRoute.B : "",
|
|
381
|
-
"Label": currRoute.L ? currRoute.L : "",
|
|
382
400
|
"LabelBGColor": currRoute.LC ? currRoute.LC : "",
|
|
383
401
|
"LabelAlignment": currRoute.LA ? currRoute.LA : "",
|
|
384
402
|
"Color": currRoute.C ? VectorUtils.argbToRgba(currRoute.C) : "",
|
|
@@ -395,11 +413,32 @@ sap.ui.define([
|
|
|
395
413
|
"DotWidth": currRoute.DW ? currRoute.DW : "",
|
|
396
414
|
"DotColor": currRoute.DC ? currRoute.DC : "",
|
|
397
415
|
"LineDash": currRoute.LD ? currRoute.LD : "",
|
|
416
|
+
"LineColor": currRoute.F ? currRoute.F : "",
|
|
398
417
|
"DirectionIndicator": currRoute.DI ? currRoute.DI : "",
|
|
399
418
|
"DragData": currRoute.DD ? currRoute.DD : "",
|
|
400
419
|
"type": "{00100000-2012-0004-B001-C46BD7336A1A}"
|
|
420
|
+
|
|
401
421
|
|
|
402
422
|
};
|
|
423
|
+
let labeledRoutes = new Set();
|
|
424
|
+
if (currRoute.L) {
|
|
425
|
+
routeProperties["Label"] = currRoute.L;
|
|
426
|
+
// ✅ Only label the first route with this Label
|
|
427
|
+
if (!labeledRoutes.has(currRoute.L)) {
|
|
428
|
+
routeProperties["ShowLabel"] = true;
|
|
429
|
+
labeledRoutes.add(currRoute.L);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
const colorStr = currRoute.F;
|
|
433
|
+
routeProperties["lineLabelTextColor"] = '#000000'; // Default color
|
|
434
|
+
|
|
435
|
+
if (colorStr) {
|
|
436
|
+
const [r, g, b, a] = VectorUtils.parseRGBAString(colorStr);
|
|
437
|
+
routeProperties["lineLabelTextColor"] = VectorUtils.getContrastTextColor(r, g, b);
|
|
438
|
+
const { hexColor, opacity } = VectorUtils.rgbaToHexAndOpacity(colorStr);
|
|
439
|
+
routeProperties["labelHaloColor"] = hexColor;
|
|
440
|
+
routeProperties["opacity"] = opacity;
|
|
441
|
+
}
|
|
403
442
|
|
|
404
443
|
//itearate through the route points and add the coordinates to the GeoJSON
|
|
405
444
|
let coord_array = currRoute.H.split(";");
|
|
@@ -37,7 +37,7 @@ sap.ui.define([
|
|
|
37
37
|
VectorUtils.createSpotElement = (marker) => {
|
|
38
38
|
// create a DOM element for the marker (parent div)
|
|
39
39
|
const el = document.createElement('div');
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
// Set background image for the marker
|
|
42
42
|
var base64decoded = "data:image/png;base64," + marker.properties.base64;
|
|
43
43
|
el.style.backgroundImage = `url(${base64decoded})`;
|
|
@@ -65,10 +65,10 @@ sap.ui.define([
|
|
|
65
65
|
return child_el;
|
|
66
66
|
}
|
|
67
67
|
//Function to set the canvas id
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
VectorUtils._setcanvasid = () => {
|
|
69
|
+
var mapCanvas = '__mapcanvas';
|
|
70
70
|
return mapCanvas;
|
|
71
|
-
|
|
71
|
+
}
|
|
72
72
|
|
|
73
73
|
VectorUtils.createDropdownMenu = (menuData) => {
|
|
74
74
|
const dropdown = document.createElement('div');
|
|
@@ -232,6 +232,72 @@ sap.ui.define([
|
|
|
232
232
|
|
|
233
233
|
return windowContainer;
|
|
234
234
|
};
|
|
235
|
+
|
|
236
|
+
VectorUtils.createMarkerLabel = (label, labelcolor) => {
|
|
237
|
+
var r, g, b, a;
|
|
238
|
+
const obj = document.createElement('div');
|
|
239
|
+
obj.className = 'marker-label';
|
|
240
|
+
obj.textContent = label;
|
|
241
|
+
obj.style.color = labelcolor;
|
|
242
|
+
obj.style.position = 'absolute';
|
|
243
|
+
obj.style.top = '100%';
|
|
244
|
+
if (!labelcolor) {
|
|
245
|
+
[r, g, b, a] = [211, 211, 211, 1];
|
|
246
|
+
} else {
|
|
247
|
+
[r, g, b, a] = VectorUtils.parseRGBAString(labelcolor);
|
|
248
|
+
}
|
|
249
|
+
obj.style.backgroundColor = `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
250
|
+
obj.style.border = `2px solid rgba(${r}, ${g}, ${b}, ${a})`;
|
|
251
|
+
const textColor = VectorUtils.getContrastTextColor(r, g, b);
|
|
252
|
+
obj.style.color = textColor;
|
|
253
|
+
obj.style.fontFamily = 'Arial, sans-serif';
|
|
254
|
+
obj.style.fontSize = '14px';
|
|
255
|
+
return obj;
|
|
256
|
+
}
|
|
257
|
+
VectorUtils.rgbaToHexAndOpacity = (rgbaString) => {
|
|
258
|
+
const rgbaRegex = /rgba?\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d*\.?\d+)\s*\)/i;
|
|
259
|
+
const match = rgbaString.match(rgbaRegex);
|
|
260
|
+
|
|
261
|
+
if (!match) {
|
|
262
|
+
throw new Error("Invalid RGBA format");
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const r = parseInt(match[1], 10);
|
|
266
|
+
const g = parseInt(match[2], 10);
|
|
267
|
+
const b = parseInt(match[3], 10);
|
|
268
|
+
const a = parseFloat(match[4]);
|
|
269
|
+
|
|
270
|
+
const toHex = (value) => value.toString(16).padStart(2, '0');
|
|
271
|
+
|
|
272
|
+
const hex = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
hexColor: hex,
|
|
276
|
+
opacity: a
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
VectorUtils.parseRGBAString = (rgbaStr) => {
|
|
282
|
+
const match = rgbaStr.match(/rgba?\s*\(\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)\s*\)/i);
|
|
283
|
+
|
|
284
|
+
if (!match) return null;
|
|
285
|
+
|
|
286
|
+
const r = parseInt(match[1]);
|
|
287
|
+
const g = parseInt(match[2]);
|
|
288
|
+
const b = parseInt(match[3]);
|
|
289
|
+
const a = parseInt(match[4]) / 255;
|
|
290
|
+
|
|
291
|
+
return [r, g, b, parseFloat(a.toFixed(3))];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
VectorUtils.getContrastTextColor = (r, g, b) => {
|
|
295
|
+
if (r === 0 && g === 0 && b === 0) {
|
|
296
|
+
return '#000000';
|
|
297
|
+
}
|
|
298
|
+
const brightness = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
299
|
+
return brightness < 128 ? '#FFFFFF' : '#000000';
|
|
300
|
+
}
|
|
235
301
|
VectorUtils.createSubCaption = (item) => {
|
|
236
302
|
const obj = document.createElement('div');
|
|
237
303
|
obj.setAttribute("role", sap.ui.core.AccessibleRole.Secondary);
|