@sapui5/sap.ui.vbm 1.96.8 → 1.96.9

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