Skip to content

Commit

Permalink
Change log message to show centroid instead of envelope (#9)
Browse files Browse the repository at this point in the history
patrickackermann authored Jun 17, 2024

Verified

This commit was signed with the committer’s verified signature.
2 parents fc6d28a + c3df918 commit 5f4d051
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -9,9 +9,9 @@
import ch.interlis.iom.IomObject;
import ch.interlis.iox_j.jts.Iox2jtsext;
import ch.interlis.iox_j.validator.Value;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;

import java.util.Collection;
import java.util.Collections;
@@ -96,20 +96,20 @@ private Value isInsideArea(String usageScope, Collection<IomObject> objects, Pat

if (!next.getValue().contains(current.getValue())) {
Geometry offendingGeometry = current.getValue().difference(next.getValue());
Coordinate position = offendingGeometry.getCoordinate();
String offendingEnvelopeWkt = offendingGeometry.getEnvelope().toText();
Point centroid = offendingGeometry.getCentroid();
String offendingCentroidWkt = centroid.toText();

String currentCode = current.getKey().getStringValue();
String nextCode = next.getKey().getStringValue();

logger.addEvent(logger.logErrorMsg(
"IsInsideAreaByCode found an invalid overlap between code '{0}' and '{1}'. The offending geometry is inside this envelope: {2}",
position.x,
position.y,
position.z,
"IsInsideAreaByCode found an invalid overlap between code '{0}' and '{1}'. The offending geometry has it's centroid at point: {2}",
centroid.getX(),
centroid.getY(),
null,
currentCode,
nextCode,
offendingEnvelopeWkt));
offendingCentroidWkt));

result = false;
}

0 comments on commit 5f4d051

Please sign in to comment.