public class FLyrVect extends FLyrDefault implements VectorLayer, LegendContentsChangedListener, Observer
Modifier and Type | Class and Description |
---|---|
protected class |
FLyrVect.EnvelopeCantBeInitializedException |
static class |
FLyrVect.SelfRegister |
FLyrDefault.RegisterMetadata, FLyrDefault.RegisterPersistence
Modifier and Type | Field and Description |
---|---|
protected ILabelingStrategy |
strategy |
static java.lang.String |
TAG_LAYERVECT_MAXSCALE |
static java.lang.String |
TAG_LAYERVECT_MINSCALE |
drawVersion, layerListeners, metadataContainer, properties
METADATA_CRS, METADATA_DEFINITION_DESCRIPTION, METADATA_DEFINITION_NAME, METADATA_NAME
Constructor and Description |
---|
FLyrVect() |
Modifier and Type | Method and Description |
---|---|
void |
addBaseFilter(Evaluator filter) |
void |
addBaseFilter(java.lang.String filter) |
boolean |
allowLinks()
Deprecated.
the hiperlink functionaliti is out the layer now
|
protected void |
bindToDataStore(DataStore dataStore)
Enlaza la capa con el DataStore indicado.
|
protected void |
cleanLoadOptions() |
void |
clearSpatialCache()
Deprecated.
|
FLayer |
cloneLayer()
This method can be used to have a fast cloned layer.
|
FeatureQuery |
createFeatureQuery() |
FeatureQuery |
createQueryByGeometry(Geometry geom,
FeatureType featureType) |
FeatureQuery |
createQueryByPoint(double x,
double y,
double tol,
FeatureType featureType) |
protected void |
doDispose()
Internal implementation for the
AbstractDisposable.dispose() method, to be
implemented by child classes. |
void |
draw(java.awt.image.BufferedImage image,
java.awt.Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale)
Draws using IFeatureIterator.
|
void |
drawLabels(java.awt.image.BufferedImage image,
java.awt.Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale,
double dpi)
Causes the labels to be drawn.
|
static Envelope |
fromViewPortCRSToSourceCRS(FLayer lyr,
Envelope env)
Returns envelope in layer's data source CRS from envelope provided in
viewport CRS
|
static Geometry |
fromViewPortCRSToSourceCRS(FLayer lyr,
Geometry geo,
boolean clone)
Deprecated.
use the transformToSourceCRS method of layer.
|
FeatureQuery |
getBaseQuery() |
DataStore |
getDataStore()
Return the store associated to the layer.
|
DataStoreParameters |
getDataStoreParameters() |
FeatureStore |
getFeatureStore() |
Envelope |
getFullEnvelope()
Returns the full extension of the layer node.
|
GeometryType |
getGeometryType()
Returns the layer's geometry type
|
DynObjectSet |
getInfo(Point p,
double tolerance)
Executes a consultation about information of a point on the layer.
|
DynObjectSet |
getInfo(java.awt.Point p,
double tolerance,
Cancellable cancel)
Executes a consultation about information of a point on the layer.
|
DynObjectSet |
getInfo(java.awt.Point p,
double tolerance,
Cancellable cancel,
boolean fast)
Executes a consultation about information of a point on the layer.
|
java.lang.String |
getInfoString()
Returns an string with the information of this layer.
|
ILabelingStrategy |
getLabelingStrategy()
Returns the current labeling strategy
|
ILegend |
getLegend()
Devuelve la Leyenda de la capa.
|
java.util.Set |
getMetadataChildren()
Returns an unsorted set of child Metadata objects.
|
java.lang.Object |
getMetadataID()
Returns the unique identifier of the Metadata.
|
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.
|
int |
getShapeType()
Returns the type of the shape.
|
SpatialCache |
getSpatialCache() |
java.lang.String |
getTocImageIcon()
Returns the image icon that will be shown in the TOC next to this layer.
|
GeometryType |
getTypeVectorLayer() |
void |
invalidate() |
boolean |
isEditing()
Returns if this layer is editable.
|
boolean |
isLabeled()
Returns true if labels are drawn, or false otherwise.
|
boolean |
isLayerToSnap() |
boolean |
isPropertiesMenuVisible()
This method returns a boolean that is used by the FPopMenu to make
visible the properties menu or not.
|
boolean |
isSpatialCacheEnabled()
Deprecated.
|
boolean |
isTemporary() |
boolean |
isWritable()
Returns the writing status of this layer.
|
java.util.Iterator |
iterator() |
void |
legendCleared(LegendClearEvent event) |
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 |
print(java.awt.Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale,
PrintAttributes properties)
Prints this layer according to some properties requested.
|
void |
printLabels(java.awt.Graphics2D g,
ViewPort viewPort,
Cancellable cancel,
double scale,
PrintAttributes properties) |
protected void |
putLoadLegend() |
protected void |
putLoadSelection() |
FeatureSet |
queryByContainedInEnvelope(Envelope envelope,
FeatureType featureType) |
FeatureSet |
queryByContainedInEnvelope(Envelope envelope,
FeatureType featureType,
java.lang.String[] names) |
FeatureSet |
queryByContainedInGeometry(Geometry geom,
FeatureType featureType) |
FeatureSet |
queryByEnvelope(Envelope envelope,
FeatureType featureType)
It return the
FeatureSet that intersects with the envelope. |
FeatureSet |
queryByEnvelope(Envelope envelope,
FeatureType featureType,
java.lang.String[] names)
It return the
FeatureSet that intersects with the envelope. |
FeatureSet |
queryByGeometry(Geometry geom,
FeatureType featureType)
Input geom must be in the CRS of the view.
|
FeatureSet |
queryByPoint(java.awt.geom.Point2D mapPoint,
double tol,
FeatureType featureType)
Deprecated.
|
FeatureSet |
queryByPoint(Point point,
double tol,
FeatureType featureType) |
void |
refreshSpatialCache(Envelope envelope) |
void |
reload()
Tries recover a layer of a possible error.
|
void |
saveToState(PersistentState state)
Saves the internal state of the object on the provided
PersistentState object.
|
void |
setBaseQuery(FeatureQuery baseQuery) |
void |
setDataStore(DataStore dataStore)
Deprecated.
|
void |
setDataStoreParameters(DataStoreParameters parameters) |
void |
setEditing(boolean b)
Do nothing.
|
void |
setIsLabeled(boolean isLabeled)
Enables or disables the label drawing.
|
void |
setLabelingStrategy(ILabelingStrategy strategy)
Sets the new labeling strategy.
|
void |
setLayerToSnap(boolean enable) |
void |
setLegend(IVectorLegend legend)
Sets the layer's legend as a vector legend.
|
protected void |
setLoadLegend(IVectorLegend legend) |
protected void |
setLoadSelection(java.lang.Object xml) |
void |
setMaxFeaturesInEditionCache(int maxFeatures)
Siempre es un numero mayor de 1000
|
void |
setSpatialCacheEnabled(boolean spatialCacheEnabled)
Deprecated.
|
void |
setVisible(boolean visibility)
Changes the status of this layer to visible or not.
|
boolean |
symbolChanged(SymbolLegendEvent e)
Invocado cuando se cambia en el legend el símbolo por defecto.
|
java.lang.String |
toString()
Sobreimplementación del método toString para que las bases de datos
identifiquen la capa.
|
Geometry |
transformToSourceCRS(Geometry geom,
boolean clone) |
void |
update(Observable observable,
java.lang.Object notification)
Called whenever a
Observable object is changed and this
Observer has registered on it to receive notifications. |
activationChanged, addError, addLayerListener, addLegendListener, callEditionChanged, callLegendChanged, clear, delegate, drawValueChanged, editionChanged, getClassName, getCoordTrans, getDefaultTolerance, getDrawVersion, getDynClass, getDynValue, getError, getErrors, getExtendedProperties, getFLayerStatus, getLayerListeners, getLink, getLinkProperties, getMapContext, getMaxScale, getMetadataName, getMinScale, getName, getNumErrors, getParentLayer, getTocStatusImage, getTransparency, hasChangedForDrawing, hasDynValue, hidesThisArea, implement, invokeDynMethod, invokeDynMethod, isActive, isAvailable, isInTOC, isOk, isVisible, isWithinScale, nameChanged, newComposedLayer, removeLayerListener, removeLegendListener, reProject, setActive, setAvailable, setCoordTrans, setDynValue, setError, setFLayerStatus, setInTOC, setMaxScale, setMinScale, setName, setParentLayer, setProjection, setProperty, setTemporary, setTocStatusImage, setTransparency, updateDrawVersion, updateDrawVersion, visibilityChanged, visibleRequired, wakeUp
dispose, dispose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addError, addLayerListener, getCoordTrans, getDefaultTolerance, getDrawVersion, getError, getErrors, getFLayerStatus, getLayerListeners, getLink, getLinkProperties, getMapContext, getMaxScale, getMinScale, getName, getNumErrors, getParentLayer, getTocStatusImage, isActive, isAvailable, isInTOC, isOk, isVisible, isWithinScale, newComposedLayer, removeLayerListener, setActive, setAvailable, setCoordTrans, setError, setFLayerStatus, setInTOC, setMaxScale, setMinScale, setName, setParentLayer, setProjection, setTemporary, visibleRequired
getMetadataName
clear, clone, delegate, getDynClass, getDynValue, hasDynValue, implement, invokeDynMethod, invokeDynMethod, setDynValue
dispose
getExtendedProperties, setProperty
addLegendListener, removeLegendListener
public static final java.lang.String TAG_LAYERVECT_MAXSCALE
public static final java.lang.String TAG_LAYERVECT_MINSCALE
protected ILabelingStrategy strategy
public java.lang.String getTocImageIcon()
FLayer
getTocImageIcon
in interface FLayer
getTocImageIcon
in class FLyrDefault
null
if there isn't anypublic DataStore getDataStore()
getDataStore
in interface HasDataStore
getDataStore
in interface SingleLayer
public void setDataStore(DataStore dataStore) throws LoadLayerException
bindToDataStore(DataStore)
setDataStore
in interface SingleLayer
dataStore
- LoadLayerException
public void setDataStoreParameters(DataStoreParameters parameters)
public void setVisible(boolean visibility)
FLayer
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
.
setVisible
in interface FLayer
setVisible
in class FLyrDefault
visibility
- the boolean to be setFLayer.isVisible()
,
FLayer.visibleRequired()
,
FLayer.isAvailable()
protected void bindToDataStore(DataStore dataStore) throws LoadLayerException
dataStore
- LoadLayerException
public Envelope getFullEnvelope() throws ReadException
FLayer
getFullEnvelope
in interface FLayer
ReadException
- if fails the driver used in this method.public void setBaseQuery(FeatureQuery baseQuery)
setBaseQuery
in interface VectorLayer
public FeatureQuery getBaseQuery()
getBaseQuery
in interface VectorLayer
public void addBaseFilter(Evaluator filter)
addBaseFilter
in interface VectorLayer
public void addBaseFilter(java.lang.String filter)
addBaseFilter
in interface VectorLayer
public void draw(java.awt.image.BufferedImage image, java.awt.Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale) throws ReadException
draw
in interface FLayer
image
- g
- viewPort
- cancel
- scale
- ReadDriverException
ReadException
- if fails the driver used in this method.FLayer.print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
public void print(java.awt.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 setLegend(IVectorLegend legend) throws LegendLayerException
ClassifiableVectorial
Sets the layer's legend as a vector legend.
setLegend
in interface ClassifiableVectorial
legend
- the legend with vector dataLegendLayerException
- if fails setting the legend to this layer.public ILegend getLegend()
getLegend
in interface Classifiable
public int getShapeType() throws ReadException
Classifiable
Returns the type of the shape.
All geometry types are defined in Geometry.TYPES
.
For getting the equivalent shape of a geometry type, you must use a method like
SHPFileWrite#getShapeType()
.
getShapeType
in interface Classifiable
ReadException
Geometry
,
Constant
public GeometryType getGeometryType() throws ReadException
getGeometryType
in interface Classifiable
ReadException
- if there is an error getting the geometry typepublic 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 java.lang.String toString()
toString
in class FLyrDefault
public boolean isEditing()
FLayer
Returns if this layer is editable.
One layer is editable if user can modify its information with graphical tools.
isEditing
in interface FLayer
isEditing
in class FLyrDefault
true
if this layer is editable; false
otherwiseFLayer.setEditing(boolean)
public void setEditing(boolean b) throws StartEditionLayerException
FLayer
setEditing
in interface FLayer
setEditing
in class FLyrDefault
StartEditionLayerException
public void clearSpatialCache()
getSpatialCache()
public boolean isSpatialCacheEnabled()
getSpatialCache()
public void setSpatialCacheEnabled(boolean spatialCacheEnabled)
getSpatialCache()
public SpatialCache getSpatialCache()
public void refreshSpatialCache(Envelope envelope)
public void setMaxFeaturesInEditionCache(int maxFeatures)
maxFeatures
- public boolean isPropertiesMenuVisible()
public void reload() throws ReloadLayerException
FLayer
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.
reload
in interface FLayer
reload
in class FLyrDefault
ReloadLayerException
- if it's thrown a ReadException
or an
IOException
during the load of this layer.FLayer.load()
protected void setLoadSelection(java.lang.Object xml)
protected void setLoadLegend(IVectorLegend legend)
protected void putLoadSelection()
protected void putLoadLegend() throws LegendLayerException
LegendLayerException
protected void cleanLoadOptions()
public boolean isWritable()
FLayer
Returns the writing status of this layer.
One layer is writable if there is a writing driver for this layer.
isWritable
in interface FLayer
isWritable
in class FLyrDefault
true
if there is a writing driver for this layer; false
otherwisepublic FLayer cloneLayer() throws java.lang.Exception
FLayer
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.
cloneLayer
in interface FLayer
cloneLayer
in class FLyrDefault
java.lang.Exception
- any exception produced during the cloning of this layer.public boolean isLabeled()
ILabelable
isLabeled
in interface ILabelable
public void setIsLabeled(boolean isLabeled)
ILabelable
setIsLabeled
in interface ILabelable
public ILabelingStrategy getLabelingStrategy()
ILabelable
getLabelingStrategy
in interface ILabelable
ILabelingStrategy
public void setLabelingStrategy(ILabelingStrategy strategy)
ILabelable
setLabelingStrategy
in interface ILabelable
public void drawLabels(java.awt.image.BufferedImage image, java.awt.Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, double dpi) throws ReadException
ILabelable
drawLabels
in interface ILabelable
ReadException
public void printLabels(java.awt.Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties) throws ReadException
printLabels
in interface ILabelable
ReadException
public boolean allowLinks()
allowLinks
in interface FLayer
allowLinks
in class FLyrDefault
public void load() throws LoadLayerException
FLayer
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.
load
in interface FLayer
load
in class FLyrDefault
LoadLayerException
- if fails loading the layer.FLayer.reload()
public FeatureStore getFeatureStore()
getFeatureStore
in interface VectorLayer
public FeatureQuery createFeatureQuery()
createFeatureQuery
in interface VectorLayer
public FeatureSet queryByPoint(java.awt.geom.Point2D mapPoint, double tol, FeatureType featureType) throws DataException
queryByPoint(org.gvsig.fmap.geom.primitive.Point, double, FeatureType)
DataException
public FeatureSet queryByPoint(Point point, double tol, FeatureType featureType) throws DataException
DataException
public FeatureQuery createQueryByPoint(double x, double y, double tol, FeatureType featureType) throws DataException
DataException
public FeatureSet queryByGeometry(Geometry geom, FeatureType featureType) throws DataException
geom
- featureType
- DataException
public FeatureQuery createQueryByGeometry(Geometry geom, FeatureType featureType) throws DataException
DataException
public FeatureSet queryByContainedInGeometry(Geometry geom, FeatureType featureType) throws DataException
DataException
public FeatureSet queryByEnvelope(Envelope envelope, FeatureType featureType) throws DataException
FeatureSet
that intersects with the envelope.envelope
- envelope that defines the area for the query.featureType
- only the features with this feature type are used in
the query.DataException
public FeatureSet queryByEnvelope(Envelope envelope, FeatureType featureType, java.lang.String[] names) throws DataException
FeatureSet
that intersects with the envelope.envelope
- envelope that defines the area for the query in viewport
CRSfeatureType
- only the features with this feature type are used in
the query.names
- the feature attributes that have to be checked.DataException
public FeatureSet queryByContainedInEnvelope(Envelope envelope, FeatureType featureType) throws DataException
DataException
public FeatureSet queryByContainedInEnvelope(Envelope envelope, FeatureType featureType, java.lang.String[] names) throws DataException
DataException
public DynObjectSet getInfo(java.awt.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(java.awt.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 void legendCleared(LegendClearEvent event)
legendCleared
in interface LegendContentsChangedListener
public boolean symbolChanged(SymbolLegendEvent e)
LegendContentsChangedListener
symbolChanged
in interface LegendContentsChangedListener
e
- SymbolLegendEventpublic void update(Observable observable, java.lang.Object notification)
Observer
Observable
object is changed and this
Observer
has registered on it to receive notifications.
Implementations of this method will be called for each simple notification or, if a complex notification is created, for each of the child notifications.
In the latter case, don't assume any ordering in the notification between
this Observer
and other Observer
s listening to the same
Observable
.
In a complex notification scenario, if you want to receive only the
complex notification and not each of the child notifications, just
implement the ComplexObserver
and prepare this method
implementation to handle receiving DefaultComplexNotification
instances
as well as direct notification objects.
public void setLayerToSnap(boolean enable)
public boolean isLayerToSnap()
public java.util.Set getMetadataChildren()
Metadata
getMetadataChildren
in interface Metadata
public java.lang.Object getMetadataID() throws MetadataException
Metadata
getMetadataID
in interface Metadata
MetadataException
public GeometryType getTypeVectorLayer() throws DataException, LocatorException, GeometryTypeNotSupportedException, GeometryTypeNotValidException
protected void doDispose() throws BaseException
AbstractDisposable
AbstractDisposable.dispose()
method, to be
implemented by child classes.doDispose
in class AbstractDisposable
BaseException
AbstractDisposable.dispose()
public static Envelope fromViewPortCRSToSourceCRS(FLayer lyr, Envelope env)
lyr
- env
- public static Geometry fromViewPortCRSToSourceCRS(FLayer lyr, Geometry geo, boolean clone)
lyr
- geo
- clone
- public java.util.Iterator iterator()
public java.lang.String getInfoString()
FLayer
getInfoString
in interface FLayer
getInfoString
in class FLyrDefault
public boolean isTemporary()
isTemporary
in interface FLayer
isTemporary
in class FLyrDefault
public DataStoreParameters getDataStoreParameters()
public IProjection getProjection()
Projected
Returns the current projection.
getProjection
in interface Projected
getProjection
in class FLyrDefault
Projected.reProject(ICoordTrans)
public void invalidate()
invalidate
in interface FLayer
invalidate
in class FLyrDefault
public java.lang.Object getProperty(java.lang.Object key)
ExtendedPropertiesSupport
Returns 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 ExtendedPropertiesSupport
getProperty
in class FLyrDefault
key
- the key associated to the propertynull
if key is not foundExtendedPropertiesSupport.getExtendedProperties()
,
ExtendedPropertiesSupport.setProperty(Object, Object)