Canvas events

Package:

diva.canvas.feature

Status:

Unpublished. Preliminary.

Imported packages and classes:

See also:

The Diva canvas
Copyright

Contents

Interfaces

interface Feature

A feature represents a point on a figure. Features are used to identify unique points on the figure and to reshape the figure.

public static int MOVEABLE
The property that the feature can be moved. Features such as "north-west corner" can be moved, while features such as "center" generally cannot.

public static int GRABBABLE
The property that the feature is a good candidate for having a grab-handle attached to it.

public static int NORTHWEST
public static int NORTHEAST
public static int SOUTHWEST
public static int SOUTHEAST
public static int NORTH
public static int SOUTH
public static int WEST
public static int EAST
The eight compass points.

public static int CENTER
The center.

public static int VERTEX_N
A flag that can be bit-wise or'ed with an integer to indicate a vertex of a segmented figure. Up to 32 features can be indicated this way.

public static int FIRST_VERTEX
The first vertex of an open segmented figure.

public static int LAST_VERTEX
A last vertex of an open segmented figure.

int id ( )
Return this feature's id, which indicates where it is on the figure.

void translate ( double, double )
Reshape the figure by moving this feature the given distance.

Figure getFigure ( )
Get the figure that this feature belongs to.

Point2D getLocation ( )
Get the current location of this feature, in layer coordinates.

interface FeaturePredicate
A predicate that can be applied to features and used to filter them.

boolean apply ( Feature )
Return true if the feature satisfies this predicate, otherwise false.

interface FeatureSet

FeatureSet is an interface for representing a set of features. The set can be a subset of the features supported by a figure, or can include features from more than one figure (for example, when performing selection of multiple grab-handles).

Enumeration features ( )
Return an enumeration over the features of the set.

void filter ( FeaturePredicate )
Filter the set, retaining only those features that satisfy the predicate.

FigureListener getTranslater ( )
Get an object that will respond to coordinate movements by translating all features in the set. If any features are not movable, this will probably throw an exception, so the feature set should be filtered appropriately.

Classes

The classes in this package provide implementations of feature for common shapes, such as rectangles and polygons.

class RectangularFeatures implements FeatureSet

RectangularFeatures is a class that implements a set of features for rectangular shapes. The feature set is constructed by passing it the rectangle to which it is to attach the features, and a flag saying which features to include in the set.

RectangularFeatures ( Rectangle2D, int )
Create the feature set on the given rectangle. The integer flag must be either Feature.MOVABLE or Feature.GRABBABLE, or one of the rectangular feature ids.

RectangularFeatures ( Rectangle2D, int [ ] )
Create the feature set on the given rectangle. The integer array must contain rectangular feature ids.

class SegmentedFeatures implements FeatureSet

SegmentedFeatures is a class that implements a set of features for shapes that have straight-line segments, such as polygons. The feature set is constructed by passing it the shape to which it is to attach the features, and a flag saying which features to include in the set.

SegmentedFeatures ( Shape, int )
Create the feature set on the given segmented. The integer flag must be either Feature.MOVABLE or Feature.GRABBABLE, or one of the vertex feature ids.

SegmentedFeatures ( Shape, int [ ] )
Create the feature set on the given segmented shape. The integer array must contain vertex feature ids.

Issues