public class

AnnotSnappingManager

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.utils.AnnotSnappingManager

Class Overview

This class is in charge of storing the data used for annotation snapping.

Snapping rules: - Snapping is separated into horizontal and vertical snapping, and we can only show at most one of each. - Snapping will prioritize snapping in each axis as follows: page (center) > annot (center) > annot (edges) (for example, if an annot can snap to both an annot and page on the x axis, it will prioritize showing page snapping) - It multiple snapping occurs, we prioritize showing snapping to the closest point

Summary

Nested Classes
enum AnnotSnappingManager.SnappingGroup Defines annotation groups that should snap to each other. 
class AnnotSnappingManager.SnappingResult  
enum AnnotSnappingManager.SnappingType  
Public Constructors
AnnotSnappingManager()
Public Methods
AnnotSnappingManager.SnappingResult checkSnapping(PDFViewCtrl pdfViewCtrl, Annot annot, Rect rect, int pageNum, boolean pageCenterSnapping, boolean annotCenterSnapping, boolean annotLeftSnapping, boolean annotTopSnapping, boolean annotRightSnapping, boolean annotBottomSnapping)
Returns information on whether the supplied rect can snap with any of the existing annotations
void clearCache()
void setEnabled(boolean enabled)
Sets whether snapping should be disabled.
void setPaused(boolean paused)
Sets whether snapping should be paused.
void setThreshold(double threshold)
void tryUpdateCache(PDFViewCtrl pdfViewCtrl, boolean forceUpdate)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AnnotSnappingManager ()

Public Methods

public AnnotSnappingManager.SnappingResult checkSnapping (PDFViewCtrl pdfViewCtrl, Annot annot, Rect rect, int pageNum, boolean pageCenterSnapping, boolean annotCenterSnapping, boolean annotLeftSnapping, boolean annotTopSnapping, boolean annotRightSnapping, boolean annotBottomSnapping)

Returns information on whether the supplied rect can snap with any of the existing annotations

Parameters
pdfViewCtrl the PDFViewCtrl
annot the annotation of interest to applys snapping
rect the rect to compare against the cached information. Assumes rect is normalized.
pageNum the page number containg the annotation
pageCenterSnapping whether page center snapping is checked
annotCenterSnapping whether annot center snapping is checked
annotLeftSnapping whether annot left snapping is checked
annotTopSnapping whether annot top snapping is checked
annotRightSnapping whether annot right snapping is checked
annotBottomSnapping whether annot bottom snapping is checked
Returns
  • the result of snapping

public void clearCache ()

public void setEnabled (boolean enabled)

Sets whether snapping should be disabled. When disabled, no snapping will occur and the cache will not be populated.

public void setPaused (boolean paused)

Sets whether snapping should be paused. When paused, no snapping will occur but the cache will continue to be updated.

public void setThreshold (double threshold)

public void tryUpdateCache (PDFViewCtrl pdfViewCtrl, boolean forceUpdate)