ravendb
Version:
RavenDB client for Node.js
44 lines • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpatialCriteria = void 0;
const index_js_1 = require("../../../Exceptions/index.js");
const WhereToken_js_1 = require("../../Session/Tokens/WhereToken.js");
class SpatialCriteria {
_relation;
_distanceErrorPct;
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, index_js_1.throwError)("InvalidArgumentException");
}
}
return WhereToken_js_1.WhereToken.create(whereOperator, fieldName, null, new WhereToken_js_1.WhereOptions({
shape: shapeToken,
distance: this._distanceErrorPct
}));
}
}
exports.SpatialCriteria = SpatialCriteria;
//# sourceMappingURL=SpatialCriteria.js.map