Package org.openscience.cdk.renderer
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 theIGenerator
s'IGeneratorParameter
s with with the associatedRendererModel
.- Author:
- egonw
- Source code:
- main
- Belongs to CDK module:
- render
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Rectangle
calculateDiagramBounds(T object)
Given aIChemObject
, calculates the bounding rectangle in screen space.IRenderingElement
generateDiagram(T obj)
Internal method to generate the intermediate format.List<IGenerator<T>>
getGenerators()
Returns aList
ofIGenerator
s for this renderer.RendererModel
getRenderer2DModel()
Returns the drawing model, giving access to drawing parameters.Rectangle
paint(T object, IDrawVisitor drawVisitor)
Paint an IChemObject.void
paint(T object, IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter)
Paint the chem object within the specified bounds.void
setScale(T object)
Set the scale for anIChemObject
.void
setup(T object, Rectangle screen)
Setup the transformations necessary to draw theIChemObject
matching thisIRenderer
implementation.void
setZoom(double zoomFactor)
Set a new zoom factor.void
shiftDrawCenter(double screenX, double screenY)
Set a new drawing center in screen coordinates.javax.vecmath.Point2d
toModelCoordinates(double screenXTo, double screenYTo)
Converts screen coordinates into model (or world) coordinates.javax.vecmath.Point2d
toScreenCoordinates(double screenXTo, double screenYTo)
Converts model (or world) coordinates into screen coordinates.
-
-
-
Method Detail
-
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 coordinatescreenYTo
- the screen's y coordinate- Returns:
- the matching model coordinates
- See Also:
toScreenCoordinates(double, double)
-
toScreenCoordinates
javax.vecmath.Point2d toScreenCoordinates(double screenXTo, double screenYTo)
Converts model (or world) coordinates into screen coordinates.- Parameters:
screenXTo
- the model's x coordinatescreenYTo
- the model's y coordinate- Returns:
- the matching screen coordinates
- See Also:
toModelCoordinates(double, double)
-
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 centerscreenY
- the y screen coordinate of the drawing center
-
paint
Rectangle paint(T object, IDrawVisitor drawVisitor)
Paint an IChemObject.- Parameters:
object
- the chem object to paintdrawVisitor
- 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 drawdrawVisitor
- the visitor to draw tobounds
- the screen bounds between which to drawresetCenter
- a boolean indicating the the drawing center needs to be reset
-
setup
void setup(T object, Rectangle screen)
Setup the transformations necessary to draw theIChemObject
matching thisIRenderer
implementation.- Parameters:
object
-IChemObject
to be drawnscreen
-Rectangle
to draw the object to
-
setScale
void setScale(T object)
Set the scale for anIChemObject
. 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 theRendererModel
.- Parameters:
object
- theIChemObject
to draw.
-
calculateDiagramBounds
Rectangle calculateDiagramBounds(T object)
Given aIChemObject
, calculates the bounding rectangle in screen space.- Parameters:
object
- theIChemObject
to draw.- Returns:
- a rectangle in screen space.
-
getGenerators
List<IGenerator<T>> getGenerators()
Returns aList
ofIGenerator
s for this renderer.- Returns:
- the list of generators for this renderer.
-
-