${core_FeatureMouseEventArgs_Title}
${core_FeatureMouseEventArgs_Description}
private void virtualLayer_MouseMove(object sender , FeatureMouseEventArgs args) { Feature hoverFeature = args.Feature; //在虚拟线上,并且没遇到虚拟顶点 ,显示捕捉点 if (draggingVertex == null && hoverFeature.Geometry is GeoLine) { GeoLine line = hoverFeature.Geometry as GeoLine; Point2D pMap = Map.ScreenToMap(args.GetPosition(Map)); Point2D snap = FindPointOnLineClosestToPoint(line.Parts[0][0] , line.Parts[0][1] , pMap); if (snapVertex == null) { snapVertex = new Feature() { Style = SnapStyle , Geometry = new GeoPoint(snap) }; hoverLayer.Features.Add(snapVertex); } else { snapVertex.Geometry = new GeoPoint(snap); } } }
private void virtualLayer_MouseLeave(object sender , FeatureMouseEventArgs args) { if (snapVertex != null) { hoverLayer.Features.Remove(snapVertex); snapVertex = null; } }