Class MolPrinter

java.lang.Object
chemaxon.marvin.MolPrinter

@PublicApi public class MolPrinter extends Object
Molecule renderer that can draw a molecule to a graphics context using various display settings.

Example of usage:

 import chemaxon.marvin.MolPrinter;
 import chemaxon.struc.Molecule;
 import chemaxon.formats.MolImporter;
 import java.awt.Color;
 import java.awt.Rectangle;
 import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
 import javax.imageio.ImageIO;

 public class MolPrinterTest {
     static BufferedImage createTestImage() throws IOException {
         // Create a molecule
         Molecule mol = MolImporter.importMol("CN1C=NC2=C1C(=O)N(C)C(=O)N2C");
         // Create a writable image
         BufferedImage im = new BufferedImage(400, 400, BufferedImage.TYPE_INT_ARGB);
         Graphics2D g = im.createGraphics();
         // Clear background
         g.setColor(Color.white);
         g.fillRect(0, 0, im.getWidth(), im.getHeight());
         // Draw the bounding rectangle
         g.setColor(Color.red);
         Rectangle rect = new Rectangle(20, 20, 360, 200);
         g.draw(rect);
         // Paint the molecule
         MolPrinter molPrinter = new MolPrinter(mol);
         molPrinter.setScale(molPrinter.maxScale(rect)); // fit image in the rectangle
         molPrinter.setBackgroundColor(Color.white);
         molPrinter.paint(g, rect);
         return im;
     }

     public static void main(String[] args) throws Exception {
         BufferedImage im = createTestImage();
         ImageIO.write(im, "png", new File("test.png"));
     }
 }
 
  • Constructor Details

    • MolPrinter

      public MolPrinter()
      Constructs a molecule renderer for an empty molecule.
    • MolPrinter

      public MolPrinter(MoleculeGraph m)
      Constructs a molecule renderer for the specified molecule.
      Parameters:
      m - a molecule graph
      Since:
      Marvin 4.1.8, 04/20/2007
    • MolPrinter

      public MolPrinter(MDocument d)
      Constructs a molecule renderer for the specified document.
      Parameters:
      d - the document
      Since:
      Marvin 4.1.8, 04/20/2007
  • Method Details

    • getDispopts

      public int getDispopts()
      Returns the actual display options. Note that this is an advanced way of handling display options. It may be easier to see specific methods that provides information on each display options individually.
      Example with explicit hydrogen atom display:
      1. boolean explicitHVisible = (molPrinter.getDispopts() & DispOptConsts.EXPLICITH_FLAG) != 0;
      2. boolean explicitHVisible = molPrinter.isExplicitHVisible();
      Returns:
      display options
      Since:
      Marvin 2.6
      See Also:
      • DispOptConsts
    • setDispopts

      public void setDispopts(int f)
      Modifies the display options in the advanced way of handling display options.
      Parameters:
      f - display options to set
      Since:
      Marvin 2.6
      See Also:
      • DispOptConsts
    • setDispopts

      public void setDispopts(int f, int mask)
      Modifies the display options as in setDispopts(int), but affects only limited display options using a mask.
      Parameters:
      f - display options
      mask - the bits of the mask determine the specific display options to set
      Since:
      Marvin 4.1.9, 06/05/2007
      See Also:
      • DispOptConsts
    • getDispoptsExt

      public int getDispoptsExt()
      Returns the actual extended display options. Note that this is an advanced way of handling display options. It may be easier to see specific methods that provides information on each display options individually.
      Extended display options: bits 0-1: ligand order visibility, bit 2: Atom property visibility, bit 3: R-Logic visibility, bit 4: Depth cue (fog) visibility, bit 5: valence property visibility
      Returns:
      display options
      Since:
      Marvin 5.5
      See Also:
      • DispOptConsts
      • DispOptConsts.LIGAND_ORDER_OFF
      • DispOptConsts.LIGAND_ORDER_ON
      • DispOptConsts.LIGAND_ORDER_ONLY_WITH_DEFINITION
      • DispOptConsts.ATPROP_FLAG
      • DispOptConsts.RLOGIC_FLAG
      • DispOptConsts.AUTOMATIC_FOG
      • DispOptConsts.VALENCE_PROP_VISIBILITY_FLAG
    • setDispoptsExt

      public void setDispoptsExt(int f)
      Modifies the extended display options in the advanced way of handling display options. It may be easier to use specific methods to change display options individually.
      Parameters:
      f - display options to set
      Since:
      Marvin 5.5
      See Also:
    • setDispoptsExt

      public void setDispoptsExt(int f, int mask)
      Modifies the extended display options as in setDispoptsExt(int), but affects only limited display options using a mask.
      Parameters:
      f - display options
      mask - the bits of the mask determine the specific display options to set
      Since:
      Marvin 5.5
      See Also:
    • getScale

      public double getScale()
      Returns the scale factor in units of regular bond length.
      Returns:
      displayed length of a C-C bond in pixels
      Since:
      Marvin 2.9.11
    • setScale

      public void setScale(double m)
      Sets the scale factor in units of regular bond length.
      Parameters:
      m - displayed length of a C-C bond in pixels
      Since:
      Marvin 2.9.11
    • maxScale

      public double maxScale(Rectangle r)
      Calculates the maximum scaling factor for fitting the image in the specified rectangle.
      Parameters:
      r - the rectangle to fit
      Returns:
      calculated maximum scale factor
      Since:
      Marvin 4.1.8, 04/20/2007
    • maxScale

      public double maxScale(Dimension d)
      Calculates the maximum scaling factor for fitting the image in a rectangle of the specified size.
      Parameters:
      d - the size of the rectangle to fit
      Returns:
      calculated maximum scale factor
    • getBoundingRectangle

      public Rectangle getBoundingRectangle(MoleculeGraph[] mols)
      Returns the bounding rectangle of the specified molecules using the current scale factor. This method is useful to determine what the minimum size of the rectangle should be in paint(java.awt.Graphics2D, java.awt.Rectangle) to draw the molecules using a certain scale factor. Example:
       molPrinter.setScale(28);
       Rectangle r = molPrinter.getBoundingRectangle(mols);
       BufferedImage im = new BufferedImage(r.x, r.y, BufferedImage.TYPE_INT_ARGB);
       Graphics2D g = im.createGraphics();
       molPrinter.paint(g, r);
       
      Note that having an MDocument object, one can call getBoundingRectangle(mDocument.getAllMolecules()).
      Parameters:
      mols - the molecules
      Returns:
      the bounding rectangle
    • getAtomsize

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public double getAtomsize()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.2.2, replaced by getAtomSize().
      Returns the atom size in units of regular bond length.
      Returns:
      the size of displayed atom labels
    • getAtomSize

      public double getAtomSize()
      Returns the atom size in units of regular bond length.
      Returns:
      the size of displayed atom labels
      Since:
      Marvin 5.2.2 04/15/2009
    • setAtomsize

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setAtomsize(double l)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.2.2, replaced by setAtomSize(double).
      Sets the size of displayed atoms in units of regular bond length.
      Parameters:
      l - size of the displayed atom labels
    • setAtomSize

      public void setAtomSize(double s)
      Sets the size of displayed atoms in units of regular bond length.
      Parameters:
      s - size of the displayed atom labels
      Since:
      Marvin 5.2.2 04/15/2009
    • getBondSpacing

      public double getBondSpacing()
      Returns the double bond spacing that is the distance of the two lines representing a double bond.
      Returns:
      the bond spacing in regular bond length units.
      Since:
      Marvin 4.1, 10/19/2005
    • getBondHashSpacing

      public double getBondHashSpacing()
      Returns the bond hash spacing that is the distance hashes in a hashed bond.
      Returns:
      the bond hash spacing in regular bond length units.
    • getBallRadius

      public double getBallRadius()
      Gets the ball radius for "ball and stick" mode.
      Returns:
      the ball radius
      Since:
      Marvin 5.2.5
    • setBallRadius

      public void setBallRadius(double r)
      Sets the ball radius for "ball and stick" mode.
      Parameters:
      r - the ball radius
      Since:
      Marvin 5.2.5
    • getStickThickness

      public double getStickThickness()
      Gets the 3D stick's diameter.
      Returns:
      the stick thickness
      Since:
      Marvin 5.2.5
    • setStickThickness

      public void setStickThickness(double w)
      Sets the 3D stick's diameter.
      Parameters:
      w - the stick thickness
      Since:
      Marvin 5.2.5
    • isAminoAcidBondColoringEnabled

      public boolean isAminoAcidBondColoringEnabled()
      Is peptide bridge coloring enabled?
      Returns:
      true if enabled
      Since:
      Marvin 6.3.1
    • setAminoAcidBondColoringEnabled

      public void setAminoAcidBondColoringEnabled(boolean v)
      Sets peptide bridge coloring enabled.
      Parameters:
      v - true for enabled
      Since:
      Marvin 6.3.1
    • isAbsoluteLabelsVisible

      public boolean isAbsoluteLabelsVisible()
      Is 'Absolute' label visible?.
      Returns:
      true if visible, false if invisible
      Since:
      Marvin 4.1
    • setAbsoluteLabelsVisible

      public void setAbsoluteLabelsVisible(boolean v)
      Set 'Absolute' label visibility.
      Parameters:
      v - true to visible, false to invisible
      Since:
      Marvin 4.1
    • setPeptideDisplay

      public void setPeptideDisplay(String type)
      Sets the Peptide display settings.
      Parameters:
      type - "1-letter" to One Letter Peptide Display anything else to Three Letter Peptide Display
      Since:
      Marvin 4.1
    • isOneLetterPeptideDisplay

      public boolean isOneLetterPeptideDisplay()
      Decides whether the Peptide display settings set to one letter.
      Returns:
      true if the Peptide display settings are set to one letter.
    • isThreeLetterPeptideDisplay

      public boolean isThreeLetterPeptideDisplay()
      Decides whether the Peptide display settings set to three letter.
      Returns:
      true if the Peptide display settings are set to three letter.
    • setRgroupsVisible

      public void setRgroupsVisible(boolean v)
      Sets whether the R-group definitions are visible.
      Parameters:
      v - true to visible, false to invisible
    • isRgroupsVisible

      public boolean isRgroupsVisible()
      Decides whether the R-group definitions are visible.
      Returns:
      true if the R-group definitions are visible, false otherwise.
    • setAnyBondStyles

      public void setAnyBondStyles(String s)
      Sets the any bond style.
      Parameters:
      s - the style
    • getAnyBondStyles

      public String getAnyBondStyles()
      Gets the any bond style.
      Returns:
      the style
    • setLonePairAsLine

      public void setLonePairAsLine(boolean v)
      Sets the visibility of Lone Pairs
    • isLonePairAsLine

      public boolean isLonePairAsLine()
      Get the visibility of Lone Pairs: dots/line
    • setChargeWithCircle

      public void setChargeWithCircle(boolean v)
      Sets the visibility of Charge with Circle
    • isChargeWithCircle

      public boolean isChargeWithCircle()
      Get the visibility of Charge with Circle
    • getChargeFont

      public Font getChargeFont()
      Gets the charge's font.
      Returns:
      the font
      Since:
      Marvin 5.12
    • setChargeFont

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setChargeFont(Font f)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in Marvin 15.5.18
      Sets the circled charge's font.
      Parameters:
      f - the font
      Since:
      Marvin 5.12
    • getChargeFontSize

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public double getChargeFontSize()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the circled charge's font's size.
      Returns:
      the chargeFontSize
      Since:
      Marvin 5.12
    • getWireThickness

      public double getWireThickness()
      Gets the line thickness for wireframe mode.
      Returns:
      the line thickness in Angstroms
      Since:
      Marvin 5.2.5
    • setWireThickness

      public void setWireThickness(double w)
      Sets the line thickness for wireframe mode.
      Parameters:
      w - the line thickness in Angstroms
      Since:
      Marvin 5.2.5
    • setBondSpacing

      public void setBondSpacing(double s)
      Sets the double bond spacing that is the distance of the two lines representing a double bond.

      spacing = s * 1.54 Å = s * scale pixels

      Parameters:
      s - the bond spacing in regular bond length units.
      Since:
      Marvin 4.1, 10/19/2005
    • setBondHashSpacing

      public void setBondHashSpacing(double s)
      Sets the bond hash spacing that is the distance the hashes in a hashed bond.

      spacing = s * 1.54 Å = s * scale pixels

      Parameters:
      s - the bond hash spacing in regular bond length units.
    • getImplicitH

      public String getImplicitH()
      Returns the display method of implicit hydrogens.
      • Not displayed: IMPLICITH_OFF_S
      • Displayed on heteroatoms: IMPLICITH_HETERO_S
      • Displayed on hetero and terminal atoms: IMPLICITH_HETEROTERM_S
      • All displayed: IMPLICITH_ALL_S
      Returns:
      the display method as String
      Since:
      Marvin 2.9.11
      See Also:
      • DispOptConsts.IMPLICITH_LEVELS
    • setImplicitH

      public void setImplicitH(String s)
      Sets the display method of implicit hydrogens.
      • Not displayed: IMPLICITH_OFF_S
      • Displayed on heteroatoms: IMPLICITH_HETERO_S
      • Displayed on hetero and terminal atoms: IMPLICITH_HETEROTERM_S
      • All displayed: IMPLICITH_ALL_S
      Parameters:
      s - the display method as String
      Since:
      Marvin 2.9.11
      See Also:
      • DispOptConsts.IMPLICITH_LEVELS
    • getColorScheme

      public String getColorScheme()
      Returns the current color scheme.
      • Displays all atoms with the default drawing color: MONO_SCHEME_S
      • Displays all atoms with Corey-Pauling-Kultun colors: CPK_SCHEME_S
      • Coloring atoms based on RasMol's shapely color scheme for nucleic and amino acids: SHAPELY_SCHEME_S
      • Coloring atoms based on PDB residue numbers: GROUP_SCHEME_S
      Returns:
      the color scheme as String
      Since:
      Marvin 2.9.11
      See Also:
      • DispOptConsts.COLOR_SCHEMES
    • setColorScheme

      public void setColorScheme(String s)
      Sets the color scheme.
      • Displays all atoms with the default drawing color: MONO_SCHEME_S
      • Displays all atoms with Corey-Pauling-Kultun colors: CPK_SCHEME_S
      • Coloring atoms based on RasMol's shapely color scheme for nucleic and amino acids: SHAPELY_SCHEME_S
      • Coloring atoms based on PDB residue numbers: GROUP_SCHEME_S
      Parameters:
      s - the color scheme as String
      Since:
      Marvin 2.9.11
      See Also:
      • DispOptConsts.COLOR_SCHEMES
    • isSetColoringEnabled

      public boolean isSetColoringEnabled()
      Returns true if atoms and bonds are colored according to the color of the pre-defined set they belong to. For more information, see http://www.chemaxon.com/marvin/help/developer/core/sets.html
      Returns:
      true if atom/bond set coloring is enabled
      Since:
      Marvin 3.3
    • setSetColoringEnabled

      public void setSetColoringEnabled(boolean v)
      Colors atoms and bonds according to the color of the pre-defined set they belong to. For more information, see http://www.chemaxon.com/marvin/help/developer/core/sets.html
      Parameters:
      v - true to enable atom/bond set coloring
      Since:
      Marvin 3.3
    • getRendering

      public String getRendering()
      Returns the rendering style of atoms and bonds.
      Returns:
      the rendering style as a string representation of an enum value of type RenderingStyle.
      Since:
      Marvin 2.9.11
    • setRendering

      public void setRendering(String s)
      Sets the rendering style of atoms and bonds.
      Parameters:
      s - the rendering style as a string representation of an enum value of type RenderingStyle.
      Since:
      Marvin 2.9.11
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns the current background color.
      Returns:
      the background color
      Since:
      Marvin 5.2.2
    • setBackgroundColor

      public void setBackgroundColor(Color color)
      Sets the background color.
      Parameters:
      color - the desired bakcground Color
      Since:
      Marvin 4.1.13
    • isAtomSymbolsVisible

      public boolean isAtomSymbolsVisible()
      Returns the atom symbol visibility of 3D mode.
      Returns:
      true if atom symbols are visible in 3D mode
      Since:
      Marvin 3.3.3
    • setAtomSymbolsVisible

      public void setAtomSymbolsVisible(boolean v)
      Sets atom symbol visibility in 3D mode. Note that in 3D mode, atoms may become invisible in Wireframe and Stick mode by hiding atom symbols.
      Parameters:
      v - show (true) or hide (false) atom symbols in 3D mode
      Since:
      Marvin 3.3.3
    • setAtomNumbersVisible

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setAtomNumbersVisible(boolean v)
      Deprecated, for removal: This API element is subject to removal in a future version.
      in 6.2.0. Use setAtomNumberingType() instead.
      Sets the atom number visibility. Please note that atom numbers are numbered from 0 in molecule structures, but displayed from 1.
      Parameters:
      v - true to show, false to hide
      Since:
      Marvin 5.7
    • isAtomNumbersVisible

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean isAtomNumbersVisible()
      Deprecated, for removal: This API element is subject to removal in a future version.
      in 6.2.0. Use getAtomNumberingType instead.
      Returns true if atom numbers are visible.
      Returns:
      true if visible, false if not
      Since:
      Marvin 5.7
    • setAtomNumberingType

      public void setAtomNumberingType(int t)
      sets atom numbering type.
      Parameters:
      t - (0) for off, (1) for atom numbers and (2) for IUPAC numbering
      Since:
      Marvin 6.1
    • getAtomNumberingType

      public int getAtomNumberingType()
      Returns atom numbering type.
      Returns:
      (0) for off, (1) for atom numbers and (2) for IUPAC numbering
      Since:
      Marvin 6.1
    • setAtomMappingVisible

      public void setAtomMappingVisible(boolean v)
      Sets the atom mapping visibility.
      Parameters:
      v - true to show, false to hide
      Since:
      Marvin 5.7
    • isAtomMappingVisible

      public boolean isAtomMappingVisible()
      Returns true if atom mapping is visible.
      Returns:
      true if visible, false if not
      Since:
      Marvin 5.7
    • getChiralitySupport

      public int getChiralitySupport()
      Returns the current chirality display mode.
      Returns:
      the chirality display mode as int
      Since:
      Marvin 3.3.3
    • setChiralitySupport

      public void setChiralitySupport(int l)
      Sets the chirality display mode.
      Parameters:
      l - the desired chirality display mode
      Since:
      Marvin 3.3.3
    • isEzVisible

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean isEzVisible()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.2.2, replaced by isEZLabelsVisible()
      Returns the E/Z labels display option.
      Returns:
      show (true) or hide (false)
      Since:
      Marvin 3.3.3
    • setEzVisible

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setEzVisible(boolean v)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.2.2, replaced by setEZLabelsVisible(boolean)
      Sets the E/Z labels display option.
      Parameters:
      v - show (true) or hide (false) E/Z
      Since:
      Marvin 3.3.3
    • isEZLabelsVisible

      public boolean isEZLabelsVisible()
      Returns the visibility state of absolute double bond stereo configuration labels.
      Returns:
      true if E/Z labels are visible
      Since:
      Marvin 3.3.3
    • setEZLabelsVisible

      public void setEZLabelsVisible(boolean v)
      Sets the visibility state of absolute double bond stereo configuration labels. Bonds known to have an (E) or (Z) configuration will be marked as such.
      Parameters:
      v - show (true) or hide (false) E/Z labels
      Since:
      Marvin 3.3.3
    • isMPLabelsVisible

      public boolean isMPLabelsVisible()
      Returns the visibility state of M/P labels.
      Returns:
      true if M/P labels are visible
      Since:
      Marvin 3.3.3
    • setMPLabelsVisible

      public void setMPLabelsVisible(boolean v)
      Sets the visibility state of M/P labels.
      Parameters:
      v - show (true) or hide (false) M/P labels
      Since:
      Marvin 3.3.3
    • isLonePairsVisible

      public boolean isLonePairsVisible()
      Returns the visibility state of lone pairs.
      Returns:
      true if lone pairs are visible
      Since:
      Marvin 5.2.2
    • setLonePairsVisible

      public void setLonePairsVisible(boolean v)
      Sets the visibility state of lone pairs. In case the molecule does not contain explicit lone pairs this method may not display lone pairs. To display lone pairs in this case, use the setLonePairsAutoCalculated(boolean) method too.
      Parameters:
      v - show (true) or hide (false) lone pairs
      Since:
      Marvin 5.2.2
    • isLonePairsAutoCalculated

      public boolean isLonePairsAutoCalculated()
      Returns the state of the automatic calculation of lone pairs.
      Returns:
      true if lone pairs are calculated automatically.
      Since:
      Marvin 5.2.5
    • setLonePairsAutoCalculated

      public void setLonePairsAutoCalculated(boolean v)
      Sets the state of the automatic calculation of lone pairs.
      Parameters:
      v - true if lone pairs should be calculated automatically
      Since:
      Marvin 5.2.5
    • getCarbonVisibility

      public String getCarbonVisibility()
      Returns the visibility style of the C labels on Carbon atoms.
      • Always: DispOptConsts.CARBON_VIS_ON_S
      • At straight angles and implicit H atoms: DispOptConsts.CARBON_VIS_INCHAIN_S
      • Never: DispOptConsts.CARBON_VIS_OFF_S
      See more information at the MarvinSketch User's Guide
      Returns:
      the style
      Since:
      Marvin 5.2.5
    • setCarbonVisibility

      public void setCarbonVisibility(String s)
      Sets the visibility style of the C labels on Carbon atoms.
      • Always: DispOptConsts.CARBON_VIS_ON_S
      • At straight angles and implicit H atoms: DispOptConsts.CARBON_VIS_INCHAIN_S
      • Never: DispOptConsts.CARBON_VIS_OFF_S
      See more information at the MarvinSketch User's Guide
      Parameters:
      s - the style
      Since:
      Marvin 5.2.5
    • isTransparent

      public boolean isTransparent()
      Returns the transparency state of the painting.
      Returns:
      true if the painter is in transparent drawing mode.
      Since:
      Marvin 5.2.5
    • setTransparent

      public void setTransparent(boolean transparency)
      Sets the transparency state of the painting.
      Parameters:
      transparency - if true then the painting is in transparent mode.
      Since:
      Marvin 5.2.5
    • isValenceErrorvisible

      public boolean isValenceErrorvisible()
      Returns the visibility state of valence errors. If valence errors are set to visible, they are indicated by a red underline under the atom labels. The default value is false.
      Returns:
      true if valence errors are shown.
    • setValenceErrorVisible

      public void setValenceErrorVisible(boolean b)
      Sets the visibility state of valence errors.
      Parameters:
      b - true if the valence errors are drawn
    • getLigandOrderVisibility

      public String getLigandOrderVisibility()
      Gets the ligand order visibility setting.
      Returns:
      the ligand order visibility setting
      Since:
      Marvin 5.5
      See Also:
      • DispOptConsts.LIGAND_ORDER_OFF_S
      • DispOptConsts.LIGAND_ORDER_ON_S
      • DispOptConsts.LIGAND_ORDER_ONLY_WITH_DEFINITION_S
    • setLigandOrderVisibility

      public void setLigandOrderVisibility(String s)
      Sets the ligand order visibility.
      Parameters:
      s - the ligand order visibility to set
      Since:
      Marvin 5.5
      See Also:
      • DispOptConsts.LIGAND_ORDER_OFF_S
      • DispOptConsts.LIGAND_ORDER_ON_S
      • DispOptConsts.LIGAND_ORDER_ONLY_WITH_DEFINITION_S
    • isAtomPropertiesVisible

      public boolean isAtomPropertiesVisible()
      Get the atom properties visibility
      Returns:
      true if atom properties has to be drawn.
      Since:
      Marvin 5.5
    • setAtomPropertiesVisible

      public void setAtomPropertiesVisible(boolean v)
      Set the atom properties visibility
      Parameters:
      v - true to draw atom properties.
      Since:
      Marvin 5.5
    • isRLogicVisible

      public boolean isRLogicVisible()
      Is R-logic visible?.
      Returns:
      true if visible, false if invisible
      Since:
      Marvin 5.5
    • setRLogicVisible

      public void setRLogicVisible(boolean v)
      Set R-logic visibility.
      Parameters:
      v - true to visible, false to invisible
      Since:
      Marvin 5.5
    • isValencePropertyVisible

      public boolean isValencePropertyVisible()
      Gets the atom valence property visibility
      Returns:
      true if the valence property is visibile
      Since:
      Marvin 5.5
    • setValencePropertyVisible

      public void setValencePropertyVisible(boolean v)
      Sets the atom valence propertiy visibility
      Parameters:
      v - the valence property visibility
      Since:
      Marvin 5.5
    • areAttachmentPointsVisible

      public boolean areAttachmentPointsVisible()
      Gets the attachment points visibility.
    • setAttachmentPointsVisible

      public void setAttachmentPointsVisible(boolean v)
      Sets the attachment points visibility.
    • isLigandErrorVisible

      public boolean isLigandErrorVisible()
      Gets the bond's ligand error visibility
      Returns:
      true if the ligand error is visibile
      Since:
      Marvin 5.6
    • setLigandErrorVisible

      public void setLigandErrorVisible(boolean v)
      Sets the bond's ligand error visibility
      Parameters:
      v - the ligand error visibility
      Since:
      Marvin 5.6
    • getCoordinateBondStyle

      public String getCoordinateBondStyle()
      Gets the coordinate bond line style when both atoms are single.
      Returns:
      the coordinative bond line style "solid"/"arrow"
    • setCoordinateBondStyle

      public void setCoordinateBondStyle(String s)
      Set the coordinate bond line style when both atoms are single.
      Parameters:
      s - "solid"/"arrow"
    • getCoordinateBondStyleAtMulticenter

      public String getCoordinateBondStyleAtMulticenter()
      Gets the coordinate bond line style.
      Returns:
      the coordinate bond line style "solid"/"hashed"
    • setCoordinateBondStyleAtMulticenter

      public void setCoordinateBondStyleAtMulticenter(String s)
      Set the coordinate bond line style.
      Parameters:
      s - "solid"/"hashed"
    • setMol

      public void setMol(Molecule m)
      Sets the current molecule and calculate its bounds.
      Parameters:
      m - the molecule
    • setMolTemplate

      public void setMolTemplate(Molecule m)
    • setMol

      public void setMol(String s) throws MolFormatException
      Sets the current molecule and calculate its bounds.
      Parameters:
      s - string containing the molecule file in some known format
      Throws:
      MolFormatException - if the molecule string cannot be imported
    • setDoc

      public void setDoc(MDocument d)
      Sets the current document and calculates its bounds.
      Parameters:
      d - the document
      Since:
      Marvin 4.1.8, 04/20/2007
    • paint

      public void paint(Graphics g, Rectangle r)
      Paints the molecule into the center of the specified rectangle.
      Parameters:
      g - the graphics context to paint on
      r - the rectangle in which the molecule is painted
    • paint

      public void paint(Graphics2D g, Rectangle r)
      Paints the molecule into the center of the specified rectangle.
      Parameters:
      g - the graphics context to paint on
      r - the rectangle in which the molecule is painted
      Since:
      Marvin 5.2.2 04/15/2009
    • paint

      public void paint(Graphics2D g, Dimension d)
      Paints the molecule on the specified graphics context in the given size.
      Parameters:
      g - the graphics context to paint on
      d - the dimension of the painted molecule
      Since:
      Marvin 5.3 12/01/2009
    • getBondWidth

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public double getBondWidth()
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of Marvin 4.1, replaced by getBondSpacing()
      Returns the double bond spacing that is the distance of the two lines representing a double bond.
      Returns:
      the bond spacing in regular bond length units.
    • setBondWidth

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setBondWidth(double w)
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of Marvin 4.1, replaced by setBondSpacing(double)
      Sets the double bond spacing that is the distance of the two lines representing a double bond.
      Parameters:
      w - the bond spacing in regular bond length units.
    • molToScreenCoords

      public void molToScreenCoords(DPoint3 molcoords, Point2D scrcoords)
      Converts molecular coordinates to 2D screen coordinates.
      Parameters:
      molcoords - molecular coordinates in Angstroms (input)
      scrcoords - graphics context coordinates in pixels (output)
      Since:
      Marvin 5.2.4, 07/29/2009
    • setExplicitH

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setExplicitH(boolean show)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.5.1 this method does nothing. This method will be removed in a future release.
      Sets the visibility state of explicit hydrogen atoms.
      Parameters:
      show - show (true) or hide (false) explicit hydrogen atoms
      Since:
      Marvin 3.3.3
    • isExplicitHVisible

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean isExplicitHVisible()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.5.1 this method always returns true. This method will be removed in a future release.
      Returns the visibility state of explicit hydrogen atoms.
      Returns:
      true if explicit hydrogens are displayed
      Since:
      Marvin 5.2.2 04/15/2009
    • setExplicitHVisible

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setExplicitHVisible(boolean b)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.5.1 this method does nothing. This method will be removed in a future release.
      Sets the visibility state of explicit hydrogen atoms.
      Parameters:
      b - show (true) or hide (false) explicit hydrogen atoms
      Since:
      Marvin 5.2.2 04/15/2009
    • getDisplayQuality

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public int getDisplayQuality()
      Deprecated, for removal: This API element is subject to removal in a future version.
      since Marvin 6.4 only high quality exists
      Gets the display quality.
      0 - low quality, faster rendering
      1 - high quality (antialiasing), slower rendering
      Returns:
      the display quality
      Since:
      Marvin 5.7, 09/08/2011ű
    • setDisplayQuality

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setDisplayQuality(int q)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since Marvin 6.4 only high quality exists
      Sets the display quality.
      0 - low quality, faster rendering
      1 - high quality (antialiasing), slower rendering
      Parameters:
      q - the display quality
      Since:
      Marvin 5.7, 09/08/2011
    • isBondLengthVisible

      public boolean isBondLengthVisible()
      Return whether the bond length is visible or not.
      Returns:
      true is the bond length is visible, otherwise false
      Since:
      Marvin 5.7, 09/08/2011
    • setBondLengthVisible

      public void setBondLengthVisible(boolean v)
      Sets the bond length visibility
      Parameters:
      v - true - visible, false - invisible
      Since:
      Marvin 5.7, 09/08/2011
    • isGraphInvariantVisible

      public boolean isGraphInvariantVisible()
      Return whether the graph invariant is visible or not.
      Returns:
      true is the graph invariant is visible, otherwise false
      Since:
      Marvin 5.7, 09/08/2011
    • setGraphInvariantVisible

      public void setGraphInvariantVisible(boolean v)
      Sets the graph invariant visibility
      Parameters:
      v - true - visible, false - invisible
      Since:
      Marvin 5.7, 09/08/2011
    • getDownWedge

      public String getDownWedge()
      Gets the down wedge orientation.
      Returns:
      the down wedge orientation
      Since:
      Marvin 5.7, 09/08/2011
    • setDownWedge

      public void setDownWedge(String orientation)
      Set the down wedge orientation.
      Parameters:
      orientation - the down wedge orientation
      Since:
      Marvin 5.7, 09/08/2011
    • setBondLength

      public void setBondLength(double bondLength)
      Sets the bond length in pt.
      Parameters:
      bondLength - the required bond length in pt.
    • getBondLength

      public double getBondLength()
      Returns the actual bond length in pt.
    • setBoldBondWidth

      public void setBoldBondWidth(double width)
      Sets the bold bond with.
    • setMarginInPt

      public void setMarginInPt(double marginPt)
      Sets the Margin of the painted molecule.
    • setStereoFontRatio

      public void setStereoFontRatio(float stereoFontRatio)
      Sets the ratio of the font size of the stereo label compared to the normal atom label size. Its value must be between 1.0 and 0.1. The default value is 1/1.3
    • getStereoFontRatio

      public float getStereoFontRatio()
      Returns the current ratio of the font size of the stereo label compared to the normal atom label size.
    • setSgroupDataFormatted

      public void setSgroupDataFormatted(boolean isFormatted)
      Sets if the Sgroup data to be formatted. The default value is true
    • isSgroupDataFormatted

      public boolean isSgroupDataFormatted()
      Returns whether the Sgroup data is formatted.