private IGeometry PrimitiveCoordinateMapper(IGeometry geom) { if (geom is IPoint) return new Topology.Geometries.Point(PrimitiveCoordinateMapper(geom.Coordinates)[0]); else if (geom is IMultiPoint) { IGeometry[] input = (geom as IMultiLineString).Geometries; IPoint[] output = new IPoint[input.Length]; for (int i = 0; i < input.Length; i++) output[i] = (IPoint)PrimitiveCoordinateMapper(input[i]); return new MultiPoint(output); } else if (geom is ILineString) return new LineString(PrimitiveCoordinateMapper(geom.Coordinates)); else if (geom is ILinearRing) return new LinearRing(PrimitiveCoordinateMapper(geom.Coordinates)); else if (geom is IMultiLineString) { IGeometry[] input = (geom as IMultiLineString).Geometries; ILineString[] output = new ILineString[input.Length]; for (int i = 0; i < input.Length; i++) output[i] = (ILineString)PrimitiveCoordinateMapper(input[i]); return new MultiLineString(output); } else if (geom is IPolygon) { ILineString shell = (ILineString)PrimitiveCoordinateMapper(((IPolygon)geom).Shell); ILineString[] input = (geom as IPolygon).Holes; ILinearRing[] output = new ILinearRing[input.Length]; for (int i = 0; i < input.Length; i++) output[i] = new LinearRing(((ILineString)PrimitiveCoordinateMapper(input[i])).Coordinates); return new Polygon(new LinearRing(shell.Coordinates), output); } else if (geom is IMultiPolygon) { IGeometry[] input = (geom as IMultiPolygon).Geometries; IPolygon[] output = new IPolygon[input.Length]; for (int i = 0; i < input.Length; i++) output[i] = (IPolygon)PrimitiveCoordinateMapper(input[i]); return new MultiPolygon(output); } else if (geom is IGeometryCollection) { IGeometry[] input = (geom as IGeometryCollection).Geometries; IGeometry[] output = new IGeometry[input.Length]; for (int i = 0; i < input.Length; i++) output[i] = PrimitiveCoordinateMapper(input[i]); return new GeometryCollection(output); } else return null; }
/// <summary> /// Constructs a <c>Polygon</c> with the given exterior boundary. /// </summary> /// <param name="shell"> /// The outer boundary of the new <c>Polygon</c>, /// or <c>null</c> or an empty <c>LinearRing</c> if the empty /// polygon is to be created. /// </param> public Polygon(LinearRing shell) : this(shell, null, DefaultFactory) { }
/// <summary> /// Constructs a <c>Polygon</c> with the given exterior boundary. /// </summary> /// <param name="shell"> /// The outer boundary of the new <c>Polygon</c>, /// or <c>null</c> or an empty <c>LinearRing</c> if the empty /// polygon is to be created. /// </param> public Polygon(LinearRing shell) : this(shell, null, DefaultFactory) { }
/* BEGIN ADDED BY MPAUL42: monoGIS team */ /// <summary> /// Constructs a <c>Polygon</c> with the given exterior boundary. /// </summary> /// <param name="shell"> /// The outer boundary of the new <c>Polygon</c>, /// or <c>null</c> or an empty <c>LinearRing</c> if the empty /// polygon is to be created. /// </param> /// <param name="factory"></param> public Polygon(LinearRing shell, GeometryFactory factory) : this(shell, null, factory) { }
/* BEGIN ADDED BY MPAUL42: monoGIS team */ /// <summary> /// Constructs a <c>Polygon</c> with the given exterior boundary. /// </summary> /// <param name="shell"> /// The outer boundary of the new <c>Polygon</c>, /// or <c>null</c> or an empty <c>LinearRing</c> if the empty /// polygon is to be created. /// </param> /// <param name="factory"></param> public Polygon(LinearRing shell, GeometryFactory factory) : this(shell, null, factory) { }