Add abillity to remove markers from the marker list while keeping them on the map

This commit is contained in:
Lukas Rieger (Blue) 2023-02-07 19:43:15 +01:00
parent 2a3cc1c270
commit 812e4b8fce
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
1 changed files with 33 additions and 1 deletions

View File

@ -45,12 +45,14 @@ public abstract class Marker {
private String label;
private Vector3d position;
private int sorting;
private boolean listed;
public Marker(String type, String label, Vector3d position) {
this.type = Objects.requireNonNull(type, "type cannot be null");
this.label = Objects.requireNonNull(label, "label cannot be null");
this.position = Objects.requireNonNull(position, "position cannot be null");
this.sorting = 0;
this.listed = true;
}
/**
@ -114,7 +116,7 @@ public abstract class Marker {
* A lower value makes the marker sorted first (in lists and menus), a higher value makes it sorted later.<br>
* If multiple markers have the same sorting-value, their order will be arbitrary.<br>
* This value defaults to 0.
* @return This markers sorting-value
* @return this markers sorting-value
*/
public int getSorting() {
return sorting;
@ -131,6 +133,24 @@ public abstract class Marker {
this.sorting = sorting;
}
/**
* This value defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
* displayed on the map) or not (false).
* @return whether the marker will be listed or not
*/
public boolean isListed() {
return listed;
}
/**
* Defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
* displayed on the map) or not (false).
* @param listed whether the marker will be listed or not
*/
public void setListed(boolean listed) {
this.listed = listed;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -156,6 +176,7 @@ public abstract class Marker {
String label;
Vector3d position;
Integer sorting;
Boolean listed;
/**
* Sets the label of the {@link Marker}.
@ -201,6 +222,16 @@ public abstract class Marker {
return self();
}
/**
* Defines whether the marker will be listed (true) in markers and lists by the webapp (additionally to being
* displayed on the map) or not (false).
* @param listed whether the marker will be listed or not
*/
public B listed(Boolean listed) {
this.listed = listed;
return self();
}
/**
* Creates a new {@link Marker} with the current builder-settings
* @return The new {@link Marker}-instance
@ -211,6 +242,7 @@ public abstract class Marker {
if (label != null) marker.setLabel(label);
if (position != null) marker.setPosition(position);
if (sorting != null) marker.setSorting(sorting);
if (listed != null) marker.setListed(listed);
return marker;
}