public abstract class

ShapeAnnotation

extends Annotation
implements ResizableAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.ShapeAnnotation
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Abstract base-class of all shape annotations: LineAnnotation, SquareAnnotation, CircleAnnotation, PolygonAnnotation, PolylineAnnotation. Shape annotations can also be measurement annotations if created using the measurement tools included with the Measurement Tools license component.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Methods
FloatPrecision getMeasurementPrecision()
Returns the FloatPrecision of this shape annotation if this is a measurement, null if not.
Scale getMeasurementScale()
Returns the Scale of this shape annotation if this is a measurement, null if not.
Size getMinimumSize()
Returns the minimum size of the annotation.
boolean isMeasurement()
Returns true when the annotation is a measurement annotation.
void setMeasurementPrecision(FloatPrecision precision)
Sets the FloatPrecision of this shape annotation.
void setMeasurementScale(Scale scale)
Sets the Scale of this shape annotation.
void updateTransformationProperties(RectF newBoundingBox, RectF oldBoundingBox)
Annotations may override this method to transform their properties (i.e.
Protected Methods
void setMeasurementProperties(Scale scale, FloatPrecision precision)
Once these are set, the shape becomes a measurement annotation.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Methods

public FloatPrecision getMeasurementPrecision ()

Returns the FloatPrecision of this shape annotation if this is a measurement, null if not. This information can also be taken from getMeasurementInfo().

Returns
  • If this is a measurement, returns FloatPrecision for this annotation. If not a measurement, returns null.

public Scale getMeasurementScale ()

Returns the Scale of this shape annotation if this is a measurement, null if not. This information can also be taken from getMeasurementInfo().

Returns
  • If this is a measurement, returns Scale for this annotation. If not a measurement, returns null.

public Size getMinimumSize ()

Returns the minimum size of the annotation.

Returns
  • The minimum annotation size in PDF points.

public boolean isMeasurement ()

Returns true when the annotation is a measurement annotation. Measurement annotations can be: - LineAnnotation: Distance measurement - PolylineAnnotation: Perimeter measurement - PolygonAnnotation: Polygonal area measurement - CircleAnnotation: Elliptical area measurement - SquareAnnotation: Rectangular area measurement

Returns
  • true when the annotation is a measurement annotation.

public void setMeasurementPrecision (FloatPrecision precision)

Sets the FloatPrecision of this shape annotation. Throws an InvalidPSPDFKitLicenseException if measurement tools are not licensed.

Parameters
precision FloatPrecision for this measurement annotation.

public void setMeasurementScale (Scale scale)

Sets the Scale of this shape annotation. Throws an InvalidPSPDFKitLicenseException if measurement tools are not licensed.

Parameters
scale Scale for this measurement annotation.

public void updateTransformationProperties (RectF newBoundingBox, RectF oldBoundingBox)

Annotations may override this method to transform their properties (i.e. points, rects, sizes) whenever the bounding box of the annotation changed.

Parameters
newBoundingBox New bounding box of the annotation (in PDF points).
oldBoundingBox Old bounding box of the annotation (in PDF points).

Protected Methods

protected void setMeasurementProperties (Scale scale, FloatPrecision precision)

Once these are set, the shape becomes a measurement annotation. Throws if measurements are not licensed.