Skip to content

Commit

Permalink
added legacy option to GeoJSONAnalyzerProperties (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
rashtao authored Sep 5, 2024
1 parent 1c4916c commit b0b1c7c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final class GeoJSONAnalyzerProperties {

private GeoJSONAnalyzerType type;
private GeoAnalyzerOptions options;
private Boolean legacy;

public GeoJSONAnalyzerType getType() {
return type;
Expand All @@ -51,17 +52,36 @@ public void setOptions(GeoAnalyzerOptions options) {
this.options = options;
}

/**
* @return This option controls how GeoJSON Polygons are interpreted (introduced in v3.10.5).
* - If `legacy` is `true`, the smaller of the two regions defined by a
* linear ring is interpreted as the interior of the ring and a ring can at most
* enclose half the Earth's surface.
* - If `legacy` is `false`, the area to the left of the boundary ring's
* path is considered to be the interior and a ring can enclose the entire
* surface of the Earth.
* <p>
* The default is `false`.
*/
public Boolean getLegacy() {
return legacy;
}

public void setLegacy(Boolean legacy) {
this.legacy = legacy;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GeoJSONAnalyzerProperties that = (GeoJSONAnalyzerProperties) o;
return type == that.type && Objects.equals(options, that.options);
return type == that.type && Objects.equals(options, that.options) && Objects.equals(legacy, that.legacy);
}

@Override
public int hashCode() {
return Objects.hash(type, options);
return Objects.hash(type, options, legacy);
}

public enum GeoJSONAnalyzerType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ void geoJsonAnalyzer(ArangoDatabaseAsync db) throws ExecutionException, Interrup
GeoJSONAnalyzerProperties properties = new GeoJSONAnalyzerProperties();
properties.setOptions(options);
properties.setType(GeoJSONAnalyzerProperties.GeoJSONAnalyzerType.point);
properties.setLegacy(true);

Set<AnalyzerFeature> features = new HashSet<>();
features.add(AnalyzerFeature.frequency);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ void geoJsonAnalyzer(ArangoDatabase db) {
GeoJSONAnalyzerProperties properties = new GeoJSONAnalyzerProperties();
properties.setOptions(options);
properties.setType(GeoJSONAnalyzerProperties.GeoJSONAnalyzerType.point);
properties.setLegacy(true);

Set<AnalyzerFeature> features = new HashSet<>();
features.add(AnalyzerFeature.frequency);
Expand Down

0 comments on commit b0b1c7c

Please sign in to comment.