예제 #1
0
        private static SMGeometry SqlGeometryToSharpMapMultiPoint(SqlGeometry geometry, Factory factory)
        {
            var fact   = factory ?? Services.CreateGeometryFactory((int)geometry.STSrid);
            var points = new SMPoint[(int)geometry.STNumGeometries()];

            for (var i = 1; i <= geometry.STNumGeometries(); i++)
            {
                points[i - 1] = (SMPoint)SqlGeometryToSharpMapPoint(geometry.STGeometryN(i), fact);
            }
            return(fact.CreateMultiPoint(points));
        }
예제 #2
0
        internal static NTSMultiPoint ToNTSMultiPoint(Geometries.MultiPoint geom,
                                                      IGeometryFactory factory)
        {
            NTSPoint[] points = new NTSPoint[geom.Points.Count];
            int        index  = 0;

            foreach (Geometries.Point point in geom.Points)
            {
                points[index++] = ToNTSPoint(point, factory);
            }
            return(factory.CreateMultiPoint(points) as NTSMultiPoint);
        }
예제 #3
0
 internal static DotSpatial.Topology.Point ToDotSpatialPoint(GeoAPI.Geometries.IPoint point)
 {
     return(new DotSpatial.Topology.Point(point.X, point.Y));
 }
예제 #4
0
 private static void SharpMapPointToSqlGeometry(SqlGeometryBuilder geomBuilder, SMPoint point)
 {
     geomBuilder.BeginGeometry(OpenGisGeometryType.Point);
     geomBuilder.BeginFigure(point.X, point.Y);
     geomBuilder.EndFigure();
     geomBuilder.EndGeometry();
 }
예제 #5
0
 internal static Geometries.Point ToSharpMapPoint(NTSPoint geom)
 {
     Debug.Assert(geom.Coordinates.Length == 1);
     return(ToSharpMapPoint((geom.Coordinate as Coordinate)));
 }
예제 #6
0
 private static void SharpMapPointToSqlGeometry(SqlGeometryBuilder geomBuilder, SMPoint point)
 {
     geomBuilder.BeginGeometry(OpenGisGeometryType.Point);
     geomBuilder.BeginFigure(point.X, point.Y);
     geomBuilder.EndFigure();
     geomBuilder.EndGeometry();
 }
예제 #7
0
 private static SMGeometry SqlGeometryToSharpMapMultiPoint(SqlGeometry geometry, Factory factory)
 {
     var fact = factory ?? Services.CreateGeometryFactory((int)geometry.STSrid);
     var points = new SMPoint[(int)geometry.STNumGeometries()];
     for (var i = 1; i <= geometry.STNumGeometries(); i++)
         points[i-1] = (SMPoint) SqlGeometryToSharpMapPoint(geometry.STGeometryN(i), fact);
     return fact.CreateMultiPoint(points);
 }
예제 #8
0
 internal static Geometries.Point ToSharpMapPoint(NTSPoint geom)
 {
     Debug.Assert(geom.Coordinates.Length == 1);
     return ToSharpMapPoint((geom.Coordinate as Coordinate));
 }
예제 #9
0
 private static void SharpMapPointToSqlGeography(SqlGeographyBuilder geogBuilder, SMPoint point)
 {
     geogBuilder.BeginGeography(OpenGisGeographyType.Point);
     geogBuilder.BeginFigure(point.Y, point.X);
     geogBuilder.EndFigure();
     geogBuilder.EndGeography();
 }
예제 #10
0
 internal static NTSMultiPoint ToNTSMultiPoint(Geometries.MultiPoint geom,
     IGeometryFactory factory)
 {
    NTSPoint[] points = new NTSPoint[geom.Points.Count];
     int index = 0;
     foreach (Geometries.Point point in geom.Points)
         points[index++] = ToNTSPoint(point, factory);
     return factory.CreateMultiPoint(points) as NTSMultiPoint;
 }
예제 #11
0
        private readonly bool empty;//cached

        /// <summary>
        /// A simple constructor without normalization / validation.
        /// </summary>
        public NtsPoint(GeoAPI.Geometries.IPoint pointGeom, SpatialContext ctx)
        {
            this.ctx       = ctx;
            this.pointGeom = pointGeom;
            this.empty     = pointGeom.IsEmpty;
        }
 private static IPoint ReProject(this IPoint point, ICoordinateTransformation transformator)
 {
     return(new Point(point.Coordinate.ReProject(transformator)));
 }
 /// <summary>
 /// Calculate distance between two points
 /// </summary>
 /// <param name="p1"></param>
 /// <param name="p2"></param>
 /// <returns></returns>
 public static double Distance(this IPoint p1, IPoint p2)
 {
     return(Math.Sqrt(Math.Pow((p2.X - p1.X), 2) + Math.Pow((p2.Y - p1.Y), 2)));
 }
 /// <summary>
 /// Cast point to webpoint
 /// </summary>
 /// <param name="point"></param>
 /// <returns></returns>
 public static WebPoint ToWebPoint(this IPoint point)
 {
     return(new WebPoint(point.X, point.Y));
 }