예제 #1
0
        // Needed?
        #endregion

        #region Import
        public static AgGateway.ADAPT.ApplicationDataModel.Shapes.Shape Map(Feature feature, AffineTransformation affineTransformation = null)
        {
            // ToDo: importing different GeoJSONObjectTypes
            switch (feature.Type)
            {
            case GeoJSON.Net.GeoJSONObjectType.Point:
                return(PointMapper.MapPosition(((GeoJSON.Net.Geometry.Point)feature.Geometry).Coordinates, affineTransformation));

            case GeoJSON.Net.GeoJSONObjectType.MultiPoint:
                break;

            case GeoJSON.Net.GeoJSONObjectType.LineString:
                return(LineStringMapper.MapLineString((GeoJSON.Net.Geometry.LineString)feature.Geometry, affineTransformation));

            case GeoJSON.Net.GeoJSONObjectType.MultiLineString:
                break;

            case GeoJSON.Net.GeoJSONObjectType.Polygon:
                return(PolygonMapper.MapPolygon((GeoJSON.Net.Geometry.Polygon)feature.Geometry, affineTransformation));

            case GeoJSON.Net.GeoJSONObjectType.MultiPolygon:
                return(MultiPolygonMapper.MapMultiPolygon((GeoJSON.Net.Geometry.MultiPolygon)feature.Geometry, affineTransformation));

            case GeoJSON.Net.GeoJSONObjectType.GeometryCollection:
                break;

            case GeoJSON.Net.GeoJSONObjectType.Feature:
                break;

            case GeoJSON.Net.GeoJSONObjectType.FeatureCollection:
                break;
            }
            return(null);
        }
예제 #2
0
        public static AgGateway.ADAPT.ApplicationDataModel.Shapes.Polygon MapPolygon(GeoJSON.Net.Geometry.Polygon polygonGeoJson, AffineTransformation affineTransformation = null)
        {
            var polygon = new AgGateway.ADAPT.ApplicationDataModel.Shapes.Polygon();

            // First LineString is ExteriorRing, see https://tools.ietf.org/html/rfc7946#section-3.1.6
            for (int i = 0; i < polygonGeoJson.Coordinates.Count; i++)
            {
                if (i == 0)
                {
                    polygon.ExteriorRing = LineStringMapper.MapLineString(polygonGeoJson.Coordinates[i], affineTransformation);
                }
                else
                {
                    polygon.InteriorRings.Add(LineStringMapper.MapLineString(polygonGeoJson.Coordinates[i], affineTransformation));
                }
            }

            return(polygon);
        }