NASA World Wind

gov.nasa.worldwind.terrain
Class SectorGeometryList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<SectorGeometry>
              extended by gov.nasa.worldwind.terrain.SectorGeometryList
All Implemented Interfaces:
Serializable, Cloneable, Iterable<SectorGeometry>, Collection<SectorGeometry>, List<SectorGeometry>, RandomAccess

public class SectorGeometryList
extends ArrayList<SectorGeometry>

This class is a container for terrain geometry.

See Also:
Serialized Form

Field Summary
protected  HashMap<SectorGeometry,ArrayList<Point>> pickSectors
           
protected  PickSupport pickSupport
           
protected  Sector sector
          The spanning sector of all sector geometries contained in this list.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
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
 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 by beginRendering(gov.nasa.worldwind.render.DrawContext).
protected  void endSectorGeometryPicking(DrawContext dc)
          Restores state established by beginSectorGeometryPicking(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.
 List<PickedObject> pick(DrawContext dc, List<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 pick(DrawContext dc, Point pickPoint)
          Detects the locations of the sector geometries in this list that intersect a specified screen point.
 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, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

pickSectors

protected HashMap<SectorGeometry,ArrayList<Point>> pickSectors

pickSupport

protected PickSupport pickSupport

sector

protected Sector sector
The spanning sector of all sector geometries contained in this list.

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

beginRendering

public void beginRendering(DrawContext dc)
Indicates that this list's sectors are about to be rendered. When rendering is complete, the endRendering(gov.nasa.worldwind.render.DrawContext) must be called.

Parameters:
dc - the current draw context.

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.

endRendering

public void endRendering(DrawContext dc)
Restores state established by beginRendering(gov.nasa.worldwind.render.DrawContext).

Parameters:
dc - the current draw context.

endSectorGeometryPicking

protected void endSectorGeometryPicking(DrawContext dc)
Restores state established by beginSectorGeometryPicking(gov.nasa.worldwind.render.DrawContext).

Parameters:
dc - the current draw context.

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.

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.

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(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.

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 - two Intersection 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.

intersect

public Intersection[] intersect(Line line)
Determines if and where a ray intersects the geometry.

Parameters:
line - the Line for which an intersection is to be found.
Returns:
the point closest to the ray origin where an intersection has been found or null if no intersection was found.

pick

public List<PickedObject> pick(DrawContext dc,
                               List<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.

pick

public void pick(DrawContext dc,
                 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.

setSector

public void setSector(Sector sector)
Specifies the sector this list spans.

Parameters:
sector - the sector spanned by this list.

NASA World Wind