public override void SendTo(GeographyPipeline pipeline)
 {
     base.SendTo(pipeline);
     pipeline.BeginGeography(SpatialType.LineString);
     this.SendFigure(pipeline);
     pipeline.EndGeography();
 }
Exemplo n.º 2
0
 public override void SendTo(GeographyPipeline pipeline)
 {
     base.SendTo(pipeline);
     pipeline.BeginGeography(SpatialType.MultiPolygon);
     for (int i = 0; i < this.polygons.Length; i++)
     {
         this.polygons[i].SendTo(pipeline);
     }
     pipeline.EndGeography();
 }
 public override void SendTo(GeographyPipeline pipeline)
 {
     base.SendTo(pipeline);
     pipeline.BeginGeography(SpatialType.Collection);
     for (int i = 0; i < this.geographyArray.Length; i++)
     {
         this.geographyArray[i].SendTo(pipeline);
     }
     pipeline.EndGeography();
 }
        private void WriteMultiPolygon(GeographyPipeline pipeline, IEnumerable <IEnumerable <GeographyPosition> > lineStrings)
        {
            pipeline.BeginGeography(SpatialType.Polygon);

            foreach (var lineString in lineStrings)
            {
                WriteLineString(pipeline, lineString);
            }

            pipeline.EndGeography();
        }
Exemplo n.º 5
0
 public override void SendTo(GeographyPipeline pipeline)
 {
     base.SendTo(pipeline);
     pipeline.BeginGeography(SpatialType.Point);
     if (!this.IsEmpty)
     {
         pipeline.BeginFigure(new GeographyPosition(this.latitude, this.longitude, this.z, this.m));
         pipeline.EndFigure();
     }
     pipeline.EndGeography();
 }
        public override void SendTo(GeographyPipeline pipeline)
        {
            base.SendTo(pipeline);
            pipeline.BeginGeography(SpatialType.MultiLineString);

            for (int i = 0; i < this.lineStrings.Length; ++i)
            {
                this.lineStrings[i].SendTo(pipeline);
            }

            pipeline.EndGeography();
        }
        public override void SendTo(GeographyPipeline pipeline)
        {
            base.SendTo(pipeline);
            pipeline.BeginGeography(SpatialType.Polygon);

            for (int i = 0; i < this.rings.Length; ++i)
            {
                this.rings[i].SendFigure(pipeline);
            }

            pipeline.EndGeography();
        }
