public abstract class FLyrDefault extends AbstractDisposable implements FLayer, FLayerHidesArea, LayerListener
Implementation of the common characteristics of all layers: visibility, activation, name, ...
Represents the definition of a basic layer, implementing
FLayer, and new functionality:
Each graphical layer will inherit from this class and adapt to its particular logic and model according its nature.
FLayer,
FLayerStatus| Modifier and Type | Class and Description |
|---|---|
static class |
FLyrDefault.RegisterMetadata |
static class |
FLyrDefault.RegisterPersistence |
| Modifier and Type | Field and Description |
|---|---|
protected long |
drawVersion
Draw version of the context.
|
protected java.util.Set<LayerListener> |
layerListeners
Array list with all listeners registered to this layer.
|
protected MetadataContainer |
metadataContainer |
protected ExtendedPropertiesHelper |
properties |
METADATA_CRS, METADATA_DEFINITION_DESCRIPTION, METADATA_DEFINITION_NAME, METADATA_NAME| Constructor and Description |
|---|
FLyrDefault() |
FLyrDefault(MetadataContainer metadataContainer) |
| Modifier and Type | Method and Description |
|---|---|
void |
activationChanged(LayerEvent e)
Called when the activation of a layer has changed.
|
void |
addError(java.lang.Throwable exception)
Adds an error reason that describes this layer's wrong status.
|
boolean |
addLayerListener(LayerListener o)
Adds a
LayerListener to the listener list. |
void |
addLegendListener(LegendListener listener) |
boolean |
allowLinks()
Alwais return false
|
protected void |
callEditionChanged(LayerEvent e)
Called by some version of the method setEditing(boolean)
overwritten.
|
protected void |
callLegendChanged(LegendChangedEvent e) |
void |
clear() |
FLayer |
cloneLayer()
This method can be used to have a fast cloned layer.
|
void |
delegate(DynObject dynObject) |
void |
drawValueChanged(LayerEvent e)
Called when a draw value of a layer has changed.
|
void |
editionChanged(LayerEvent e)
Called when the edition of a layer has changed.
|
java.lang.String |
getClassName() |
ICoordTrans |
getCoordTrans()
Returns the transformation coordinates of this layer.
|
int |
getDefaultTolerance()
Returns layer tolerance in pixels
|
long |
getDrawVersion() |
DynClass |
getDynClass() |
java.lang.Object |
getDynValue(java.lang.String name) |
java.lang.Throwable |
getError(int i)
Returns the specified error.
|
java.util.List<java.lang.Throwable> |
getErrors()
Returns a list with all layer errors.
|
java.util.Map |
getExtendedProperties()
Returns a hash map with all new properties associated to this layer.
|
FLayerStatus |
getFLayerStatus()
Returns the status of this layer.
|
java.lang.String |
getInfoString()
Returns an string with the information of this layer.
|
LayerListener[] |
getLayerListeners()
Returns all
LayerListeners of this layer as an array. |
java.net.URI[] |
getLink(java.awt.geom.Point2D point,
double tolerance)
alwais return null
|
AbstractLinkProperties |
getLinkProperties()
Alwais return null.
|
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.
|
java.lang.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.
|
java.lang.String |
getName()
Returns the name of this layer.
|
int |
getNumErrors()
Returns the number of errors which causes this layer to be in unavailable status.
|
FLayers |
getParentLayer()
Returns the parent
FLayers node of this layer. |
IProjection |
getProjection()
Returns the current projection.
|
java.lang.Object |
getProperty(java.lang.Object key)
Returns a reference to an object (property) associated to this layer.
|
java.lang.String |
getTocImageIcon()
Returns the image icon that will be shown in the TOC next to this layer.
|
java.awt.Image |
getTocStatusImage()
Returns the image icon that will be shown in the TOC next to this layer, according its status.
|
int |
getTransparency()
Returns the transparency level of this layer, in the range 0-255 .
|
boolean |
hasChangedForDrawing(long value) |
boolean |
hasDynValue(java.lang.String name) |
boolean |
hidesThisArea(Envelope area) |
void |
implement(DynClass dynClass) |
void |
invalidate() |
java.lang.Object |
invokeDynMethod(int code,
java.lang.Object[] args) |
java.lang.Object |
invokeDynMethod(java.lang.String name,
java.lang.Object[] args) |
boolean |
isActive()
Returns if this layer is active or not in TOC.
|
boolean |
isAvailable()
Returns the status of availability of this layer.
|
boolean |
isEditing()
Returns if this layer is editable.
|
boolean |
isInTOC()
Returns if this layer appears in the TOC.
|
boolean |
isOk()
Returns if this layer hasn't got errors.
|
boolean |
isTemporary() |
boolean |
isVisible()
Returns if this layer is visible and available.
|
boolean |
isWithinScale(double scale)
Returns if the value of
scale argument
is within the maximum and minimum scale of this layer. |
boolean |
isWritable()
Returns the writing status of this layer.
|
void |
load()
Executes the initialization operations of this layer.
|
void |
loadFromState(PersistentState state)
Set the state of the object from the state passed as parameter.
|
void |
nameChanged(LayerEvent e)
Called when the name of a layer has changed.
|
ComposedLayer |
newComposedLayer()
Returns a new instance of
ComposedLayer. |
void |
reload()
Tries recover a layer of a possible error.
|
boolean |
removeLayerListener(LayerListener o)
Removes the
LayerListener argument from this layer. |
void |
removeLegendListener(LegendListener listener) |
void |
reProject(ICoordTrans arg0)
Changes the projection of this layer.
|
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setActive(boolean selected)
Changes the status of this layer to active or inactive.
|
void |
setAvailable(boolean available)
Changes the status of availability of this layer.
|
void |
setCoordTrans(ICoordTrans ct)
Sets transformation coordinates for this layer.
|
void |
setDynValue(java.lang.String name,
java.lang.Object value) |
void |
setEditing(boolean b)
Do nothing.
|
void |
setError(java.lang.Throwable ex) |
void |
setFLayerStatus(FLayerStatus status)
Sets the status of this layer.
|
void |
setInTOC(boolean b)
Sets that this layer appears or not in the TOC.
|
void |
setMaxScale(double maxScale)
Sets the maximum scale visible.
|
void |
setMinScale(double minScale)
Sets the minimum scale visible.
|
void |
setName(java.lang.String name)
Sets a name to this layer.
|
void |
setParentLayer(FLayers root)
Inserts the parent
FLayers node of the layer. |
void |
setProjection(IProjection proj)
Inserts the projection to this layer.
|
void |
setProperty(java.lang.Object key,
java.lang.Object val)
Inserts an object as a property to this layer.
|
void |
setTemporary(boolean temporary) |
void |
setTocStatusImage(java.awt.Image tocStatusImage)
Inserts the image icon that will be shown in the TOC next to this layer,
according its status.
|
void |
setTransparency(int trans)
Inserts the transparency level for this layer, the range allowed is 0-255
.
|
void |
setVisible(boolean visibility)
Changes the status of this layer to visible or not.
|
java.lang.String |
toString() |
protected void |
updateDrawVersion() |
protected void |
updateDrawVersion(boolean fireEvents) |
void |
visibilityChanged(LayerEvent e)
Called when the visibility of a layer has changed.
|
boolean |
visibleRequired()
Returns
true if this layer has the visible status enabled. |
void |
wakeUp()
Deprecated.
no deberia ser necesario llamar a esto, la capa debe
comportarse correctamente sin necesidad de llamarlo.
|
dispose, dispose, doDisposeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdraw, getFullEnvelope, printgetMetadataChildren, getMetadataIDdisposeprotected java.util.Set<LayerListener> layerListeners
protected MetadataContainer metadataContainer
protected long drawVersion
getDrawVersion,
updateDrawVersionprotected ExtendedPropertiesHelper properties
public FLyrDefault(MetadataContainer metadataContainer)
public FLyrDefault()
public java.lang.Object getProperty(java.lang.Object key)
ExtendedPropertiesSupportReturns a reference to an object (property) associated to this layer.
For example, you can attach a network definition to key "network" and check if a layer has a network loaded using getAssociatedObject("network") and that it's not null.
getProperty in interface ExtendedPropertiesSupportkey - the key associated to the propertynull if key is not foundExtendedPropertiesSupport.getExtendedProperties(),
ExtendedPropertiesSupport.setProperty(Object, Object)public void setProperty(java.lang.Object key,
java.lang.Object val)
ExtendedPropertiesSupportsetProperty in interface ExtendedPropertiesSupportkey - the key associated to the propertyval - the propertyExtendedPropertiesSupport.getProperty(Object),
ExtendedPropertiesSupport.getExtendedProperties()public java.util.Map getExtendedProperties()
ExtendedPropertiesSupportgetExtendedProperties in interface ExtendedPropertiesSupportExtendedPropertiesSupport.getProperty(Object),
ExtendedPropertiesSupport.setProperty(Object, Object)public void setActive(boolean selected)
FLayerChanges the status of this layer to active or inactive.
One layer is active if is selected in TOC.
setActive in interface FLayerselected - the boolean to be setFLayer.isActive()public boolean isActive()
FLayerReturns if this layer is active or not in TOC.
One layer is active if is selected in TOC.
isActive in interface FLayertrue if this layer is active; false otherwiseFLayer.setActive(boolean)public void setName(java.lang.String name)
FLayersetName in interface FLayername - the string that is to be this layer's nameFLayer.getName()public java.lang.String getName()
FLayergetName in interface FLayerFLayer.setName(String)public void load()
throws LoadLayerException
FLayerExecutes the initialization operations of this layer. This method is invoked only one time during the life of this layer and just before visualize it.
load in interface FLayerLoadLayerException - if fails loading the layer.FLayer.reload()public void setVisible(boolean visibility)
FLayerChanges the status of this layer to visible or not.
One layer is visible if it's check box associated is selected. This means
that layer will tried to be painted. If the data associated isn't available,
then this property will change to false.
setVisible in interface FLayervisibility - the boolean to be setFLayer.isVisible(),
FLayer.visibleRequired(),
FLayer.isAvailable()public boolean isVisible()
FLayerReturns if this layer is visible and available.
One layer is visible if it's check box associated is selected. This means that layer will tried to be painted.
One layer is available if the source of data is on-line.
It's probably that one layer selected hadn't available it's data, for example in a remote service.
isVisible in interface FLayertrue if this layer is visible and available; false otherwiseFLayer.isAvailable(),
FLayer.setAvailable(boolean),
FLayer.visibleRequired()public FLayers getParentLayer()
FLayerFLayers node of this layer.getParentLayer in interface FLayernull if hasn't parentFLayer.setParentLayer(FLayers)public void setParentLayer(FLayers root)
FLayerFLayers node of the layer.setParentLayer in interface FLayerroot - a FLayers objectFLayer.getParentLayer()public void setProjection(IProjection proj)
setProjection in interface FLayerproj - information about the new projection#isReprojectable(),
#reProject(MapControl)public IProjection getProjection()
ProjectedReturns the current projection.
getProjection in interface ProjectedProjected.reProject(ICoordTrans)public void reProject(ICoordTrans arg0)
Changes the projection of this layer.
This method will be overloaded in each kind of layer, according its specific nature.
reProject in interface Projectedarg0 - #isReprojectable(),
setProjection(IProjection)public int getTransparency()
setTransparency(int)public void setTransparency(int trans)
trans - the transparency levelgetTransparency()public MapContext getMapContext()
FLayerReturns a reference to the model of this layer, or null if this layer has no model.
getMapContext in interface FLayerpublic boolean addLayerListener(LayerListener o)
FLayerLayerListener to the listener list.addLayerListener in interface FLayero - a layer listenertrue if hasn't been any problem during the insertion of the listenerFLayer.getLayerListeners(),
FLayer.removeLayerListener(LayerListener)public LayerListener[] getLayerListeners()
FLayerLayerListeners of this layer as an array.getLayerListeners in interface FLayerFLayer.addLayerListener(LayerListener),
FLayer.removeLayerListener(LayerListener)public boolean removeLayerListener(LayerListener o)
FLayerLayerListener argument from this layer.removeLayerListener in interface FLayero - a layer listenertrue if hasn't been any problem doing this processFLayer.addLayerListener(LayerListener),
FLayer.getLayerListeners()public void setCoordTrans(ICoordTrans ct)
setCoordTrans in interface FLayerct - an object that implements the ICoordTrans
interface, and with the transformation coordinatesgetCoordTrans()public ICoordTrans getCoordTrans()
getCoordTrans in interface FLayerICoordTrans interface,
and with the transformation coordinatessetCoordTrans(ICoordTrans)public void wakeUp()
throws LoadLayerException
Method called by FLayers to notify this layer that is
going to be added.This previous notification is useful for the layers
that need do something before being added. For example, the raster needs
reopen a file that could have been closed recently.
LoadLayerExceptionpublic double getMinScale()
FLayergetMinScale in interface FLayerFLayer.setMinScale(double)public double getMaxScale()
FLayergetMaxScale in interface FLayerFLayer.setMaxScale(double)public void setMinScale(double minScale)
FLayersetMinScale in interface FLayerminScale - the scale > 0, -1 if not definedFLayer.getMinScale()public void setMaxScale(double maxScale)
FLayersetMaxScale in interface FLayermaxScale - the scale > 0, -1 if not definedFLayer.getMaxScale()public boolean isWithinScale(double scale)
FLayerReturns if the value of scale argument
is within the maximum and minimum scale of this layer.
isWithinScale in interface FLayerscale - the scale > 0true if the scale argument is within the range of scales of this layer; false otherwiseFLayer.setMinScale(double),
FLayer.setMaxScale(double)public void setEditing(boolean b)
throws StartEditionLayerException
FLayersetEditing in interface FLayerStartEditionLayerExceptionprotected void callEditionChanged(LayerEvent e)
e - a layer event with the name of the property that has changedsetEditing(boolean)public boolean isEditing()
FLayerReturns if this layer is editable.
One layer is editable if user can modify its information with graphical tools.
isEditing in interface FLayertrue if this layer is editable; false otherwiseFLayer.setEditing(boolean)public java.lang.String getTocImageIcon()
FLayergetTocImageIcon in interface FLayernull if there isn't anypublic boolean isInTOC()
FLayerReturns if this layer appears in the TOC.
If doesn't appears, remains in the view and in the project.
public void setInTOC(boolean b)
FLayerSets that this layer appears or not in the TOC.
public boolean isAvailable()
FLayerReturns the status of availability of this layer.
One layer is available if the source of data is on-line.
isAvailable in interface FLayertrue if the source of data is on-line; false otherwiseFLayer.setAvailable(boolean),
FLayer.isVisible()public void setAvailable(boolean available)
FLayerChanges the status of availability of this layer.
One layer is available if the source of data is on-line.
setAvailable in interface FLayeravailable - the boolean to be setFLayer.isAvailable()public void reload()
throws ReloadLayerException
FLayerTries recover a layer of a possible error.
If it has any problem during the load, marks the availability to false and throws an exception.
reload in interface FLayerReloadLayerException - if it's thrown a ReadException or an
IOException during the load of this layer.FLayer.load()public FLayerStatus getFLayerStatus()
FLayergetFLayerStatus in interface FLayerFLayerStatus objectFLayer.setFLayerStatus(FLayerStatus)public void setFLayerStatus(FLayerStatus status)
FLayersetFLayerStatus in interface FLayerstatus - information of the status for this layerFLayer.getFLayerStatus()public boolean isOk()
FLayerReturns if this layer hasn't got errors.
public int getNumErrors()
FLayergetNumErrors in interface FLayerFLayer.getError(int),
FLayer.getErrors()public java.lang.Throwable getError(int i)
FLayergetError in interface FLayeri - index of the error >= 0 && < getNumErrorsFLayer.getNumErrors(),
FLayer.getErrors()public java.util.List<java.lang.Throwable> getErrors()
FLayergetErrors in interface FLayerArrayList with the errorsFLayer.getError(int),
FLayer.getNumErrors()public void addError(java.lang.Throwable exception)
FLayeraddError in interface FLayerexception - a BaseException with the information of the errorFLayer.getNumErrors(),
FLayer.getError(int),
FLayer.getErrors()public boolean visibleRequired()
FLayertrue if this layer has the visible status enabled.visibleRequired in interface FLayertrue if visible this layer has the visible status enabled, otherwise falseFLayer.isVisible(),
FLayer.setVisible(boolean)public java.lang.String getInfoString()
FLayergetInfoString in interface FLayerpublic boolean isWritable()
FLayerReturns the writing status of this layer.
One layer is writable if there is a writing driver for this layer.
isWritable in interface FLayertrue if there is a writing driver for this layer; false otherwisepublic FLayer cloneLayer() throws java.lang.Exception
FLayerThis method can be used to have a fast cloned layer.
The implementations should take care of not recreate this layer. Instead of this, is better to use the same source (driver) and deepclone the legend. Exception: the labels aren't deepcloned to avoid memory consumption.
Note: Labels are memory consuming to speed up layers like PostGIS and so on.
cloneLayer in interface FLayerjava.lang.Exception - any exception produced during the cloning of this layer.public java.awt.Image getTocStatusImage()
FLayergetTocStatusImage in interface FLayerpublic void setTocStatusImage(java.awt.Image tocStatusImage)
tocStatusImage - the imagegetTocStatusImage()public ComposedLayer newComposedLayer()
FLayerReturns a new instance of ComposedLayer.
This allows make a single draw for a group of layers with the same source.
If this operation isn't applicable for this kind of layer, this method returns null.
By default this operation is not supported.
newComposedLayer in interface FLayernull if not supportedComposedLayerpublic boolean allowLinks()
FLayerallowLinks in interface FLayerpublic AbstractLinkProperties getLinkProperties()
FLayergetLinkProperties in interface FLayerpublic java.net.URI[] getLink(java.awt.geom.Point2D point,
double tolerance)
throws ReadException
FLayergetLink in interface FLayerReadExceptionpublic void addLegendListener(LegendListener listener)
protected void callLegendChanged(LegendChangedEvent e)
e - LayerChangeSupport.callLegendChanged(LegendChangedEvent)public void removeLegendListener(LegendListener listener)
listener - LayerChangeSupport.removeLayerListener(LegendListener)public java.lang.String getClassName()
public DynClass getDynClass()
getDynClass in interface DynObjectpublic java.lang.Object getDynValue(java.lang.String name)
throws DynFieldNotFoundException
getDynValue in interface DynObjectDynFieldNotFoundExceptionpublic boolean hasDynValue(java.lang.String name)
hasDynValue in interface DynObjectpublic java.lang.Object invokeDynMethod(int code,
java.lang.Object[] args)
throws DynMethodException
invokeDynMethod in interface DynObjectDynMethodExceptionpublic java.lang.Object invokeDynMethod(java.lang.String name,
java.lang.Object[] args)
throws DynMethodException
invokeDynMethod in interface DynObjectDynMethodExceptionpublic void setDynValue(java.lang.String name,
java.lang.Object value)
throws DynFieldNotFoundException
setDynValue in interface DynObjectDynFieldNotFoundExceptionpublic long getDrawVersion()
getDrawVersion in interface FLayerprotected void updateDrawVersion()
protected void updateDrawVersion(boolean fireEvents)
public boolean hasChangedForDrawing(long value)
public void activationChanged(LayerEvent e)
LayerListenerCalled when the activation of a layer has changed.
activationChanged in interface LayerListenere - an activation changed layer event objectpublic void drawValueChanged(LayerEvent e)
LayerListenerCalled when a draw value of a layer has changed.
drawValueChanged in interface LayerListenere - an edition changed layer event objectpublic void editionChanged(LayerEvent e)
LayerListenerCalled when the edition of a layer has changed.
editionChanged in interface LayerListenere - an edition changed layer event objectpublic void nameChanged(LayerEvent e)
LayerListenerCalled when the name of a layer has changed.
nameChanged in interface LayerListenere - a name changed layer event objectpublic void visibilityChanged(LayerEvent e)
LayerListenerCalled when the visibility of a layer has changed.
visibilityChanged in interface LayerListenere - a visibility changed layer event objectpublic void saveToState(PersistentState state) throws PersistenceException
PersistentsaveToState in interface PersistentPersistenceExceptionpublic void loadFromState(PersistentState state) throws PersistenceException
PersistentloadFromState in interface PersistentPersistenceExceptionpublic java.lang.String getMetadataName()
throws MetadataException
MetadatagetMetadataName in interface MetadataMetadataExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean hidesThisArea(Envelope area)
hidesThisArea in interface FLayerHidesAreapublic boolean isTemporary()
isTemporary in interface FLayerpublic void setTemporary(boolean temporary)
setTemporary in interface FLayerpublic int getDefaultTolerance()
FLayergetDefaultTolerance in interface FLayerpublic void invalidate()
invalidate in interface FLayer