当前位置: 首页>>代码示例>>Java>>正文


Java MultiPath.getPathCount方法代码示例

本文整理汇总了Java中com.esri.core.geometry.MultiPath.getPathCount方法的典型用法代码示例。如果您正苦于以下问题:Java MultiPath.getPathCount方法的具体用法?Java MultiPath.getPathCount怎么用?Java MultiPath.getPathCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esri.core.geometry.MultiPath的用法示例。


在下文中一共展示了MultiPath.getPathCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import com.esri.core.geometry.MultiPath; //导入方法依赖的package包/类
public BooleanWritable 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 {

		switch(GeometryUtils.getType(geomref)) {
		case ST_LINESTRING:
		case ST_MULTILINESTRING:
			MultiPath lines = (MultiPath)(ogcGeometry.getEsriGeometry());
			int nPaths = lines.getPathCount();
			boolean rslt = true;
			for (int ix = 0; rslt && ix < nPaths; ix++) {
				Point p0 = lines.getPoint(lines.getPathStart(ix));
				Point pf = lines.getPoint(lines.getPathEnd(ix)-1);
				rslt = rslt && pf.equals(p0);  // no tolerance - OGC
			}
			resultBoolean.set(rslt);
			return resultBoolean;
		default:  // ST_IsClosed gives ERROR on Point or Polygon, on Postgres/Oracle
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_LINESTRING, GeometryUtils.getType(geomref));
			return null;
		}

	} catch (Exception e) {
	    LogUtils.Log_InternalError(LOG, "ST_IsClosed" + e);
		return null;
	}

}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:39,代码来源:ST_IsClosed.java

示例2: isClosed

import com.esri.core.geometry.MultiPath; //导入方法依赖的package包/类
public boolean isClosed() {
	MultiPath mp = (MultiPath) getEsriGeometry();
	for (int i = 0, n = mp.getPathCount(); i < n; i++) {
		if (!mp.isClosedPathInXYPlane(i))
			return false;
	}

	return true;
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:10,代码来源:OGCMultiCurve.java

示例3: evaluate

import com.esri.core.geometry.MultiPath; //导入方法依赖的package包/类
public DoubleWritable evaluate(BytesWritable geomref) {
	if (geomref == null || geomref.getLength() == 0) {
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	int WGS84 = 4326;
	if (GeometryUtils.getWKID(geomref) != WGS84) {
	    LogUtils.Log_SRIDMismatch(LOG, geomref, WGS84);
		return null;
	}

	OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
	if (ogcGeometry == null){
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	Geometry esriGeom = ogcGeometry.getEsriGeometry();
	switch(esriGeom.getType()) {
	case Point:
	case MultiPoint:
		resultDouble.set(0.);
		break;
	default:
		MultiPath lines = (MultiPath)(esriGeom);
		int nPath = lines.getPathCount();
		double length = 0.;
		for (int ix = 0; ix < nPath; ix++) {
			int curPt = lines.getPathStart(ix);
			int pastPt = lines.getPathEnd(ix);
			Point fromPt = lines.getPoint(curPt);
			Point toPt = null;
			for (int vx = curPt+1; vx < pastPt; vx++) {
				toPt = lines.getPoint(vx);
				length += GeometryEngine.geodesicDistanceOnWGS84(fromPt, toPt);
				fromPt = toPt;
			}
		}
		resultDouble.set(length);
		break;
	}

	return resultDouble;
}
 
开发者ID:Esri,项目名称:spatial-framework-for-hadoop,代码行数:46,代码来源:ST_GeodesicLengthWGS84.java

示例4: numGeometries

import com.esri.core.geometry.MultiPath; //导入方法依赖的package包/类
public int numGeometries() {
	MultiPath mp = (MultiPath) getEsriGeometry();
	return mp.getPathCount();
}
 
开发者ID:Esri,项目名称:geometry-api-java,代码行数:5,代码来源:OGCMultiCurve.java


注:本文中的com.esri.core.geometry.MultiPath.getPathCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。