chemaxon.marvin
Class MolPrinter

java.lang.Object
  extended by chemaxon.marvin.MolPrinter

public class MolPrinter
extends java.lang.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"));
    }
}

Version:
5.2.6, 09/13/2009
Author:
Peter Csizmadia, Tamas Vertse

Constructor Summary
MolPrinter()
          Constructs a molecule renderer for an empty molecule.
MolPrinter(MDocument d)
          Constructs a molecule renderer for the specified document.
MolPrinter(MoleculeGraph m)
          Constructs a molecule renderer for the specified molecule.
 
Method Summary
 java.lang.String getAnyBondStyles()
          Gets the any bond style.
 double getAtomsize()
          Deprecated. As of Marvin 5.2.2, replaced by getAtomSize().
 double getAtomSize()
          Returns the atom size in units of regular bond length.
 java.awt.Color getBackgroundColor()
          Returns the current background color.
 double getBallRadius()
          Gets the ball radius for "ball and stick" mode.
 double getBondSpacing()
          Returns the double bond spacing that is the distance of the two lines representing a double bond.
 double getBondWidth()
          Deprecated. as of Marvin 4.1, replaced by getBondSpacing()
 java.awt.Rectangle getBoundingRectangle(MoleculeGraph[] mols)
          Returns the bounding rectangle of the specified molecules using the current scale factor.
 java.lang.String getCarbonVisibility()
          Returns the visibility style of the C labels on Carbon atoms.
 int getChiralitySupport()
          Returns the current chirality display mode.
 java.lang.String getColorScheme()
          Returns the current color scheme.
 java.lang.String getCoordinateBondStyle()
          Gets the coordinate bond line style when both atoms are single.
 java.lang.String getCoordinateBondStyleAtMulticenter()
          Gets the coordinate bond line style.
 int getDisplayQuality()
          Gets the display quality.
 int getDispopts()
          Returns the actual display options.
 int getDispoptsExt()
          Returns the actual extended display options.
 java.lang.String getDownWedge()
          Gets the down wedge orientation.
 java.lang.String getImplicitH()
          Returns the display method of implicit hydrogens.
 java.lang.String getLigandOrderVisibility()
          Gets the ligand order visibility setting.
 java.lang.String getRendering()
          Returns the rendering style of atoms and bonds.
 double getScale()
          Returns the scale factor in units of regular bond length.
 double getStickThickness()
          Gets the 3D stick's diameter.
 double getWireThickness()
          Gets the line thickness for wireframe mode.
 boolean isAbsoluteLabelsVisible()
          Is 'Absolute' label visible?.
 boolean isAtomMappingVisible()
          Returns true if atom mapping is visible.
 boolean isAtomNumbersVisible()
          Returns true if atom numbers are visible.
 boolean isAtomPropertiesVisible()
          Get the atom properties visibility
 boolean isAtomSymbolsVisible()
          Returns the atom symbol visibility of 3D mode.
 boolean isBondLengthVisible()
          Return whether the bond length is visible or not.
 boolean isChargeWithCircle()
          Get the visibility of Charge with Circle
 boolean isExplicitHVisible()
          Deprecated. As of Marvin 5.5.1 this method always returns true. This method will be removed in a future release.
 boolean isEZLabelsVisible()
          Returns the visibility state of absolute double bond stereo configuration labels.
 boolean isEzVisible()
          Deprecated. As of Marvin 5.2.2, replaced by isEZLabelsVisible()
 boolean isGraphInvariantVisible()
          Return whether the graph invariant is visible or not.
 boolean isLigandErrorVisible()
          Gets the bond's ligand error visibility
 boolean isLonePairAsLine()
          Get the visibility of Lone Pairs: dots/line
 boolean isLonePairsAutoCalculated()
          Returns the state of the automatic calculation of lone pairs.
 boolean isLonePairsVisible()
          Returns the visibility state of lone pairs.
 boolean isOneLetterPeptideDisplay()
          Decides whether the Peptide display settings set to one letter.
 boolean isRgroupsVisible()
          Decides whether the R-group definitions are visible.
 boolean isRLogicVisible()
          Is R-logic visible?.
 boolean isSetColoringEnabled()
          Returns true if atoms and bonds are colored according to the color of the pre-defined set they belong to.
 boolean isThreeLetterPeptideDisplay()
          Decides whether the Peptide display settings set to three letter.
 boolean isTransparent()
          Returns the transparency state of the painting.
 boolean isValenceErrorvisible()
          Returns the visibility state of valence errors.
 boolean isValencePropertyVisible()
          Gets the atom valence property visibility
 double maxScale(java.awt.Dimension d)
          Calculates the maximum scaling factor for fitting the image in a rectangle of the specified size.
 double maxScale(java.awt.Rectangle r)
          Calculates the maximum scaling factor for fitting the image in the specified rectangle.
 void molToScreenCoords(DPoint3 molcoords, java.awt.geom.Point2D scrcoords)
          Converts molecular coordinates to 2D screen coordinates.
 void paint(java.awt.Graphics2D g, java.awt.Dimension d)
          Paints the molecule on the specified graphics context in the given size.
 void paint(java.awt.Graphics2D g, java.awt.Rectangle r)
          Paints the molecule into the center of the specified rectangle.
 void paint(java.awt.Graphics g, java.awt.Rectangle r)
          Paints the molecule into the center of the specified rectangle.
 void setAbsoluteLabelsVisible(boolean v)
          Set 'Absolute' label visibility.
 void setAnyBondStyles(java.lang.String s)
          Sets the any bond style.
 void setAtomMappingVisible(boolean v)
          Sets the atom mapping visibility.
 void setAtomNumbersVisible(boolean v)
          Sets the atom number visibility.
 void setAtomPropertiesVisible(boolean v)
          Set the atom properties visibility
 void setAtomsize(double l)
          Deprecated. As of Marvin 5.2.2, replaced by setAtomSize(double).
 void setAtomSize(double s)
          Sets the size of displayed atoms in units of regular bond length.
 void setAtomSymbolsVisible(boolean v)
          Sets atom symbol visibility in 3D mode.
 void setBackgroundColor(java.awt.Color color)
          Sets the background color.
 void setBallRadius(double r)
          Sets the ball radius for "ball and stick" mode.
 void setBondLengthVisible(boolean v)
          Sets the bond length visibility
 void setBondSpacing(double s)
          Sets the double bond spacing that is the distance of the two lines representing a double bond.
 void setBondWidth(double w)
          Deprecated. as of Marvin 4.1, replaced by setBondSpacing(double)
 void setCarbonVisibility(java.lang.String s)
          Sets the visibility style of the C labels on Carbon atoms.
 void setChargeWithCircle(boolean v)
          Sets the visibility of Charge with Circle
 void setChiralitySupport(int l)
          Sets the chirality display mode.
 void setColorScheme(java.lang.String s)
          Sets the color scheme.
 void setCoordinateBondStyle(java.lang.String s)
          Set the coordinate bond line style when both atoms are single.
 void setCoordinateBondStyleAtMulticenter(java.lang.String s)
          Set the coordinate bond line style.
 void setDisplayQuality(int q)
          Sets the display quality.
 void setDispopts(int f)
          Modifies the display options in the advanced way of handling display options.
 void setDispopts(int f, int mask)
          Modifies the display options as in setDispopts(int), but affects only limited display options using a mask.
 void setDispoptsExt(int f)
          Modifies the extended display options in the advanced way of handling display options.
 void setDispoptsExt(int f, int mask)
          Modifies the extended display options as in setDispoptsExt(int), but affects only limited display options using a mask.
 void setDoc(MDocument d)
          Sets the current document and calculates its bounds.
 void setDownWedge(java.lang.String orientation)
          Set the down wedge orientation.
 void setExplicitH(boolean show)
          Deprecated. As of Marvin 5.5.1 this method does nothing. This method will be removed in a future release.
 void setExplicitHVisible(boolean b)
          Deprecated. As of Marvin 5.5.1 this method does nothing. This method will be removed in a future release.
 void setEZLabelsVisible(boolean v)
          Sets the visibility state of absolute double bond stereo configuration labels.
 void setEzVisible(boolean v)
          Deprecated. As of Marvin 5.2.2, replaced by setEZLabelsVisible(boolean)
 void setGraphInvariantVisible(boolean v)
          Sets the graph invariant visibility
 void setImplicitH(java.lang.String s)
          Sets the display method of implicit hydrogens.
 void setLigandErrorVisible(boolean v)
          Sets the bond's ligand error visibility
 void setLigandOrderVisibility(java.lang.String s)
          Sets the ligand order visibility.
 void setLonePairAsLine(boolean v)
          Sets the visibility of Lone Pairs
 void setLonePairsAutoCalculated(boolean v)
          Sets the state of the automatic calculation of lone pairs.
 void setLonePairsVisible(boolean v)
          Sets the visibility state of lone pairs.
 void setMol(Molecule m)
          Sets the current molecule and calculate its bounds.
 void setMol(java.lang.String s)
          Sets the current molecule and calculate its bounds.
 void setMolTemplate(Molecule m)
           
 void setPeptideDisplay(java.lang.String type)
          Sets the Peptide display settings.
 void setRendering(java.lang.String s)
          Sets the rendering style of atoms and bonds.
 void setRgroupsVisible(boolean v)
          Sets whether the R-group definitions are visible.
 void setRLogicVisible(boolean v)
          Set R-logic visibility.
 void setScale(double m)
          Sets the scale factor in units of regular bond length.
 void setSetColoringEnabled(boolean v)
          Colors atoms and bonds according to the color of the pre-defined set they belong to.
 void setStickThickness(double w)
          Sets the 3D stick's diameter.
 void setTransparent(boolean transparency)
          Sets the transparency state of the painting.
 void setValenceErrorVisible(boolean b)
          Sets the visibility state of valence errors.
 void setValencePropertyVisible(boolean v)
          Sets the atom valence propertiy visibility
 void setWireThickness(double w)
          Sets the line thickness for wireframe mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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:
