Package gov.nasa.worldwind.terrain
Class SectorGeometryList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<SectorGeometry>
-
- gov.nasa.worldwind.terrain.SectorGeometryList
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<SectorGeometry>
,java.util.Collection<SectorGeometry>
,java.util.List<SectorGeometry>
,java.util.RandomAccess
public class SectorGeometryList extends java.util.ArrayList<SectorGeometry>
This class is a container for terrain geometry.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<SectorGeometry,java.util.ArrayList<java.awt.Point>>
pickSectors
protected PickSupport
pickSupport
protected Sector
sector
The spanning sector of all sector geometries contained in this list.
-
Constructor Summary
Constructors Constructor Description SectorGeometryList()
Constructs an empty sector geometry list.SectorGeometryList(SectorGeometryList list)
Constructs a sector geometry list that contains a specified list of sector geometries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginRendering(DrawContext dc)
Indicates that this list's sectors are about to be rendered.protected void
beginSectorGeometryPicking(DrawContext dc)
Indicates that sector geometry picking is about to be performed.void
endRendering(DrawContext dc)
Restores state established bybeginRendering(gov.nasa.worldwind.render.DrawContext)
.protected void
endSectorGeometryPicking(DrawContext dc)
Restores state established bybeginSectorGeometryPicking(gov.nasa.worldwind.render.DrawContext)
.Sector
getSector()
Indicates the spanning sector of all sector geometries in this list.Vec4
getSurfacePoint(Angle latitude, Angle longitude)
Computes a Cartesian point at a specified location on the terrain.Vec4
getSurfacePoint(Angle latitude, Angle longitude, double metersOffset)
Computes a Cartesian point at a specified latitude, longitude and altitude above the terrain.Vec4
getSurfacePoint(LatLon latLon)
Computes a Cartesian point at a specified location on the terrain.Vec4
getSurfacePoint(Position position)
Computes a Cartesian point at a specified latitude, longitude and altitude above the terrain.Intersection[]
intersect(double elevation, Sector sector)
Determines if and where the geometry intersects the ellipsoid at a given elevation.Intersection[]
intersect(Line line)
Determines if and where a ray intersects the geometry.void
pick(DrawContext dc, java.awt.Point pickPoint)
Detects the locations of the sector geometries in this list that intersect a specified screen point.java.util.List<PickedObject>
pick(DrawContext dc, java.util.List<java.awt.Point> pickPoints)
Detects the locations of the sector geometries in this list that intersect any of the points in a specified list of screen points.void
setSector(Sector sector)
Specifies the sector this list spans.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Field Detail
-
sector
protected Sector sector
The spanning sector of all sector geometries contained in this list.
-
pickSupport
protected PickSupport pickSupport
-
pickSectors
protected java.util.HashMap<SectorGeometry,java.util.ArrayList<java.awt.Point>> pickSectors
-
-
Constructor Detail
-
SectorGeometryList
public SectorGeometryList()
Constructs an empty sector geometry list.
-
SectorGeometryList
public SectorGeometryList(SectorGeometryList list)
Constructs a sector geometry list that contains a specified list of sector geometries.- Parameters:
list
- the secter geometries to place in the list.
-
-
Method Detail
-
getSector
public Sector getSector()
Indicates the spanning sector of all sector geometries in this list.- Returns:
- a sector that is the union of all sectors of entries in this list.
-
setSector
public void setSector(Sector sector)
Specifies the sector this list spans.- Parameters:
sector
- the sector spanned by this list.
-
beginRendering
public void beginRendering(DrawContext dc)
Indicates that this list's sectors are about to be rendered. When rendering is complete, theendRendering(gov.nasa.worldwind.render.DrawContext)
must be called.- Parameters:
dc
- the current draw context.
-
endRendering
public void endRendering(DrawContext dc)
Restores state established bybeginRendering(gov.nasa.worldwind.render.DrawContext)
.- Parameters:
dc
- the current draw context.
-
pick
public void pick(DrawContext dc, java.awt.Point pickPoint)
Detects the locations of the sector geometries in this list that intersect a specified screen point.Note: Prior to calling this method,
beginRendering(gov.nasa.worldwind.render.DrawContext)
must be called.- Parameters:
dc
- the current draw context.pickPoint
- the screen point to test.
-
pick
public java.util.List<PickedObject> pick(DrawContext dc, java.util.List<java.awt.Point> pickPoints)
Detects the locations of the sector geometries in this list that intersect any of the points in a specified list of screen points.Note: Prior to calling this method,
beginRendering(gov.nasa.worldwind.render.DrawContext)
must be called.- Parameters:
dc
- the current draw context.pickPoints
- the points to test.- Returns:
- an array of picked objects that intersect one or more of the specified screen points.
-
beginSectorGeometryPicking
protected void beginSectorGeometryPicking(DrawContext dc)
Indicates that sector geometry picking is about to be performed. Configures the state necessary to correctly draw sector geometry in a second pass using unique per-triangle colors. When picking is complete,endSectorGeometryPicking(gov.nasa.worldwind.render.DrawContext)
must be called.- Parameters:
dc
- the current draw context.
-
endSectorGeometryPicking
protected void endSectorGeometryPicking(DrawContext dc)
Restores state established bybeginSectorGeometryPicking(gov.nasa.worldwind.render.DrawContext)
.- Parameters:
dc
- the current draw context.
-
getSurfacePoint
public Vec4 getSurfacePoint(Position position)
Computes a Cartesian point at a specified latitude, longitude and altitude above the terrain.- Parameters:
position
- the position to compute the Cartesian point for. The altitude element of the position is considered to be distance above the terrain at the position's latitude and longitude.- Returns:
- the Cartesian point, in meters, relative to an origin of (0, 0, 0). Will be null if there is no sector geometry in this list for the specifed latitude and longitude.
-
getSurfacePoint
public Vec4 getSurfacePoint(LatLon latLon)
Computes a Cartesian point at a specified location on the terrain.- Parameters:
latLon
- the location of the point to compute.- Returns:
- the Cartesian point, in meters, relative to an origin of (0, 0, 0). Will be null if there is no sector geometry in this list for the specifed latitude and longitude.
-
getSurfacePoint
public Vec4 getSurfacePoint(Angle latitude, Angle longitude)
Computes a Cartesian point at a specified location on the terrain.- Parameters:
latitude
- the latitude of the point to compute.longitude
- the longitude of the point to compute.- Returns:
- the Cartesian point, in meters, relative to an origin of (0, 0, 0). Will be null if there is no sector geometry in this list for the specifed latitude and longitude.
-
getSurfacePoint
public Vec4 getSurfacePoint(Angle latitude, Angle longitude, double metersOffset)
Computes a Cartesian point at a specified latitude, longitude and altitude above the terrain.- Parameters:
latitude
- the latitude of the point to compute.longitude
- the longitude of the point to compute.metersOffset
- the distance above the terrain of the point to compute.- Returns:
- the Cartesian point, in meters, relative to an origin of (0, 0, 0). Will be null if there is no sector geometry in this list for the specifed latitude and longitude.
-
intersect
public Intersection[] intersect(Line line)
Determines if and where a ray intersects the geometry.- Parameters:
line
- theLine
for which an intersection is to be found.- Returns:
- the <Vec4> point closest to the ray origin where an intersection has been found or null if no intersection was found.
-
intersect
public Intersection[] intersect(double elevation, Sector sector)
Determines if and where the geometry intersects the ellipsoid at a given elevation.The returned array of
Intersection
describes a list of individual segments - twoIntersection
for each, corresponding to each geometry triangle that intersects the given elevation.Note that the provided bounding
Sector
only serves as a 'hint' to avoid processing unnecessary geometry tiles. The returned intersection list may contain segments outside that sector.- Parameters:
elevation
- the elevation for which intersections are to be found.sector
- the sector inside which intersections are to be found.- Returns:
- a list of
Intersection
pairs/segments describing a contour line at the given elevation.
-
-