本文整理汇总了Java中com.esri.core.geometry.GeometryEngine.convexHull方法的典型用法代码示例。如果您正苦于以下问题:Java GeometryEngine.convexHull方法的具体用法?Java GeometryEngine.convexHull怎么用?Java GeometryEngine.convexHull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.esri.core.geometry.GeometryEngine
的用法示例。
在下文中一共展示了GeometryEngine.convexHull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeAggregateBuffer
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
private void maybeAggregateBuffer(boolean force) throws HiveException {
if (force || geometries.size() > MAX_BUFFER_SIZE){
Geometry[] geomArray = new Geometry[geometries.size()];
geometries.toArray(geomArray);
geometries.clear();
try {
//LOG.trace("performing convexHull");
Geometry[] convexResult = GeometryEngine.convexHull(geomArray, true);
Collections.addAll(geometries, convexResult); // expect one
} catch (Exception e) {
LOG.error("exception thrown", e);
}
}
}
示例2: evaluate
import com.esri.core.geometry.GeometryEngine; //导入方法依赖的package包/类
public BytesWritable evaluate (BytesWritable ... geomrefs){
// validate arguments
if (geomrefs == null || geomrefs.length < 1){
// LogUtils.Log_VariableArgumentLength(LOG);
return null;
}
int firstWKID = 0;
// validate spatial references and geometries first
for (int i=0;i<geomrefs.length; i++){
BytesWritable geomref = geomrefs[i];
if (geomref == null || geomref.getLength() == 0){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
if (i==0){
firstWKID = GeometryUtils.getWKID(geomref);
} else if (firstWKID != GeometryUtils.getWKID(geomref)){
LogUtils.Log_SRIDMismatch(LOG, geomrefs[0], geomref);
return null;
}
}
// now build geometry array to pass to GeometryEngine.union
Geometry [] geomsToProcess = new Geometry[geomrefs.length];
for (int i=0;i<geomrefs.length;i++){
//HiveGeometry hiveGeometry = GeometryUtils.geometryFromEsriShape(geomrefs[i]);
OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomrefs[i]);
if (ogcGeometry == null){
LogUtils.Log_ArgumentsNull(LOG);
return null;
}
geomsToProcess[i] = ogcGeometry.getEsriGeometry();
}
try {
Geometry [] geomResult = GeometryEngine.convexHull(geomsToProcess, true);
if (geomResult.length != 1){
return null;
}
Geometry merged = geomResult[0];
// we have to infer the type of the differenced geometry because we don't know
// if it's going to end up as a single or multi-part geometry
OGCType inferredType = GeometryUtils.getInferredOGCType(merged);
return GeometryUtils.geometryToEsriShapeBytesWritable(merged, firstWKID, inferredType);
} catch (Exception e){
LogUtils.Log_ExceptionThrown(LOG, "GeometryEngine.convexHull", e);
return null;
}
}