java.lang.Object
org.gvsig.app.project.documents.layout.fframes.FFrame
All Implemented Interfaces:
Cloneable, IFFrame, org.gvsig.fmap.mapcontext.rendering.symbols.IPrintable, org.gvsig.tools.dispose.Disposable, org.gvsig.tools.lang.Cloneable, org.gvsig.tools.observer.Observable, org.gvsig.tools.persistence.Persistent
Direct Known Subclasses:
AbstractFFrameViewDependence, FFrameBasic, FFrameGraphics, FFrameMapBox, FFramePicture, FFrameText, FFrameView

public abstract class FFrame extends Object implements IFFrame
Class implementing the IFFrame interface, that will be extended by all the FFrames. It provides default methods useful for all fframes and abstract methods to be implemented by them.
Author:
Vicente Caballero Navarro, Cesar Martinez Izquierdo
  • Field Details

  • Constructor Details

    • FFrame

      public FFrame()
  • Method Details

    • drawHandlers

      public void drawHandlers(Graphics2D g)
      Dibuja los handlers sobre el boundingBox en el graphics que se pasa como par�metro.
      Specified by:
      drawHandlers in interface IFFrame
      Parameters:
      g - Graphics sobre el que dibujar.
    • setSelected

      public void setSelected(Point2D p, MouseEvent e)
      Sets the type of selection performed on the frame, based on the position of the provided Point compared with the boundaries of the FFrame. This method is usually called when the user clicks on the FFrame
      Specified by:
      setSelected in interface IFFrame
      Parameters:
      p - Point which should be evaluated to establish if the FFrame must be selected or not
      e - Mouse event that triggered this method call
    • updateRect

      public void updateRect(Rectangle2D r, AffineTransform at)
      Actualiza el BoundBox del FFrame a partir de su rect�ngulo en pixels y la matriz de transformaci�n.
      Specified by:
      updateRect in interface IFFrame
      Parameters:
      r - Rect�ngulo.
      at - Matriz de transformaci�n.
    • getMovieRect

      public Rectangle2D getMovieRect(int difx, int dify)
      Devuelve el rect�ngulo a partir del desplazamiento en el eje x y el desplazamiento en el eje y.
      Specified by:
      getMovieRect in interface IFFrame
      Parameters:
      difx - desplazamiento sobre el eje x.
      dify - desplazamiento sobre el eje y.
      Returns:
      rect�ngulo modificado en funci�n del desplazamiento realizado.
    • getMovieRect

      public Rectangle2D getMovieRect(int difx, int dify, boolean prop)
      Description copied from interface: IFFrame
      Devuelve el rectángulo a partir del desplazamiento en el eje x y el desplazamiento en el eje y.
      Specified by:
      getMovieRect in interface IFFrame
      Parameters:
      difx - desplazamiento sobre el eje x.
      dify - desplazamiento sobre el eje y.
      prop - true para un desplazamiento proporcional
      Returns:
      rectángulo modificado en función del desplazamiento realizado.
    • getLastMoveRect

      public Rectangle2D getLastMoveRect()
      Devuelve el rect�ngulo que representa el �ltimo generado al desplazar o modificar el tama�o del fframe.
      Specified by:
      getLastMoveRect in interface IFFrame
      Returns:
      Rectangle2D
    • getSelected

      public int getSelected()
      Returns an integer representing the type of selection applied to the FFrame. Valid values are: IFFrame.NOSELECT, IFFrame.NO, IFFrame.N, IFFrame.NE, IFFrame.O, IFFrame.RECT, IFFrame.E, IFFrame.SO, IFFrame.S, IFFrame.SE.
      Specified by:
      getSelected in interface IFFrame
      Returns:
      The type of selection that has been applied
    • isSelected

      public boolean isSelected()
      Gets the selection status of the frame
      Specified by:
      isSelected in interface IFFrame
      Returns:
      true if the frame is selected, false otherwise
    • contains

      public boolean contains(Point2D p)
      Devuelve true, si el punto que se pasa como par�metro esta contenido dentro del boundingbox del fframe.
      Specified by:
      contains in interface IFFrame
      Parameters:
      p - punto a comprobar en pixels.
      Returns:
      true si el punto esta dentro del boundingbox.
    • getContains

      public int getContains(Point2D p)
      Description copied from interface: IFFrame
      Checks whether the provided point is contained within the FFrame rectangle.
      Specified by:
      getContains in interface IFFrame
      Parameters:
      p - Point to compare
      Returns:
      An integer representing the topologic relation of the point and the frame rectangle. It can be one of: IFFrame.NOSELECT, IFFrame.NO, IFFrame.N, IFFrame.NE, IFFrame.O, IFFrame.RECT, IFFrame.E, IFFrame.SO, IFFrame.S, IFFrame.SE.
    • getMapCursor

      public Image getMapCursor(Point2D p)
      Devuelve el Cursor adecuado seg�n como est� contenido el punto, si es para desplazamiento, o cambio de tama�o.
      Specified by:
      getMapCursor in interface IFFrame
      Parameters:
      p - punto a comprobar.
      Returns:
      Cursor adecuado a la posici�n.
    • draw

      public abstract void draw(Graphics2D g, AffineTransform at, Rectangle2D r, BufferedImage imgBase)
      Draws the FFrame on the provided Graphics, according to the provided affine transform and the visible rectangle. It has to to be implemented by each FFrame, as each of them usually draws diffently.
      Specified by:
      draw in interface IFFrame
      Parameters:
      g - Graphics2D
      at - Affine transform to translate sheet coordinates (in cm) to screen coordinates (in pixels)
      r - rectángulo sobre el que hacer un clip.
      imgBase - Image used to speed up the drawing process
      visibleLayoutDocRect - visible rectangle
    • getBoundingBox

      public Rectangle2D.Double getBoundingBox(AffineTransform at)
      Returns the bounding box (in pixels) of this FFrame, based on the provided AffineTransform. If the AffineTransform is null, it returns the last calculated bounding box.
      Specified by:
      getBoundingBox in interface IFFrame
      Parameters:
      at - Affine transform to apply to the sheet coordinates to get the bounding box in pixels.
      Returns:
      Rectangle representing the bounding box (in pixels) of this FFrame
    • setBoundBox

      public void setBoundBox(Rectangle2D r)
      Sets the bounding box in centimeters of this FFrame, using paper coordinates.
      Specified by:
      setBoundBox in interface IFFrame
      Parameters:
      r - Rectangle in centimeters
    • getBoundBox

      public Rectangle2D.Double getBoundBox()
      Returns the bounding box in centimeters of this FFrame, using paper coordinates
      Specified by:
      getBoundBox in interface IFFrame
      Returns:
      The bounding box of this FFrame, measured in centimeters.
    • setSelected

      public void setSelected(boolean selected)
      Sets the selected status of the frame.
      Specified by:
      setSelected in interface IFFrame
      Parameters:
      selected - true to select the frame, false to unselect it
    • doSetSelected

      protected void doSetSelected(int selectedStatus)
    • drawDraft

      public void drawDraft(Graphics2D g)
      Dibuja sobre el graphics el rect�ngulo del fframe en modo borrador.
      Specified by:
      drawDraft in interface IFFrame
      Parameters:
      g - Graphics so bre el que dibujar.
    • setNum

      public void setNum(int i)
      Rellena con el n�mero de FFrame.
      Specified by:
      setNum in interface IFFrame
      Parameters:
      i - n�mero
    • drawEmpty

      public void drawEmpty(Graphics2D g)
      Draws the FFrame rectangle on the provided Graphics2D, only showing the FFrame name on an empty rectangle.
      Parameters:
      g - The graphics to draw on
    • intersects

      public boolean intersects(Rectangle2D rv, Rectangle2D r)
      Devuelve true si el rect�ngulo primero es null o si es distinto de null e intersecta.
      Specified by:
      intersects in interface IFFrame
      Parameters:
      rv - Rect�ngulo
      r - Rect�ngulo
      Returns:
      True si intersecta o es null.
    • setTag

      public void setTag(String s)
      Rellena el tag del FFrame.
      Specified by:
      setTag in interface IFFrame
      Parameters:
      s - String que representa el valor a guardar en el tag.
    • getTag

      public String getTag()
      Devuelve el tag.
      Specified by:
      getTag in interface IFFrame
      Returns:
      tag.
    • drawSymbolTag

      public void drawSymbolTag(Graphics2D g)
      Dibuja sobre el graphics que se pasa como par�metro el icono que representa que contiene un tag.
      Specified by:
      drawSymbolTag in interface IFFrame
      Parameters:
      g - Graphics sobre el que dibujar el icono.
    • setRotation

      public void setRotation(double rotation)
      Sets the rotation of the frame, measured in arc degrees
      Specified by:
      setRotation in interface IFFrame
      Parameters:
      rotation - Rotation to apply to the frame
    • getRotationAT

      protected AffineTransform getRotationAT()
      Gets the affine transform used to rotate the graphics when rotation is not 0
      Returns:
    • getRotation

      public double getRotation()
      Gets the rotation of the frame, measured in arc degrees
      Specified by:
      getRotation in interface IFFrame
      Returns:
      Rotation of the frame
    • getLevel

      public int getLevel()
      Devuelve el nivel en el que se encuentra el FFrame.
      Specified by:
      getLevel in interface IFFrame
      Returns:
      nivel
    • setLevel

      public void setLevel(int l)
      Inserta el nivel al que se encuentra el FFrame.
      Specified by:
      setLevel in interface IFFrame
      Parameters:
      l - entero que refleja el nivel del FFrame.
    • clone

      public Object clone() throws CloneNotSupportedException
      Specified by:
      clone in interface org.gvsig.tools.lang.Cloneable
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • setFrameFactory

      public void setFrameFactory(FrameFactory flf)
      Specified by:
      setFrameFactory in interface IFFrame
    • getFrameFactory

      public FrameFactory getFrameFactory()
      Specified by:
      getFrameFactory in interface IFFrame
    • initializeIcons

      public static void initializeIcons()
      Initilizes the static icons
    • registerPersistent

      public static void registerPersistent()
    • loadFromState

      public void loadFromState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      loadFromState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • saveToState

      public void saveToState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException
      Specified by:
      saveToState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException
    • addObserver

      public void addObserver(org.gvsig.tools.observer.Observer o)
      Specified by:
      addObserver in interface org.gvsig.tools.observer.Observable
    • deleteObserver

      public void deleteObserver(org.gvsig.tools.observer.Observer o)
      Specified by:
      deleteObserver in interface org.gvsig.tools.observer.Observable
    • deleteObservers

      public void deleteObservers()
      Specified by:
      deleteObservers in interface org.gvsig.tools.observer.Observable
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.gvsig.tools.dispose.Disposable
    • frameRemoved

      public void frameRemoved()
      Description copied from interface: IFFrame
      This method is called when the FFrame has been removed from the Layout
      Specified by:
      frameRemoved in interface IFFrame
    • frameAdded

      public void frameAdded()
      Description copied from interface: IFFrame
      This method is called when the FFrame has been added to the Layout
      Specified by:
      frameAdded in interface IFFrame
    • getLayoutContext

      public LayoutContext getLayoutContext()
      Specified by:
      getLayoutContext in interface IFFrame
    • setLayoutContext

      public void setLayoutContext(LayoutContext layoutContext)
      Specified by:
      setLayoutContext in interface IFFrame
    • getDocument

      public org.gvsig.app.project.documents.Document getDocument()
      Specified by:
      getDocument in interface IFFrame
    • setDocument

      public void setDocument(org.gvsig.app.project.documents.Document document)
      Specified by:
      setDocument in interface IFFrame
    • getVisibleRect

      protected Rectangle2D getVisibleRect(Rectangle2D visibleLayoutDocRect, Rectangle2D frame)
      Gets the visible rectangle of the frame, taking rotation into consideration. The result of this method is the rectangular area of the unrotated frame that will be visible when the frame gets rotated.
      Parameters:
      visibleLayoutDocRect - The visible area of the layout document
      frame - The bounding box of this frame
      Returns:
      the rectangular area of the unrotated frame that will be visible when the frame gets rotated, measured in screen coordinates