Exemplo n.º 1
0
 public void GotoFeature(Feature fet)
 {
     if (fet == null)
     {
         return;
     }
     //锁住的目的是为了避免在定位过程中系统进行地理坐标向投影坐标的转换
     lock (fet)
     {
         ShapePoint pt = fet.Geometry.Centroid.Clone() as ShapePoint;
         if ((fet.Projected && fet.FeatureClass.OriginalCoordinateType == enumCoordinateType.Geographic) ||
             fet.FeatureClass.OriginalCoordinateType == enumCoordinateType.Projection)
         {
             CoordinateTransfrom.PrjCoord2GeoCoord(new ShapePoint[] { pt });
         }
         ShapePoint pt0 = pt.Clone() as ShapePoint;
         PanTo(pt);
         ReRender(delegate()
         {
             CoordinateTransfrom.GeoCoord2PrjCoord(new ShapePoint[] { pt0 });
             _vectorMapRuntime.LocatingFocusLayer.Focus(pt, 6, 500);
         }
                  );
     }
 }
Exemplo n.º 2
0
 void MapControl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.Control && e.Shift && e.KeyCode == Keys.L)
     {
         Point[] pts = new Point[] { PointToClient(Control.MousePosition) };
         CoordinateTransfrom.PixelCoord2PrjCoord(pts);
         PointF[] ptfs = new PointF[] { new PointF(pts[0].X, pts[0].Y) };
         CoordinateTransfrom.PrjCoord2GeoCoord(ptfs);
         Clipboard.SetText(ptfs[0].X.ToString("0.####") + " " + ptfs[0].Y.ToString("0.####"));
     }
 }