你这是用的SuperMap iObject .NET吗?
你这里需要循环地图的所有图层对应的数据 Layer.Dataset ,每个图层都进行点查询,参考代码如下:
mapControl.MouseDoubleClick +=FrmMain_MouseDoubleClick;
void FrmMain_MouseDoubleClick(object sender, MouseEventArgs e)
{
try
{
//生成缓冲区
Point2D point2d = mapControl.Map.PixelToMap(new Point(e.X, e.Y));
GeoPoint geopoint = new GeoPoint(point2d.X, point2d.Y);
BufferAnalystParameter bufferAnalystParameter = new BufferAnalystParameter();
bufferAnalystParameter.EndType = BufferEndType.Round;
bufferAnalystParameter.LeftDistance = 6;
bufferAnalystParameter.RadiusUnit = BufferRadiusUnit.Meter;
bufferAnalystParameter.SemicircleLineSegment = 4;
GeoRegion geoRegion = BufferAnalystGeometry.CreateBuffer(geopoint, bufferAnalystParameter);
mapControl.Map.TrackingLayer.Add(geoRegion, "Region");
mapControl.Map.RefreshTrackingLayer();
//设置查询参数
QueryParameter parameter = new QueryParameter();
parameter.SpatialQueryObject = geoRegion;
parameter.SpatialQueryMode = SuperMap.Data.SpatialQueryMode.Intersect; ;
//对指定查询的图层进行查询
Layer layer = mapControl.Map.Layers[0];
DatasetVector dataset = layer.Dataset as DatasetVector;
Recordset recordset = dataset.Query(parameter);
recordset.MoveFirst();
while ( !recordset.IsEOF)
{
recordset.MoveNext();
}
}
catch (Exception ex)
{
}
}