public class

SquareAnnotation

extends ShapeAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.ShapeAnnotation
       ↳ com.pspdfkit.annotations.SquareAnnotation

Class Overview

Represents a square rendered on the page.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
SquareAnnotation(int pageIndex, RectF rect)
Creates a new square annotation.
SquareAnnotation(int pageIndex, RectF rect, Scale scale, FloatPrecision precision)
Creates a measurement rectangular area annotation.
Public Methods
AnnotationType getType()
Gets the annotation type of the annotation.
Protected Methods
MeasurementLabelValue getMeasurementLabelValue(MeasurementProperties measurementProperties)
Return the measurement label and value for this annotation if it is a measurement.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.ShapeAnnotation
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Constructors

public SquareAnnotation (int pageIndex, RectF rect)

Creates a new square annotation.

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this square.

public SquareAnnotation (int pageIndex, RectF rect, Scale scale, FloatPrecision precision)

Creates a measurement rectangular area annotation. Will throw an exception if Measurement Tools are not licensed.

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this square.
scale Measurement Scale for the annotation.
precision Measurement FloatPrecision for the annotation.

Public Methods

public AnnotationType getType ()

Gets the annotation type of the annotation.

Returns
  • The type of the annotation. Makes down casting easier.

Protected Methods

protected MeasurementLabelValue getMeasurementLabelValue (MeasurementProperties measurementProperties)

Return the measurement label and value for this annotation if it is a measurement. Returns null if it's not a measurement. Overridden in child shape annotations who can be measurements. Calculates the measurement value based on the passed `measurementProperties` and shape size.

Parameters
measurementProperties the properties for this measurement. Including Scale and FloatPrecision.
Returns
  • The calculated measurement value and label, or null if it's not a measurement.