org.springframework.data.geo.Distance.getNormalizedValue()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.springframework.data.geo.Distance.getNormalizedValue()方法的一些代码示例,展示了Distance.getNormalizedValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Distance.getNormalizedValue()方法的具体详情如下:
包路径:org.springframework.data.geo.Distance
类名称:Distance
方法名:getNormalizedValue

Distance.getNormalizedValue介绍

[英]Returns the normalized value regarding the underlying Metric.
[中]返回有关基础度量的规范化值。

代码示例

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
  public Document convert(Sphere source) {
    if (source == null) {
      return null;
    }
    Document result = new Document();
    result.put("center", PointToDocumentConverter.INSTANCE.convert(source.getCenter()));
    result.put("radius", source.getRadius().getNormalizedValue());
    result.put("metric", source.getRadius().getMetric().toString());
    return result;
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@Override
  public Document convert(Circle source) {
    if (source == null) {
      return null;
    }
    Document result = new Document();
    result.put("center", PointToDocumentConverter.INSTANCE.convert(source.getCenter()));
    result.put("radius", source.getRadius().getNormalizedValue());
    result.put("metric", source.getRadius().getMetric().toString());
    return result;
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

argument.add(((Circle) shape).getRadius().getNormalizedValue());
argument.add(((Sphere) shape).getRadius().getNormalizedValue());

代码示例来源:origin: spring-projects/spring-data-mongodb

document.put("maxDistance", maxDistance.getNormalizedValue());
document.put("minDistance", minDistance.getNormalizedValue());

代码示例来源:origin: spring-projects/spring-data-mongodb

criteria.maxDistance(it.getNormalizedValue());
minDistance.ifPresent(min -> criteria.minDistance(min.getNormalizedValue()));

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
  public Document convert(Sphere source) {
    if (source == null) {
      return null;
    }
    Document result = new Document();
    result.put("center", PointToDocumentConverter.INSTANCE.convert(source.getCenter()));
    result.put("radius", source.getRadius().getNormalizedValue());
    result.put("metric", source.getRadius().getMetric().toString());
    return result;
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

@Override
  public Document convert(Circle source) {
    if (source == null) {
      return null;
    }
    Document result = new Document();
    result.put("center", PointToDocumentConverter.INSTANCE.convert(source.getCenter()));
    result.put("radius", source.getRadius().getNormalizedValue());
    result.put("metric", source.getRadius().getMetric().toString());
    return result;
  }
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

argument.add(((Circle) shape).getRadius().getNormalizedValue());
argument.add(((Sphere) shape).getRadius().getNormalizedValue());

代码示例来源:origin: org.springframework.data/spring-data-mongodb

document.put("maxDistance", maxDistance.getNormalizedValue());
document.put("minDistance", minDistance.getNormalizedValue());

代码示例来源:origin: org.springframework.data/spring-data-mongodb

criteria.maxDistance(it.getNormalizedValue());
minDistance.ifPresent(min -> criteria.minDistance(min.getNormalizedValue()));

代码示例来源:origin: apache/servicemix-bundles

@Override
public int compareTo(@Nullable Distance that) {
  if (that == null) {
    return 1;
  }
  double difference = this.getNormalizedValue() - that.getNormalizedValue();
  return difference == 0 ? 0 : difference > 0 ? 1 : -1;
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Adds the given distance to the current one. The resulting {@link Distance} will be in the same metric as the
 * current one.
 *
 * @param other must not be {@literal null}.
 * @return
 */
public Distance add(Distance other) {
  Assert.notNull(other, "Distance to add must not be null!");
  double newNormalizedValue = getNormalizedValue() + other.getNormalizedValue();
  return new Distance(newNormalizedValue * metric.getMultiplier(), metric);
}

代码示例来源:origin: com.arangodb/arangodb-spring-data

private double convertDistanceToMeters(final Distance distance) {
  return distance.getNormalizedValue() * Metrics.KILOMETERS.getMultiplier() * 1000;
}

代码示例来源:origin: arangodb/spring-data

private double convertDistanceToMeters(final Distance distance) {
  return distance.getNormalizedValue() * Metrics.KILOMETERS.getMultiplier() * 1000;
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Adds the given {@link Distance} to the current one and forces the result to be in a given {@link Metric}.
 *
 * @param other must not be {@literal null}.
 * @param metric must not be {@literal null}.
 * @return
 */
public Distance add(Distance other, Metric metric) {
  Assert.notNull(other, "Distance to must not be null!");
  Assert.notNull(metric, "Result metric must not be null!");
  double newLeft = getNormalizedValue() * metric.getMultiplier();
  double newRight = other.getNormalizedValue() * metric.getMultiplier();
  return new Distance(newLeft + newRight, metric);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns a new {@link Distance} in the given {@link Metric}. This means that the returned instance will have the
 * same normalized value as the original instance.
 *
 * @param metric must not be {@literal null}.
 * @return
 */
public Distance in(Metric metric) {
  Assert.notNull(metric, "Metric must not be null!");
  return this.metric.equals(metric) ? this : new Distance(getNormalizedValue() * metric.getMultiplier(), metric);
}

代码示例来源:origin: spring-projects/spring-data-couchbase

@Override
public boolean pointInCircle(Point p, Point center, Distance radiusDistance) {
 double radius = radiusDistance.getNormalizedValue();
 return pointNear(p, new Point2D.Double(center.getX(), center.getY()), radius);
}

代码示例来源:origin: org.springframework.data/spring-data-couchbase

@Override
public boolean pointInCircle(Point p, Point center, Distance radiusDistance) {
 double radius = radiusDistance.getNormalizedValue();
 return pointNear(p, new Point2D.Double(center.getX(), center.getY()), radius);
}

代码示例来源:origin: org.springframework.data/spring-data-couchbase

@Override
public boolean pointInCircle(Point p, Circle c) {
 Point2D center = new Point2D.Double(c.getCenter().getX(), c.getCenter().getY());
 return pointNear(p, center, c.getRadius().getNormalizedValue());
}

代码示例来源:origin: spring-projects/spring-data-couchbase

@Override
public boolean pointInCircle(Point p, Circle c) {
 Point2D center = new Point2D.Double(c.getCenter().getX(), c.getCenter().getY());
 return pointNear(p, center, c.getRadius().getNormalizedValue());
}

相关文章