예제 #1
0
        private static Microsoft.SqlServer.Types.SqlGeometry CreateGeometryPoint(Esri.ArcGISRuntime.Geometry.MapPoint p, int cs)
        {
            if (!p.HasZ && !p.HasM)
            {
                return(Microsoft.SqlServer.Types.SqlGeometry.Point(p.X, p.Y, cs));
            }

            var b = new Microsoft.SqlServer.Types.SqlGeometryBuilder();

            b.SetSrid(cs);
            b.BeginGeometry(Microsoft.SqlServer.Types.OpenGisGeometryType.Point);
            b.BeginFigure(p.X, p.Y, p.HasZ ? (double?)p.Z : null,
                          p.HasM ? (double?)p.M : null);
            b.EndFigure();
            b.EndGeometry();
            return(b.ConstructedGeometry);
        }
예제 #2
0
        private static Microsoft.SqlServer.Types.SqlGeometry CreateGeometryMultipoint(Esri.ArcGISRuntime.Geometry.Multipoint multipoint, int cs)
        {
            var b = new Microsoft.SqlServer.Types.SqlGeometryBuilder();

            b.SetSrid(cs);
            b.BeginGeometry(Microsoft.SqlServer.Types.OpenGisGeometryType.MultiPoint);

            foreach (var p in multipoint.Points)
            {
                b.BeginGeometry(Microsoft.SqlServer.Types.OpenGisGeometryType.Point);
                b.BeginFigure(p.X, p.Y, p.HasZ ? (double?)p.Z : null,
                              p.HasM ? (double?)p.M : null);
                b.EndFigure();
                b.EndGeometry();
            }
            b.EndGeometry();
            return(b.ConstructedGeometry);
        }
예제 #3
0
 private static void CreateGeometryFigures(IEnumerable <Esri.ArcGISRuntime.Geometry.ReadOnlyPart> parts,
                                           Microsoft.SqlServer.Types.SqlGeometryBuilder b, bool close)
 {
     foreach (var part in parts.Select(p => p.Points))
     {
         if (part.Count == 0)
         {
             continue;
         }
         var p = part[0];
         b.BeginFigure(p.X, p.Y, p.HasZ ? (double?)p.Z : null, p.HasM ? (double?)p.M : null);
         for (int i = 1; i < part.Count; i++)
         {
             p = part[i];
             b.AddLine(p.X, p.Y, p.HasZ ? (double?)p.Z : null, p.HasM ? (double?)p.M : null);
         }
         if (close)
         {
             p = part[0];
             b.AddLine(p.X, p.Y, p.HasZ ? (double?)p.Z : null, p.HasM ? (double?)p.M : null);
         }
         b.EndFigure();
     }
 }