Package gov.nasa.worldwind.render
Class ContourLine
- java.lang.Object
-
- gov.nasa.worldwind.render.ContourLine
-
- All Implemented Interfaces:
Renderable
- Direct Known Subclasses:
ContourLinePolygon
public class ContourLine extends java.lang.Object implements Renderable
Renders a contour line on the terrain at a given elevation. The contour line extent can be bounded by aSector
.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Object
globeStateKey
protected int
maxConnectingDistance
-
Constructor Summary
Constructors Constructor Description ContourLine()
ContourLine(double elevation)
ContourLine(double elevation, Sector sector)
ContourLine(Sector sector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.ArrayList<Intersection>
filterIntersections(DrawContext dc, java.util.ArrayList<Intersection> list)
Filters the given intersection segments list according to some criteria - here the inclusion inside the bounding sector.protected java.util.ArrayList<Intersection>
filterIntersectionsOnViewFrustum(DrawContext dc, java.util.ArrayList<Intersection> list)
Filters the given intersection segments list according to the current view frustum.java.awt.Color
getColor()
Get the contour line color.double
getElevation()
Get the contour line current elevation.double
getLineWidth()
Get the contour line width.java.util.List<Renderable>
getRenderables()
Sector
getSector()
Get the contour line current bounding sector.boolean
isEnabled()
protected boolean
isValid(DrawContext dc)
boolean
isViewClippingEnabled()
Indicates whether view volume clipping is performed.protected void
makeContourLine(DrawContext dc)
Update the renderable list with appropriate renderables to display the contour line.protected int
makePathsConnected(DrawContext dc, java.util.ArrayList<Intersection> inter, int tolerance)
Add a set ofPath
objects to the contour line renderable list by connecting as much as possible the segments from the givenIntersection
array.void
render(DrawContext dc)
Causes thisRenderable
to render itself using the provided draw context.void
setColor(java.awt.Color color)
Set the contour line color.void
setElevation(double elevation)
Set the contour line elevation.void
setEnabled(boolean state)
void
setLineWidth(double width)
Set the contour line width.void
setSector(Sector sector)
Set the contour line bounding sector.void
setViewClippingEnabled(boolean viewClippingEnabled)
Set whether view volume clipping is performed.void
update()
Update the contour line according to the current terrain geometry.
-
-
-
Method Detail
-
getElevation
public double getElevation()
Get the contour line current elevation.- Returns:
- the contour line current elevation.
-
setElevation
public void setElevation(double elevation)
Set the contour line elevation.- Parameters:
elevation
- the contour line elevation.
-
getSector
public Sector getSector()
Get the contour line current bounding sector.- Returns:
- the contour line current bounding sector.
-
setSector
public void setSector(Sector sector)
Set the contour line bounding sector.- Parameters:
sector
- the contour line bounding sector.
-
getColor
public java.awt.Color getColor()
Get the contour line color.- Returns:
- the contour line color.
-
setColor
public void setColor(java.awt.Color color)
Set the contour line color.- Parameters:
color
- the contour line color.
-
getLineWidth
public double getLineWidth()
Get the contour line width.- Returns:
- the contour line width.
-
setLineWidth
public void setLineWidth(double width)
Set the contour line width.- Parameters:
width
- the contour line width.
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean state)
-
isViewClippingEnabled
public boolean isViewClippingEnabled()
Indicates whether view volume clipping is performed.- Returns:
true
if view volume clipping is performed, otherwisefalse
(the default).
-
setViewClippingEnabled
public void setViewClippingEnabled(boolean viewClippingEnabled)
Set whether view volume clipping is performed.- Parameters:
viewClippingEnabled
-true
if view clipping should be performed, otherwisefalse
(the default).
-
update
public void update()
Update the contour line according to the current terrain geometry.
-
getRenderables
public java.util.List<Renderable> getRenderables()
-
render
public void render(DrawContext dc)
Description copied from interface:Renderable
Causes thisRenderable
to render itself using the provided draw context.- Specified by:
render
in interfaceRenderable
- Parameters:
dc
- theDrawContext
to be used- See Also:
DrawContext
-
isValid
protected boolean isValid(DrawContext dc)
-
makeContourLine
protected void makeContourLine(DrawContext dc)
Update the renderable list with appropriate renderables to display the contour line.- Parameters:
dc
- the currentDrawContext
.
-
filterIntersectionsOnViewFrustum
protected java.util.ArrayList<Intersection> filterIntersectionsOnViewFrustum(DrawContext dc, java.util.ArrayList<Intersection> list)
Filters the given intersection segments list according to the current view frustum.- Parameters:
dc
- the currentDrawContext
list
- the list ofIntersection
to be filtered.- Returns:
- the filtered list.
-
filterIntersections
protected java.util.ArrayList<Intersection> filterIntersections(DrawContext dc, java.util.ArrayList<Intersection> list)
Filters the given intersection segments list according to some criteria - here the inclusion inside the bounding sector.- Parameters:
dc
- the currentDrawContext
list
- the list ofIntersection
to be filtered.- Returns:
- the filtered list.
-
makePathsConnected
protected int makePathsConnected(DrawContext dc, java.util.ArrayList<Intersection> inter, int tolerance)
Add a set ofPath
objects to the contour line renderable list by connecting as much as possible the segments from the givenIntersection
array.- Parameters:
dc
- the currentDrawContext
.inter
- the list ofIntersection
to sort out.tolerance
- how far in meter can two points be considered connected.- Returns:
- the number of
Path
objects added.
-
-