jfig.objects
Interface FigObject

All Superinterfaces:
FigDrawable
All Known Implementing Classes:
FigBaseobject, FigPolyline

public interface FigObject
extends FigDrawable

base FIG object interface.

The basic graphics editor object interface.

A simple stub implementation that may be subclassed for actual objects can be found in jfig.objects.FigBaseobject.java


Method Summary
 void appendPoint(java.awt.Point wp)
          append the new Point wp (in world coords) at the end of the Point list.
 boolean canRotate(double angle_in_rad)
           
 FigObject copy()
          method stub for the copy() method
 java.awt.Point deletePoint(java.awt.Point wp)
          delete the selected Point (world-coordinates) if possible.
 void deselect()
          mehtod stub for the deselect() mehtod
 FigBbox get_sc_bbox()
          get bounding box (in screen coordinates)
 FigAttribs getAttributes()
          get object attributes
 FigBbox getBbox()
          get bounding box (in world coordinates)
 java.lang.String getComment()
          get the comment for this object (may be null).
 int getLayer()
          get layer (depth)
 java.awt.Point[] getMovePointNeighbors(java.awt.Point wp)
          get the neighbor Points for a move point operation
 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 neighbor Points for the given Point wp (in world-coords).
 java.awt.Point[] getPoints()
          get PointList (if any), world-coordinates
 java.awt.Point getPosition()
          get object position (usually the top-left corner)
 java.lang.String getText()
          get the object's text, if any
 FigTrafo2D getTrafo()
          get transformation
 boolean initialize(java.lang.String s)
           
 void insertPoint(java.awt.Point wp, java.awt.Point prev)
          insert the new Point wp (in world-coords) after Point prev into the Point list.
 boolean isClosed()
          return true if this object is 'closed' (polygon vs.
 boolean isSelected()
          get current selection status
 boolean isVisible()
           
 boolean isVisible(FigBbox bbox)
          is this object visible within the given FigBbox?
 void keyPressed(java.awt.event.KeyEvent e)
          react to a key event (e.g.
 double minDistance(java.awt.Point wp)
          return the minimum distance of reference point wp and this object (use fast and xfig compatible measure, like manhattan distance).
 double minDistanceEuclid(java.awt.Point wp)
          return the minimum distance of reference point wp and this object, using an accurate (and possibly computationally expensive) norm, like the length of the norm vector to a polygon segment.
 void mirrorX(int x, int y)
          method stub for mirrorX() method
 void mirrorY(int x, int y)
          method stub for mirrorY() method
 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 at position wp (in world coords) to new Position wpnew.
 int numPoints()
          get number of Points in this object
 void paint(java.awt.Graphics g)
          paint this object using a default transformation and Graphics g
 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()
          rebuild (=re-initialize) this object given its current points, attributes, transformation, and the global Java2D enable status.
 void reset_debug()
          reset debug flag
 void rotate(java.awt.Point anchor, double angle_in_rad)
          method stub for rotate() - allow for Exceptions if the object doesn't support the specified angle.
 void scale(java.awt.Point origin, double factor_x, double factor_y)
          method stub for the scale() method
 void select()
          method stub for the select() method.
 void set_debug()
          set debug flag
 void setAttributes(FigAttribs attribs)
           
 void setComment(java.lang.String s)
          set a comment for this object.
 void setObjectPainter(ObjectPainter canvas)
           
 void setPoints(java.awt.Point[] wcp)
          set PointList (if any), world-coordinates.
 void setText(java.lang.String s)
          set the object's text
 void setTrafo(FigTrafo2D trafo)
          set transformation
 void setVisible(boolean v)
           
 void showPoints()
          method stub for the showPoints() method.
 boolean supportsPointOps()
          return true if this object supports the polyline add/insert/ append/cut/move single Point functions.
 java.lang.String toString()
          debug object information
 void update(FigAttribs parent_attribs)
          method stub for update() method.
 void updateAttributes(java.lang.String stringWithAttributes)
           
 void writeAsResource(java.io.PrintWriter ps)
          write a complete text representation of this object
 
Methods inherited from interface jfig.canvas.FigDrawable
getSyncRedrawFlag, setSyncRedrawFlag
 

Method Detail

paint

public void paint(java.awt.Graphics g)
Description copied from interface: FigDrawable
paint this object using a default transformation and Graphics g

Specified by:
paint in interface FigDrawable

paint

public void paint(java.awt.Graphics g,
                  FigTrafo2D trafo)
Description copied from interface: FigDrawable
paint this object using the specified transformation and Graphics g

Specified by:
paint in interface FigDrawable

paintSave

public void paintSave(java.awt.Graphics g,
                      FigTrafo2D trafo)

isVisible

public boolean isVisible(FigBbox bbox)
Description copied from interface: FigDrawable
is this object visible within the given FigBbox?

Specified by:
isVisible in interface FigDrawable

initialize

public boolean initialize(java.lang.String s)

setObjectPainter

public void setObjectPainter(ObjectPainter canvas)

setVisible

public void setVisible(boolean v)

isVisible

public boolean isVisible()

setTrafo

public void setTrafo(FigTrafo2D trafo)
set transformation

Specified by:
setTrafo in interface FigDrawable

getTrafo

public FigTrafo2D getTrafo()
get transformation


getLayer

public int getLayer()
get layer (depth)


getBbox

public FigBbox getBbox()
get bounding box (in world coordinates)

Specified by:
getBbox in interface FigDrawable

get_sc_bbox

public FigBbox get_sc_bbox()
get bounding box (in screen coordinates)

Specified by:
get_sc_bbox in interface FigDrawable

getPosition

public java.awt.Point getPosition()
get object position (usually the top-left corner)


getAttributes

public FigAttribs getAttributes()
get object attributes


setAttributes

public void setAttributes(FigAttribs attribs)

updateAttributes

public void updateAttributes(java.lang.String stringWithAttributes)

set_debug

public void set_debug()
set debug flag


reset_debug

public void reset_debug()
reset debug flag


move

public void move(int dx,
                 int dy)
method stub for the move() method


copy

public FigObject copy()
method stub for the copy() method


mirrorX

public void mirrorX(int x,
                    int y)
method stub for mirrorX() method


mirrorY

public void mirrorY(int x,
                    int y)
method stub for mirrorY() method


scale

public void scale(java.awt.Point origin,
                  double factor_x,
                  double factor_y)
method stub for the scale() method


rotate

public void rotate(java.awt.Point anchor,
                   double angle_in_rad)
            throws java.lang.Exception
method stub for rotate() - allow for Exceptions if the object doesn't support the specified angle.

Throws:
java.lang.Exception

canRotate

public boolean canRotate(double angle_in_rad)

update

public void update(FigAttribs parent_attribs)
method stub for update() method. The FigObject should update all of it's internal FigAttribs to parent_attribs.

Parameters:
parent_attribs - The current editor FigAttribs object.

rebuild

public void rebuild()
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.


showPoints

public void showPoints()
method stub for the showPoints() method. The object will paint() its control points (e.g. the bbox for a rectangle, origin and radius for a circle, the control points for a spline). Similar to xfig, these points should be marked with small rectangles. showPoints() is deactivated again by calling deselect().


select

public void select()
method stub for the select() method. Similar to xfig, a selected object will paint its control points with small filled rectangles. select() is deactivated again by calling deselect().


deselect

public void deselect()
mehtod stub for the deselect() mehtod


isSelected

public boolean isSelected()
get current selection status


supportsPointOps

public boolean supportsPointOps()
return true if this object supports the polyline add/insert/ append/cut/move single Point functions.


numPoints

public int numPoints()
get number of Points in this object


isClosed

public boolean isClosed()
return true if this object is 'closed' (polygon vs. polyline, etc)


getPoints

public java.awt.Point[] getPoints()
get PointList (if any), world-coordinates


setPoints

public void setPoints(java.awt.Point[] wcp)
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.


deletePoint

public java.awt.Point deletePoint(java.awt.Point wp)
delete the selected Point (world-coordinates) if possible. Compare the xfig 'cut point' function for polylines.


getNearestPoint

public java.awt.Point getNearestPoint(java.awt.Point wp)
return the point of this object nearest to Point wp, if any.


getNeighborPoints

public java.awt.Point[] getNeighborPoints(java.awt.Point wp)
get the neighbor Points for the given Point wp (in world-coords). This function returns an array of three Points: the preceding and the two following Points.


getMovePointNeighbors

public java.awt.Point[] getMovePointNeighbors(java.awt.Point wp)
get the neighbor Points for a move point operation


appendPoint

public void appendPoint(java.awt.Point wp)
append the new Point wp (in world coords) at the end of the Point list.


insertPoint

public void insertPoint(java.awt.Point wp,
                        java.awt.Point prev)
insert the new Point wp (in world-coords) after Point prev into the Point list.


movePoint

public void movePoint(java.awt.Point wp,
                      java.awt.Point wpnew)
move the Point at position wp (in world coords) to new Position wpnew.


getText

public java.lang.String getText()
get the object's text, if any


setText

public void setText(java.lang.String s)
set the object's text


minDistance

public double minDistance(java.awt.Point wp)
return the minimum distance of reference point wp and this object (use fast and xfig compatible measure, like manhattan distance).


minDistanceEuclid

public double minDistanceEuclid(java.awt.Point wp)
return the minimum distance of reference point wp and this object, using an accurate (and possibly computationally expensive) norm, like the length of the norm vector to a polygon segment.


keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
react to a key event (e.g. for a text object)


writeAsResource

public void writeAsResource(java.io.PrintWriter ps)
write a complete text representation of this object


toString

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


getComment

public java.lang.String getComment()
get the comment for this object (may be null).


setComment

public void setComment(java.lang.String s)
set a comment for this object.