public class

PointAndAnchor

extends Object
implements CopyableGeometry<T>
java.lang.Object
   ↳ sofia.graphics.PointAndAnchor

Class Overview

A PointAndAnchor encapsulates a PointF denoting a location on a shape canvas and an Anchor that indicates how a shape should be anchored to that point.

Summary

Public Constructors
PointAndAnchor(PointF point, Anchor anchor)
Creates a new PointAndAnchor with the specified point and anchor.
PointAndAnchor(PointAndAnchor source)
Creates a new PointAndAnchor that is a copy of the specified one.
Public Methods
PointAndAnchor copy()
Gets a copy of this PointAndAnchor.
Anchor getAnchor()
Gets the anchor represented by the receiver.
PointF getPoint()
Gets the point represented by the receiver.
RectF sized(SizeF size)
Returns a RectF-compatible object that is positioned with respect to this point and anchor and has the specified size.
RectF sized(float width, float height)
Returns a RectF-compatible object that is positioned with respect to this point and anchor and has the specified width and height.
RectF sizedProportionalTo(Shape sourceShape, double widthRatio, double heightRatio)
Gets a RectF-compatible object that is positioned with respect to this point and anchor and has the specified width and height, calculated as proportions of the size of another shape.
RectF sizedProportionalToView(double widthRatio, double heightRatio)
Gets a RectF object that has the receiver as the origin and the specified size, proportional to the size of the ShapeView that contains the shape.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sofia.graphics.CopyableGeometry

Public Constructors

public PointAndAnchor (PointF point, Anchor anchor)

Creates a new PointAndAnchor with the specified point and anchor.

Parameters
point the PointF
anchor the Anchor

public PointAndAnchor (PointAndAnchor source)

Creates a new PointAndAnchor that is a copy of the specified one.

Parameters
source the PointAndAnchor to copy

Public Methods

public PointAndAnchor copy ()

Gets a copy of this PointAndAnchor.

Returns
  • a copy of the receiver

public Anchor getAnchor ()

Gets the anchor represented by the receiver.

Returns
  • the anchor represented by the receiver

public PointF getPoint ()

Gets the point represented by the receiver.

Returns
  • the point represented by the receiver

public RectF sized (SizeF size)

Returns a RectF-compatible object that is positioned with respect to this point and anchor and has the specified size.

Parameters
size the size of the rectangle
Returns
  • a RectF-compatible object

public RectF sized (float width, float height)

Returns a RectF-compatible object that is positioned with respect to this point and anchor and has the specified width and height.

Parameters
width the width of the rectangle
height the height of the rectangle
Returns
  • a RectF-compatible object

public RectF sizedProportionalTo (Shape sourceShape, double widthRatio, double heightRatio)

Gets a RectF-compatible object that is positioned with respect to this point and anchor and has the specified width and height, calculated as proportions of the size of another shape.

Parameters
sourceShape the shape that the width and height are proportional to
widthRatio the ratio of the desired width compared to the width of the specified shape; 1.0 is equal, and larger numbers will increase the size
heightRatio the ratio of the desired height compared to the height of the specified shape
Returns
  • a RectF-compatible object that has the receiver as the origin and the specified size

public RectF sizedProportionalToView (double widthRatio, double heightRatio)

Gets a RectF object that has the receiver as the origin and the specified size, proportional to the size of the ShapeView that contains the shape.

Parameters
widthRatio the ratio of the desired width compared to the width of the specified shape; 1.0 is equal, and larger numbers will increase the size
heightRatio the ratio of the desired height compared to the height of the specified shape
Returns
  • a RectF that has the receiver as the origin and the specified size