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

public interface FLayer extends Projected, org.gvsig.tools.persistence.Persistent, org.gvsig.metadata.Metadata, org.gvsig.tools.dispose.Disposable, ExtendedPropertiesSupport
Definition of the basic functionality that all kind of layers should implement.
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 Details

  • 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:
      true if this layer is active; false otherwise
      See Also:
    • setName

      void setName(String name)
      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

      void load() throws LoadLayerException

      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:
      true if this layer is visible and available; false otherwise
      See Also:
    • getParentLayer

      FLayers getParentLayer()
      Returns the parent FLayers node of this layer.
      Returns:
      the parent of this layer, or null if 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

      void setParentLayer(FLayers root)
      Inserts the parent FLayers node of the layer.
      Parameters:
      root - a FLayers object
      See Also:
    • getFullEnvelope

      org.gvsig.fmap.geom.primitive.Envelope getFullEnvelope() throws org.gvsig.fmap.dal.exception.ReadException
      Returns 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 draw
      g - for rendering 2-dimensional shapes, text and images on the Java(tm) platform
      viewPort - information for drawing this layer
      cancel - an object thread that implements the Cancellable interface, and will allow to cancel the draw
      scale - 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) platform
      viewPort - the information for drawing the layers
      cancel - an object thread that implements the Cancellable interface, and will allow to cancel the draw
      scale - 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

      boolean addLayerListener(LayerListener o)
      Adds a LayerListener to the listener list.
      Parameters:
      o - a layer listener
      Returns:
      true if hasn't been any problem during the insertion of the listener
      See Also:
    • getLayerListeners

      LayerListener[] getLayerListeners()
      Returns all LayerListeners of this layer as an array.
      Returns:
      an array with all layer listeners associated to this layer
      See Also:
    • removeLayerListener

      boolean removeLayerListener(LayerListener o)
      Removes the LayerListener argument from this layer.
      Parameters:
      o - a layer listener
      Returns:
      true if hasn't been any problem doing this process
      See Also:
    • isWithinScale

      boolean isWithinScale(double scale)

      Returns if the value of scale argument is within the maximum and minimum scale of this layer.

      Parameters:
      scale - the scale > 0
      Returns:
      true if the scale argument is within the range of scales of this layer; false otherwise
      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:
      true if this layer is editable; false otherwise
      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 null if 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:
      true if this layer appears in the TOC; false otherwise
    • setInTOC

      void setInTOC(boolean b)

      Sets that this layer appears or not in the TOC.

      Parameters:
      b - true if appears in the TOC; false otherwise
    • getFLayerStatus

      FLayerStatus getFLayerStatus()
      Returns the status of this layer.
      Returns:
      the status stored in a FLayerStatus object
      See Also:
    • setFLayerStatus

      void setFLayerStatus(FLayerStatus status)
      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:
      true if this layer hasn't got errors; false otherwise
    • 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

      Throwable getError(int i)
      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

      void addError(Throwable exception)
      Adds an error reason that describes this layer's wrong status.
      Parameters:
      exception - a BaseException with the information of the error
      See Also:
    • setError

      void setError(Throwable ex)
    • getErrors

      List<Throwable> getErrors()
      Returns a list with all layer errors.
      Returns:
      an ArrayList with 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:
      true if the source of data is on-line; false otherwise
      See Also:
    • reload

      void reload() throws ReloadLayerException

      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 a ReadException or an IOException during the load of this layer.
      See Also:
    • visibleRequired

      boolean visibleRequired()
      Returns true if this layer has the visible status enabled.
      Returns:
      true if visible this layer has the visible status enabled, otherwise false
      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:
      true if there is a writing driver for this layer; false otherwise
    • cloneLayer

      FLayer cloneLayer() throws Exception

      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 null if 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

      void setEditing(boolean b) throws StartEditionLayerException
      Do nothing.
      Parameters:
      b -
      Throws:
      StartEditionLayerException
    • allowLinks

      boolean allowLinks()
      Alwais return false
      Returns:
      false
    • getLinkProperties

      AbstractLinkProperties getLinkProperties()
      Alwais return null.
      Returns:
      null
    • getLink

      URI[] getLink(Point2D point, double tolerance) throws org.gvsig.fmap.dal.exception.ReadException
      alwais return null
      Parameters:
      point -
      tolerance -
      Returns:
      null
      Throws:
      org.gvsig.fmap.dal.exception.ReadException
    • invalidate

      void invalidate()