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.ObjectglobeStateKeyprotected intmaxConnectingDistance
-
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.ColorgetColor()Get the contour line color.doublegetElevation()Get the contour line current elevation.doublegetLineWidth()Get the contour line width.java.util.List<Renderable>getRenderables()SectorgetSector()Get the contour line current bounding sector.booleanisEnabled()protected booleanisValid(DrawContext dc)booleanisViewClippingEnabled()Indicates whether view volume clipping is performed.protected voidmakeContourLine(DrawContext dc)Update the renderable list with appropriate renderables to display the contour line.protected intmakePathsConnected(DrawContext dc, java.util.ArrayList<Intersection> inter, int tolerance)Add a set ofPathobjects to the contour line renderable list by connecting as much as possible the segments from the givenIntersectionarray.voidrender(DrawContext dc)Causes thisRenderableto render itself using the provided draw context.voidsetColor(java.awt.Color color)Set the contour line color.voidsetElevation(double elevation)Set the contour line elevation.voidsetEnabled(boolean state)voidsetLineWidth(double width)Set the contour line width.voidsetSector(Sector sector)Set the contour line bounding sector.voidsetViewClippingEnabled(boolean viewClippingEnabled)Set whether view volume clipping is performed.voidupdate()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:
trueif view volume clipping is performed, otherwisefalse(the default).
-
setViewClippingEnabled
public void setViewClippingEnabled(boolean viewClippingEnabled)
Set whether view volume clipping is performed.- Parameters:
viewClippingEnabled-trueif 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:RenderableCauses thisRenderableto render itself using the provided draw context.- Specified by:
renderin interfaceRenderable- Parameters:
dc- theDrawContextto 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 currentDrawContextlist- the list ofIntersectionto 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 currentDrawContextlist- the list ofIntersectionto be filtered.- Returns:
- the filtered list.
-
makePathsConnected
protected int makePathsConnected(DrawContext dc, java.util.ArrayList<Intersection> inter, int tolerance)
Add a set ofPathobjects to the contour line renderable list by connecting as much as possible the segments from the givenIntersectionarray.- Parameters:
dc- the currentDrawContext.inter- the list ofIntersectionto sort out.tolerance- how far in meter can two points be considered connected.- Returns:
- the number of
Pathobjects added.
-
-