public class Ellipse extends AbstractShape
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.
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. See setFollowTerrain(boolean)
and
AbstractShape.setAltitudeMode(int)
.
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 with setMaximumIntervals(int)
.
Constructor and 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.
|
Modifier and Type | Method and 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.
|
getAltitudeMode, getAttributes, getHighlightAttributes, getMaximumIntermediatePoints, getPathType, isHighlighted, setAltitudeMode, setAttributes, setHighlightAttributes, setHighlighted, setMaximumIntermediatePoints, setPathType
getDisplayName, getPickDelegate, getUserProperty, hasUserProperty, isEnabled, putUserProperty, removeUserProperty, render, setDisplayName, setEnabled, setPickDelegate
public Ellipse()
public Ellipse(ShapeAttributes attributes)
attributes
- the shape attributes applied to the ellipsepublic Ellipse(Position center, double majorRadius, double minorRadius)
AbstractShape.setAttributes(ShapeAttributes)
. The ellipse does not display if
the center position is null, or both radii are 0.0.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.java.lang.IllegalArgumentException
- If either radius is negativepublic Ellipse(Position center, double majorRadius, double minorRadius, ShapeAttributes attributes)
AbstractShape.setAttributes(ShapeAttributes)
. The ellipse does
not display if the center position is null, or both radii are 0.0.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 ellipsejava.lang.IllegalArgumentException
- If either radius is negativepublic Position getCenter()
public Ellipse setCenter(Position position)
position
- the new center position; may be nullpublic double getMajorRadius()
public Ellipse setMajorRadius(double radius)
radius
- the new radius, in metersjava.lang.IllegalArgumentException
- If the radius is negativepublic double getMinorRadius()
public Ellipse setMinorRadius(double radius)
radius
- the new radius, in metersjava.lang.IllegalArgumentException
- If the radius is negativepublic double getHeading()
public Ellipse setHeading(double degrees)
degrees
- the new heading, in degrees clockwise from Northpublic boolean isExtrude()
public Ellipse setExtrude(boolean extrude)
public boolean isFollowTerrain()
public Ellipse setFollowTerrain(boolean followTerrain)
followTerrain
- true to follow the terrain surface, and false otherwisepublic int getMaximumIntervals()
public Ellipse setMaximumIntervals(int numIntervals)
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.
numIntervals
- the number of angular intervalsjava.lang.IllegalArgumentException
- If the number of intervals is negative