@sapui5/sap.ui.vbm 1.84.9 → 1.84.12
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 +8 -2
- package/src/sap/ui/vbm/Adapter3D.js +1 -1
- package/src/sap/ui/vbm/AnalyticMap.js +7 -1
- package/src/sap/ui/vbm/GeoMap.js +7 -8
- package/src/sap/ui/vbm/Viewport.js +1 -1
- package/src/sap/ui/vbm/VoAggregation.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/SceneBuilder.js +1 -1
- package/src/sap/ui/vbm/adapter3d/VBIJSONParser.js +1 -1
- package/src/sap/ui/vbm/lib/sapdataprovider.js +9 -1
- package/src/sap/ui/vbm/lib/sapmapmanager.js +189 -21
- package/src/sap/ui/vbm/lib/sapmapprovider.js +19 -7
- package/src/sap/ui/vbm/lib/sapscene.js +1 -1
- package/src/sap/ui/vbm/lib/saputilities.js +5 -0
- package/src/sap/ui/vbm/library.js +2 -2
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.84.
|
|
6
|
+
<version>1.84.12</version>
|
|
7
7
|
|
|
8
8
|
<documentation>SAP UI library: sap.ui.vbm</documentation>
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ sap.ui.define([
|
|
|
21
21
|
* @param {string} [sId] id for the new control, generated automatically if no id is given
|
|
22
22
|
* @param {object} [mSettings] initial settings for the new object
|
|
23
23
|
* @author SAP SE
|
|
24
|
-
* @version 1.84.
|
|
24
|
+
* @version 1.84.12
|
|
25
25
|
* @extends sap.ui.core.Element
|
|
26
26
|
* @constructor
|
|
27
27
|
* @public
|
|
@@ -573,7 +573,13 @@ sap.ui.define([
|
|
|
573
573
|
resolution : provider.resolution,
|
|
574
574
|
retries : provider.retries,
|
|
575
575
|
type : provider.type,
|
|
576
|
-
|
|
576
|
+
Header : provider.Header ? [].concat(provider.Header).map(function(header) {
|
|
577
|
+
return {
|
|
578
|
+
name : header.name,
|
|
579
|
+
value : header.value
|
|
580
|
+
};
|
|
581
|
+
}) : provider.Header,
|
|
582
|
+
Source : provider.Source ? [].concat(provider.Source).map(function(source) {
|
|
577
583
|
return {
|
|
578
584
|
id : source.id,
|
|
579
585
|
url : source.url
|
|
@@ -42,7 +42,7 @@ sap.ui.define([
|
|
|
42
42
|
* @param {string} [sId] id for the new control, generated automatically if no id is given
|
|
43
43
|
* @param {object} [mSettings] initial settings for the new object
|
|
44
44
|
* @author SAP SE
|
|
45
|
-
* @version 1.84.
|
|
45
|
+
* @version 1.84.12
|
|
46
46
|
* @extends sap.ui.core.Element
|
|
47
47
|
* @constructor
|
|
48
48
|
* @public
|
|
@@ -321,7 +321,13 @@ sap.ui.define([
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// get the name of the fragment........................................//
|
|
324
|
-
|
|
324
|
+
if (f.properties && f.properties.name) {
|
|
325
|
+
tt = f.properties.name;
|
|
326
|
+
} else if (f.properties && f.properties.NAME) {
|
|
327
|
+
tt = f.properties.NAME;
|
|
328
|
+
} else {
|
|
329
|
+
tt = "";
|
|
330
|
+
}
|
|
325
331
|
this.mNames[f.id2] = tt;
|
|
326
332
|
this.mRegionProps[f.id2] = f.properties;
|
|
327
333
|
|
package/src/sap/ui/vbm/GeoMap.js
CHANGED
|
@@ -686,23 +686,22 @@ sap.ui.define([
|
|
|
686
686
|
* @param {string} oMapConfiguration.MapProvider.minLOD Minimal supported Level Of Detail.
|
|
687
687
|
* @param {string} oMapConfiguration.MapProvider.maxLOD Maximal supported Level Of Detail.
|
|
688
688
|
* @param {string} oMapConfiguration.MapProvider.copyright Copyright Information to be shown with the map.
|
|
689
|
-
* @param {array} oMapConfiguration.MapProvider.
|
|
690
|
-
*
|
|
689
|
+
* @param {array} oMapConfiguration.MapProvider.Header Array of HTTP headers definitions. Optional.
|
|
690
|
+
* @param {string} oMapConfiguration.MapProvider.Header.name Name of the header.
|
|
691
|
+
* @param {string} oMapConfiguration.MapProvider.Header.value Value of the header.
|
|
692
|
+
* @param {array} oMapConfiguration.MapProvider.Source Array of source definitions. At least on Source has to be given. Multiple sources can be used for load distribution.
|
|
691
693
|
* @param {string} oMapConfiguration.MapProvider.Source.id Source id.
|
|
692
|
-
* @param {string} oMapConfiguration.MapProvider.Source.url Source URL for map tile service. URL includes place holders for variable informations
|
|
693
|
-
* set at runtime, e.g. {LOD}.
|
|
694
|
+
* @param {string} oMapConfiguration.MapProvider.Source.url Source URL for map tile service. URL includes place holders for variable informations set at runtime, e.g. {LOD}.
|
|
694
695
|
* @param {array} oMapConfiguration.MapLayerStacks Array of Map Layer Stacks
|
|
695
696
|
* @param {string} oMapConfiguration.MapLayerStacks.name Name of Map Layer Stack. Use with the GeoMap refMapLayerStack property.
|
|
696
697
|
* @param {string} oMapConfiguration.MapLayerStacks.previewPosition.latitude Latitude position to use when creating image tile
|
|
697
698
|
* @param {string} oMapConfiguration.MapLayerStacks.previewPosition.longitude Longitude position to use when creating image tile
|
|
698
699
|
* @param {string} oMapConfiguration.MapLayerStacks.previewPosition.lod Lod position to use when creating image tile
|
|
699
|
-
* @param {array} oMapConfiguration.MapLayerStacks.MapLayer Array of Map Layers. Each Layer refers to a Map Proveride. Map Layers get overlayed in
|
|
700
|
-
* the given sequence.
|
|
700
|
+
* @param {array} oMapConfiguration.MapLayerStacks.MapLayer Array of Map Layers. Each Layer refers to a Map Proveride. Map Layers get overlayed in the given sequence.
|
|
701
701
|
* @param {string} oMapConfiguration.MapLayerStacks.MapLayer.name Name of Map Layer.
|
|
702
702
|
* @param {string} oMapConfiguration.MapLayerStacks.MapLayer.refMapProvider Name of referenced Map Provider.
|
|
703
703
|
* @param {string} oMapConfiguration.MapLayerStacks.MapLayer.opacity Opacity of Map Layer. Value range 0 to 1.
|
|
704
|
-
* @param {sap.ui.core.CSSColor} oMapConfiguration.MapLayerStacks.colBkgnd Background color for Map Layer. Only meaningful if opacity is
|
|
705
|
-
* below 1.
|
|
704
|
+
* @param {sap.ui.core.CSSColor} oMapConfiguration.MapLayerStacks.colBkgnd Background color for Map Layer. Only meaningful if opacity is below 1.
|
|
706
705
|
* @returns {sap.ui.vbm.GeoMap} This allows method chaining
|
|
707
706
|
* @public
|
|
708
707
|
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
|
|
@@ -351,7 +351,7 @@ sap.ui.define([
|
|
|
351
351
|
var key = (name.indexOf(".") !== -1) ? name.split(".")[1] : name;
|
|
352
352
|
for (var nJ = 0, len = aVO.length; nJ < len; ++nJ) {
|
|
353
353
|
// get the control.....................................................//
|
|
354
|
-
if (aVO[nJ].
|
|
354
|
+
if (aVO[nJ].getKey() === key) {
|
|
355
355
|
return aVO[nJ];
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -31,7 +31,7 @@ sap.ui.define([
|
|
|
31
31
|
*
|
|
32
32
|
* @private
|
|
33
33
|
* @author SAP SE
|
|
34
|
-
* @version 1.84.
|
|
34
|
+
* @version 1.84.12
|
|
35
35
|
* @alias sap.ui.vbm.adapter3d.ModelHandler
|
|
36
36
|
*/
|
|
37
37
|
var ModelHandler = BaseObject.extend("sap.ui.vbm.adapter3d.ModelHandler", /** @lends sap.ui.vbm.adapter3d.ModelHandler.prototype */ {
|
|
@@ -378,7 +378,7 @@ sap.ui.define([
|
|
|
378
378
|
*
|
|
379
379
|
* @private
|
|
380
380
|
* @author SAP SE
|
|
381
|
-
* @version 1.84.
|
|
381
|
+
* @version 1.84.12
|
|
382
382
|
* @alias sap.ui.vbm.adapter3d.ObjectFactory
|
|
383
383
|
*/
|
|
384
384
|
var ObjectFactory = BaseObject.extend("sap.ui.vbm.adapter3d.ObjectFactory", /** @lends sap.ui.vbm.adapter3d.ObjectFactory.prototype */ {});
|
|
@@ -34,7 +34,7 @@ sap.ui.define([
|
|
|
34
34
|
*
|
|
35
35
|
* @private
|
|
36
36
|
* @author SAP SE
|
|
37
|
-
* @version 1.84.
|
|
37
|
+
* @version 1.84.12
|
|
38
38
|
* @alias sap.ui.vbm.adapter3d.PolygonHandler
|
|
39
39
|
*/
|
|
40
40
|
var PolygonHandler = BaseObject.extend("sap.ui.vbm.adapter3d.PolygonHandler", /** @lends sap.ui.vbm.adapter3d.PolygonHandler.prototype */ {
|
|
@@ -50,7 +50,7 @@ function(jQuery, BaseObject, Utilities, PolygonHandler, ModelHandler, THREE, Dec
|
|
|
50
50
|
*
|
|
51
51
|
* @private
|
|
52
52
|
* @author SAP SE
|
|
53
|
-
* @version 1.84.
|
|
53
|
+
* @version 1.84.12
|
|
54
54
|
* @alias sap.ui.vbm.adapter3d.SceneBuilder
|
|
55
55
|
*/
|
|
56
56
|
var SceneBuilder = BaseObject.extend("sap.ui.vbm.adapter3d.SceneBuilder", /** @lends sap.ui.vbm.adapter3d.SceneBuilder.prototype */ {
|
|
@@ -58,7 +58,7 @@ sap.ui.define([
|
|
|
58
58
|
*
|
|
59
59
|
* @private
|
|
60
60
|
* @author SAP SE
|
|
61
|
-
* @version 1.84.
|
|
61
|
+
* @version 1.84.12
|
|
62
62
|
* @alias sap.ui.vbm.adapter3d.VBIJSONParser
|
|
63
63
|
*/
|
|
64
64
|
var VBIJSONParser = BaseObject.extend("sap.ui.vbm.adapter3d.VBIJSONParser", /** @lends sap.ui.vbm.adapter3d.VBIJSONParser.prototype */ {
|
|
@@ -993,7 +993,15 @@ VBI.DataProvider = function() {
|
|
|
993
993
|
if (type == A && (nJ + 1) == len) {
|
|
994
994
|
var ta;
|
|
995
995
|
if ((ta = curNodeType.GetTypeAttribute(parts[nJ], false))) {
|
|
996
|
-
|
|
996
|
+
if (curElement) {
|
|
997
|
+
return curElement.m_dataattributes[ta.m_nArrayIndex];
|
|
998
|
+
} else {
|
|
999
|
+
// no element specified, so we use the first one .............//
|
|
1000
|
+
if (curNode.m_dataelements.length) {
|
|
1001
|
+
curElement = curNode.m_dataelements[0];
|
|
1002
|
+
return curElement.m_dataattributes[ta.m_nArrayIndex];
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
997
1005
|
}
|
|
998
1006
|
}
|
|
999
1007
|
|
|
@@ -11,6 +11,7 @@ VBI.MapManager = (function() {
|
|
|
11
11
|
mapmanager.m_tileWidth = 256;
|
|
12
12
|
mapmanager.m_tileHeight = 256;
|
|
13
13
|
mapmanager.m_runningRequests = 0;
|
|
14
|
+
mapmanager.m_runningXhrRequests = 0;
|
|
14
15
|
mapmanager.m_limitRequests = 12;
|
|
15
16
|
mapmanager.m_requestQueue = [];
|
|
16
17
|
mapmanager.m_renderQueue = [];
|
|
@@ -19,13 +20,37 @@ VBI.MapManager = (function() {
|
|
|
19
20
|
mapmanager.m_renderJunksize = 100;
|
|
20
21
|
// image is loaded
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Increments and Decrements counters related to tile download connections
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
* @param {Image} image - Image object to track counters agains
|
|
28
|
+
* @param {number} factor - A positive or negative integer to be added to the counter
|
|
29
|
+
*/
|
|
30
|
+
mapmanager._modifyReqCounters = function(image, factor) {
|
|
31
|
+
if (image.m_Headers) { // if headers presents -> this is xhr request
|
|
32
|
+
mapmanager.m_runningXhrRequests += factor;
|
|
33
|
+
} else {
|
|
34
|
+
mapmanager.m_runningRequests += factor;
|
|
35
|
+
}
|
|
36
|
+
if (VBI.m_bTrace) {
|
|
37
|
+
VBI.Trace("Running Requests - Xhr: " + mapmanager.m_runningXhrRequests + ", src: " + mapmanager.m_runningRequests);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
22
41
|
mapmanager.onAbort = function(event) {
|
|
23
42
|
var image = event.srcElement;
|
|
24
43
|
|
|
25
44
|
if (VBI.m_bTrace) {
|
|
26
45
|
VBI.Trace("onAbort " + image.src);
|
|
27
46
|
}
|
|
47
|
+
|
|
48
|
+
//decrement the counters
|
|
49
|
+
mapmanager._modifyReqCounters(image, -1);
|
|
50
|
+
|
|
51
|
+
//trigger more requests if there are some in the queue
|
|
28
52
|
mapmanager.CheckReqQueue();
|
|
53
|
+
|
|
29
54
|
// unlink the image from within the image chain
|
|
30
55
|
mapmanager.UnlinkImage(image);
|
|
31
56
|
mapmanager.CheckTmpCanvas(image.m_Target, image.m_nRequest, image.m_nLayersAbove);
|
|
@@ -35,7 +60,9 @@ VBI.MapManager = (function() {
|
|
|
35
60
|
if (VBI.m_bTrace) {
|
|
36
61
|
VBI.Trace("onFailedSend " + object.src);
|
|
37
62
|
}
|
|
38
|
-
|
|
63
|
+
|
|
64
|
+
//decrement the counters
|
|
65
|
+
mapmanager._modifyReqCounters(object, -1);
|
|
39
66
|
mapmanager.m_bRequestError = true;
|
|
40
67
|
|
|
41
68
|
if (!mapmanager.m_failedSendTimer) {
|
|
@@ -51,6 +78,9 @@ VBI.MapManager = (function() {
|
|
|
51
78
|
if (VBI.m_bTrace) {
|
|
52
79
|
VBI.Trace("onError " + image.src);
|
|
53
80
|
}
|
|
81
|
+
|
|
82
|
+
//decrement the counters
|
|
83
|
+
mapmanager._modifyReqCounters(image, -1);
|
|
54
84
|
mapmanager.CheckReqQueue();
|
|
55
85
|
|
|
56
86
|
var imageRender = null;
|
|
@@ -62,8 +92,10 @@ VBI.MapManager = (function() {
|
|
|
62
92
|
if (image.m_Prev == null && image.m_Next != null && image.m_Next.complete == true) {
|
|
63
93
|
imageRender = image.m_Next;
|
|
64
94
|
}
|
|
95
|
+
|
|
65
96
|
// unlink the image from within the image chain
|
|
66
97
|
mapmanager.UnlinkImage(image);
|
|
98
|
+
|
|
67
99
|
// when the image is the first in current and would be rendered
|
|
68
100
|
if (imageRender != null) {
|
|
69
101
|
mapmanager.m_renderQueue.push(imageRender);
|
|
@@ -81,9 +113,18 @@ VBI.MapManager = (function() {
|
|
|
81
113
|
if (!image.complete) { //skip odd onload event from IE where image is not loaded yet
|
|
82
114
|
return;
|
|
83
115
|
}
|
|
116
|
+
|
|
117
|
+
//If the request is xhr then we need to revoke the blob data url once loaded
|
|
118
|
+
if (image.m_Headers) {
|
|
119
|
+
(window.URL || window.webkitURL).revokeObjectURL(image.src);
|
|
120
|
+
}
|
|
121
|
+
|
|
84
122
|
if (VBI.m_bTrace) {
|
|
85
|
-
VBI.Trace("VBI.MapManager: onLoad
|
|
123
|
+
VBI.Trace("VBI.MapManager: onLoad " + (image.m_Headers ? "(xhr) " : " ") + (image.m_Headers ? image.src2execute : image.src));
|
|
86
124
|
}
|
|
125
|
+
|
|
126
|
+
//decrement the counters
|
|
127
|
+
mapmanager._modifyReqCounters(image, -1);
|
|
87
128
|
mapmanager.CheckReqQueue();
|
|
88
129
|
|
|
89
130
|
var bChainComplete = true; // I for myself am complete as I am in onLoad.
|
|
@@ -111,7 +152,6 @@ VBI.MapManager = (function() {
|
|
|
111
152
|
clearInterval(mapmanager.m_failedSendTimer);
|
|
112
153
|
mapmanager.m_failedSendTimer = 0;
|
|
113
154
|
mapmanager.m_bRequestError = false;
|
|
114
|
-
mapmanager.m_runningRequests++;
|
|
115
155
|
mapmanager.CheckReqQueue();
|
|
116
156
|
};
|
|
117
157
|
|
|
@@ -124,7 +164,14 @@ VBI.MapManager = (function() {
|
|
|
124
164
|
mapmanager.CheckTmpCanvas(targetCanvas, image.m_nRequest, image.m_nLayersAbove);
|
|
125
165
|
} else {
|
|
126
166
|
try {
|
|
127
|
-
|
|
167
|
+
//Check for xhr object and resend if present, otherwise set image src
|
|
168
|
+
if (image.m_Headers) {
|
|
169
|
+
mapmanager._createHttpRequest(image);
|
|
170
|
+
} else {
|
|
171
|
+
mapmanager.m_bRequestError = false;
|
|
172
|
+
mapmanager._modifyReqCounters(image, 1);
|
|
173
|
+
image.src = image.src2execute;
|
|
174
|
+
}
|
|
128
175
|
} catch (e) {
|
|
129
176
|
mapmanager.m_requestQueue.unshift(image);
|
|
130
177
|
mapmanager.onFailedSend(image);
|
|
@@ -133,7 +180,6 @@ VBI.MapManager = (function() {
|
|
|
133
180
|
}
|
|
134
181
|
}
|
|
135
182
|
// no further request to be executed
|
|
136
|
-
mapmanager.m_runningRequests--;
|
|
137
183
|
};
|
|
138
184
|
|
|
139
185
|
mapmanager.RenderTiles = function() {
|
|
@@ -146,11 +192,14 @@ VBI.MapManager = (function() {
|
|
|
146
192
|
|
|
147
193
|
mapmanager.RenderTile = function(image) {
|
|
148
194
|
if (!image.bRendered) {
|
|
195
|
+
|
|
196
|
+
//get the target canvas reference from the image property and check whether rendering should be redirected to another canvas
|
|
149
197
|
var targetCanvas = image.m_Target;
|
|
150
198
|
if ((targetCanvas.m_CanvasRedirect != undefined) && (targetCanvas.m_CanvasRedirRequest == image.m_nRequest)) {
|
|
151
199
|
targetCanvas = targetCanvas.m_CanvasRedirect;
|
|
152
200
|
}
|
|
153
201
|
|
|
202
|
+
//If the canvas isn't connected to a scene then don't render
|
|
154
203
|
var currentScene = targetCanvas.m_Scene;
|
|
155
204
|
if (!currentScene) {
|
|
156
205
|
return;
|
|
@@ -162,16 +211,17 @@ VBI.MapManager = (function() {
|
|
|
162
211
|
targetCanvas.m_nAppliedRequest = Math.max(targetCanvas.m_nAppliedRequest, image.m_nRequest);
|
|
163
212
|
var context = targetCanvas.getContext('2d');
|
|
164
213
|
|
|
214
|
+
//Get the maximum number of tiles for the specified zoom level
|
|
165
215
|
var nMaxX = (1 << context.canvas.m_nCurrentLOD);
|
|
166
216
|
|
|
217
|
+
//Calculate whether current image is still visibile for the current canvas
|
|
167
218
|
var nCol = ((image.m_nReqX - context.canvas.m_nCurrentX) % nMaxX + nMaxX) % nMaxX; // double mod for neg.numbers
|
|
168
219
|
if (nMaxX < currentScene.m_nTilesX) {
|
|
169
220
|
nCol = image.m_nCol + image.m_nXOrigin - context.canvas.m_nCurrentX;
|
|
170
221
|
}
|
|
171
|
-
|
|
172
222
|
var nRow = image.m_nReqY - context.canvas.m_nCurrentY;
|
|
173
223
|
|
|
174
|
-
// unlink and return when image request is outdated
|
|
224
|
+
// unlink and return when image request is outdated / would not be visible
|
|
175
225
|
if (image.m_bOutdated || (nCol < 0) || (nRow < 0) || (nCol >= image.m_numCol) || (nRow >= image.m_numRow) || (image.m_nLOD != targetCanvas.m_nCurrentLOD || targetCanvas.m_bInvalid)) {
|
|
176
226
|
mapmanager.UnlinkImage(image);
|
|
177
227
|
|
|
@@ -193,10 +243,15 @@ VBI.MapManager = (function() {
|
|
|
193
243
|
targetCanvas.setPixelWidth(nWidth);
|
|
194
244
|
targetCanvas.setPixelHeight(nHeight);
|
|
195
245
|
|
|
246
|
+
//Calculate the current image/tile width relative to the canvas
|
|
196
247
|
var tilewidth = nWidth / currentScene.m_nTilesX;
|
|
197
248
|
var tileheight = nHeight / currentScene.m_nTilesY;
|
|
249
|
+
|
|
250
|
+
//Calculate the correct offset for this tile on the current canvas
|
|
198
251
|
var left = nCol * tilewidth;
|
|
199
252
|
var top = nRow * tileheight;
|
|
253
|
+
|
|
254
|
+
//Scale the image to canvas if required (e.g. smaller tile / static map image)
|
|
200
255
|
var picWidth = image.m_nXExpansion * tilewidth;
|
|
201
256
|
var picHeight = image.m_nYExpansion * tileheight;
|
|
202
257
|
|
|
@@ -206,6 +261,7 @@ VBI.MapManager = (function() {
|
|
|
206
261
|
while (imageTemp.m_Prev != null) {
|
|
207
262
|
imageTemp = imageTemp.m_Prev;
|
|
208
263
|
}
|
|
264
|
+
|
|
209
265
|
while (imageTemp != null && imageTemp.complete == true) {
|
|
210
266
|
// optional draw the image background into the canvas
|
|
211
267
|
if (imageTemp.m_FillStyle != null) {
|
|
@@ -217,7 +273,8 @@ VBI.MapManager = (function() {
|
|
|
217
273
|
context.fillRect(left, top, picWidth, picHeight);
|
|
218
274
|
context.fillStyle = tmpFillStyle;
|
|
219
275
|
}
|
|
220
|
-
|
|
276
|
+
|
|
277
|
+
//Draw the image to the canvas with the specified opacity
|
|
221
278
|
if (VBI.m_bTrace) {
|
|
222
279
|
VBI.Trace("RenderTile drawImage " + imageTemp.src);
|
|
223
280
|
}
|
|
@@ -226,6 +283,7 @@ VBI.MapManager = (function() {
|
|
|
226
283
|
context.drawImage(imageTemp, left, top, picWidth, picHeight);
|
|
227
284
|
imageTemp.bRendered = true;
|
|
228
285
|
|
|
286
|
+
// as soon as an image is rendererd set the parent of the next to null
|
|
229
287
|
if (imageTemp.m_Next != null) {
|
|
230
288
|
imageTemp.m_Next.m_Prev = null;
|
|
231
289
|
}
|
|
@@ -258,7 +316,7 @@ VBI.MapManager = (function() {
|
|
|
258
316
|
};
|
|
259
317
|
|
|
260
318
|
mapmanager.CheckTmpCanvas = function(targetCanvas, imgRequest, nTilesAbove) {
|
|
261
|
-
|
|
319
|
+
//tries to fill the hidden canvas with tiles before displaying it
|
|
262
320
|
if ((targetCanvas.m_nTilesBefSwitch != undefined) && (targetCanvas.m_nRequest == imgRequest) && !nTilesAbove) {
|
|
263
321
|
targetCanvas.m_nTilesBefSwitch--;
|
|
264
322
|
if (!targetCanvas.m_nTilesBefSwitch) {
|
|
@@ -267,6 +325,7 @@ VBI.MapManager = (function() {
|
|
|
267
325
|
}
|
|
268
326
|
|
|
269
327
|
};
|
|
328
|
+
|
|
270
329
|
// request the tiles
|
|
271
330
|
mapmanager.RequestTiles = function(targetCanvas, maplayerstack, x, y, nx, ny, leftOffset, topOffset, rightOffset, bottomOffset, lod, bclear) {
|
|
272
331
|
mapmanager.m_bRequestError = false;
|
|
@@ -288,6 +347,8 @@ VBI.MapManager = (function() {
|
|
|
288
347
|
}
|
|
289
348
|
|
|
290
349
|
var nCount = 0;
|
|
350
|
+
|
|
351
|
+
//Calculate XMax based on the YMax for a given ratio of X->Y for the current projection
|
|
291
352
|
var nYMax = (1 << lod);
|
|
292
353
|
var xyRatio = sc.m_Proj.m_nXYRatio;
|
|
293
354
|
var nXMax = nYMax * xyRatio;
|
|
@@ -313,6 +374,7 @@ VBI.MapManager = (function() {
|
|
|
313
374
|
var ni, nk, nYExpansion, nCurrentXExpansion = 1;
|
|
314
375
|
var yCorr = y;
|
|
315
376
|
|
|
377
|
+
//future: Adjust logic to account for m_bSingleBMP on maplayer level
|
|
316
378
|
if (maplayerstack.m_bSingleBMP) {
|
|
317
379
|
nk = 1;
|
|
318
380
|
yCorr = Math.max(0, y);
|
|
@@ -335,6 +397,7 @@ VBI.MapManager = (function() {
|
|
|
335
397
|
if (nReqX < 0) {
|
|
336
398
|
nReqX = nXMax + nReqX;
|
|
337
399
|
}
|
|
400
|
+
|
|
338
401
|
var nReqY = yCorr + topOffset + k;
|
|
339
402
|
if ((nReqY + nYExpansion) <= 0 || nReqY >= nYMax) {
|
|
340
403
|
if ((targetCanvas.m_nTilesBefSwitch != undefined) && (targetCanvas.m_nTilesBefSwitch > 0)) {
|
|
@@ -396,25 +459,28 @@ VBI.MapManager = (function() {
|
|
|
396
459
|
var url;
|
|
397
460
|
|
|
398
461
|
if (mapProv.m_bPosRequired) {
|
|
399
|
-
var leftupper = [
|
|
400
|
-
|
|
401
|
-
];
|
|
402
|
-
var rightlower = [
|
|
403
|
-
(nReqX + nCurrentXExpansion) * fTileSize / xyRatio - 1, (nReqY + nYExpansion) * fTileSize - 1
|
|
404
|
-
];
|
|
462
|
+
var leftupper = [nReqX * fTileSize / xyRatio - 1, nReqY * fTileSize - 1];
|
|
463
|
+
var rightlower = [(nReqX + nCurrentXExpansion) * fTileSize / xyRatio - 1, (nReqY + nYExpansion) * fTileSize - 1];
|
|
405
464
|
// VBI.Trace("Requesting "+nReqX+","+nReqY+" with Extension "+nCurrentXExpansion+". Coordinates :
|
|
406
465
|
// "+leftupper[0]+"-->"+rightlower[0]+","+rightlower[1]);
|
|
407
466
|
url = mapProv.CombineUrlWPos(nReqX, nReqY, lod, fTileSize, leftupper, rightlower, nCurrentXExpansion, nYExpansion, mapmanager.m_requestTileWidth, mapmanager.m_requestTileHeight);
|
|
408
467
|
} else {
|
|
409
468
|
url = mapProv.CombineUrl(nReqX, nReqY, lod);
|
|
410
469
|
}
|
|
470
|
+
|
|
411
471
|
image.onload = mapmanager.onLoad;
|
|
412
472
|
image.onerror = mapmanager.onError;
|
|
413
473
|
image.onabort = mapmanager.onAbort;
|
|
414
474
|
|
|
415
|
-
|
|
416
|
-
|
|
475
|
+
//If the provider has headers defined, then we must use the HTTP Request approach
|
|
476
|
+
//as it is possible that the application provided an image via the URL callback, we check for a data url before proceeding with the HTTP Request creation
|
|
477
|
+
if (mapProv.m_Headers && url.substring(0, 5).toLowerCase() != "data:") {
|
|
478
|
+
image.m_Headers = mapProv.m_Headers;
|
|
479
|
+
image.src2execute = url; //store the URL in case the request ends up being queued
|
|
480
|
+
mapmanager._createHttpRequest(image);
|
|
481
|
+
} else if ((mapmanager.m_runningRequests < mapmanager.m_limitRequests) && (!mapmanager.m_bRequestError)) { //The request is for a URL only or it is a data URL
|
|
417
482
|
try {
|
|
483
|
+
mapmanager._modifyReqCounters(image, 1);
|
|
418
484
|
image.src = url;
|
|
419
485
|
} catch (e) {
|
|
420
486
|
image.src2execute = url;
|
|
@@ -425,6 +491,7 @@ VBI.MapManager = (function() {
|
|
|
425
491
|
image.src2execute = url;
|
|
426
492
|
mapmanager.m_requestQueue.push(image);
|
|
427
493
|
}
|
|
494
|
+
|
|
428
495
|
image.m_nCount = nCount;
|
|
429
496
|
|
|
430
497
|
if (VBI.m_bTrace) {
|
|
@@ -466,7 +533,7 @@ VBI.MapManager = (function() {
|
|
|
466
533
|
|
|
467
534
|
mapmanager.GetPreviewImage = function(lon, lat, lod, maplayerstack, scene, callback) {
|
|
468
535
|
//extend layer configuration object with preview location object which is {lat, lon, lod}
|
|
469
|
-
if (!callback || !maplayerstack
|
|
536
|
+
if (!callback || !maplayerstack || !lon || !lod || !lat || !scene) { //check that parameters are valid
|
|
470
537
|
return;
|
|
471
538
|
}
|
|
472
539
|
|
|
@@ -478,7 +545,7 @@ VBI.MapManager = (function() {
|
|
|
478
545
|
var xyRatio = scene.m_Proj.m_nXYRatio; //ratio from current projection
|
|
479
546
|
var lodDistance = (1 << lod); //how many tiles on a particular lod?
|
|
480
547
|
var tileSize = 2.0 / lodDistance; //???
|
|
481
|
-
var lonlat = VBI.MathLib.DegToRad([parseFloat(lon),parseFloat(lat)]); //from degrees to radians
|
|
548
|
+
var lonlat = VBI.MathLib.DegToRad([parseFloat(lon), parseFloat(lat)]); //from degrees to radians
|
|
482
549
|
var uxy = [lodDistance * tileWidth, lodDistance * tileHeight]; //prepare conversion from lat,lon
|
|
483
550
|
scene.m_Proj.LonLatToUCS(lonlat, uxy); // to User Coordinate System (pixel space of a target lod)
|
|
484
551
|
var x = Math.floor(uxy[0] / tileWidth); // calculate X tile coordinate
|
|
@@ -527,7 +594,7 @@ VBI.MapManager = (function() {
|
|
|
527
594
|
var stretchY = canvas.height;
|
|
528
595
|
|
|
529
596
|
// Draw image based on measurments
|
|
530
|
-
context.drawImage(this.m_Images[i],clipPosX,clipPosY,clipWidth,clipHeight, offsetX,offsetY, stretchX, stretchY); //draw image to canvas
|
|
597
|
+
context.drawImage(this.m_Images[i], clipPosX, clipPosY, clipWidth, clipHeight, offsetX, offsetY, stretchX, stretchY); //draw image to canvas
|
|
531
598
|
}
|
|
532
599
|
}
|
|
533
600
|
var tileImages = new Image();
|
|
@@ -543,6 +610,11 @@ VBI.MapManager = (function() {
|
|
|
543
610
|
VBI.Trace("onLoad " + event.target.src);
|
|
544
611
|
}
|
|
545
612
|
var image = event.target;
|
|
613
|
+
|
|
614
|
+
//If the request was xhr then we need to revoke the blob data url once loaded
|
|
615
|
+
if (image.m_Headers) {
|
|
616
|
+
(window.URL || window.webkitURL).revokeObjectURL(image.src);
|
|
617
|
+
}
|
|
546
618
|
image.m_Context.compose();
|
|
547
619
|
};
|
|
548
620
|
|
|
@@ -589,12 +661,20 @@ VBI.MapManager = (function() {
|
|
|
589
661
|
if (layer.m_fOpacity) {
|
|
590
662
|
image.m_Opacity = layer.m_fOpacity;
|
|
591
663
|
}
|
|
664
|
+
|
|
592
665
|
image.onload = onImageLoad;
|
|
593
666
|
image.onabort = onImageAbort;
|
|
594
667
|
image.onerror = onImageError;
|
|
595
668
|
|
|
596
669
|
try {
|
|
597
|
-
|
|
670
|
+
if (provider.m_Headers && url.substring(0, 5).toLowerCase() != "data:") {
|
|
671
|
+
//Handle requests that require headers
|
|
672
|
+
image.m_Headers = provider.m_Headers;
|
|
673
|
+
image.src2execute = url;
|
|
674
|
+
mapmanager._createHttpRequest(image, true);
|
|
675
|
+
} else {
|
|
676
|
+
image.src = url;
|
|
677
|
+
}
|
|
598
678
|
} catch (ex) {
|
|
599
679
|
if (VBI.m_bTrace) {
|
|
600
680
|
VBI.Trace("GetPreviewImage " + ex);
|
|
@@ -604,5 +684,93 @@ VBI.MapManager = (function() {
|
|
|
604
684
|
}
|
|
605
685
|
}
|
|
606
686
|
};
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Helper function used to create and manage HTTP request objects
|
|
690
|
+
*
|
|
691
|
+
* @private
|
|
692
|
+
* @param {Image} image - Image object to use for request
|
|
693
|
+
* @param {boolean} preview - True if image is requested for preview.
|
|
694
|
+
*/
|
|
695
|
+
mapmanager._createHttpRequest = function(image, preview) {
|
|
696
|
+
if (preview || mapmanager.m_runningXhrRequests < mapmanager.m_limitRequests) { // 'preview' images are not participated in requests limitation process
|
|
697
|
+
if (!preview) { // modify counter only if it is not a 'preview' image
|
|
698
|
+
mapmanager._modifyReqCounters(image, 1);
|
|
699
|
+
}
|
|
700
|
+
//Make a xhr request promise
|
|
701
|
+
var oXMLHttpRequest = (typeof window.sinon === "object" && window.sinon.xhr && window.sinon.xhr.XMLHttpRequest) ? window.sinon.xhr.XMLHttpRequest : XMLHttpRequest;
|
|
702
|
+
var xhr = new oXMLHttpRequest();
|
|
703
|
+
xhr.m_Image = image;
|
|
704
|
+
|
|
705
|
+
xhr.onerror = function(event) {
|
|
706
|
+
// onerror event caters for events such as CORS errors
|
|
707
|
+
if (this.m_Image && this.m_Image.onerror) {
|
|
708
|
+
this.m_Image.onerror({
|
|
709
|
+
srcElement: this.m_Image, // in case of a normal image
|
|
710
|
+
target: this.m_Image // in case of a 'preview' image
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
jQuery.sap.log.error("Download error: " + this.statusText);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if (!preview) { // skip for 'preview' images as they cannot be outdated
|
|
717
|
+
//If the mapmanager has decided the image is outdated then abort loading
|
|
718
|
+
xhr.onprogress = function(event) {
|
|
719
|
+
if (this.m_Image && this.m_Image.m_bOutdated) {
|
|
720
|
+
this.abort();
|
|
721
|
+
this.m_Image.onabort({
|
|
722
|
+
srcElement: this.m_Image
|
|
723
|
+
});
|
|
724
|
+
jQuery.sap.log.error("Download error: image outdated");
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
xhr.onload = function(event) {
|
|
730
|
+
// When file is loaded from a Cordova container the status equals 0
|
|
731
|
+
if (this.status === 200 || this.status === 0) {
|
|
732
|
+
var contentType = this.getResponseHeader("Content-Type");
|
|
733
|
+
if (contentType.split("/")[0] == "image") {
|
|
734
|
+
this.m_Image.src = (window.URL || window.webkitURL).createObjectURL(this.response);
|
|
735
|
+
} else {
|
|
736
|
+
this.m_Image.onerror({
|
|
737
|
+
srcElement: this.m_Image, // in case of a normal image
|
|
738
|
+
target: this.m_Image // in case of a 'preview' image
|
|
739
|
+
});
|
|
740
|
+
jQuery.sap.log.error("Download error: image response type expected. Recieved: " + contentType);
|
|
741
|
+
}
|
|
742
|
+
} else {
|
|
743
|
+
// onload event is also called in the case of status code 404 Not Found.
|
|
744
|
+
// This is why we have to check for the right status. If the status is not
|
|
745
|
+
// something that indicates success, we fire the fireItemFailed event.
|
|
746
|
+
if (preview) {
|
|
747
|
+
this.m_Image.onerror({
|
|
748
|
+
target: this.m_Image // in case of a 'preview' image
|
|
749
|
+
});
|
|
750
|
+
} else {
|
|
751
|
+
if (this.m_Image && !this.m_Image.m_bOutdated) {
|
|
752
|
+
mapmanager.m_requestQueue.push(this.m_Image);
|
|
753
|
+
}
|
|
754
|
+
mapmanager.onFailedSend(this.m_Image);
|
|
755
|
+
}
|
|
756
|
+
jQuery.sap.log.error("Download error: " + this.statusText);
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
|
|
760
|
+
xhr.open("GET", image.src2execute, true);
|
|
761
|
+
|
|
762
|
+
//Add headers array to the request
|
|
763
|
+
image.m_Headers.forEach(function(header) {
|
|
764
|
+
xhr.setRequestHeader(header.name, header.value);
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
xhr.responseType = "blob";
|
|
768
|
+
xhr.send(null);
|
|
769
|
+
} else {
|
|
770
|
+
mapmanager.m_requestQueue.push(image);
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
|
|
607
775
|
return mapmanager;
|
|
608
776
|
})();
|
|
@@ -22,14 +22,14 @@ VBI.MapProviders = function() {
|
|
|
22
22
|
|
|
23
23
|
mapproviders.load = function(dat, ctx) {
|
|
24
24
|
// load the json delta data............................................//
|
|
25
|
-
//
|
|
25
|
+
// future: do more than only set
|
|
26
26
|
if (dat.Set) {
|
|
27
27
|
var mp;
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// future: refine delta loading
|
|
30
30
|
mapproviders.clear();
|
|
31
31
|
// load the mapproviders............................................//
|
|
32
|
-
//
|
|
32
|
+
// future: support specialized sets and removes.......................//
|
|
33
33
|
if (dat.Set.MapProvider) {
|
|
34
34
|
if (jQuery.type(dat.Set.MapProvider) == 'object') {
|
|
35
35
|
mp = new VBI.MapProvider();
|
|
@@ -67,7 +67,7 @@ VBI.MapProviders = function() {
|
|
|
67
67
|
// ...........................................................................//
|
|
68
68
|
// MapProvider namespace.....................................................//
|
|
69
69
|
|
|
70
|
-
VBI.MapProvider = function(name, description, copyright, tileX, tileY, minLOD, maxLOD, fillStyle, resolution, projection) {
|
|
70
|
+
VBI.MapProvider = function(name, description, copyright, tileX, tileY, minLOD, maxLOD, fillStyle, resolution, projection, headers) {
|
|
71
71
|
"use strict";
|
|
72
72
|
var mapprovider = {};
|
|
73
73
|
mapprovider.vbiclass = "MapProvider";
|
|
@@ -83,6 +83,7 @@ VBI.MapProvider = function(name, description, copyright, tileX, tileY, minLOD, m
|
|
|
83
83
|
mapprovider.m_minLOD = typeof minLOD !== 'undefined' ? minLOD : 0;
|
|
84
84
|
mapprovider.m_nResolution = typeof resolution != 'undefined' ? resolution : 256;
|
|
85
85
|
mapprovider.m_nProjection = typeof projection != 'undefined' ? projection : 1;
|
|
86
|
+
mapprovider.m_Headers = headers; // Headers can be undefined
|
|
86
87
|
|
|
87
88
|
// set optional background style of map provider..........................//
|
|
88
89
|
if (fillStyle != null) {
|
|
@@ -140,7 +141,7 @@ VBI.MapProvider = function(name, description, copyright, tileX, tileY, minLOD, m
|
|
|
140
141
|
|
|
141
142
|
mapprovider.load = function(dat) {
|
|
142
143
|
// load dataprovider attributes........................................//
|
|
143
|
-
//
|
|
144
|
+
// future: add additional attributes
|
|
144
145
|
if (dat.name) {
|
|
145
146
|
mapprovider.m_Name = dat.name;
|
|
146
147
|
}
|
|
@@ -178,6 +179,17 @@ VBI.MapProvider = function(name, description, copyright, tileX, tileY, minLOD, m
|
|
|
178
179
|
mapprovider.m_nProjection = 3;
|
|
179
180
|
}
|
|
180
181
|
}
|
|
182
|
+
if (dat.Header) {
|
|
183
|
+
[].concat(dat.Header).forEach(function(header) {
|
|
184
|
+
if (header.name) { // name must not be empty, while value can be empty (HTTP headers spec)
|
|
185
|
+
if (!mapprovider.m_Headers) {
|
|
186
|
+
mapprovider.m_Headers = [];
|
|
187
|
+
}
|
|
188
|
+
mapprovider.m_Headers.push(header);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
181
193
|
var mapBase = dat.MapBase;
|
|
182
194
|
mapprovider.m_StdMapBase = mapprovider.addMapBase(-1, 1, 1, -1, 10);
|
|
183
195
|
if (dat.MapBase) {
|
|
@@ -217,8 +229,8 @@ VBI.MapProvider = function(name, description, copyright, tileX, tileY, minLOD, m
|
|
|
217
229
|
|
|
218
230
|
var nMax = 1 << lod;
|
|
219
231
|
// check levels......................................................//
|
|
220
|
-
// if( x < 0 || ( y + yExpansion ) <= 0 || ( x >= nMax ) || ( y >= nYMax ) )
|
|
221
|
-
// return null;
|
|
232
|
+
// if( x < 0 || ( y + yExpansion ) <= 0 || ( x >= nMax ) || ( y >= nYMax ) )
|
|
233
|
+
// return null;
|
|
222
234
|
// VBI.Trace("Org on lod "+lod+" : ["+(lu[0]).toFixed(7)+","+(lu[1]).toFixed(7)+"] - ["+(rl[0]).toFixed(7)+","+(rl[1]).toFixed(7)+"]");
|
|
223
235
|
var nRound = 10;
|
|
224
236
|
if (mapprovider.m_MapBase) {
|
|
@@ -3358,7 +3358,7 @@ VBI.GeoScene = function(target, mapmanager, maplayerstack) {
|
|
|
3358
3358
|
}
|
|
3359
3359
|
var sCopyright = scene.m_MapLayerStack.GetCopyright();
|
|
3360
3360
|
if (sCopyright) {
|
|
3361
|
-
scene.m_DivCopyright.innerHTML =
|
|
3361
|
+
scene.m_DivCopyright.innerHTML = sCopyright;
|
|
3362
3362
|
} else {
|
|
3363
3363
|
scene.m_DivCopyright.style.paddingRight = 0;
|
|
3364
3364
|
scene.m_DivCopyright.style.paddingLeft = 0;
|
|
@@ -1951,6 +1951,11 @@ VBI.Utilities.AssembleCopyrightString = function(Copyright, CopyrightLink, Copyr
|
|
|
1951
1951
|
var regex3 = /\{LINK\|([^\}]+)\}/;
|
|
1952
1952
|
|
|
1953
1953
|
if (Copyright) {
|
|
1954
|
+
if (!CopyrightLink && !CopyrightImage) {
|
|
1955
|
+
Copyright = jQuery.sap.encodeHTML(Copyright);
|
|
1956
|
+
}
|
|
1957
|
+
CopyrightLink = CopyrightLink ? jQuery.sap.encodeHTML(CopyrightLink):CopyrightLink;
|
|
1958
|
+
CopyrightImage = CopyrightImage ? jQuery.sap.encodeHTML(CopyrightImage):CopyrightImage;
|
|
1954
1959
|
var tmp = Copyright.replace(regex1, "<a href='" + CopyrightLink + "'><img src='" + CopyrightImage + "' width='10' height='10' border='none'></a>");
|
|
1955
1960
|
tmp = tmp.replace(regex2, "<img src='" + CopyrightImage + "' width='10' height='10' border='none' >");
|
|
1956
1961
|
return tmp.replace(regex3, "<a href='" + CopyrightLink + "'>$1</a>");
|
|
@@ -17,7 +17,7 @@ sap.ui.define([
|
|
|
17
17
|
* @namespace
|
|
18
18
|
* @name sap.ui.vbm
|
|
19
19
|
* @author SAP SE
|
|
20
|
-
* @version 1.84.
|
|
20
|
+
* @version 1.84.12
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
23
|
|
|
@@ -47,7 +47,7 @@ sap.ui.define([
|
|
|
47
47
|
"sap.ui.vbm.ClusterBase", "sap.ui.vbm.ClusterTree", "sap.ui.vbm.ClusterGrid", "sap.ui.vbm.ClusterDistance", "sap.ui.vbm.Heatmap",
|
|
48
48
|
"sap.ui.vbm.HeatPoint", "sap.ui.vbm.ClusterContainer", "sap.ui.vbm.Adapter", "sap.ui.vbm.Adapter3D"
|
|
49
49
|
],
|
|
50
|
-
version: "1.84.
|
|
50
|
+
version: "1.84.12"
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
jQuery.sap.registerModuleShims({
|