Package com.motivewave.platform.sdk.draw
Class Polygon
java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.Polygon
Draws a polygon with the given set of coordinates.
A fill color may be used to fill the interior of the shape.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(double x, double y, DrawContext ctx) Returns true if the polygon contains the given x and y coordinates within the given draw context.void
draw
(Graphics2D gc, DrawContext ctx) Draws the polygon (this is called by the study framework).Gets the color for drawing the fill (null for no fill).Gets the color for drawing the outline.Gets the stroke for displaying the outline.boolean
Gets the show fill attributeboolean
Gets the show outline attributeboolean
isVisible
(DrawContext ctx) Returns true if the polygon is currently visible within the given draw context.void
layout
(DrawContext ctx) Lays out the polygon by converting the start and end coordinates to x,y coordinates on the graph.void
setFillColor
(Color color) Sets the color for drawing the fill (null for no fill).void
setLineColor
(Color color) Sets the color of the line used to draw the outline.void
setShowFill
(boolean b) Sets the display of the fill.void
setShowOutline
(boolean b) Sets the display of the outline.void
Sets the stroke for displaying the outline.Methods inherited from class com.motivewave.platform.sdk.draw.Figure
getBounds, getPopupMessage, isUnderlay, setBounds, setPopupMessage, setUnderlay
-
Constructor Details
-
Polygon
Constructor- Parameters:
p1
- first point in the polygonp2
- second point in the polygonps
- remaining points in the polygon
-
-
Method Details
-
setShowOutline
public void setShowOutline(boolean b) Sets the display of the outline. Set to false to hide the outline.- Parameters:
b
- true if the outline of the polygon should be displayed
-
isShowOutline
public boolean isShowOutline()Gets the show outline attribute- Returns:
- true if the outline should be displayed
-
setShowFill
public void setShowFill(boolean b) Sets the display of the fill.- Parameters:
b
- true if the fill color should be displayed
-
isShowFill
public boolean isShowFill()Gets the show fill attribute- Returns:
- true if the fill should be displayed
-
getLineColor
Gets the color for drawing the outline.- Returns:
- the color of the line used to draw the outline.
-
setLineColor
Sets the color of the line used to draw the outline.- Parameters:
color
- outline color
-
getFillColor
Gets the color for drawing the fill (null for no fill).- Returns:
- the color used to draw the fill (null for no fill).
-
setFillColor
Sets the color for drawing the fill (null for no fill).- Parameters:
color
- fill color
-
setStroke
Sets the stroke for displaying the outline. If this value is null, the outline will not be drawn.- Parameters:
stroke
-
-
getStroke
Gets the stroke for displaying the outline.- Returns:
- stroke for displaying the outline
-
isVisible
Returns true if the polygon is currently visible within the given draw context. -
contains
Returns true if the polygon contains the given x and y coordinates within the given draw context. -
layout
Lays out the polygon by converting the start and end coordinates to x,y coordinates on the graph. This is called by the study framework. -
draw
Draws the polygon (this is called by the study framework).
-