public class TLcyGXYLayerOrderManager extends Object implements ILcyGXYLayerOrderManager
Implementation of ILcyGXYLayerOrderManager
that orders the layers of a given
ILcyMapComponent
based on their ILcyGXYLayerType
and their
ILcyModelContentType
.
Layers whose layer type is ILcyGXYLayerType.REALTIME
are kept above all other layers. Additionally,
to optimize performance, the ILcdGXYView.setNumberOfCachedBackgroundLayers
flag is automatically updated
to be the total layer count minus the amount of those layers. So the REALTIME
layers aren't cached to
allow them to refresh often.
The remaining layers are sorted on their ILcyModelContentType
(the constant values). Layers having the
same model content type, are sorted on the ILcyGXYLayerType
(except REALTIME
layers, which are
kept above all others, as explained above).
Note that this ordering is only approximate when layers are also moved otherwise, for example in a layer control GUI.
This class works actively and passively. It works actively when a layer is added using insertGXYLayer. It works
passively in the sense that it listens to the associated ILcdGXYView
to detect the addition of new
layers. When a new layer is added, it is moved to the correct position.
Constructor and Description |
---|
TLcyGXYLayerOrderManager(ILcyLucyEnv aLucyEnv,
ILcyMapComponent aMapComponent)
Creates a new
TLcyGXYLayerOrderManager . |
Modifier and Type | Method and Description |
---|---|
boolean |
canMoveGXYLayerDown(ILcdGXYLayer aGXYLayer)
Returns true if the given gxy layer can be moved down without violating
the layer ordering.
|
boolean |
canMoveGXYLayerUp(ILcdGXYLayer aGXYLayer)
Returns true if the given gxy layer can be moved up without violating the
layer ordering.
|
ILcdGXYView |
getGXYView()
Return the gxy view associated with this layer order manager.
|
void |
insertGXYLayer(ILcdGXYLayer aGXYLayer,
int aGXYLayerType,
int aModelType)
Method to insert the given layer to the given gxy view.
|
void |
moveLayerBottom(ILcdGXYLayer aGXYLayer)
Moves the given layer to the bottom of the view, but respects the layer
ordering.
|
void |
moveLayerDown(ILcdGXYLayer aGXYLayer)
Moves the given layer downwards.
|
void |
moveLayerTop(ILcdGXYLayer aGXYLayer)
Moves the given layer to the top of the view, but respects the layer
ordering.
|
void |
moveLayerUp(ILcdGXYLayer aGXYLayer)
Moves the given layer upwards.
|
public TLcyGXYLayerOrderManager(ILcyLucyEnv aLucyEnv, ILcyMapComponent aMapComponent)
TLcyGXYLayerOrderManager
.aLucyEnv
- The Lucy environment.aMapComponent
- The ILcyMapComponent
on which this ILcyGXYLayerOrderManager
should
operate.public ILcdGXYView getGXYView()
ILcyGXYLayerOrderManager
getGXYView
in interface ILcyGXYLayerOrderManager
public void insertGXYLayer(ILcdGXYLayer aGXYLayer, int aGXYLayerType, int aModelType)
This method will try to determine the correct layer and model content type when called with
ILcyGXYLayerType#UNKNOWN
as layer type and ILcyModelContentType#UNKNOWN
as
model type. Once the model and layer type are determined, it will not be changed anymore.
insertGXYLayer
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to insert.aGXYLayerType
- The layer type of the layer.aModelType
- The model type of the model of the layer.public boolean canMoveGXYLayerUp(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerOrderManager
canMoveGXYLayerUp
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to test.public boolean canMoveGXYLayerDown(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerOrderManager
canMoveGXYLayerDown
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to test.public void moveLayerUp(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerOrderManager
This method should only be called if canMoveGXYLayerUp for the same layer returns true.
moveLayerUp
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to move.ILcyGXYLayerOrderManager.canMoveGXYLayerUp(com.luciad.view.gxy.ILcdGXYLayer)
public void moveLayerDown(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerOrderManager
This method should only be called if canMoveGXYLayerDown for the same layer returns true.
moveLayerDown
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to move.ILcyGXYLayerOrderManager.canMoveGXYLayerDown(com.luciad.view.gxy.ILcdGXYLayer)
public void moveLayerTop(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerOrderManager
This method should only be called if canMoveGXYLayerUp for the same layer returns true.
moveLayerTop
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to move.ILcyGXYLayerOrderManager.canMoveGXYLayerUp(com.luciad.view.gxy.ILcdGXYLayer)
public void moveLayerBottom(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerOrderManager
This method should only be called if canMoveGXYLayerDown for the same layer returns true.
moveLayerBottom
in interface ILcyGXYLayerOrderManager
aGXYLayer
- The layer to move.ILcyGXYLayerOrderManager.canMoveGXYLayerDown(com.luciad.view.gxy.ILcdGXYLayer)