Package org.openstreetmap.josm.gui.layer
Interface LayerPositionStrategy
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface LayerPositionStrategy
This class defines a position to insert a given layer in the list of layers.- Since:
- 10008, 10592 functional interface
-
-
Field Summary
Fields Modifier and Type Field Description static LayerPositionStrategy
AFTER_LAST_DATA_LAYER
A GPX layer is added below the lowest data layer.static LayerPositionStrategy
AFTER_LAST_VALIDATION_LAYER
A normal layer is added after all validation layers.static LayerPositionStrategy
BEFORE_FIRST_BACKGROUND_LAYER
The default for background layers: They are added before the first background layer in the list.static LayerPositionStrategy
IN_FRONT
always inserts at the front of the stack.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static LayerPositionStrategy
afterLast(java.util.function.Predicate<Layer> what)
Creates a strategy that places the layer after the last layer of a given kind or at the beginning of the list if no such layer exists.int
getPosition(LayerManager manager)
Gets the position where the layer should be insertedstatic LayerPositionStrategy
inFrontOf(Layer other)
Gets aLayerPositionStrategy
that inserts this layer in front of a given layerstatic LayerPositionStrategy
inFrontOfFirst(java.util.function.Predicate<Layer> what)
Gets aLayerPositionStrategy
that inserts the layer in front of the first layer that matches a condition.
-
-
-
Field Detail
-
IN_FRONT
static final LayerPositionStrategy IN_FRONT
always inserts at the front of the stack.
-
AFTER_LAST_DATA_LAYER
static final LayerPositionStrategy AFTER_LAST_DATA_LAYER
A GPX layer is added below the lowest data layer.
-
AFTER_LAST_VALIDATION_LAYER
static final LayerPositionStrategy AFTER_LAST_VALIDATION_LAYER
A normal layer is added after all validation layers.
-
BEFORE_FIRST_BACKGROUND_LAYER
static final LayerPositionStrategy BEFORE_FIRST_BACKGROUND_LAYER
The default for background layers: They are added before the first background layer in the list. If there is none, they are added at the end of the list.
-
-
Method Detail
-
inFrontOf
static LayerPositionStrategy inFrontOf(Layer other)
Gets aLayerPositionStrategy
that inserts this layer in front of a given layer- Parameters:
other
- The layer before which to insert this layer- Returns:
- The strategy
-
inFrontOfFirst
static LayerPositionStrategy inFrontOfFirst(java.util.function.Predicate<Layer> what)
Gets aLayerPositionStrategy
that inserts the layer in front of the first layer that matches a condition.- Parameters:
what
- The condition to match.- Returns:
- The strategy.
-
afterLast
static LayerPositionStrategy afterLast(java.util.function.Predicate<Layer> what)
Creates a strategy that places the layer after the last layer of a given kind or at the beginning of the list if no such layer exists.- Parameters:
what
- what to search for- Returns:
- The strategy.
-
getPosition
int getPosition(LayerManager manager)
Gets the position where the layer should be inserted- Parameters:
manager
- The layer manager to insert the layer in.- Returns:
- The position in the range 0...layers.size
-
-