MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / resetLocation

Method resetLocation

src/common/overlay/Graph.js:350–373  ·  view source on GitHub ↗

* @function FeatureThemeGraph.prototype.resetLocation * @description 根据地理位置 lonlat 重置专题要素(图表)位置。 * @param {LonLat} lonlat - 专题要素新的像素中心位置。 * @returns {Array. } 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。

(lonlat)

Source from the content-addressed store, hash-verified

348 * @returns {Array.<number>} 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
349 */
350 resetLocation(lonlat) {
351 if (lonlat) {
352 this.lonlat = lonlat;
353 }
354
355 // 获取地理位置对应的像素坐标 newLocalLX
356 var newLocalLX = this.getLocalXY(this.lonlat);
357 // 处理偏移量 XOffset, YOffset
358 newLocalLX[0] += this.XOffset;
359 newLocalLX[1] += this.YOffset;
360 // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
361 this.location = newLocalLX;
362
363 // 更新图表像素 Bounds
364 var w = this.width;
365 var h = this.height;
366 var loc = this.location;
367 this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
368
369 //重新计算当前渐变色
370 this.resetLinearGradient();
371
372 return loc;
373 }
374
375 /**
376 * @function FeatureThemeGraph.prototype.resetLinearGradient

Callers 5

initBaseParameterMethod · 0.95
drawChartsMethod · 0.80
GraphThemeLayer.jsFile · 0.80
initBaseParameterMethod · 0.80
drawChartsMethod · 0.80

Calls 2

getLocalXYMethod · 0.95
resetLinearGradientMethod · 0.95

Tested by

no test coverage detected