public void TestClassifyRingsWithOuterAndInnerRing() { // arrange var coords = new List <List <Coordinate> >(); var poly1 = TestData.GetCCWPolygon(2); var poly2 = TestData.GetCWPolygon(1); coords.Add(poly1); coords.Add(poly2); // act var classify = ClassifyRings.Classify(coords); // assert Assert.IsTrue(classify.Count == 1); Assert.IsTrue(classify[0].Count == 2); }
public void TestClassifyRingsWithTwoOuterrings() { // arrange var coords = new List <VectorTileGeometry>(); var poly1 = TestData.GetCCWPolygon(2); var poly2 = TestData.GetCCWPolygon(1); coords.Add(poly1); coords.Add(poly2); // act var classify = ClassifyRings.Classify(coords); // assert Assert.IsTrue(classify.Count == 2); Assert.IsTrue(classify[0].Count == 1); Assert.IsTrue(classify[1].Count == 1); }
public static Feature ToGeoJSON(this VectorTiles.VectorTileFeature vectortileFeature, int x, int y, int z) { IGeometryObject geom = null; switch (vectortileFeature.GeometryType) { case GeometryType.Point: var projectedPoints = ProjectPoints(vectortileFeature.Geometry, x, y, z, vectortileFeature.Extent); geom = GetPointGeometry(projectedPoints); break; case GeometryType.LineString: var projectedLines = ProjectLines(vectortileFeature.Geometry, x, y, z, vectortileFeature.Extent); geom = GetLineGeometry(projectedLines); break; case GeometryType.Polygon: // todo: Call method ClassifyRings.Classify first... // and process the classified rings... var rings = ClassifyRings.Classify(vectortileFeature.Geometry); var projectedPolygons = ProjectPolygons(rings, x, y, z, vectortileFeature.Extent); // var projectedPolygons = ProjectLines(vectortileFeature.Geometry, x, y, z, vectortileFeature.Extent); geom = GetPolygonGeometry(projectedPolygons); break; } var result = new Feature(geom); // add attributes foreach (var item in vectortileFeature.Tags) { result.Properties.Add(item.Key, item.Value); } result.Id = vectortileFeature.Id; return(result); }