當前位置: 首頁>>代碼示例>>Java>>正文


Java OGCMultiLineString類代碼示例

本文整理匯總了Java中com.esri.core.geometry.ogc.OGCMultiLineString的典型用法代碼示例。如果您正苦於以下問題:Java OGCMultiLineString類的具體用法?Java OGCMultiLineString怎麽用?Java OGCMultiLineString使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OGCMultiLineString類屬於com.esri.core.geometry.ogc包,在下文中一共展示了OGCMultiLineString類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: evaluate

import com.esri.core.geometry.ogc.OGCMultiLineString; //導入依賴的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 {
		OGCGeometry boundGeom = ogcGeometry.boundary();
		if (boundGeom.geometryType().equals("MultiLineString") && ((OGCMultiLineString)boundGeom).numGeometries() == 1)
			boundGeom = ((OGCMultiLineString)boundGeom).geometryN(0);  // match ST_Boundary/SQL-RDBMS
		return GeometryUtils.geometryToEsriShapeBytesWritable(boundGeom);
	} catch (Exception e) {
		LogUtils.Log_InternalError(LOG, "ST_Boundary: " + e);
		return null;
	}
}
 
開發者ID:Esri,項目名稱:spatial-framework-for-hadoop,代碼行數:22,代碼來源:ST_Boundary.java

示例2: testPolylineSimplifyIssueGithub52

import com.esri.core.geometry.ogc.OGCMultiLineString; //導入依賴的package包/類
@Test
public void testPolylineSimplifyIssueGithub52() throws Exception {
	String json = "{\"paths\":[[[2,0],[4,3],[5,1],[3.25,1.875],[1,3]]],\"spatialReference\":{\"wkid\":4326}}";
	{
		OGCGeometry g = OGCGeometry.fromJson(json);
		assertTrue(g.geometryType().equals("LineString"));
		OGCGeometry simpleG = g.makeSimple();//make ogc simple
		assertTrue(simpleG.geometryType().equals("MultiLineString"));			
		assertTrue(simpleG.isSimpleRelaxed());//geodatabase simple
		assertTrue(simpleG.isSimple());//ogc simple
		OGCMultiLineString mls =(OGCMultiLineString)simpleG;
		assertTrue(mls.numGeometries() == 4);
		OGCGeometry baseGeom = OGCGeometry.fromJson("{\"paths\":[[[2,0],[3.25,1.875]],[[3.25,1.875],[4,3],[5,1]],[[5,1],[3.25,1.875]],[[3.25,1.875],[1,3]]],\"spatialReference\":{\"wkid\":4326}}");
		assertTrue(simpleG.equals(baseGeom));
		
	}
}
 
開發者ID:Esri,項目名稱:geometry-api-java,代碼行數:18,代碼來源:TestOGC.java

示例3: evaluate

import com.esri.core.geometry.ogc.OGCMultiLineString; //導入依賴的package包/類
public IntWritable 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 {
		GeometryUtils.OGCType ogcType = GeometryUtils.getType(geomref);
		switch(ogcType) {
		case ST_POINT:
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTIPOINT, ogcType);
			return null;
		case ST_LINESTRING:
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTILINESTRING, ogcType);
			return null;
		case ST_POLYGON:
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTIPOLYGON, ogcType);
			return null;
		case ST_MULTIPOINT:
			resultInt.set(((OGCMultiPoint)ogcGeometry).numGeometries());
			break;
		case ST_MULTILINESTRING:
			resultInt.set(((OGCMultiLineString)ogcGeometry).numGeometries());
			break;
		case ST_MULTIPOLYGON:
			resultInt.set(((OGCMultiPolygon)ogcGeometry).numGeometries());
			break;
		}
	} catch (ClassCastException cce) {  // single vs Multi geometry type
		resultInt.set(1);
	} catch (Exception e) {
		LogUtils.Log_InternalError(LOG, "ST_NumGeometries: " + e);
		return null;
	}
	return resultInt;
}
 
開發者ID:Esri,項目名稱:spatial-framework-for-hadoop,代碼行數:43,代碼來源:ST_NumGeometries.java

示例4: evaluate

import com.esri.core.geometry.ogc.OGCMultiLineString; //導入依賴的package包/類
public BytesWritable evaluate(BytesWritable geomref, IntWritable index) {
	if (geomref == null || geomref.getLength() == 0 || index == null) {
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

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

	int idx = index.get() - 1;  // 1-based UI, 0-based engine
	try {
		GeometryUtils.OGCType ogcType = GeometryUtils.getType(geomref);
		OGCGeometry ogcGeom = null;
		switch(ogcType) {
		case ST_POINT:
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTIPOINT, ogcType);
			return null;
		case ST_LINESTRING:
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTILINESTRING, ogcType);
			return null;
		case ST_POLYGON:
			LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_MULTIPOLYGON, ogcType);
			return null;
		case ST_MULTIPOINT:
			ogcGeom = ((OGCMultiPoint)ogcGeometry).geometryN(idx);
			break;
		case ST_MULTILINESTRING:
			ogcGeom = ((OGCMultiLineString)ogcGeometry).geometryN(idx);
			break;
		case ST_MULTIPOLYGON:
			ogcGeom = ((OGCMultiPolygon)ogcGeometry).geometryN(idx);
			break;
		}
		return GeometryUtils.geometryToEsriShapeBytesWritable(ogcGeom);
	} catch (Exception e) {
		LogUtils.Log_InternalError(LOG, "ST_GeometryN: " + e);
		return null;
	}
}
 
開發者ID:Esri,項目名稱:spatial-framework-for-hadoop,代碼行數:43,代碼來源:ST_GeometryN.java


注:本文中的com.esri.core.geometry.ogc.OGCMultiLineString類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。