private void TryConvertGeoCoord2PrjCoord(Feature fet) { /* * 1.调用地图服务中的坐标转换接口进行地理坐标到投影坐标的转换 * 2.在异步转换事件中,生成XamlObject,往画布中添加 */ GeoShape geometry = fet.Geometry; if (fet.Geometry == null) { return; } IProjectableArguments arguments = fet.Geometry as IProjectableArguments; if (arguments == null) { throw new NotImplementedException("几何类型\"" + geometry.GetType().ToString() + "\"未实现IProjectableArguments,无法进行投影转换。"); } // if ((arguments.Points == null && arguments.Points.Length == 0) && (arguments.SingleValues == null && arguments.SingleValues.Length == 0)) { return; } List <AgileMapServiceProxy.PointF> points = new List <AgileMapServiceProxy.PointF>(); if (arguments.Points != null) { foreach (GeoPoint pt in arguments.Points) { AgileMapServiceProxy.PointF ptf = new AgileMapServiceProxy.PointF(); ptf.x = (float)pt.X; ptf.y = (float)pt.Y; points.Add(ptf); } } int valueCount = 0; if (arguments.SingleValues != null) { valueCount = arguments.SingleValues.Length; foreach (double v in arguments.SingleValues) { AgileMapServiceProxy.PointF ptf = new AgileMapServiceProxy.PointF(); ptf.x = (float)v; ptf.y = 0; points.Add(ptf); } } // _map.ServerAgent.MapServiceClient.Geo2PrjAsync(new ObservableCollection <AgileMapServiceProxy.PointF>(points), new FeatureUserState(fet, Id)); }
public Shape ToShape() { if (_geometry == null) { return(null); } if (_geometry is GeoPoint) { Path pthPoint = new Path(); pthPoint.Data = _geometry.ToGeometry(); return(pthPoint); } else if (_geometry is GeoPolyline) { Path pthPolyline = new Path(); pthPolyline.Data = _geometry.ToGeometry(); return(pthPolyline); } else if (_geometry is GeoPolygon) { Path pthPolygon = new Path(); pthPolygon.Data = _geometry.ToGeometry(); return(pthPolygon); } else if (_geometry is GeoPieArea) { Path pthPolygon = new Path(); pthPolygon.Data = _geometry.ToGeometry(); return(pthPolygon); } else if (_geometry is GeoRectangle) { Path pthPolygon = new Path(); pthPolygon.Data = _geometry.ToGeometry(); return(pthPolygon); } else if (_geometry is GeoEllipse) { Path pthPolygon = new Path(); pthPolygon.Data = _geometry.ToGeometry(); return(pthPolygon); } throw new Exception("不支持直接渲染几何类型\"" + _geometry.GetType().ToString() + "\""); }