geofasc.swing.model
public interface PolylineModel extends FigureModel
PolylineModel
is the interface for the data model of a polyline
figure. If the polyline figure is closed, i.e., the polyline has at least
three points and its first and last point have the same coordinates, it might
be treated as a polygon figure. Thus this model serves for both the related
figures. This interface is inherited from FigureModel
. Besides the
information maintained by FigureModel
, this model supports
access to the point set defining the poly[gon|line].Modifier and Type | Method and Description |
---|---|
boolean |
addPoint(int x,
int y)
Adds a point to this model's poly[gon|line].
|
boolean |
addPoint(int index,
int x,
int y)
Adds a point to this model's poly[gon|line] at the specified index.
|
boolean |
addPoint(int index,
Point point)
Adds a point to this model's poly[gon|line] at the specified index.
|
boolean |
addPoint(Point point)
Adds a point to this model's poly[gon|line].
|
int |
getIndexOfPoint(int x,
int y)
Gets the index of the point of this model's poly[gon|line] with the given
coordinates.
|
int |
getIndexOfPoint(Point point)
Gets the index of the point of this model's poly[gon|line].
|
int |
getNumberOfPoints()
Gets the total number of points defining this model's poly[gon|line].
|
Point |
getPoint(int index)
Gets the point of this model's poly[gon|line] with the given index.
|
Point[] |
getPoints()
Gets all points of this model's poly[gon|line].
|
int[] |
getXPoints()
Deprecated.
use
toAWTPolygon() and then
getXPoints() instead |
int[] |
getYPoints()
Deprecated.
use
toAWTPolygon() and then
getYPoints() instead |
boolean |
isClosed()
Determines whether this model's polyline is closed.
|
boolean |
removePoint(int index)
Removes the point with the given index from this model's poly[gon|line].
|
boolean |
removePoint(int x,
int y)
Removes the point with the given coordinates from this model's
poly[gon|line].
|
boolean |
removePoint(Point point)
Removes the given point from this model's poly[gon|line].
|
Point |
setPoint(int index,
int x,
int y)
Substitutes the point with the given index by a new one.
|
Point |
setPoint(int index,
Point point)
Substitutes the point with the given index by a new one.
|
boolean |
setPoints(Point[] points)
Substitutes all the points of this model's poly[gon|line].
|
Polygon |
toAWTPolygon() |
addChangeListener, getBounds, getBounds, getDirection, getFillColor, getHeight, getLineColor, getLocation, getLocationX, getLocationY, getSize, getWidth, isFilled, moveLocationBy, moveLocationBy, moveLocationBy, moveLocationXBy, moveLocationYBy, removeChangeListener, setDirection, setFillColor, setFilled, setLineColor, setLocation, setLocation, setLocationX, setLocationY, turnDirectionBy, turnDirectionTo
boolean addPoint(int x, int y)
x
- the x-location of the new pointy
- the y-location of the new pointboolean addPoint(int index, int x, int y)
index
- the index the new point is added tox
- the x-location of the new pointy
- the y-location of the new pointboolean addPoint(int index, Point point)
index
- the index the new point is added topoint
- the new pointboolean addPoint(Point point)
point
- the new pointint getIndexOfPoint(int x, int y)
x
- the x-location of the pointy
- the y-location of the pointint getIndexOfPoint(Point point)
point
- the point whose index is computedint getNumberOfPoints()
Point getPoint(int index)
index
- the index of the pointPoint[] getPoints()
int[] getXPoints()
int[] getYPoints()
boolean isClosed()
boolean removePoint(int index)
index
- the index of the point to removeboolean removePoint(int x, int y)
x
- the x-location of the pointy
- the y-location of the pointboolean removePoint(Point point)
point
- the point to removePoint setPoint(int index, int x, int y)
index
- the index of the point to be substitutedx
- the x-locationy
- the y-locationPoint setPoint(int index, Point point)
index
- the index of the point to be substitutedpoint
- the new pointboolean setPoints(Point[] points)
points
- the new pointsPolygon toAWTPolygon()