- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.geotools.resources.XMath
类的一些代码示例,展示了XMath
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMath
类的具体详情如下:
包路径:org.geotools.resources.XMath
类名称:XMath
[英]Simple mathematical functions.
[中]简单的数学函数。
代码示例来源:origin: org.geotools/gt-coverage
/**
* Returns a {@code double} value for the specified number. If {@code direction}
* is non-zero, then this method will returns the closest representable number of type
* {@code type} before or after the double value.
*
* @param type The range element class. {@code number} must be
* an instance of this class (this will not be checked).
* @param number The number to transform to a {@code double} value.
* @param direction -1 to return the previous representable number,
* +1 to return the next representable number, or
* 0 to return the number with no change.
*/
private static double doubleValue(final Class<?> type,
final Comparable number,
final int direction)
{
assert (direction >= -1) && (direction <= +1) : direction;
return org.geotools.resources.XMath.rool(type, ((Number)number).doubleValue(), direction);
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Initialise l'itrateur.
*
* @param minimum Valeur minimale de la premire graduation.
* @param maximum Valeur limite des graduations. La dernire
* graduation n'aura pas ncessairement cette valeur.
* @param visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation.
* Cette longueur doit tre exprime en pixels ou en points.
* @param visualTickSpacing Espace laisser visuellement entre deux marques de graduation.
* Cet espace doit tre exprim en pixels ou en points (1/72 de pouce).
*/
protected void init(final double minimum,
final double maximum,
final float visualLength,
final float visualTickSpacing)
{
final double logMin = XMath.log10(minimum);
final double logMax = XMath.log10(maximum);
super.init(logMin, logMax, visualLength, visualTickSpacing);
scale = (maximum-minimum) / (logMax-logMin);
offset = minimum - scale*logMin;
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Try to remove at least {@code n} fraction digits in the string representation of
* the specified value. This method try small changes to {@code value}, by adding or
* substracting a maximum of 4 ulps. If there is no small change that remove at least
* {@code n} fraction digits, then the value is returned unchanged. This method is
* used for hiding rounding errors, like in conversions from radians to degrees.
*
* <P>Example: {@code XMath.fixRoundingError(-61.500000000000014, 12)} returns
* {@code -61.5}.
*
* @param value The value to fix.
* @param n The minimum amount of fraction digits.
* @return The fixed value, or the unchanged {@code value} if there is no small change
* that remove at least {@code n} fraction digits.
*/
public static double fixRoundingError(final double value, int n) {
double lower = value;
double upper = value;
n = countFractionDigits(value) - n;
if (n > 0) {
for (int i=0; i<4; i++) {
if (countFractionDigits(lower = previous(lower)) <= n) return lower;
if (countFractionDigits(upper = next (upper)) <= n) return upper;
}
}
return value;
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Round the specified value, providing that the difference between the original value and
* the rounded value is not greater than the specified amount of floating point units. This
* method can be used for hiding floating point error likes 2.9999999996.
*
* @param value The value to round.
* @param flu The amount of floating point units.
* @return The rounded value, of {@code value} if it was not close enough to an integer.
*/
public static double round(final double value, int flu) {
final double target = Math.rint(value);
if (value != target) {
final boolean pos = (value < target);
double candidate = value;
while (--flu >= 0) {
candidate = pos ? next(candidate) : previous(candidate);
if (candidate == target) {
return target;
}
}
}
return value;
}
代码示例来源:origin: org.geotools/gt-metadata
if (amount<0) {
do {
value = previous(value);
} while (++amount != 0);
} else if (amount!=0) {
do {
value = next(value);
} while (--amount != 0);
if (amount<0) {
do {
vf = previous(vf);
} while (++amount != 0);
} else if (amount!=0) {
do {
vf = next(vf);
} while (--amount != 0);
if (isInteger(type)) {
return value + amount;
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Formats the specified number.
*/
private String format(final Number value) {
if (numberFormat == null) {
numberFormat = NumberFormat.getNumberInstance(locale);
numberFormat.setMinimumFractionDigits(0);
}
int precision = 0;
if (!XMath.isInteger(value.getClass())) {
precision = PRECISION;
final double v = Math.abs(value.doubleValue());
if (v > 0) {
final int digits = (int) XMath.log10(v);
if (Math.abs(digits) >= PRECISION) {
// TODO: Switch to exponential notation when a convenient API will be available in J2SE.
return value.toString();
}
if (digits >= 0) {
precision -= digits;
}
precision = Math.max(0, PRECISION - precision);
}
}
numberFormat.setMaximumFractionDigits(precision);
return numberFormat.format(value);
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Set the type and the range of valid values.
*/
public void setValueRange(Class classe, final Range range) {
String type = null;
String minimum = null;
String maximum = null;
if (classe != null) {
while (classe.isArray()) {
classe = classe.getComponentType();
}
classe = XMath.primitiveToWrapper(classe);
boolean isInteger = false;
if (XMath.isReal(classe) || (isInteger=XMath.isInteger(classe))==true) {
type = Vocabulary.format(isInteger ? VocabularyKeys.SIGNED_INTEGER_$1
: VocabularyKeys.REAL_NUMBER_$1,
new Integer(XMath.getBitCount(classe)));
} else {
type = Utilities.getShortName(classe);
}
}
if (range != null) {
minimum = format(range.getMinValue());
maximum = format(range.getMaxValue());
}
this.type .setText(type);
this.minimum.setText(minimum);
this.maximum.setText(maximum);
}
代码示例来源:origin: org.geotools/gt2-coverage
/**
* Returns a string representation of this category.
* The returned string is implementation dependent.
* It is usually provided for debugging purposes.
*/
public String toString() {
final StringBuffer buffer = new StringBuffer(Utilities.getShortClassName(this));
buffer.append("(\"");
buffer.append(name);
buffer.append("\":[");
if (Double.isNaN(minimum) && Double.isNaN(maximum)) {
buffer.append("NaN(");
buffer.append(Math.round(inverse.minimum));
buffer.append("...");
buffer.append(Math.round(inverse.maximum));
buffer.append(')');
} else {
if (XMath.isInteger(getRange().getElementClass())) {
buffer.append(Math.round(minimum));
buffer.append("...");
buffer.append(Math.round(maximum)); // Inclusive
} else {
buffer.append(minimum);
buffer.append(" ... ");
buffer.append(maximum); // Inclusive
}
}
buffer.append("])");
return buffer.toString();
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
final double factor = XMath.pow10((int)Math.floor(XMath.log10(increment)));
increment /= factor;
if (Double.isNaN(increment) || Double.isInfinite(increment) || increment==0) {
代码示例来源:origin: org.geotools/gt2-coverageio
/**
* Returns the user object associated as an instance of the specified class. If the value
* returned by {@link #getUserObject()} is not of the expected type, then this method will
* tries to parse it as a string.
*
* @param type The expected class.
* @return The user object, or {@code null} if none.
* @throws ClassCastException if the user object can not be casted to the specified type.
*
* @see #getUserObject()
* @see #setUserObject
*/
protected Object /*T*/ getUserObject(Class/*<T>*/ type) throws ClassCastException {
type = XMath.primitiveToWrapper(type);
Object value = getUserObject();
if (value instanceof CharSequence) {
if (Number.class.isAssignableFrom(type)) {
value = XMath.valueOf(type, value.toString());
} else {
final Class component = XMath.primitiveToWrapper(type.getComponentType());
if (Double.class.equals(component)) {
value = parseSequence(value.toString(), false, false);
} else if (Integer.class.equals(component)) {
value = parseSequence(value.toString(), false, true);
}
}
}
return value; // TODO: use type.cast with Java 5.
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Finds the least float greater than <var>f</var>.
* If {@code NaN}, returns same value.
*
* @todo Remove this method when we will be allowed to use Java 6.
*/
public static float next(final float f) {
return next(f, true);
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
final double normalize = 0.25 * XMath.hypot(tmp.x, tmp.y);
tmp.x /= normalize;
tmp.y /= normalize;
adjusting = 0;
switch (XMath.sgn(Math.rint(tmp.x))) {
case -1: adjusting |= WEST; break;
case +1: adjusting |= EAST; break;
switch (XMath.sgn(Math.rint(tmp.y))) {
case -1: adjusting |= NORTH; break;
case +1: adjusting |= SOUTH; break;
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Returns the axis length. This is the distance between starting point (@link #getP1 P1})
* and end point ({@link #getP2 P2}). This length is usually measured in pixels or points
* (1/72 of inch).
*/
public synchronized double getLength() {
return XMath.hypot(getX1()-getX2(), getY1()-getY2());
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Returns the most specific superclass for all the cell values.
*/
public Class getColumnClass(final int index) {
if (index==0 || unsigned) {
return Integer.class;
}
return XMath.primitiveToWrapper(table[index-1].getClass().getComponentType());
}
代码示例来源:origin: org.geotools/gt2-coverageio
PadValuesMask(final double[] padValues) {
doubleValues = new double[padValues.length];
floatValues = new float [padValues.length];
NaNs = new float [padValues.length];
for (int i=0; i<padValues.length; i++) {
floatValues[i] = (float) (doubleValues[i] = padValues[i]);
NaNs[i] = XMath.toNaN(i);
}
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Compute 10 power <var>x</var>.
*/
public static double pow10(final double x) {
final int ix = (int) x;
if (ix == x) {
return pow10(ix);
} else {
return Math.pow(10, x);
}
}
代码示例来源:origin: org.geotools/gt2-metadata
value = Boolean.valueOf(property);
} else if (Number.class.isAssignableFrom(type)) try {
value = XMath.valueOf(type, property);
} catch (NumberFormatException e) {
unexpectedException(e);
代码示例来源:origin: org.geotools/gt2-metadata
if (amount<0) {
do {
value = previous(value);
} while (++amount != 0);
} else if (amount!=0) {
do {
value = next(value);
} while (--amount != 0);
if (amount<0) {
do {
vf = previous(vf);
} while (++amount != 0);
} else if (amount!=0) {
do {
vf = next(vf);
} while (--amount != 0);
if (isInteger(type)) {
return value + amount;
代码示例来源:origin: org.geotools/gt-metadata
/**
* Rounds the specified value, providing that the difference between the original value and
* the rounded value is not greater than the specified amount of floating point units. This
* method can be used for hiding floating point error likes 2.9999999996.
*
* @param value The value to round.
* @param maxULP The maximal change allowed in ULPs (Unit in the Last Place).
* @return The rounded value, of {@code value} if it was not close enough to an integer.
*/
public static double roundIfAlmostInteger(final double value, int maxULP) {
final double target = Math.rint(value);
if (value != target) {
final boolean pos = (value < target);
double candidate = value;
while (--maxULP >= 0) {
candidate = pos ? next(candidate) : previous(candidate);
if (candidate == target) {
return target;
}
}
}
return value;
}
代码示例来源:origin: org.geotools/gt2-coverage
final boolean adjustSamples = (XMath.isInteger(sType) && !XMath.isInteger(gType));
if ((adjustSamples ? gMinInc : sMinInc) != 0) {
int swap = sMinInc;
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
我也是 Geotools 和 Maven 的新手。我尝试了快速入门来开始使用地理工具,一切都运行良好,直到我尝试创建示例应用程序。所有以 org.geotools 开头的导入都被标记为不存在。查找依赖
我目前正在使用 GeoTools 工具包对海洋船只数据进行计算,例如计算两个经/纬度点之间的大圆距离。我还有两个需要满足的其他要求,但我不确定在 GeoTools 中的什么地方可以找到执行此类计算的类
我正在研究一个Java项目,该项目需要将WGS84转换为UMT。我使用geotools v20.5通过以下代码创建了一个转换: transform = CRS.findMathTransform(
有人可以告诉我如何通过 java geotools api 获取特征的顶点吗? 就我而言,我在postgis中有一个多边形层,我可以查询该层的所有特征,并且我需要知道每个特征的顶点。
我正在使用 geotools.js 将操作系统网格引用转换为纬度和经度。不幸的是,默认情况下(我相信)输出限制为小数点后两位。为了更准确的读数,我需要它是小数点后 5 位。 我尝试在自己的代码中删除对
我正在使用 geotools 库。我的目标是输入一个坐标,然后获取包含它的要素信息。 Geotools Quickstart 教程的 map 完全按照我想要的方式使用我在下面用红色圈出的按钮。但是,我
我正在使用 GeoTools Java 库进行一些几何计算。就我而言,我使用的是一个形状文件,其中包含某个城市的所有邻域多面体。我想知道那个城市的每一个可能的坐标,它对应于哪个街区。所以我的方法是简单
我正在使用 Java Geotools 库来检查 POINT(...) 是否包含在 POLYGON(...) 中。 我已经完成了: Geometry sPG = reader.read(wktStar
本文整理了Java中org.geotools.util.WeakCollectionCleaner类的一些代码示例,展示了WeakCollectionCleaner类的具体用法。这些代码示例主要来源于
本文整理了Java中org.geotools.resources.XArray类的一些代码示例,展示了XArray类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mave
本文整理了Java中org.geotools.resources.XMath类的一些代码示例,展示了XMath类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等
本文整理了Java中org.geotools.xs.XSSchema类的一些代码示例,展示了XSSchema类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平
本文整理了Java中org.geotools.ysld.Ysld类的一些代码示例,展示了Ysld类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些
本文整理了Java中org.geotools.ysld.YamlSeq类的一些代码示例,展示了YamlSeq类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平
本文整理了Java中org.geotools.ysld.YamlUtil类的一些代码示例,展示了YamlUtil类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 6 个月前关闭。 Improve
我正在实现轨迹点的插值。所以,基本上,我需要沿着从起点到终点的方位角创建几个点。问题是,我无法将创建的点添加到集合中: SimpleFeatureType featureType = featureS
我有很多点导致 getOrthodromicDistance 方法在 geotools lib 中失败并出现异常,而这些点是有效的经纬度点: 抛出异常的点(纬度,经度): val p1= (5.318
我是一名优秀的程序员,十分优秀!