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.Runnable
Base 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 class
LineIntersector.InternalIntersector
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<Position,java.util.List<Intersection>>
allIntersections
protected long
endTime
protected int
numPositions
protected java.util.concurrent.atomic.AtomicInteger
numProcessedPositions
protected int
numThreads
protected java.lang.Iterable<Position>
positions
protected Vec4
referencePoint
protected Position
referencePosition
protected long
startTime
protected Terrain
terrain
protected java.util.concurrent.ThreadPoolExecutor
threadPool
-
Constructor Summary
Constructors Modifier Constructor Description protected
LineIntersector(Terrain terrain, int numThreads)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
doPerformIntersection(Position position)
Called to execute an intersection test for one position.java.util.Map<Position,java.util.List<Intersection>>
getAllIntersections()
long
getEndTime()
java.util.List<Intersection>
getIntersections(Position position)
int
getNumProcessedPositions()
int
getNumThreads()
java.lang.Iterable<Position>
getPositions()
Position
getReferencePosition()
long
getStartTime()
Terrain
getTerrain()
protected void
performIntersection(Position position)
void
run()
void
setPositions(java.lang.Iterable<Position> positions)
Specifies the end positions of all lines to intersect.void
setReferencePosition(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:
run
in interfacejava.lang.Runnable
-
performIntersection
protected void performIntersection(Position position) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
-