我试图在 mousemove 事件上使用 ShowCalloutAt API 函数在弹出窗口中显示选定的功能信息。使用以下代码:
public class TestMouseMove
{
public TestMouseMove(MapView mapView)
{
mapView.MouseMove+=MouseMove_Event;
}
private void MouseMove_Event(object sender, MouseEventArgs e)
{
var screenPoint = new MapPoint (e.Location.X, e.Location.Y,
EsriMapView.SpatialReference);
var mapPoint = (MapPoint)GeometryEngine.Project (screenPoint, SpatialReferences.Wgs84);
Feature selectedFeature=null;
//I have written logic to Filter and take the single feature of top layer under mouse pointer
selectedFeature=GetFeatureUnderMousePointer();
//Now I am calling callout at the selected point using below code
CalloutDefinition myCalloutDefinition = new CalloutDefinition("Testing message");
// Display the callout
MyMapView.ShowCalloutAt(mapPoint , myCalloutDefinition);
}
private GetFeatureUnderMousePointer()
{
//Logic to filter and ge feature under mouse pointer
}
}
但是,如果我在多边形特征内移动鼠标指针,则 ShowCAllout 弹出窗口会在 mousemove 上多次出现。结果,弹出窗口看起来像是在闪烁。那么,有没有更好的方法来实现类似 on mousemovestop 事件?
或对解决此问题的任何建议表示赞赏。
提前致谢。