Exemplo n.º 8
0
        protected override void ReadGeographyImplementation(TextReader input)
        {
            MatchLine(input, "P");

            GeographyPipeline destination = this.Destination;

            destination.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
            destination.BeginGeography(SpatialType.Point);
            destination.BeginFigure(new GeographyPosition(ExpectedGeographyResult.Latitude,
                                                          ExpectedGeographyResult.Longitude, null, null));

            MatchLine(input, "T");

            destination.EndFigure();
            destination.EndGeography();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Convert a DbGeography to Edm GeographyPoint
        /// </summary>
        /// <param name="geography"> The DbGeography to be converted</param>
        /// <returns>A Edm GeographyLineString</returns>
        public static GeographyLineString ToGeographyLineString(this DbGeography geography)
        {
            if (geography == null)
            {
                return(null);
            }

            if (geography.SpatialTypeName != GeographyTypeNameLineString)
            {
                throw new InvalidOperationException(string.Format(
                                                        CultureInfo.InvariantCulture,
                                                        Resources.InvalidLineStringGeographyType,
                                                        geography.SpatialTypeName));
            }

            SpatialBuilder    builder   = SpatialBuilder.Create();
            GeographyPipeline pipleLine = builder.GeographyPipeline;

            pipleLine.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
            pipleLine.BeginGeography(SpatialType.LineString);

            int numPoints = geography.PointCount ?? 0;

            if (numPoints > 0)
            {
                DbGeography point = geography.PointAt(1);
                pipleLine.BeginFigure(new GeographyPosition(
                                          point.Latitude ?? 0, point.Latitude ?? 0, point.Elevation, point.Measure));

                for (int n = 2; n <= numPoints; n++)
                {
                    point = geography.PointAt(n);
                    pipleLine.LineTo(new GeographyPosition(
                                         point.Latitude ?? 0, point.Latitude ?? 0, point.Elevation, point.Measure));
                }

                pipleLine.EndFigure();
            }

            pipleLine.EndGeography();
            GeographyLineString lineString = (GeographyLineString)builder.ConstructedGeography;

            return(lineString);
        }
 public override void SendTo(GeographyPipeline pipeline)
 {
     base.SendTo(pipeline);
     pipeline.BeginGeography(SpatialType.FullGlobe);
     pipeline.EndGeography();
 }
Exemplo n.º 11
0
 public void EndGeography()
 {
     pipeline.EndGeography();
 }
Exemplo n.º 12
0
        public PlacesController()
        {
            data = new List <Place>();
            data.Add(new Place()
            {
                Id = 0, Name = "Place1", Description = "Desc", Entrance = GeographyPoint.Create(-1.56, 29.76)
            });
            data.Add(new Place()
            {
                Id = 1, Name = "Place1", Description = "Desc", Entrance = GeographyPoint.Create(-2.56, 19.76)
            });
            data.Add(new Place()
            {
                Id = 2, Name = "Place1", Description = "Desc", Entrance = GeographyPoint.Create(-3.56, 9.76)
            });
            data.Add(new Place()
            {
                Id = 3, Name = "Place1", Description = "Desc", Entrance = GeographyPoint.Create(-4.56, -9.76)
            });
            data.Add(new Place()
            {
                Id = 4, Name = "Place1", Description = "Desc", Entrance = GeographyPoint.Create(-10.56, -19.76)
            });


            for (int i = 0; i < data.Count; i++)
            {
                data[i].Gp = GeometryPoint.Create(-1.56 - i, 29.76 + i);

                SpatialBuilder    spatialBuilder    = SpatialBuilder.Create();
                GeographyPipeline geographyPipeline = spatialBuilder.GeographyPipeline;
                geographyPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
                geographyPipeline.BeginGeography(SpatialType.LineString);
                geographyPipeline.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline.LineTo(new GeographyPosition(-1.58, 29.78));
                geographyPipeline.LineTo(new GeographyPosition(5, 50));
                geographyPipeline.EndFigure();
                geographyPipeline.EndGeography();
                data[i].Ls = (GeographyLineString)spatialBuilder.ConstructedGeography;

                SpatialBuilder    spatialBuilder1    = SpatialBuilder.Create();
                GeographyPipeline geographyPipeline1 = spatialBuilder1.GeographyPipeline;
                geographyPipeline1.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
                geographyPipeline1.BeginGeography(SpatialType.MultiPoint);
                geographyPipeline1.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline1.EndFigure();
                geographyPipeline1.BeginFigure(new GeographyPosition(-3.56, 50));
                geographyPipeline1.EndFigure();
                geographyPipeline1.EndGeography();
                data[i].Mp = (GeographyMultiPoint)spatialBuilder1.ConstructedGeography;

                SpatialBuilder    spatialBuilder2    = SpatialBuilder.Create();
                GeographyPipeline geographyPipeline2 = spatialBuilder2.GeographyPipeline;
                geographyPipeline2.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
                geographyPipeline2.BeginGeography(SpatialType.Polygon);
                geographyPipeline2.BeginFigure(new GeographyPosition(-2, 2));
                geographyPipeline2.LineTo(new GeographyPosition(2, 2));
                geographyPipeline2.LineTo(new GeographyPosition(2, -2));
                geographyPipeline2.LineTo(new GeographyPosition(-2, -2));
                geographyPipeline2.LineTo(new GeographyPosition(-2, 2));
                geographyPipeline2.EndFigure();
                geographyPipeline2.BeginFigure(new GeographyPosition(-1, 1));
                geographyPipeline2.LineTo(new GeographyPosition(1, 1));
                geographyPipeline2.LineTo(new GeographyPosition(1, -1));
                geographyPipeline2.LineTo(new GeographyPosition(-1, -1));
                geographyPipeline2.LineTo(new GeographyPosition(-1, 1));
                geographyPipeline2.EndFigure();
                geographyPipeline2.EndGeography();
                data[i].Pol = (GeographyPolygon)spatialBuilder2.ConstructedGeography;

                SpatialBuilder    spatialBuilder3    = SpatialBuilder.Create();
                GeographyPipeline geographyPipeline3 = spatialBuilder3.GeographyPipeline;
                geographyPipeline3.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
                geographyPipeline3.BeginGeography(SpatialType.MultiPolygon);
                geographyPipeline3.BeginGeography(SpatialType.Polygon);
                geographyPipeline3.BeginFigure(new GeographyPosition(-2, 2));
                geographyPipeline3.LineTo(new GeographyPosition(2, 2));
                geographyPipeline3.LineTo(new GeographyPosition(2, -2));
                geographyPipeline3.LineTo(new GeographyPosition(-2, -2));
                geographyPipeline3.LineTo(new GeographyPosition(-2, 2));
                geographyPipeline3.EndFigure();
                geographyPipeline3.BeginFigure(new GeographyPosition(-1, 1));
                geographyPipeline3.LineTo(new GeographyPosition(1, 1));
                geographyPipeline3.LineTo(new GeographyPosition(1, -1));
                geographyPipeline3.LineTo(new GeographyPosition(-1, -1));
                geographyPipeline3.LineTo(new GeographyPosition(-1, 1));
                geographyPipeline3.EndFigure();
                geographyPipeline3.EndGeography();
                geographyPipeline3.BeginGeography(SpatialType.Polygon);
                geographyPipeline3.BeginFigure(new GeographyPosition(-4, 4));
                geographyPipeline3.LineTo(new GeographyPosition(4, 4));
                geographyPipeline3.LineTo(new GeographyPosition(4, -4));
                geographyPipeline3.LineTo(new GeographyPosition(-4, -4));
                geographyPipeline3.LineTo(new GeographyPosition(-4, 4));
                geographyPipeline3.EndFigure();
                geographyPipeline3.BeginFigure(new GeographyPosition(-1, 1));
                geographyPipeline3.LineTo(new GeographyPosition(1, 1));
                geographyPipeline3.LineTo(new GeographyPosition(1, -1));
                geographyPipeline3.LineTo(new GeographyPosition(-1, -1));
                geographyPipeline3.LineTo(new GeographyPosition(-1, 1));
                geographyPipeline3.EndFigure();
                geographyPipeline3.EndGeography();
                geographyPipeline3.EndGeography();
                data[i].MPol = (GeographyMultiPolygon)spatialBuilder3.ConstructedGeography;

                SpatialBuilder    spatialBuilder4    = SpatialBuilder.Create();
                GeographyPipeline geographyPipeline4 = spatialBuilder4.GeographyPipeline;
                geographyPipeline4.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
                geographyPipeline4.BeginGeography(SpatialType.MultiLineString);
                geographyPipeline4.BeginGeography(SpatialType.LineString);
                geographyPipeline4.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline4.LineTo(new GeographyPosition(-1.58, 29.78));
                geographyPipeline4.LineTo(new GeographyPosition(5, 50));
                geographyPipeline4.EndFigure();
                geographyPipeline4.EndGeography();
                geographyPipeline4.BeginGeography(SpatialType.LineString);
                geographyPipeline4.BeginFigure(new GeographyPosition(-2.56, 30.76));
                geographyPipeline4.LineTo(new GeographyPosition(-2.58, 30.78));
                geographyPipeline4.LineTo(new GeographyPosition(6, 51));
                geographyPipeline4.EndFigure();
                geographyPipeline4.EndGeography();
                geographyPipeline4.BeginGeography(SpatialType.LineString);
                geographyPipeline4.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline4.LineTo(new GeographyPosition(-1.58, 29.78));
                geographyPipeline4.LineTo(new GeographyPosition(5, 50));
                geographyPipeline4.EndFigure();
                geographyPipeline4.EndGeography();
                geographyPipeline4.BeginGeography(SpatialType.LineString);
                geographyPipeline4.BeginFigure(new GeographyPosition(-2.56, 30.76));
                geographyPipeline4.LineTo(new GeographyPosition(-2.58, 30.78));
                geographyPipeline4.LineTo(new GeographyPosition(8, 52));
                geographyPipeline4.EndFigure();
                geographyPipeline4.EndGeography();
                geographyPipeline4.EndGeography();
                data[i].MLs = (GeographyMultiLineString)spatialBuilder4.ConstructedGeography;



                SpatialBuilder    spatialBuilder5    = SpatialBuilder.Create();
                GeographyPipeline geographyPipeline5 = spatialBuilder5.GeographyPipeline;
                geographyPipeline5.SetCoordinateSystem(CoordinateSystem.DefaultGeography);
                geographyPipeline5.BeginGeography(SpatialType.Collection);
                geographyPipeline5.BeginGeography(SpatialType.LineString);
                geographyPipeline5.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline5.LineTo(new GeographyPosition(-1.58, 29.78));
                geographyPipeline5.LineTo(new GeographyPosition(5, 50));
                geographyPipeline5.EndFigure();
                geographyPipeline5.EndGeography();
                geographyPipeline5.BeginGeography(SpatialType.Point);
                geographyPipeline5.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline5.EndFigure();
                geographyPipeline5.EndGeography();
                geographyPipeline5.BeginGeography(SpatialType.LineString);
                geographyPipeline5.BeginFigure(new GeographyPosition(-1.56, 29.76));
                geographyPipeline5.LineTo(new GeographyPosition(-1.58, 29.78));
                geographyPipeline5.LineTo(new GeographyPosition(5, 50));
                geographyPipeline5.EndFigure();
                geographyPipeline5.EndGeography();
                geographyPipeline5.EndGeography();
                data[i].Coll = (GeographyCollection)spatialBuilder5.ConstructedGeography;

                SpatialBuilder   spatialBuilder6    = SpatialBuilder.Create();
                GeometryPipeline geographyPipeline6 = spatialBuilder6.GeometryPipeline;
                geographyPipeline6.SetCoordinateSystem(CoordinateSystem.DefaultGeometry);
                geographyPipeline6.BeginGeometry(SpatialType.Collection);
                geographyPipeline6.BeginGeometry(SpatialType.LineString);
                geographyPipeline6.BeginFigure(new GeometryPosition(-1.56, 29.76));
                geographyPipeline6.LineTo(new GeometryPosition(-1.58, 29.78));
                geographyPipeline6.LineTo(new GeometryPosition(5, 50));
                geographyPipeline6.EndFigure();
                geographyPipeline6.EndGeometry();
                geographyPipeline6.BeginGeometry(SpatialType.Point);
                geographyPipeline6.BeginFigure(new GeometryPosition(-1.56, 29.76));
                geographyPipeline6.EndFigure();
                geographyPipeline6.EndGeometry();
                geographyPipeline6.BeginGeometry(SpatialType.LineString);
                geographyPipeline6.BeginFigure(new GeometryPosition(-1.56, 29.76));
                geographyPipeline6.LineTo(new GeometryPosition(-1.58, 29.78));
                geographyPipeline6.LineTo(new GeometryPosition(5, 50));
                geographyPipeline6.EndFigure();
                geographyPipeline6.EndGeometry();
                geographyPipeline6.EndGeometry();
                data[i].gColl = (GeometryCollection)spatialBuilder6.ConstructedGeometry;
            }
        }