jfig.objects
Class FigEllipse

java.lang.Object
  extended byjfig.objects.FigBaseobject
      extended byjfig.objects.FigEllipse
All Implemented Interfaces:
FigDrawable, FigObject
Direct Known Subclasses:
Circle, SolderDot

public class FigEllipse
extends FigBaseobject

FIG ellipse/circle object.


Field Summary
(package private)  java.awt.Point center
           
(package private)  FigRenderer renderer
           
(package private)  java.awt.Point size
           
 
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
FigEllipse(java.awt.Point p1, java.awt.Point p2, FigAttribs attribs, FigTrafo2D trafo)
          Basic FigEllipse constructor, center Point p1.
 
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()
          build a copy of this FigEllipse object.
 void createRenderer()
           
 java.awt.Point deletePoint(java.awt.Point wp)
          delete the Point with specified coords from our Point list.
 java.awt.Point getCenterPoint()
           
 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()
          return a list of all Points of this objects.
 java.awt.Point getRadiusPoint()
           
 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.
 double minDistance(java.awt.Point wp)
          return the minimum distance of any points (edges,corners) of this object and the Point wp.
 void mirrorX(int mirror_x, int mirror_y)
          mirrorX():
 void mirrorY(int mirror_x, int mirror_y)
          mirrorY():
 void move(int dx, int dy)
          method stub for the move() method
 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 rebuild()
          rebuild (=re-initialize) this object given its current points, attributes, transformation, and the global Java2D enable status.
 void rotate(java.awt.Point anchor, double angle_in_rad)
          Try to rotate a FigEllipse, as best as we currently can.
 void setAttributes(FigAttribs attribs)
          set object attributes
 void setCenterAndRadius(java.awt.Point p1, java.awt.Point p2)
           
 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[] pp)
          set PointList (if any), world-coordinates.
 void setTrafo(FigTrafo2D trafo)
          set transformation
 boolean supportsPointOps()
          yes, we support the point operations (actually, only movePoint).
 java.lang.String toString()
          debug object information
(package private)  void update_bbox()
           
 void update(FigAttribs new_attribs)
          update(): get the new text attribs and recalculate the bbox.
 
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, minDistanceEuclid, numPoints, paint, paintSave, reset_debug, scale, select, set_debug, setComment, setConsole, setObjectPainter, setSyncRedrawFlag, setText, setVisible, showPoints, updateAttributes, writeAsResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

renderer

FigRenderer renderer

center

java.awt.Point center

size

java.awt.Point size
Constructor Detail

FigEllipse

public FigEllipse(java.awt.Point p1,
                  java.awt.Point p2,
                  FigAttribs attribs,
                  FigTrafo2D trafo)
Basic FigEllipse constructor, center Point p1. Point p2 is used to specify the radius(es).

Method Detail

createRenderer

public void createRenderer()

setAttributes

public void setAttributes(FigAttribs attribs)
Description copied from class: FigBaseobject
set object attributes

Specified by:
setAttributes in interface FigObject
Overrides:
setAttributes in class FigBaseobject

getCenterPoint

public java.awt.Point getCenterPoint()

getRadiusPoint

public java.awt.Point getRadiusPoint()

setTrafo

public void setTrafo(FigTrafo2D trafo)
Description copied from class: FigBaseobject
set transformation

Specified by:
setTrafo in interface FigObject
Overrides:
setTrafo in class FigBaseobject

setCenterAndRadius

public void setCenterAndRadius(java.awt.Point p1,
                               java.awt.Point p2)

rebuild

public void rebuild()
Description copied from interface: FigObject
rebuild (=re-initialize) this object given its current points, attributes, transformation, and the global Java2D enable status. This is a potentially expensive but sometimes necessary operation.

Specified by:
rebuild in interface FigObject
Overrides:
rebuild in class FigBaseobject

getPoints

public java.awt.Point[] getPoints()
Description copied from class: FigBaseobject
return a list of all Points of this objects. No Points in a FigBaseobject.

Specified by:
getPoints in interface FigObject
Overrides:
getPoints in class FigBaseobject

setPoints

public void setPoints(java.awt.Point[] pp)
Description copied from interface: FigObject
set PointList (if any), world-coordinates. This function should be used by input file parsers to speed up the construction of polylines, polygons, or splines with many points.

Specified by:
setPoints in interface FigObject
Overrides:
setPoints in class FigBaseobject

supportsPointOps

public boolean supportsPointOps()
yes, we support the point operations (actually, only movePoint).

Specified by:
supportsPointOps in interface FigObject
Overrides:
supportsPointOps in class FigBaseobject

isClosed

public boolean isClosed()
Description copied from interface: FigObject
return true if this object is 'closed' (polygon vs. polyline, etc)

Specified by:
isClosed in interface FigObject
Overrides:
isClosed in class FigBaseobject

appendPoint

public void appendPoint(java.awt.Point wp)
No, we cannot append, insert, or delete a Point in a rectangle. Therefore, these functions just return without doing anything.

