public class FLayers extends FLyrDefault implements LayerCollection, InfoByPoint, List<FLayer>
Represents a generic collection of layers, that can be represented as a node in a tree of nodes of layers.
Adapts the basic functionality implemented for a layer in the abstract class
FLyrDefault
, to a collection of layers, implementing, as well,
specific methods for this kind of object, defined in the interfaces
VectorialData
, LayerCollection
, and
InfoByPoint
.
FLyrDefault
Modifier and Type | Class and Description |
---|---|
static class |
FLayers.RegisterPersistence |
FLyrDefault.RegisterMetadata
Modifier and Type | Field and Description |
---|---|
protected MapContext |
fmap |
protected ArrayList |
layerCollectionListeners
List with all listeners registered for this kind of node.
|
protected List<FLayer> |
layers
A synchronized list with the layers.
|
layerListeners, metadataContainer
AFTER, BEFORE, BEGIN, END
METADATA_CRS, METADATA_DEFINITION_DESCRIPTION, METADATA_DEFINITION_NAME, METADATA_NAME
Constructor and Description |
---|
FLayers() |
Modifier and Type | Method and Description |
---|---|
void |
accept(LayersVisitor visitor) |
void |
accept(Visitor visitor)
Provides each value of this container to the provided
Visitor . |
boolean |
add(FLayer e) |
void |
add(int i,
FLayer e) |
boolean |
addAll(Collection clctn) |
boolean |
addAll(int i,
Collection clctn) |
void |
addLayer(DataStore store) |
void |
addLayer(FLayer layer)
Adds a new layer to this collection.
|
void |
addLayer(FLayer layer,
int where,
FLayer adjoiningLayer)
Adds a new layer to this collection before or after an element if supplied,
and if not at the beginning or end of the collection.
|
void |
addLayer(int pos,
FLayer layer)
Adds a layer in an specified position in this node.
|
void |
addLayerCollectionListener(LayerCollectionListener listener)
Adds a listener of events produced on a collection of layers.
|
boolean |
addLayerListener(LayerListener o)
Adds a
LayerListener to the listener list. |
void |
beginDraw(Graphics2D g,
ViewPort viewPort) |
protected void |
callLayerAdded(LayerCollectionEvent event)
Notifies all listeners associated to this collection of layers, that
another layer has been added or replaced in the internal list of layers.
|
protected void |
callLayerAdding(LayerCollectionEvent event)
Notifies all listeners associated to this collection of layers, that
another layer is going to be added or replaced in the internal list of
layers.
|
protected void |
callLayerMoved(LayerPositionEvent event)
Notifies all listeners associated to this collection of layers, that
another layer has been moved in the internal list of layers.
|
protected void |
callLayerMoving(LayerPositionEvent event)
Notifies all listeners associated to this collection of layers, that a
layer is going to be moved in the internal list of layers.
|
protected void |
callLayerRemoved(LayerCollectionEvent event)
Notifies all listeners associated to this collection of layers, that
another layer has been removed from the internal list of layers.
|
protected void |
callLayerRemoving(LayerCollectionEvent event)
Notifies all listeners associated to this collection of layers, that a
layer is going to be removed from the internal list of layers.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection clctn) |
Iterator |
deepiterator() |
protected void |
doDispose()
Internal implementation for the
AbstractDisposable.dispose() method, to be
implemented by child classes. |
void |
draw(BufferedImage image,
Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale)
Draws the layer using a buffer.
|
void |
endDraw(Graphics2D g,
ViewPort viewPort) |
FLayer |
get(int index) |
FLayer[] |
getActives()
Returns an array with all active layers in this collection.
|
FLayer |
getFirstActiveLayer() |
FLyrVect |
getFirstActiveVectorLayer() |
Envelope |
getFullEnvelope()
Returns the full extension of the layer node.
|
DynObjectSet |
getInfo(Point p,
double tolerance)
Executes a consultation about information of a point on the layer.
|
DynObjectSet |
getInfo(Point p,
double tolerance,
Cancellable cancel)
Executes a consultation about information of a point on the layer.
|
DynObjectSet |
getInfo(Point p,
double tolerance,
Cancellable cancel,
boolean fast)
Executes a consultation about information of a point on the layer.
|
FLayer |
getLayer(int index)
Returns the ith-output directed son (from bottom up) of this collection.
|
FLayer |
getLayer(String layerName)
Returns a first-level layer of this collection, using its name.
|
int |
getLayersCount()
Returns the number of layers that are at the first level inside this one.
|
MapContext |
getMapContext()
Returns a reference to the model of this layer, or null if this layer has no model.
|
double |
getMaxScale()
Returns the maximum scale visible.
|
Set |
getMetadataChildren()
Returns an unsorted set of child Metadata objects.
|
Object |
getMetadataID()
Returns the unique identifier of the Metadata.
|
String |
getMetadataName()
Returns the name of the Metadata, which allows to identify the type in
the Metadata registry.
|
double |
getMinScale()
Returns the minimum scale visible.
|
String |
getTocImageIcon()
Returns the image icon that will be shown in the TOC next to this layer.
|
FLayer[] |
getVisibles()
Returns an array with all visible layers in this collection.
|
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator |
iterator() |
void |
join(FLayer layer,
LayerCollection group) |
int |
lastIndexOf(Object o) |
ListIterator |
listIterator() |
ListIterator |
listIterator(int i) |
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
void |
move(FLayer layer,
LayerCollection group)
Moves a layer from this collection to the end of another collection.
|
void |
move(FLayer layer,
LayerCollection group,
int where,
FLayer adjoiningLayer)
Moves a layer from this collection to another collection
before or after an element if supplied,
and if not at the beginning or end of the collection.
|
void |
moveTo(int from,
int to)
Moves a layer of the collection to another position in internal list.
|
void |
print_old(Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale,
PrintAttributes properties) |
ComposedLayer |
print_old(Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale,
PrintAttributes properties,
ComposedLayer group)
Checks all layers (each one as a sub-node of this node collection of
layers) of this collection and draws their requested properties.
|
void |
print(Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale,
PrintAttributes properties)
Prints this layer according to some properties requested.
|
FLayer |
remove(int i) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection clctn) |
void |
removeLayer(FLayer lyr)
Removes a layer from this collection.
|
void |
removeLayer(int idLayer)
Removes a layer using its identifier.
|
void |
removeLayer(String layerName)
Removes a layer using its name.
|
void |
removeLayerCollectionListener(LayerCollectionListener listener)
Removes a listener of events produced on a collection of layers.
|
void |
replaceLayer(FLayer layer,
FLayer newLayer)
Replace a layer by another layer.
|
void |
replaceLayer(String layerName,
FLayer layer)
Deprecated.
|
boolean |
retainAll(Collection clctn) |
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
FLayer |
set(int i,
FLayer e) |
void |
setActive(boolean b)
Changes the status of this layer to active or inactive.
|
void |
setAllActives(boolean active)
Changes the status of all layers to active or inactive.
|
void |
setAllVisibles(boolean visible)
Changes the status of all layers to visible or invisible.
|
void |
setMapContext(MapContext mapContext)
Sets the
MapContext that contains this layer node. |
void |
setMaxScale(double maxScale)
Sets the maximum scale visible.
|
void |
setMinScale(double minScale)
Sets the minimum scale visible.
|
int |
size() |
List |
subList(int i,
int i1) |
Object[] |
toArray() |
Object[] |
toArray(Object[] ts) |
activationChanged, addError, addLegendListener, allowLinks, callEditionChanged, callLegendChanged, clear, cloneLayer, delegate, drawValueChanged, editionChanged, getClassName, getCoordTrans, getDrawVersion, getDynClass, getDynValue, getError, getErrors, getExtendedProperties, getFLayerStatus, getInfoString, getLayerListeners, getLink, getLinkProperties, getName, getNumErrors, getParentLayer, getProjection, getProperty, getTocStatusImage, getTransparency, hasChangedForDrawing, hasDynValue, hidesThisArea, implement, invokeDynMethod, invokeDynMethod, isActive, isAvailable, isEditing, isInTOC, isOk, isTemporary, isVisible, isWithinScale, isWritable, load, nameChanged, newComposedLayer, reload, removeLayerListener, removeLegendListener, reProject, setAvailable, setCoordTrans, setDynValue, setEditing, setError, setFLayerStatus, setInTOC, setName, setParentLayer, setProjection, setProperty, setTemporary, setTocStatusImage, setTransparency, setVisible, toString, updateDrawVersion, visibilityChanged, visibleRequired, wakeUp
dispose, dispose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clear, equals, hashCode, replaceAll, sort, spliterator
parallelStream, removeIf, stream
dispose
protected ArrayList layerCollectionListeners
protected MapContext fmap
public void addLayerCollectionListener(LayerCollectionListener listener)
LayerCollection
Adds a listener of events produced on a collection of layers.
addLayerCollectionListener
in interface LayerCollection
listener
- a LayerCollectionListener
LayerCollection.removeLayerCollectionListener(LayerCollectionListener)
public void setAllVisibles(boolean visible)
LayerCollection
Changes the status of all layers to visible or invisible.
setAllVisibles
in interface LayerCollection
visible
- a boolean valueLayerCollection.getVisibles()
public void removeLayerCollectionListener(LayerCollectionListener listener)
LayerCollection
Removes a listener of events produced on a collection of layers.
removeLayerCollectionListener
in interface LayerCollection
listener
- a LayerCollectionListener
LayerCollection.addLayerCollectionListener(LayerCollectionListener)
public void addLayer(FLayer layer)
LayerCollection
Adds a new layer to this collection.
addLayer
in interface LayerCollection
layer
- the new layerLayerCollection.removeLayer(FLayer)
,
LayerCollection.removeLayer(int)
,
LayerCollection.removeLayer(String)
public void addLayer(DataStore store)
public void addLayer(int pos, FLayer layer)
pos
- layer
- a layerpublic void moveTo(int from, int to) throws CancelationException
LayerCollection
Moves a layer of the collection to another position in internal list. It doesn't consider sub-nodes of layers.
moveTo
in interface LayerCollection
from
- origin positionto
- destination positionCancelationException
- any exception produced during the cancellation of the driver.public void removeLayer(FLayer lyr) throws CancelationException
LayerCollection
Removes a layer from this collection.
removeLayer
in interface LayerCollection
lyr
- a layerCancelationException
- any exception produced during the cancellation of the driver.LayerCollection.removeLayer(int)
,
LayerCollection.removeLayer(String)
,
LayerCollection.addLayer(FLayer)
public void removeLayer(int idLayer)
LayerCollection
Removes a layer using its identifier.
removeLayer
in interface LayerCollection
idLayer
- layer identifierLayerCollection.removeLayer(FLayer)
,
LayerCollection.removeLayer(String)
,
LayerCollection.addLayer(FLayer)
public void removeLayer(String layerName)
LayerCollection
Removes a layer using its name.
removeLayer
in interface LayerCollection
layerName
- the name of the layerLayerCollection.removeLayer(FLayer)
,
LayerCollection.removeLayer(int)
,
LayerCollection.addLayer(FLayer)
public void replaceLayer(String layerName, FLayer layer) throws LoadLayerException
replaceLayer(FLayer, FLayer)
layerName
- the name of the layer to be replacedlayer
- the new layerLoadLayerException
public void replaceLayer(FLayer layer, FLayer newLayer) throws LoadLayerException
layer
- the layer to be replacednewLayer
- the new layerLoadLayerException
public FLayer[] getVisibles()
LayerCollection
Returns an array with all visible layers in this collection.
getVisibles
in interface LayerCollection
null
if no there is no layer visibleLayerCollection.setAllVisibles(boolean)
public FLayer getLayer(int index)
LayerCollection
Returns the ith-output directed son (from bottom up) of this collection.
getLayer
in interface LayerCollection
index
- index of the ith-output layer in this collection.LayerCollection.getLayer(String)
public FLayer getLayer(String layerName)
LayerCollection
Returns a first-level layer of this collection, using its name.
getLayer
in interface LayerCollection
layerName
- name of a layer of this collectionLayerCollection.getLayer(int)
public int getLayersCount()
LayerCollection
Returns the number of layers that are at the first level inside this one.
Doesn't counts the sublayers (of FLayers
subnodes).
getLayersCount
in interface LayerCollection
LayerCollection.getLayer(int)
,
LayerCollection.getLayer(String)
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale) throws ReadException
FLayer
draw
in interface FLayer
image
- an image used to accelerate the screen drawg
- for rendering 2-dimensional shapes, text and images on the Java(tm) platformviewPort
- information for drawing this layercancel
- an object thread that implements the Cancellable
interface, and will allow to cancel the drawscale
- value that represents the scaleReadException
- if fails the driver used in this method.FLayer.print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties) throws ReadException
FLayer
print
in interface FLayer
g
- for rendering 2-dimensional shapes, text and images on the Java(tm) platformviewPort
- the information for drawing the layerscancel
- an object thread that implements the Cancellable
interface, and will allow to cancel the drawscale
- the scale of the view. Must be between FLayer.getMinScale() and FLayer.getMaxScale().properties
- a set with the settings to be applied to a whole print job and to all the docs in the print jobReadException
- if fails the driver used in this method.FLayer.draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
public void print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties) throws ReadException
ReadException
public ComposedLayer print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties, ComposedLayer group) throws ReadException
Checks all layers (each one as a sub-node of this node collection of
layers) of this collection and draws their requested properties. If a
node is a group of layers (ComposedLayer
), executes it's
drawn.
All nodes which could group with the composed layer group
,
will be drawn together. And once the
group
is drawn, will be set to null
if hasn't a
parent layer.
The particular implementation depends on the kind of each layer and
composed layer. And this process can be cancelled at any time by the
shared object cancel
.
According the print quality, labels will be printed in different resolution:
g
- for rendering 2-dimensional shapes, text and images on the
Java(tm) platformviewPort
- the information for drawing the layerscancel
- shared object that determines if this layer can continue
being drawnscale
- the scale of the view. Must be between
FLayer.getMinScale() and FLayer.getMaxScale().properties
- properties that will be printgroup
- a composed layer pending to paint; if this parameter is
null
, the composed layernull
if the layers in group
had been
drawn or were null
; otherwise, the group
ReadException
FLayer.print(Graphics2D, ViewPort, Cancellable, double,
PrintAttributes)
public Envelope getFullEnvelope()
FLayer
getFullEnvelope
in interface FLayer
protected void callLayerAdding(LayerCollectionEvent event) throws CancelationException
event
- a layer collection event with the new layerCancelationException
protected void callLayerRemoving(LayerCollectionEvent event) throws CancelationException
event
- a layer collection event with the layer being removedCancelationException
- any exception produced during the
cancellation of the driver.protected void callLayerMoving(LayerPositionEvent event) throws CancelationException
event
- a layer collection event with the layer being moved, and the
initial and final positionsCancelationException
- any exception produced during the
cancellation of the driver.protected void callLayerAdded(LayerCollectionEvent event)
event
- a layer collection event with the new layerprotected void callLayerRemoved(LayerCollectionEvent event)
event
- a layer collection event with the layer removedprotected void callLayerMoved(LayerPositionEvent event)
event
- a layer collection event with the layer moved, and the initial
and final positionspublic void saveToState(PersistentState state) throws PersistenceException
Persistent
saveToState
in interface Persistent
saveToState
in class FLyrDefault
PersistenceException
public void loadFromState(PersistentState state) throws PersistenceException
Persistent
loadFromState
in interface Persistent
loadFromState
in class FLyrDefault
PersistenceException
public MapContext getMapContext()
FLayer
Returns a reference to the model of this layer, or null if this layer has no model.
getMapContext
in interface FLayer
getMapContext
in class FLyrDefault
public void setAllActives(boolean active)
LayerCollection
Changes the status of all layers to active or inactive.
setAllActives
in interface LayerCollection
active
- a boolean valueLayerCollection.getActives()
public FLayer[] getActives()
LayerCollection
Returns an array with all active layers in this collection.
getActives
in interface LayerCollection
null
if no there is no layer activedLayerCollection.setAllActives(boolean)
public double getMinScale()
FLayer
getMinScale
in interface FLayer
getMinScale
in class FLyrDefault
FLayer.setMinScale(double)
public double getMaxScale()
FLayer
getMaxScale
in interface FLayer
getMaxScale
in class FLyrDefault
FLayer.setMaxScale(double)
public void setMinScale(double minScale)
FLayer
setMinScale
in interface FLayer
setMinScale
in class FLyrDefault
minScale
- the scale > 0, -1 if not definedFLayer.getMinScale()
public void setMaxScale(double maxScale)
FLayer
setMaxScale
in interface FLayer
setMaxScale
in class FLyrDefault
maxScale
- the scale > 0, -1 if not definedFLayer.getMaxScale()
public void setActive(boolean b)
FLayer
Changes the status of this layer to active or inactive.
One layer is active if is selected in TOC.
setActive
in interface FLayer
setActive
in class FLyrDefault
b
- the boolean to be setFLayer.isActive()
public boolean addLayerListener(LayerListener o)
FLayer
LayerListener
to the listener list.addLayerListener
in interface FLayer
addLayerListener
in class FLyrDefault
o
- a layer listenertrue
if hasn't been any problem during the insertion of the listenerFLayer.getLayerListeners()
,
FLayer.removeLayerListener(LayerListener)
public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel) throws LoadLayerException, DataException
InfoByPoint
Executes a consultation about information of a point on the layer.
There is an area around the point where will got the information.
getInfo
in interface InfoByPoint
p
- point where is the consultationtolerance
- permissible margin around the coordinates of the point where
the method will got the information. Each
singular implementation of this method would use it in a
different way. The coordinates also depend on the
implementation.cancel
- shared object that determines if this layer can continue being
drawnLoadLayerException
- any exception produced using the driver.DataException
- TODOpublic DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel, boolean fast) throws LoadLayerException, DataException
InfoByPoint
Executes a consultation about information of a point on the layer.
There is an area around the point where will got the information.
getInfo
in interface InfoByPoint
p
- point where is the consultationtolerance
- permissible margin around the coordinates of the point where
the method will got the information. Each
singular implementation of this method would use it in a
different way. The coordinates also depend on the
implementation.cancel
- shared object that determines if this layer can continue being
drawnfast
- if true try to reuse objects as much as possible to make the
object iteration faster. If true, DynObjects got through the
returned set must not be stored unless cloned.LoadLayerException
- any exception produced using the driver.DataException
- TODOpublic DynObjectSet getInfo(Point p, double tolerance) throws LoadLayerException, DataException
InfoByPoint
Executes a consultation about information of a point on the layer.
There is an area around the point where will got the information.
getInfo
in interface InfoByPoint
p
- point in map coordinates where is the consultationtolerance
- permissible margin around the coordinates of the point where
the method will got the information. Each
singular implementation of this method would use it in a
different way. The unit are in map coordinates.LoadLayerException
DataException
public String getTocImageIcon()
FLayer
getTocImageIcon
in interface FLayer
getTocImageIcon
in class FLyrDefault
null
if there isn't anypublic void setMapContext(MapContext mapContext)
Sets the MapContext
that contains this layer node.
mapContext
- the MapContext
that contains this layer
nodepublic void accept(Visitor visitor) throws BaseException
Visitable
Visitor
.accept
in interface Visitable
visitor
- the visitor to apply to each value.BaseException
- if there is an error while performing the visitpublic void accept(LayersVisitor visitor) throws BaseException
accept
in interface LayersVisitable
BaseException
public Object getMetadataID() throws MetadataException
Metadata
getMetadataID
in interface Metadata
MetadataException
public Set getMetadataChildren()
Metadata
getMetadataChildren
in interface Metadata
public String getMetadataName() throws MetadataException
Metadata
getMetadataName
in interface Metadata
getMetadataName
in class FLyrDefault
MetadataException
public void beginDraw(Graphics2D g, ViewPort viewPort)
beginDraw
in interface LayerCollection
public void endDraw(Graphics2D g, ViewPort viewPort)
endDraw
in interface LayerCollection
protected void doDispose() throws BaseException
AbstractDisposable
AbstractDisposable.dispose()
method, to be
implemented by child classes.doDispose
in class AbstractDisposable
BaseException
AbstractDisposable.dispose()
public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException
LayerCollection
Moves a layer from this collection to another collection before or after an element if supplied, and if not at the beginning or end of the collection.
move
in interface LayerCollection
layer
- a FLayer to movegroup
- a LayerCollection in which the layer has to be movedwhere
- the position parameter. The valid values are:adjoiningLayer
- a FLayer a layer adjacent to where to insert the layer.LayerNotFoundInCollectionException
LayerCollection.addLayer(FLayer, int, FLayer)
public void join(FLayer layer, LayerCollection group)
public void move(FLayer layer, LayerCollection group)
LayerCollection
Moves a layer from this collection to the end of another collection.
move
in interface LayerCollection
layer
- a FLayer to movegroup
- a LayerCollection in which the layer has to be movedpublic void addLayer(FLayer layer, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException
LayerCollection
Adds a new layer to this collection before or after an element if supplied, and if not at the beginning or end of the collection.
.addLayer
in interface LayerCollection
layer
- a FLayer to movewhere
- the position parameter. The valid values are:adjoiningLayer
- a FLayer a layer adjacent to where to insert the layer.LayerNotFoundInCollectionException
#moveTo(FLayer, LayerCollection, int, FLayer)
public FLayer getFirstActiveLayer()
public FLyrVect getFirstActiveVectorLayer()
public Iterator iterator()
public Iterator deepiterator()
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public boolean add(FLayer e)
public boolean remove(Object o)
public boolean containsAll(Collection clctn)
containsAll
in interface Collection<FLayer>
containsAll
in interface List<FLayer>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<FLayer>
public ListIterator listIterator()
listIterator
in interface List<FLayer>
public ListIterator listIterator(int i)
listIterator
in interface List<FLayer>
public boolean addAll(Collection clctn)
public boolean addAll(int i, Collection clctn)
public boolean removeAll(Collection clctn)
public boolean retainAll(Collection clctn)