Commit c2a12ed4 authored by Riegel's avatar Riegel
Browse files

Refactor: Simplify Surface geometry mapping

parent 53599b81
......@@ -10,7 +10,6 @@ public final class PatchCollection implements Serializable {
@Serial
private static final long serialVersionUID = -1748657379840997228L;
private GmlId gmlId;
private List<ConcretePolygon> patchMembers = new ArrayList<>();
......@@ -23,11 +22,4 @@ public final class PatchCollection implements Serializable {
return new ArrayList<>(patchMembers);
}
public void setGmlId(GmlId gmlId) {
this.gmlId = gmlId;
}
public GmlId getGmlId() {
return gmlId;
}
}
......@@ -69,26 +69,20 @@ public class Citygml3GeometryMapper extends GeometryWalker {
logger.warn("Surface {} has no PolygonPatches.", surface.getId());
return;
}
List<PolygonPatch> polygonPatches = new ArrayList<>();
PatchCollection patchCollection = new PatchCollection();
GeometryWalker patchCollector = new GeometryWalker() {
@Override
public void visit(PolygonPatch pp) {
polygonPatches.add(pp);
public void visit(PolygonPatch patch) {
parsePolygonPatch(patch, patchCollection);
}
};
surface.getPatches().getObjects().forEach(abstractSurfacePatch -> abstractSurfacePatch.accept(patchCollector));
PatchCollection patchCollection = new PatchCollection();
Citygml3GeometryMapper patchMapper = new Citygml3GeometryMapper(config, vertexMap);
for (PolygonPatch patch : polygonPatches) {
patchMapper.parsePolygonPatch(patch.getExterior(), patch.getInterior());
}
List<ConcretePolygon> patchPolys = patchMapper.getPolygons();
patchPolys.forEach(patchCollection::addPatchMember);
polygons.addAll(patchPolys);
}
private void parsePolygonPatch(AbstractRingProperty exterior, List<AbstractRingProperty> interior) {
private void parsePolygonPatch(PolygonPatch patch, PatchCollection collection) {
AbstractRingProperty exterior = patch.getExterior();
List<AbstractRingProperty> interior = patch.getInterior();
if (exterior == null || exterior.getObject() == null) {
if (logger.isWarnEnabled()) {
logger.warn(Localization.getText("GeometryMapper.emptyPolygon"));
......@@ -110,6 +104,8 @@ public class Citygml3GeometryMapper extends GeometryWalker {
gmlRing.accept(this);
conc.addInteriorRing(currentRing);
}
collection.addPatchMember(conc);
polygons.add(conc);
}
private void parsePolygon(String id, AbstractRingProperty exterior, List<AbstractRingProperty> interior) {
......
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