All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.blaisemath.graphics.core.package.html Maven / Gradle / Ivy



  
    org.blaise.graphics package
    
  
  
      

Provides a scene graph component ({@link org.blaise.graphics.GraphicComponent}) and a tree of {@link org.blaise.graphics.Graphic} objects supporting pluggable rendering, mouse actions, selections, tooltips, and more.

Overview

The Graphics Component and the Graphics Tree

{@link org.blaise.graphics.GraphicComponent} is the top-level swing component, and works primarily with two classes: a {@link org.blaise.graphics.GraphicRoot} and a {@link org.blaise.style.StyleContext}. As might be expected, the first is responsible for storing the shapes and the second for drawing the shapes. However, the shapes stored in the {@code GraphicRoot} may also provide their own style information. Shapes within the {@code GraphicRoot} are stored as {@link org.blaise.graphics.Graphic}s, comprised of:

  1. the graphic object and a means to draw it (in the form of a {@code contains} method and a {@code draw} method),
  2. a parent for that shape, and
  3. a tooltip for the shape (parametrized by point),
  4. a mouse listener for the shape (parametrized by point),
  5. visibility status ({@link org.blaise.style.VisibilityHint}).

The {@link org.blaise.graphics.GraphicRoot} maintains the shapes that are to be drawn, including both the shapes themselves and the order in which they are drawn. This object also listens to mouse events from the {@link org.blaise.graphics.GraphicComponent}, which it passes along as a {@link org.blaise.graphics.GraphicMouseEvent} to the top-most {@link org.blaise.graphics.Graphic} (in terms of draw order) whose parent is a {@link org.blaise.graphics.GraphicMouseListener}.

Specific Graphics

Implementing {@link org.blaise.graphics.Graphic} should be straightforward. {@link org.blaise.graphics.GraphicSupport} contains much of the code required, apart from the {@code draw} and {@code contains} methods. {@link org.blaise.graphics.GraphicComposite} groups together several {@code Graphic}s, and also has an overridable {@link org.blaise.style.StyleContext}, which can be used to set a default style for its constituents. {@code Graphic}s are typically implemented in one of two ways: either with concrete styles, or with styles that are chosen/generated as the object is drawn, depending on a "source object". The first are labeled by "{@code Basic}" and the second by "{@code Delegating}".

Within the package, a few specific {@code Graphic}s are implemented, as described in the table below:

Class Name Description
{@link org.blaise.graphics.BasicPointGraphic} A draggable point, rendered by a {@link org.blaise.style.PointStyle}
{@link org.blaise.graphics.BasicPointSetGraphic} Several points, rendered by a common {@link org.blaise.style.PointStyle}
{@link org.blaise.graphics.BasicShapeGraphic} An arbitrary shape or path, rendered by a common {@link org.blaise.style.ShapeStyle} or {@link org.blaise.style.PathStyle}
{@link org.blaise.graphics.BasicStringGraphic} A string located at a point on the graphics canvas, rendered by a {@link org.blaise.style.StringStyle}
{@link org.blaise.graphics.CustomPointSetGraphic} Several points, with references to source objects, rendered by a {@link org.blaise.style.PointStyle} delegate.

Interfaces

Extensible interfaces and abstract classes in the {@code org.blaise.graphics} package are:
  • {@link org.blaise.graphics.Graphic} - core graphic object
  • {@link org.blaise.graphics.GraphicSupport} - partial implementation of {@code Graphic} with common functionality
  • {@link org.blaise.graphics.CanvasPainter} - more general object that paints on a canvas
  • {@link org.blaise.graphics.ContextMenuInitializer} - general way to populate a {@link javax.swing.JPopupMenu} given a "focus" object and a "selection" of objects
  • {@link org.blaise.graphics.AbstractPointGraphic}
  • {@link org.blaise.graphics.AbstractShapeGraphic}
  • {@link org.blaise.graphics.AbstractGraphicDragger} - make it easier to interpret drag gestures/events on graphic objects




© 2015 - 2025 Weber Informatics LLC | Privacy Policy