UNPKG

soda-angular

Version:
28 lines (27 loc) 972 B
import { WellKnownType } from '../../../../datatypes/well-known-type'; import { LocationUtils } from '../../../../utilities/location-utils'; export class WithinCircle { constructor(column, location, radius) { if (!column) { throw new Error("Column must be provided"); } if (!location) { throw new Error("Location point must be provided"); } if (!radius) { throw new Error("Radius must be provided"); } this.Column = column; this.Location = location; this.Radius = radius; } toString() { if (LocationUtils.isLocation(this.Location.Value)) { return `within_circle(${this.Column}, ${this.Location.Value}, ${this.Radius})`; } else { const wkt = new WellKnownType(this.Location.Value); return `within_circle(${this.Column}, '${wkt}', ${this.Radius})`; } } }