@totvs-agro/mobile-components
Version:
Componentes Mobile Totvs (Front-End) para utilização dos estilos do T-Faces e Ionic v3
40 lines • 1.46 kB
JavaScript
import { Injectable } from "@angular/core";
import { Spherical } from "@ionic-native/google-maps";
var CircleUtil = /** @class */ (function () {
function CircleUtil() {
console.log('Criado CircleUtil');
}
CircleUtil.prototype.insideCircle = function (circle, latLng) {
try {
if (circle.getBounds().contains(latLng) && Spherical.computeDistanceBetween(circle.getCenter(), latLng) <= circle.getRadius())
return true;
else
return false;
}
catch (error) {
return false;
}
};
CircleUtil.prototype.getShortestDistanceBetween = function (points) {
if (points.length <= 1)
return null;
var shorter = Spherical.computeDistanceBetween(points[0], points[1]);
for (var i = 0; i < points.length; i++) {
for (var j = 0; j < points.length; j++) {
if (i == j)
continue;
var distance = Spherical.computeDistanceBetween(points[i], points[j]);
shorter = (distance < shorter ? distance : shorter);
}
}
return shorter;
};
CircleUtil.decorators = [
{ type: Injectable },
];
/** @nocollapse */
CircleUtil.ctorParameters = function () { return []; };
return CircleUtil;
}());
export { CircleUtil };
//# sourceMappingURL=circle-util.js.map