Skip to content

Commit

Permalink
Change log message to show centroid instead of envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickackermann committed Jun 17, 2024
1 parent fc6d28a commit 8d94f44
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 is near this point: {2}",
centroid.getX(),
centroid.getY(),
null,
currentCode,
nextCode,
offendingEnvelopeWkt));
offendingCentroidWkt));

result = false;
}
Expand Down

0 comments on commit 8d94f44

Please sign in to comment.