- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.geotools.geometry.util.XRectangle2D
类的一些代码示例,展示了XRectangle2D
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XRectangle2D
类的具体详情如下:
包路径:org.geotools.geometry.util.XRectangle2D
类名称:XRectangle2D
[英]Serializable, high-performance double-precision rectangle. Instead of using x, y, width and height, this class store rectangle's coordinates into the following fields: #xmin, #xmax, #ymin et #ymax. Methods likes contains and intersects are faster, which make this class more appropriate for using intensively inside a loop. Furthermore, this class work correctly with Double#POSITIVE_INFINITY and Double#NaN values.
[中]可串行化的高性能双精度矩形。该类不使用x、y、宽度和高度,而是将矩形的坐标存储到以下字段中:#xmin、#xmax、#ymin et#ymax。像contains和intersects这样的方法速度更快,这使得这个类更适合在循环中大量使用。此外,这个类可以正确处理双#正#无穷大和双#NaN值。
代码示例来源:origin: geotools/geotools
/**
* Create a rectangle using maximal <var>x</var> and <var>y</var> values rather than width and
* height. This factory avoid the problem of NaN values when extremums are infinite numbers.
*/
public static XRectangle2D createFromExtremums(
final double xmin, final double ymin, final double xmax, final double ymax) {
final XRectangle2D rect = new XRectangle2D();
rect.xmin = xmin;
rect.ymin = ymin;
rect.xmax = xmax;
rect.ymax = ymax;
return rect;
}
代码示例来源:origin: geotools/geotools
/**
* Returns a {@link Rectangle2D} with the same bounds as this {@code Envelope}. This is a
* convenience method for interoperability with Java2D.
*
* @return This envelope as a twp-dimensional rectangle.
* @throws IllegalStateException if this envelope is not two-dimensional.
*/
public Rectangle2D toRectangle2D() throws IllegalStateException {
if (ordinates.length == 4) {
return XRectangle2D.createFromExtremums(
ordinates[0], ordinates[1], ordinates[2], ordinates[3]);
} else {
throw new IllegalStateException(
Errors.format(ErrorKeys.NOT_TWO_DIMENSIONAL_$1, getDimension()));
}
}
代码示例来源:origin: geotools/geotools
/** Returns {@code true} if the two rectangles are equals up to an epsilon value. */
public static boolean equalsEpsilon(final Rectangle2D rect1, final Rectangle2D rect2) {
double dx = 0.5 * Math.abs(rect1.getWidth() + rect2.getWidth());
double dy = 0.5 * Math.abs(rect1.getHeight() + rect2.getHeight());
if (dx > 0) dx *= EPS;
else dx = EPS;
if (dy > 0) dy *= EPS;
else dy = EPS;
return equalsEpsilon(rect1.getMinX(), rect2.getMinX(), dx)
&& equalsEpsilon(rect1.getMinY(), rect2.getMinY(), dy)
&& equalsEpsilon(rect1.getMaxX(), rect2.getMaxX(), dx)
&& equalsEpsilon(rect1.getMaxY(), rect2.getMaxY(), dy);
}
代码示例来源:origin: geotools/geotools
private Rectangle createQueryGridEnvelope(DirectPosition pos) {
final GridCoverage2DReader reader = sourceRef.get();
try {
MathTransform worldToGridTransform =
reader.getOriginalGridToWorld(PixelInCell.CELL_CORNER).inverse();
DirectPosition midPos = worldToGridTransform.transform(pos, null);
int x = (int) midPos.getOrdinate(0);
int y = (int) midPos.getOrdinate(1);
int halfWidth = CACHED_RASTER_WIDTH / 2;
final Rectangle queryRect =
new Rectangle(
x - halfWidth, y - halfWidth, CACHED_RASTER_WIDTH, CACHED_RASTER_WIDTH);
GridEnvelope gridEnv = reader.getOriginalGridRange();
Rectangle rect =
new Rectangle(
gridEnv.getLow(0), gridEnv.getLow(1),
gridEnv.getSpan(0), gridEnv.getSpan(1));
XRectangle2D.intersect(queryRect, rect, queryRect);
return queryRect;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
代码示例来源:origin: geotools/geotools
destination.setRect(xmin, ymin, xmax - xmin, ymax - ymin);
} else {
destination = XRectangle2D.createFromExtremums(xmin, ymin, xmax, ymax);
|| !(destination instanceof Rectangle2D.Double
|| destination instanceof Rectangle2D.Float))
|| XRectangle2D.equalsEpsilon(
destination,
transform(transform, new Envelope2D(null, envelope))
代码示例来源:origin: geotools/geotools
/**
* Construct a rectangle with the same coordinates than the supplied rectangle.
*
* @param rect The rectangle, or {@code null} in none (in which case this constructor is
* equivalents to the no-argument constructor). Use {@link #INFINITY} for initializing this
* {@code XRectangle2D} with infinite bounds.
*/
public XRectangle2D(final Rectangle2D rect) {
if (rect != null) {
setRect(rect);
}
}
代码示例来源:origin: geotools/geotools
private Rectangle computeRasterArea(
ReferencedEnvelope computedBBox, MathTransform2D requestedWorldToGrid)
throws TransformException, FactoryException {
final ReferencedEnvelope cropBBOXInRequestCRS =
Utils.reprojectEnvelope(computedBBox, requestCRS, requestedBBox);
// make sure it falls within the requested envelope
cropBBOXInRequestCRS.intersection((org.locationtech.jts.geom.Envelope) requestedBBox);
// now go back to raster space
Rectangle computedRasterArea =
new GeneralGridEnvelope(
CRS.transform(requestedWorldToGrid, cropBBOXInRequestCRS),
PixelInCell.CELL_CORNER,
false)
.toRectangle();
// intersect with the original requested raster space to be sure that we stay within
// the requested raster area
XRectangle2D.intersect(computedRasterArea, requestedRasterArea, computedRasterArea);
return computedRasterArea;
}
代码示例来源:origin: geotools/geotools
XRectangle2D.createFromExtremums(
-3943612.4042124213,
-4078471.954436003,
XRectangle2D.createFromExtremums(
-178.49352310409273,
-88.99136583196398,
assertTrue(XRectangle2D.equalsEpsilon(expected, actual));
expected = XRectangle2D.createFromExtremums(-180, -90, 180, -40.905775004205864);
actual = CRS.transform(operation, envelope, actual);
assertTrue(XRectangle2D.equalsEpsilon(expected, actual));
envelope = XRectangle2D.createFromExtremums(-4000000, -4000000, 300000, 30000);
expected = XRectangle2D.createFromExtremums(-180, -90, 180, -41.03163170198091);
actual = CRS.transform(operation, envelope, actual);
assertTrue(XRectangle2D.equalsEpsilon(expected, actual));
代码示例来源:origin: geotools/geotools
XRectangle2D.intersect(
coverageRequestedRasterArea,
coverageRasterArea,
代码示例来源:origin: geotools/geotools
/**
* Returns a new {@code Rectangle2D} object representing the union of this {@code Rectangle2D}
* with the specified {@code Rectangle2D}.
*
* @param rect the {@code Rectangle2D} to be combined with this {@code Rectangle2D}
* @return the smallest {@code Rectangle2D} containing both the specified {@code Rectangle2D}
* and this {@code Rectangle2D}.
*/
public Rectangle2D createUnion(final Rectangle2D rect) {
final XRectangle2D r = new XRectangle2D();
r.xmin = Math.min(xmin, rect.getMinX());
r.ymin = Math.min(ymin, rect.getMinY());
r.xmax = Math.max(xmax, rect.getMaxX());
r.ymax = Math.max(ymax, rect.getMaxY());
return r;
}
代码示例来源:origin: geotools/geotools
final Rectangle tempRect = finalRange.toRectangle();
XRectangle2D.intersect(tempRect, requestedDim, tempRect);
requestedDim.setRect(tempRect);
} catch (TransformException te) {
代码示例来源:origin: geotools/geotools
/**
* Returns a new {@code Rectangle2D} object representing the intersection of this {@code
* Rectangle2D} with the specified {@code Rectangle2D}.
*
* @param rect the {@code Rectangle2D} to be intersected with this {@code Rectangle2D}
* @return the largest {@code Rectangle2D} contained in both the specified {@code Rectangle2D}
* and in this {@code Rectangle2D}.
*/
public Rectangle2D createIntersection(final Rectangle2D rect) {
final XRectangle2D r = new XRectangle2D();
r.xmin = Math.max(xmin, rect.getMinX());
r.ymin = Math.max(ymin, rect.getMinY());
r.xmax = Math.min(xmax, rect.getMaxX());
r.ymax = Math.min(ymax, rect.getMaxY());
return r;
}
代码示例来源:origin: geotools/geotools
.toRectangle2D()
.getBounds();
XRectangle2D.intersect(
sourceArea,
selectedlevel.rasterDimensions,
代码示例来源:origin: geotools/geotools
new XRectangle2D(
raster.getMinX() + 0.5,
raster.getMinY() + 0.5,
代码示例来源:origin: geotools/geotools
sourceArea.grow(2, 2);
XRectangle2D.intersect(
sourceArea,
selectedlevel.rasterDimensions,
代码示例来源:origin: geotools/geotools
/**
* This method is responsible for computing the raster bounds of the final mosaic.
*
* @throws TransformException In case transformation fails during the process.
*/
private void initRasterBounds() throws TransformException {
final GeneralEnvelope tempRasterBounds = CRS.transform(finalWorldToGridCorner, mosaicBBox);
rasterBounds = tempRasterBounds.toRectangle2D().getBounds();
// SG using the above may lead to problems since the reason is that may be a little (1 px)
// bigger
// than what we need. The code below is a bit better since it uses a proper logic (see
// GridEnvelope
// Javadoc)
rasterBounds =
new GridEnvelope2D(new Envelope2D(tempRasterBounds), PixelInCell.CELL_CORNER);
if (rasterBounds.width == 0) rasterBounds.width++;
if (rasterBounds.height == 0) rasterBounds.height++;
if (oversampledRequest) rasterBounds.grow(2, 2);
// make sure the expanded bounds are still within the reach of the granule bounds, not
// larger
// (the above expansion might have made them so)
final GeneralEnvelope levelRasterArea_ =
CRS.transform(
finalWorldToGridCorner, request.spatialRequestHelper.getCoverageBBox());
final GridEnvelope2D levelRasterArea =
new GridEnvelope2D(new Envelope2D(levelRasterArea_), PixelInCell.CELL_CORNER);
XRectangle2D.intersect(levelRasterArea, rasterBounds, rasterBounds);
}
代码示例来源:origin: geotools/geotools
XRectangle2D.intersect(
destinationRasterArea, requestedRasterArea, destinationRasterArea);
} catch (NoninvertibleTransformException e) {
代码示例来源:origin: geotools/geotools
XRectangle2D.intersect(
destinationRasterArea, requestedRasterArea, destinationRasterArea);
} catch (NoninvertibleTransformException e) {
代码示例来源:origin: geotools/geotools
XRectangle2D.intersect(
imageBounds,
rasterLayerResponse.getRasterBounds(),
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我试图用这种形式简单地获取数字 28 integer+space+integer+integer+space+integer我试过这个正则表达式 \\s\\d\\d\\s 但我得到了两个数字11 和
最近一直在学习D语言。我一直对运行时感到困惑。 从我能收集到的关于它的信息中,(这不是很多)我知道它是一种有助于 D 的一些特性的运行时。像垃圾收集一样,它与您自己的程序一起运行。但是既然 D 是编译
想问一下这两个正则表达式有区别吗? \d\d\d 与 \d{3} 我已经在我的本地机器上使用 Java 和 Windows 操作系统对此进行了测试,两者都工作正常并且结果相同。但是,当在 linux
我正在学习 Go,而且我坚持使用 Go 之旅(exercise-stringer.go:https://tour.golang.org/methods/7)。 这是一些代码: type IPAddr
我在Java正则表达式中发现了一段令我困惑的代码: Pattern.compile( "J.*\\d[0-35-9]-\\d\\d-\\d\\d" ); 要编译的字符串是: String string
我在 ruby 代码上偶然发现了这个。我知道\d{4})\/(\d\d)\/(\d\d)\/(.*)/是什么意思,但是\1-\2-\3-\4 是什么意思? 最佳答案 \1-\2-\3-\4 是 b
我一直在努力解决这个问题,这让我很恼火。我了解 D 运行时库。它是什么,它做什么。我也明白你可以在没有它的情况下编译 D 应用程序。就像 XoMB 所做的那样。好吧,XoMB 定义了自己的运行时,但是
我有两个列表列表,子列表代表路径。我想找到所有路径。 List> pathList1 List> pathList2 当然是天真的解决方案: List> result = new ArrayList>
我需要使用 Regex 格式化一个字符串,该字符串包含数字、字母 a-z 和 A-Z,同时还包含破折号和空格。 从用户输入我有02-219 8 53 24 输出应该是022 198 53 24 我正在
目标是达到与this C++ example相同的效果: 避免创建临时文件。我曾尝试将 C++ 示例翻译为 D,但没有成功。我也尝试过不同的方法。 import std.datetime : benc
tl;dr:你好吗perfect forwarding在 D? 该链接有一个很好的解释,但例如,假设我有这个方法: void foo(T)(in int a, out int b, ref int c
有什么方法可以在 D 中使用abstract auto 函数吗? 如果我声明一个类如下: class MyClass { abstract auto foo(); } 我收到以下错误: mai
有没有人为内存中重叠的数组切片实现交集?算法在没有重叠时返回 []。 当 pretty-print (使用重叠缩进)内存中重叠的数组切片时,我想要这个。 最佳答案 如果您确定它们是数组,那么只需取 p
我已经开始学习 D,但我在使用 Andrei Alexandrescu 所著的 The D Programming Language 一书中提供的示例时遇到了一些麻烦。由于 int 和 ulong 类
如何创建一个不可变的类? 我的目标是创建一个实例始终不可变的类。现在我只是用不可变的方法和构造函数创建了一个“可变”类。我将其称为 mData,m 表示可变。然后我创建一个别名 alias immut
不久前我买了《The D Programming Language》。好书,很有教育意义。但是,我在尝试编译书中列出的语言功能时遇到了麻烦:扩展函数。 在这本书中,Andrei 写了任何可以像这样调用
我在 D http://www.digitalmars.com/d/2.0/lazy-evaluation.html 中找到了函数参数的惰性求值示例 我想知道如何在 D 中实现可能的无限数据结构,就像
这个问题在这里已经有了答案: 12 年前关闭。 Possible Duplicate: Could anyone explain these undefined behaviors (i = i++
当前是否可以跨模块扫描/查询/迭代具有某些属性的所有函数(或类)? 例如: source/packageA/something.d: @sillyWalk(10) void doSomething()
我是一名优秀的程序员,十分优秀!