Beispiel #1
0
 private static Esri.ArcGISRuntime.Geometry.Geometry ReadGeometryMultiLineString(Microsoft.SqlServer.Types.SqlGeometry mline, Esri.ArcGISRuntime.Geometry.SpatialReference sr)
 {
     return(new Esri.ArcGISRuntime.Geometry.Polyline(
                Utilities.CountEnumerator(mline.STNumGeometries().Value)
                .Select(i => mline.STGeometryN(i))
                .SelectMany(line => Utilities.CountEnumerator(line.STNumPoints().Value)
                            .Select(i => line.STPointN(i))
                            .Select(p => ReadGeometryPoint(p, sr)))));
 }
Beispiel #2
0
        private static Esri.ArcGISRuntime.Geometry.Geometry ReadGeometryMultiPolygon(Microsoft.SqlServer.Types.SqlGeometry mpoly, Esri.ArcGISRuntime.Geometry.SpatialReference sr)
        {
            var rings = new List <IEnumerable <Esri.ArcGISRuntime.Geometry.MapPoint> >();

            for (int j = 0; j < mpoly.STNumGeometries().Value; j++)
            {
                var poly      = mpoly.STGeometryN(j);
                var outerRing = Utilities.CountEnumerator(poly.STExteriorRing().STNumPoints().Value)
                                .Select(i => poly.STExteriorRing().STPointN(i))
                                .Select(p => ReadGeometryPoint(p, sr));
                rings.AddRange(rings);
                var innerRings = Utilities.CountEnumerator(poly.STNumInteriorRing().Value)
                                 .Select(i => poly.STInteriorRingN(i))
                                 .Select(t => Utilities.CountEnumerator(t.STNumPoints().Value)
                                         .Select(r => t.STPointN(r))
                                         .Select(p => ReadGeometryPoint(p, sr)));
                rings.AddRange(innerRings);
            }

            return(new Esri.ArcGISRuntime.Geometry.Polygon(rings));
        }