A structured drawing is represented by a Drawing object that holds a collection of Figure objects.

 

A Drawing object organizes its Figure objects into a list from back to front. Figures can be added and removed from a Drawing object as needed. At a given time, a Figure can only be part of a single Drawing object.

 

A Figure object represents a structural element of a drawing. There can be various types of Figure objects in a Drawing, e. g. there can be a type of Figure objects specialized for representing rectangles, a type for circles, for lines, for text and so on.


A Figure has attributes defining its visual appearance and its state. A Figure can have an attribute for its background color, an attribute for its outline color, an attribute for line thickness and so on. The number of supported attributes is open ended. An attribute has an AttributeKey and an attribute value. An AttributeKey defines the name and type of an attribute value. Class AttributeKeys contains of number of useful AttributeKey's.


Complex figures can be built by compositing multiple Figure objects into a CompositeFigure. A CompositeFigure organizes its child Figures into a list from back to front. A CompositeFigure can use a Layouter to lay out its child Figures.


For diagrams it is very common to have connected figures. A ConnectionFigure object is a special type of a Figure, that can hold one Figure at its start point and another Figure at its end point. The location of the start and the end points are determined by Locator objects, which were created by the connected Figure object's. A ConnectionFigure typically draws a line between its start and its end point. A ConnectionFigure can use a Liner to lay out the path of the line between these points.


Elements of a Drawing

JHotDraw 7