Package com.pspdfkit.annotations
Class LineAnnotation
-
- All Implemented Interfaces:
public class LineAnnotation extends BaseLineAnnotation
Represents a line on the page.
-
-
Field Summary
Fields Modifier and Type Field Description public boolean
isCalibration
-
Constructor Summary
Constructors Constructor Description LineAnnotation(int pageIndex, PointF point1, PointF point2)
Creates a new line annotation. LineAnnotation(int pageIndex, PointF point1, PointF point2, Scale scale, MeasurementPrecision precision)
Creates a measurement distance annotation. LineAnnotation(AnnotationPropertyManager properties, boolean markDirty)
Intended for internal usage only.
-
Method Summary
Modifier and Type Method Description boolean
isCalibration()
Internal use only - for temporary annotations used with the calibration tool createCalibrationLineAnnotation AnnotationType
getType()
Gets the annotation type of the annotation. void
setPoints(@NonNull() PointF point1, @NonNull() PointF point2)
Sets a starting and ending point of the line in PDF coordinates. Pair<PointF, PointF>
getPoints()
Returns starting and ending point of this line in PDF coordinates. void
setLineEnds(@NonNull() LineEndType lineEnd1, @NonNull() LineEndType lineEnd2)
Sets line ending style for this line. Pair<LineEndType, LineEndType>
getLineEnds()
Returns current line ending styles for this line. static LineAnnotation
createCalibrationLineAnnotation(@IntRange(from = 0) int pageIndex, @NonNull() PointF point1, @NonNull() PointF point2)
Creates a new LineAnnotation with the `isCalibration` flag set to true. -
-
Constructor Detail
-
LineAnnotation
LineAnnotation(int pageIndex, PointF point1, PointF point2)
Creates a new line annotation.- Parameters:
pageIndex
- Page to which this annotation will be attached to.point1
- Starting point of the line in PDF coordinates.point2
- End point of the line in PDF coordinates.
-
LineAnnotation
LineAnnotation(int pageIndex, PointF point1, PointF point2, Scale scale, MeasurementPrecision precision)
Creates a measurement distance annotation.- Parameters:
pageIndex
- Page to which this annotation will be attached to.point1
- Starting point of the line in PDF coordinates.point2
- End point of the line in PDF coordinates.scale
- Measurement com.pspdfkit.annotations.measurements.Scale for the annotation.precision
- Measurement MeasurementPrecision for the annotation.
-
LineAnnotation
LineAnnotation(AnnotationPropertyManager properties, boolean markDirty)
Intended for internal usage only.
-
-
Method Detail
-
isCalibration
boolean isCalibration()
Internal use only - for temporary annotations used with the calibration tool createCalibrationLineAnnotation
-
getType
@NonNull() AnnotationType getType()
Gets the annotation type of the annotation.
- Returns:
The type of the annotation. Makes down casting easier.
-
setPoints
void setPoints(@NonNull() PointF point1, @NonNull() PointF point2)
Sets a starting and ending point of the line in PDF coordinates.
- Parameters:
point1
- Starting point of the line in PDF coordinates.point2
- End point of the line in PDF coordinates.
-
getPoints
@NonNull() Pair<PointF, PointF> getPoints()
Returns starting and ending point of this line in PDF coordinates.
- Returns:
Pair of start and end point. If for any reason valid coordinates aren't set, returns (0, 0) points.
-
setLineEnds
void setLineEnds(@NonNull() LineEndType lineEnd1, @NonNull() LineEndType lineEnd2)
Sets line ending style for this line.
- Parameters:
lineEnd1
- LineEndType for start of this line.lineEnd2
- LineEndType for end of this line.
-
getLineEnds
@NonNull() Pair<LineEndType, LineEndType> getLineEnds()
Returns current line ending styles for this line.
- Returns:
Pair of start and end line ending styles. If they're not set, returns NONE.
-
createCalibrationLineAnnotation
static LineAnnotation createCalibrationLineAnnotation(@IntRange(from = 0) int pageIndex, @NonNull() PointF point1, @NonNull() PointF point2)
Creates a new LineAnnotation with the `isCalibration` flag set to true. Internal use only
- Parameters:
pageIndex
- Page to which this annotation will be attached to.point1
- Starting point of the line in PDF coordinates.point2
- End point of the line in PDF coordinates.
-
-
-
-