Package hec.gfx2d
Class G2dPolygon
java.lang.Object
java.awt.Polygon
hec.gfx2d.G2dPolygon
- All Implemented Interfaces:
ActionListener,Shape,Serializable,EventListener
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 Summary
FieldsModifier and TypeFieldDescriptionprotected G2dPolygonPropertiesReference to it properties objectprotected static final String -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Polygon with default propertiesG2dPolygon(int[] xpoints, int[] ypoints, int npoints) Constructs a new polygon with the given dataConstructs a new polygon with the given properties -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) booleanThis method test the given point to see if the point falls within the given polygon.protected voidvoiddrawPolygon(Graphics g, Rectangle clipRect) This method draws the contents of this polygon to this polygon to the selected graphics context.voidMethod that allows the editing of line properties.voidvoidsetPolygonData(int[] xdata, int[] ydata, int npts) voidsetProperties(G2dPolygonProperties propValue) voidvoidMethods inherited from class java.awt.Polygon
addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate
-
Field Details
-
_properties
Reference to it properties object -
EDIT_PROPERTIES
- See Also:
-
-
Constructor Details
-
G2dPolygon
public G2dPolygon()Constructs a new Polygon with default properties -
G2dPolygon
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
-
setGlyph
-
showPopup
-
createPopupMenu
protected void createPopupMenu() -
createEditMenu
-
getProperties
-
setProperties
-
setPolygonData
public void setPolygonData(int[] xdata, int[] ydata, int npts) -
contains
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
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
- Specified by:
actionPerformedin interfaceActionListener
-
editProperties
public void editProperties()Method that allows the editing of line properties. This method displays a visible dialog for line editing.
-