Class LineIntersector
- java.lang.Object
-
- gov.nasa.worldwindx.examples.lineofsight.LineIntersector
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
ShapeLineIntersector,TerrainLineIntersector
public abstract class LineIntersector extends java.lang.Object implements java.lang.RunnableBase class for intersectors that compute intersections with a line. The line is specified by a single origin (seesetReferencePosition(gov.nasa.worldwind.geom.Position)) and a list of end positions (seesetPositions(Iterable)).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classLineIntersector.InternalIntersector
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<Position,java.util.List<Intersection>>allIntersectionsprotected longendTimeprotected intnumPositionsprotected java.util.concurrent.atomic.AtomicIntegernumProcessedPositionsprotected intnumThreadsprotected java.lang.Iterable<Position>positionsprotected Vec4referencePointprotected PositionreferencePositionprotected longstartTimeprotected Terrainterrainprotected java.util.concurrent.ThreadPoolExecutorthreadPool
-
Constructor Summary
Constructors Modifier Constructor Description protectedLineIntersector(Terrain terrain, int numThreads)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoPerformIntersection(Position position)Called to execute an intersection test for one position.java.util.Map<Position,java.util.List<Intersection>>getAllIntersections()longgetEndTime()java.util.List<Intersection>getIntersections(Position position)intgetNumProcessedPositions()intgetNumThreads()java.lang.Iterable<Position>getPositions()PositiongetReferencePosition()longgetStartTime()TerraingetTerrain()protected voidperformIntersection(Position position)voidrun()voidsetPositions(java.lang.Iterable<Position> positions)Specifies the end positions of all lines to intersect.voidsetReferencePosition(Position referencePosition)Sets the origin of the lines to intersect.
-
-
-
Field Detail
-
terrain
protected Terrain terrain
-
numThreads
protected int numThreads
-
referencePosition
protected Position referencePosition
-
positions
protected java.lang.Iterable<Position> positions
-
numPositions
protected int numPositions
-
referencePoint
protected Vec4 referencePoint
-
threadPool
protected java.util.concurrent.ThreadPoolExecutor threadPool
-
numProcessedPositions
protected java.util.concurrent.atomic.AtomicInteger numProcessedPositions
-
startTime
protected long startTime
-
endTime
protected long endTime
-
allIntersections
protected java.util.Map<Position,java.util.List<Intersection>> allIntersections
-
-
Constructor Detail
-
LineIntersector
protected LineIntersector(Terrain terrain, int numThreads)
-
-
Method Detail
-
doPerformIntersection
protected abstract void doPerformIntersection(Position position) throws java.lang.InterruptedException
Called to execute an intersection test for one position.- Parameters:
position- the position to test.- Throws:
java.lang.InterruptedException- if the operation is interrupted.s
-
getTerrain
public Terrain getTerrain()
-
getNumThreads
public int getNumThreads()
-
getReferencePosition
public Position getReferencePosition()
-
setReferencePosition
public void setReferencePosition(Position referencePosition)
Sets the origin of the lines to intersect.- Parameters:
referencePosition- the origin to use for all lines.
-
getPositions
public java.lang.Iterable<Position> getPositions()
-
setPositions
public void setPositions(java.lang.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.
-
getStartTime
public long getStartTime()
-
getEndTime
public long getEndTime()
-
getNumProcessedPositions
public int getNumProcessedPositions()
-
getAllIntersections
public java.util.Map<Position,java.util.List<Intersection>> getAllIntersections()
-
getIntersections
public java.util.List<Intersection> getIntersections(Position position)
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
performIntersection
protected void performIntersection(Position position) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-