当前位置: 首页>>代码示例>>Java>>正文


Java MathUtil.max方法代码示例

本文整理汇总了Java中com.vividsolutions.jts.math.MathUtil.max方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtil.max方法的具体用法?Java MathUtil.max怎么用?Java MathUtil.max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vividsolutions.jts.math.MathUtil的用法示例。


在下文中一共展示了MathUtil.max方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: precisionScaleFactor

import com.vividsolutions.jts.math.MathUtil; //导入方法依赖的package包/类
/**
 * Compute a scale factor to limit the precision of
 * a given combination of Geometry and buffer distance.
 * The scale factor is determined by
 * the number of digits of precision in the (geometry + buffer distance),
 * limited by the supplied <code>maxPrecisionDigits</code> value.
 * <p>
 * The scale factor is based on the absolute magnitude of the (geometry + buffer distance).
 * since this determines the number of digits of precision which must be handled.
 *
 * @param g the Geometry being buffered
 * @param distance the buffer distance
 * @param maxPrecisionDigits the max # of digits that should be allowed by
 * the precision determined by the computed scale factor
 * @return a scale factor for the buffer computation
 */
private static double precisionScaleFactor(Geometry g,
                                           double distance,
                                           int maxPrecisionDigits) {
    Envelope env = g.getEnvelopeInternal();
    double envMax = MathUtil.max(
            Math.abs(env.getMaxX()),
            Math.abs(env.getMaxY()),
            Math.abs(env.getMinX()),
            Math.abs(env.getMinY())
    );

    double expandByDistance = distance > 0.0 ? distance : 0.0;
    double bufEnvMax = envMax + 2 * expandByDistance;

    // the smallest power of 10 greater than the buffer envelope
    int bufEnvPrecisionDigits = (int) (Math.log(bufEnvMax) / Math.log(10) + 1.0);
    int minUnitLog10 = maxPrecisionDigits - bufEnvPrecisionDigits;

    double scaleFactor = Math.pow(10.0, minUnitLog10);
    return scaleFactor;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:38,代码来源:BufferOp.java

示例2: precisionScaleFactor

import com.vividsolutions.jts.math.MathUtil; //导入方法依赖的package包/类
/**
 * Compute a scale factor to limit the precision of
 * a given combination of Geometry and buffer distance.
 * The scale factor is determined by
 * the number of digits of precision in the (geometry + buffer distance),
 * limited by the supplied <code>maxPrecisionDigits</code> value.
 * <p/>
 * The scale factor is based on the absolute magnitude of the (geometry + buffer distance).
 * since this determines the number of digits of precision which must be handled.
 *
 * @param g                  the Geometry being buffered
 * @param distance           the buffer distance
 * @param maxPrecisionDigits the max # of digits that should be allowed by
 *                           the precision determined by the computed scale factor
 * @return a scale factor for the buffer computation
 */
private static double precisionScaleFactor(Geometry g,
                                           double distance,
                                           int maxPrecisionDigits) {
    Envelope env = g.getEnvelopeInternal();
    double envMax = MathUtil.max(
            Math.abs(env.getMaxX()),
            Math.abs(env.getMaxY()),
            Math.abs(env.getMinX()),
            Math.abs(env.getMinY())
    );

    double expandByDistance = distance > 0.0 ? distance : 0.0;
    double bufEnvMax = envMax + 2 * expandByDistance;

    // the smallest power of 10 greater than the buffer envelope
    int bufEnvPrecisionDigits = (int) (Math.log(bufEnvMax) / Math.log(10) + 1.0);
    int minUnitLog10 = maxPrecisionDigits - bufEnvPrecisionDigits;

    double scaleFactor = Math.pow(10.0, minUnitLog10);
    return scaleFactor;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:38,代码来源:BufferOp.java

示例3: precisionScaleFactor

import com.vividsolutions.jts.math.MathUtil; //导入方法依赖的package包/类
/**
 * Compute a scale factor to limit the precision of
 * a given combination of Geometry and buffer distance.
 * The scale factor is determined by
 * the number of digits of precision in the (geometry + buffer distance),
 * limited by the supplied <code>maxPrecisionDigits</code> value.
 * <p>
 * The scale factor is based on the absolute magnitude of the (geometry + buffer distance).
 * since this determines the number of digits of precision which must be handled.
 *
 * @param g the Geometry being buffered
 * @param distance the buffer distance
 * @param maxPrecisionDigits the max # of digits that should be allowed by
 *          the precision determined by the computed scale factor
 *
 * @return a scale factor for the buffer computation
 */
private static double precisionScaleFactor(Geometry g,
    double distance,
  int maxPrecisionDigits)
{
  Envelope env = g.getEnvelopeInternal();
  double envMax = MathUtil.max(
      Math.abs(env.getMaxX()), 
          Math.abs(env.getMaxY()), 
              Math.abs(env.getMinX()), 
                  Math.abs(env.getMinY())
          );
  
  double expandByDistance = distance > 0.0 ? distance : 0.0;
  double bufEnvMax = envMax + 2 * expandByDistance;

  // the smallest power of 10 greater than the buffer envelope
  int bufEnvPrecisionDigits = (int) (Math.log(bufEnvMax) / Math.log(10) + 1.0);
  int minUnitLog10 = maxPrecisionDigits - bufEnvPrecisionDigits;
  
  double scaleFactor = Math.pow(10.0, minUnitLog10);
  return scaleFactor;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:40,代码来源:BufferOp.java


注:本文中的com.vividsolutions.jts.math.MathUtil.max方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。