Intersection queries problem

Topics: SharpMap Project
Jan 30, 2013 at 6:51 AM
Edited Feb 1, 2013 at 1:32 AM
Hello, I use MapQueried this event can only inquires the a layer, in order to realize function, the accuracy is not accurate, sometimes mouse click can highlight displays the selected elements, sometimes not click on the layer, but the line segment or highlighting chosen, the following is my inquires the part of the code, I hope you can help me.
private void MapImage1_MapQueried(SharpMap.Data.FeatureDataTable data)
{
try {
    SharpMap.Data.FeatureDataSet featureDataSet = new SharpMap.Data.FeatureDataSet();
    SharpMap.Geometries.Point pointmap = MapImage1.Map.ImageToWorld(new System.Drawing.Point());
    if (LayerMap1 == null) {
        return;
    }
    if (!LayerMap1.DataSource.IsOpen) {
        LayerMap1.DataSource.Open();
    }
    LayerMap1.DataSource.ExecuteIntersectionQuery(pointmap.GetBoundingBox(), featureDataSet);
    if (featureDataSet == null) {
        return;
    }
    SharpMap.Data.FeatureDataTable featureDataTable = data;
    if (featureDataTable == null) {
        return;
    }
    //把选中要素添加到选择图层,高亮显示
    selectedLyr.DataSource = new SharpMap.Data.Providers.GeometryProvider(featureDataTable(0));
    FeaturesDataGridView.Visible = true;
    FeaturesDataGridView.DataSource = data;
    selectedLyr.Style.EnableOutline = true;
    selectedLyr.Style.Outline = new Pen(Color.Red, 5);
    selectedLyr.Style.Line = Pens.Red;
    MapImage1.Map.Layers.Add(selectedLyr);
    MapImage1.Refresh();
    LayerMap1.DataSource.Close();
} catch (Exception ex) {
}
}
Feb 1, 2013 at 1:40 AM
Hello, my English is not very good, a few days ago to write article page automatic translation into Chinese, if you click on the function of this problem has good advice, please contact me.

Yes, I have a question, I found that sometimes no mouse did not click on the layer, but was chosen this layer of a line segment, I try to judge whether the mouse click on the layer, but did not do it, do you have any good Suggestions? thank you