@sapui5/sap.ui.vbm 1.131.0 → 1.133.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.
@@ -11,10 +11,13 @@
11
11
 
12
12
  sap.ui.define([
13
13
  "../lib/sapvbi",
14
- "./MapRenderer"
15
- ], function (vb, MapRenderer) {
14
+ "./MapRenderer",
15
+ "./VectorUtils",
16
+ "sap/ui/unified/Menu",
17
+ "sap/ui/unified/MenuItem",
18
+ ], function (vb, MapRenderer, VectorUtils, Menu, MenuItem) {
16
19
  'use strict';
17
- // var thisModule = "sap.ui.vbm.VBI.VBITransformer";
20
+
18
21
  VBI.VBITransformer = {};
19
22
 
20
23
  VBI.vectorFlag = false;
@@ -28,9 +31,11 @@ sap.ui.define([
28
31
  var route_id = 0;
29
32
 
30
33
  var ind_del;
31
-
34
+ var legend;
32
35
  var resources;
36
+ var resourceMap;
33
37
  var menus;
38
+ var defaultbase64 = 'iVBORw0KGgoAAAANSUhEUgAAABcAAAAfCAYAAAAMeVbNAAADGUlEQVRIia3WW2xMQRjA8f+Z3bWru622ulhVWtpQlzbFhrq1UQmpy4O+IO6C4kki4VHcIx5RJO7iSXgRSpG6e6hbo7WJRrShFVLqTtX5POxO1Wa3u9Z+ySTfnNn5zZyzc+aMISJEiDnApEDJBJ4CN4HqQAkfIhKubBORGuk+qkVkbTjDCDHzacAeIB/A9/IdN+pe8aSpldfvvzDInUR+lpuS/Aw8KU7d5zKwEmjqCgXjB4FVAHVNrRyuquPxi7ch71gpg+KRA1hWMoL+qU6ANqAEeBAKrwDKTVM4Wf2UU9d9mGbE/4MEu431cwqYmpehL43RA2h8NHBfBHafreHyo8aIaHCsK81nbmE2QD2QB/xSgbatAOfuNcQEA1RU1upHOBzYC6CAcUDpx6/tHL1aHxMMYJrC/gu1BJ5yOWBR+Ncxlx428vXHz5hxgIaWNmobOxfAbAVMBrjja/4vWMddX4tOJyugAOBZc1tc8IaWTqdAAa7v7R18a++IC9766btOPQqgvcOMCxxk2RWA02GLG+76Y31QQJNFGfRNTogLHtgKAJ4roAZgaHpKXPAcT7JOHyj8ezPenL5xwb05/XR6UwGVABNz+2O1qLCdoglPipPsPzO/pQAfcK1Xgp2iEen/hc/yZmEYAJwATD3VMwALi3OxKCMm2OWwMds7WFcPgX/jAv9eXj3Qncj0gsyY8PlThuolfR643RUHOAawtGQ4CXbrP8EZaYmUFebo6i6ddMWPAxd7JzpYPSMvatiiDDaWjcVmVQBH9KyDcYANADPHZDFhmCcqfEHRMHIHpIL/01betS0YrwcOGAZsKvOS3tvVLTx6SB8WF+fq6ibgrw9CqIW9BjjtdNjYuXhi2H1noDuRzfPGo/yr6xBQFfybcG/NcqAqPdXF9oUTsNssfzW6k3qyY1HnwKeB1aGQcPgPYAXwZNSgNLYsKKSH1T9AqsvBnmVT9IHoErAkjNHtcQ4RGSwiDSIij56/kVX7rkjzu8/6KHdFRJK76x8JR0SyRaReRMQ0O8+IlSKSFqlvNDgiYhWRigBcEWUffgN+ZuQK2lE/1gAAAABJRU5ErkJggg==';
34
39
  // var Events
35
40
 
36
41
  // Needs to be triggerd only for initial load
@@ -40,26 +45,29 @@ sap.ui.define([
40
45
 
41
46
  // Get data from config - >
42
47
 
43
- // VBI.VBITransformer.init = function() {
44
- // // event handlers from actions and automations
45
- // this._eventHandlers = [];
46
- // this._actions = [];
48
+ VBI.VBITransformer.init = function () {
49
+ // event handlers from actions and automations
50
+ this._eventHandlers = [];
51
+ this._actions = [];
47
52
 
48
- // //initialize section
49
- // this._mapConfiguration = {};
50
- // this._clusterVOs = new Map();
53
+ //initialize section
54
+ this._mapConfiguration = {};
55
+ this._clusterVOs = new Map();
51
56
 
52
- // //Dictionary for Data Attributes
53
- // this._dataTypes = {};
54
- // this._data = {};
55
- // this._idKeyMap = {};
57
+ //Dictionary for Data Attributes
58
+ this._dataTypes = {};
59
+ this._data = {};
60
+ this._idKeyMap = {};
56
61
 
57
- // //Properties in VBI JSON that need special handling
58
- // this._propsAnomalies = new Map();
59
- // }
62
+ //Properties in VBI JSON that need special handling
63
+ this._propsAnomalies = new Map();
64
+ }
60
65
 
61
66
  VBI.VBITransformer._extractMapProvider = (obj) => {
62
-
67
+ if (!this.mVBIContext) {
68
+ // just create the context.............................................//
69
+ this.mVBIContext = new VBI.VBIContext(this);
70
+ }
63
71
  var currRefMap = "DEFAULT";
64
72
  var initialStartPosition = [12.980846657174002, 77.7154284936771];
65
73
  var initialZoom = "0";
@@ -170,7 +178,6 @@ sap.ui.define([
170
178
  // var spot_id = 0;
171
179
  //E can be a single object too..
172
180
  // For each spot
173
- var defaultbase64 = 'iVBORw0KGgoAAAANSUhEUgAAABcAAAAfCAYAAAAMeVbNAAADGUlEQVRIia3WW2xMQRjA8f+Z3bWru622ulhVWtpQlzbFhrq1UQmpy4O+IO6C4kki4VHcIx5RJO7iSXgRSpG6e6hbo7WJRrShFVLqTtX5POxO1Wa3u9Z+ySTfnNn5zZyzc+aMISJEiDnApEDJBJ4CN4HqQAkfIhKubBORGuk+qkVkbTjDCDHzacAeIB/A9/IdN+pe8aSpldfvvzDInUR+lpuS/Aw8KU7d5zKwEmjqCgXjB4FVAHVNrRyuquPxi7ch71gpg+KRA1hWMoL+qU6ANqAEeBAKrwDKTVM4Wf2UU9d9mGbE/4MEu431cwqYmpehL43RA2h8NHBfBHafreHyo8aIaHCsK81nbmE2QD2QB/xSgbatAOfuNcQEA1RU1upHOBzYC6CAcUDpx6/tHL1aHxMMYJrC/gu1BJ5yOWBR+Ncxlx428vXHz5hxgIaWNmobOxfAbAVMBrjja/4vWMddX4tOJyugAOBZc1tc8IaWTqdAAa7v7R18a++IC9766btOPQqgvcOMCxxk2RWA02GLG+76Y31QQJNFGfRNTogLHtgKAJ4roAZgaHpKXPAcT7JOHyj8ezPenL5xwb05/XR6UwGVABNz+2O1qLCdoglPipPsPzO/pQAfcK1Xgp2iEen/hc/yZmEYAJwATD3VMwALi3OxKCMm2OWwMds7WFcPgX/jAv9eXj3Qncj0gsyY8PlThuolfR643RUHOAawtGQ4CXbrP8EZaYmUFebo6i6ddMWPAxd7JzpYPSMvatiiDDaWjcVmVQBH9KyDcYANADPHZDFhmCcqfEHRMHIHpIL/01betS0YrwcOGAZsKvOS3tvVLTx6SB8WF+fq6ibgrw9CqIW9BjjtdNjYuXhi2H1noDuRzfPGo/yr6xBQFfybcG/NcqAqPdXF9oUTsNssfzW6k3qyY1HnwKeB1aGQcPgPYAXwZNSgNLYsKKSH1T9AqsvBnmVT9IHoErAkjNHtcQ4RGSwiDSIij56/kVX7rkjzu8/6KHdFRJK76x8JR0SyRaReRMQ0O8+IlSKSFqlvNDgiYhWRigBcEWUffgN+ZuQK2lE/1gAAAABJRU5ErkJggg==';
174
181
  if (Array.isArray(spots.E)) {
175
182
  // console.log(spots.E.length);
176
183
  for (const spot in spots.E) {
@@ -227,50 +234,51 @@ sap.ui.define([
227
234
  } else {
228
235
 
229
236
  let currSpot = spots.E;
230
-
231
- let spotProperties = {
232
- "GeoPosition": currSpot.A ? currSpot.A : "",
233
- "ToolTip": currSpot.B ? currSpot.B : "",
234
- "Label": currSpot.L ? currSpot.L : "",
235
- "LabelBGColor": currSpot.LC ? currSpot.LC : "",
236
- "LabelAlignment": currSpot.LA ? currSpot.LA : "",
237
- "Color": currSpot.C ? currSpot.C : "",
238
- "HotColor": currSpot.HC ? currSpot.HC : "",
239
- "SelectColor": currSpot.SC ? currSpot.SC : "",
240
- "Transformation": currSpot.D ? currSpot.D : "",
241
- "FixDir": currSpot.E ? currSpot.E : "",
242
- "FixSize": currSpot.F ? currSpot.F : "",
243
- "Icon": currSpot.G ? currSpot.G : "",
244
- "Image": currSpot.I ? currSpot.I : "",
245
- "base64": resources.find(resource => resource.name === currSpot.I)?.value || defaultbase64,
246
- "Key": currSpot.K ? currSpot.K : "",
247
- "Scale": currSpot.S ? currSpot.S : "",
248
- "DisplayRole": currSpot.R ? currSpot.R : "",
249
- "DragData": currSpot.DD ? currSpot.DD : "",
250
- "Alignment": currSpot.AL ? currSpot.AL : "",
251
- "height": resources.find(resource => resource.name === currSpot.I) ? '45px' : '30px',
252
- "width": resources.find(resource => resource.name === currSpot.I) ? '45px' : '24px'
253
-
254
- };
255
-
256
- let coord_array = currSpot.A.split(";");
257
-
258
- let geometry = {
259
- "coordinates": [
260
- Number(coord_array[0]),
261
- Number(coord_array[1])
262
- ],
263
- "type": "Point"
264
- };
265
-
266
- let spot_data = {
267
- "type": "Feature",
268
- "properties": spotProperties,
269
- "geometry": geometry,
270
- "id": spot_id++,
271
- };
272
-
273
- featureCollection.push(spot_data);
237
+ if (currSpot) {
238
+ let spotProperties = {
239
+ "GeoPosition": currSpot.A ? currSpot.A : "",
240
+ "ToolTip": currSpot.B ? currSpot.B : "",
241
+ "Label": currSpot.L ? currSpot.L : "",
242
+ "LabelBGColor": currSpot.LC ? currSpot.LC : "",
243
+ "LabelAlignment": currSpot.LA ? currSpot.LA : "",
244
+ "Color": currSpot.C ? currSpot.C : "",
245
+ "HotColor": currSpot.HC ? currSpot.HC : "",
246
+ "SelectColor": currSpot.SC ? currSpot.SC : "",
247
+ "Transformation": currSpot.D ? currSpot.D : "",
248
+ "FixDir": currSpot.E ? currSpot.E : "",
249
+ "FixSize": currSpot.F ? currSpot.F : "",
250
+ "Icon": currSpot.G ? currSpot.G : "",
251
+ "Image": currSpot.I ? currSpot.I : "",
252
+ "base64": resources.find(resource => resource.name === currSpot.I)?.value || defaultbase64,
253
+ "Key": currSpot.K ? currSpot.K : "",
254
+ "Scale": currSpot.S ? currSpot.S : "",
255
+ "DisplayRole": currSpot.R ? currSpot.R : "",
256
+ "DragData": currSpot.DD ? currSpot.DD : "",
257
+ "Alignment": currSpot.AL ? currSpot.AL : "",
258
+ "height": resources.find(resource => resource.name === currSpot.I) ? '45px' : '30px',
259
+ "width": resources.find(resource => resource.name === currSpot.I) ? '45px' : '24px'
260
+
261
+ };
262
+
263
+ let coord_array = currSpot.A.split(";");
264
+
265
+ let geometry = {
266
+ "coordinates": [
267
+ Number(coord_array[0]),
268
+ Number(coord_array[1])
269
+ ],
270
+ "type": "Point"
271
+ };
272
+
273
+ let spot_data = {
274
+ "type": "Feature",
275
+ "properties": spotProperties,
276
+ "geometry": geometry,
277
+ "id": spot_id++,
278
+ };
279
+
280
+ featureCollection.push(spot_data);
281
+ }
274
282
  }
275
283
  }
276
284
 
@@ -292,8 +300,8 @@ sap.ui.define([
292
300
  "Label": currRoute.L ? currRoute.L : "",
293
301
  "LabelBGColor": currRoute.LC ? currRoute.LC : "",
294
302
  "LabelAlignment": currRoute.LA ? currRoute.LA : "",
295
- "Color": currRoute.C ? argbToRgba(currRoute.C) : "",
296
- "BorderColor": currRoute.D ? argbToRgba(currRoute.D) : "",
303
+ "Color": currRoute.C ? VectorUtils.argbToRgba(currRoute.C) : "",
304
+ "BorderColor": currRoute.D ? VectorUtils.argbToRgba(currRoute.D) : "",
297
305
  "HotColor": currRoute.HC ? currRoute.HC : "",
298
306
  "SelectColor": currRoute.SC ? currRoute.SC : "",
299
307
  "PosList": currRoute.H ? currRoute.H : "",
@@ -302,7 +310,7 @@ sap.ui.define([
302
310
  "Key": currRoute.K ? currRoute.K : "",
303
311
  "DisplayRole": currRoute.R ? currRoute.R : "",
304
312
  "LineWidth": currRoute.LW ? currRoute.LW * 1.5 : "",
305
- "BorderWidth": currRoute.LW ? currRoute.LW * 1.5 + 2: "",
313
+ "BorderWidth": currRoute.LW ? currRoute.LW * 1.5 + 2 : "",
306
314
  "DotWidth": currRoute.DW ? currRoute.DW : "",
307
315
  "DotColor": currRoute.DC ? currRoute.DC : "",
308
316
  "LineDash": currRoute.LD ? currRoute.LD : "",
@@ -337,74 +345,57 @@ sap.ui.define([
337
345
  } else {
338
346
 
339
347
  let currRoute = routes.E;
348
+ if (currRoute) {
349
+ let routeProperties = {
350
+ "GeoPosition": currRoute.A ? currRoute.A : "",
351
+ "ToolTip": currRoute.B ? currRoute.B : "",
352
+ "Label": currRoute.L ? currRoute.L : "",
353
+ "LabelBGColor": currRoute.LC ? currRoute.LC : "",
354
+ "LabelAlignment": currRoute.LA ? currRoute.LA : "",
355
+ "Color": currRoute.C ? VectorUtils.argbToRgba(currRoute.C) : "",
356
+ "BorderColor": currRoute.D ? VectorUtils.argbToRgba(currRoute.D) : "",
357
+ "HotColor": currRoute.HC ? currRoute.HC : "",
358
+ "SelectColor": currRoute.SC ? currRoute.SC : "",
359
+ "PosList": currRoute.H ? currRoute.H : "",
360
+ "StartStyle": currRoute.Y ? currRoute.Y : "",
361
+ "EndStyle": currRoute.Z ? currRoute.Z : "",
362
+ "Key": currRoute.K ? currRoute.K : "",
363
+ "DisplayRole": currRoute.R ? currRoute.R : "",
364
+ "LineWidth": currRoute.LW ? currRoute.LW * 1.5 : "",
365
+ "BorderWidth": currRoute.LW ? currRoute.LW * 1.5 + 2 : "",
366
+ "DotWidth": currRoute.DW ? currRoute.DW : "",
367
+ "DotColor": currRoute.DC ? currRoute.DC : "",
368
+ "LineDash": currRoute.LD ? currRoute.LD : "",
369
+ "DirectionIndicator": currRoute.DI ? currRoute.DI : "",
370
+ "DragData": currRoute.DD ? currRoute.DD : ""
371
+
372
+ };
373
+
374
+ //itearate through the route points and add the coordinates to the GeoJSON
375
+ let coord_array = currRoute.H.split(";");
376
+ let coord_collection = [];
377
+
378
+ for (let i = 0; i < coord_array.length; i = i + 3) {
379
+ coord_collection.push([Number(coord_array[i]), Number(coord_array[i + 1])])
380
+ }
340
381
 
341
- let routeProperties = {
342
- "GeoPosition": currRoute.A ? currRoute.A : "",
343
- "ToolTip": currRoute.B ? currRoute.B : "",
344
- "Label": currRoute.L ? currRoute.L : "",
345
- "LabelBGColor": currRoute.LC ? currRoute.LC : "",
346
- "LabelAlignment": currRoute.LA ? currRoute.LA : "",
347
- "Color": currRoute.C ? argbToRgba(currRoute.C) : "",
348
- "BorderColor": currRoute.D ? argbToRgba(currRoute.D) : "",
349
- "HotColor": currRoute.HC ? currRoute.HC : "",
350
- "SelectColor": currRoute.SC ? currRoute.SC : "",
351
- "PosList": currRoute.H ? currRoute.H : "",
352
- "StartStyle": currRoute.Y ? currRoute.Y : "",
353
- "EndStyle": currRoute.Z ? currRoute.Z : "",
354
- "Key": currRoute.K ? currRoute.K : "",
355
- "DisplayRole": currRoute.R ? currRoute.R : "",
356
- "LineWidth": currRoute.LW ? currRoute.LW * 1.5 : "",
357
- "BorderWidth": currRoute.LW ? currRoute.LW * 1.5 + 2: "",
358
- "DotWidth": currRoute.DW ? currRoute.DW : "",
359
- "DotColor": currRoute.DC ? currRoute.DC : "",
360
- "LineDash": currRoute.LD ? currRoute.LD : "",
361
- "DirectionIndicator": currRoute.DI ? currRoute.DI : "",
362
- "DragData": currRoute.DD ? currRoute.DD : ""
363
-
364
- };
365
-
366
- //itearate through the route points and add the coordinates to the GeoJSON
367
- let coord_array = currRoute.H.split(";");
368
- let coord_collection = [];
369
-
370
- for (let i = 0; i < coord_array.length; i = i + 3) {
371
- coord_collection.push([Number(coord_array[i]), Number(coord_array[i + 1])])
382
+ let geometry = {
383
+ "coordinates": coord_collection,
384
+ "type": "LineString"
385
+ };
386
+
387
+ let route_data = {
388
+ "type": "Feature",
389
+ "properties": routeProperties,
390
+ "geometry": geometry,
391
+ // "id" : currRoute['VB:ix'],
392
+ "id": route_id++,
393
+ };
394
+ featureCollection.push(route_data);
372
395
  }
373
-
374
- let geometry = {
375
- "coordinates": coord_collection,
376
- "type": "LineString"
377
- };
378
-
379
- let route_data = {
380
- "type": "Feature",
381
- "properties": routeProperties,
382
- "geometry": geometry,
383
- // "id" : currRoute['VB:ix'],
384
- "id": route_id++,
385
- };
386
- featureCollection.push(route_data);
387
396
  }
388
397
  }
389
398
 
390
- function argbToRgba(argbString) {
391
-
392
- // Remove "ARGB(" and ")" from the string and split the values by commas
393
- let argbValues = argbString.replace('ARGB(', '').replace(')', '').split(',');
394
-
395
- // Parse the values as integers
396
- let alpha = parseInt(argbValues[0].trim(), 10);
397
- let red = parseInt(argbValues[1].trim(), 10);
398
- let green = parseInt(argbValues[2].trim(), 10);
399
- let blue = parseInt(argbValues[3].trim(), 10);
400
-
401
- // Convert alpha from 0-255 range to 0-1 range
402
- let alphaDecimal = alpha / 255;
403
-
404
- // Return the RGBA string
405
- return `rgba(${red}, ${green}, ${blue}, ${alphaDecimal.toFixed(2)})`;
406
- }
407
-
408
399
  VBI.VBITransformer._deleteSpotsData = (spots) => {
409
400
 
410
401
  if (Array.isArray(spots.E)) {
@@ -481,12 +472,111 @@ sap.ui.define([
481
472
  featureCollection.splice(ind_del, 1);
482
473
  }
483
474
  }
475
+ VBI.VBITransformer._processAutomation = function (Menus, data) {
476
+ const menusip = data.SAPVB.Automation?.Menus ? data.SAPVB.Automation.Menus : data.SAPVB?.Menus;
477
+ if (menusip || menusip != null) {
478
+ const menus = new VBI.Menus();
479
+ menus.load(menusip, data.SAPVB.Automation.Call);
480
+ VBI.MapRenderer.createMenu(menus, Menus.Call);
481
+ }
482
+ }
484
483
 
484
+ VBI.VBITransformer._createLegend = (target) => {
485
+ if (legend.m_DataSource && legend.LegendChanged()) {
486
+ legend.m_Data = [];
485
487
 
488
+ if (legend.m_oLegend && legend.m_oLegend.m_Table) {
489
+ while (legend.m_oLegend.m_Table.rows.length > 0) {
490
+ legend.m_oLegend.m_Table.deleteRow(-1);
491
+ }
492
+ legend.ApplyData();
493
+ legend.FillContent();
494
+ }
495
+ }
496
+ // var bClickRow = (this.mVBIContext.m_Actions.findAction("Click", hs, legend.m_ID)) ? true : false;
497
+ if (target && legend.m_oLegend == null) {
498
+ legend.m_oLegend = VBI.Utilities.CreateLegend(target + "-" + legend.m_ID, 0, legend.m_Caption, 5, false);
499
+ legend.RegisterEvents();
500
+ legend.m_Expanded = true;
501
+ legend.ApplyData();
502
+ legend.FillContent();
503
+ }
504
+ var map_container1 = document.getElementById(target)
505
+ map_container1.appendChild(legend.m_oLegend.m_Div);
506
+ }
507
+
508
+ VBI.VBITransformer._extractDetailWindow = (jsonData) => {
509
+ // Extract data from the JSON
510
+ const { Windows } = jsonData.SAPVB;
511
+ const windowDetails = Windows.Set.Window;
512
+ const pos = Windows.Set.Window["pos.bind"];
513
+ const posArray = pos.split(".");
514
+
515
+ const data = jsonData.SAPVB.Data.Set.N.E[0].N.E; // Extract data from DetailData
516
+ const scene = jsonData.SAPVB.Scenes.Set.Scene.VO; // Extract scene details
517
+ const actions = jsonData.SAPVB.Actions.Set; // Extract actions
518
+
519
+ // Create the popup window with its caption and other details
520
+ const windowContainer = VectorUtils.createDetailWindowContainer(windowDetails);
521
+ // Create popup container
522
+ const popupContainer = document.createElement('div');
523
+ // Add popup container as a child of the window container
524
+ windowContainer.appendChild(popupContainer);
525
+
526
+ scene.forEach(item => {
527
+ let obj;
528
+ switch (item.type) {
529
+ case "{00100000-2013-1000-1100-50059A6A47FA}": // Sub Caption
530
+ obj = VectorUtils.createSubCaption(item);
531
+ popupContainer.appendChild(obj);
532
+ break;
533
+
534
+ case "{00100000-2013-1000-3700-AD84DDBBB31B}": // Label
535
+ obj = VectorUtils.createLabel(item, data);
536
+ popupContainer.appendChild(obj);
537
+ break;
538
+
539
+ case "{00100000-2013-1000-2400-D305F7942B98}": // Link
540
+ obj = VectorUtils.createLink(item);
541
+ popupContainer.appendChild(obj);
542
+ break;
543
+
544
+ case "{00100000-2013-1000-2200-6B060A330B2C}": // Image
545
+ obj = VectorUtils.createImage(item, defaultbase64, resourceMap);
546
+ popupContainer.appendChild(obj);
547
+ break;
548
+
549
+ case "{00100000-2013-1000-2400-D305F7942B98}": // Button
550
+ obj = VectorUtils.createButton(item, actions);
551
+ popupContainer.appendChild(obj);
552
+ break;
553
+
554
+ default:
555
+ console.error("Unknown element type:", item.type);
556
+ break;
557
+ }
558
+ });
486
559
 
560
+ VBI.MapRenderer.createPopup(windowContainer, posArray);
487
561
 
562
+ }
563
+ VBI.VBITransformer._processDetailWindows = (obj) => {
564
+ if (!this.mVBIContext.m_Windows) {
565
+ this.mVBIContext.m_Windows = new VBI.Windows();
566
+ // this.mVBIContext.m_Windows.load(obj.SAPVB.Windows, this.mVBIContext);
567
+ }
568
+ legend = new VBI.LegendWindow();
569
+ if (Array.isArray(obj.SAPVB.Windows.Set.Window)) {
570
+ legend.load(obj.SAPVB.Windows.Set.Window.find(window => window.id === "LEGEND"), this.mVBIContext);
571
+ }
572
+ }
488
573
 
489
574
  VBI.VBITransformer._extractData = (obj) => {
575
+ if (!this.mVBIContext.m_DataProvider) {
576
+ this.mVBIContext.m_DataProvider = new VBI.DataProvider();
577
+ }
578
+
579
+ this.mVBIContext.m_DataProvider.load(obj.SAPVB.Data, this.mVBIContext);
490
580
  // Set
491
581
  if (obj.SAPVB.Data.Set) {
492
582
 
@@ -506,6 +596,9 @@ sap.ui.define([
506
596
  case "Links":
507
597
  VBI.VBITransformer._extractRoutesData(currItm.N)
508
598
  break;
599
+ case "DetailData":
600
+ VBI.VBITransformer._extractDetailWindow(obj);
601
+ break;
509
602
  default:
510
603
  // code block
511
604
  }
@@ -532,6 +625,9 @@ sap.ui.define([
532
625
  case "Links":
533
626
  VBI.VBITransformer._extractRoutesData(currVO)
534
627
  break;
628
+ case "DetailData":
629
+ VBI.VBITransformer._extractDetailWindow(obj);
630
+ break;
535
631
  case "KeyPress":
536
632
  if (this._target !== this._adapter._map()) { // only map supports key events
537
633
  return false;
@@ -554,6 +650,9 @@ sap.ui.define([
554
650
  case "Links":
555
651
  VBI.VBITransformer._extractRoutesData(C);
556
652
  break;
653
+ case "DetailData":
654
+ VBI.VBITransformer._extractDetailWindow(obj);
655
+ break;
557
656
  default:
558
657
  // code block
559
658
  }
@@ -630,143 +729,13 @@ sap.ui.define([
630
729
  }
631
730
 
632
731
 
633
-
634
-
635
-
636
-
637
-
638
-
639
-
640
- // // VBI.VBITransformer._deleteData = (obj) => {
641
-
642
- // if (obj.SAPVB.Data.Remove) {
643
-
644
- // let del = obj.SAPVB.Data.Remove;
645
-
646
- // if (Array.isArray(del)) {
647
- // for (const vo in del) {
648
- // if (del.hasOwnProperty(vo)) {
649
- // let currItm = del[vo];
650
- // // N->E->[]
651
- // switch (currItm.name) {
652
- // case "Spots":
653
- // VBI.VBITransformer._deleteSpotsData(currItm.N);
654
- // break;
655
- // default:
656
-
657
- // }
658
- // }
659
- // }
660
- // }
661
- // else{
662
- // if (obj.SAPVB.Data.Remove.N) {
663
- // // E or A within each array object. ***************
664
- // let D = obj.SAPVB.Data.Remove.N;
665
- // // let C = obj.SAPVB.Data.Set.A;
666
- // if (Array.isArray(D)) {
667
- // for (const item in D) {
668
- // if (D.hasOwnProperty(item)) {
669
- // let currVO = D[item];
670
- // switch (currVO.name) {
671
- // case "Spots":
672
- // VBI.VBITransformer._extractSpotsData(currVO);
673
- // break;
674
-
675
- // default:
676
- // // code block
677
- // }
678
- // }
679
- // }
680
- // } else {
681
- // switch (D.name) {
682
- // case "Spots":
683
- // VBI.VBITransformer._deleteSpotsData(D);
684
- // break;
685
- // default:
686
- // // code block
687
- // }
688
- // }
689
- // }
690
-
691
-
692
- // }
693
- // }
694
- // }
695
- // }
696
-
697
-
698
-
699
- // DELTA UPDATE
700
-
701
- // if(obj.SAPVB.Data.Set.N){
702
-
703
- // }
704
-
705
- // Remove
706
-
707
-
708
- // // Extract the necessary information from the payload
709
- // const removeData = obj.SAPVB.Data.Remove;
710
- // const spotKey = removeData.N.E.K;
711
-
712
- // // Assuming you have a map object and spots layer initialized
713
-
714
- // const spotsLayer = map.getLayer('Spots'); // Assuming 'Spots' is the layer name
715
-
716
- // if (spotsLayer) {
717
- // // Find the spot with the specific key and remove it
718
- // const feature = spotsLayer.getFeatureById(spotKey);
719
- // if (feature) {
720
- // spotsLayer.removeFeature(feature);
721
- // console.log(`Spot with key ${spotKey} removed from the map.`);
722
- // } else {
723
- // console.error(`Spot with key ${spotKey} not found.`);
724
- // }
725
- // } else {
726
- // console.error('Spots layer not found on the map.');
727
- // }
728
-
729
-
730
- // console.log(obj.SAPVB.Data.Set);
731
- // [].concat(obj.SAPVB.Data.Remove).filter(function(r){
732
- // return(r.N && r.N.E);
733
- // }).forEach(function(r){
734
- // [].conact(r.N.E).foreach(function(e){
735
- // var index=library.findIndexINArray(this._data(r.name),function(_d){ return _d.key==e.k; });
736
-
737
- // if(index !==-1){
738
- // history._data(r.name).splice(index,1);
739
- // }
740
- // },this);
741
- // },this);
742
- // }
743
-
744
- // function deleteSpots(obj.SAPVB.Data.Remove) {
745
- // // Extract the necessary information from the payload
746
- // const removeData = paylSAPVB.Data.Remove;
747
- // const spotKey = removeData.N.E.K;
748
-
749
- // // Assuming you have a map object and spots layer initialized
750
- // const map = getMapInstance(); // Replace this with your actual map instance retrieval
751
- // const spotsLayer = map.getLayer('Spots'); // Assuming 'Spots' is the layer name
752
-
753
- // if (spotsLayer) {
754
- // // Find the spot with the specific key and remove it
755
- // spotsLayer.removeFeature(spotKey);
756
- // console.log(`Spot with key ${spotKey} removed from the map.`);
757
- // } else {
758
- // console.error('Spots layer not found on the map.');
759
- // }
760
- // }
761
-
762
- // // Call the function to delete spots
763
- // deleteSpots(payload);
764
-
765
732
  // Get the datatypes
766
733
  // Run on initial load, if the datatypes are provided
767
734
  VBI.VBITransformer._extractDataTypes = (obj) => {
768
735
  //check if the datatypes are provided in the obj
769
736
  //If else check if the mappings are stored (from the initial load.)
737
+ // load the datatype provider....................................//
738
+
770
739
 
771
740
  }
772
741
 
@@ -785,41 +754,56 @@ sap.ui.define([
785
754
 
786
755
  VBI.VBITransformer.parseVBI = (obj) => {
787
756
  VBI.vectorFlag = true;
788
- // VBI.VBITransformer.init();
789
757
  if (obj.SAPVB) {
790
758
  // initial load
791
759
  if (obj.SAPVB.MapProviders && obj.SAPVB.MapLayerStacks && obj.SAPVB.Scenes) {
792
760
  VBI.VBITransformer._extractMapProvider(obj);
793
761
  }
794
-
762
+ if (obj?.SAPVB?.Scenes?.Merge?.SceneGeo?.refMapLayerStack) {
763
+ const refMapLayerStack = obj.SAPVB.Scenes.Merge.SceneGeo.refMapLayerStack;
764
+ const provider = this._adapter._mapConfiguration.MapProvider.find(provider => provider.name === refMapLayerStack);
765
+ const style = provider.Source[0].url;
766
+ mapProvider.provider = style;
767
+ mapProvider.header = Array.isArray(provider.Header) ? provider.Header.reduce((acc, { name, value }) => ({ ...acc, [name]: value }), {}) : {}
768
+ VBI.MapRenderer.setRefMapLayerStack(style, mapProvider.header);
769
+ }
795
770
  if (obj.SAPVB.DataTypes) {
796
-
771
+ if (!this.mVBIContext.m_DataTypeProvider) {
772
+ this.mVBIContext.m_DataTypeProvider = new VBI.DataTypeProvider();
773
+ }
774
+ this.mVBIContext.m_DataTypeProvider.load(obj.SAPVB.DataTypes, this.mVBIContext);
797
775
  }
798
776
 
799
777
  if (obj.SAPVB.Resources) {
800
778
  resources = obj.SAPVB.Resources.Set.Resource;
779
+ // Convert Array to a Map
780
+ resourceMap = new Map(resources.map(item => [item.name, item.value]));
801
781
  }
802
782
 
803
783
  if (obj.SAPVB.Automation && obj.SAPVB.Automation.Call) {
804
- // VBI.VBITransformer._processAutomation(obj.SAPVB.Automation, obj.SAPVB.Menus);
784
+ VBI.VBITransformer._processAutomation(obj.SAPVB.Automation, obj);
805
785
  }
806
786
 
807
787
  if (obj.SAPVB.Menus && Object.keys(obj.SAPVB.Menus).length != 0) {
808
- // menus = obj.SAPVB.Menus.Set.Menu.MenuItem[0].text;
809
- menus = obj.SAPVB.Menus.Set.Menu;
788
+ menus = obj.SAPVB.Menus.Set.Menu;
810
789
  }
811
790
 
812
791
  if (obj.SAPVB.Data) {
813
792
  VBI.VBITransformer._extractData(obj);
814
793
  }
794
+
795
+ if (obj.SAPVB.Actions) {
796
+ VBI.MapRenderer.actionName(obj);
797
+ }
798
+
815
799
  // if(obj.SAPVB.Data.Remove){
816
800
  // VBI.VBITransformer._deleteData(obj);
817
801
  // }
818
802
 
819
803
 
820
- // if(obj.SAPVB.Windows){
821
-
822
- // }
804
+ if (obj.SAPVB.Windows) {
805
+ VBI.VBITransformer._processDetailWindows(obj);
806
+ }
823
807
 
824
808
  // if(obj.SAPVB.Actions){
825
809
 
@@ -852,23 +836,9 @@ sap.ui.define([
852
836
  VBI.VBITransformer.getVectorFlag = () => {
853
837
  return VBI.vectorFlag;
854
838
  }
855
- VBI.VBITransformer._processAutomation = function (automation, menus) {
856
- // var call = {};
857
- // if (automation.Call.handler === "CONTEXTMENUHANDLER") {
858
- // var that = this;
859
-
860
- // var automationTarget = VBI.VBITransformer._map();
861
- // if (menus.Set.Menu) {
862
- // [].concat(menus.Set.Menu).forEach(function(oMenu) {
863
- // that._attachHandler.call(
864
- // automationTarget,
865
- // oMenu.action ) } ) }
866
- // }
867
- // let menu = menus.Set.Menu.MenuItem.text;
868
- // featureCollection.push(menu);
869
- }
839
+
870
840
  VBI.VBITransformer._map = function () {
871
- return sap.ui.getCore().byId(this.getMap());
841
+ return sap.ui.getCore().byId(_adapter.getMap());
872
842
  };
873
843
  /**
874
844
  * Attaches the specified event handler to the specified event with the provided listener.