@sapui5/sap.ui.vbm 1.130.0 → 1.131.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 +53 -2
- package/src/sap/ui/vbm/Adapter3D.js +1 -1
- package/src/sap/ui/vbm/VBI.js +43 -36
- package/src/sap/ui/vbm/VBIRenderer.js +7 -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/themes/base/img/Pin_images.json +33 -1
- package/src/sap/ui/vbm/vector/MapRenderer.js +872 -0
- package/src/sap/ui/vbm/vector/PayloadGenerator.js +130 -0
- package/src/sap/ui/vbm/vector/VBITransformer.js +897 -0
- package/src/sap/ui/vbm/vector/VectorUtils.js +146 -0
- package/src/sap/ui/vbm/vector/thirdparty/MaplibreStyles.js +723 -0
- package/src/sap/ui/vbm/vector/thirdparty/maplibre.css +682 -0
- package/src/sap/ui/vbm/vector/thirdparty/maplibregl.js +37950 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
"sap/ui/base/Object",
|
|
4
|
+
], function (BaseObject) {
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const VectorUtils = BaseObject.extend("sap.ui.vbm.vector.VectorUtils", /** @lends sap.ui.vbm.vector.VectorUtils.prototype */ {
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
VectorUtils.createMap = (geoJSON, map_container) => {
|
|
11
|
+
|
|
12
|
+
return new maplibregl.Map({
|
|
13
|
+
container: map_container,
|
|
14
|
+
renderWorldCopies: false,
|
|
15
|
+
attributionControl: false,
|
|
16
|
+
dragRotate: false,
|
|
17
|
+
touchZoomRotate: false,
|
|
18
|
+
style: geoJSON[0].provider,
|
|
19
|
+
center: geoJSON[0].center,
|
|
20
|
+
zoom: geoJSON[0].zoom,
|
|
21
|
+
// Use transformRequest to modify requests for specific maps
|
|
22
|
+
transformRequest: (url, resourceType) => {
|
|
23
|
+
// Add the headers only for the specific types of requests
|
|
24
|
+
if (Object.keys(geoJSON[0].header).length != 0) {
|
|
25
|
+
return {
|
|
26
|
+
url: url,
|
|
27
|
+
headers: geoJSON[0].header // Add the header
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
|
|
31
|
+
return { url: url }; // For other maps, use the default request
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
VectorUtils.createSpotElement = (marker) => {
|
|
38
|
+
// create a DOM element for the marker (parent div)
|
|
39
|
+
const el = document.createElement('div');
|
|
40
|
+
|
|
41
|
+
// Set background image for the marker
|
|
42
|
+
var base64decoded = "data:image/png;base64," + marker.properties.base64;
|
|
43
|
+
el.style.backgroundImage = `url(${base64decoded})`;
|
|
44
|
+
el.style.width = marker.properties.width;
|
|
45
|
+
el.style.height = marker.properties.height;
|
|
46
|
+
el.style.backgroundSize = 'cover'; // Ensure image fits
|
|
47
|
+
return el;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
VectorUtils.createIconElement = (Icon) => {
|
|
51
|
+
const child_el = document.createElement('div');
|
|
52
|
+
child_el.className = 'marker';
|
|
53
|
+
child_el.style.position = 'absolute'; // Position it absolutely inside the parent
|
|
54
|
+
child_el.style.top = '30%'; // Adjust positioning
|
|
55
|
+
child_el.style.left = '50%';
|
|
56
|
+
child_el.style.transform = 'translate(-50%, -50%)'; // Center the icon
|
|
57
|
+
child_el.style.fontFamily = 'SAP-icons';
|
|
58
|
+
child_el.style.fontSize = '20px'; // Adjust size as needed
|
|
59
|
+
var iconInfo = sap.ui.core.IconPool.getIconInfo(Icon);
|
|
60
|
+
child_el.innerHTML = iconInfo.content;
|
|
61
|
+
return child_el;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
VectorUtils.createDropdownMenu = (menuData) => {
|
|
65
|
+
const dropdown = document.createElement('div');
|
|
66
|
+
dropdown.classList.add('dropdown');
|
|
67
|
+
|
|
68
|
+
const menuContainer = document.createElement('div');
|
|
69
|
+
menuContainer.classList.add('dropdown-content');
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function createMenu(items) {
|
|
73
|
+
const ul = document.createElement('ul');
|
|
74
|
+
if (Array.isArray(items)) {
|
|
75
|
+
items.forEach(items => {
|
|
76
|
+
const li = document.createElement('li');
|
|
77
|
+
li.textContent = items.text;
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if (items.MenuItem) {
|
|
82
|
+
const submenu = createMenu(items.MenuItem);
|
|
83
|
+
submenu.style.display = 'none'; // Hide submenu initially
|
|
84
|
+
submenu.style.position = 'absolute'; // Position it absolutely
|
|
85
|
+
submenu.style.left = '100%'; // Position submenu to the right of the parent
|
|
86
|
+
submenu.style.top = '0'; // Align to the top of the parent
|
|
87
|
+
submenu.style.backgroundColor = 'white';
|
|
88
|
+
submenu.style.display = 'none'; // Hide submenu initially
|
|
89
|
+
li.appendChild(submenu);
|
|
90
|
+
// Keep submenu open on hover
|
|
91
|
+
li.addEventListener('mouseenter', () => {
|
|
92
|
+
submenu.style.display = 'block'; // Show submenu on hover
|
|
93
|
+
});
|
|
94
|
+
// Toggle submenu visibility on click
|
|
95
|
+
li.addEventListener('click', (event) => {
|
|
96
|
+
event.stopPropagation(); // Prevent click event from propagating
|
|
97
|
+
submenu.style.display = submenu.style.display === 'block' ? 'none' : 'block';
|
|
98
|
+
|
|
99
|
+
// Close other submenus
|
|
100
|
+
document.querySelectorAll('.dropdown-content ul').forEach(sub => {
|
|
101
|
+
if (sub !== submenu) {
|
|
102
|
+
sub.style.display = 'none';
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
ul.appendChild(li);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return ul;
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
const mainMenu = createMenu(menuData.MenuItem);
|
|
115
|
+
menuContainer.appendChild(mainMenu);
|
|
116
|
+
dropdown.appendChild(menuContainer);
|
|
117
|
+
|
|
118
|
+
// Hide menu when clicking outside
|
|
119
|
+
document.addEventListener('click', () => {
|
|
120
|
+
menuContainer.style.display = 'none';
|
|
121
|
+
// Hide all submenus
|
|
122
|
+
menuContainer.querySelectorAll('ul').forEach(sub => {
|
|
123
|
+
sub.style.display = 'none';
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
// Toggle main dropdown visibility
|
|
127
|
+
dropdown.addEventListener('mouseenter', () => {
|
|
128
|
+
dropdown.style.display = 'block';
|
|
129
|
+
});
|
|
130
|
+
// Add dropdown to the body
|
|
131
|
+
document.body.appendChild(dropdown);
|
|
132
|
+
|
|
133
|
+
return dropdown;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Method to format the coordinates
|
|
137
|
+
VectorUtils.formatCoordinates = function (coords) {
|
|
138
|
+
return `${coords.lng};${coords.lat};0.0`;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
return VectorUtils;
|
|
143
|
+
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
|