- 使用 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(),
Schema.org、Goodrelations-vocabulary.org 和 Productontology.org 之间有什么关系? Schema.org 告知,“W3C schema.org
大家好,我想知道包 org.ietf、org.omg、org.w3c 和 org 是如何实现的.xml 已进入 "official" Java classes ? 例如,默认 JDK 不会包含 Apa
首先,我试图用来自 Schema.org 的属性定义数据库表,例如,例如,我有一个名为“JobPosting”的表,它或多或少具有与 http://schema.org/JobPosting 中定义的
我有一个 org.w3c.dom.Document 被 org.dom4j.io.DOMReader 解析。 我想通过 org.w3c.dom.Element 搜索 dom4j DOM 文档。 比方说
我正在将我的应用程序部署到 Tomcat 6.0.20。 应用程序使用 Hibernate 作为 Web 层的 ORM、Spring 和 JSF。 我还从 main() 方法制作了简单的运行器来测试
我有一个使用 hibernate > 4 的 gradle 项目。如果我在 Apache tomcat 中运行我的 war 文件,我不会收到任何错误。但是当我在 Wildfly 8.2 中部署它时,出
我正在尝试将 JaCoCo 添加到我的 Android 以覆盖 Sonar Qube。但是在运行命令 ./gradlew jacocoTestReport 时,我收到以下错误。 Task :app:
如何在 emacs 组织模式中格式化日期? 例如,在下表中,我希望日期显示为“Aug 29”或“Wed, Aug 29”而不是“” #+ATTR_HTML: border="2" rules="all
我想使用 org 模式来写一本技术书籍。我正在寻找一种将外部文件中的现有代码插入到 babel 代码块中的方法,该代码块在导出为 pdf 时会提供很好的格式。 例如 #+BEGIN_SRC pytho
用作引用:https://support.google.com/webmasters/answer/146750?hl=en 您会注意到在“产品”下有一个属性类别,此外页面下方还有一个示例: Too
我读了这个Google doc .它说我们不使用列表中的产品。 那么对于产品列表(具有多页的类似产品的类别,如“鞋子”),推荐使用哪种模式? 我用这个: { "@context": "htt
我目前在做DBpedia数据集,想通过wikidata实现schema.org和DBpedia的映射。因此我想知道 schema.org 和 wikidata 之间是否存在任何映射。 最佳答案 我认为
我爱org-tables ,我用它们来记录各种事情。我现在正在为 Nix 记录一些单行代码(在阅读了 Domen Kožar 的 excellent guide 后,在 this year's Eur
如果看一下 Movie在 schema.org 中输入,actor 和 actors 属性都是允许的(actor 取代 actors)。但是 author 和 contributor 属性没有等效项。
我们有一些餐厅有多个地点或分支机构。我想包含正确的 Schema.org 标记,但找不到任何允许列出多个餐厅的内容。 每家餐厅都有自己的地址、电子邮件、电话和营业时间,甚至可能是“分店名称”。 两个分
我在一个页面中有多个综合评分片段。 有没有办法让其中之一成为默认值?将显示在搜索引擎结果中的那个? 谢谢大家! 更新:该网页本质上是品牌的页面。它包含品牌评论的总评分及其产品列表(每个产品的总评分)。
我提到了一些相关的职位,但并没有解决我的问题。因为我正在使用maven-jar-plugin-2.4 jar。 我正在使用JBoss Developer Studio 7.1.1 GA IDE,并且正
网站的根页面(即 http://example.com/ )的特殊之处在于它是默认的着陆页。它可能包含许多不同的对象类型。 它可能被认为是一个网站,或者一个博客等... 但它是否也应该被标记为给定对象
我想将一些文本放入一个 org 文件中,当我将内容导出到其中一种目标类型(在本例中为 HTML)时,该文件不会发布。有什么方法可以实现这个目标吗? 最佳答案 您可能想要使用 :noexport: 标签
org-mode 是否有一个键绑定(bind)可以在编号/项目符号列表项之间移动,就像您可以对标题一样? 喜欢的功能: org-forward-heading-same-level 大纲下一个可见标题
我是一名优秀的程序员,十分优秀!