if (isSpherical || !Metrics.NEUTRAL.equals(it.getMetric())) { criteria.nearSphere(pointToUse); } else {
@Override public Circle convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Circle(DocumentToPointConverter.INSTANCE.convert(center), distance); } }
private double convertDistanceToMeters(final Distance distance) { return distance.getNormalizedValue() * Metrics.KILOMETERS.getMultiplier() * 1000; }
private double convertDistanceToMeters(final Distance distance) { return distance.getNormalizedValue() * Metrics.KILOMETERS.getMultiplier() * 1000; }
@Override public Sphere convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Sphere(DocumentToPointConverter.INSTANCE.convert(center), distance); } }
if (isSpherical || !Metrics.NEUTRAL.equals(it.getMetric())) { criteria.nearSphere(pointToUse); } else {
@Override public Sphere convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Sphere(DocumentToPointConverter.INSTANCE.convert(center), distance); } }
@Override public Circle convert(Document source) { if (source == null) { return null; } Document center = (Document) source.get("center"); Number radius = (Number) source.get("radius"); Assert.notNull(center, "Center must not be null!"); Assert.notNull(radius, "Radius must not be null!"); Distance distance = new Distance(toPrimitiveDoubleValue(radius)); if (source.containsKey("metric")) { String metricString = (String) source.get("metric"); Assert.notNull(metricString, "Metric must not be null!"); distance = distance.in(Metrics.valueOf(metricString)); } return new Circle(DocumentToPointConverter.INSTANCE.convert(center), distance); } }