private static PolygonType ExtractShellPolygon(ref ILinearRing shell, SurfacePropertyType member) { PolygonType sur = member.Surface as PolygonType; LinearRingType li = sur.Exterior.Ring as LinearRingType; foreach (DirectPositionListType rings in li.Items) { List <Coordinate> lstCoor = ExtractCoordinates(rings); shell = new LinearRing(lstCoor); } return(sur); }
private static Feature ConvertLinearRing(LinearRingType linearRing) { return(new Feature((Geometry) new LineairRing((IEnumerable <GeoCoordinate>)KmlFeatureStreamSource.ConvertCoordinates(linearRing.coordinates))) { Attributes = { { "id", (object)linearRing.id } } }); }
public static LinearRingType ToGmlLinearRing(this LineString lineString) { if (!lineString.IsClosed()) { throw new InvalidFormatException("LineString geometry is not closed and cannot be transformed to GML linearRing"); } LinearRingType gmlLineString = new LinearRingType(); gmlLineString.ItemsElementName = new ItemsChoiceType6[1]; gmlLineString.ItemsElementName[0] = ItemsChoiceType6.posList; gmlLineString.Items = new object[1]; gmlLineString.Items[0] = ToGmlPosList(lineString.Positions.ToArray()); return(gmlLineString); }
public static LineString ToGeometry(this LinearRingType linearRing) { List <IPosition> positions; Type posType = linearRing.ItemsElementName.First().GetType(); positions = FromGMLData(linearRing.Items, Array.ConvertAll <ItemsChoiceType6, string>(linearRing.ItemsElementName, i => i.ToString())); LineString linestring = new LineString(positions); if (linestring.Positions.Count < 4 || !linestring.IsClosed()) { throw new InvalidFormatException("invalid GML representation: linearring is not a closed ring of minimum 4 positions"); } return(linestring); }
private static void ExtractInteriorPolygon(ILinearRing[] holes, PolygonType sur) { Collection <AbstractRingPropertyType> lin = sur.Interior as Collection <AbstractRingPropertyType>; int i = 0; foreach (AbstractRingPropertyType ringis in lin) { LinearRingType lii = ringis.Ring as LinearRingType; foreach (DirectPositionListType rings in lii.Items) { List <Coordinate> lstCoor = ExtractCoordinates(rings); holes[i] = new LinearRing(lstCoor); i++; } } }
public static LinearRingType ToGmlLinearRing(this LineString lineString) { if (!lineString.IsClosed()) throw new InvalidFormatException("LineString geometry is not closed and cannot be transformed to GML linearRing"); LinearRingType gmlLineString = new LinearRingType(); gmlLineString.Items1ElementName = new Items1ChoiceType2[1]; gmlLineString.Items1ElementName[0] = Items1ChoiceType2.posList; gmlLineString.Items1 = new object[1]; gmlLineString.Items1[0] = ToGmlPosList(lineString.Positions.ToArray()); return gmlLineString; }