net.kolls.railworld.segment
Class TrackSegment.TSEP

java.lang.Object
  extended by net.kolls.railworld.edit.SegmentEditPoint
      extended by net.kolls.railworld.segment.TrackSegment.TSEP
Enclosing class:
TrackSegment

public class TrackSegment.TSEP
extends SegmentEditPoint

Track segment edit point. Public because the edit canvas wants the ability to call a special disconnect method here.


Field Summary
 
Fields inherited from class net.kolls.railworld.edit.SegmentEditPoint
c, myr, pidx
 
Constructor Summary
TrackSegment.TSEP(TrackSegment t, int pt)
          Create a track segment edit point.
 
Method Summary
 RailSegment anchor(RailSegment r)
          Attachs a segment to this edit point.
 boolean disconnect()
           
 boolean isAnchorSource()
          If this segment is being moved, should it offer to anchor onto other segments? Note that the other segment will be asked to approve with RailSegment.nearEditPoint(Point2D, RailSegment).
 
Methods inherited from class net.kolls.railworld.edit.SegmentEditPoint
draw, getColor, getPoint, getSegment, moveTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrackSegment.TSEP

public TrackSegment.TSEP(TrackSegment t,
                         int pt)
Create a track segment edit point. Called from TrackSegment.createSEP(int, RailSegment)

Parameters:
t - The track segment
pt - The point index
Method Detail

disconnect

public boolean disconnect()
Returns:
true if the segment was connected at this end and has been disconnected.

isAnchorSource

public boolean isAnchorSource()
Description copied from class: SegmentEditPoint
If this segment is being moved, should it offer to anchor onto other segments? Note that the other segment will be asked to approve with RailSegment.nearEditPoint(Point2D, RailSegment).

Specified by:
isAnchorSource in class SegmentEditPoint
Returns:
true if we should snap-to and anchor onto other segments.

anchor

public RailSegment anchor(RailSegment r)
Description copied from class: SegmentEditPoint
Attachs a segment to this edit point.

Specified by:
anchor in class SegmentEditPoint
Parameters:
r - The RailSegment to anchor to this point.
Returns:
Returns a new segment if that segment should be added to the array of segments, and also anything else that wanted to anchor here should anchor at the returned segment. May return null.