hades.symbols
Class WireSegment

java.lang.Object
  extended byjfig.objects.FigPolyline
      extended byhades.symbols.WireSegment
All Implemented Interfaces:
FigDrawable, FigObject, java.io.Serializable

public class WireSegment
extends FigPolyline
implements java.io.Serializable

WireSegment: display a wire segment on a HADES schematic.

This class is realized as a subclass of FigPolyline with specific attributes: layer 15, color blue.

During a simulation with 'glow mode' 'a la DIGLOG, the color of the wire corresponds to its logical value.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jfig.objects.FigPolyline
attribs, bbox, comment, debug, is_closed, min_i, min_num_points, painter, renderer, selected, showPoints, syncRedrawFlag, trafo, visible, wcp
 
Constructor Summary
WireSegment()
          construct an empty WireSegment.
WireSegment(Signal signal)
           
 
Method Summary
protected  void build_attribs()
           
 double getEuclideanDistance(java.awt.Point wp)
          calculate and return the _relative_ euclidean distance between point wp and the first segment (points[0] and points[1]) of this wire segment.
 Signal getSignal()
          return a reference to the Signal this WireSegment belongs to
 boolean initialize(java.lang.String s)
          initialize an WireSegment from a String.
 void paint(java.awt.Graphics g)
          paint this WireSegment.
 void paint(java.awt.Graphics g, FigTrafo2D trafo)
          paint this object using the specified transformation and Graphics g
 void setColorSource(ColorSource _colorSource)
           
 void setSignal(Signal s)
           
 java.lang.String toString()
          toString() - the usual info method
 void writeAsResource(java.io.PrintWriter ps)
          write a complete text representation of this object
 
Methods inherited from class jfig.objects.FigPolyline
appendPoint, calc_dist, canRotate, copy, createRenderer, deletePoint, deselect, get_min_dist_index, get_sc_bbox, getAttributes, getBbox, getComment, getLayer, getMinDistPoint1, getMinDistPoint2, getMinPerpendicularDistance, getMinPerpendicularDistance, getMovePointNeighbors, getNearestPoint, getNeighborPoints, getObjectPainter, getPoints, getPosition, getSegmentDistance, getSyncRedrawFlag, getText, getTrafo, indexOfNearestNeighbor, insertPoint, isClosed, isSelected, isShowPoints, isVisible, isVisible, keyPressed, manhattan, message, minDistance, minDistanceEuclid, mirrorX, mirrorY, move, movePoint, nearerPoint, numPoints, paintSave, printCost, rebuild, reset_debug, rotate, scale, select, set_debug, setArrowMode, setAttributes, setBackwardArrow, setComment, setFillColor, setFillStyle, setForwardArrow, setIsClosed, setLayer, setLineColor, setLineStyle, setLineWidth, setObjectPainter, setPoints, setSyncRedrawFlag, setText, setTrafo, setVisible, showPoints, supportsPointOps, update_bbox, update, updateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WireSegment

public WireSegment()
construct an empty WireSegment.


WireSegment

public WireSegment(Signal signal)
Method Detail

getSignal

public Signal getSignal()
return a reference to the Signal this WireSegment belongs to


setSignal

public void setSignal(Signal s)

setColorSource

public void setColorSource(ColorSource _colorSource)

initialize

public boolean initialize(java.lang.String s)
initialize an WireSegment from a String. The String contains the number of Points in this WireSegment, then the actual Point coordinates: n x0 y0 x1 y1 ... xn-1 yn-1

Specified by:
initialize in interface FigObject
Overrides:
initialize in class FigPolyline

build_attribs

protected void build_attribs()

getEuclideanDistance

public double getEuclideanDistance(java.awt.Point wp)
calculate and return the _relative_ euclidean distance between point wp and the first segment (points[0] and points[1]) of this wire segment. This method is typically used to find the wire segment nearest to a given point.


writeAsResource

public void writeAsResource(java.io.PrintWriter ps)
Description copied from interface: FigObject
write a complete text representation of this object

Specified by:
writeAsResource in interface FigObject
Overrides:
writeAsResource in class FigPolyline

paint

public void paint(java.awt.Graphics g)
paint this WireSegment. We first check if a ColorSource is set for us; if so, we retrieve the current line color. Afterwards, we dispatch to super.paint().

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

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 FigObject
Overrides:
paint in class FigPolyline

toString

public java.lang.String toString()
toString() - the usual info method

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