Sofia API Reference

  • Package Index
  • Class Index
  • Packages
  • sofia.app
  • sofia.content
  • sofia.data
  • sofia.graphics
    • Interfaces
    • Joint
    • PropertyTransformer
    • Classes
    • AbstractJoint
    • Anchor
    • Color
    • CoordinateSystem
    • DirectionalPad
    • DistanceJoint
    • ElasticInInterpolator
    • ElasticInOutInterpolator
    • ElasticOutInterpolator
    • FillableShape
    • FillableShape.Animator
    • Geometry
    • Image
    • LineShape
    • MotionStep
    • OvalShape
    • PointAndAnchor
    • Polygon
    • PolygonShape
    • Predicate
    • RectangleShape
    • RevoluteJoint
    • Shape
    • Shape.Animator
    • Shape.Filter
    • ShapeField
    • ShapeFilter
    • ShapeSet
    • ShapeView
    • SizeF
    • StrokedShape
    • StrokedShape.Animator
    • TextShape
    • TextShape.Animator
    • Timings
    • ViewEdges
    • ZIndexComparator
    • Enums
    • RepeatMode
    • ShapeMotion
  • sofia.util
  • sofia.view
  • sofia.widget

public class
PointAndAnchor

extends Object

Inheritance

  • 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.
Methods inherited from class java.lang.Object
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait()
final void wait(long arg0, int arg1)
final void wait(long arg0)

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