public interface EditableShape extends Shape
Shape
that implements specific methods
to be modified (edited) in a graphic environmentModifier and Type | Method and Description |
---|---|
void |
aproximateNearestBorder(double x,
double y)
Moves towards a specific point the side of the shape that is located nearest it.
.
|
void |
changeBorder(double x,
double y)
Changes the co-ordinates of the previously marked corner to (x, y)
|
Object |
clone()
Makes a copy of the shape.
|
void |
deselectBorder()
Unselects the selected border of the shape, if any.
|
double |
distanceTo(double x,
double y)
Computes the distance between a supplied point and the nearest limit of the shape.
|
EditableShape[] |
divide(double x,
double y)
Divides the shape taking (x,y) as the "significant" point of the division.
|
void |
drawBorders(Graphics g)
Draws the shape with dragable sides
|
Point2D[] |
getBorders()
Gets an array with all the corners and other special points of the shape.
|
Point2D |
getEndPoint()
Gets the point of the shape that is considered as "ending" point.
|
Point2D |
getInitialPoint()
Returns the point of the shape that acts as "starting" point.
|
Point2D |
getNearestBorder(double x,
double y)
Rerturns the starting point of the side of the shape nearest to a specific point.
|
Point2D |
getNotSelectedBorder()
Gets the starting point of the first non-selected side of the shape
|
boolean |
hasClickedBorder(double x,
double y,
boolean needSelected)
Checks if the specified point lies within a side of the shape
|
boolean |
hasSelectedBorder()
Checks if the shape currently has a selected side.
|
boolean |
isAdjacentTo(Point2D p)
Checks if the shape is adjacent to a specific point.
|
boolean |
isInto(Rectangle2D r)
Checks if the shape is into the limits of a specific
Rectangle . |
boolean |
isSelected()
Checks if the shape is selected
|
void |
paint(Graphics g,
int drawingMode)
Draws the shape with the default colour
|
void |
paintSelection(Graphics g)
Draws squares in black and the remainder objects in the selection color
(EditableShapeConstants.selectedColor)
|
void |
paintWithColor(Graphics g,
int drawingMode,
Color c)
Draws the shape with the indicated color.
|
void |
selectBorder(double x,
double y)
Selects the side of the shape that lies with the specified point (if any).
|
void |
setSelected(boolean b)
Selects/unselects the shape
|
void |
transform(AffineTransform aTransf)
Applies an affine transformation (rotation, trnaslation, scale...) to the shape
|
contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, intersects, intersects
void setSelected(boolean b)
b
- The state (selected/unselected) of the shapeboolean isSelected()
true
if the shape is selected, false
otherwise.void paint(Graphics g, int drawingMode)
g
- The graphic environment where to draw the shapedrawingMode
- The drawing mode. Squares are drawed in red when this value is ShapeGenPanel.NEW_POINTvoid paintWithColor(Graphics g, int drawingMode, Color c)
g
- The graphic environment where to draw the shapedrawingMode
- The drawing mode. Squares are drawed in red when this value is
ShapeGenPanel.NEW_POINTc
- The color to be used to draw the shapevoid paintSelection(Graphics g)
g
- The graphic environment where to draw the shapevoid drawBorders(Graphics g)
g
- The graphic environment where to draw the shapeboolean hasClickedBorder(double x, double y, boolean needSelected)
x
- The horizontal co-ordinate of the point to checky
- The vertical co-ordinate of the point to checkneedSelected
- When the value of this param is true
, the side must be selected.true
when a side of the shape is near the point defined by x and y.void selectBorder(double x, double y)
x
- The horizontal co-ordinate of the point to checky
- The vertical co-ordinate of the point to checkPoint2D getNearestBorder(double x, double y)
x
- The horizontal co-ordinate of the pointy
- The vertical co-ordinate of the pointvoid aproximateNearestBorder(double x, double y)
x
- The horizontal co-ordinate of the pointy
- The vertival co-ordinate of the pointdouble distanceTo(double x, double y)
x
- The horizontal co-ordinate of the pointy
- The vertical co-ordinate of the pointboolean isInto(Rectangle2D r)
Rectangle
.r
- The rectangle to be checkedtrue
if the shape intersects with the rectangle, false
otherwise.void changeBorder(double x, double y)
x
- The horizontal co-ordinate of the pointy
- The vertical co-ordinate of the pointvoid deselectBorder()
Point2D getNotSelectedBorder()
boolean hasSelectedBorder()
true
if the shape has a selected side, false
otherwise.void transform(AffineTransform aTransf)
aTransf
- The affine transformation to be appliedEditableShape[] divide(double x, double y)
x
- The horizontal co-ordinate of the pointy
- The vertical co-ordinate of the pointboolean isAdjacentTo(Point2D p)
p
- The point to be checkedtrue
if the shape is adjacent to the point, false
otherwisePoint2D getInitialPoint()
Point2D getEndPoint()
Point2D[] getBorders()
Object clone()
Copyright © 2004-15 Francesc Busquets (fbusquets@xtec.cat) & Departament d'Educació de la Generalitat de Catalunya (info@xtec.cat)
Licensed under the terms of the GNU General Public License.