NASA World Wind

gov.nasa.worldwindx.examples.lineofsight
Class LineIntersector

java.lang.Object
  extended by gov.nasa.worldwindx.examples.lineofsight.LineIntersector
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ShapeLineIntersector, TerrainLineIntersector

public abstract class LineIntersector
extends Object
implements Runnable

Base class for intersectors that compute intersections with a line. The line is specified by a single origin (see setReferencePosition(gov.nasa.worldwind.geom.Position)) and a list of end positions (see setPositions(Iterable)).


Nested Class Summary
protected  class LineIntersector.InternalIntersector
           
 
Field Summary
protected  Map<Position,List<Intersection>> allIntersections
           
protected  long endTime
           
protected  int numPositions
           
protected  AtomicInteger numProcessedPositions
           
protected  int numThreads
           
protected  Iterable<Position> positions
           
protected  Vec4 referencePoint
           
protected  Position referencePosition
           
protected  long startTime
           
protected  Terrain terrain
           
protected  ThreadPoolExecutor threadPool
           
 
Constructor Summary
protected LineIntersector(Terrain terrain, int numThreads)
           
 
Method Summary
protected abstract  void doPerformIntersection(Position position)
          Called to execute an intersection test for one position.
 Map<Position,List<Intersection>> getAllIntersections()
           
 long getEndTime()
           
 List<Intersection> getIntersections(Position position)
           
 int getNumProcessedPositions()
           
 int getNumThreads()
           
 Iterable<Position> getPositions()
           
 Position getReferencePosition()
           
 long getStartTime()
           
 Terrain getTerrain()
           
protected  void performIntersection(Position position)
           
 void run()
           
 void setPositions(Iterable<Position> positions)
          Specifies the end positions of all lines to intersect.
 void setReferencePosition(Position referencePosition)
          Sets the origin of the lines to intersect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allIntersections

protected Map<Position,List<Intersection>> allIntersections

endTime

protected long endTime

numPositions

protected int numPositions

numProcessedPositions

protected AtomicInteger numProcessedPositions

numThreads

protected int numThreads

positions

protected Iterable<Position> positions

referencePoint

protected Vec4 referencePoint

referencePosition

protected Position referencePosition

startTime

protected long startTime

terrain

protected Terrain terrain

threadPool

protected ThreadPoolExecutor threadPool
Constructor Detail

LineIntersector

protected LineIntersector(Terrain terrain,
                          int numThreads)
Method Detail

doPerformIntersection

protected abstract void doPerformIntersection(Position position)
                                       throws InterruptedException
Called to execute an intersection test for one position.

Parameters:
position - the position to test.
Throws:
InterruptedException - if the operation is interrupted.s

getAllIntersections

public Map<Position,List<Intersection>> getAllIntersections()

getEndTime

public long getEndTime()

getIntersections

public List<Intersection> getIntersections(Position position)

getNumProcessedPositions

public int getNumProcessedPositions()

getNumThreads

public int getNumThreads()

getPositions

public Iterable<Position> getPositions()

getReferencePosition

public Position getReferencePosition()

getStartTime

public long getStartTime()

getTerrain

public Terrain getTerrain()

performIntersection

protected void performIntersection(Position position)
                            throws InterruptedException
Throws:
InterruptedException

run

public void run()
Specified by:
run in interface Runnable

setPositions

public void setPositions(Iterable<Position> positions)
Specifies the end positions of all lines to intersect. Intersection tests are performed for each position, using the position as the line's end and the current reference position as the line's origin.

Parameters:
positions - the positions.

setReferencePosition

public void setReferencePosition(Position referencePosition)
Sets the origin of the lines to intersect.

Parameters:
referencePosition - the origin to use for all lines.

NASA World Wind