Interface IRenderer<T extends IChemObject>

All Known Implementing Classes:
AtomContainerRenderer, ChemModelRenderer, MoleculeSetRenderer, ReactionRenderer, ReactionSetRenderer

public interface IRenderer<T extends IChemObject>
Interface that all 2D renderers implement. The constructor is responsible for registering the IGenerators' IGeneratorParameters with with the associated RendererModel.
Author:
egonw
Source code:
main
Belongs to CDK module:
render
  • Method Details

    • generateDiagram

      IRenderingElement generateDiagram(T obj)
      Internal method to generate the intermediate format.
      Parameters:
      obj - the IChemObject to generate a diagram for
      Returns:
      a tree of rendering elements
    • getRenderer2DModel

      RendererModel getRenderer2DModel()
      Returns the drawing model, giving access to drawing parameters.
      Returns:
      the rendering model
    • toModelCoordinates

      javax.vecmath.Point2d toModelCoordinates(double screenXTo, double screenYTo)
      Converts screen coordinates into model (or world) coordinates.
      Parameters:
      screenXTo - the screen's x coordinate
      screenYTo - the screen's y coordinate
      Returns:
      the matching model coordinates
      See Also:
    • toScreenCoordinates

      javax.vecmath.Point2d toScreenCoordinates(double screenXTo, double screenYTo)
      Converts model (or world) coordinates into screen coordinates.
      Parameters:
      screenXTo - the model's x coordinate
      screenYTo - the model's y coordinate
      Returns:
      the matching screen coordinates
      See Also:
    • setZoom

      void setZoom(double zoomFactor)
      Set a new zoom factor.
      Parameters:
      zoomFactor - the new zoom factor
    • shiftDrawCenter

      void shiftDrawCenter(double screenX, double screenY)
      Set a new drawing center in screen coordinates.
      Parameters:
      screenX - the x screen coordinate of the drawing center
      screenY - the y screen coordinate of the drawing center
    • paint

      Rectangle paint(T object, IDrawVisitor drawVisitor)
      Paint an IChemObject.
      Parameters:
      object - the chem object to paint
      drawVisitor - the class that visits the generated elements
      Returns:
      the rectangular area where was drawn
    • paint

      void paint(T object, IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter)
      Paint the chem object within the specified bounds.
      Parameters:
      object - Object to draw
      drawVisitor - the visitor to draw to
      bounds - the screen bounds between which to draw
      resetCenter - a boolean indicating the the drawing center needs to be reset
    • setup

      void setup(T object, Rectangle screen)
      Setup the transformations necessary to draw the IChemObject matching this IRenderer implementation.
      Parameters:
      object - IChemObject to be drawn
      screen - Rectangle to draw the object to
    • setScale

      void setScale(T object)
      Set the scale for an IChemObject. It calculates the average bond length of the model and calculates the multiplication factor to transform this to the bond length that is set in the RendererModel.
      Parameters:
      object - the IChemObject to draw.
    • calculateDiagramBounds

      Rectangle calculateDiagramBounds(T object)
      Given a IChemObject, calculates the bounding rectangle in screen space.
      Parameters:
      object - the IChemObject to draw.
      Returns:
      a rectangle in screen space.
    • getGenerators

      List<IGenerator<T>> getGenerators()
      Returns a List of IGenerators for this renderer.
      Returns:
      the list of generators for this renderer.