Package net.pl3x.map.core.markers.layer
Class Layer
java.lang.Object
net.pl3x.map.core.Keyed
net.pl3x.map.core.markers.layer.Layer
- All Implemented Interfaces:
JsonSerializable
- Direct Known Subclasses:
SimpleLayer
Represents a layer of markers and other metadata.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
@Nullable String
getCss()
Get the custom CSS to add for this layer.getLabel()
Get the label of this layer, shown in the control box.abstract Collection
<Marker<?>> Get the markers to display in this Layer.@Nullable String
getPane()
Get the map pane for this layer.int
Get the indexed order for this layer in the control box.int
Get this layer's update interval (in seconds).int
getUpdateInterval
(boolean ticks) Get this layer's update interval (in seconds or in ticks).@Nullable Integer
Get the z-index for this layer.int
hashCode()
boolean
Get if this layer is hidden by default in the control box.@org.jspecify.annotations.Nullable boolean
Get if this layer gets pushed through sse.Set the custom CSS to add for this layer.setDefaultHidden
(boolean defaultHidden) Set if this layer is hidden by default in the control box.Set the label of this layer, shown in the control box.Set the label supplier of this layer, shown in the control box.setLiveUpdate
(@org.jspecify.annotations.Nullable boolean liveUpdate) Set whether to push this layer through sse.Set the map pane for this layer.setPriority
(int priority) Set the indexed order for this layer in the control box.setShowControls
(boolean showControls) Set whether to show this layer in the control box.setUpdateInterval
(int updateInterval) Set this layer's update interval (in seconds).setUpdateInterval
(int updateInterval, boolean ticks) Set this layer's update interval (in seconds or in ticks).Set the z-index for this layer.boolean
Get whether to show this layer in the control box.com.google.gson.JsonObject
toJson()
Jsonify this object.toString()
-
Constructor Details
-
Layer
Create a layer.- Parameters:
key
- key for layer
-
-
Method Details
-
getLabel
Get the label of this layer, shown in the control box.- Returns:
- layer label
-
setLabel
Set the label of this layer, shown in the control box.- Parameters:
label
- new label- Returns:
- this layer
-
setLabel
Set the label supplier of this layer, shown in the control box.- Parameters:
labelSupplier
- new label supplier- Returns:
- this layer
-
getUpdateInterval
public int getUpdateInterval()Get this layer's update interval (in seconds).- Returns:
- update interval
-
getUpdateInterval
public int getUpdateInterval(boolean ticks) Get this layer's update interval (in seconds or in ticks).- Parameters:
ticks
- set to true to get update interval as ticks instead of seconds- Returns:
- update interval
-
setUpdateInterval
Set this layer's update interval (in seconds).- Parameters:
updateInterval
- new update interval- Returns:
- this layer
-
setUpdateInterval
Set this layer's update interval (in seconds or in ticks).- Parameters:
updateInterval
- new update intervalticks
- set to true to treat the interval value as ticks instead of seconds- Returns:
- this layer
-
shouldShowControls
public boolean shouldShowControls()Get whether to show this layer in the control box.- Returns:
- true if showing controls
-
setShowControls
Set whether to show this layer in the control box.- Parameters:
showControls
- true to show- Returns:
- this layer
-
isDefaultHidden
public boolean isDefaultHidden()Get if this layer is hidden by default in the control box.- Returns:
- true if hidden by default
-
setDefaultHidden
Set if this layer is hidden by default in the control box.- Parameters:
defaultHidden
- true to hide by default- Returns:
- this layer
-
getPriority
public int getPriority()Get the indexed order for this layer in the control box.Falls back to alphanumeric ordering based on label if there are order conflicts.
- Returns:
- layer priority
-
setPriority
Set the indexed order for this layer in the control box.Falls back to alphanumeric ordering based on label if there are order conflicts.
- Parameters:
priority
- new priority- Returns:
- this layer
-
getZIndex
Get the z-index for this layer. Used in determining what layers are visually on top of other layers.Falls back to alphanumeric ordering based on name if there are order conflicts.
Defaults to '
' if null.getPriority()
- Returns:
- layer z-index
-
setZIndex
Set the z-index for this layer. Used in determining what layers are visually on top of other layers.Falls back to alphanumeric ordering based on name if there are order conflicts.
Defaults to '
' if null.getPriority()
- Parameters:
zIndex
- new z-index- Returns:
- this layer
-
getPane
Get the map pane for this layer.- Returns:
- map pane
-
setPane
Set the map pane for this layer.If the pane does not exist, it will be created the first time it is used.
- Parameters:
pane
- new map pane- Returns:
- this layer
-
getCss
Get the custom CSS to add for this layer.- Returns:
- custom CSS
-
setCss
Set the custom CSS to add for this layer.- Parameters:
css
- new custom CSS- Returns:
- this layer
-
isLiveUpdate
public @org.jspecify.annotations.Nullable boolean isLiveUpdate()Get if this layer gets pushed through sse.- Returns:
- true if being sent through sse
-
setLiveUpdate
Set whether to push this layer through sse.- Parameters:
liveUpdate
- true to push this layer through sse.- Returns:
- this layer
-
getMarkers
Get the markers to display in this Layer.- Returns:
- markers to display
-
toJson
public com.google.gson.JsonObject toJson()Description copied from interface:JsonSerializable
Jsonify this object.- Specified by:
toJson
in interfaceJsonSerializable
- Returns:
- object as json element
-
equals
-
hashCode
public int hashCode() -
toString
-