Interface Element

  • All Superinterfaces:
    PicObjectConstants
    All Known Implementing Classes:
    AbstractCurve, AbstractElement, BranchElement, DefaultLeafElement, DefaultSelectionHandler, Drawing.RootElement, PicCircleFrom3Points, PicEllipse, PicGroup, PicMultiCurve, PicNodeConnection, PicParallelogram, PicPsCurve, PicSmoothPolygon, PicText, TextEditable

    public interface Element
    extends PicObjectConstants
    This interface specifies the general contract for models of graphic elements that may be added to a Drawing.

    A MODEL of graphic element basically comprises :

    • A set of (possibly virtual, see implementation hints below) user-controlled points that helps the "user" alter the geometry of the element ; these points are made accessible by means of the various get/setPoint() methods, using an index ranging from getFirstPointIndex() to getLastPointIndex() inclusive. These methods may be used e.g. by the UI machinery when processing mouse-events, or by parsers when building a new Drawing from scratch.
    • Amid this set, some points may serve as anchor-points for grid alignment (see PointIterator).
    • An attribute set that allows binding the element's geometry to a set of colour, stroke, etc... attributes.
    • A parent and possibly children once the element has been added to a tree defining a Drawing's model. This allows us to let the root element only hold state about the tree while still maintaining the ability for a child to retrieve this state at any time through a (possibly recursive) call to getParent.
    • Besides, each Element may have a View attached to it (but this is not necessary as long as it has not to be rendered), which is responsible for rendering the element to a graphic context. View's are usually created by a ViewFactory that's suited for the kind of content the model represents (e.g. PostScript, LaTeX, JPIC-XML, ...).
    Implementation hints : under the hood, the geometry may be backed e.g. by an array of points (in which case these may be the control-points as well), by a java.awt.Shape, or by any other kind of mechanism the developper thinks is appropriate to the particular model she wants to implement.

Since:
PicEdt 1.0
Author:
Sylvain Reynal