@sapui5/sap.ui.vbm 1.134.1 → 1.136.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ui.vbm",
3
- "version": "1.134.1",
3
+ "version": "1.136.0",
4
4
  "description": "SAPUI5 Library sap.ui.vbm",
5
5
  "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
6
6
  "author": "SAP SE (https://www.sap.com)",
@@ -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.134.1</version>
6
+ <version>1.136.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.134.1
27
+ * @version 1.136.0
28
28
  * @extends sap.ui.core.Element
29
29
  * @constructor
30
30
  * @public
@@ -274,16 +274,16 @@ sap.ui.define([
274
274
  for (const MapProvider in MapProviders) {
275
275
  if (MapProviders.hasOwnProperty(MapProvider)) {
276
276
  let Provider = MapProviders[MapProvider];
277
- if (Provider.name == currRefMap && Provider.type == "vector") {
277
+ if (Provider.name == currRefMap && Provider.type == "V") {
278
278
  return true;
279
- } else if (Provider.name == currRefMap && (Provider.type == "raster" || Provider.type == "")) {
279
+ } else if (Provider.name == currRefMap && (Provider.type == "")) {
280
280
  return false;
281
281
  }
282
282
  }
283
283
  }
284
- } else if (MapProviders.name == currRefMap && MapProviders.type == "vector") {
284
+ } else if (MapProviders.name == currRefMap && MapProviders.type == "V") {
285
285
  return true;
286
- } else if (MapProviders.name == currRefMap && (MapProviders.type == "raster" || MapProviders.type == "")) {
286
+ } else if (MapProviders.name == currRefMap && (MapProviders.type == "")) {
287
287
  return false;
288
288
  }
289
289
  }
@@ -291,7 +291,7 @@ sap.ui.define([
291
291
  var mapLayerStack = obj?.SAPVB?.Scenes?.Merge?.SceneGeo?.refMapLayerStack
292
292
  if (mapLayerStack) {
293
293
  const provider = this._mapConfiguration.MapProvider.find(provider => provider.name === mapLayerStack);
294
- return provider.type === "vector" ? true : false;
294
+ return provider.type === "V" ? true : false;
295
295
  }
296
296
  }
297
297
  }
@@ -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.134.1
50
+ * @version 1.136.0
51
51
  * @extends sap.ui.core.Element
52
52
  * @constructor
53
53
  * @public
@@ -106,13 +106,23 @@ sap.ui.define([
106
106
  // on abap systems the GeoJSON is requested from this handler................//
107
107
  AnalyticMap.DefaultABAPGeoJSONURL = "/sap/bc/vbi/geojson/L0.json";
108
108
  AnalyticMap.DefaultGeoJSONURL = "media/analyticmap/L0.json";
109
- AnalyticMap.DefaultRegionColor = (Parameters && Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBG")) ? Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBG") : "rgb(213,218,221)";
110
- AnalyticMap.DefaultRegionColorBorder = (Parameters && Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBorder")) ? Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBorder") : "rgb(255,255,255)";
111
109
  AnalyticMap.DefaultRegionSelectColor = "RHLSA(0;1;1;1)"; // no change!
112
110
  AnalyticMap.DefaultHotDeltaColor = "RHLSA(0;1;1;1.0)"; // default regions should not be hot
113
- AnalyticMap.AltBorderColor = (Parameters && Parameters.get("_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor")) ? Parameters.get("_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor") : "#676767";
114
111
  // reduce opacity to 60%
115
- var nonSelectOpacity = (Parameters && Parameters.get("_sap_ui_vbm_shared_ChartDataPointNotSelectedBackgroundOpacity") ? Parameters.get("_sap_ui_vbm_shared_ChartDataPointNotSelectedBackgroundOpacity") : "0.6");
112
+ var nonSelectOpacity = "0.6";
113
+ let values = Parameters.get({
114
+ name: [
115
+ "_sap_ui_vbm_shared_ChoroplethRegionBG",
116
+ "_sap_ui_vbm_shared_ChoroplethRegionBorder",
117
+ "_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor",
118
+ "_sap_ui_vbm_shared_ChartDataPointNotSelectedBackgroundOpacity"
119
+ ] });
120
+
121
+ AnalyticMap.DefaultRegionColor = values?values["_sap_ui_vbm_shared_ChoroplethRegionBG"] : "rgb(213,218,221)";
122
+ AnalyticMap.DefaultRegionColorBorder = values?values["_sap_ui_vbm_shared_ChoroplethRegionBorder"] : "rgb(255,255,255)";
123
+ AnalyticMap.AltBorderColor = values?values["_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor"] : "#676767";
124
+ nonSelectOpacity = values?values["_sap_ui_vbm_shared_ChartDataPointNotSelectedBackgroundOpacity"] : "0.6";
125
+
116
126
  AnalyticMap.DefaultRegionNonSelectColor = "RHLSA(0;1;1;" + nonSelectOpacity + ")";
117
127
 
118
128
  // ...........................................................................//
@@ -976,13 +986,14 @@ sap.ui.define([
976
986
  AnalyticMap.prototype.applyTheming = function(aRegions) {
977
987
  if (Parameters) { // only if theming parameters are available
978
988
  var sColC = AnalyticMap.DefaultRegionColor;
979
- if (Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBG") != undefined) {
980
- sColC = AnalyticMap.DefaultRegionColor = Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBG");
981
- }
982
989
  var sColCB = AnalyticMap.DefaultRegionColorBorder;
983
- if (Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBorder") != undefined) {
984
- sColCB = AnalyticMap.DefaultRegionColorBorder = Parameters.get("_sap_ui_vbm_shared_ChoroplethRegionBorder");
985
- }
990
+ let oColValues = Parameters.get({
991
+ name: [
992
+ "_sap_ui_vbm_shared_ChoroplethRegionBG",
993
+ "_sap_ui_vbm_shared_ChoroplethRegionBorder"
994
+ ] });
995
+ sColC = AnalyticMap.DefaultRegionColor = oColValues? oColValues["_sap_ui_vbm_shared_ChoroplethRegionBG"] : AnalyticMap.DefaultRegionColor;
996
+ sColCB = AnalyticMap.DefaultRegionColorBorder = oColValues? oColValues["_sap_ui_vbm_shared_ChoroplethRegionBorder"] : AnalyticMap.DefaultRegionColorBorder;
986
997
  if (this.getPlugin()) { // plug-in mode -> make sure color format matches plugin requirements
987
998
  sColC = window.VBI.Utilities.String2VBColor(sColC);
988
999
  sColCB = window.VBI.Utilities.String2VBColor(sColCB);
@@ -219,7 +219,10 @@ sap.ui.define([
219
219
  // do something for initialization...
220
220
  this.mVizObjMap = {};
221
221
  this.mContObjMap = {};
222
- var sDefaultFontFamily = Parameters.get("sapUiFontFamily");
222
+ var sDefaultFontFamily = Parameters.get({
223
+ name: "sapUiFontFamily"
224
+ });
225
+
223
226
  this.setProperty("textSettings", {
224
227
  textcolor: "#000000",
225
228
  textfont: (sDefaultFontFamily) ? sDefaultFontFamily : "Arial, Helvetica, sans-serif",
@@ -465,11 +465,13 @@ sap.ui.define([
465
465
  var oTemp, aResult = [];
466
466
 
467
467
  // Polygones
468
+ var oTempBorder = Parameters.get({
469
+ name: "_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor" });
468
470
  oTemp = {
469
471
  id: this.getId() + "_Polys",
470
472
  type: "{00100000-2012-0004-B001-F311DE491C77}", // Area
471
473
  hotDeltaColor: "RHLSA(0;1;1;1.5)", // increase opacity by 50%
472
- altBorderDeltaColor: (Parameters) ? Parameters.get("_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor") : "#666"
474
+ altBorderDeltaColor: oTempBorder ? oTempBorder : "#666"
473
475
  };
474
476
  // the data source name is equivalent to the controls id..................//
475
477
  oTemp.datasource = oTemp.id;
@@ -481,11 +483,13 @@ sap.ui.define([
481
483
  aResult.push(oTemp);
482
484
 
483
485
  // Lines
486
+ var oTempBorderLines = Parameters.get({
487
+ name: "_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor" });
484
488
  oTemp = {
485
489
  id: this.getId() + "_Lines",
486
490
  type: "{00100000-2012-0004-B001-C46BD7336A1A}", // Route
487
491
  hotDeltaColor: "RHLSA(0;1;1;1.5)", // increase opacity by 50%
488
- altBorderDeltaColor: (Parameters) ? Parameters.get("_sap_ui_vbm_shared_ChartDataPointBorderHoverSelectedColor") : "#666"
492
+ altBorderDeltaColor: oTempBorderLines ? oTempBorderLines : "#666"
489
493
  };
490
494
  // the data source name is equivalent to the controls id..................//
491
495
  oTemp.datasource = oTemp.id;
@@ -190,7 +190,9 @@ sap.ui.define([
190
190
  // set control specific property defaults
191
191
  // explicitly set properties will still be applied later!
192
192
  this.mProperties.contentColor = "#000000";
193
- this.mProperties.contentSize = (Parameters) ? Parameters.get("sapMFontMediumSize") : null;
193
+ var contentSize = Parameters.get({
194
+ name: "sapMFontMediumSize" });
195
+ this.mProperties.contentSize = contentSize ? contentSize : null;
194
196
  };
195
197
 
196
198
  // Implement function defined in VoBase
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  *
24
24
  * @public
25
25
  * @author SAP SE
26
- * @version 1.134.1
26
+ * @version 1.136.0
27
27
  * @extends sap.ui.core.Control
28
28
  * @alias sap.ui.vbm.Viewport
29
29
  */
@@ -335,10 +335,16 @@ sap.ui.define([
335
335
  // // do something for initialization...
336
336
  // };
337
337
 
338
- VoBase.prototype.DefaultColorBad = (Parameters) ? Parameters.get("_sap_ui_vbm_shared_ChartBad") : "rgb(211, 32, 48)";
339
- VoBase.prototype.DefaultColorCritical = (Parameters) ? Parameters.get("_sap_ui_vbm_shared_ChartCritical") : "rgb(225, 123, 36)";
340
- VoBase.prototype.DefaultColorGood = (Parameters) ? Parameters.get("_sap_ui_vbm_shared_ChartGood") : "rgb(97, 166, 86)";
341
- VoBase.prototype.DefaultColorNeutral = (Parameters) ? Parameters.get("_sap_ui_vbm_shared_ChartNeutral") : "rgb(132, 143, 148)";
338
+ var colorParams = Parameters.get({
339
+ name: ["_sap_ui_vbm_shared_ChartBad",
340
+ "_sap_ui_vbm_shared_ChartCritical",
341
+ "_sap_ui_vbm_shared_ChartGood",
342
+ "_sap_ui_vbm_shared_ChartNeutral"] });
343
+
344
+ VoBase.prototype.DefaultColorBad = colorParams? colorParams["_sap_ui_vbm_shared_ChartBad"] : "rgb(211, 32, 48)";
345
+ VoBase.prototype.DefaultColorCritical = colorParams? colorParams["_sap_ui_vbm_shared_ChartCritical"] : "rgb(225, 123, 36)";
346
+ VoBase.prototype.DefaultColorGood = colorParams? colorParams["_sap_ui_vbm_shared_ChartGood"] : "rgb(97, 166, 86)";
347
+ VoBase.prototype.DefaultColorNeutral = colorParams? colorParams["_sap_ui_vbm_shared_ChartNeutral"] : "rgb(132, 143, 148)";
342
348
 
343
349
  // VO Interface implementation ..............................................//
344
350
 
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  *
23
23
  * @private
24
24
  * @author SAP SE
25
- * @version 1.134.1
25
+ * @version 1.136.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.134.1
86
+ * @version 1.136.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.134.1
32
+ * @version 1.136.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.134.1
380
+ * @version 1.136.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.134.1
35
+ * @version 1.136.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.134.1
42
+ * @version 1.136.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.134.1
50
+ * @version 1.136.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.134.1
59
+ * @version 1.136.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.134.1
23
+ * @version 1.136.0
24
24
  * @public
25
25
  */
26
26
 
@@ -45,7 +45,7 @@ sap.ui.define([
45
45
  "sap.ui.vbm.ClusterBase", "sap.ui.vbm.ClusterTree", "sap.ui.vbm.ClusterGrid", "sap.ui.vbm.ClusterDistance", "sap.ui.vbm.Heatmap",
46
46
  "sap.ui.vbm.HeatPoint", "sap.ui.vbm.ClusterContainer", "sap.ui.vbm.Adapter", "sap.ui.vbm.Adapter3D"
47
47
  ],
48
- version: "1.134.1"
48
+ version: "1.136.0"
49
49
  });
50
50
 
51
51
  sap.ui.loader.config({
@@ -10,11 +10,12 @@ sap.ui.define([
10
10
  "./RectangularSelection",
11
11
  "./LassoSelection",
12
12
  "./SAPNavControl",
13
+ "./SAPAutomationManager",
13
14
  "sap/ui/core/Lib",
14
15
  //"../lib/sapscene",
15
16
  "./thirdparty/maplibregl",
16
17
  "./VBITransformer"
17
- ], function (vb, visualobjects, actions, VBIRenderer, VectorUtils, MaplibreStyles, PayloadGenerator, RectangularSelection, LassoSelection,SAPMapNavControl, Lib) {
18
+ ], function (vb, visualobjects, actions, VBIRenderer, VectorUtils, MaplibreStyles, PayloadGenerator, RectangularSelection, LassoSelection, SAPMapNavControl, SAPAutomationManager, Lib) {
18
19
  'use strict';
19
20
  visualobjects = {};
20
21
  VBI.MapRenderer = {};
@@ -26,7 +27,6 @@ sap.ui.define([
26
27
  // let isDrawing = false;
27
28
  // let isCtrlPressed = false;
28
29
  // let lassoPoints = [];
29
- var bounds = [];
30
30
  let predefinedMarkers = [];
31
31
  let allMarkers = [];
32
32
  let lineDrag = false;
@@ -81,9 +81,18 @@ sap.ui.define([
81
81
  map.touchZoomRotate.enable();
82
82
  this.map = map;
83
83
  map.on('load', () => {
84
- if(VBI.mapFlags.isLegendExists){
85
- // Legend control
86
- VBI.VBITransformer._createLegend(map_container);
84
+
85
+ map.getCanvas().style.cursor = 'default';
86
+ map.on('mouseup', function () {
87
+ map.getCanvas().style.cursor = 'default';
88
+ });
89
+ map.getCanvas().addEventListener('mousemove', function () {
90
+ map.getCanvas().style.cursor = 'default';
91
+ });
92
+
93
+ if (VBI.mapFlags.isLegendExists) {
94
+ // Legend control
95
+ VBI.VBITransformer._createLegend(map_container);
87
96
  }
88
97
  // Custom attribution/copyright control
89
98
  map.addControl(new maplibregl.AttributionControl({
@@ -96,25 +105,25 @@ sap.ui.define([
96
105
  maxWidth: 80,
97
106
  unit: geoJSON[0].scaleType
98
107
  })
99
- if(VBI.mapFlags.scaleVisible){
100
- // Scale control in mi,km or nm
101
- map.addControl(scaleControl);
102
- }else if(!VBI.mapFlags.scaleVisible && map.hasControl(scaleControl)){
103
- map.removeControl(scaleControl);
104
- }
105
-
108
+ if (VBI.mapFlags.scaleVisible) {
109
+ // Scale control in mi,km or nm
110
+ map.addControl(scaleControl);
111
+ } else if (!VBI.mapFlags.scaleVisible && map.hasControl(scaleControl)) {
112
+ map.removeControl(scaleControl);
113
+ }
114
+
106
115
  // Parsing GeoJSON for each type of object
107
116
  map.addSource('geojson-source', {
108
117
  'type': 'geojson',
109
118
  'data': geoJSON[1]
110
119
  });
111
120
 
112
- let sapNavControl = new SAPMapNavControl(VBI.mapFlags.moveDisable,VBI.mapFlags.zoomDisable);
113
- if(VBI.mapFlags.navControlVisible){
114
- map.addControl(sapNavControl, 'top-left');
115
- }else if(!VBI.mapFlags.navControlVisible && map.hasControl(sapNavControl)){
116
- map.removeControl(sapNavControl);
117
- }
121
+ let sapNavControl = new SAPMapNavControl(VBI.mapFlags.moveDisable, VBI.mapFlags.zoomDisable);
122
+ if (VBI.mapFlags.navControlVisible) {
123
+ map.addControl(sapNavControl, 'top-left');
124
+ } else if (!VBI.mapFlags.navControlVisible && map.hasControl(sapNavControl)) {
125
+ map.removeControl(sapNavControl);
126
+ }
118
127
 
119
128
  // map.addControl(new SAPMAPLgndControl(), 'top-right');
120
129
  // Create a popup, but don't add it to the map yet.
@@ -123,17 +132,16 @@ sap.ui.define([
123
132
  closeOnClick: false
124
133
  });
125
134
  // add markers to map only for Points
126
- bounds = [];
127
135
  const pointFeatures = [];
128
136
  geoJSON[1].features.forEach((marker) => {
129
137
  let markerCoordinates = marker.geometry.coordinates;
130
138
  if (marker.geometry.type === 'Point') {
131
139
  // create a DOM element for the marker (parent div)
132
140
  const el = VectorUtils.createSpotElement(marker);
133
- el.id = '__mapspot' + spotid++;
134
141
  if (marker.properties.Icon) {
135
142
  // Create child element for the SAP icon (icon overlay)
136
143
  const child_el = VectorUtils.createIconElement(marker.properties.Icon);
144
+ child_el.id = '__mapspot' + spotid++;
137
145
  // Append the icon inside the marker
138
146
  el.appendChild(child_el);
139
147
  }
@@ -141,7 +149,7 @@ sap.ui.define([
141
149
  let spot = new maplibregl.Marker({
142
150
  element: el,
143
151
  draggable: true
144
- // offset: [0, -25]
152
+ // offset: [0, -25]
145
153
  }).setLngLat(marker.geometry.coordinates)
146
154
  .on('dragend', onDragEnd)
147
155
  .addTo(map);
@@ -228,6 +236,7 @@ sap.ui.define([
228
236
  return value * Math.PI / 180;
229
237
  }
230
238
  function onDragEnd(e) {
239
+ map.getCanvas().style.cursor = 'default';
231
240
  let dragItems = [];
232
241
  let dropItems = [];
233
242
  const key = e.target.customProperties;
@@ -237,7 +246,7 @@ sap.ui.define([
237
246
  const features1 = map.queryRenderedFeatures({
238
247
  layers: ['geojson-source-point']
239
248
  });
240
-
249
+
241
250
  features1.forEach((feature, index) => {
242
251
  if (feature.properties && typeof feature.properties.Key !== 'undefined') {
243
252
  console.log(`Feature ${index} key:`, feature.properties.Key);
@@ -253,34 +262,27 @@ sap.ui.define([
253
262
  return false;
254
263
  });
255
264
  console.log('dragInstance:', dragInstance);
256
- if (dragInstance) {
257
- console.log("Matching feature:", dragInstance);
258
- if (dragInstance.properties && dragInstance.properties.DragData) {
259
- const dragData = dragInstance.properties.DragData;
260
- // Normalize dragData to an array if it's not already one
261
- const dragDataArray = Array.isArray(dragData) ? dragData : [dragData];
262
- let parsedDataArray;
263
- try {
264
- parsedDataArray = JSON.parse(dragDataArray);
265
- console.log('Parsed dragData:', parsedDataArray);
266
- } catch (error) {
267
- console.error('Error parsing JSON:', error);
268
- }
269
- if (Array.isArray(parsedDataArray)) {
270
- parsedDataArray.forEach(data => {
271
- if (data.name === "DragSource") {
272
- dragItems.push(data.E.A);
273
- }
274
- });
265
+
266
+ if (VBI.VBITransformer && Array.isArray(VBI.VBITransformer.VisualObjs)) {
267
+ const matchingVO = VBI.VBITransformer.VisualObjs.find(
268
+ VO => VO.type === dragInstance.properties.type
269
+ );
270
+
271
+ if (matchingVO && matchingVO.DragSource && matchingVO.DragSource.DragItem) {
272
+ if (Array.isArray(matchingVO.DragSource.DragItem)) {
273
+ dragItems = matchingVO.DragSource.DragItem.map(item => item.type);
274
+ } else {
275
+ dragItems = [matchingVO.DragSource.DragItem.type];
275
276
  }
276
- console.log("Extracted dragItems:", dragItems);
277
277
  } else {
278
- console.log('No DragData present in the matching feature.');
278
+ dragItems = [];
279
279
  }
280
280
  } else {
281
- console.log('No matching feature found.');
281
+ console.error("VBITransformer.VisualObjs is undefined or not an array.");
282
282
  }
283
283
 
284
+ console.log("Extracted dragItems:", dragItems);
285
+
284
286
  var dropInstance = VBI.MapRenderer.findNearestSpot(pos, features1);
285
287
  console.log('Nearest Spot:', dropInstance);
286
288
  // Haversine formula to calculate the distance between two coordinates in meters
@@ -295,41 +297,27 @@ sap.ui.define([
295
297
  features: [dragInstance, dropInstance]
296
298
  };
297
299
  const dropSpots = featureCollection.features;
298
- // const dropSpots = findDropSpots(pos, featureCollection);
299
- if (!dropSpots) {
300
- console.log("Invalid drop: The drop position is outside the bounding box of available spots.");
301
- } else {
302
- console.log("Valid drop: The drop position is inside the bounding box.");
303
- dropSpots.forEach(feature => {
304
- if (feature.properties && feature.properties.DragData) {
305
- const dropData = feature.properties.DragData;
306
- // Normalize dropData to an array if it's not already
307
- const dropDataArray = Array.isArray(dropData) ? dropData : [dropData];
308
- let parsedDropData;
309
- try {
310
- parsedDropData = JSON.parse(dropDataArray);
311
- console.log('Parsed dropData:', parsedDropData);
312
- } catch (error) {
313
- console.error('Error parsing drop JSON:', error);
314
- }
315
- if (Array.isArray(parsedDropData)) {
316
- parsedDropData.forEach(data => {
317
- if (data.name === "DropTarget") {
318
- if (Array.isArray(data.E)) {
319
- data.E.forEach(e => {
320
- dropItems.push(e.A);
321
- });
322
- } else {
323
- dropItems.push(data.E.A);
324
- }
325
- }
326
- });
327
- }
300
+
301
+ if (VBI.VBITransformer && Array.isArray(VBI.VBITransformer.VisualObjs)) {
302
+ const matchingVO = VBI.VBITransformer.VisualObjs.find(
303
+ VO => VO.type === dropInstance.properties.type
304
+ );
305
+
306
+ if (matchingVO && matchingVO.DropTarget && matchingVO.DropTarget.DropItem) {
307
+ if (Array.isArray(matchingVO.DropTarget.DropItem)) {
308
+ dropItems = matchingVO.DropTarget.DropItem.map(item => item.type);
309
+ } else {
310
+
311
+ dropItems = [matchingVO.DropTarget.DropItem.type];
328
312
  }
329
- });
330
- console.log("Extracted dropItems:", dropItems);
313
+ } else {
314
+ dropItems = [];
315
+ }
316
+ } else {
317
+ console.error("VBITransformer.VisualObjs is undefined or not an array.");
331
318
  }
332
319
 
320
+ console.log("Extracted dropItems:", dropItems);
333
321
  const validDrop = Array.isArray(dragItems) && dragItems.some(item => dropItems.includes(item));
334
322
  console.log("dragItems:", dragItems);
335
323
  console.log("dropItems:", dropItems);
@@ -355,6 +343,7 @@ sap.ui.define([
355
343
  if (lngLat.lng !== 0 && lngLat.lat !== 0) {
356
344
  spot.setLngLat(originalpos);
357
345
  }
346
+ map.getCanvas().style.cursor = 'default';
358
347
  }
359
348
 
360
349
  // Function to return a promise that resolves when the map is clicked
@@ -381,8 +370,8 @@ sap.ui.define([
381
370
  if (that.Apressed || that.Rpressed) {
382
371
  el.style.cursor = 'crosshair';
383
372
  } else {
384
- var tooltip = marker.properties.ToolTip.replace(/\n/g, '<br>');
385
- popup.setLngLat(marker.geometry.coordinates).setHTML(tooltip).addTo(map);
373
+ var tooltip = marker.properties.ToolTip.replace(/\n/g, '<br>');
374
+ popup.setLngLat(marker.geometry.coordinates).setHTML(tooltip).addTo(map);
386
375
  }
387
376
  }
388
377
 
@@ -406,13 +395,10 @@ sap.ui.define([
406
395
  triggerPayloadSpot(e, 'DETAIL_REQUEST');
407
396
  });
408
397
 
409
- el.addEventListener('contextmenu', (e) => {
410
- e.stopPropagation();
411
- e.preventDefault();
398
+ el.oncontextmenu = (e) => {
412
399
  //Trigger payload
413
400
  triggerPayloadSpot(e, 'CONTEXT_MENU_REQUEST');
414
- });
415
-
401
+ };
416
402
  el.addEventListener('mouseleave', () => {
417
403
  if (!that.Apressed && !that.Rpressed) {
418
404
  map.getCanvas().style.cursor = '';
@@ -485,44 +471,11 @@ sap.ui.define([
485
471
  }
486
472
  }
487
473
 
488
- // Calculate bounds to Zoom
489
- if (marker.geometry.type == "LineString") {
490
- markerCoordinates.forEach((line) => {
491
- let exists = bounds.some(
492
- (coords) => coords[0] === line[0] && coords[1] === line[1]
493
- );
494
- //If it doesn't exist, push the new coordinates
495
- if (!exists) {
496
- bounds.push(line);
497
- }
498
- });
499
- } else {
500
- // Check if the coordinates already exist in predefinedMarkers
501
- let exists = bounds.some(
502
- (coords) => coords[0] === markerCoordinates[0] && coords[1] === markerCoordinates[1]
503
- );
504
-
505
- // If it doesn't exist, push the new coordinates
506
- if (!exists) {
507
- bounds.push(markerCoordinates);
508
- }
509
- }
510
-
511
474
  });
512
- let initialZoom = VBI.mapFlags.initialZoom;
513
- //Focus the map into the features
514
- if(bounds.length > 0){
515
- var zoombounds = bounds.reduce((zoombounds, coord) => {
516
- return zoombounds.extend(coord);
517
- }, new maplibregl.LngLatBounds(bounds[0], bounds[0]));
518
- if(!initialZoom || +initialZoom === 0){
519
- map.fitBounds(zoombounds, {
520
- padding: 150
521
- });
522
- }
523
- }
524
- //map.setZoom(Number(sceneGeo.initialZoom))
525
-
475
+ if(VBI.mapFlags.automations){
476
+ let automations = new SAPAutomationManager(map, maplibregl.LngLatBounds);
477
+ automations.load(VBI.mapFlags.automations);
478
+ }
526
479
  map.addLayer({
527
480
  'id': 'geojson-source-point',
528
481
  'type': 'circle',
@@ -650,104 +603,128 @@ sap.ui.define([
650
603
  function triggerPayloaddnd() {
651
604
  PayloadGenerator.objectDrop(action, dropItems);
652
605
  }
606
+
607
+ map.on('mousedown', 'geojson-source-route', (e) => {
608
+ dragInstance = map.queryRenderedFeatures(e.point, {
609
+ layers: ['geojson-source-route']
610
+ });
611
+
612
+ if (dragInstance.length > 0) {
613
+ const feature = dragInstance[0];
614
+ const visualObjs = VBI.VBITransformer.VisualObjs;
615
+ const matchingVO = visualObjs.find(VO => VO.type === feature.properties.type);
616
+
617
+ if (matchingVO && matchingVO.DragSource && matchingVO.DragSource.DragItem) {
618
+ dragItems = Array.isArray(matchingVO.DragSource.DragItem)
619
+ ? matchingVO.DragSource.DragItem.map(item => item.type)
620
+ : [matchingVO.DragSource.DragItem.type];
621
+ } else {
622
+ dragItems = [];
623
+ }
624
+
625
+ console.log("Extracted Drag Items:", dragItems);
626
+ }
627
+
628
+ if (e.originalEvent.button === 0) {
629
+ e.preventDefault();
630
+ lineDrag = true;
631
+ validDrop = false;
632
+
633
+ map.getCanvas().style.cursor = 'default';
634
+ map.on('mousemove', onMove);
635
+ map.on('mouseup', onUp);
636
+
637
+
638
+ if (!that.Apressed && !that.Rpressed) {
639
+ map.getCanvas().style.cursor = 'pointer';
640
+ }
641
+ if (that.Apressed || that.Rpressed) {
642
+ map.getCanvas().style.cursor = 'crosshair';
643
+ }
644
+ }
645
+ });
653
646
 
654
647
  function onUp(e) {
648
+ let dropInstance = null;
655
649
  var dropRoute = map.queryRenderedFeatures(e.point, {
656
650
  layers: ['geojson-source-route']
657
651
  });
658
- if(dropRoute.length != 0){
659
- var dropInstance = dropRoute[0];
660
- }
661
652
 
662
- if (!dropInstance && (map.getLayer('geojson-source-point'))) {
663
- var features1 = map.queryRenderedFeatures({
664
- layers: ['geojson-source-point']
665
- });
653
+ if (dropRoute.length > 0) {
654
+ dropInstance = dropRoute[0];
655
+ }
656
+ if (!dropInstance && map.getLayer('geojson-source-point')) {
657
+ var features1 = map.queryRenderedFeatures({ layers: ['geojson-source-point'] });
666
658
  var pos = e.lngLat;
667
659
  dropInstance = VBI.MapRenderer.findNearestSpot(pos, features1);
668
660
  }
669
661
 
670
-
671
- if (dropInstance != null) {
672
- // Check if the left mouse button is clicked (button === 0)
662
+ if (dropInstance) {
673
663
  if (e.originalEvent.button === 0) {
674
- dropItems = VBI.VBITransformer.getddvalues(dropInstance, "DropTarget");
664
+ const visualObjs = VBI.VBITransformer.VisualObjs;
665
+ const matchingVO = visualObjs.find(VO => VO.type === dropInstance.properties.type);
666
+
667
+ if (matchingVO && matchingVO.DropTarget && matchingVO.DropTarget.DropItem) {
668
+ dropItems = Array.isArray(matchingVO.DropTarget.DropItem)
669
+ ? matchingVO.DropTarget.DropItem.map(item => item.type)
670
+ : [matchingVO.DropTarget.DropItem.type];
671
+ } else {
672
+ dropItems = [];
673
+ }
674
+
675
+ console.log("Extracted Drop Items:", dropItems);
675
676
 
676
677
  validDrop = dragItems.some(item => dropItems.includes(item));
677
- // dragItems = undefined;
678
- // dropItems = undefined;
678
+
679
679
  if (validDrop) {
680
- //Trigger payload
680
+ // Trigger payload for valid drop
681
681
  var dragInsId = VBI.VBITransformer.findObject(dragInstance[0].properties.type);
682
682
  var dropInsId = VBI.VBITransformer.findObject(dropInstance.properties.type);
683
683
  PayloadGenerator.triggerPayloaddnd(dragInsId, dropInsId, dragInstance[0], dropInstance, map_container);
684
- // }
685
- // Perform action for valid drop
686
684
  console.log('Dropped on valid target');
687
685
  } else {
688
- // Perform action for invalid drop
689
686
  console.log('Invalid drop');
690
687
  }
691
688
  }
692
689
  }
690
+
693
691
  // Reset cursor and remove event listeners
694
- map.getCanvas().style.cursor = '';
692
+ map.getCanvas().style.cursor = 'default';
693
+ setTimeout(() => {
694
+ map.getCanvas().style.cursor = 'default';
695
+ }, 100);
695
696
  map.off('mousemove', onMove);
696
- //map.off('touchmove', onMove);
697
697
  map.off('mouseup', onUp);
698
698
  lineDrag = false;
699
699
  validDrop = false;
700
700
  }
701
701
 
702
- // map.on('mousedown', 'geojson-source-route', (e) => {
703
- map.on('mousedown', 'geojson-source-route', (e) => {
704
- dragInstance = map.queryRenderedFeatures(e.point, {
705
- layers: ['geojson-source-route']
706
- })
707
- // Check if the left mouse button is clicked (button === 0)
708
- if (e.originalEvent.button === 0) {
709
- dragItems = VBI.VBITransformer.getddvalues(dragInstance[0], "DragSource");
710
- // Prevent the default map drag behavior.
711
- e.preventDefault();
712
- lineDrag = true;
713
- validDrop = false; 'mouseup', onUp
714
- // Add move and up event listeners
715
- map.on('mousemove', onMove);
716
- map.on('mouseup', onUp);
717
- // Change the cursor style as a UI indicator
718
- if (!that.Apressed && !that.Rpressed) {
719
- map.getCanvas().style.cursor = 'pointer';
720
- }
721
- if (that.Apressed || that.Rpressed) {
722
- map.getCanvas().style.cursor = 'crosshair';
723
- }
724
- }
725
- });
726
-
727
702
  function onMove(e) {
728
703
  const features = map.queryRenderedFeatures(e.point, {
729
704
  layers: ['geojson-source-route']
730
705
  });
731
- if (features) {
732
- map.getCanvas().style.cursor = 'not-alloed';
733
- if (!that.Apressed && !that.Rpressed) {
734
- // dropItems = VBI.VBITransformer.getdroptarget(features);
735
- if (dragItems) {
736
- dropItems = VBI.VBITransformer.getddvalues(features[0], "DropTarget");
737
- }
738
- if (dragItems && dropItems) {
739
- validDrop = VectorUtils.isAccepted(dragItems, dropItems);
706
+
707
+ if (features.length > 0) {
708
+ map.getCanvas().style.cursor = 'not-allowed';
709
+
710
+ if (!that.Apressed && !that.Rpressed) {
711
+ if (dragItems) {
712
+ dropItems = VBI.VBITransformer.getddvalues(features[0], "DropTarget");
713
+ }
714
+
715
+ if (dragItems && dropItems) {
716
+ validDrop = VectorUtils.isAccepted(dragItems, dropItems);
717
+ }
718
+
719
+ map.getCanvas().style.cursor = validDrop ? 'copy' : 'not-allowed';
740
720
  }
741
- if (validDrop) {
742
- map.getCanvas().style.cursor = 'copy';
743
- } else {
744
- // If not over a valid feature, show the "not-allowed" cursor
745
- map.getCanvas().style.cursor = 'not-allowed';
721
+ else {
722
+
723
+ map.getCanvas().style.cursor = 'default';
746
724
  }
747
725
  }
748
726
  }
749
- };
750
-
727
+
751
728
  mapCanvas.oncontextmenu = (e) => {
752
729
  e.preventDefault();
753
730
  // Get the mouse coordinates within the map container
@@ -756,7 +733,7 @@ sap.ui.define([
756
733
  const y = e.clientY - rect.top;
757
734
  const lngLat = map.unproject([x, y]);
758
735
  // Check if the right-click happened on the 'geojson-source-route' layer
759
- const features = map.queryRenderedFeatures([x, y], {layers: ['geojson-source-route']});
736
+ const features = map.queryRenderedFeatures([x, y], { layers: ['geojson-source-route'] });
760
737
 
761
738
  if (features.length > 0) {
762
739
  e.features = features;
@@ -849,27 +826,27 @@ sap.ui.define([
849
826
  default:
850
827
  }
851
828
 
852
- // VBI.MapRenderer.createPopup = (htmlContent, posArray) => {
853
- // let lngLat;
854
- // switch (posArray[0]) {
855
- // case "Spots":
856
- // const intervalId = setInterval(() => {
857
- // const foundSpot = allMarkers.find(spot => spot.customProperties.Key === posArray[1]);
858
- // if (foundSpot) {
859
- // clearInterval(intervalId);
860
- // const lngLat = foundSpot.getLngLat();
861
- // // Create the popup using lngLat and htmlContent.
862
- // // For example, if using Mapbox GL:
863
- // // new mapboxgl.Popup().setLngLat(lngLat).setHTML(htmlContent).addTo(map);
864
- // console.log("Popup created at", lngLat);
865
- // } else {
866
- // console.log("Waiting for marker with key:", posArray[1]);
867
- // }
868
- // }, 100); // Check every 100ms until the marker is found
869
- // break;
870
- // default:
871
- // // Handle other cases if needed.
872
- // }
829
+ // VBI.MapRenderer.createPopup = (htmlContent, posArray) => {
830
+ // let lngLat;
831
+ // switch (posArray[0]) {
832
+ // case "Spots":
833
+ // const intervalId = setInterval(() => {
834
+ // const foundSpot = allMarkers.find(spot => spot.customProperties.Key === posArray[1]);
835
+ // if (foundSpot) {
836
+ // clearInterval(intervalId);
837
+ // const lngLat = foundSpot.getLngLat();
838
+ // // Create the popup using lngLat and htmlContent.
839
+ // // For example, if using Mapbox GL:
840
+ // // new mapboxgl.Popup().setLngLat(lngLat).setHTML(htmlContent).addTo(map);
841
+ // console.log("Popup created at", lngLat);
842
+ // } else {
843
+ // console.log("Waiting for marker with key:", posArray[1]);
844
+ // }
845
+ // }, 100); // Check every 100ms until the marker is found
846
+ // break;
847
+ // default:
848
+ // // Handle other cases if needed.
849
+ // }
873
850
  if (this.popup) {
874
851
  //Remove existing popups
875
852
  this.popup.remove();
@@ -12,7 +12,7 @@ sap.ui.define([
12
12
  *
13
13
  * @private
14
14
  * @author SAP SE
15
- * @version 1.134.1
15
+ * @version 1.136.0
16
16
  * @alias sap.ui.vbm.vector.PayloadGenerator
17
17
  */
18
18
  var adapter = {};
@@ -12,7 +12,7 @@ sap.ui.define([
12
12
  *
13
13
  * @private
14
14
  * @author SAP SE
15
- * @version 1.134.1
15
+ * @version 1.136.0
16
16
  * @alias sap.ui.vbm.vector.RectangularSelection
17
17
  */
18
18
 
@@ -0,0 +1,134 @@
1
+ sap.ui.define([
2
+ "sap/ui/core/Lib",
3
+ "./VBITransformer"
4
+ ], function (Lib, VBITransformer) {
5
+ "use strict";
6
+
7
+ class SAPAutomationManager {
8
+ constructor(map, LngLatBounds) {
9
+ this.map = map;
10
+ this.LngLatBounds = LngLatBounds;
11
+ }
12
+
13
+
14
+ /** Loads automation data from JSON */
15
+ load(data) {
16
+ if (!data?.Call) return;
17
+
18
+ const calls = Array.isArray(data.Call) ? data.Call : [data.Call];
19
+ calls.forEach(call => this.addAutomation(call));
20
+ }
21
+ createHandler(callData){
22
+ if (callData.handler === "FLYTOHANDLER") {
23
+ return this.flyToHandler(callData.Param);
24
+
25
+ } else {
26
+ return false;
27
+ }
28
+ }
29
+ /** creates handler functions*/
30
+ addAutomation(callData) {
31
+ let automationHandler = this.createHandler(callData);
32
+ if(!automationHandler){
33
+ return ;
34
+ }
35
+ let automation = {
36
+ name: callData.name || "Unnamed",
37
+ handler: callData.handler,
38
+ delay: callData.delay || 1,
39
+ earliest: callData.earliest || 1,
40
+ retryAfterMS: callData.retryAfterMS || 0,
41
+ reattempts: callData.reattempts || -1,
42
+ attempts: 0,
43
+ params: callData.Param,
44
+ start: () => automationHandler.start()
45
+ };
46
+ this.scheduleAutomation(automation);
47
+
48
+ }
49
+
50
+ /** Runs automation with delay & retries */
51
+ scheduleAutomation(automation) {
52
+ const now = new Date().getTime();
53
+ const runningTime = now - (this.map.startTime || now);
54
+ let delay = automation.delay;
55
+
56
+ if (runningTime < automation.earliest) {
57
+ delay = Math.max(delay, automation.earliest - runningTime);
58
+ }
59
+
60
+ setTimeout(() => this.executeAutomation(automation), delay);
61
+
62
+ }
63
+
64
+ /** Executes automation and handles retries */
65
+ executeAutomation(automation) {
66
+ const success = automation.start();
67
+ if (!success && automation.retryAfterMS) {
68
+ automation.attempts++;
69
+ if (automation.reattempts === -1 || automation.attempts < automation.reattempts) {
70
+ setTimeout(() => this.executeAutomation(automation), automation.retryAfterMS);
71
+ }
72
+ }
73
+ }
74
+ /**To calculate bounds for zoom to features */
75
+ calculatebounds() {
76
+ let bounds = [];
77
+ let geoJSON = VBI.VBITransformer.getTransformedJSON();
78
+ geoJSON[1].features.forEach((marker) => {
79
+ let markerCoordinates = marker.geometry.coordinates;
80
+
81
+ if (marker.geometry.type === 'LineString') {
82
+ markerCoordinates.forEach((coord) => {
83
+ if (!bounds.some((b) => b[0] === coord[0] && b[1] === coord[1])) {
84
+ bounds.push(coord);
85
+ }
86
+ });
87
+ } else {
88
+ if (!bounds.some((b) => b[0] === markerCoordinates[0] && b[1] === markerCoordinates[1])) {
89
+ bounds.push(markerCoordinates);
90
+ }
91
+ }
92
+ });
93
+ let zoombounds;
94
+ if (bounds.length > 0) {
95
+ zoombounds = bounds.reduce((zoombounds, coord) => {
96
+ return zoombounds.extend(coord);
97
+ }, new this.LngLatBounds(bounds[0], bounds[0]));
98
+
99
+ }
100
+ return zoombounds;
101
+ }
102
+
103
+ /** FLYTOHANDLER*/
104
+ flyToHandler(params) {
105
+ const x = parseFloat(params.find(p => p.name === "x")?.["#"]);
106
+ const y = parseFloat(params.find(p => p.name === "y")?.["#"]);
107
+ const zoom = parseFloat(params.find(p => p.name === "lod")?.["#"]) || 12;
108
+ const speed = parseFloat(params.find(p => p.name === "velocity")?.["#"]) || 1;
109
+ const zoomToAll = params.find(p => p.name === "zoomToAll")?.["#"] || false;
110
+
111
+ if (zoomToAll) {
112
+ let zoombounds = this.calculatebounds();
113
+ //Focus the map into the features
114
+ if (zoombounds) {
115
+ map.fitBounds(zoombounds, {
116
+ padding: 150
117
+ });
118
+ }
119
+ return true;
120
+ } else if (x !== undefined && y !== undefined) {
121
+ this.map.flyTo({
122
+ center: [x, y],
123
+ zoom: zoom,
124
+ speed: speed,
125
+ essential: true
126
+ });
127
+ return true;
128
+ }
129
+ return false;
130
+ }
131
+ }
132
+ return SAPAutomationManager
133
+ });
134
+
@@ -91,20 +91,26 @@ sap.ui.define([
91
91
  VBI.mapFlags.initialZoom = obj.SAPVB.Scenes.Set.SceneGeo.initialZoom;
92
92
  }
93
93
  }
94
-
95
- VBI.mapFlags.scaleVisible = obj.SAPVB.Scenes.Set.SceneGeo.scaleVisible ? JSON.parse(obj.SAPVB.Scenes.Set.SceneGeo.scaleVisible):true;
96
-
97
94
 
98
- VBI.mapFlags.navControlVisible = obj.SAPVB.Scenes.Set.SceneGeo.navControlVisible?JSON.parse(obj.SAPVB.Scenes.Set.SceneGeo.navControlVisible):true;
99
-
95
+ VBI.mapFlags.scaleVisible = obj.SAPVB.Scenes.Set.SceneGeo.scaleVisible ? JSON.parse(obj.SAPVB.Scenes.Set.SceneGeo.scaleVisible) : true;
100
96
 
101
- if(obj.SAPVB.Scenes.Set.SceneGeo.NavigationDisablement){
97
+ VBI.mapFlags.navControlVisible = obj.SAPVB.Scenes.Set.SceneGeo.navControlVisible ? JSON.parse(obj.SAPVB.Scenes.Set.SceneGeo.navControlVisible) : true;
98
+
99
+ if (obj.SAPVB.Scenes.Set.SceneGeo.NavigationDisablement) {
102
100
  let navigationDisablement = obj.SAPVB.Scenes.Set.SceneGeo.NavigationDisablement;
103
- VBI.mapFlags.moveDisable = navigationDisablement.move?JSON.parse(navigationDisablement.move):true;
104
- VBI.mapFlags.zoomDisable = navigationDisablement.zoom?JSON.parse(navigationDisablement.zoom):true;
105
- }
101
+ VBI.mapFlags.moveDisable = navigationDisablement.move ? JSON.parse(navigationDisablement.move) : true;
102
+ VBI.mapFlags.zoomDisable = navigationDisablement.zoom ? JSON.parse(navigationDisablement.zoom) : true;
103
+ }
104
+
105
+ if (obj.SAPVB && obj.SAPVB.Scenes && obj.SAPVB.Scenes.Set && obj.SAPVB.Scenes.Set.SceneGeo &&
106
+ obj.SAPVB.Scenes.Set.SceneGeo.VO) {
107
+ VBI.VBITransformer = VBI.VBITransformer || {};
108
+ VBI.VBITransformer.VisualObjs = obj.SAPVB.Scenes.Set.SceneGeo.VO || [];
109
+ console.log("VisualObjs initialized:", VBI.VBITransformer.VisualObjs);
110
+ } else {
111
+ console.error("VisualObjs is undefined.");
112
+ }
106
113
 
107
-
108
114
  // Scale Control in Maplibre
109
115
  // metric -> m,km
110
116
  // imperial -> ft,mi
@@ -170,7 +176,7 @@ sap.ui.define([
170
176
  for (const MapProvider in MapProvidersArray) {
171
177
  if (MapProvidersArray.hasOwnProperty(MapProvider)) {
172
178
  let Provider = MapProvidersArray[MapProvider];
173
- if (Provider.name == currRefMap && Provider.type == "vector") {
179
+ if (Provider.name == currRefMap && Provider.type == "V") {
174
180
  mapProvider = {
175
181
  "type": "MapProvider",
176
182
  "provider": Provider.Source[0].url,
@@ -414,8 +420,8 @@ sap.ui.define([
414
420
  }
415
421
  }
416
422
  }
417
- VBI.VBITransformer.findObject = function (itemtype){
418
- for (let i = 0; i < visualObj.length; i++) {
423
+ VBI.VBITransformer.findObject = function (itemtype) {
424
+ for (let i = 0; i < visualObj.length; i++) {
419
425
  if (visualObj[i].type === itemtype) {
420
426
  return visualObj[i].id;
421
427
  }
@@ -445,17 +451,20 @@ sap.ui.define([
445
451
  else {
446
452
  let currSpot = spots.E;
447
453
 
448
- for (const index in featureCollection) {
449
- if (featureCollection[index].properties.Key == currSpot.K) {
450
- // ind_del = featureCollection[index].id;
451
- ind_del = index;
452
- }
453
- else {
454
- console.log("error");
454
+ if (currSpot) {
455
+
456
+ for (const index in featureCollection) {
457
+ if (featureCollection[index].properties.Key == currSpot.K) {
458
+ // ind_del = featureCollection[index].id;
459
+ ind_del = index;
460
+ }
461
+ else {
462
+ console.log("error");
463
+ }
455
464
  }
456
- }
457
465
 
458
- featureCollection.splice(ind_del, 1);
466
+ featureCollection.splice(ind_del, 1);
467
+ }
459
468
  }
460
469
  }
461
470
 
@@ -484,17 +493,19 @@ sap.ui.define([
484
493
  else {
485
494
 
486
495
  let currRoute = routes.E;
496
+ if (currRoute) {
487
497
 
488
- for (const index in featureCollection) {
489
- if (featureCollection[index].properties.Key == currRoute.K) {
490
- ind_del = [index];
491
- }
492
- else {
493
- console.log("error");
498
+ for (const index in featureCollection) {
499
+ if (featureCollection[index].properties.Key == currRoute.K) {
500
+ ind_del = [index];
501
+ }
502
+ else {
503
+ console.log("error");
504
+ }
494
505
  }
495
- }
496
506
 
497
- featureCollection.splice(ind_del, 1);
507
+ featureCollection.splice(ind_del, 1);
508
+ }
498
509
  }
499
510
  }
500
511
  VBI.VBITransformer._processAutomation = function (Menus, data) {
@@ -592,10 +603,10 @@ sap.ui.define([
592
603
  }
593
604
  legend = new VBI.LegendWindow();
594
605
  if (Array.isArray(obj.SAPVB.Windows.Set.Window)) {
595
- let oLegend = obj.SAPVB.Windows.Set.Window.find(window => window.id === "LEGEND");
596
- VBI.mapFlags.isLegendExists = oLegend?oLegend:false;
597
- if(oLegend){
598
- legend.load(oLegend, this.mVBIContext);
606
+ let oLegend = obj.SAPVB.Windows.Set.Window.find(window => window.id === "LEGEND");
607
+ VBI.mapFlags.isLegendExists = oLegend ? oLegend : false;
608
+ if (oLegend) {
609
+ legend.load(oLegend, this.mVBIContext);
599
610
  }
600
611
  }
601
612
  }
@@ -691,68 +702,68 @@ sap.ui.define([
691
702
  }
692
703
  }
693
704
 
694
- else {
695
- if (obj.SAPVB.Data.Remove) {
696
-
697
- let del = obj.SAPVB.Data.Remove;
698
-
699
- if (Array.isArray(del)) {
700
- for (const vo in del) {
701
- if (del.hasOwnProperty(vo)) {
702
- let currItm = del[vo];
703
- // N->E->[]
704
- switch (currItm.name) {
705
- case "Spo ts":
706
- VBI.VBITransformer._deleteSpotsData(currItm.N);
707
- case "Links":
708
- VBI.VBITransformer._deleteRoutesData(currItm.N);
709
- break;
710
- default:
711
705
 
712
- }
706
+ if (obj.SAPVB.Data.Remove) {
707
+
708
+ let del = obj.SAPVB.Data.Remove;
709
+
710
+ if (Array.isArray(del)) {
711
+ for (const vo in del) {
712
+ if (del.hasOwnProperty(vo)) {
713
+ let currItm = del[vo];
714
+ // N->E->[]
715
+ switch (currItm.name) {
716
+ case "Spots":
717
+ VBI.VBITransformer._deleteSpotsData(currItm.N);
718
+ case "Links":
719
+ VBI.VBITransformer._deleteRoutesData(currItm.N);
720
+ break;
721
+ default:
722
+
713
723
  }
714
724
  }
715
725
  }
716
- else {
717
- if (obj.SAPVB.Data.Remove.N) {
718
- // E or A within each array object. ***************
719
- let D = obj.SAPVB.Data.Remove.N;
720
- // let C = obj.SAPVB.Data.Set.A;
721
- if (Array.isArray(D)) {
722
- for (const item in D) {
723
- if (D.hasOwnProperty(item)) {
724
- let currVO = D[item];
725
- switch (currVO.name) {
726
- case "Spots":
727
- VBI.VBITransformer._deleteSpotsData(currVO);
728
- break;
729
- case "Links":
730
- VBI.VBITransformer._deleteRoutesData(currVO);
731
- break;
732
-
733
- default:
734
-
735
- }
726
+ }
727
+ else {
728
+ if (obj.SAPVB.Data.Remove.N) {
729
+ // E or A within each array object. ***************
730
+ let D = obj.SAPVB.Data.Remove.N;
731
+ // let C = obj.SAPVB.Data.Set.A;
732
+ if (Array.isArray(D)) {
733
+ for (const item in D) {
734
+ if (D.hasOwnProperty(item)) {
735
+ let currVO = D[item];
736
+ switch (currVO.name) {
737
+ case "Spots":
738
+ VBI.VBITransformer._deleteSpotsData(currVO);
739
+ break;
740
+ case "Links":
741
+ VBI.VBITransformer._deleteRoutesData(currVO);
742
+ break;
743
+
744
+ default:
745
+
736
746
  }
737
747
  }
738
- } else {
739
- switch (D.name) {
740
- case "Spots":
741
- VBI.VBITransformer._deleteSpotsData(D);
742
- break;
743
- case "Links":
744
- VBI.VBITransformer._deleteRoutesData(D);
745
- break;
746
-
747
- default:
748
- // code block
749
- }
750
748
  }
751
- }
749
+ } else {
750
+ switch (D.name) {
751
+ case "Spots":
752
+ VBI.VBITransformer._deleteSpotsData(D);
753
+ break;
754
+ case "Links":
755
+ VBI.VBITransformer._deleteRoutesData(D);
756
+ break;
752
757
 
758
+ default:
759
+ // code block
760
+ }
761
+ }
753
762
  }
763
+
754
764
  }
755
765
  }
766
+
756
767
  }
757
768
 
758
769
  // Get the datatypes
@@ -809,6 +820,7 @@ sap.ui.define([
809
820
 
810
821
  if (obj.SAPVB.Automation && obj.SAPVB.Automation.Call) {
811
822
  VBI.VBITransformer._processAutomation(obj.SAPVB.Automation, obj);
823
+ VBI.mapFlags.automations = obj.SAPVB.Automation;
812
824
  }
813
825
 
814
826
  if (obj.SAPVB.Menus && Object.keys(obj.SAPVB.Menus).length != 0) {