java.lang.Object
com.levigo.jadice.web.client.internal.annotation.wrangler.callout.CalloutAnnotations

public class CalloutAnnotations extends Object
Common utility methods for working with CalloutAnnotations.
  • Field Details

    • DEFAULT_CALLOUT_POINT_COUNT

      public static final int DEFAULT_CALLOUT_POINT_COUNT
      See Also:
  • Method Details

    • getHeadPoint

      public static Point2D getHeadPoint(CalloutAnnotation annotation)
      Returns the head point of the callout line (arrow position).
      Parameters:
      annotation - the CalloutAnnotation
      Returns:
      the head point (document coordinates in JadiceDocumentUnits)
    • getKneePoint

      public static Point2D getKneePoint(CalloutAnnotation annotation)
      Returns the knee point of the callout line (middle point of the line).
      Parameters:
      annotation - the CalloutAnnotation
      Returns:
      the knee point (document coordinates in JadiceDocumentUnits)
    • getAnchorPoint

      public static Point2D getAnchorPoint(CalloutAnnotation annotation)
      Returns the anchor point of the callout line (anchor to textbox).
      Parameters:
      annotation - the CalloutAnnotation
      Returns:
      the anchor point (document coordinates in JadiceDocumentUnits)
    • getHeadLine

      public static Line2D getHeadLine(CalloutAnnotation annotation)
      Returns a line connecting the head point with the knee point.
      Parameters:
      annotation - the CalloutAnnotation
      Returns:
      the head line
    • getAnchorLine

      public static Line2D getAnchorLine(CalloutAnnotation annotation)
      Returns a line connecting the anchor point with the knee point.
      Parameters:
      annotation - the CalloutAnnotation
      Returns:
      the anchor line
    • createCallout

      public static GeneralPath createCallout(Point2D[] line)
      Creates a new callout for the given array of points.
      Parameters:
      line - the point array
      Returns:
      the callout path
    • createPossibleAnchorSnapPoints

      public static List<Point2D> createPossibleAnchorSnapPoints(CalloutAnnotation annotation)
      Returns a list of the possible anchor snap points.
      Parameters:
      annotation - the CalloutAnnotation
      Returns:
      the list of possible anchor snap points
    • getClosestAnchorSnapPoint

      public static Point2D getClosestAnchorSnapPoint(CalloutAnnotation annotation, Point2D point)
      Returns the closest anchor snap point for the given point.
      Parameters:
      annotation - the annotation
      point - the point
      Returns:
      the closest anchor snap point
    • updateAnchorPoint

      public static void updateAnchorPoint(CalloutAnnotation annotation, Point2D anchorPoint)
      Updates the callout anchor point of the given annotation. Annotation bounds will be recalculated.
      Parameters:
      annotation - the CalloutAnnotation
      anchorPoint - the anchor point
    • updateKneePoint

      public static void updateKneePoint(CalloutAnnotation annotation, Point2D kneePoint)
      Updates the callout knee point of the given annotation. Annotation bounds will be recalculated.
      Parameters:
      annotation - the CalloutAnnotation
      kneePoint - the knee point
    • updateHeadPoint

      public static void updateHeadPoint(CalloutAnnotation annotation, Point2D headPoint)
      Updates the callout head point of the given annotation. Annotation bounds will be recalculated.
      Parameters:
      annotation - the CalloutAnnotation
      headPoint - the head point
    • updateAnnotationBounds

      public static void updateAnnotationBounds(CalloutAnnotation annotation)
      After modifying the textbox rectangle or the callout, this method can be used to update the annotation full rectangle to the actual value.
      Parameters:
      annotation - the CalloutAnnotation
    • pageClampPoint

      public static void pageClampPoint(PageView pageView, Page page, Point2D p)
      Makes sure that the given point is inside the page rectangle
      Parameters:
      pageView - the pageView
      page - the page
      p - the point to clamp into the page bounds
    • validateAnchorPoint

      public static void validateAnchorPoint(CalloutAnnotation annotation)
      Checks if the anchor point is still correct (it might be necessary to update it if the textbox was moved/resized for example).
      Parameters:
      annotation - the CalloutAnnotation
    • autoMoveTextBox

      public static void autoMoveTextBox(CalloutAnnotation annotation, PageView pageView, Point2D moveToCenterPoint)
      Performs the automatic move, meaning the textbox can be moved, but the arrow head remains at the same location.
      Parameters:
      annotation - the CalloutAnnotation
      pageView - the page view
      moveToCenterPoint - the point to move to (center point of the textbox as the auto-move Handle is at center)