@configurator/ravendb
Version:
RavenDB client for Node.js
37 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpatialCriteria = void 0;
const Exceptions_1 = require("../../../Exceptions");
const WhereToken_1 = require("../../Session/Tokens/WhereToken");
class SpatialCriteria {
constructor(relation, distanceErrorPct) {
this._relation = relation;
this._distanceErrorPct = distanceErrorPct;
}
toQueryToken(fieldName, addQueryParameter) {
const shapeToken = this._getShapeToken(addQueryParameter);
let whereOperator;
switch (this._relation) {
case "Within":
whereOperator = "SpatialWithin";
break;
case "Contains":
whereOperator = "SpatialContains";
break;
case "Disjoint":
whereOperator = "SpatialDisjoint";
break;
case "Intersects":
whereOperator = "SpatialIntersects";
break;
default:
(0, Exceptions_1.throwError)("InvalidArgumentException");
}
return WhereToken_1.WhereToken.create(whereOperator, fieldName, null, new WhereToken_1.WhereOptions({
shape: shapeToken,
distance: this._distanceErrorPct
}));
}
}
exports.SpatialCriteria = SpatialCriteria;
//# sourceMappingURL=SpatialCriteria.js.map