public abstract class IlvLayerVisibilityFilter extends Object implements IlvPersistentObject, Serializable
IlvManagerLayer.addVisibilityFilter(ilog.views.IlvLayerVisibilityFilter)
method.
Once the filter is installed, the method isVisible
of the filter is called each time the layer of the manager needs
to be redrawn.
If this method returns true
then the contents
of the layer will be drawn. If the method returns
false
then nothing will be drawn.
Note that the method will not be called when the
layer has been set as invisible for all or for one
view.isPersistent
in the subclass must return true
.
In this case, the subclass must be public
,
because classes from the ilog.views
package must be able to write and read the filter.
The subclass must provide a constructor with an IlvInputStream
argument and must override the write
method if some specific
data is to be stored.
Here is a small example that shows how to control that a layer will be visible only when the zoom level is less than 400%:
layer.addVisibilityFilter( new IlvLayerVisibilityFilter() { public boolean isVisible(IlvManagerLayer l, IlvManagerView v) { return v.getTransformer().getx11() < 4; } public boolean isPersistent() { return false; } });
Constructor and Description |
---|
IlvLayerVisibilityFilter()
Creates a new
IlvLayerVisibilityFilter . |
IlvLayerVisibilityFilter(IlvInputStream stream)
Creates a new
IlvLayerVisibilityFilter from
an IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
isPersistent()
Tells if the filter must be saved to an IVL file.
|
abstract boolean |
isVisible(IlvManagerLayer layer,
IlvManagerView view)
Checks the visibility of
a layer.
|
void |
write(IlvOutputStream stream)
Writes the filter to an
IlvOutputStream . |
public IlvLayerVisibilityFilter()
IlvLayerVisibilityFilter
.public IlvLayerVisibilityFilter(IlvInputStream stream) throws IlvReadFileException
IlvLayerVisibilityFilter
from
an IlvInputStream
. Note that you must provide
an overridden version of this method in your subclass if some
specific data is to be read from the input stream.stream
- the input stream from which the filter must be read.IlvReadFileException
- if an error occurs while reading.public abstract boolean isVisible(IlvManagerLayer layer, IlvManagerView view)
true
then the contents
of the layer will be drawn. If the method returns
false
then nothing will be drawn.
Note that the method will not be called when the
layer has been set as invisible for all or for one
view.public abstract boolean isPersistent()
true
, the filter
is saved; otherwise it is not saved.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
stream
- the output stream. You must override this method
if specific data is to be stored. Note that the first instruction
in your implementation of the method must be
super.write(stream)
.IOException
- standard IO error.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.