Skip to content

Commit

Permalink
AutoFix suggestions for Building Road Intersection check (osmlab#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
ladwlo committed Jan 14, 2021
1 parent 57154a4 commit 761877b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.openstreetmap.atlas.checks.base.BaseCheck;
import org.openstreetmap.atlas.checks.flag.CheckFlag;
import org.openstreetmap.atlas.geography.Location;
import org.openstreetmap.atlas.geography.atlas.change.FeatureChange;
import org.openstreetmap.atlas.geography.atlas.complete.CompleteEntity;
import org.openstreetmap.atlas.geography.atlas.items.Area;
import org.openstreetmap.atlas.geography.atlas.items.AtlasObject;
import org.openstreetmap.atlas.geography.atlas.items.Edge;
Expand Down Expand Up @@ -39,6 +41,7 @@
*
* @author mgostintsev
* @author sayas01
* @author ladwlo (autofix)
*/
public class BuildingRoadIntersectionCheck extends BaseCheck<Long>
{
Expand Down Expand Up @@ -128,6 +131,7 @@ protected Optional<CheckFlag> flag(final AtlasObject object)
ignoreTags());
final CheckFlag flag = new CheckFlag(getTaskIdentifier(building));
flag.addObject(building);
flag.addFixSuggestion(FeatureChange.remove(CompleteEntity.shallowFrom(building)));
this.handleIntersections(intersectingEdges, flag, building);
return flag.getPolyLines().size() > 1 ? Optional.of(flag) : Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void testCheck()
{
this.verifier.actual(this.setup.getAtlas(), check);
this.verifier.verifyExpectedSize(2);
this.verifier.verify(flag -> Assert.assertEquals(1, flag.getFixSuggestions().size()));
}

/**
Expand Down Expand Up @@ -77,6 +78,7 @@ public void testHighwayFilterConfig()
{
this.verifier.actual(this.setup.getCorewayIntersectionAtlas(), highwayFilterCheck);
this.verifier.verifyExpectedSize(2);
this.verifier.verify(flag -> Assert.assertEquals(1, flag.getFixSuggestions().size()));
}

@Test
Expand Down Expand Up @@ -118,7 +120,7 @@ public void testSpanishCheck()
flag.getInstructions().contains("Edificio(id-323232) cruza calle(id-292929)"));
});
this.verifier.verifyExpectedSize(2);

this.verifier.verify(flag -> Assert.assertEquals(1, flag.getFixSuggestions().size()));
}

/**
Expand Down

0 comments on commit 761877b

Please sign in to comment.