Class ExtentHistory

java.lang.Object
org.gvsig.fmap.mapcontext.ExtentHistory
All Implemented Interfaces:
org.gvsig.tools.persistence.Persistent

public class ExtentHistory extends Object implements org.gvsig.tools.persistence.Persistent

ExtentHistory is designed for managing a history of extents.

Note: An extent is a rectangular area, with information of its top-left 2D corner.

Author:
Vicente Caballero Navarro
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of ExtentsHistory with an history of 10 extents.
    ExtentHistory(int numEntries)
    Creates a new instance of ExtentsHistory with an history of numEntries extents.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the current extent.
    Returns the last next extent from the history.
    Returns the last previous extent from the history.
    boolean
    Returns true if there are next extents registered.
    boolean
    Returns true if there are previous extents registered.
    void
    loadFromState(org.gvsig.tools.persistence.PersistentState state)
     
    void
    Appends the specified extent at the end of the array of previous zooms.
    void
    saveToState(org.gvsig.tools.persistence.PersistentState state)
    Returns information of this object.
    Adds the current extent to the previous extent history and sets the last next extent as the new current extent.
    Adds the current extent to the next extent history and sets the last previous extent as the new current extent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExtentHistory

      public ExtentHistory()

      Creates a new instance of ExtentsHistory with an history of 10 extents.

    • ExtentHistory

      public ExtentHistory(int numEntries)

      Creates a new instance of ExtentsHistory with an history of numEntries extents.

      Parameters:
      numEntries - the maximum number of extents that will store the instance
  • Method Details

    • put

      public void put(Rectangle2D ext)

      Appends the specified extent at the end of the array of previous zooms.

      Parameters:
      ext - the new extent
    • hasPrevious

      public boolean hasPrevious()

      Returns true if there are previous extents registered.

      Returns:
      true if there are previous extents registered; false otherwise
    • hasNext

      public boolean hasNext()

      Returns true if there are next extents registered.

      Returns:
      true if there are next extents registered; false otherwise
    • getPrev

      public Rectangle2D getPrev()

      Returns the last previous extent from the history.

      Returns:
      the last previous extent from the history
    • getNext

      public Rectangle2D getNext()

      Returns the last next extent from the history.

      Returns:
      the last next extent from the history
    • setPreviousExtent

      public Rectangle2D setPreviousExtent()

      Adds the current extent to the next extent history and sets the last previous extent as the new current extent.

      Returns:
      the last previous extent as the new current extent
    • setNextExtent

      public Rectangle2D setNextExtent()

      Adds the current extent to the previous extent history and sets the last next extent as the new current extent.

      Returns:
      the last next extent as the new current extent
    • getCurrent

      public Rectangle2D getCurrent()

      Returns the current extent.

      Returns:
      the current extent
    • 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

      Returns information of this object. All information is stored as properties:

      Properties:

      • className: name of this class.
      • num: number of extents registered.
      • numrec: maximum number of extents that can register.
      • extents: .

      Specified by:
      saveToState in interface org.gvsig.tools.persistence.Persistent
      Throws:
      org.gvsig.tools.persistence.exception.PersistenceException