public GetPosition ( |
||
relativeTo | ${WP_core_FeatureMouseEventArgs_method_getPosition_param_relativeTo} | |
Résultat | Point |
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); } } }