Interface FLayer
- All Superinterfaces:
org.gvsig.tools.dispose.Disposable,org.gvsig.tools.dynobject.DynObject,ExtendedPropertiesSupport,org.gvsig.metadata.Metadata,org.gvsig.tools.persistence.Persistent,Projected
- All Known Subinterfaces:
GraphicLayer,RasterLayer,SingleLayer,VectorLayer
- All Known Implementing Classes:
DefaultGraphicLayer,FLayers,FLyrDefault,FLyrVect
This kind of layers store their data, are drawable, projectable (with a projection), can be a node of a tree of layers, and could be editable and have a cache with previous draws. They also can be visible or not, and active or not.
A layer can also store information about errors produced working with it, and have a name (kind of layer) and a brief summary explaining what's for.
Each particular implementation can add new properties, and limit or expand the functionality.invalid input: '<'/p
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an error reason that describes this layer's wrong status.booleanAdds aLayerListenerto the listener list.booleanAlwais return falseThis method can be used to have a fast cloned layer.voiddraw(BufferedImage image, Graphics2D g, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, double scale) Draws the layer using a buffer.org.gvsig.crs.projection.lib.CoordinateTransformationReturns the transformation coordinates.intReturns layer tolerance in pixelslonggetError(int i) Returns the specified error.Returns a list with all layer errors.Returns the status of this layer.org.gvsig.fmap.geom.primitive.EnvelopeReturns the full extension of the layer node.Returns an string with the information of this layer.Returns allLayerListeners of this layer as an array.URI[]alwais return nullAlwais return null.Returns a reference to the model of this layer, or null if this layer has no model.doubleReturns the maximum scale visible.doubleReturns the minimum scale visible.getName()Returns the name of this layer.intReturns the number of errors which causes this layer to be in unavailable status.Returns the parentFLayersnode of this layer.Returns the image icon that will be shown in the TOC next to this layer.Returns the image icon that will be shown in the TOC next to this layer, according its status.voidbooleanisActive()Returns if this layer is active or not in TOC.booleanReturns the status of availability of this layer.booleanReturns if this layer is editable.booleanisInTOC()Returns if this layer appears in the TOC.booleanisOk()Returns if this layer hasn't got errors.booleanbooleanReturns if this layer is visible and available.booleanisWithinScale(double scale) Returns if the value ofscaleargument is within the maximum and minimum scale of this layer.booleanReturns the writing status of this layer.voidload()Executes the initialization operations of this layer.Returns a new instance ofComposedLayer.voidprint(Graphics2D g, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, double scale, org.gvsig.compat.print.PrintAttributes properties) Prints this layer according to some properties requested.voidreload()Tries recover a layer of a possible error.booleanRemoves theLayerListenerargument from this layer.voidsetActive(boolean selected) Changes the status of this layer to active or inactive.voidsetAvailable(boolean available) Changes the status of availability of this layer.voidsetCoordTrans(org.gvsig.crs.projection.lib.CoordinateTransformation ct) Inserts the transformation coordinates.voidsetEditing(boolean b) Do nothing.voidvoidsetFLayerStatus(FLayerStatus status) Sets the status of this layer.voidsetInTOC(boolean b) Sets that this layer appears or not in the TOC.voidsetMaxScale(double maxScale) Sets the maximum scale visible.voidsetMinScale(double minScale) Sets the minimum scale visible.voidSets a name to this layer.voidsetParentLayer(FLayers root) Inserts the parentFLayersnode of the layer.voidsetProjection(org.gvsig.crs.projection.lib.Projection proj) Sets the projection to this layer.voidsetTemporary(boolean temporary) voidsetVisible(boolean visibility) Changes the status of this layer to visible or not.booleanReturnstrueif this layer has the visible status enabled.Methods inherited from interface org.gvsig.tools.dispose.Disposable
disposeMethods inherited from interface org.gvsig.tools.dynobject.DynObject
clear, delegate, getDynClass, getDynValue, hasDynValue, implement, invokeDynMethod, invokeDynMethod, setDynValueMethods inherited from interface org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport
getExtendedProperties, getProperty, setPropertyMethods inherited from interface org.gvsig.metadata.Metadata
getMetadataChildren, getMetadataID, getMetadataNameMethods inherited from interface org.gvsig.tools.persistence.Persistent
loadFromState, saveToStateMethods inherited from interface org.gvsig.fmap.mapcontext.Projected
getProjection, reProject
-
Field Details
-
METADATA_DEFINITION_NAME
- See Also:
-
METADATA_DEFINITION_DESCRIPTION
- See Also:
-
METADATA_CRS
- See Also:
-
METADATA_NAME
- See Also:
-
-
Method Details
-
setActive
void setActive(boolean selected) Changes the status of this layer to active or inactive.
One layer is active if is selected in TOC.
- Parameters:
selected- the boolean to be set- See Also:
-
isActive
boolean isActive()Returns if this layer is active or not in TOC.
One layer is active if is selected in TOC.
- Returns:
trueif this layer is active;falseotherwise- See Also:
-
setName
Sets a name to this layer.- Parameters:
name- the string that is to be this layer's name- See Also:
-
getName
String getName()Returns the name of this layer.- Returns:
- an string with this layer's name
- See Also:
-
load
Executes the initialization operations of this layer. This method is invoked only one time during the life of this layer and just before visualize it.
- Throws:
LoadLayerException- if fails loading the layer.- See Also:
-
setVisible
void setVisible(boolean visibility) Changes 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.- Parameters:
visibility- the boolean to be set- See Also:
-
isVisible
boolean isVisible()Returns 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.
- Returns:
trueif this layer is visible and available;falseotherwise- See Also:
-
getParentLayer
FLayers getParentLayer()Returns the parentFLayersnode of this layer.- Returns:
- the parent of this layer, or
nullif hasn't parent - See Also:
-
getMapContext
MapContext getMapContext()Returns a reference to the model of this layer, or null if this layer has no model.
- Returns:
- the model of this layer
-
setParentLayer
Inserts the parentFLayersnode of the layer.- Parameters:
root- aFLayersobject- See Also:
-
getFullEnvelope
org.gvsig.fmap.geom.primitive.Envelope getFullEnvelope() throws org.gvsig.fmap.dal.exception.ReadExceptionReturns the full extension of the layer node.- Returns:
- location and dimension of this layer node
- Throws:
org.gvsig.fmap.dal.exception.ReadException- if fails the driver used in this method.
-
draw
void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, double scale) throws org.gvsig.fmap.dal.exception.ReadException Draws the layer using a buffer.- Parameters:
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 theCancellableinterface, and will allow to cancel the drawscale- value that represents the scale- Throws:
org.gvsig.fmap.dal.exception.ReadException- if fails the driver used in this method.- See Also:
-
print
void print(Graphics2D g, ViewPort viewPort, org.gvsig.tools.task.Cancellable cancel, double scale, org.gvsig.compat.print.PrintAttributes properties) throws org.gvsig.fmap.dal.exception.ReadException Prints this layer according to some properties requested.- Parameters:
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 theCancellableinterface, and will allow to cancel the drawscale- the scale of the view. Must be between getMinScale() and getMaxScale().properties- a set with the settings to be applied to a whole print job and to all the docs in the print job- Throws:
org.gvsig.fmap.dal.exception.ReadException- if fails the driver used in this method.- See Also:
-
setCoordTrans
void setCoordTrans(org.gvsig.crs.projection.lib.CoordinateTransformation ct) Inserts the transformation coordinates.- Parameters:
ct- transformation coordinates- See Also:
-
getCoordTrans
org.gvsig.crs.projection.lib.CoordinateTransformation getCoordTrans()Returns the transformation coordinates.- Returns:
- transformation coordinates
- See Also:
-
getDefaultTolerance
int getDefaultTolerance()Returns layer tolerance in pixels- Returns:
- layer tolerance
-
addLayerListener
Adds aLayerListenerto the listener list.- Parameters:
o- a layer listener- Returns:
trueif hasn't been any problem during the insertion of the listener- See Also:
-
getLayerListeners
LayerListener[] getLayerListeners()Returns allLayerListeners of this layer as an array.- Returns:
- an array with all layer listeners associated to this layer
- See Also:
-
removeLayerListener
Removes theLayerListenerargument from this layer.- Parameters:
o- a layer listener- Returns:
trueif hasn't been any problem doing this process- See Also:
-
isWithinScale
boolean isWithinScale(double scale) Returns if the value of
scaleargument is within the maximum and minimum scale of this layer.- Parameters:
scale- the scale > 0- Returns:
trueif thescaleargument is within the range of scales of this layer;falseotherwise- See Also:
-
getMinScale
double getMinScale()Returns the minimum scale visible. Lower scales won't be drawn.- Returns:
- the minimum scale > 0, -1 if not defined
- See Also:
-
getMaxScale
double getMaxScale()Returns the maximum scale visible. Higher scales won't be drawn.- Returns:
- the maximum scale > 0, -1 if not defined
- See Also:
-
setMinScale
void setMinScale(double minScale) Sets the minimum scale visible. Lower scales won't be drawn.- Parameters:
minScale- the scale > 0, -1 if not defined- See Also:
-
setMaxScale
void setMaxScale(double maxScale) Sets the maximum scale visible. Higher scales won't be drawn.- Parameters:
maxScale- the scale > 0, -1 if not defined- See Also:
-
isEditing
boolean isEditing()Returns if this layer is editable.
One layer is editable if user can modify its information with graphical tools.
- Returns:
trueif this layer is editable;falseotherwise- See Also:
-
getTocImageIcon
String getTocImageIcon()Returns the image icon that will be shown in the TOC next to this layer.- Returns:
- a String reference to the image icon, or
nullif there isn't any
-
isInTOC
boolean isInTOC()Returns if this layer appears in the TOC.
If doesn't appears, remains in the view and in the project.
- Returns:
trueif this layer appears in the TOC;falseotherwise
-
setInTOC
void setInTOC(boolean b) Sets that this layer appears or not in the TOC.
- Parameters:
b-trueif appears in the TOC;falseotherwise
-
getFLayerStatus
FLayerStatus getFLayerStatus()Returns the status of this layer.- Returns:
- the status stored in a
FLayerStatusobject - See Also:
-
setFLayerStatus
Sets the status of this layer.- Parameters:
status- information of the status for this layer- See Also:
-
isOk
boolean isOk()Returns if this layer hasn't got errors.
- Returns:
trueif this layer hasn't got errors;falseotherwise
-
getNumErrors
int getNumErrors()Returns the number of errors which causes this layer to be in unavailable status.- Returns:
- number of errors >= 0
- See Also:
-
getError
Returns the specified error.- Parameters:
i- index of the error >= 0 invalid input: '&'invalid input: '&' invalid input: '<'getNumErrors- Returns:
- a singular error
- See Also:
-
addError
Adds an error reason that describes this layer's wrong status.- Parameters:
exception- aBaseExceptionwith the information of the error- See Also:
-
setError
-
getErrors
Returns a list with all layer errors.- Returns:
- an
ArrayListwith the errors - See Also:
-
setAvailable
void setAvailable(boolean available) Changes the status of availability of this layer.
One layer is available if the source of data is on-line.
- Parameters:
available- the boolean to be set- See Also:
-
isAvailable
boolean isAvailable()Returns the status of availability of this layer.
One layer is available if the source of data is on-line.
- Returns:
trueif the source of data is on-line;falseotherwise- See Also:
-
reload
Tries recover a layer of a possible error.
If it has any problem during the load, marks the availability to false and throws an exception.
- Throws:
ReloadLayerException- if it's thrown aReadExceptionor anIOExceptionduring the load of this layer.- See Also:
-
visibleRequired
boolean visibleRequired()Returnstrueif this layer has the visible status enabled.- Returns:
trueif visible this layer has the visible status enabled, otherwisefalse- See Also:
-
getInfoString
String getInfoString()Returns an string with the information of this layer.- Returns:
- the string that is to be this component's information
-
isWritable
boolean isWritable()Returns the writing status of this layer.
One layer is writable if there is a writing driver for this layer.
- Returns:
trueif there is a writing driver for this layer;falseotherwise
-
cloneLayer
This 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.
- Returns:
- a layer that is a clonation of this layer
- Throws:
Exception- any exception produced during the cloning of this layer.
-
newComposedLayer
ComposedLayer newComposedLayer()Returns 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.
- Returns:
- a new composed layer or
nullif not supported - See Also:
-
getTocStatusImage
Image getTocStatusImage()Returns the image icon that will be shown in the TOC next to this layer, according its status.- Returns:
- the image
-
setProjection
void setProjection(org.gvsig.crs.projection.lib.Projection proj) Sets the projection to this layer.
- Parameters:
proj- information about the new projection
-
getDrawVersion
long getDrawVersion() -
isTemporary
boolean isTemporary() -
setTemporary
void setTemporary(boolean temporary) -
setEditing
Do nothing.- Parameters:
b-- Throws:
StartEditionLayerException
-
allowLinks
boolean allowLinks()Alwais return false- Returns:
- false
-
getLinkProperties
AbstractLinkProperties getLinkProperties()Alwais return null.- Returns:
- null
-
getLink
alwais return null- Parameters:
point-tolerance-- Returns:
- null
- Throws:
org.gvsig.fmap.dal.exception.ReadException
-
invalidate
void invalidate()
-