(To support these operations, we might convert the FigRectangle automatically into a polygon. But currently I don't want this.)

Specified by:
appendPoint in interface FigObject
Overrides:
appendPoint in class FigBaseobject

deletePoint

public java.awt.Point deletePoint(java.awt.Point wp)
Description copied from class: FigBaseobject
delete the Point with specified coords from our Point list.

Specified by:
deletePoint in interface FigObject
Overrides:
deletePoint in class FigBaseobject

insertPoint

public void insertPoint(java.awt.Point wp,
                        java.awt.Point wpnew)
Description copied from class: FigBaseobject
insert a Point wp into our Point list after Point wprev.

Specified by:
insertPoint in interface FigObject
Overrides:
insertPoint in class FigBaseobject

getMovePointNeighbors

public 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.

Specified by:
getMovePointNeighbors in interface FigObject
Overrides:
getMovePointNeighbors in class FigBaseobject

movePoint

public void movePoint(java.awt.Point wp,
                      java.awt.Point wpnew)
move the Point wp to position wpnew. Note that this method will search and move the rectangle corner nearest to wp, independent of the actual distance.

Specified by:
movePoint in interface FigObject
Overrides:
movePoint in class FigBaseobject

getNearestPoint

public java.awt.Point getNearestPoint(java.awt.Point wp)
Description copied from class: FigBaseobject
return the point of this object nearest to Point wp, if any.

Specified by:
getNearestPoint in interface FigObject
Overrides:
getNearestPoint in class FigBaseobject

getNeighborPoints

public java.awt.Point[] getNeighborPoints(java.awt.Point wp)
Description copied from class: FigBaseobject
get the two neighbor Points for the specified Point wp from our Point list.

Specified by:
getNeighborPoints in interface FigObject
Overrides:
getNeighborPoints in class FigBaseobject

update_bbox

void update_bbox()

paint

public void paint(java.awt.Graphics g)
Description copied from class: FigBaseobject
paint() this object. This function currently handles drawing the bounding box corners with emply rectangles for (showPoint) and with filled rectangles for (selected). Subclasses can therefore directly call this method to implement drawing of (showPoints) and (selected) objects.

Specified by:
paint in interface FigObject
Overrides:
paint in class FigBaseobject

move

public void move(int dx,
                 int dy)
Description copied from class: FigBaseobject
method stub for the move() method

Specified by:
move in interface FigObject
Overrides:
move in class FigBaseobject

copy

public FigObject copy()
build a copy of this FigEllipse object.

Specified by:
copy in interface FigObject
Overrides:
copy in class FigBaseobject

mirrorX

public void mirrorX(int mirror_x,
                    int mirror_y)
mirrorX():

Specified by:
mirrorX in interface FigObject
Overrides:
mirrorX in class FigBaseobject

mirrorY

public void mirrorY(int mirror_x,
                    int mirror_y)
mirrorY():

Specified by:
mirrorY in interface FigObject
Overrides:
mirrorY in class FigBaseobject

update

public void update(FigAttribs new_attribs)
update(): get the new text attribs and recalculate the bbox.

Specified by:
update in interface FigObject
Overrides:
update in class FigBaseobject

canRotate

public boolean canRotate(double angle_in_rad)
Specified by:
canRotate in interface FigObject
Overrides:
canRotate in class FigBaseobject

rotate

public void rotate(java.awt.Point anchor,
                   double angle_in_rad)
Try to rotate a FigEllipse, as best as we currently can. Due to the very incomplete status of FigEllipse with respect to rotation angle != 0, we use the following hack: First, we retrieve the current values of the ellipse center point and the "radius point" (which gives the ellipse size for the un-rotated ellipse). Next, we rotate the center point using a standard rotation matrix. Then, we update the FigAttribs.fig_ellipse_angle value. However, we keep the original (un-rotated!) value of the radius. Finally, we are ready to call rebuild. This algorithm provides the correct visual for the ellipse, even if the bounding box still is sub-optimal.

Specified by:
rotate in interface FigObject
Overrides:
rotate in class FigBaseobject

setLayer

public 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. Note that changing the layer attribute DOES NOT AUTOMATICALLY re-sort the objectlist of the editor/viewer that this object belongs to. Therefore, you might want to do something like this: polyline.setLayer( newLayer ); editor.removeFromObjectList( polyline ); editor.insertIntoObjectList( polyline );


setLineColor

public void setLineColor(java.awt.Color c)
set a new line color


setLineWidth

public void setLineWidth(int fig_line_width)
set the line width to one of the predefined FIG widths, e.g. setLineWidth( FigAttribs.LINE_WIDTH_1 )


setLineStyle

public void setLineStyle(int fig_line_style)
set the line style to one of the predefined FIG styles, e.g. setLineStyle( FigAttribs.DASHED_LINE )


setFillColor

public void setFillColor(java.awt.Color c)
set a new fill color


setFillStyle

public 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.


minDistance

public double minDistance(java.awt.Point wp)
return the minimum distance of any points (edges,corners) of this object and the Point wp. Coordinates are world-coordinates, the distance is therefore given as a multiple of 2400 dpi.

Specified by:
minDistance in interface FigObject
Overrides:
minDistance in class FigBaseobject

toString

public java.lang.String toString()
debug object information

Specified by:
toString in interface FigObject
Overrides:
toString in class FigBaseobject