本文整理汇总了Java中com.vividsolutions.jts.geom.util.GeometryTransformer类的典型用法代码示例。如果您正苦于以下问题:Java GeometryTransformer类的具体用法?Java GeometryTransformer怎么用?Java GeometryTransformer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeometryTransformer类属于com.vividsolutions.jts.geom.util包,在下文中一共展示了GeometryTransformer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: lngLatToMeters
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/**
* Converts geometry from lat/lon (EPSG:4326)) to Spherical Mercator
* (EPSG:3857)
*
* @param geometry the geometry to convert
* @return the geometry transformed to EPSG:3857
*/
public Geometry lngLatToMeters(Geometry geometry) {
GeometryTransformer transformer = new GeometryTransformer() {
@Override
protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent) {
Coordinate[] newCoords = new Coordinate[coords.size()];
for (int i = 0; i < coords.size(); ++i) {
Coordinate coord = coords.getCoordinate(i);
newCoords[i] = lngLatToMeters(coord);
}
return new CoordinateArraySequence(newCoords);
}
};
Geometry result = transformer.transform(geometry);
return result;
}
开发者ID:scaleset,项目名称:scaleset-geo,代码行数:23,代码来源:GoogleMapsTileMath.java
示例2: metersToLngLat
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/**
* Converts geometry from Spherical Mercator
* (EPSG:3857) to lat/lon (EPSG:4326))
*
* @param geometry the geometry to convert
* @return the geometry transformed to EPSG:4326
*/
public Geometry metersToLngLat(Geometry geometry) {
GeometryTransformer transformer = new GeometryTransformer() {
@Override
protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent) {
Coordinate[] newCoords = new Coordinate[coords.size()];
for (int i = 0; i < coords.size(); ++i) {
Coordinate coord = coords.getCoordinate(i);
newCoords[i] = metersToLngLat(coord);
}
return new CoordinateArraySequence(newCoords);
}
};
Geometry result = transformer.transform(geometry);
return result;
}
开发者ID:scaleset,项目名称:scaleset-geo,代码行数:23,代码来源:GoogleMapsTileMath.java
示例3: getForwardTransformer
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/** */
public GeometryTransformer getForwardTransformer ();
开发者ID:reuven,项目名称:modelingcommons,代码行数:3,代码来源:Projection.java
示例4: getInverseTransformer
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/** */
public GeometryTransformer getInverseTransformer ();
开发者ID:reuven,项目名称:modelingcommons,代码行数:3,代码来源:Projection.java
示例5: getForwardTransformer
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/** */
public GeometryTransformer getForwardTransformer () {
return new ForwardTransformer((AbstractProjection)clone());
}
开发者ID:reuven,项目名称:modelingcommons,代码行数:5,代码来源:AbstractProjection.java
示例6: getInverseTransformer
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/** */
public GeometryTransformer getInverseTransformer () {
return new InverseTransformer((AbstractProjection)clone());
}
开发者ID:reuven,项目名称:modelingcommons,代码行数:5,代码来源:AbstractProjection.java
示例7: RasterDataset
import com.vividsolutions.jts.geom.util.GeometryTransformer; //导入依赖的package包/类
/** */
public RasterDataset (WritableRaster raster,
GridDimensions srcDimensions,
Projection srcProj,
Projection dstProj) {
super("RASTER");
GeometryFactory factory = GISExtension.getState().factory();
GeometryTransformer srcToGeog = srcProj.getInverseTransformer();
GeometryTransformer geogToDst = dstProj.getForwardTransformer();
int minCol = Integer.MAX_VALUE;
int maxCol = -1;
int minRow = Integer.MAX_VALUE;
int maxRow = -1;
Envelope newEnvelope = new Envelope();
for (int col = 0; col <= srcDimensions.getGridWidth(); col += 2) {
for (int row = 0; row <= srcDimensions.getGridHeight(); row += 2) {
Point src = factory.createPoint(new Coordinate(srcDimensions.getColumnLeft(col),
srcDimensions.getRowBottom(row)));
Point dest = (Point)geogToDst.transform(srcToGeog.transform(src));
if (!dest.isEmpty()) {
if (col < minCol) {
minCol = col;
}
if (col > maxCol) {
maxCol = col;
}
if (row < minRow) {
minRow = row;
}
if (row > maxRow) {
maxRow = row;
}
newEnvelope.expandToInclude(dest.getCoordinate());
}
}
}
double scale = StrictMath.min((maxCol - minCol) / newEnvelope.getWidth(),
(maxRow - minRow) / newEnvelope.getHeight());
_dimensions = new GridDimensions(new Dimension((int)(scale * newEnvelope.getWidth()),
(int)(scale * newEnvelope.getHeight())),
newEnvelope);
ColorModel srcCM = new ValueColorModel(raster);
BufferedImage img = new BufferedImage(srcCM, raster, false, null);
RenderedImage dstImage = RasterUtils.reproject(img,
srcDimensions,
srcProj,
_dimensions,
dstProj,
factory,
new double[] { Double.NaN });
_raster = (WritableRaster)dstImage.getData();
_interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
_interpArray = new double[_interpolation.getHeight()][_interpolation.getWidth()];
GISExtension.getState().datasetLoadNotify();
}
开发者ID:reuven,项目名称:modelingcommons,代码行数:56,代码来源:RasterDataset.java
注:本文中的com.vividsolutions.jts.geom.util.GeometryTransformer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论