Wikitude ARchitect v2.0 API Documentation

Wikitude ARchitect > AR > Drawable2D
Filters

Class Drawable2D - extends Drawable

Known Subclasses:
Label Circle ImageDrawable HtmlDrawable
Drawable2D is the base class for Drawables representing GeoObjects as 2D objects.

Drawable2Ds can be scaled and rotated (rotation axis is defined as the normal on the screen plain, causing a rotation on the screen), and an opacity can be defined. They also allow for horizontal and vertical anchors, defining the anchor of Drawable2Ds on the screen relative to the GeoLocations of the referenced GeoObject.

In case a Drawable2D is used for representation of a GeoObject having multiple GeoLocations, the Drawable2D will represent each GeoLocation seperately. For example, if a GeoObject has an array of 2 GeoLocations set as GeoObject.locations, two Drawable2Ds will be visible.

Drawable2D is a superclass for other classes and must not be directly instantiated by the developer.

Properties

horizontalAnchor - int

The horizontal anchor defines which pixel (in a horizontal pixel row) of the Drawable2D will be placed right at the screen position of the GeoObject represented by the Drawable2D.

Valid values are defined in AR.CONST.HORIZONTAL_ANCHOR. For example, if LEFT is set as horizontal anchor of an ImageDrawable, the image's left edge will match the calculated position of the Drawable2D.

The default horizontal anchor points is dependent on the concrete class of the Drawable2D.

offsetX - float

The horizontal offset to the calculated position of the Drawable2D, in SDUs. A positive offsetX causes the Drawable2D to move right, a negative offsetX causes it to move left.
Default Value: 0

offsetY - float

The vertical offset to the calculated position of the Drawable2D, in SDUs. A positive offsetY causes the Drawable2D to move up, a negative offsetY causes it to move down.
Default Value: 0

opacity - float

A value within the interval from 0.0 to 1.0 defining the opacity of the entire Drawable2D. A value of 0 indicates full transparency, a value of 1 indicates full opacity.
Default Value: 1

rotation - float

Defines the rotation of the Drawable, in degrees, with the rotation axis perpendicular to the screen plain. For example, setting rotation to 45.0 on a square plain image turns it into a rhombus. A positive value defines a rotation in clockwise direction, a negative value defines a rotation in anti-clockwise direction. Rotation can influence the BoundingRectangle of the Drawable (for example, when a Rectangle is rotated).

Note, rotation is applied in addition to any roll-tilt-heading rotations defined. Rotation specifies the rotation on the screen, with the origin of the rotation being the center of the Drawable2D, including any offsets etc.
Default Value: 0

scale - float

The scale factor for the Drawable2D. A scale factor greater than 1 enlarges the drawable, a scale factor less than 1 shrinks it down. Only values greater than or equal to 0 are allowed. A scale factor of 0 makes the Drawable2D invisible. A scale factor of 2 doubles the size of the Drawable2D, a scale factor of 0.5 halfs the size of the Drawable2D. Scale will influence the BoundingRectangle of the Drawable, but it will not influence the original properties of the Drawable2D.
Default Value: 1

scaling - float

Deprecated: Use scale instead.

verticalAnchor - int

The vertical anchor defines which pixel (in a vertical pixel column) of the Drawable2D will be placed right at the screen position of the GeoObject represented by the Drawable2D.

Valid values are defined in AR.CONST.VERTICAL_ANCHOR. For example, if TOP is set as horizontal anchor of an Image, the image's top edge will match the calculated position of the Drawable2D.

The default vertical anchor points is dependent on the concrete class of the Drawable2D.

zOrder - int

If multiple Drawable2Ds are assigned to a certain GeoObject, the zOrder defines the drawing order of these Drawables. In case the Drawables overlap, the Drawable with the higher zOrder value is rendered on top of the others (e.g. a Drawable with zOrder 1 is rendered on top of a Drawable of zOrder 0, which again is rendered on top of -1). In case Drawables have the same zOrder defined, and they overlap, the behavior is undefined and might cause unexpected results, thus it is good practice to define the zOrder for potentially overlapping Drawables.

To specify the rendering order of the Drawables of different GeoObjects, refer to GeoObject.renderingOrder.
Default Value: 0

Properties inherited from ARchitectObject:

Methods

getBoundingRectangle

BoundingRectangle getBoundingRectangle ( )
Returns the BoundingRectangle for this Drawable2D. In case of an error, null will be returned.
Returns: BoundingRectangle
the BoundingRectangle for the Drawable2D

Methods inherited from Drawable:

Methods inherited from ARchitectObject:


Copyright © 2013 Wikitude GmbH. All rights reserved.