org.apache.sis.util.Utilities.equalsApproximatively()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(149)

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

Utilities.equalsApproximatively介绍

[英]Compares the specified objects for equality, ignoring metadata and slight differences in numerical values. If this method returns true, then:

  • If the two given objects are org.apache.sis.referencing.operation.transform.AbstractMathTransform, then transforming a set of coordinate values using one transform will produce approximately the same results than transforming the same coordinates with the other transform.
  • If the two given objects are org.apache.sis.referencing.crs.AbstractCRS (CRS), then a call to org.apache.sis.referencing.CRS#findOperation(crs1, crs2, null) will return an operation close to identity.
    Implementation note This is a convenience method for the following method call: java
    [中]比较指定对象的相等性,忽略元数据和数值的细微差异。如果此方法返回true,则:
    *如果给定的两个对象是org。阿帕奇。姐妹。参考。活动使改变AbstractMathTransform,然后使用一个变换变换一组坐标值,将产生与使用另一个变换变换相同的结果。
    *如果给定的两个对象是org。阿帕奇。姐妹。参考。crs。AbstractCRS(CRS),则对org.apache.sis.referencing.CRS#findOperation(crs1, crs2, null)的调用将返回一个接近identity的操作。
    实现说明这是以下方法调用的一个方便方法:java

代码示例

代码示例来源:origin: Geomatys/geotoolkit

return Utilities.equalsApproximatively(object1, object2);

代码示例来源:origin: apache/sis

final SingleCRS crsA = authoritative.next();
final SingleCRS crsG = given.next();
if (!Utilities.equalsApproximatively(crsA, crsG)) {
  if (crsA instanceof GeneralDerivedCRS && crsG instanceof GeneralDerivedCRS) {
    final Conversion cnvA = ((GeneralDerivedCRS) crsA).getConversionFromBase();
    final Conversion cnvG = ((GeneralDerivedCRS) crsG).getConversionFromBase();
    if (!Utilities.equalsApproximatively(cnvA, cnvG)) {
      return Utilities.equalsApproximatively(cnvA.getMethod(), cnvG.getMethod()) ? CONVERSION : METHOD;
  if (!Utilities.equalsApproximatively(crsA.getCoordinateSystem(), crsG.getCoordinateSystem())) {
    return CS;
  if (!Utilities.equalsApproximatively(datumA, datumG)) {
    if ((datumA instanceof GeodeticDatum) && (datumG instanceof GeodeticDatum) &&
      !Utilities.equalsApproximatively(((GeodeticDatum) datumA).getPrimeMeridian(),
                       ((GeodeticDatum) datumG).getPrimeMeridian()))

代码示例来源:origin: org.apache.sis.core/sis-referencing

final SingleCRS crsA = authoritative.next();
final SingleCRS crsG = given.next();
if (!Utilities.equalsApproximatively(crsA, crsG)) {
  if (crsA instanceof GeneralDerivedCRS && crsG instanceof GeneralDerivedCRS) {
    final Conversion cnvA = ((GeneralDerivedCRS) crsA).getConversionFromBase();
    final Conversion cnvG = ((GeneralDerivedCRS) crsG).getConversionFromBase();
    if (!Utilities.equalsApproximatively(cnvA, cnvG)) {
      return Utilities.equalsApproximatively(cnvA.getMethod(), cnvG.getMethod()) ? CONVERSION : METHOD;
  if (!Utilities.equalsApproximatively(crsA.getCoordinateSystem(), crsG.getCoordinateSystem())) {
    return CS;
  if (!Utilities.equalsApproximatively(datumA, datumG)) {
    if ((datumA instanceof GeodeticDatum) && (datumG instanceof GeodeticDatum) &&
      !Utilities.equalsApproximatively(((GeodeticDatum) datumA).getPrimeMeridian(),
                       ((GeodeticDatum) datumG).getPrimeMeridian()))

代码示例来源:origin: apache/sis

if (parameters != null) {
  CoordinateReferenceSystem crs;
  if (Utilities.equalsApproximatively(sourceCRS, crs = operation.getSourceCRS())) sourceCRS = crs;
  if (Utilities.equalsApproximatively(targetCRS, crs = operation.getTargetCRS())) targetCRS = crs;
  final MathTransformFactory mtFactory = factorySIS.getMathTransformFactory();
  if (mtFactory instanceof DefaultMathTransformFactory) {

代码示例来源:origin: org.apache.sis.core/sis-referencing

if (Utilities.equalsApproximatively(sourceCRS, crs = operation.getSourceCRS())) sourceCRS = crs;
if (Utilities.equalsApproximatively(targetCRS, crs = operation.getTargetCRS())) targetCRS = crs;
final Map<String,Object> properties = new HashMap<String,Object>(derivedFrom(operation));

代码示例来源:origin: apache/sis

if (Utilities.equalsApproximatively(sourceCRS, crs = operation.getSourceCRS())) sourceCRS = crs;
if (Utilities.equalsApproximatively(targetCRS, crs = operation.getTargetCRS())) targetCRS = crs;
final Map<String,Object> properties = new HashMap<>(derivedFrom(operation));

代码示例来源:origin: org.apache.sis.core/sis-referencing

if (parameters != null) {
  CoordinateReferenceSystem crs;
  if (Utilities.equalsApproximatively(sourceCRS, crs = operation.getSourceCRS())) sourceCRS = crs;
  if (Utilities.equalsApproximatively(targetCRS, crs = operation.getTargetCRS())) targetCRS = crs;
  final MathTransformFactory mtFactory = factorySIS.getMathTransformFactory();
  if (mtFactory instanceof DefaultMathTransformFactory) {

代码示例来源:origin: Geomatys/geotoolkit

private static UnaryOperator<Coordinate> getTransformer(final CoordinateReferenceSystem target) throws FactoryException {
  if (org.apache.sis.util.Utilities.equalsApproximatively(target, CommonCRS.defaultGeographic())) {
    return UnaryOperator.identity();
  } else {
    final CoordinateOperation op = CRS.findOperation(CommonCRS.defaultGeographic(), target, null);
    final MathTransform geoToTarget = op.getMathTransform();
    return c -> Utilities.transform(c, geoToTarget, false);
  }
}

相关文章