java.lang.Object
org.gvsig.app.project.documents.layout.geometryadapters.GeometryAdapter
All Implemented Interfaces:
Cloneable, org.gvsig.tools.lang.Cloneable, org.gvsig.tools.persistence.Persistent
Direct Known Subclasses:
CircleAdapter, PolyLineAdapter

public abstract class GeometryAdapter extends Object implements org.gvsig.tools.persistence.Persistent, org.gvsig.tools.lang.Cloneable
Abstract adaptor to relate the geometries with the fframes and to be able to integrate them in the Layout.
Author:
Vicente Caballero Navarro
  • Field Details

    • PERSISTENCE_DEFINITION_NAME

      public static final String PERSISTENCE_DEFINITION_NAME
      See Also:
    • geomManager

      protected static final org.gvsig.fmap.geom.GeometryManager geomManager
  • Constructor Details

    • GeometryAdapter

      public GeometryAdapter()
  • Method Details

    • addPoint

      public int addPoint(Point2D point)
      Add a point to de geometry.
      Parameters:
      point - Point that is added.
      Returns:
      Number of points that contains the geometry.
    • end

      public void end()
      End the creation of the geometry with the last point added.
    • setGeometry

      protected void setGeometry(org.gvsig.fmap.geom.Geometry geometry)
      Adds the GeneralPathX with all the points of the geometry.
      Parameters:
      gpx - GeneralPathX
    • obtainShape

      public abstract void obtainShape(Point2D p)
      Obtains the geometry passing him as parameter the last point.
      Parameters:
      p - Last Point.
      Throws:
      org.gvsig.fmap.geom.exception.CreateGeometryException
    • applyTransform

      public void applyTransform(AffineTransform at)
      Applies the transformation to all the points of the geometry.
      Parameters:
      at - AffineTransform
    • draw

      public void draw(Graphics2D g, AffineTransform at, org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol symbol)
      It draws the geometry on the Graphics that is passed like parameter.
      Parameters:
      g - Graphics
      at - AffineTransform
      symbol - FSymbol
    • print

      public void print(Graphics2D g, AffineTransform at, org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol symbol, org.gvsig.compat.print.PrintAttributes properties)
      It print the geometry on the Graphics that is passed like parameter.
      Parameters:
      g - Graphics
      at - AffineTransform
      symbol - ISymbol
      properties -
    • paint

      public abstract void paint(Graphics2D g, AffineTransform at, boolean andLastPoint)
      Paints the geometry on the Graphics adding him the last point if the parameter andLastPoint is true.
      Parameters:
      g - Graphics
      at - AffineTransform
      andLastPoint - If true add last point.
    • pointPosition

      public abstract void pointPosition(Point2D p)
      Set the point of cursor.
      Parameters:
      p - Point of cursor.
    • getGeometry

      public org.gvsig.fmap.geom.Geometry getGeometry(AffineTransform at)
      Obtains the shape of the Geometry.
      Returns:
      Geometry.
    • getGeometry

      public org.gvsig.fmap.geom.Geometry getGeometry()
      Returns the geometry to draw
      Returns:
      the geometry
    • getPoints

      public Point2D[] getPoints()
      Returns all the points of Geometry.
      Returns:
      Array of points.
    • drawVertex

      public void drawVertex(Graphics2D g, AffineTransform at)
      Draws a handler in each vertex of the Geometry.
      Parameters:
      g - Graphics
      at - AffineTransform.
    • changePoint

      public void changePoint(int pos, Point2D point)
      Modifies a point of the Geometry from an index by the one that is passed like parameter.
      Parameters:
      pos - Index
      point - Point
    • setPoints

      public void setPoints(Point2D[] points)
      Add all the points of Geometry.
      Parameters:
      points - All points.
    • delLastPoint

      public void delLastPoint()
      Remove last point of Geometry.
    • clone

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

      public Rectangle2D getBounds2D()
    • 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