@sapui5/sap.ui.vbm 1.84.15 → 1.84.16

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.84.15",
3
+ "version": "1.84.16",
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.84.15</version>
6
+ <version>1.84.16</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.15
24
+ * @version 1.84.16
25
25
  * @extends sap.ui.core.Element
26
26
  * @constructor
27
27
  * @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.84.15
45
+ * @version 1.84.16
46
46
  * @extends sap.ui.core.Element
47
47
  * @constructor
48
48
  * @public
@@ -5,8 +5,9 @@
5
5
 
6
6
  // Provides control sap.ui.vbm.AnalyticMap.
7
7
  sap.ui.define([
8
- 'sap/ui/core/theming/Parameters', './GeoMap', './library', './VoBase'
9
- ], function(Parameters, GeoMap, library, VoBase) {
8
+ 'sap/ui/core/theming/Parameters', './GeoMap', './library', './VoBase',
9
+ "sap/base/Log"
10
+ ], function(Parameters, GeoMap, library, VoBase, Log) {
10
11
  "use strict";
11
12
 
12
13
  /**
@@ -228,7 +229,7 @@ sap.ui.define([
228
229
  var colCB = this.mColCB = AnalyticMap.DefaultRegionColorBorder;
229
230
 
230
231
  // helper function. returns {} as jQuery.extend can deep copy 'plain' objects only.
231
- function _createRegion(id, array, type, color, colorBorder, tooltip, entity) {
232
+ function _createRegion(id, array, type, color, colorBorder, tooltip, entity, xa) {
232
233
  var region = {};
233
234
  region.K = id;
234
235
  region.P = [];
@@ -239,6 +240,7 @@ sap.ui.define([
239
240
  region.ACB = region.CB; // no alternative border color per default
240
241
  region.G = entity;
241
242
  region.S = "false"; // per default nothing selected
243
+ region.XA = xa;
242
244
 
243
245
  var str, area, areaParts;
244
246
  for (var nI = 0, alen = array.length; nI < alen; ++nI) {
@@ -419,8 +421,7 @@ sap.ui.define([
419
421
  // ignore all other feature types!
420
422
  continue;
421
423
  }
422
- E.push(_createRegion(f.id2, mpa, f.geometry.type, colC, colCB, tt, f.id2));
423
-
424
+ E.push(_createRegion(f.id2, mpa, f.geometry.type, colC, colCB, tt, f.id2, xa));
424
425
  // get surrounding box for all parts -> this needs to consider round world for optimized bounding box size!
425
426
  this.mRegionBox[f.id2] = window.VBI.MathLib.GetSurroundingBox(xa);
426
427
  }
@@ -885,11 +886,68 @@ sap.ui.define([
885
886
  code = aCodes[nJ];
886
887
  result[code] = {};
887
888
  result[code].BBox = this.mRegionBox[code];
888
- result[code].Midpoint = [
889
- (this.mRegionBox[code][0] + this.mRegionBox[code][1]) / 2, (this.mRegionBox[code][2] + this.mRegionBox[code][3]) / 2
890
- ];
891
889
  result[code].Name = this.mNames[code];
892
890
  result[code].Properties = this.mRegionProps[code];
891
+ result[code].Midpoint = [0,0];
892
+
893
+ var scene = this.mVBIContext.GetMainScene();
894
+ if (scene) {
895
+ var xa = [];
896
+ for (var i = 0; i < this.mRegionApplicationTable.length; ++i) {
897
+ if (this.mRegionApplicationTable[i].K === code) {
898
+ xa = this.mRegionApplicationTable[i].XA;
899
+ break;
900
+ }
901
+ }
902
+ if (xa.length != 0) {
903
+ var box, maxArea, g1, g2, p1, p2;
904
+ // special case when country consists of one region only
905
+ if (xa.length == 1) {
906
+ box = xa[0];
907
+ } else {
908
+ maxArea = 0;
909
+ // find region with biggest area
910
+ for (var j = 0; j < xa.length; ++j) {
911
+ g1 = window.VBI.MathLib.DegToRad([xa[j][0], xa[j][2]]);
912
+ g2 = window.VBI.MathLib.DegToRad([xa[j][1], xa[j][3]]);
913
+ // crossing anti meridian
914
+ if (Math.abs(g2[0] - g1[0]) > Math.PI)
915
+ g1[0] += 2 * Math.PI;
916
+ // geo -> screen coordinates
917
+ p1 = scene.GetPointFromGeo(g1, false);
918
+ p2 = scene.GetPointFromGeo(g2, false);
919
+ // area of the rect in screen coordinates
920
+ var area = Math.abs(p2[0] - p1[0]) * Math.abs(p2[1] - p1[1]) * 0.5;
921
+
922
+ if (area > maxArea) {
923
+ maxArea = area;
924
+ box = xa[j];
925
+ }
926
+ }
927
+ }
928
+ // calculate mid point of region
929
+ if (box) {
930
+ g1 = window.VBI.MathLib.DegToRad([box[0], box[2]]);
931
+ g2 = window.VBI.MathLib.DegToRad([box[1], box[3]]);
932
+ // crossing anti meridian
933
+ if (Math.abs(g2[0] - g1[0]) > Math.PI)
934
+ g1[0] += 2 * Math.PI;
935
+ // geo -> screen coordinates
936
+ p1 = scene.GetPointFromGeo(g1, false);
937
+ p2 = scene.GetPointFromGeo(g2, false);
938
+ // center in screen coordinates
939
+ var center = [(p1[0] + p2[0]) * 0.5, (p1[1] + p2[1]) * 0.5];
940
+ // screen -> geo coordinates
941
+ result[code].Midpoint = window.VBI.MathLib.RadToDeg(scene.GetGeoFromPoint(center));
942
+ } else {
943
+ Log.error("Unable to calculate country mid point, box is empty", code, "sap.ui.vbm.AnalyticMap");
944
+ }
945
+ } else {
946
+ Log.error("Unable to calculate country mid point, region not found", code, "sap.ui.vbm.AnalyticMap");
947
+ }
948
+ } else {
949
+ Log.error("Unable to calculate country mid point, scene is empty", code, "sap.ui.vbm.AnalyticMap");
950
+ }
893
951
  }
894
952
  return result;
895
953
  };
@@ -25,7 +25,7 @@ sap.ui.define([
25
25
  *
26
26
  * @public
27
27
  * @author SAP SE
28
- * @version 1.84.15
28
+ * @version 1.84.16
29
29
  * @extends sap.ui.core.Control
30
30
  * @alias sap.ui.vbm.Viewport
31
31
  */
@@ -31,7 +31,7 @@ sap.ui.define([
31
31
  *
32
32
  * @private
33
33
  * @author SAP SE
34
- * @version 1.84.15
34
+ * @version 1.84.16
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.15
381
+ * @version 1.84.16
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.15
37
+ * @version 1.84.16
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.15
53
+ * @version 1.84.16
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.15
61
+ * @version 1.84.16
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 */ {
@@ -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.15
20
+ * @version 1.84.16
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.15"
50
+ version: "1.84.16"
51
51
  });
52
52
 
53
53
  jQuery.sap.registerModuleShims({