Skip to content

Commit

Permalink
Add geometry type column to mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
domi-b committed Nov 7, 2024
1 parent 83bcb46 commit d9a3834
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 57 deletions.
9 changes: 4 additions & 5 deletions src/main/java/ch/geowerkstatt/lk2dxf/MappedObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.vividsolutions.jts.geom.GeometryFactory;

public record MappedObject(Geometry geometry, IomObject iomObject, LayerMapping layerMapping) {
private static final String BASKET_NAME = "SIA405_LKMap_2015_LV95.SIA405_LKMap";
private static final GeometryFactory GEOMETRY_FACTORY = new JtsextGeometryFactory();

/**
Expand All @@ -21,10 +20,10 @@ public record MappedObject(Geometry geometry, IomObject iomObject, LayerMapping
*/
public static MappedObject create(IomObject iomObject, LayerMapping layerMapping) {
try {
Geometry geometry = switch (iomObject.getobjecttag()) {
case BASKET_NAME + ".LKPunkt", BASKET_NAME + ".LKObjekt_Text" -> readPoint(iomObject, layerMapping.geometry());
case BASKET_NAME + ".LKLinie" -> readLine(iomObject, layerMapping.geometry());
case BASKET_NAME + ".LKFlaeche" -> readSurface(iomObject, layerMapping.geometry());
Geometry geometry = switch (layerMapping.geometryType()) {
case "Point" -> readPoint(iomObject, layerMapping.geometry());
case "Line" -> readLine(iomObject, layerMapping.geometry());
case "Surface" -> readSurface(iomObject, layerMapping.geometry());
default -> throw new IllegalArgumentException("Unsupported object tag: " + iomObject.getobjecttag());
};
return new MappedObject(geometry, iomObject, layerMapping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

public record LayerMapping(
String layer,
String objectType,
String objectClass,
String geometryType,
String geometry,
int color,
String orientation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private Optional<MappedObject> getLayerMapping(IomObject iomObject) {
}

private boolean matchesMapping(LayerMapping layerMapping, IomObject iomObject) {
if (!iomObject.getobjecttag().endsWith("." + layerMapping.objectType())) {
if (!iomObject.getobjecttag().endsWith("." + layerMapping.objectClass())) {
return false;
}

Expand Down
Loading

0 comments on commit d9a3834

Please sign in to comment.