Class DefaultLayoutControl

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.gvsig.app.project.documents.layout.DefaultLayoutControl
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, LayoutControl, org.gvsig.tools.observer.Observer

public class DefaultLayoutControl extends JComponent implements LayoutControl
Control of Layout.
Author:
Vicente Caballero Navarro
See Also:
  • Field Details

  • Constructor Details

    • DefaultLayoutControl

      public DefaultLayoutControl()
      Create a new object of LayoutControl.
      Parameters:
      layout -
  • Method Details

    • initialize

      public void initialize(LayoutPanel layoutPanel)
    • getCurrentTool

      public String getCurrentTool()
      Description copied from interface: LayoutControl
      Returns the name of the current selected tool on this Layout
      Specified by:
      getCurrentTool in interface LayoutControl
      Returns:
      A tool name.
    • addLayoutTool

      public void addLayoutTool(String name, LayoutBehavior tool)
      Description copied from interface: LayoutControl
      Add a new Layout tool.
      Specified by:
      addLayoutTool in interface LayoutControl
      Parameters:
      name - Name of tool.
      tool - LayoutBehavior
    • getLayoutTool

      public LayoutBehavior getLayoutTool(String name)
      Specified by:
      getLayoutTool in interface LayoutControl
    • setLayoutContext

      public void setLayoutContext(LayoutContext lc)
      Description copied from interface: LayoutControl
      Inserts the LayoutContext.
      Specified by:
      setLayoutContext in interface LayoutControl
      Parameters:
      lc - LayoutContext.
    • paintComponent

      protected void paintComponent(Graphics g)
      paintComponent of Layout.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g - Graphics of Layout.
    • getImgRuler

      public BufferedImage getImgRuler()
      Description copied from interface: LayoutControl
      Returns the image with the ruler.
      Specified by:
      getImgRuler in interface LayoutControl
      Returns:
      Ruler image.
    • fullRect

      public void fullRect()
      Description copied from interface: LayoutControl
      It obtains the rect that is adjusted to the size of the window, to see the full extent of layout.
      Specified by:
      fullRect in interface LayoutControl
    • getRect

      public Rectangle2D.Double getRect()
      Description copied from interface: LayoutControl

      Returns a copy of the rectangle that represents the size and position of the layout sheet (in pixels), relative to the containing LayoutControl.

      Note: you must use LayoutControl.setRect(Rectangle2D) to update the rectangle, as this method only returns a copy of it.

      Specified by:
      getRect in interface LayoutControl
      Returns:
      Rectangle2D.Double Rectangle that represents the sheet.
      See Also:
    • setRect

      public void setRect(Rectangle2D r)
      Description copied from interface: LayoutControl

      Sets the size and position of the layout sheet in screen coordinates (pixels), relative to the LayoutControl.

      The size of the sheet is usually different from the bounds of the underlying UI control, for instance if we have zoomed in an area of the sheet then the paper size in pixels will be bigger than the actual control size.

      Specified by:
      setRect in interface LayoutControl
    • getImage

      public BufferedImage getImage()
      Description copied from interface: LayoutControl
      Returns the current image of Layout.
      Specified by:
      getImage in interface LayoutControl
      Returns:
      Current image of Layout.
    • setMapCursor

      public void setMapCursor(Image image)
      Description copied from interface: LayoutControl
      Changes the pointer of the mouse by the image of parameter.
      Specified by:
      setMapCursor in interface LayoutControl
      Parameters:
      image - Image
    • setTool

      public void setTool(String toolName)
      Description copied from interface: LayoutControl
      It establishes as selected to the tool from its name of identification.
      Specified by:
      setTool in interface LayoutControl
      Parameters:
      toolName - Name of identification tool.
    • setDefaultTool

      public void setDefaultTool()
      Description copied from interface: LayoutControl
      Changes the currently selected tool to the default tool
      Specified by:
      setDefaultTool in interface LayoutControl
    • startEdit

      public void startEdit()
      Description copied from interface: LayoutControl
      Start the vertex edition of graphics.
      Specified by:
      startEdit in interface LayoutControl
    • stopEdit

      public void stopEdit()
      Description copied from interface: LayoutControl
      Stop the vertex edition of graphics.
      Specified by:
      stopEdit in interface LayoutControl
    • getRectOrigin

      public Point getRectOrigin()
      Description copied from interface: LayoutControl
      It returns the point that represents the northwest corner of the Layout.
      Specified by:
      getRectOrigin in interface LayoutControl
      Returns:
      Point.
    • getLayoutDraw

      public FLayoutDraw getLayoutDraw()
      Description copied from interface: LayoutControl
      Returns the object to draw the Layout.
      Specified by:
      getLayoutDraw in interface LayoutControl
      Returns:
      FLayoutDraw.
    • getCurrentLayoutTool

      public LayoutBehavior getCurrentLayoutTool()
      Description copied from interface: LayoutControl
      Returns the current Layout tool.
      Specified by:
      getCurrentLayoutTool in interface LayoutControl
      Returns:
      LayoutBehavior Current Layout Tool.
    • getFirstPoint

      public Point getFirstPoint()
      Description copied from interface: LayoutControl
      It returns the first click point of mouse.
      Specified by:
      getFirstPoint in interface LayoutControl
      Returns:
      Point.
    • getPointAnt

      public Point getPointAnt()
      Description copied from interface: LayoutControl
      Returns the previous click of mouse.
      Specified by:
      getPointAnt in interface LayoutControl
      Returns:
      Point.
    • getLastPoint

      public Point getLastPoint()
      Description copied from interface: LayoutControl
      Returns the last click point of mouse.
      Specified by:
      getLastPoint in interface LayoutControl
      Returns:
      Point.
    • setFirstPoint

      public void setFirstPoint()
      Description copied from interface: LayoutControl
      Inserts the first click point of mouse.
      Specified by:
      setFirstPoint in interface LayoutControl
    • setPointAnt

      public void setPointAnt()
      Description copied from interface: LayoutControl
      Inserts the previous click point of mouse.
      Specified by:
      setPointAnt in interface LayoutControl
    • setLastPoint

      public void setLastPoint()
      Description copied from interface: LayoutControl
      Inserts the last click point of mouse.
      Specified by:
      setLastPoint in interface LayoutControl
    • setPosition

      public void setPosition(Point point2)
      Description copied from interface: LayoutControl
      Insert the position point and calculate the new position if the grid is actived.
      Specified by:
      setPosition in interface LayoutControl
      Parameters:
      point2 - Position.
    • getPosition

      public Point getPosition()
      Description copied from interface: LayoutControl
      Returns the position adjusted point.
      Specified by:
      getPosition in interface LayoutControl
      Returns:
    • getAT

      public AffineTransform getAT()
      Description copied from interface: LayoutControl
      Returns the AffineTransform that is applying in the Layout.
      Specified by:
      getAT in interface LayoutControl
      Returns:
      AffineTransform
    • getGeometryAdapter

      public GeometryAdapter getGeometryAdapter()
      Description copied from interface: LayoutControl
      It returns the current GeometryAdapter.
      Specified by:
      getGeometryAdapter in interface LayoutControl
      Returns:
      Current GeometryAdapter.
    • delLastPoint

      public void delLastPoint()
      Description copied from interface: LayoutControl
      Remove last point of geometryAdapter.
      Specified by:
      delLastPoint in interface LayoutControl
    • addGeometryAdapterPoint

      public int addGeometryAdapterPoint()
      Description copied from interface: LayoutControl
      Add a new point to geometryAdapter.
      Specified by:
      addGeometryAdapterPoint in interface LayoutControl
      Returns:
      Number of points in the geometryAdapter.
    • setGeometryAdapterPoinPosition

      public void setGeometryAdapterPoinPosition()
      Description copied from interface: LayoutControl
      Change the position of mousemoved point of geometryAdapter.
      Specified by:
      setGeometryAdapterPoinPosition in interface LayoutControl
    • clearMouseImage

      public void clearMouseImage()
      Description copied from interface: LayoutControl
      Clear the image of pointer of mouse.
      Specified by:
      clearMouseImage in interface LayoutControl
    • refresh

      public void refresh()
      Description copied from interface: LayoutControl
      Refres the Layout.
      Specified by:
      refresh in interface LayoutControl
    • calculateTransformFromViewport

      protected AffineTransform calculateTransformFromViewport()
      Calculates the affine transform using the viewport and the control size, instead of calculating it from rect. as usual. This is required when the component size changes, as rect. has to be recalculated using the viewport, and thus we can't calculate the affine transform using rect.
      Returns:
      An matrix to transform from paper coordinates to screen coordinates
    • isDrawingCancelled

      public boolean isDrawingCancelled()
      Description copied from interface: LayoutControl
      It returns true if the drawing has been canceled.
      Specified by:
      isDrawingCancelled in interface LayoutControl
      Returns:
      true if the drawn has been canceled.
    • setCancelDrawing

      public void setCancelDrawing(boolean b)
      Description copied from interface: LayoutControl
      It cancels the drawing if the parameter is true.
      Specified by:
      setCancelDrawing in interface LayoutControl
      Parameters:
      b - true if the drawing wants to be canceled
    • getReSel

      public Rectangle getReSel()
      Description copied from interface: LayoutControl
      Returns the rectangle of selection.
      Specified by:
      getReSel in interface LayoutControl
      Returns:
      Rectangle of selection.
    • isReSel

      public boolean isReSel()
      Description copied from interface: LayoutControl
      It returns true if should draw the rectangle of selection and does the selection.
      Specified by:
      isReSel in interface LayoutControl
      Returns:
      true if should draw the rectangle of selection.
    • setIsReSel

      public void setIsReSel(boolean b)
      Description copied from interface: LayoutControl
      Insert true if should draw the rectangle of selection and does the selection.
      Specified by:
      setIsReSel in interface LayoutControl
      Parameters:
      b - boolean.
    • viewFull

      public void viewFull() throws org.gvsig.fmap.dal.exception.ReadException
      Description copied from interface: LayoutControl
      It does a full extent of the layers that contains the view of the FFrameView selected.
      Specified by:
      viewFull in interface LayoutControl
      Throws:
      org.gvsig.fmap.dal.exception.ReadException
    • getLayoutZooms

      public FLayoutZooms getLayoutZooms()
      Description copied from interface: LayoutControl
      Returns the object to make zooms.
      Specified by:
      getLayoutZooms in interface LayoutControl
      Returns:
      FLayoutZooms.
    • getLayoutFunctions

      public FLayoutFunctions getLayoutFunctions()
      Description copied from interface: LayoutControl
      Returns the object of FLayoutFunctions.
      Specified by:
      getLayoutFunctions in interface LayoutControl
      Returns:
      FLayoutFunctions
    • getLayoutContext

      public LayoutContext getLayoutContext()
      Description copied from interface: LayoutControl
      Returns the LayoutContext.
      Specified by:
      getLayoutContext in interface LayoutControl
      Returns:
      LayoutContext.
    • setGeometryAdapter

      public void setGeometryAdapter(GeometryAdapter adapter)
      Description copied from interface: LayoutControl
      Inserts the geometryAdapter.
      Specified by:
      setGeometryAdapter in interface LayoutControl
      Parameters:
      adapter - GeometryAdapter.
    • getComponent

      public JComponent getComponent()
      Specified by:
      getComponent in interface LayoutControl
    • update

      public void update(org.gvsig.tools.observer.Observable observable, Object notification)
      Specified by:
      update in interface org.gvsig.tools.observer.Observer