Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getPosition = () => {
let {x, y, z} = this.props.mousePosition ? this.props.mousePosition : [null, null];
if (!x && !y) {
// if we repoject null coordinates we can end up with -0.00 instead of 0.00
({x, y} = {x: 0, y: 0, z});
} else if (proj4js.defs(this.props.mousePosition.crs) !== proj4js.defs(this.props.crs)) {
({x, y} = CoordinatesUtils.reproject([x, y], this.props.mousePosition.crs, this.props.crs));
}
let units = CoordinatesUtils.getUnits(this.props.crs);
if (units === "degrees") {
return {lat: y, lng: x, z};
}
return {x, y, z};
};
const reproject = (point, source, dest, normalize = true) => {
const sourceProj = source && Proj4js.defs(source) ? new Proj4js.Proj(source) : null;
const destProj = dest && Proj4js.defs(dest) ? new Proj4js.Proj(dest) : null;
if (sourceProj && destProj) {
let p = isArray(point) ? Proj4js.toPoint(point) : Proj4js.toPoint([point.x, point.y]);
const transformed = assign({}, source === dest ? numberize(p) : Proj4js.transform(sourceProj, destProj, numberize(p)), {srs: dest});
if (normalize) {
return normalizePoint(transformed);
}
return transformed;
}
return null;
};
const reproject = (point, source, dest, normalize = true) => {
const sourceProj = source && Proj4js.defs(source) ? new Proj4js.Proj(source) : null;
const destProj = dest && Proj4js.defs(dest) ? new Proj4js.Proj(dest) : null;
if (sourceProj && destProj) {
let p = isArray(point) ? Proj4js.toPoint(point) : Proj4js.toPoint([point.x, point.y]);
const transformed = assign({}, source === dest ? numberize(p) : Proj4js.transform(sourceProj, destProj, numberize(p)), {srs: dest});
if (normalize) {
return normalizePoint(transformed);
}
return transformed;
}
return null;
};
function determineCrs(crs) {
if (typeof crs === 'string' || crs instanceof String) {
return Proj4js.defs(crs) ? new Proj4js.Proj(crs) : null;
}
return crs;
}
render() {
const status = this.getStatus();
const currentEPSG = this.checkBbox();
const epsgIsSupported = currentEPSG && Proj4js.defs(currentEPSG);
const layerMetadataModal = ();
return this.props.activateTool.activateToolsContainer ? (
{this.props.activateTool.activateAddLayer && (status === 'DESELECT' || status === 'GROUP') ?
isSRSAllowed: (srs) => {
return !!Proj4js.defs(srs);
},
/**
config.projectionDefs.forEach((proj) => {
proj4.defs(proj.code, proj.def);
});