/// <summary> /// This method populates the given sink with the data from this geography instance /// </summary> /// <param name="sink">Sink to be populated</param> public override void Populate(Microsoft.SqlServer.Types.IGeographySink sink) { CheckCoordinates(); // The coordinates for this geography instance will be: // (west, south), (east, south), (east, notrh), (west, north), (west, south) sink.BeginGeography(OpenGisGeographyType.Polygon); // (west, south) sink.BeginFigure(South, West, m_Altitude, m_Measure); // (east, south) sink.AddLine(South, East, m_Altitude, m_Measure); // (east, notrh) sink.AddLine(North, East, m_Altitude, m_Measure); // (west, north) sink.AddLine(North, West, m_Altitude, m_Measure); // (west, south) sink.AddLine(South, West, m_Altitude, m_Measure); sink.EndFigure(); sink.EndGeography(); }
/// <summary> /// This method populates the given sink with the data from this geography instance /// </summary> /// <param name="sink">Sink to be populated</param> public override void Populate(Microsoft.SqlServer.Types.IGeographySink sink) { if (Points == null || Points.Count == 0) { return; } sink.BeginGeography(OpenGisGeographyType.Polygon); sink.BeginFigure(Points[0].Latitude, Points[0].Longitude, Points[0].Altitude, Points[0].Measure); for (int i = 1; i < Points.Count; i++) { sink.AddLine(Points[i].Latitude, Points[i].Longitude, Points[i].Altitude, Points[i].Measure); } sink.EndFigure(); sink.EndGeography(); }