private void WriteMultiPoint(GeographyPipeline pipeline, IEnumerable <GeographyPosition> positions) { foreach (var position in positions) { pipeline.BeginFigure(position); pipeline.EndFigure(); } }
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(); }
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(); }
public static void DrawLine(GeographyPipeline pipeline, PositionData[] line) { for (int i = 0; i < line.Length; ++i) { if (i == 0) { pipeline.BeginFigure(new GeographyPosition(line[i].X, line[i].Y, line[i].Z, line[i].M)); } else { pipeline.LineTo(new GeographyPosition(line[i].X, line[i].Y, line[i].Z, line[i].M)); } } pipeline.EndFigure(); }
/// <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); }
private void WriteLineString(GeographyPipeline pipeline, IEnumerable <GeographyPosition> positions) { var first = true; foreach (var position in positions) { if (first) { pipeline.BeginFigure(position); first = false; } else { pipeline.LineTo(position); } } pipeline.EndFigure(); }
internal static void SendFigure(this GeographyLineString lineString, GeographyPipeline pipeline) { ReadOnlyCollection <GeographyPoint> points = lineString.Points; for (int i = 0; i < points.Count; i++) { if (i == 0) { pipeline.BeginFigure(new GeographyPosition(points[i].Latitude, points[i].Longitude, points[i].Z, points[i].M)); } else { pipeline.LineTo(new GeographyPosition(points[i].Latitude, points[i].Longitude, points[i].Z, points[i].M)); } } if (points.Count > 0) { pipeline.EndFigure(); } }
public void EndFigure() { pipeline.EndFigure(); }
private void WritePoint(GeographyPipeline pipeline, GeographyPosition position) { pipeline.BeginFigure(position); pipeline.EndFigure(); }
public static void DrawPoint(GeographyPipeline pipeline, PositionData point) { pipeline.BeginFigure(new GeographyPosition(point.X, point.Y, point.Z, point.M)); pipeline.EndFigure(); }
public static void DrawPoint(GeographyPipeline pipeline, PositionData point) { pipeline.BeginFigure(new GeographyPosition(point.X, point.Y, point.Z, point.M)); pipeline.EndFigure(); }
public static void DrawLine(GeographyPipeline pipeline, PositionData[] line) { for (int i = 0; i < line.Length; ++i) { if (i == 0) { pipeline.BeginFigure(new GeographyPosition(line[i].X, line[i].Y, line[i].Z, line[i].M)); } else { pipeline.LineTo(new GeographyPosition(line[i].X, line[i].Y, line[i].Z, line[i].M)); } } pipeline.EndFigure(); }
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; } }