DroidDiagram Programmer's Guide
Shape Class
Remarks See Also
 






A Shape object describes a shape consisting of a series of straight lines, arcs and Bezier curves. The main component of a shape definition is its outline, which describes the shape region that will be filled in color, and used for hit-testing and aligning links to the shape. A shape can also contain decorations - lines, arcs or Bezier curves that are drawn with the shape but do not influence the fill or hit testing.

A shape is used by applying it to a ShapeNode instance by calling the setShape method.

Namespace: com.mindfusion.diagramming
Package: com.mindfusion.diagramming

 Syntax

Java  Copy Code

public class Shape

 Remarks

Shape Definitions

The Shape class provides the means for defining complex node shapes. You can design any shape composed of lines, arcs and Bézier-curves. A shape template must always contain an outline to be used for hit testing, clipping and finding intersections with other items.

Predefined Shapes

DroidDiagram provides a set of about 100 predefined shape templates accessible by the static Shapes collection and the fromId method of Shape. A shape template can be applied to a node through the setShape method.

Custom Shapes

There are several Shape constructor overrides you might choose from, depending on the complexity of the shapes you want to create. They take arrays of ElementTemplate objects as arguments, which define the outline, decorations and text region definitions. Templates are described with coordinates expressed as percents of a shape node's area. It is also possible to associate an image with a shape definition by setImage and to define the area in which the image is displayed by setImageRectangle.

Shape Libraries

The ShapeDesigner tool included in the DroidDiagram suite lets you draw custom shapes and store them in shape libraries. A library file can be loaded into your application using the ShapeLibrary class. The definitions loaded from a shape library are automatically added to the Shapes collection and can be accessed through the FromId method, just as the predefined shapes.

Link Arrowheads

A Shape instance can be set as a link's arrowhead through the setHeadShape, setBaseShape or setIntermediateShape methods of DiagramLink. When used for arrowheads, position (50, 0) in the shape definition corresponds to the arrowhead's tip point. The link segment adjacent to an arrowhead connects to the point calculated from LinkSegmentInset. Several predefined arrowhead shapes are provided as static properties of the ArrowHeads class.

 Inheritance Hierarchy

java.lang.Object
    com.mindfusion.diagramming.Shape

 See Also

Shape Members
com.mindfusion.diagramming Namespace