本文整理了Java中org.geotools.geometry.jts.JTS.shapeToGeometry()
方法的一些代码示例,展示了JTS.shapeToGeometry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTS.shapeToGeometry()
方法的具体详情如下:
包路径:org.geotools.geometry.jts.JTS
类名称:JTS
方法名:shapeToGeometry
[英]Converts an arbitrary Java2D shape into a JTS geometry. The created JTS geometry may be any of LineString, LinearRing or MultiLineString.
[中]将任意Java2D形状转换为JTS几何图形。创建的JTS几何图形可以是线条、线条或多重线条中的任意一种。
代码示例来源:origin: bcdev/beam
private Geometry getPolygon(GeneralPath geoBoundaryPath) {
Geometry boundary = JTS.shapeToGeometry(geoBoundaryPath, factory);
if (boundary instanceof LinearRing) {
boundary = factory.createPolygon((LinearRing) boundary, null);
}
return boundary;
}
}
代码示例来源:origin: bcdev/beam
private static Coordinate[] getBoundsCoordinates(Geometry roiGeometry) {
// do not use ShapeWriter.toShape(Geometry) here, because it rounds
GeneralPath shape = new GeneralPath();
shape.moveTo((float) roiGeometry.getCoordinates()[0].x, (float) roiGeometry.getCoordinates()[0].y);
for (int i = 1; i < roiGeometry.getNumPoints(); i++) {
shape.lineTo((float) roiGeometry.getCoordinates()[i].x, (float) roiGeometry.getCoordinates()[i].y);
}
roiGeometry = JTS.shapeToGeometry(shape.getBounds2D(), new GeometryFactory());
return roiGeometry.getCoordinates();
}
代码示例来源:origin: bcdev/beam
private BinWriter createBinWriter(File tempFile, int numRows, ProductData.UTC startTime, ProductData.UTC stopTime) {
final SEAGrid seaGrid = new SEAGrid(numRows);
final VariableContextImpl variableContext = new VariableContextImpl();
variableContext.defineVariable("test", "blah");
final BinManager binManager = new BinManager(variableContext, new AggregatorMinMax(variableContext, "test", "test"));
final BinningContextImpl binningContext = new BinningContextImpl(seaGrid, binManager, CompositingType.BINNING, 1, -1, null, null);
final Geometry region = JTS.shapeToGeometry(new Rectangle2D.Double(-180, -90, 360, 180), new GeometryFactory());
final SeaDASLevel3BinWriter binWriter = new SeaDASLevel3BinWriter(region, startTime, stopTime);
binWriter.setBinningContext(binningContext);
binWriter.setTargetFileTemplatePath(tempFile.getAbsolutePath());
binWriter.setLogger(Logger.getLogger("SeaDASLevel3BinWriterTest"));
return binWriter;
}
}
代码示例来源:origin: bcdev/beam
region = JTS.shapeToGeometry(regionArea, new GeometryFactory());
代码示例来源:origin: org.geotools/gt-coverage
final Geometry jis = JTS.shapeToGeometry(intersectionEnvelope.toRectangle2D(), cropRoi.getFactory());
if( ! IntersectUtils.intersects(cropRoi, jis))
throw new CannotCropException(Errors.format(ErrorKeys.CANT_CROP));
内容来源于网络,如有侵权,请联系作者删除!