import { NativeModules } from 'react-native'; import { MPGeometry, MPPoint, MPCollisionHandling } from '../../index'; const { UtilsModule } = NativeModules; /** * Internal - Documentation will follow. * * @export * @class MPUtils * @typedef {MPUtils} */ export default class MPUtils { /** * Creates an instance of MPUtils. * * @constructor * @private */ private constructor() { } /** * Internal - Documentation will follow. * * @static * @async * @param {string} venueId * @returns {Promise} */ static async venueHasGraph(venueId: string): Promise { return UtilsModule.venueHasGraph(venueId); } /** * Internal - Documentation will follow. * * @static * @async * @param {MPPoint} it * @param {MPPoint} other * @returns {Promise} */ static async pointAngleBetween(it: MPPoint, other: MPPoint): Promise { return UtilsModule.pointAngleBetween(JSON.stringify(it), JSON.stringify(other)); } /** * Internal - Documentation will follow. * * @static * @async * @param {MPPoint} it * @param {MPPoint} other * @returns {Promise} */ static async pointDistanceTo(it: MPPoint, other: MPPoint): Promise { return UtilsModule.pointDistanceTo(JSON.stringify(it), JSON.stringify(other)); } /** * Internal - Documentation will follow. * * @static * @async * @param {MPPoint} point * @param {MPGeometry} geometry * @returns {Promise} */ static async geometryIsInside(point: MPPoint, geometry: MPGeometry): Promise { return UtilsModule.geometryIsInside(JSON.stringify(point), JSON.stringify(geometry)); } /** * Internal - Documentation will follow. * * @static * @async * @param {MPGeometry} geometry * @returns {Promise} */ static async geometryArea(geometry: MPGeometry): Promise { return UtilsModule.geometryArea(JSON.stringify(geometry)); } /** * Internal - Documentation will follow. * * @static * @async * @param {MPPoint} point * @param {MPGeometry} polygon * @returns {Promise} */ static async polygonDistanceToClosestEdge(point: MPPoint, polygon: MPGeometry): Promise { return UtilsModule.polygonDistanceToClosestEdge(JSON.stringify(point), JSON.stringify(polygon)); } /** * Internal - Documentation will follow. * * @static * @async * @param {string} venueId * @param {string} locationId * @returns {Promise} */ static async parseMapClientUrl(venueId: string, locationId: string): Promise { return UtilsModule.parseMapClientUrl(venueId, locationId); } /** * Internal - Documentation will follow. * * @static * @async * @param {MPCollisionHandling} collisionHandling * @returns {Promise} */ static async setCollisionHandling(collisionHandling: MPCollisionHandling): Promise { return UtilsModule.setCollisionHandling(collisionHandling.valueOf()); } /** * Internal - Documentation will follow. * * @static * @async * @param {boolean} enableClustering * @returns {Promise} */ static async setEnableClustering(enableClustering: boolean): Promise { return UtilsModule.enableClustering(enableClustering); } /** * Internal - Documentation will follow. * * @static * @async * @param {boolean} enableClustering * @returns {Promise} */ static async setNewSelection(isNewSelection: boolean): Promise { return Promise.resolve(UtilsModule.setNewSelection(isNewSelection)); } /** * Internal - Documentation will follow. * * @static * @async * @param {number} opacity * @returns {Promise} */ static async setExtrusionOpacity(opacity: number): Promise { return UtilsModule.setExtrusionOpacity(opacity); } /** * Internal - Documentation will follow. * * @static * @async * @param {number} opacity * @returns {Promise} */ static async setWallOpacity(opacity: number): Promise { return UtilsModule.setWallOpacity(opacity); } static async setSelectable(id: string, selectable: boolean): Promise { return UtilsModule.setSelectable(id, selectable); } static async setAutomatedZoomLimit(automatedZoomLimit?: number): Promise { return UtilsModule.setAutomatedZoomLimit(automatedZoomLimit); } }