Skip to content

Commit

Permalink
Created runOutOfOrderRelationTest unit test (#5710)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarchant authored Sep 28, 2023
1 parent 06e30f5 commit 526f304
Show file tree
Hide file tree
Showing 3 changed files with 357 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* This will properly maintain the copyright information. Maxar
* copyrights will be updated automatically.
*
* @copyright Copyright (C) 2014, 2015, 2017, 2018, 2019, 2020, 2021, 2022 Maxar (http://www.maxar.com/)
* @copyright Copyright (C) 2014-2023 Maxar (http://www.maxar.com/)
*/

// geos
Expand All @@ -32,6 +32,8 @@
#include <hoot/core/TestUtils.h>
#include <hoot/core/algorithms/FindNodesInWayFactory.h>
#include <hoot/core/geometry/RelationToMultiPolygonConverter.h>
#include <hoot/core/io/OsmGeoJsonWriter.h>
#include <hoot/core/io/OsmXmlReader.h>

using namespace geos::geom;
using namespace std;
Expand All @@ -46,10 +48,17 @@ class RelationToMultiPolygonConverterTest : public HootTestFixture
CPPUNIT_TEST(runMultiPolygonExample1Test);
CPPUNIT_TEST(runMultiPolygonExample7Test);
CPPUNIT_TEST(runMultipleWaysFormingARing);
CPPUNIT_TEST(runOutOfOrderRelationTest);
CPPUNIT_TEST_SUITE_END();

public:

RelationToMultiPolygonConverterTest()
: HootTestFixture("test-files/geometry/RelationToMultiPolygonConverter/",
"test-output/geometry/RelationToMultiPolygonConverter/")
{
}

FindNodesInWayFactory f;

void addPoint(OsmMapPtr map, WayPtr w, double x, double y)
Expand Down Expand Up @@ -233,6 +242,24 @@ class RelationToMultiPolygonConverterTest : public HootTestFixture
g->toString());
}

void runOutOfOrderRelationTest()
{
OsmMapPtr map = std::make_shared<OsmMap>();
OsmXmlReader reader;
reader.setUseDataSourceIds(true);
reader.setDefaultStatus(Status::Unknown1);
reader.read(_inputPath + "OutOfOrderRelation.osm", map);
reader.close();

OsmGeoJsonWriter writer;
writer.open(_outputPath + "OutOfOrderRelation.geojson");
writer.setIncludeCircularError(false);
writer.write(map);
writer.close();

HOOT_FILE_EQUALS(_inputPath + "OutOfOrderRelation.geojson", _outputPath + "OutOfOrderRelation.geojson");
}

};

CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(RelationToMultiPolygonConverterTest, "quick");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{"generator":"Hootenanny","type":"FeatureCollection","bbox":[-119.28, 46.318, -119.26, 46.336],"features": [
{"type":"Feature","properties":{"crossing":"uncontrolled"},"geometry": {"type":"Point","coordinates": [-119.2726704, 46.333013]}},
{"type":"Feature","properties":{"crossing":"uncontrolled"},"geometry": {"type":"Point","coordinates": [-119.2722529, 46.3330139]}},
{"type":"Feature","properties":{"highway":"traffic_signals","traffic_signals":"signal"},"geometry": {"type":"Point","coordinates": [-119.2723928, 46.3330138]}},
{"type":"Feature","properties":{"highway":"traffic_signals"},"geometry": {"type":"Point","coordinates": [-119.2725239, 46.3330136]}},
{"type":"Feature","properties":{"note":"outer border of river"},"geometry": {"type":"LineString","coordinates": [[-119.2616102, 46.3301559],[-119.2615458, 46.3300911],[-119.2614694, 46.3300281],[-119.2614224, 46.3299902],[-119.2613795, 46.3299568],[-119.2613473, 46.3299263],[-119.2613313, 46.3299013],[-119.2613111, 46.329842],[-119.2613044, 46.3297929],[-119.2613044, 46.3297392],[-119.2613017, 46.3296781],[-119.261293, 46.3296346],[-119.2612789, 46.3295855],[-119.2612402, 46.3294715],[-119.2611553, 46.3292153],[-119.2611262, 46.3291002]]}},
{"type":"Feature","properties":{"oneway":"yes","source":"Yahoo image;TIGER"},"geometry": {"type":"LineString","coordinates": [[-119.2725239, 46.3330136],[-119.2723928, 46.3330138]]}},
{"type":"Feature","properties":{"oneway":"yes","source":"Yahoo image;TIGER"},"geometry": {"type":"LineString","coordinates": [[-119.2698328, 46.3342712],[-119.2697528, 46.3343367],[-119.2691719, 46.3347256],[-119.2688507, 46.3349721]]}},
{"type":"Feature","properties":{"oneway":"yes","source":"Yahoo image;TIGER"},"geometry": {"type":"LineString","coordinates": [[-119.2723928, 46.3330138],[-119.2722529, 46.3330139],[-119.2720956, 46.3330141],[-119.2718955, 46.3330184],[-119.2717375, 46.3330407],[-119.2716393, 46.3330727],[-119.2715109, 46.3331294],[-119.2706444, 46.3337137],[-119.270474, 46.3338281],[-119.2698328, 46.3342712]]}},
{"type":"Feature","properties":{"oneway":"yes","source":"Yahoo image;TIGER"},"geometry": {"type":"LineString","coordinates": [[-119.2776224, 46.3330127],[-119.2765847, 46.33301],[-119.2746595, 46.3330051],[-119.2739337, 46.333008],[-119.2726704, 46.333013],[-119.2725239, 46.3330136]]}},
{"type":"Feature","properties":{"alt_name":"WSU Tri-Cities","amenity":"university","name":"Washington State University Tri-Cities","operator":"Washington State University","wikidata":"Q7972303","wikipedia":"en:Washington State University Tri-Cities"},"relation-type":"multipolygon","roles":"outer;outer;outer;outer;outer;outer","geometry": {"type":"MultiPolygon","coordinates": [[[[-119.2765758, 46.3244186],[-119.2765729, 46.3239726],[-119.2764516, 46.3239724],[-119.2764569, 46.3226023],[-119.2765696, 46.3223671],[-119.2776129, 46.3201405],[-119.2780307, 46.3193567],[-119.2784244, 46.3184863],[-119.2784584, 46.318411],[-119.2783532, 46.3184106],[-119.2780949, 46.3184095],[-119.2777891, 46.3190539],[-119.2767749, 46.3190464],[-119.2767699, 46.3191614],[-119.275938, 46.3191615],[-119.275844, 46.3209043],[-119.2750694, 46.3209028],[-119.2750531, 46.3212217],[-119.2750069, 46.3221256],[-119.2749999, 46.3222629],[-119.2749889, 46.322479],[-119.2748057, 46.3224733],[-119.2740468, 46.3224498],[-119.2729394, 46.3224155],[-119.2728669, 46.3236884],[-119.2728454, 46.3240718],[-119.2727972, 46.3249405],[-119.2727408, 46.3259129],[-119.2727086, 46.3264797],[-119.2726498, 46.3275571],[-119.2724156, 46.3275561],[-119.2632804, 46.3275039],[-119.2637094, 46.3290889],[-119.2637472, 46.3292249],[-119.2615582, 46.3292149],[-119.2614962, 46.329215],[-119.2614937, 46.3290989],[-119.2611262, 46.3291002],[-119.2611553, 46.3292153],[-119.2612402, 46.3294715],[-119.2612789, 46.3295855],[-119.261293, 46.3296346],[-119.2613017, 46.3296781],[-119.2613044, 46.3297392],[-119.2613044, 46.3297929],[-119.2613111, 46.329842],[-119.2613313, 46.3299013],[-119.2613473, 46.3299263],[-119.2613795, 46.3299568],[-119.2614224, 46.3299902],[-119.2614694, 46.3300281],[-119.2615458, 46.3300911],[-119.2616102, 46.3301559],[-119.2615582, 46.3292149],[-119.2621042, 46.3303591],[-119.2625634, 46.331305],[-119.2637876, 46.333584],[-119.2639462, 46.3342802],[-119.2640299, 46.3346426],[-119.2641771, 46.3353368],[-119.2643781, 46.3362784],[-119.2668565, 46.3362969],[-119.2671881, 46.3362959],[-119.2672647, 46.3362449],[-119.2673066, 46.3362029],[-119.2673791, 46.3361108],[-119.2674899, 46.3359841],[-119.2675809, 46.335876],[-119.2676906, 46.3357847],[-119.2682138, 46.335416],[-119.2688507, 46.3349721],[-119.2691719, 46.3347256],[-119.2697528, 46.3343367],[-119.2698328, 46.3342712],[-119.270474, 46.3338281],[-119.2706444, 46.3337137],[-119.2715109, 46.3331294],[-119.2716393, 46.3330727],[-119.2717375, 46.3330407],[-119.2718955, 46.3330184],[-119.2720956, 46.3330141],[-119.2722529, 46.3330139],[-119.2723928, 46.3330138],[-119.2725239, 46.3330136],[-119.2726704, 46.333013],[-119.2739337, 46.333008],[-119.2746595, 46.3330051],[-119.2765847, 46.33301],[-119.2776224, 46.3330127],[-119.2776165, 46.3320767],[-119.2765329, 46.3320749],[-119.2765115, 46.3309599],[-119.2731802, 46.3309488],[-119.2727676, 46.3292734],[-119.2737112, 46.3249108],[-119.2763774, 46.3249108],[-119.2763733, 46.324852],[-119.2764431, 46.324853],[-119.2764431, 46.3244964],[-119.2765758, 46.3244186]]]]}}
]
}
Loading

0 comments on commit 526f304

Please sign in to comment.