Package chemaxon.marvin
Class MolPrinter
java.lang.Object
chemaxon.marvin.MolPrinter
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 Summary
ConstructorsConstructorDescriptionConstructs a molecule renderer for an empty molecule.Constructs a molecule renderer for the specified document.Constructs a molecule renderer for the specified molecule. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the attachment points visibility.Gets the any bond style.intReturns atom numbering type.doubleDeprecated, for removal: This API element is subject to removal in a future version.doubleReturns the atom size in units of regular bond length.Returns the current background color.doubleGets the ball radius for "ball and stick" mode.doubleReturns the bond hash spacing that is the distance hashes in a hashed bond.doubleReturns the actual bond length in pt.doubleReturns the double bond spacing that is the distance of the two lines representing a double bond.doubleDeprecated, for removal: This API element is subject to removal in a future version.as of Marvin 4.1, replaced bygetBondSpacing()getBoundingRectangle(MoleculeGraph[] mols) Returns the bounding rectangle of the specified molecules using the current scale factor.Returns the visibility style of the C labels on Carbon atoms.Gets the charge's font.doubleDeprecated, for removal: This API element is subject to removal in a future version.intReturns the current chirality display mode.Returns the current color scheme.Gets the coordinate bond line style when both atoms are single.Gets the coordinate bond line style.intDeprecated, for removal: This API element is subject to removal in a future version.since Marvin 6.4 only high quality existsintReturns the actual display options.intReturns the actual extended display options.Gets the down wedge orientation.Returns the display method of implicit hydrogens.Gets the ligand order visibility setting.Returns the rendering style of atoms and bonds.doublegetScale()Returns the scale factor in units of regular bond length.floatReturns the current ratio of the font size of the stereo label compared to the normal atom label size.doubleGets the 3D stick's diameter.doubleGets the line thickness for wireframe mode.booleanIs 'Absolute' label visible?.booleanIs peptide bridge coloring enabled?booleanReturns true if atom mapping is visible.booleanDeprecated, for removal: This API element is subject to removal in a future version.in 6.2.0.booleanGet the atom properties visibilitybooleanReturns the atom symbol visibility of 3D mode.booleanReturn whether the bond length is visible or not.booleanGet the visibility of Charge with CirclebooleanDeprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.5.1 this method always returns true.booleanReturns the visibility state of absolute double bond stereo configuration labels.booleanDeprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.2, replaced byisEZLabelsVisible()booleanReturn whether the graph invariant is visible or not.booleanGets the bond's ligand error visibilitybooleanGet the visibility of Lone Pairs: dots/linebooleanReturns the state of the automatic calculation of lone pairs.booleanReturns the visibility state of lone pairs.booleanReturns the visibility state of M/P labels.booleanDecides whether the Peptide display settings set to one letter.booleanDecides whether the R-group definitions are visible.booleanIs R-logic visible?.booleanReturns true if atoms and bonds are colored according to the color of the pre-defined set they belong to.booleanReturns whether the Sgroup data is formatted.booleanDecides whether the Peptide display settings set to three letter.booleanReturns the transparency state of the painting.booleanReturns the visibility state of valence errors.booleanGets the atom valence property visibilitydoubleCalculates the maximum scaling factor for fitting the image in a rectangle of the specified size.doubleCalculates the maximum scaling factor for fitting the image in the specified rectangle.voidmolToScreenCoords(DPoint3 molcoords, Point2D scrcoords) Converts molecular coordinates to 2D screen coordinates.voidpaint(Graphics2D g, Dimension d) Paints the molecule on the specified graphics context in the given size.voidpaint(Graphics2D g, Rectangle r) Paints the molecule into the center of the specified rectangle.voidPaints the molecule into the center of the specified rectangle.voidsetAbsoluteLabelsVisible(boolean v) Set 'Absolute' label visibility.voidsetAminoAcidBondColoringEnabled(boolean v) Sets peptide bridge coloring enabled.voidSets the any bond style.voidsetAtomMappingVisible(boolean v) Sets the atom mapping visibility.voidsetAtomNumberingType(int t) sets atom numbering type.voidsetAtomNumbersVisible(boolean v) Deprecated, for removal: This API element is subject to removal in a future version.in 6.2.0.voidsetAtomPropertiesVisible(boolean v) Set the atom properties visibilityvoidsetAtomsize(double l) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.2, replaced bysetAtomSize(double).voidsetAtomSize(double s) Sets the size of displayed atoms in units of regular bond length.voidsetAtomSymbolsVisible(boolean v) Sets atom symbol visibility in 3D mode.voidsetAttachmentPointsVisible(boolean v) Sets the attachment points visibility.voidsetBackgroundColor(Color color) Sets the background color.voidsetBallRadius(double r) Sets the ball radius for "ball and stick" mode.voidsetBoldBondWidth(double width) Sets the bold bond with.voidsetBondHashSpacing(double s) Sets the bond hash spacing that is the distance the hashes in a hashed bond.voidsetBondLength(double bondLength) Sets the bond length in pt.voidsetBondLengthVisible(boolean v) Sets the bond length visibilityvoidsetBondSpacing(double s) Sets the double bond spacing that is the distance of the two lines representing a double bond.voidsetBondWidth(double w) Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 4.1, replaced bysetBondSpacing(double)voidSets the visibility style of the C labels on Carbon atoms.voidDeprecated, for removal: This API element is subject to removal in a future version.in Marvin 15.5.18voidsetChargeWithCircle(boolean v) Sets the visibility of Charge with CirclevoidsetChiralitySupport(int l) Sets the chirality display mode.voidSets the color scheme.voidSet the coordinate bond line style when both atoms are single.voidSet the coordinate bond line style.voidsetDisplayQuality(int q) Deprecated, for removal: This API element is subject to removal in a future version.since Marvin 6.4 only high quality existsvoidsetDispopts(int f) Modifies the display options in the advanced way of handling display options.voidsetDispopts(int f, int mask) Modifies the display options as insetDispopts(int), but affects only limited display options using a mask.voidsetDispoptsExt(int f) Modifies the extended display options in the advanced way of handling display options.voidsetDispoptsExt(int f, int mask) Modifies the extended display options as insetDispoptsExt(int), but affects only limited display options using a mask.voidSets the current document and calculates its bounds.voidsetDownWedge(String orientation) Set the down wedge orientation.voidsetExplicitH(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.voidsetExplicitHVisible(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.voidsetEZLabelsVisible(boolean v) Sets the visibility state of absolute double bond stereo configuration labels.voidsetEzVisible(boolean v) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.2, replaced bysetEZLabelsVisible(boolean)voidsetGraphInvariantVisible(boolean v) Sets the graph invariant visibilityvoidSets the display method of implicit hydrogens.voidsetLigandErrorVisible(boolean v) Sets the bond's ligand error visibilityvoidSets the ligand order visibility.voidsetLonePairAsLine(boolean v) Sets the visibility of Lone PairsvoidsetLonePairsAutoCalculated(boolean v) Sets the state of the automatic calculation of lone pairs.voidsetLonePairsVisible(boolean v) Sets the visibility state of lone pairs.voidsetMarginInPt(double marginPt) Sets the Margin of the painted molecule.voidSets the current molecule and calculate its bounds.voidSets the current molecule and calculate its bounds.voidvoidsetMPLabelsVisible(boolean v) Sets the visibility state of M/P labels.voidsetPeptideDisplay(String type) Sets the Peptide display settings.voidSets the rendering style of atoms and bonds.voidsetRgroupsVisible(boolean v) Sets whether the R-group definitions are visible.voidsetRLogicVisible(boolean v) Set R-logic visibility.voidsetScale(double m) Sets the scale factor in units of regular bond length.voidsetSetColoringEnabled(boolean v) Colors atoms and bonds according to the color of the pre-defined set they belong to.voidsetSgroupDataFormatted(boolean isFormatted) Sets if the Sgroup data to be formatted.voidsetStereoFontRatio(float stereoFontRatio) Sets the ratio of the font size of the stereo label compared to the normal atom label size.voidsetStickThickness(double w) Sets the 3D stick's diameter.voidsetTransparent(boolean transparency) Sets the transparency state of the painting.voidsetValenceErrorVisible(boolean b) Sets the visibility state of valence errors.voidsetValencePropertyVisible(boolean v) Sets the atom valence propertiy visibilityvoidsetWireThickness(double w) Sets the line thickness for wireframe mode.
-
Constructor Details
-
MolPrinter
public MolPrinter()Constructs a molecule renderer for an empty molecule. -
MolPrinter
Constructs a molecule renderer for the specified molecule.- Parameters:
m- a molecule graph- Since:
- Marvin 4.1.8, 04/20/2007
-
MolPrinter
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() invalid input: '&' DispOptConsts.EXPLICITH_FLAG) != 0;
2.boolean explicitHVisible = molPrinter.isExplicitHVisible();- Returns:
- display options
- Since:
- Marvin 2.6
- See Also:
-
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:
-
setDispopts
public void setDispopts(int f, int mask) Modifies the display options as insetDispopts(int), but affects only limited display options using a mask.- Parameters:
f- display optionsmask- the bits of the mask determine the specific display options to set- Since:
- Marvin 4.1.9, 06/05/2007
- See Also:
-
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:
-
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 insetDispoptsExt(int), but affects only limited display options using a mask.- Parameters:
f- display optionsmask- 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
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
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
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 inpaint(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, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.2, replaced bygetAtomSize().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, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.2, replaced bysetAtomSize(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
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
Sets the any bond style.- Parameters:
s- the style
-
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
Gets the charge's font.- Returns:
- the font
- Since:
- Marvin 5.12
-
setChargeFont
Deprecated, for removal: This API element is subject to removal in a future version.in Marvin 15.5.18Sets the circled charge's font.- Parameters:
f- the font- Since:
- Marvin 5.12
-
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
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:
- Not displayed:
-
setImplicitH
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:
- Not displayed:
-
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:
- Displays all atoms with the default drawing color:
-
setColorScheme
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:
- Displays all atoms with the default drawing color:
-
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
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
Sets the rendering style of atoms and bonds.- Parameters:
s- the rendering style as a string representation of an enum value of typeRenderingStyle.- Since:
- Marvin 2.9.11
-
getBackgroundColor
Returns the current background color.- Returns:
- the background color
- Since:
- Marvin 5.2.2
-
setBackgroundColor
Sets the background color.- Parameters:
color- the desired bakcgroundColor- 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.- Always show atom chirality (R/S) and highlight possible chiral centers as well:
StereoConstants.CHIRALITYSUPPORT_ALL_POSSIBLE - Always show atom chirality (R/S):
StereoConstants.CHIRALITYSUPPORT_ALL - Do not show atom chirality (R/S):
StereoConstants.CHIRALITYSUPPORT_NONE
- Returns:
- the chirality display mode as
int - Since:
- Marvin 3.3.3
- Always show atom chirality (R/S) and highlight possible chiral centers as well:
-
setChiralitySupport
public void setChiralitySupport(int l) Sets the chirality display mode.- Always show atom chirality (R/S) and highlight possible chiral centers as well:
StereoConstants.CHIRALITYSUPPORT_ALL_POSSIBLE - Always show atom chirality (R/S):
StereoConstants.CHIRALITYSUPPORT_ALL - Do not show atom chirality (R/S):
StereoConstants.CHIRALITYSUPPORT_NONE
- Parameters:
l- the desired chirality display mode- Since:
- Marvin 3.3.3
- Always show atom chirality (R/S) and highlight possible chiral centers as well:
-
isEzVisible
Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 5.2.2, replaced byisEZLabelsVisible()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 bysetEZLabelsVisible(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 thesetLonePairsAutoCalculated(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
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
- Returns:
- the style
- Since:
- Marvin 5.2.5
- Always:
-
setCarbonVisibility
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
- Parameters:
s- the style- Since:
- Marvin 5.2.5
- Always:
-
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
Gets the ligand order visibility setting.- Returns:
- the ligand order visibility setting
- Since:
- Marvin 5.5
- See Also:
-
setLigandOrderVisibility
Sets the ligand order visibility.- Parameters:
s- the ligand order visibility to set- Since:
- Marvin 5.5
- See Also:
-
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
Gets the coordinate bond line style when both atoms are single.- Returns:
- the coordinative bond line style "solid"/"arrow"
-
setCoordinateBondStyle
Set the coordinate bond line style when both atoms are single.- Parameters:
s- "solid"/"arrow"
-
getCoordinateBondStyleAtMulticenter
Gets the coordinate bond line style.- Returns:
- the coordinate bond line style "solid"/"hashed"
-
setCoordinateBondStyleAtMulticenter
Set the coordinate bond line style.- Parameters:
s- "solid"/"hashed"
-
setMol
Sets the current molecule and calculate its bounds.- Parameters:
m- the molecule
-
setMolTemplate
-
setMol
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
Sets the current document and calculates its bounds.- Parameters:
d- the document- Since:
- Marvin 4.1.8, 04/20/2007
-
paint
Paints the molecule into the center of the specified rectangle.- Parameters:
g- the graphics context to paint onr- the rectangle in which the molecule is painted
-
paint
Paints the molecule into the center of the specified rectangle.- Parameters:
g- the graphics context to paint onr- the rectangle in which the molecule is painted- Since:
- Marvin 5.2.2 04/15/2009
-
paint
Paints the molecule on the specified graphics context in the given size.- Parameters:
g- the graphics context to paint ond- the dimension of the painted molecule- Since:
- Marvin 5.3 12/01/2009
-
getBondWidth
Deprecated, for removal: This API element is subject to removal in a future version.as of Marvin 4.1, replaced bygetBondSpacing()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, for removal: This API element is subject to removal in a future version.as of Marvin 4.1, replaced bysetBondSpacing(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
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, for removal: This API element is subject to removal in a future version.since Marvin 6.4 only high quality existsGets 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 existsSets 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
Gets the down wedge orientation.- Returns:
- the down wedge orientation
- Since:
- Marvin 5.7, 09/08/2011
-
setDownWedge
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.
-
getAtomSize().