DatasetVector dataset = (DatasetVector) m_MapControl.getMap().getLayers().get("kml@kml#1").getDataset();
//获取记录集
//false表示获取的是数据中所有的记录集,true表示获取与数据集关联的记录集但是没有数据
//record count 968
Recordset recordset = dataset.getRecordset(false, CursorType.DYNAMIC);
while(recordset.moveNext()){
//记录集操作
Geometry geometry = recordset.getGeometry();
if(geometry == null)
{
continue;
}
GeometryType type = geometry.getType();
if(type == GeometryType.GEOPOINT3D || type == GeometryType.GEOPOINT)
{
String stationName = (String) recordset.getFieldValue("Name");//属性表 有个表头,你知道表头了你就知道哪一列了,自然可以通过每一行recordset获取具体那个数据
if( stationName == null||stationName.isEmpty())
{
continue;
}
Point2D innerPoint = ((GeoPoint)geometry).getInnerPoint();
}else if(type == GeometryType.GEOLINE3D || type == GeometryType.GEOLINE)
{
GeoLine tmpLine = (GeoLine) geometry;
}
}
望采纳