本文整理了Java中org.locationtech.jts.geom.Geometry.isRectangle()
方法的一些代码示例,展示了Geometry.isRectangle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.isRectangle()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:isRectangle
暂无
代码示例来源:origin: geotools/geotools
public boolean isRectangle() {
return geometry.isRectangle();
}
代码示例来源:origin: geotools/geotools
ReferencedEnvelope renderingEnvelope)
throws FactoryException {
if (validArea.isRectangle()) {
this.renderingEnvelope = renderingEnvelope;
this.sourceCRS = sourceCRS;
代码示例来源:origin: orbisgis/h2gis
/**
* Returns true if the given geometry is a rectangle.
*
* @param geometry Geometry
* @return True if the given geometry is a rectangle
*/
public static Boolean isRectangle(Geometry geometry) {
if(geometry == null){
return null;
}
return geometry.isRectangle();
}
}
代码示例来源:origin: locationtech/jts
public static boolean isRectangle(Geometry g) { return g.isRectangle(); }
public static boolean isClosed(Geometry g) {
代码示例来源:origin: locationtech/spatial4j
/**
* Reads WKT from the {@code str} via JTS's {@link org.locationtech.jts.io.WKTReader}.
* @param str
* @param reader <pre>new WKTReader(ctx.getGeometryFactory()))</pre>
* @return Non-Null
*/
protected Shape parseIfSupported(String str, WKTReader reader) throws ParseException {
try {
Geometry geom = reader.read(str);
//Normalizes & verifies coordinates
checkCoordinates(geom);
if (geom instanceof org.locationtech.jts.geom.Point) {
org.locationtech.jts.geom.Point ptGeom = (org.locationtech.jts.geom.Point) geom;
if (getShapeFactory().useJtsPoint())
return new JtsPoint(ptGeom, (JtsSpatialContext) ctx);
else
return getShapeFactory().pointXY(ptGeom.getX(), ptGeom.getY());
} else if (geom.isRectangle()) {
return getShapeFactory().makeRectFromRectangularPoly(geom);
} else {
return getShapeFactory().makeShapeFromGeometry(geom);
}
} catch (InvalidShapeException e) {
throw e;
} catch (Exception e) {
throw new InvalidShapeException("error reading WKT: "+e.toString(), e);
}
}
代码示例来源:origin: locationtech/jts
public PreparedPolygon(Polygonal poly) {
super((Geometry) poly);
isRectangle = getGeometry().isRectangle();
}
代码示例来源:origin: locationtech/spatial4j
/**
* INTERNAL: Returns a Rectangle of the JTS {@link Envelope} (bounding box) of the given {@code geom}. This asserts
* that {@link Geometry#isRectangle()} is true. This method reacts to the {@link DatelineRule} setting.
* @param geom non-null
* @return the equivalent Rectangle.
*/
public Rectangle makeRectFromRectangularPoly(Geometry geom) {
// TODO although, might want to never convert if there's a semantic difference (e.g.
// geodetically)? Should have a setting for that.
assert geom.isRectangle();
Envelope env = geom.getEnvelopeInternal();
boolean crossesDateline = false;
if (ctx.isGeo() && getDatelineRule() != DatelineRule.none) {
if (getDatelineRule() == DatelineRule.ccwRect) {
// If JTS says it is clockwise, then it's actually a dateline crossing rectangle.
crossesDateline = !CGAlgorithms.isCCW(geom.getCoordinates());
} else {
crossesDateline = env.getWidth() > 180;
}
}
if (crossesDateline)
return rect(env.getMaxX(), env.getMinX(), env.getMinY(), env.getMaxY());
else
return rect(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY());
}
代码示例来源:origin: locationtech/jts
public boolean isRectangle(String wkt)
throws Exception
{
Geometry a = rdr.read(wkt);
return a.isRectangle();
}
}
代码示例来源:origin: geotools/geotools
&& env.getHeight() > 0
&& !(geom instanceof GeometryCollection)
&& geom.isRectangle()) {
代码示例来源:origin: org.geoserver.community/gs-wps-download
/**
* Constructor.
*
* @param roi original ROI as a JTS geometry
* @param roiCRS {@link CoordinateReferenceSystem} for the provided geometry. If this is null
* the CRS must be provided with the USerData of the roi
*/
public ROIManager(Geometry roi, CoordinateReferenceSystem roiCRS) {
this.originalRoi = roi;
DownloadUtilities.checkPolygonROI(roi);
// Check ROI CRS
if (roiCRS == null) {
if (!(roi.getUserData() instanceof CoordinateReferenceSystem)) {
throw new IllegalArgumentException("ROI without a CRS is not usable!");
}
this.roiCRS = (CoordinateReferenceSystem) roi.getUserData();
} else {
this.roiCRS = roiCRS;
}
roi.setUserData(this.roiCRS);
// is this a bbox
isROIBBOX = roi.isRectangle();
}
代码示例来源:origin: it.geosolutions.jaiext.vectorbin/jt-vectorbin
@Override
public LinkedList getAsRectangleList(int x, int y, int width, int height) {
Rectangle rect = new Rectangle(x, y, width, height);
if (!intersects(rect)) {
// no overlap
return null;
} else if (theGeom.getGeometry().isRectangle()) {
// simple case, the geometry is a rectangle to start with
Envelope env = theGeom.getGeometry().getEnvelopeInternal();
Envelope intersection = env.intersection(new Envelope(x, x + width, y, y + width));
int rx = (int) Math.round(intersection.getMinX());
int ry = (int) Math.round(intersection.getMinY());
int rw = (int) Math.round(intersection.getMaxX() - rx);
int rh = (int) Math.round(intersection.getMaxY() - ry);
LinkedList result = new LinkedList();
result.add(new Rectangle(rx, ry, rw, rh));
return result;
} else {
// we cannot force the base class to use our image, but
// we can create a ROI around it
ROI roiImage = new ROI(getAsImage());
return roiImage.getAsRectangleList(x, y, width, height);
}
}
代码示例来源:origin: geosolutions-it/jai-ext
@Override
public LinkedList getAsRectangleList(int x, int y, int width, int height) {
Rectangle rect = new Rectangle(x, y, width, height);
if (!intersects(rect)) {
// no overlap
return null;
} else if (theGeom.getGeometry().isRectangle()) {
// simple case, the geometry is a rectangle to start with
Envelope env = theGeom.getGeometry().getEnvelopeInternal();
Envelope intersection = env.intersection(new Envelope(x, x + width, y, y + width));
int rx = (int) Math.round(intersection.getMinX());
int ry = (int) Math.round(intersection.getMinY());
int rw = (int) Math.round(intersection.getMaxX() - rx);
int rh = (int) Math.round(intersection.getMaxY() - ry);
LinkedList result = new LinkedList();
result.add(new Rectangle(rx, ry, rw, rh));
return result;
} else {
// we cannot force the base class to use our image, but
// we can create a ROI around it
ROI roiImage = new ROI(getAsImage());
return roiImage.getAsRectangleList(x, y, width, height);
}
}
代码示例来源:origin: it.geosolutions.jaiext.vectorbin/jt-vectorbin
boolean pixelPerfectRectangle = theGeom.getGeometry().isRectangle() && x == env.getMinX()
&& y == env.getMinY() && (x + w) == env.getMaxX() &&
(y + h) == env.getMaxY();
代码示例来源:origin: geosolutions-it/jai-ext
boolean pixelPerfectRectangle = theGeom.getGeometry().isRectangle() && x == env.getMinX()
&& y == env.getMinY() && (x + w) == env.getMaxX() &&
(y + h) == env.getMaxY();
代码示例来源:origin: locationtech/jts
if (isRectangle()) {
return RectangleIntersects.intersects((Polygon) this, g);
if (g.isRectangle()) {
return RectangleIntersects.intersects((Polygon) g, this);
代码示例来源:origin: locationtech/jts
return false;
if (isRectangle()) {
代码示例来源:origin: locationtech/jts
return false;
if (isRectangle()) {
return RectangleContains.contains((Polygon) this, g);
内容来源于网络,如有侵权,请联系作者删除!