本文整理汇总了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;
}
示例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;
}
示例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;
}