You need to sign in or sign up before continuing.
Commit ed6f4158 authored by Riegel's avatar Riegel
Browse files

Removed unnecessary instanceof casts. Ref #69

parent 7b16c17e
......@@ -213,12 +213,10 @@ public class SelfIntersectionUtil {
// intersection is only an edge, not a polygon
// edge intersections are allowed
return PolygonIntersection.none();
} else if (intersection instanceof GeometryCollection) {
GeometryCollection col = (GeometryCollection) intersection;
} else if (intersection instanceof GeometryCollection col) {
for (int i = 0; i < col.getNumGeometries(); i++) {
org.locationtech.jts.geom.Geometry interGeom = col.getGeometryN(i);
if (interGeom instanceof org.locationtech.jts.geom.Polygon) {
org.locationtech.jts.geom.Polygon intPoly = (org.locationtech.jts.geom.Polygon) interGeom;
if (interGeom instanceof org.locationtech.jts.geom.Polygon intPoly) {
ConcretePolygon poly = convertToPolygon(plane1, projectionAxis, intPoly);
return PolygonIntersection.polygon(poly, p1.getOriginal(), p2.getOriginal());
}
......@@ -226,8 +224,7 @@ public class SelfIntersectionUtil {
// no polygon in collection, so no intersection
return PolygonIntersection.none();
}
if (intersection instanceof org.locationtech.jts.geom.Polygon) {
org.locationtech.jts.geom.Polygon intPoly = (org.locationtech.jts.geom.Polygon) intersection;
if (intersection instanceof org.locationtech.jts.geom.Polygon intPoly) {
ConcretePolygon poly = convertToPolygon(plane1, projectionAxis, intPoly);
return PolygonIntersection.polygon(poly, p1.getOriginal(), p2.getOriginal());
} else {
......
......@@ -141,18 +141,18 @@ public class XmlStreamReporter implements StreamReporter {
@Override
public void report(CityObject co) {
if (co instanceof Building) {
reportBuilding((Building) co);
} else if (co instanceof Vegetation) {
reportVegetation((Vegetation) co);
} else if (co instanceof TransportationObject) {
reportTrans((TransportationObject) co);
} else if (co instanceof BridgeObject) {
reportBridge((BridgeObject) co);
} else if (co instanceof WaterObject) {
reportWater((WaterObject) co);
} else if (co instanceof LandObject) {
reportLand((LandObject) co);
if (co instanceof Building bu) {
reportBuilding(bu);
} else if (co instanceof Vegetation ve) {
reportVegetation(ve);
} else if (co instanceof TransportationObject to) {
reportTrans(to);
} else if (co instanceof BridgeObject bo) {
reportBridge(bo);
} else if (co instanceof WaterObject wo) {
reportWater(wo);
} else if (co instanceof LandObject lo) {
reportLand(lo);
} else {
throw new IllegalStateException("Not reportable CityObject found: " + co.getClass().getSimpleName());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment