本文整理汇总了Java中com.esri.core.geometry.GeometryEngine.geometryToEsriShape方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryEngine.geometryToEsriShape方法的具体用法?Java GeometryEngine.geometryToEsriShape怎么用?Java GeometryEngine.geometryToEsriShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.GeometryEngine
的用法示例。
在下文中一共展示了GeometryEngine.geometryToEsriShape方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public BytesWritable evaluate(BytesWritable geomref) {
if (geomref == null || geomref.getLength() == 0){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
try {
// Get Esri shape representation
Geometry esriGeometry = ogcGeometry.getEsriGeometry();
byte[] esriShape = GeometryEngine.geometryToEsriShape(esriGeometry);
return new BytesWritable(esriShape);
} catch (Exception e){
LOG.error(e.getMessage());
return null;
}
}
示例2: testGeomFromPointShapeWithoutSpatialReference
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPointShapeWithoutSpatialReference() throws UDFArgumentException {
Point point = createFirstLocation();
byte[] esriShape = GeometryEngine.geometryToEsriShape(point);
assertNotNull("The shape must not be null!", esriShape);
BytesWritable shapeAsWritable = new BytesWritable(esriShape);
assertNotNull("The shape writable must not be null!", shapeAsWritable);
ST_GeomFromShape fromShape = new ST_GeomFromShape();
BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable);
assertNotNull("The geometry writable must not be null!", geometryAsWritable);
final int wkid = 0;
validatePoint(point, wkid, geometryAsWritable);
}
示例3: testGeomFromPointShape
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPointShape() throws UDFArgumentException {
Point point = createFirstLocation();
byte[] esriShape = GeometryEngine.geometryToEsriShape(point);
assertNotNull("The shape must not be null!", esriShape);
BytesWritable shapeAsWritable = new BytesWritable(esriShape);
assertNotNull("The shape writable must not be null!", shapeAsWritable);
final int wkid = 4326;
ST_GeomFromShape fromShape = new ST_GeomFromShape();
BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
assertNotNull("The geometry writable must not be null!", geometryAsWritable);
validatePoint(point, wkid, geometryAsWritable);
}
示例4: testGeomFromLineShape
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromLineShape() throws UDFArgumentException {
Polyline line = createLine();
byte[] esriShape = GeometryEngine.geometryToEsriShape(line);
assertNotNull("The shape must not be null!", esriShape);
BytesWritable shapeAsWritable = new BytesWritable(esriShape);
assertNotNull("The shape writable must not be null!", shapeAsWritable);
final int wkid = 4326;
ST_GeomFromShape fromShape = new ST_GeomFromShape();
BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
assertNotNull("The geometry writable must not be null!", geometryAsWritable);
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geometryAsWritable);
assertNotNull("The OGC geometry must not be null!", ogcGeometry);
Geometry esriGeometry = ogcGeometry.getEsriGeometry();
assertNotNull("The Esri geometry must not be null!", esriGeometry);
assertTrue("The geometries are different!",
GeometryEngine.equals(line, esriGeometry, SpatialReference.create(wkid)));
}
示例5: testGeomFromPolylineShape
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPolylineShape() throws UDFArgumentException {
Polyline line = createPolyline();
byte[] esriShape = GeometryEngine.geometryToEsriShape(line);
assertNotNull("The shape must not be null!", esriShape);
BytesWritable shapeAsWritable = new BytesWritable(esriShape);
assertNotNull("The shape writable must not be null!", shapeAsWritable);
final int wkid = 4326;
ST_GeomFromShape fromShape = new ST_GeomFromShape();
BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
assertNotNull("The geometry writable must not be null!", geometryAsWritable);
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geometryAsWritable);
assertNotNull("The OGC geometry must not be null!", ogcGeometry);
Geometry esriGeometry = ogcGeometry.getEsriGeometry();
assertNotNull("The Esri geometry must not be null!", esriGeometry);
assertTrue("The geometries are different!",
GeometryEngine.equals(line, esriGeometry, SpatialReference.create(wkid)));
}
示例6: testGeomFromPolygonShape
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomFromPolygonShape() throws UDFArgumentException {
Polygon polygon = createPolygon();
byte[] esriShape = GeometryEngine.geometryToEsriShape(polygon);
assertNotNull("The shape must not be null!", esriShape);
BytesWritable shapeAsWritable = new BytesWritable(esriShape);
assertNotNull("The shape writable must not be null!", shapeAsWritable);
final int wkid = 4326;
ST_GeomFromShape fromShape = new ST_GeomFromShape();
BytesWritable geometryAsWritable = fromShape.evaluate(shapeAsWritable, wkid);
assertNotNull("The geometry writable must not be null!", geometryAsWritable);
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geometryAsWritable);
assertNotNull("The OGC geometry must not be null!", ogcGeometry);
Geometry esriGeometry = ogcGeometry.getEsriGeometry();
assertNotNull("The Esri geometry must not be null!", esriGeometry);
assertTrue("The geometries are different!",
GeometryEngine.equals(polygon, esriGeometry, SpatialReference.create(wkid)));
}
示例7: testGeomEngine
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
@Test
public void testGeomEngine()
{
final Envelope orig = new Envelope(0, 0, 10, 10);
final byte[] bytes = GeometryEngine.geometryToEsriShape(orig);
Assert.assertNotNull(bytes);
final Geometry geometry = GeometryEngine.geometryFromEsriShape(bytes, Geometry.Type.Envelope);
Assert.assertNotNull(geometry);
Assert.assertTrue(geometry instanceof Envelope);
final Envelope dest = (Envelope) geometry;
Assert.assertEquals(0, dest.getXMin(), 0.001);
Assert.assertEquals(0, dest.getYMin(), 0.001);
Assert.assertEquals(10, dest.getXMax(), 0.001);
Assert.assertEquals(10, dest.getYMax(), 0.001);
}