setLigandOrderVisibility(String), setAtomPropertiesVisible(boolean), setLigandOrderVisibility(String), setValencePropertyVisible(boolean), DispOptConsts, getDispoptsExt()

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:
DispOptConsts, getDispoptsExt()

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(java.awt.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(java.awt.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 java.awt.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

public double getAtomsize()
Deprecated. 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

public void setAtomsize(double l)
Deprecated. 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

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

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(java.lang.String type)
Sets the Peptide display settings.

Parameters:
s - "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(java.lang.String s)
Sets the any bond style.

Parameters:
s - the style

getAnyBondStyles

public java.lang.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


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

getImplicitH

public java.lang.String getImplicitH()
Returns the display method of implicit hydrogens.

Returns:
the display method as String
Since:
Marvin 2.9.11
See Also:
DispOptConsts.IMPLICITH_LEVELS

setImplicitH

public void setImplicitH(java.lang.String s)
Sets the display method of implicit hydrogens.

Parameters:
s - the display method as String
Since:
Marvin 2.9.11
See Also:
DispOptConsts.IMPLICITH_LEVELS

getColorScheme

public java.lang.String getColorScheme()
Returns the current color scheme.

Returns:
the color scheme as String
Since:
Marvin 2.9.11
See Also:
DispOptConsts.COLOR_SCHEMES

setColorScheme

public void setColorScheme(java.lang.String s)
Sets the color scheme.

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 java.lang.String getRendering()
Returns the rendering style of atoms and bonds.

Returns:
the rendering style as String
Since:
Marvin 2.9.11
See Also:
DispOptConsts.RENDERING_STYLES

setRendering

public void setRendering(java.lang.String s)
Sets the rendering style of atoms and bonds.

Parameters:
s - the rendering style as String
Since:
Marvin 2.9.11
See Also:
DispOptConsts.RENDERING_STYLES

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the current background color.

Returns:
the background color
Since:
Marvin 5.2.2

setBackgroundColor

public void setBackgroundColor(java.awt.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

public void setAtomNumbersVisible(boolean v)
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

public boolean isAtomNumbersVisible()
Returns true if atom numbers are visible.

Returns:
true if visible, false if not
Since:
Marvin 5.7

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

public boolean isEzVisible()
Deprecated. 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

public void setEzVisible(boolean v)
Deprecated. 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

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 java.lang.String getCarbonVisibility()
Returns the visibility style of the C labels on Carbon atoms. See more information at the MarvinSketch User's Guide

Returns:
the style
Since:
Marvin 5.2.5

setCarbonVisibility

public void setCarbonVisibility(java.lang.String s)
Sets the visibility style of the C labels on Carbon atoms. 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 java.lang.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(java.lang.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

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 java.lang.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(java.lang.String s)
Set the coordinate bond line style when both atoms are single.

Parameters:
s - "solid"/"arrow"

getCoordinateBondStyleAtMulticenter

public java.lang.String getCoordinateBondStyleAtMulticenter()
Gets the coordinate bond line style.

Returns:
the coordinate bond line style "solid"/"hashed"

setCoordinateBondStyleAtMulticenter

public void setCoordinateBondStyleAtMulticenter(java.lang.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(java.lang.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(java.awt.Graphics g,
                  java.awt.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(java.awt.Graphics2D g,
                  java.awt.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(java.awt.Graphics2D g,
                  java.awt.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

public double getBondWidth()
Deprecated. 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

public void setBondWidth(double w)
Deprecated. 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,
                              java.awt.geom.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
public void setExplicitH(boolean show)
Deprecated. 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
public boolean isExplicitHVisible()
Deprecated. 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
public void setExplicitHVisible(boolean b)
Deprecated. 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

public int getDisplayQuality()
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

public void setDisplayQuality(int q)
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 java.lang.String getDownWedge()
Gets the down wedge orientation.

Returns:
the down wedge orientation
Since:
Marvin 5.7, 09/08/2011

setDownWedge

public void setDownWedge(java.lang.String orientation)
Set the down wedge orientation.

Parameters:
orientation - the down wedge orientation
Since:
Marvin 5.7, 09/08/2011