本文整理了Java中com.vividsolutions.jts.geom.Geometry.isRectangle()
方法的一些代码示例,展示了Geometry.isRectangle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.isRectangle()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:isRectangle
暂无
代码示例来源:origin: com.vividsolutions/jts
public PreparedPolygon(Polygonal poly) {
super((Geometry) poly);
isRectangle = getGeometry().isRectangle();
}
代码示例来源:origin: com.vividsolutions/jts
if (isRectangle()) {
return RectangleIntersects.intersects((Polygon) this, g);
if (g.isRectangle()) {
return RectangleIntersects.intersects((Polygon) g, this);
代码示例来源:origin: com.vividsolutions/jts
return false;
if (isRectangle()) {
代码示例来源:origin: com.vividsolutions/jts
return false;
if (isRectangle()) {
return RectangleContains.contains((Polygon) this, g);
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* 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: org.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: org.geotools/gt-render
public boolean isRectangle() {
return geometry.isRectangle();
}
代码示例来源:origin: com.vividsolutions/jts-core
public PreparedPolygon(Polygonal poly) {
super((Geometry) poly);
isRectangle = getGeometry().isRectangle();
}
代码示例来源:origin: net.di2e.ecdr.libs/cdr-rest-search-commons
public static String polygonToBBox( String wkt ) throws ParseException {
LOGGER.trace( "Trying to convert the wkt [{}] into a bounding box", wkt );
WKTReader reader = new WKTReader();
Geometry geo = reader.read( wkt );
if ( !geo.isRectangle() ) {
geo = geo.getEnvelope();
WKTWriter writer = new WKTWriter();
String bbox = writer.write( geo );
LOGGER.debug( "Convert the following wkt [{}] into a bounding box wkt [{}]", wkt, bbox );
wkt = bbox;
}
return wkt;
}
代码示例来源:origin: net.di2e.ecdr.libs/cdr-rest-search-commons
@Override
public T intersects( String propertyName, String wkt ) {
logEntry( "intersects", propertyName, wkt );
boolean isBbox = false;
try {
WKTReader reader = new WKTReader();
isBbox = reader.read( wkt ).isRectangle();
} catch ( ParseException e ) {
LOGGER.warn( "WKT could not be parsed into geometry object [{}]: " + e.getMessage() );
}
return callHandleGeoMethod( propertyName, wkt, null, isBbox ? GeospatialFilterOptions.BBOX : GeospatialFilterOptions.INTERSECTS, null );
}
代码示例来源:origin: com.vividsolutions/jts-core
if (isRectangle()) {
return RectangleIntersects.intersects((Polygon) this, g);
if (g.isRectangle()) {
return RectangleIntersects.intersects((Polygon) g, this);
代码示例来源:origin: com.vividsolutions/jts-core
return false;
if (isRectangle()) {
代码示例来源:origin: com.spatial4j/spatial4j
/**
* Parses a POLYGON shape from the raw string. It might return a
* {@link com.spatial4j.core.shape.Rectangle} if the polygon is one.
*
* <pre>
* coordinateSequenceList
* </pre>
*/
protected Shape parsePolygonShape(WKTReader.State state) throws ParseException {
Geometry geometry;
if (state.nextIfEmptyAndSkipZM()) {
GeometryFactory geometryFactory = ctx.getGeometryFactory();
geometry =
geometryFactory
.createPolygon(geometryFactory.createLinearRing(new Coordinate[] {}), null);
} else {
geometry = polygon(state);
if (geometry.isRectangle()) {
return ctx.makeRectFromRectangularPoly(geometry);
}
}
return ctx.makeShapeFromGeometry(geometry);
}
代码示例来源:origin: com.vividsolutions/jts-core
return false;
if (isRectangle()) {
return RectangleContains.contains((Polygon) this, g);
代码示例来源:origin: harbby/presto-connectors
/**
* Parses a POLYGON shape from the raw string. It might return a
* {@link com.spatial4j.core.shape.Rectangle} if the polygon is one.
*
* <pre>
* coordinateSequenceList
* </pre>
*/
protected Shape parsePolygonShape(WKTReader.State state) throws ParseException {
Geometry geometry;
if (state.nextIfEmptyAndSkipZM()) {
GeometryFactory geometryFactory = ctx.getGeometryFactory();
geometry =
geometryFactory
.createPolygon(geometryFactory.createLinearRing(new Coordinate[] {}), null);
} else {
geometry = polygon(state);
if (geometry.isRectangle()) {
return ctx.makeRectFromRectangularPoly(geometry);
}
}
return ctx.makeShapeFromGeometry(geometry);
}
代码示例来源:origin: com.spatial4j/spatial4j
/**
* Reads WKT from the {@code str} via JTS's {@link com.vividsolutions.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 com.vividsolutions.jts.geom.Point) {
com.vividsolutions.jts.geom.Point ptGeom = (com.vividsolutions.jts.geom.Point) geom;
if (ctx.useJtsPoint())
return new JtsPoint(ptGeom, ctx);
else
return ctx.makePoint(ptGeom.getX(), ptGeom.getY());
} else if (geom.isRectangle()) {
return super.ctx.makeRectFromRectangularPoly(geom);
} else {
return super.ctx.makeShapeFromGeometry(geom);
}
} catch (InvalidShapeException e) {
throw e;
} catch (Exception e) {
throw new InvalidShapeException("error reading WKT: "+e.toString(), e);
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* Reads WKT from the {@code str} via JTS's {@link com.vividsolutions.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 com.vividsolutions.jts.geom.Point) {
com.vividsolutions.jts.geom.Point ptGeom = (com.vividsolutions.jts.geom.Point) geom;
if (ctx.useJtsPoint())
return new JtsPoint(ptGeom, ctx);
else
return ctx.makePoint(ptGeom.getX(), ptGeom.getY());
} else if (geom.isRectangle()) {
return super.ctx.makeRectFromRectangularPoly(geom);
} else {
return super.ctx.makeShapeFromGeometry(geom);
}
} catch (InvalidShapeException e) {
throw e;
} catch (Exception e) {
throw new InvalidShapeException("error reading WKT: "+e.toString(), e);
}
}
代码示例来源:origin: com.spatial4j/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 null 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 (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 makeRectangle(env.getMaxX(), env.getMinX(), env.getMinY(), env.getMaxY());
else
return makeRectangle(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY());
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* 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 null 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 (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 makeRectangle(env.getMaxX(), env.getMinX(), env.getMinY(), env.getMaxY());
else
return makeRectangle(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY());
}
}
内容来源于网络,如有侵权,请联系作者删除!