Package hec.gfx2d

Class G2dPolygon

java.lang.Object
java.awt.Polygon
hec.gfx2d.G2dPolygon
All Implemented Interfaces:
ActionListener, Shape, Serializable, EventListener

public class G2dPolygon extends Polygon implements ActionListener
G2dPolygon - This class is responsible for representing and drawing a polygon to the screen. The polygon provides methods for drawing the polygon to a graphics context with in a certain clipping region.
See Also:
  • Field Details

  • Constructor Details

    • G2dPolygon

      public G2dPolygon()
      Constructs a new Polygon with default properties
    • G2dPolygon

      public G2dPolygon(G2dPolygonProperties prop)
      Constructs a new polygon with the given properties
    • G2dPolygon

      public G2dPolygon(int[] xpoints, int[] ypoints, int npoints)
      Constructs a new polygon with the given data
  • Method Details

    • setScale

      public void setScale(Scale s)
    • setGlyph

      public void setGlyph(G2dGlyph g)
    • showPopup

      public void showPopup(Component c, int x, int y)
    • createPopupMenu

      protected void createPopupMenu()
    • createEditMenu

      public JMenu createEditMenu()
    • getProperties

      public G2dPolygonProperties getProperties()
    • setProperties

      public void setProperties(G2dPolygonProperties propValue)
    • setPolygonData

      public void setPolygonData(int[] xdata, int[] ydata, int npts)
    • contains

      public boolean contains(LocalPt pt)
      This method test the given point to see if the point falls within the given polygon. In other words the point needs to be bounded on all sided by the perimeter of the polygon and the point must be in the same units as the polygon
      Returns:
      true if the point is bounded by the polygon, otherwise false
    • drawPolygon

      public void drawPolygon(Graphics g, Rectangle clipRect)
      This method draws the contents of this polygon to this polygon to the selected graphics context. If any part of the polygon falls outside of the clipping region then the polygon is clipped to fit within the clipping region.
      Parameters:
      clipRect - - the Rectange that defines a clipping rectangle that bounds the polygon
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Specified by:
      actionPerformed in interface ActionListener
    • editProperties

      public void editProperties()
      Method that allows the editing of line properties. This method displays a visible dialog for line editing.