@sapui5/sap.ui.vbm 1.108.3 → 1.108.4

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.108.3",
3
+ "version": "1.108.4",
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.108.3</version>
6
+ <version>1.108.4</version>
7
7
 
8
8
  <documentation>SAP UI library: sap.ui.vbm</documentation>
9
9
 
@@ -22,7 +22,7 @@ sap.ui.define([
22
22
  * @param {string} [sId] id for the new control, generated automatically if no id is given
23
23
  * @param {object} [mSettings] initial settings for the new object
24
24
  * @author SAP SE
25
- * @version 1.108.3
25
+ * @version 1.108.4
26
26
  * @extends sap.ui.core.Element
27
27
  * @constructor
28
28
  * @public
@@ -45,7 +45,7 @@ sap.ui.define([
45
45
  * @param {string} [sId] id for the new control, generated automatically if no id is given
46
46
  * @param {object} [mSettings] initial settings for the new object
47
47
  * @author SAP SE
48
- * @version 1.108.3
48
+ * @version 1.108.4
49
49
  * @extends sap.ui.core.Element
50
50
  * @constructor
51
51
  * @public
@@ -94,7 +94,7 @@ sap.ui.define([
94
94
  regionDeselect: {}
95
95
  }
96
96
  },
97
-
97
+
98
98
  renderer: AnalyticMapRenderer
99
99
  });
100
100
 
@@ -235,7 +235,7 @@ sap.ui.define([
235
235
  var colCB = this.mColCB = AnalyticMap.DefaultRegionColorBorder;
236
236
 
237
237
  // helper function. returns {} as jQuery.extend can deep copy 'plain' objects only.
238
- function _createRegion(id, array, type, color, colorBorder, tooltip, entity) {
238
+ function _createRegion(id, array, type, color, colorBorder, tooltip, entity, xa) {
239
239
  var region = {};
240
240
  region.K = id;
241
241
  region.P = [];
@@ -246,6 +246,7 @@ sap.ui.define([
246
246
  region.ACB = region.CB; // no alternative border color per default
247
247
  region.G = entity;
248
248
  region.S = "false"; // per default nothing selected
249
+ region.XA = xa;
249
250
 
250
251
  var str, area, areaParts;
251
252
  for (var nI = 0, alen = array.length; nI < alen; ++nI) {
@@ -426,8 +427,7 @@ sap.ui.define([
426
427
  // ignore all other feature types!
427
428
  continue;
428
429
  }
429
- E.push(_createRegion(f.id2, mpa, f.geometry.type, colC, colCB, tt, f.id2));
430
-
430
+ E.push(_createRegion(f.id2, mpa, f.geometry.type, colC, colCB, tt, f.id2, xa));
431
431
  // get surrounding box for all parts -> this needs to consider round world for optimized bounding box size!
432
432
  this.mRegionBox[f.id2] = window.VBI.MathLib.GetSurroundingBox(xa);
433
433
  }
@@ -892,11 +892,68 @@ sap.ui.define([
892
892
  code = aCodes[nJ];
893
893
  result[code] = {};
894
894
  result[code].BBox = this.mRegionBox[code];
895
- result[code].Midpoint = [
896
- (this.mRegionBox[code][0] + this.mRegionBox[code][1]) / 2, (this.mRegionBox[code][2] + this.mRegionBox[code][3]) / 2
897
- ];
898
895
  result[code].Name = this.mNames[code];
899
896
  result[code].Properties = this.mRegionProps[code];
897
+ result[code].Midpoint = [0,0];
898
+
899
+ var scene = this.mVBIContext.GetMainScene();
900
+ if (scene) {
901
+ var xa = [];
902
+ for (var i = 0; i < this.mRegionApplicationTable.length; ++i) {
903
+ if (this.mRegionApplicationTable[i].K === code) {
904
+ xa = this.mRegionApplicationTable[i].XA;
905
+ break;
906
+ }
907
+ }
908
+ if (xa.length != 0) {
909
+ var box, maxArea, g1, g2, p1, p2;
910
+ // special case when country consists of one region only
911
+ if (xa.length == 1) {
912
+ box = xa[0];
913
+ } else {
914
+ maxArea = 0;
915
+ // find region with biggest area
916
+ for (var j = 0; j < xa.length; ++j) {
917
+ g1 = window.VBI.MathLib.DegToRad([xa[j][0], xa[j][2]]);
918
+ g2 = window.VBI.MathLib.DegToRad([xa[j][1], xa[j][3]]);
919
+ // crossing anti meridian
920
+ if (Math.abs(g2[0] - g1[0]) > Math.PI)
921
+ g1[0] += 2 * Math.PI;
922
+ // geo -> screen coordinates
923
+ p1 = scene.GetPointFromGeo(g1, false);
924
+ p2 = scene.GetPointFromGeo(g2, false);
925
+ // area of the rect in screen coordinates
926
+ var area = Math.abs(p2[0] - p1[0]) * Math.abs(p2[1] - p1[1]) * 0.5;
927
+
928
+ if (area > maxArea) {
929
+ maxArea = area;
930
+ box = xa[j];
931
+ }
932
+ }
933
+ }
934
+ // calculate mid point of region
935
+ if (box) {
936
+ g1 = window.VBI.MathLib.DegToRad([box[0], box[2]]);
937
+ g2 = window.VBI.MathLib.DegToRad([box[1], box[3]]);
938
+ // crossing anti meridian
939
+ if (Math.abs(g2[0] - g1[0]) > Math.PI)
940
+ g1[0] += 2 * Math.PI;
941
+ // geo -> screen coordinates
942
+ p1 = scene.GetPointFromGeo(g1, false);
943
+ p2 = scene.GetPointFromGeo(g2, false);
944
+ // center in screen coordinates
945
+ var center = [(p1[0] + p2[0]) * 0.5, (p1[1] + p2[1]) * 0.5];
946
+ // screen -> geo coordinates
947
+ result[code].Midpoint = window.VBI.MathLib.RadToDeg(scene.GetGeoFromPoint(center));
948
+ } else {
949
+ Log.error("Unable to calculate country mid point, box is empty", code, "sap.ui.vbm.AnalyticMap");
950
+ }
951
+ } else {
952
+ Log.error("Unable to calculate country mid point, region not found", code, "sap.ui.vbm.AnalyticMap");
953
+ }
954
+ } else {
955
+ Log.error("Unable to calculate country mid point, scene is empty", code, "sap.ui.vbm.AnalyticMap");
956
+ }
900
957
  }
901
958
  return result;
902
959
  };
@@ -23,7 +23,7 @@ sap.ui.define([
23
23
  *
24
24
  * @public
25
25
  * @author SAP SE
26
- * @version 1.108.3
26
+ * @version 1.108.4
27
27
  * @extends sap.ui.core.Control
28
28
  * @alias sap.ui.vbm.Viewport
29
29
  */
@@ -83,7 +83,7 @@ sap.ui.define([
83
83
  *
84
84
  * @private
85
85
  * @author SAP SE
86
- * @version 1.108.3
86
+ * @version 1.108.4
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.108.3
32
+ * @version 1.108.4
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.108.3
380
+ * @version 1.108.4
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.108.3
35
+ * @version 1.108.4
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 */ {
@@ -46,7 +46,7 @@ sap.ui.define([
46
46
  *
47
47
  * @private
48
48
  * @author SAP SE
49
- * @version 1.108.3
49
+ * @version 1.108.4
50
50
  * @alias sap.ui.vbm.adapter3d.SceneBuilder
51
51
  */
52
52
  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.108.3
59
+ * @version 1.108.4
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 */ {
@@ -19,7 +19,7 @@ sap.ui.define([
19
19
  * @namespace
20
20
  * @alias sap.ui.vbm
21
21
  * @author SAP SE
22
- * @version 1.108.3
22
+ * @version 1.108.4
23
23
  * @public
24
24
  */
25
25
 
@@ -42,7 +42,7 @@ sap.ui.define([
42
42
  "sap.ui.vbm.ClusterBase", "sap.ui.vbm.ClusterTree", "sap.ui.vbm.ClusterGrid", "sap.ui.vbm.ClusterDistance", "sap.ui.vbm.Heatmap",
43
43
  "sap.ui.vbm.HeatPoint", "sap.ui.vbm.ClusterContainer", "sap.ui.vbm.Adapter", "sap.ui.vbm.Adapter3D"
44
44
  ],
45
- version: "1.108.3"
45
+ version: "1.108.4"
46
46
  });
47
47
 
48
48
  sap.ui.loader.config({