本文整理汇总了Java中com.esri.core.geometry.ogc.OGCGeometry.intersection方法的典型用法代码示例。如果您正苦于以下问题:Java OGCGeometry.intersection方法的具体用法?Java OGCGeometry.intersection怎么用?Java OGCGeometry.intersection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.ogc.OGCGeometry
的用法示例。
在下文中一共展示了OGCGeometry.intersection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
public BytesWritable evaluate(BytesWritable geometryref1, BytesWritable geometryref2)
{
if (geometryref1 == null || geometryref2 == null ||
geometryref1.getLength() == 0 || geometryref2.getLength() == 0) {
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
if (!GeometryUtils.compareSpatialReferences(geometryref1, geometryref2)) {
LogUtils.Log_SRIDMismatch(LOG, geometryref1, geometryref2);
return null;
}
OGCGeometry ogcGeom1 = GeometryUtils.geometryFromEsriShape(geometryref1);
OGCGeometry ogcGeom2 = GeometryUtils.geometryFromEsriShape(geometryref2);
if (ogcGeom1 == null || ogcGeom2 == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
OGCGeometry commonGeom;
try {
commonGeom = ogcGeom1.intersection(ogcGeom2);
return GeometryUtils.geometryToEsriShapeBytesWritable(commonGeom);
} catch (Exception e) {
LogUtils.Log_InternalError(LOG, "ST_Intersection: " + e);
return null;
}
}
示例2: testIntersection
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIntersection() {
OGCGeometry g = OGCGeometry.fromText("LINESTRING(0 0, 10 10)");
OGCGeometry g2 = OGCGeometry.fromText("LINESTRING(10 0, 0 10)");
OGCGeometry u = g.intersection(g2);
assertTrue(u.dimension() == 0);
String s = u.asText();
assertTrue(u.equals(OGCGeometry.fromText("POINT(5 5)")));
}
示例3: testIsectPoint
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectPoint() {
String wkt = "point (0 0)";
String wk2 = "point (0 0)";
OGCGeometry g0 = OGCGeometry.fromText(wkt);
OGCGeometry g1 = OGCGeometry.fromText(wk2);
g0.setSpatialReference(null);
g1.setSpatialReference(null);
try {
OGCGeometry rslt = g0.intersection(g1); // ArrayIndexOutOfBoundsException
assertTrue(rslt != null);
} catch (Exception e) {
assertTrue(false);
}
}
示例4: testIsectDisjoint
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectDisjoint() {
String wk3 = "linestring (0 0, 1 1)";
String wk4 = "linestring (2 2, 4 4)";
OGCGeometry g0 = OGCGeometry.fromText(wk3);
OGCGeometry g1 = OGCGeometry.fromText(wk4);
g0.setSpatialReference(null);
g1.setSpatialReference(null);
try {
OGCGeometry rslt = g0.intersection(g1); // null
assertTrue(rslt != null);
} catch (Exception e) {
assertTrue(false);
}
}
示例5: testIsectTria1
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectTria1() {
String wkt = "polygon((1 0, 3 0, 1 2, 1 0))";
String wk2 = "polygon((0 1, 2 1, 0 3, 0 1))";
OGCGeometry g0 = OGCGeometry.fromText(wkt);
OGCGeometry g1 = OGCGeometry.fromText(wk2);
g0.setSpatialReference(SpatialReference.create(4326));
g1.setSpatialReference(SpatialReference.create(4326));
OGCGeometry rslt = g0.intersection(g1);
assertTrue(rslt != null);
assertTrue(rslt.geometryType().equals("Polygon"));
assertTrue(rslt.esriSR.getID() == 4326);
String s = rslt.asText();
}
示例6: testIsectTriaJson1
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectTriaJson1() throws Exception {
String json1 = "{\"rings\":[[[1, 0], [3, 0], [1, 2], [1, 0]]], \"spatialReference\":{\"wkid\":4326}}";
String json2 = "{\"rings\":[[[0, 1], [2, 1], [0, 3], [0, 1]]], \"spatialReference\":{\"wkid\":4326}}";
OGCGeometry g0 = OGCGeometry.fromJson(json1);
OGCGeometry g1 = OGCGeometry.fromJson(json2);
OGCGeometry rslt = g0.intersection(g1);
assertTrue(rslt != null);
assertTrue(rslt.geometryType().equals("Polygon"));
assertTrue(rslt.esriSR.getID() == 4326);
String s = GeometryEngine.geometryToJson(rslt.getEsriSpatialReference().getID(), rslt.getEsriGeometry());
}
示例7: testIsectTria2
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectTria2() {
String wkt = "polygon((1 0, 3 0, 1 2, 1 0))";
String wk2 = "polygon((0 3, 2 1, 3 1, 0 3))";
OGCGeometry g0 = OGCGeometry.fromText(wkt);
OGCGeometry g1 = OGCGeometry.fromText(wk2);
g0.setSpatialReference(null);
g1.setSpatialReference(null);
OGCGeometry rslt = g0.intersection(g1);
assertTrue(rslt != null);
assertTrue(rslt.dimension() == 1);
assertTrue(rslt.geometryType().equals("LineString"));
String s = rslt.asText();
}
示例8: testIsectTria3
import com.esri.core.geometry.ogc.OGCGeometry; //导入方法依赖的package包/类
@Test
public void testIsectTria3() {
String wkt = "polygon((1 0, 3 0, 1 2, 1 0))";
String wk2 = "polygon((2 2, 2 1, 3 1, 2 2))";
OGCGeometry g0 = OGCGeometry.fromText(wkt);
OGCGeometry g1 = OGCGeometry.fromText(wk2);
g0.setSpatialReference(SpatialReference.create(4326));
g1.setSpatialReference(SpatialReference.create(4326));
OGCGeometry rslt = g0.intersection(g1);
assertTrue(rslt != null);
assertTrue(rslt.dimension() == 0);
assertTrue(rslt.geometryType().equals("Point"));
assertTrue(rslt.esriSR.getID() == 4326);
String s = rslt.asText();
}