Skip to content

[DE-736] added legacy option to GeoJSONAnalyzerProperties #572

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 1 commit into from
Sep 5, 2024
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 @@ -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