Add geoButton, getGmina, messages, and translate handler files with initial implementations
This commit is contained in:
33
js/handlers/translate.js
Normal file
33
js/handlers/translate.js
Normal file
@@ -0,0 +1,33 @@
|
||||
function translate(data) {
|
||||
let newData = [];
|
||||
const canvas = document.getElementsByClassName("ol-unselectable")[0];
|
||||
const bound = canvas.getBoundingClientRect();
|
||||
|
||||
// szerokość 90%
|
||||
// wysokość 109%
|
||||
|
||||
// SZEROKOŚĆ 137
|
||||
// WYSOKOŚĆ 132
|
||||
const XMIN = MapData.X_MIN;
|
||||
const YMIN = MapData.Y_MIN;
|
||||
const XMAX = MapData.X_MAX;
|
||||
const YMAX = MapData.Y_MAX;
|
||||
|
||||
const xratio = ((XMAX - XMIN) * 1) / bound.width;
|
||||
const yratio = ((YMAX - YMIN) * 1) / bound.height;
|
||||
|
||||
console.log(bound.width/bound.height)
|
||||
console.log((XMAX-XMIN)/(YMAX-YMIN))
|
||||
|
||||
// return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0]
|
||||
|
||||
for (let point of data) {
|
||||
let tempx = ((point[0] - XMIN) / (XMAX-XMIN)) * (bound.width)
|
||||
let tempy = ((YMAX - point[1]) / (YMAX-YMIN)) * (bound.height) ;
|
||||
// let tempx = (point[0] - XMIN) / xratio;
|
||||
// let tempy = (YMAX - point[1]) / yratio;
|
||||
newData.push([tempx, tempy]);
|
||||
}
|
||||
|
||||
return newData;
|
||||
}
|
||||
Reference in New Issue
Block a user