|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractPaintable
|
+--com.rolemodelsoft.drawlet.basics.AbstractFigure
|
+--com.rolemodelsoft.drawlet.shapes.AbstractShape
|
+--com.rolemodelsoft.drawlet.shapes.lines.LinearShape
This provides basic default functionality for LineFigures that are assumed to be moveable and reshapeable with observers that want to know when their locations or shapes change. It provides most of its functionality based on its bounds, plus some additional facilities which assume the line is made up of multiple locators, and forces concrete subclasses to define, at a minimum: paint(Graphics); getLocator(int); getNumberOfPoints(); basicAddLocator(Locator,int); basicSetLocator(Locator,int); basicRemoveLocator(int);
| Field Summary | |
protected java.awt.Color |
lineColor
The color with which to paint the line. |
| Fields inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure |
listeners,
locationListeners |
| Fields inherited from interface com.rolemodelsoft.drawlet.Figure |
FILL_COLOR_PROPERTY,
LINE_COLOR_PROPERTY,
LOCATION_PROPERTY,
RELATION_PROPERTY,
SHAPE_PROPERTY,
SIZE_PROPERTY,
STRING_PROPERTY,
STYLE_PROPERTY,
TEXT_COLOR_PROPERTY |
| Constructor Summary | |
LinearShape()
|
|
| Method Summary | |
void |
addLocator(int index,
Locator locator)
Add the locator at the appropriate position. |
void |
addLocator(Locator locator)
Add the locator at the end. |
protected abstract void |
basicAddLocator(int index,
Locator locator)
Add the locator at the given position. |
protected abstract void |
basicRemoveLocator(int index)
Remove the locator at the given position. |
protected void |
basicReshape(int x,
int y,
int width,
int height)
Reshapes the receiver to the specified bounding box. |
protected abstract void |
basicSetLocator(int index,
Locator locator)
Set the locator at the given position. |
protected void |
basicTranslate(int x,
int y)
Moves the receiver in the x and y direction. |
boolean |
contains(int x,
int y)
Checks whether a specified x,y location is "inside" the receiver, where x and y are defined to be relative to the coordinate system of the receiver. |
protected java.awt.Color |
defaultLineColor()
Answer the default/initial value for lineColor |
java.awt.Rectangle |
getBounds()
Returns the current bounds of the receiver. |
Handle[] |
getHandles()
Answer the handles associated with the receiver. |
java.awt.Color |
getLineColor()
Answer the Color to use when drawing lines. |
abstract Locator |
getLocator(int index)
Answer the indexth locator. |
abstract int |
getNumberOfPoints()
Answer the number of points which define the receiver. |
DrawingStyle |
getStyle()
Answer the style which defines how to paint the figure. |
protected boolean |
insideSegment(int x,
int y,
int x0,
int y0,
int x1,
int y1)
Answer whether the point specified is inside the specified line segment. |
protected double |
insideTolerance()
Answer a number to define how close we have to be to the geometric line to be considered inside it. |
protected double |
insideTolerance(double slope)
Answer a number to define how close we have to be to the geometric line to be considered inside it, given a particular slope. |
boolean |
intersects(java.awt.Rectangle bounds)
Answers whether the receiver intersects a rectangular area. |
Locator |
locatorAt(int x,
int y)
Answers a locator corresponding to a significant point on the receiver. |
void |
paint(java.awt.Graphics g)
Paints the receiver. |
void |
removeLocator(int index)
Remove the locator at the given position. |
Locator |
requestConnection(Figure requestor,
int x,
int y)
Answers a Locator corresponding to a significant point on the receiver that will serve as a connection to the other figure. |
void |
setLineColor(java.awt.Color color)
Set the Color to use when drawing lines. |
void |
setLocator(int index,
Locator locator)
Set the locator at the appropriate position. |
void |
setStyle(DrawingStyle style)
Set the DrawingStyle defining how to paint the receuver. |
| Methods inherited from class com.rolemodelsoft.drawlet.shapes.AbstractShape |
basicResize,
resetBoundsCache,
resetSizeCache,
reshapedPolygon,
reshapedPolygon,
setBounds,
setSize |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure |
addPropertyChangeListener,
addRelatedLocationListener,
basicMove,
changedLocation,
changedShape,
changedSize,
contains,
contains,
deleteLocationListeners,
disconnect,
duplicate,
duplicateIn,
editTool,
estimatedDuplicateSize,
figureFromLocator,
fireLocationChange,
firePropertyChange,
firePropertyChange,
fireRelationChange,
fireShapeChange,
fireSizeChange,
getLocation,
getLocator,
intersects,
isObsolete,
isWithin,
isWithin,
move,
move,
postDuplicate,
relatedLocationListeners,
removePropertyChangeListener,
removeRelatedLocationListener,
resetLocationCache,
setSize,
translate |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractPaintable |
getBottom,
getHeight,
getLeft,
getRight,
getSize,
getTop,
getWidth |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected java.awt.Color lineColor
| Constructor Detail |
public LinearShape()
| Method Detail |
public void addLocator(int index,
Locator locator)
locator - the new Locator to add.index - the index of the locator desired.public void addLocator(Locator locator)
locator - the new Locator to add.
protected abstract void basicAddLocator(int index,
Locator locator)
index - the index to add the Locator at.locator - the new Locator.protected abstract void basicRemoveLocator(int index)
index - the index of the locator no longer desired.
protected void basicReshape(int x,
int y,
int width,
int height)
x - the x coordinatey - the y coordinatewidth - the width of the figureheight - the height of the figuregetBounds()
protected abstract void basicSetLocator(int index,
Locator locator)
index - the index of the locator to be set.locator - the new Locator.
protected void basicTranslate(int x,
int y)
x - amount to move in the x directiony - amount to move in the y direction
public boolean contains(int x,
int y)
x - the x coordinatey - the y coordinatetrue if the specified x,y
location is "inside" this figure;
false otherwise.protected java.awt.Color defaultLineColor()
public java.awt.Rectangle getBounds()
public Handle[] getHandles()
public java.awt.Color getLineColor()
public abstract Locator getLocator(int index)
index - the index of the locator desired.public abstract int getNumberOfPoints()
public DrawingStyle getStyle()
protected boolean insideSegment(int x,
int y,
int x0,
int y0,
int x1,
int y1)
x - the x coordinate of the point being tested.y - the y coordinate of the point being tested.x0 - the x coordinate of the beginning of the line segment.y0 - the y coordinate of the beginning of the line segment.x1 - the x coordinate of the end of the line segment.y2 - the y coordinate of the end of the line segment.true if the point specified is
inside the line segment specified;
false otherwise.protected double insideTolerance()
protected double insideTolerance(double slope)
public boolean intersects(java.awt.Rectangle bounds)
bounds - the rectangular area.true if the receiver intersects the
specified rectangular area;
false otherwise.
public Locator locatorAt(int x,
int y)
x - the x coordinate of the requested locatory - the y coordinate of the requested locatorpublic void paint(java.awt.Graphics g)
g - the specified Graphics windowpublic void removeLocator(int index)
index - the index of the locator to be removed.
public Locator requestConnection(Figure requestor,
int x,
int y)
x - the x coordinate of the requested locatory - the y coordinate of the requested locatorpublic void setLineColor(java.awt.Color color)
color - the color
public void setLocator(int index,
Locator locator)
index - the index of the locator desired.locator - the new Locator.public void setStyle(DrawingStyle style)
style - the specified DrawingStyle.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||