code: @Override
      public Rectangle paint(IChemModel chemModel, IDrawVisitor drawVisitor) {
  
          IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
          IReactionSet reactionSet = chemModel.getReactionSet();
  
          if (moleculeSet == null && reactionSet != null) {
              Rectangle2D totalBounds = calculateBounds(reactionSet);
              this.setupTransformNatural(totalBounds);
              IRenderingElement diagram = reactionSetRenderer.generateDiagram(reactionSet);
              this.paint(drawVisitor, diagram);
              return this.convertToDiagramBounds(totalBounds);
          }
  
          if (moleculeSet != null && reactionSet == null) {
              Rectangle2D totalBounds = calculateBounds(moleculeSet);
              this.setupTransformNatural(totalBounds);
              IRenderingElement diagram = moleculeSetRenderer.generateDiagram(moleculeSet);
              this.paint(drawVisitor, diagram);
              return this.convertToDiagramBounds(totalBounds);
          }
  
          if (moleculeSet != null && reactionSet != null) {
              Rectangle2D totalBounds = BoundsCalculator.calculateBounds(chemModel);
  
              this.setupTransformNatural(totalBounds);
  
              ElementGroup diagram = new ElementGroup();
              diagram.add(reactionSetRenderer.generateDiagram(reactionSet));
              diagram.add(moleculeSetRenderer.generateDiagram(moleculeSet));
  
              this.paint(drawVisitor, diagram);
  
              // the size of the painted diagram is returned
              return this.convertToDiagramBounds(totalBounds);
          }
          return new Rectangle(0, 0, 0, 0);
      }
docs: Paint an IChemModel using the IDrawVisitor at a scale determined by the
  bond length in RendererModel.
  
  @param chemModel
  the chem model to draw
  @param drawVisitor
  the visitor used to draw with
  @return the rectangular area that the diagram will occupy on screen