|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfig.objects.FigBaseobject jfig.objects.FigRectangle
FIG rectangle objects, optionally with rounded corners.
A rectangle object for the graphics editor. The reference point is the top left corner.
Field Summary | |
protected int |
pixel_width
|
protected int |
radius
|
protected FigRenderer |
renderer
|
protected boolean |
use_rounded_corners
|
Fields inherited from class jfig.objects.FigBaseobject |
attribs, bbox, comment, debug, painter, printer, sc_bbox, sc_bbox_timestamp, selected, showPoints, syncRedrawFlag, timestamp, trafo, visible, x, y |
Constructor Summary | |
FigRectangle()
default constructor: 1inch square below the origin, layer 10 |
|
FigRectangle(FigBbox bbox,
int layer)
Basic constructor from bbox object. |
|
FigRectangle(int x1,
int y1,
int x2,
int y2,
boolean use_rounded_corners,
FigAttribs attribs,
FigTrafo2D trafo)
constructor with full parameter set. |
|
FigRectangle(int x1,
int y1,
int x2,
int y2,
int layer)
Basic rectangle constructor from (x1,y1) to (x2,y2) on (layer). |
Method Summary | |
void |
appendPoint(java.awt.Point wp)
No, we cannot append, insert, or delete a Point in a rectangle. |
boolean |
canRotate(double angle_in_rad)
|
FigObject |
copy()
make a copy of this object and return the reference to the copy. |
void |
createRenderer()
|
java.awt.Point |
deletePoint(java.awt.Point wp)
delete the Point with specified coords from our Point list. |
java.awt.Point[] |
getMovePointNeighbors(java.awt.Point wp)
getMovePointNeighbors( Point wp ): find the nearest Point of the rectangle and return an array with the opposite corner, to allow the main editor correct rubberbanding. |
java.awt.Point |
getNearestPoint(java.awt.Point wp)
return the point of this object nearest to Point wp, if any. |
java.awt.Point[] |
getNeighborPoints(java.awt.Point wp)
get the two neighbor Points for the specified Point wp from our Point list. |
java.awt.Point[] |
getPoints()
getPoints(): get bbox coordinates for this rectangle |
void |
insertPoint(java.awt.Point wp,
java.awt.Point wpnew)
insert a Point wp into our Point list after Point wprev. |
boolean |
isClosed()
return true if this object is 'closed' (polygon vs. |
boolean |
isRounded()
|
double |
minDistance(java.awt.Point wp)
return distance (currently Manhattan-distance) of the rectangle corners to the reference point wp. |
double |
minDistanceEuclid(java.awt.Point wp)
return a distance measure (in world coords units) between point wp and this rectangle which is useful for object selection. |
void |
mirrorX(int mirror_x,
int mirror_y)
mirrorX(): implemented as a move( dx, 0 ). |
void |
mirrorY(int mirror_x,
int mirror_y)
mirrorY(): implemented as a move( 0, dy ). |
void |
move(int dx,
int dy)
move() this rectangle. |
void |
movePoint(java.awt.Point wp,
java.awt.Point wpnew)
move the Point wp to position wpnew. |
void |
paint(java.awt.Graphics g)
paint() this object. |
void |
paint(java.awt.Graphics g,
FigTrafo2D trafo)
paint this object using the specified transformation and Graphics g |
void |
paintSave(java.awt.Graphics g,
FigTrafo2D trafo)
|
void |
rebuild()
as we store our coordinates directly as the bounding box coords, we have nothing to do here except to tell our renderer. |
void |
setAttributes(FigAttribs attribs)
set new object attributes and regenerate Java2D drawing stuff |
void |
setFillColor(java.awt.Color c)
set a new fill color |
void |
setFillStyle(int shade_or_pattern)
set the fill style to one of the predefined FIG values, where -1 implies NO_FILL, a value between 0..40 selects the corresponding shade/tint, and values >= 41 select one of the FIG fill patterns. |
void |
setLayer(int _layer)
set the layer (depth) for this polyline; the FIG format allows values in the range [1..1000] with 1 being the topmost layer. |
void |
setLineColor(java.awt.Color c)
set a new line color |
void |
setLineStyle(int fig_line_style)
set the line style to one of the predefined FIG styles, e.g. |
void |
setLineWidth(int fig_line_width)
set the line width to one of the predefined FIG widths, e.g. |
void |
setPoints(java.awt.Point[] wcp)
setPoints(): Set new bbox coordinates for this rectangle. |
boolean |
supportsPointOps()
yes, we support the point operations (actually, only movePoint). |
java.lang.String |
toString()
toString() for debug purposes. |
void |
update(FigAttribs new_attribs)
update(): Set the new rectangle attributes: lineColor, lineStyle, fillColor, fillStyle, ... |
Methods inherited from class jfig.objects.FigBaseobject |
build_sc_bbox, clonePoints, deselect, get_sc_bbox, getAttributes, getBbox, getComment, getLayer, getPosition, getSyncRedrawFlag, getText, getTimestamp, getTrafo, initialize, isSelected, isShowPoints, isVisible, isVisible, keyPressed, manhattan, message, numPoints, reset_debug, rotate, scale, select, set_debug, setComment, setConsole, setObjectPainter, setSyncRedrawFlag, setText, setTrafo, setVisible, showPoints, updateAttributes, writeAsResource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected FigRenderer renderer
protected boolean use_rounded_corners
protected int radius
protected int pixel_width
Constructor Detail |
public FigRectangle()
public FigRectangle(int x1, int y1, int x2, int y2, int layer)
public FigRectangle(FigBbox bbox, int layer)
public FigRectangle(int x1, int y1, int x2, int y2, boolean use_rounded_corners, FigAttribs attribs, FigTrafo2D trafo)
Method Detail |
public void createRenderer()
public void rebuild()
rebuild
in interface FigObject
rebuild
in class FigBaseobject
public void setAttributes(FigAttribs attribs)
setAttributes
in interface FigObject
setAttributes
in class FigBaseobject
public void setLayer(int _layer)
polyline.setLayer( newLayer );
editor.removeFromObjectList( polyline );
editor.insertIntoObjectList( polyline );
public void setLineColor(java.awt.Color c)
public void setLineWidth(int fig_line_width)
public void setLineStyle(int fig_line_style)
public void setFillColor(java.awt.Color c)
public void setFillStyle(int shade_or_pattern)
public boolean isRounded()
public java.awt.Point[] getPoints()
getPoints
in interface FigObject
getPoints
in class FigBaseobject
public void setPoints(java.awt.Point[] wcp)
setPoints
in interface FigObject
setPoints
in class FigBaseobject
public void update(FigAttribs new_attribs)
update
in interface FigObject
update
in class FigBaseobject
public FigObject copy()
copy
in interface FigObject
copy
in class FigBaseobject
public void move(int dx, int dy)
move
in interface FigObject
move
in class FigBaseobject
public void mirrorX(int mirror_x, int mirror_y)
mirrorX
in interface FigObject
mirrorX
in class FigBaseobject
public void mirrorY(int mirror_x, int mirror_y)
mirrorY
in interface FigObject
mirrorY
in class FigBaseobject
public boolean canRotate(double angle_in_rad)
canRotate
in interface FigObject
canRotate
in class FigBaseobject
public boolean supportsPointOps()
supportsPointOps
in interface FigObject
supportsPointOps
in class FigBaseobject
public boolean isClosed()
FigObject
isClosed
in interface FigObject
isClosed
in class FigBaseobject
public void appendPoint(java.awt.Point wp)
(To support these operations, we might convert the FigRectangle automatically into a polygon. But currently I don't want this.)
appendPoint
in interface FigObject
appendPoint
in class FigBaseobject
public java.awt.Point deletePoint(java.awt.Point wp)
FigBaseobject
deletePoint
in interface FigObject
deletePoint
in class FigBaseobject
public void insertPoint(java.awt.Point wp, java.awt.Point wpnew)
FigBaseobject
insertPoint
in interface FigObject
insertPoint
in class FigBaseobject
public java.awt.Point[] getMovePointNeighbors(java.awt.Point wp)
getMovePointNeighbors
in interface FigObject
getMovePointNeighbors
in class FigBaseobject
public void movePoint(java.awt.Point wp, java.awt.Point wpnew)
movePoint
in interface FigObject
movePoint
in class FigBaseobject
public java.awt.Point getNearestPoint(java.awt.Point wp)
FigBaseobject
getNearestPoint
in interface FigObject
getNearestPoint
in class FigBaseobject
public java.awt.Point[] getNeighborPoints(java.awt.Point wp)
FigBaseobject
getNeighborPoints
in interface FigObject
getNeighborPoints
in class FigBaseobject
public double minDistance(java.awt.Point wp)
minDistance
in interface FigObject
minDistance
in class FigBaseobject
public double minDistanceEuclid(java.awt.Point wp)
minDistanceEuclid
in interface FigObject
minDistanceEuclid
in class FigBaseobject
public void paint(java.awt.Graphics g)
FigBaseobject
paint
in interface FigObject
paint
in class FigBaseobject
public void paint(java.awt.Graphics g, FigTrafo2D trafo)
FigDrawable
paint
in interface FigObject
paint
in class FigBaseobject
public void paintSave(java.awt.Graphics g, FigTrafo2D trafo)
paintSave
in interface FigObject
paintSave
in class FigBaseobject
public java.lang.String toString()
toString
in interface FigObject
toString
in class FigBaseobject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |