Package gov.nasa.worldwind.shape
Class Ellipse
- java.lang.Object
-
- gov.nasa.worldwind.render.AbstractRenderable
-
- gov.nasa.worldwind.shape.AbstractShape
-
- gov.nasa.worldwind.shape.Ellipse
-
- All Implemented Interfaces:
Renderable
,Attributable
,Highlightable
public class Ellipse extends AbstractShape
Ellipse shape defined by a geographic center position and radii for the semi-major and semi-minor axes.
Axes and Heading
Ellipse axes, by default, are oriented such that the semi-major axis points East and the semi-minor axis points North. Ellipse provides an optional heading, which when set to anything other than 0.0 rotates the semi-major and semi-minor axes about the center position, while retaining the axes relative relationship to one another. Heading is defined in degrees clockwise from North. Configuring ellipse with a heading of 45.0 results in the semi-major axis pointing Southeast and the semi-minor axis pointing Northeast.
Altitude Mode and Terrain Following
Ellipse geometry displays at a constant altitude determined by the geographic center position and altitude mode. For example, an ellipse with a center position altitude of 1km and altitude mode of ABSOLUTE displays at 1km above mean sea level. The same ellipse with an altitude mode of RELATIVE_TO_GROUND displays at 1km above ground level, relative to the ellipse's center location.
Surface ellipse geometry, where an ellipse appears draped across the terrain, may be achieved by enabling ellipse's terrain following state and setting its altitude mode to CLAMP_TO_GROUND. SeesetFollowTerrain(boolean)
andAbstractShape.setAltitudeMode(int)
.
Display Granularity
Ellipse's appearance on screen is composed of discrete segments which approximate the ellipse's geometry. This approximation is chosen such that the display appears to be a continuous smooth ellipse. Applications can control the maximum number of angular intervals used in this representation withsetMaximumIntervals(int)
.
-
-
Constructor Summary
Constructors Constructor Description Ellipse()
Constructs an ellipse with a null center position, and with major- and minor-radius both 0.0.Ellipse(Position center, double majorRadius, double minorRadius)
Constructs an ellipse with a specified center position and radii.Ellipse(Position center, double majorRadius, double minorRadius, ShapeAttributes attributes)
Constructs an ellipse with a specified center position, radii, and shape attributes.Ellipse(ShapeAttributes attributes)
Constructs an ellipse with a null center position, and with major- and minor-radius both 0.0.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Position
getCenter()
Indicates the geographic position of this ellipse's center.double
getHeading()
Indicates this ellipse's heading.double
getMajorRadius()
Indicates the radius of this globe's semi-major axis.int
getMaximumIntervals()
Indicates the maximum number of angular intervals that may be used to approximate this ellipse's geometry on screen.double
getMinorRadius()
Indicates the radius of this globe's semi-minor axis.boolean
isExtrude()
boolean
isFollowTerrain()
Indicates whether this ellipse's geometry follows the terrain surface or is fixed at a constant altitude.Ellipse
setCenter(Position position)
Sets the geographic position of this ellipse's center.Ellipse
setExtrude(boolean extrude)
Ellipse
setFollowTerrain(boolean followTerrain)
Sets the terrain following state of this ellipse, which indicates whether this ellipse's geometry follows the terrain surface or is fixed at a constant altitude.Ellipse
setHeading(double degrees)
Sets this ellipse's heading in degrees clockwise from North.Ellipse
setMajorRadius(double radius)
Sets the radius of this globe's semi-major axis.Ellipse
setMaximumIntervals(int numIntervals)
Sets the maximum number of angular intervals that may be used to approximate this ellipse's on screen.Ellipse
setMinorRadius(double radius)
Sets the radius of this globe's semi-minor axis.-
Methods inherited from class gov.nasa.worldwind.shape.AbstractShape
getAltitudeMode, getAttributes, getHighlightAttributes, getMaximumIntermediatePoints, getPathType, isHighlighted, setAltitudeMode, setAttributes, setHighlightAttributes, setHighlighted, setMaximumIntermediatePoints, setPathType
-
Methods inherited from class gov.nasa.worldwind.render.AbstractRenderable
getDisplayName, getPickDelegate, getUserProperty, hasUserProperty, isEnabled, putUserProperty, removeUserProperty, render, setDisplayName, setEnabled, setPickDelegate
-
-
-
-
Constructor Detail
-
Ellipse
public Ellipse()
Constructs an ellipse with a null center position, and with major- and minor-radius both 0.0. This ellipse does not display until the center position is defined and the radii are both greater than 0.0.
-
Ellipse
public Ellipse(ShapeAttributes attributes)
Constructs an ellipse with a null center position, and with major- and minor-radius both 0.0. This ellipse does not display until the center position is defined and the radii are both greater than 0.0.- Parameters:
attributes
- the shape attributes applied to the ellipse
-
Ellipse
public Ellipse(Position center, double majorRadius, double minorRadius)
Constructs an ellipse with a specified center position and radii. The ellipse displays in the default shape attributes, which may be specified usingAbstractShape.setAttributes(ShapeAttributes)
. The ellipse does not display if the center position is null, or both radii are 0.0.- Parameters:
center
- geographic position at the ellipse's center. May be null.majorRadius
- radius of the semi-major axis, in meters.minorRadius
- radius of the semi-minor axis, in meters.- Throws:
java.lang.IllegalArgumentException
- If either radius is negative
-
Ellipse
public Ellipse(Position center, double majorRadius, double minorRadius, ShapeAttributes attributes)
Constructs an ellipse with a specified center position, radii, and shape attributes. The ellipse displays in the specified shape attributes, which may be modifies usingAbstractShape.setAttributes(ShapeAttributes)
. The ellipse does not display if the center position is null, or both radii are 0.0.- Parameters:
center
- geographic position at the ellipse's center; may be nullmajorRadius
- radius of the semi-major axis, in meters.minorRadius
- radius of the semi-minor axis, in meters.attributes
- the shape attributes applied to the ellipse- Throws:
java.lang.IllegalArgumentException
- If either radius is negative
-
-
Method Detail
-
getCenter
public Position getCenter()
Indicates the geographic position of this ellipse's center. The position may be null, in which case the ellipse does not display.- Returns:
- this ellipse's geographic center; may be null
-
setCenter
public Ellipse setCenter(Position position)
Sets the geographic position of this ellipse's center. The position may be null, in which case the ellipse does not display.- Parameters:
position
- the new center position; may be null- Returns:
- this ellipse with its center position set to the specified position
-
getMajorRadius
public double getMajorRadius()
Indicates the radius of this globe's semi-major axis. When the ellipse's heading is 0.0, the semi-major axis points East.- Returns:
- the radius, in meters
-
setMajorRadius
public Ellipse setMajorRadius(double radius)
Sets the radius of this globe's semi-major axis. When the ellipse's heading is 0.0, the semi-major axis points East.- Parameters:
radius
- the new radius, in meters- Returns:
- this ellipse with the radius of its semi-major axis set to the specified value
- Throws:
java.lang.IllegalArgumentException
- If the radius is negative
-
getMinorRadius
public double getMinorRadius()
Indicates the radius of this globe's semi-minor axis. When the ellipse's heading is 0.0, the semi-minor axis points North.- Returns:
- the radius, in meters
-
setMinorRadius
public Ellipse setMinorRadius(double radius)
Sets the radius of this globe's semi-minor axis. When the ellipse's heading is 0.0, the semi-minor axis points North.- Parameters:
radius
- the new radius, in meters- Returns:
- this ellipse with the radius of its semi-minor axis set to the specified value
- Throws:
java.lang.IllegalArgumentException
- If the radius is negative
-
getHeading
public double getHeading()
Indicates this ellipse's heading. When ellipse's heading is 0.0, the semi-major axis points East and the semi-minor axis points North. Headings other than 0.0 rotate the axes about the ellipse's center position, while retaining the axes relative relationship to one another.- Returns:
- this ellipse's heading, in degrees clockwise from North
-
setHeading
public Ellipse setHeading(double degrees)
Sets this ellipse's heading in degrees clockwise from North. When ellipse's heading is 0.0, the semi-major axis points East and the semi-minor axis points North. Headings other than 0.0 rotate the axes about the ellipse's center position, while retaining the axes relative relationship to one another.- Parameters:
degrees
- the new heading, in degrees clockwise from North- Returns:
- this ellipse, with its heading set to the specified value
-
isExtrude
public boolean isExtrude()
-
setExtrude
public Ellipse setExtrude(boolean extrude)
-
isFollowTerrain
public boolean isFollowTerrain()
Indicates whether this ellipse's geometry follows the terrain surface or is fixed at a constant altitude.- Returns:
- true if ellipse geometry follows the terrain surface, and false otherwise
-
setFollowTerrain
public Ellipse setFollowTerrain(boolean followTerrain)
Sets the terrain following state of this ellipse, which indicates whether this ellipse's geometry follows the terrain surface or is fixed at a constant altitude. By default the terrain following state is false, and ellipse geometry follows the constant altitude of its center position.- Parameters:
followTerrain
- true to follow the terrain surface, and false otherwise- Returns:
- this ellipse, with its terrain following state set to the specified value
-
getMaximumIntervals
public int getMaximumIntervals()
Indicates the maximum number of angular intervals that may be used to approximate this ellipse's geometry on screen.- Returns:
- the number of angular intervals
-
setMaximumIntervals
public Ellipse setMaximumIntervals(int numIntervals)
Sets the maximum number of angular intervals that may be used to approximate this ellipse's on screen.
Ellipse may use a minimum number of intervals to ensure that its appearance on screen at least roughly approximates the ellipse's shape. When the specified number of intervals is too small, it is clamped to an implementation-defined minimum number of intervals.
Ellipse may require that the number of intervals is an even multiple of some integer. When the specified number of intervals does not meet this criteria, the next smallest integer that meets ellipse's criteria is used instead.- Parameters:
numIntervals
- the number of angular intervals- Returns:
- this ellipse with its number of angular intervals set to the specified value
- Throws:
java.lang.IllegalArgumentException
- If the number of intervals is negative
-
-