Skip to content

Fix deprecation warnings #2974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ the License, or (at your option) any later version.

package com.graphhopper.isochrone.algorithm;

import org.locationtech.jts.algorithm.CGAlgorithms;
import org.locationtech.jts.algorithm.Area;
import org.locationtech.jts.geom.*;
import org.locationtech.jts.geom.prep.PreparedPolygon;
import org.locationtech.jts.triangulate.quadedge.Vertex;
Expand Down Expand Up @@ -125,7 +125,7 @@ private List<Polygon> punchHoles(List<LinearRing> rings) {
List<LinearRing> holes = new ArrayList<>(rings.size() / 2);
// 1. Split the polygon list in two: shells and holes (CCW and CW)
for (LinearRing ring : rings) {
if (CGAlgorithms.signedArea(ring.getCoordinateSequence()) > 0.0)
if (Area.ofRingSigned(ring.getCoordinateSequence()) > 0.0)
holes.add(ring);
else
shells.add(new PreparedPolygon(geometryFactory.createPolygon(ring)));
Expand Down Expand Up @@ -157,4 +157,4 @@ private List<Polygon> punchHoles(List<LinearRing> rings) {
}
return punched;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;

public class EncodedValueSerializer {
private final static ObjectMapper MAPPER = new ObjectMapper();

static {
MAPPER.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
MAPPER.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
}

public static String serializeEncodedValue(EncodedValue encodedValue) {
Expand Down
4 changes: 2 additions & 2 deletions web-api/src/main/java/com/graphhopper/jackson/Jackson.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.bedatadriven.jackson.datatype.jts.JtsModule;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;

public class Jackson {

Expand All @@ -31,7 +31,7 @@ public static ObjectMapper newObjectMapper() {
public static ObjectMapper initObjectMapper(ObjectMapper objectMapper) {
objectMapper.registerModule(new GraphHopperModule());
objectMapper.registerModule(new JtsModule());
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
objectMapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
return objectMapper;
}
Expand Down