Constructor
new SurfaceRectangle(center, width, height, heading, attributes)
Constructs a surface rectangle with a specified center and size and an optional attributes bundle.
Parameters:
Name | Type | Description |
---|---|---|
center |
Location | The rectangle's center location. |
width |
Number | The rectangle's width in meters. |
height |
Number | The rectangle's height in meters. |
heading |
Number | The rectangle's heading. |
attributes |
ShapeAttributes | The attributes to apply to this shape. May be null, in which case attributes must be set directly before the shape is drawn. |
- Source:
Throws:
-
If the specified center location is null or undefined or if either specified width or height is negative.
- Type
- ArgumentError
Extends
Members
attributes :ShapeAttributes
The shape's attributes. If null and this shape is not highlighted, this shape is not drawn.
Type:
- Inherited From:
- Default Value:
- see ShapeAttributes
- Source:
center :Location
This shape's center location.
Type:
- Source:
displayName :String
The shape's display name and label text.
Type:
- String
- Inherited From:
- Default Value:
- Surface Shape
- Source:
enabled :Boolean
Indicates whether this shape is drawn.
Type:
- Boolean
- Inherited From:
- Default Value:
- true
- Source:
expirationInterval :Number
Indicates how long to use terrain-specific shape data before regenerating it, in milliseconds. A value
of zero specifies that shape data should be regenerated every frame. While this causes the shape to
adapt more frequently to the terrain, it decreases performance.
Type:
- Number
- Inherited From:
- Default Value:
- 2000 (milliseconds)
- Source:
heading :number
The shape's heading, specified as degrees clockwise from North. This shape's height and width are
relative to its heading.
Type:
- number
- Default Value:
- 0
- Source:
height :Number
This shape's height in meters.
Type:
- Number
- Source:
highlightAttributes :ShapeAttributes
The attributes used when this shape's highlighted flag is true. If null and the
highlighted flag is true, this shape's normal attributes are used. If they, too, are null, this
shape is not drawn.
Type:
- Inherited From:
- Default Value:
- null
- Source:
highlighted :Boolean
Indicates whether this shape displays with its highlight attributes rather than its normal attributes.
Type:
- Boolean
- Inherited From:
- Default Value:
- false
- Source:
maximumNumEdgeIntervals :Number
The maximum number of intervals an edge will be broken into. This is the number of intervals that an
edge that spans to opposite side of the globe would be broken into. This is strictly an upper bound
and the number of edge intervals may be lower if this resolution is not needed.
Type:
- Number
- Inherited From:
- Default Value:
- SurfaceShape.DEFAULT_NUM_EDGE_INTERVALS
- Source:
pathType :String
The path type to used to interpolate between locations on this shape. Recognized values are:
- WorldWind.GREAT_CIRCLE
- WorldWind.RHUMB_LINE
- WorldWind.LINEAR
Type:
- String
- Inherited From:
- Default Value:
- WorldWind.GREAT_CIRCLE
- Source:
pickDelegate :Object
Indicates the object to return as the owner of this shape when picked.
Type:
- Object
- Inherited From:
- Default Value:
- null
- Source:
polarThrottle :Number
A dimensionless number that controls throttling of edge traversal near the poles where edges need to be
sampled more closely together.
A value of 0 indicates that no polar throttling is to be performed.
Type:
- Number
- Inherited From:
- Default Value:
- SurfaceShape.DEFAULT_POLAR_THROTTLE
- Source:
sector :Sector
Defines the extent of the shape in latitude and longitude.
This sector only has valid data once the boundary is defined. Prior to this, it is null.
Type:
- Inherited From:
- Source:
userProperties :Object
An application defined object associated with this renderable. A typical use case is to associate
application defined data with a picked renderable.
Type:
- Object
- Inherited From:
- Default Value:
- An empty object
- Source:
width :Number
This shape's width, in meters.
Type:
- Number
- Source:
Methods
area(globe, terrainConformant)
Returns this shape's area in square meters.
Parameters:
Name | Type | Description |
---|---|---|
globe |
Globe | The globe on which to compute the area. |
terrainConformant |
Boolean | If true, the returned area is that of the terrain, including its hillsides and other undulations. If false, the returned area is the shape's projected area. |
- Inherited From:
- Source:
computeExtent(dc) → {BoundingBox}
Computes the extent for the shape based on its sectors.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The drawing context containing a globe. |
- Inherited From:
- Source:
Returns:
The extent for the shape.
- Type
- BoundingBox
computeSectors(dc) → {Array.<Sector>}
Computes the bounding sectors for the shape. There will be more than one if the shape crosses the date line,
but does not enclose a pole.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The drawing context containing a globe. |
- Inherited From:
- Source:
Returns:
Bounding sectors for the shape.
- Type
- Array.<Sector>
computeShiftedLocations(globe, oldLocation, newLocation, locations) → {Array.<Location>}
Computes a new set of locations translated from a specified location to a new location for a shape.
Parameters:
Name | Type | Description |
---|---|---|
globe |
Globe | The globe on which to compute a new set of locations. |
oldLocation |
Location | The original reference location. |
newLocation |
Location | The new reference location. |
locations |
Array.<Location> | The locations to translate. |
- Inherited From:
- Source:
Returns:
The translated locations.
- Type
- Array.<Location>
(protected) createShapeDataObject() → {Object}
Creates a new shape data object for the current globe state. Subclasses may override this method to
modify the shape data object that this method creates, but must also call this method on this base class.
Applications do not call this method.
- Inherited From:
- Source:
Returns:
The shape data object.
- Type
- Object
get()
A hash key of the total visible external state of the surface shape.
- Inherited From:
- Source:
(protected) isShapeDataCurrent(dc, shapeData) → {Boolean}
Indicates whether a specified shape data object is current. Subclasses may override this method to add
criteria indicating whether the shape data object is current, but must also call this method on this base
class. Applications do not call this method.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The current draw context. |
shapeData |
Object | The object to validate. |
- Inherited From:
- Source:
Returns:
true if the object is current, otherwise false.
- Type
- Boolean
render(dc)
Render this renderable. Some shapes actually draw themselves during this call, others only add themselves
to the draw context's ordered rendering list for subsequent drawing when their renderOrdered method is called.
This method is intended to be called by layers such as RenderableLayer and not by applications.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The current draw context. |
- Inherited From:
- Source:
renderToTexture(dc, ctx2D, xScale, yScale, dx, dy)
Internal use only.
Render the shape onto the texture map of the tile.
Parameters:
Name | Type | Description |
---|---|---|
dc |
DrawContext | The draw context to render onto. |
ctx2D |
CanvasRenderingContext2D | The rendering context for SVG. |
xScale |
Number | The multiplicative scale factor in the horizontal direction. |
yScale |
Number | The multiplicative scale factor in the vertical direction. |
dx |
Number | The additive offset in the horizontal direction. |
dy |
Number | The additive offset in the vertical direction. |
- Inherited From:
- Source: