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

Function transformCoord

src/mapboxgl/mapping/utils/VideoMapUtil.js:1–11  ·  view source on GitHub ↗
({
  videoPoint,
  originCoordsRightBottom,
  originCoordsLeftTop,
  videoHeight,
  videoWidth
})

Source from the content-addressed store, hash-verified

1export const transformCoord = ({
2 videoPoint,
3 originCoordsRightBottom,
4 originCoordsLeftTop,
5 videoHeight,
6 videoWidth
7}) => {
8 let perWidth = Math.abs(originCoordsRightBottom.lng - originCoordsLeftTop.lng) / videoWidth;
9 let perHeight = Math.abs(originCoordsRightBottom.lat - originCoordsLeftTop.lat) / videoHeight;
10 return [videoPoint[0] * perWidth + originCoordsLeftTop.lng, originCoordsLeftTop.lat - videoPoint[1] * perHeight];
11};
12
13export const transformCoordReverse = ({
14 coord,

Callers 2

addMethod · 0.90
eachDataMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected