jfig.objects
Class FigTrigger

java.lang.Object
  extended byjfig.objects.FigBaseobject
      extended byjfig.objects.FigTrigger
All Implemented Interfaces:
FigDrawable, FigObject

public class FigTrigger
extends FigBaseobject

simple active (hyperlink) objects for jfig.

This class provides very simple and basic active objects for the jfig viewer. A FigTrigger objects is realized as a rectangle on the fixed layer 100 (very deep). However, unless explicitly selected, the trigger object will not be displayed. When the user clicks on the inside of this rectangle in the jfig viewer, the viewer will try to load a new FIG file, as specified by the basename/filename attributes of the FigTrigger.

Note that the jfig editor (ModularEditor) is able to create trigger objects, but it will not follow the hyperlinks. You will probably want to create and edit in ModularEditor, and test and debug with the Viewer, both open at the same time.

See Also:
ModularEditor, Viewer

Field Summary
(package private)  java.lang.String basename
           
(package private)  java.lang.String filename
           
(package private)  boolean visible
           
(package private)  FillWrapper wfill
           
(package private)  LineWrapper wline
           
 
Fields inherited from class jfig.objects.FigBaseobject
attribs, bbox, comment, debug, painter, printer, sc_bbox, sc_bbox_timestamp, selected, showPoints, syncRedrawFlag, timestamp, trafo, x, y
 
Constructor Summary
FigTrigger(FigBbox bbox, int layer)
          Basic constructor from bbox object.
FigTrigger(int x1, int y1, int x2, int y2)
          Basic trigger constructor from (x1,y1) to (x2,y2).
FigTrigger(int x1, int y1, int x2, int y2, FigAttribs attribs, FigTrafo2D trafo, java.lang.String basename, java.lang.String filename)
          Advanced constructor with full parameter set.
 
Method Summary
 void appendPoint(java.awt.Point wp)
          No, we cannot append, insert, or delete a Point in a trigger.
(package private)  void build_wfill()
          build the FillWrapper object to support efficient wc->sc transformation for filled rectangles.
(package private)  void build_wline()
          build the LineWrapper object to support efficient wc->sc transformation and 'fat' lines.
 FigObject copy()
          make a copy of this object and return the reference to the copy.
 java.awt.Point deletePoint(java.awt.Point wp)
          delete the Point with specified coords from our Point list.
 java.lang.String getBasename()
           
 java.lang.String getFilename()
           
 java.lang.String getLink()
          getLink(): get the current basename+filename
 java.awt.Point[] getMovePointNeighbors(java.awt.Point wp)
          getMovePointNeighbors( Point wp ): find the nearest Point of the trigger 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 trigger
 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 distance (currently Manhattan-distance) of the trigger corners to the reference point wp.
 void mirrorX(int mirror_x, int mirror_y)
          mirrorX(): implemented as a move( dx, 0 ).
 void mirrorY(int mirror_x, int mirror_y)
          mirrorX(): implemented as a move( 0, dy ).
 void move(int dx, int dy)
          move() this trigger.
 void movePoint(java.awt.Point wp, java.awt.Point wpnew)
          move a Point from position wp to new position wpnew
 void paint(java.awt.Graphics g)
          the paint() method
 void setLink(java.lang.String basename, java.lang.String filename)
          setLink(): set new basename and filename
 void setPoints(java.awt.Point[] wcp)
          setPoints(): Set new bbox coordinates for this trigger.
 void setTrafo(FigTrafo2D trafo)
          set a new transformation for this trigger.
 void setVisible(boolean v)
          setVisible(): specify whether the FigTrigger object is visible (during editing) or not (during normal usage)
 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 trigger attributes: lineColor, lineStyle, fillColor, fillStyle, ...
 
Methods inherited from class jfig.objects.FigBaseobject
build_sc_bbox, canRotate, 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, rebuild, reset_debug, rotate, scale, select, set_debug, setAttributes, setComment, setConsole, setObjectPainter, setSyncRedrawFlag, setText, showPoints, updateAttributes, writeAsResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wline

LineWrapper wline

wfill

FillWrapper wfill

basename

java.lang.String basename

filename

java.lang.String filename

visible

boolean visible
Constructor Detail

FigTrigger

public FigTrigger(int x1,
                  int y1,
                  int x2,
                  int y2)
Basic trigger constructor from (x1,y1) to (x2,y2). Color is red, no fill.


FigTrigger

public FigTrigger(FigBbox bbox,
                  int layer)
Basic constructor from bbox object.


FigTrigger

public FigTrigger(int x1,
                  int y1,
                  int x2,
                  int y2,
                  FigAttribs attribs,
                  FigTrafo2D trafo,
                  java.lang.String basename,
                  java.lang.String filename)
Advanced constructor with full parameter set.

Method Detail

setVisible

public void setVisible(boolean v)
setVisible(): specify whether the FigTrigger object is visible (during editing) or not (during normal usage)

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

setLink

public void setLink(java.lang.String basename,
                    java.lang.String filename)
setLink(): set new basename and filename


getLink

public java.lang.String getLink()
getLink(): get the current basename+filename


getBasename

public java.lang.String getBasename()

getFilename

public java.lang.String getFilename()

build_wline

void build_wline()
build the LineWrapper object to support efficient wc->sc transformation and 'fat' lines.


build_wfill

void build_wfill()
build the FillWrapper object to support efficient wc->sc transformation for filled rectangles. Note that FillWrapper, when called with two Points only will automatically construct a rectangle to fill.


setTrafo

public void setTrafo(FigTrafo2D trafo)
set a new transformation for this trigger. This should only be called when the minimal constructor was used to build a FigTrigger.

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

getPoints

public java.awt.Point[] getPoints()
getPoints(): get bbox coordinates for this trigger

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

paint

public void paint(java.awt.Graphics g)
the paint() method

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

setPoints

public void setPoints(java.awt.Point[] wcp)
setPoints(): Set new bbox coordinates for this trigger.

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

update

public void update(FigAttribs new_attribs)
update(): Set the new trigger attributes: lineColor, lineStyle, fillColor, fillStyle, ...

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

copy

public FigObject copy()
make a copy of this object and return the reference to the copy.

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

move

public void move(int dx,
                 int dy)
move() this trigger.

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

mirrorX

public void mirrorX(int mirror_x,
                    int mirror_y)
mirrorX(): implemented as a move( dx, 0 ).

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

mirrorY

public void mirrorY(int mirror_x,
                    int mirror_y)
mirrorX(): implemented as a move( 0, dy ).

Specified by:
mirrorY in interface FigObject
Overrides:
mirrorY 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 trigger. Therefore, these functions just return without doing anything.

(To support these operations, we might convert the FigTrigger 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 trigger 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)
Description copied from class: FigBaseobject
move a Point from position wp to new position wpnew

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

minDistance

public double minDistance(java.awt.Point wp)
return distance (currently Manhattan-distance) of the trigger corners to the reference point wp. A point inside the trigger may have a large distance from this trigger.

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

toString

public java.lang.String toString()
toString() for debug purposes.

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