Package chemaxon.marvin
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 Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
areAttachmentPointsVisible()
Gets the attachment points visibility.String
getAnyBondStyles()
Gets the any bond style.int
getAtomNumberingType()
Returns atom numbering type.double
getAtomsize()
Deprecated.As of Marvin 5.2.2, replaced bygetAtomSize()
.double
getAtomSize()
Returns the atom size in units of regular bond length.Color
getBackgroundColor()
Returns the current background color.double
getBallRadius()
Gets the ball radius for "ball and stick" mode.double
getBondHashSpacing()
Returns the bond hash spacing that is the distance hashes in a hashed bond.double
getBondLength()
Returns the actual bond length in pt.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 bygetBondSpacing()
Rectangle
getBoundingRectangle(MoleculeGraph[] mols)
Returns the bounding rectangle of the specified molecules using the current scale factor.String
getCarbonVisibility()
Returns the visibility style of the C labels on Carbon atoms.Font
getChargeFont()
Gets the charge's font.double
getChargeFontSize()
Gets the circled charge's font's size.int
getChiralitySupport()
Returns the current chirality display mode.String
getColorScheme()
Returns the current color scheme.String
getCoordinateBondStyle()
Gets the coordinate bond line style when both atoms are single.String
getCoordinateBondStyleAtMulticenter()
Gets the coordinate bond line style.int
getDisplayQuality()
Deprecated.since Marvin 6.4 only high quality existsint
getDispopts()
Returns the actual display options.int
getDispoptsExt()
Returns the actual extended display options.String
getDownWedge()
Gets the down wedge orientation.String
getImplicitH()
Returns the display method of implicit hydrogens.String
getLigandOrderVisibility()
Gets the ligand order visibility setting.String
getRendering()
Returns the rendering style of atoms and bonds.double
getScale()
Returns the scale factor in units of regular bond length.float
getStereoFontRatio()
Returns the current ratio of the font size of the stereo label compared to the normal atom label size.double
getStickThickness()
Gets the 3D stick's diameter.double
getWireThickness()
Gets the line thickness for wireframe mode.boolean
isAbsoluteLabelsVisible()
Is 'Absolute' label visible?.boolean
isAminoAcidBondColoringEnabled()
Is peptide bridge coloring enabled?boolean
isAtomMappingVisible()
Returns true if atom mapping is visible.boolean
isAtomNumbersVisible()
Deprecated.in 6.2.0.boolean
isAtomPropertiesVisible()
Get the atom properties visibilityboolean
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 Circleboolean
isExplicitHVisible()
Deprecated.As of Marvin 5.5.1 this method always returns true.boolean
isEZLabelsVisible()
Returns the visibility state of absolute double bond stereo configuration labels.boolean
isEzVisible()
Deprecated.As of Marvin 5.2.2, replaced byisEZLabelsVisible()
boolean
isGraphInvariantVisible()
Return whether the graph invariant is visible or not.boolean
isLigandErrorVisible()
Gets the bond's ligand error visibilityboolean
isLonePairAsLine()
Get the visibility of Lone Pairs: dots/lineboolean
isLonePairsAutoCalculated()
Returns the state of the automatic calculation of lone pairs.boolean
isLonePairsVisible()
Returns the visibility state of lone pairs.boolean
isMPLabelsVisible()
Returns the visibility state of M/P labels.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
isSgroupDataFormatted()
Returns whether the Sgroup data is formatted.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 visibilitydouble
maxScale(Dimension d)
Calculates the maximum scaling factor for fitting the image in a rectangle of the specified size.double
maxScale(Rectangle r)
Calculates the maximum scaling factor for fitting the image in the specified rectangle.void
molToScreenCoords(DPoint3 molcoords, Point2D scrcoords)
Converts molecular coordinates to 2D screen coordinates.void
paint(Graphics2D g, Dimension d)
Paints the molecule on the specified graphics context in the given size.void
paint(Graphics2D g, Rectangle r)
Paints the molecule into the center of the specified rectangle.void
paint(Graphics g, Rectangle r)
Paints the molecule into the center of the specified rectangle.void
setAbsoluteLabelsVisible(boolean v)
Set 'Absolute' label visibility.void
setAminoAcidBondColoringEnabled(boolean v)
Sets peptide bridge coloring enabled.void
setAnyBondStyles(String s)
Sets the any bond style.void
setAtomMappingVisible(boolean v)
Sets the atom mapping visibility.void
setAtomNumberingType(int t)
sets atom numbering type.void
setAtomNumbersVisible(boolean v)
Deprecated.in 6.2.0.void
setAtomPropertiesVisible(boolean v)
Set the atom properties visibilityvoid
setAtomsize(double l)
Deprecated.As of Marvin 5.2.2, replaced bysetAtomSize(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
setAttachmentPointsVisible(boolean v)
Sets the attachment points visibility.void
setBackgroundColor(Color color)
Sets the background color.void
setBallRadius(double r)
Sets the ball radius for "ball and stick" mode.void
setBoldBondWidth(double width)
Sets the bold bond with.void
setBondHashSpacing(double s)
Sets the bond hash spacing that is the distance the hashes in a hashed bond.void
setBondLength(double bondLength)
Sets the bond length in pt.void
setBondLengthVisible(boolean v)
Sets the bond length visibilityvoid
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 bysetBondSpacing(double)
void
setCarbonVisibility(String s)
Sets the visibility style of the C labels on Carbon atoms.void
setChargeFont(Font f)
Deprecated.in Marvin 15.5.18void
setChargeWithCircle(boolean v)
Sets the visibility of Charge with Circlevoid
setChiralitySupport(int l)
Sets the chirality display mode.void
setColorScheme(String s)
Sets the color scheme.void
setCoordinateBondStyle(String s)
Set the coordinate bond line style when both atoms are single.void
setCoordinateBondStyleAtMulticenter(String s)
Set the coordinate bond line style.void
setDisplayQuality(int q)
Deprecated.since Marvin 6.4 only high quality existsvoid
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 insetDispopts(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 insetDispoptsExt(int)
, but affects only limited display options using a mask.void
setDoc(MDocument d)
Sets the current document and calculates its bounds.void
setDownWedge(String orientation)
Set the down wedge orientation.void
setExplicitH(boolean show)
Deprecated.As of Marvin 5.5.1 this method does nothing.void
setExplicitHVisible(boolean b)
Deprecated.As of Marvin 5.5.1 this method does nothing.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 bysetEZLabelsVisible(boolean)
void
setGraphInvariantVisible(boolean v)
Sets the graph invariant visibilityvoid
setImplicitH(String s)
Sets the display method of implicit hydrogens.void
setLigandErrorVisible(boolean v)
Sets the bond's ligand error visibilityvoid
setLigandOrderVisibility(String s)
Sets the ligand order visibility.void
setLonePairAsLine(boolean v)
Sets the visibility of Lone Pairsvoid
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
setMarginInPt(double marginPt)
Sets the Margin of the painted molecule.void
setMol(Molecule m)
Sets the current molecule and calculate its bounds.void
setMol(String s)
Sets the current molecule and calculate its bounds.void
setMolTemplate(Molecule m)
void
setMPLabelsVisible(boolean v)
Sets the visibility state of M/P labels.void
setPeptideDisplay(String type)
Sets the Peptide display settings.void
setRendering(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
setSgroupDataFormatted(boolean isFormatted)
Sets if the Sgroup data to be formatted.void
setStereoFontRatio(float stereoFontRatio)
Sets the ratio of the font size of the stereo label compared to the normal atom label size.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 visibilityvoid
setWireThickness(double w)
Sets the line thickness for wireframe mode.
-
-
-
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 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:
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 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:
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(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 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 public double getAtomsize()
Deprecated.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 public void setAtomsize(double l)
Deprecated.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
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 public void setChargeFont(Font f)
Deprecated.in Marvin 15.5.18Sets the circled charge's font.- Parameters:
f
- the font- Since:
- Marvin 5.12
-
getChargeFontSize
public double getChargeFontSize()
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 hetero atoms:
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
- Not displayed:
-
setImplicitH
public void setImplicitH(String s)
Sets the display method of implicit hydrogens.- Not displayed:
IMPLICITH_OFF_S
- Displayed on hetero atoms:
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
- Not displayed:
-
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
- Displays all atoms with the default drawing color:
-
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
- 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
public String getRendering()
Returns the rendering style of atoms and bonds.- Displays bonds as thin lines, and atoms (except Carbon) as symbols:
WIREFRAME_RENDERING_S
- Displays bonds as thin lines, Carbon atoms as knobs, and other atoms as symbols:
- Displays bonds as thick lines, and atoms (except Carbon) as symbols:
STICKS_RENDERING_S
- Displays bonds as thick lines, atoms as shaded balls, and atoms (except Carbon and
Hydrogen) as symbols on balls:
BALLSTICK_RENDERING_S
- Displays atoms as large shaded balls, and atoms (except Carbon and Hydrogen) as symbols
on the balls:
SPACEFILL_RENDERING_S
- Returns:
- the rendering style as String
- Since:
- Marvin 2.9.11
- See Also:
DispOptConsts.RENDERING_STYLES
- Displays bonds as thin lines, and atoms (except Carbon) as symbols:
-
setRendering
public void setRendering(String s)
Sets the rendering style of atoms and bonds.- Displays bonds as thin lines, and atoms (except Carbon) as symbols:
WIREFRAME_RENDERING_S
- Displays bonds as thin lines, Carbon atoms as knobs, and other atoms as symbols:
- Displays bonds as thick lines, and atoms (except Carbon) as symbols:
STICKS_RENDERING_S
- Displays bonds as thick lines, atoms as shaded balls, and atoms (except Carbon and
Hydrogen) as symbols on balls:
BALLSTICK_RENDERING_S
- Displays atoms as large shaded balls, and atoms (except Carbon and Hydrogen) as symbols
on the balls:
SPACEFILL_RENDERING_S
- Parameters:
s
- the rendering style as String- Since:
- Marvin 2.9.11
- See Also:
DispOptConsts.RENDERING_STYLES
- Displays bonds as thin lines, and atoms (except Carbon) as symbols:
-
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 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 public void setAtomNumbersVisible(boolean v)
Deprecated.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 public boolean isAtomNumbersVisible()
Deprecated.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
- Show atom chirality if chiral flag is set for the molecule or the atom's enhanced stereo
type is absolute:
StereoConstants.CHIRALITYSUPPORT_SELECTED
- 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
- Show atom chirality if chiral flag is set for the molecule or the atom's enhanced stereo
type is absolute:
StereoConstants.CHIRALITYSUPPORT_SELECTED
- 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 public boolean isEzVisible()
Deprecated.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 public void setEzVisible(boolean v)
Deprecated.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
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
- Returns:
- the style
- Since:
- Marvin 5.2.5
- Always:
-
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
- 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
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.- Returns:
-
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 onr
- 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 onr
- 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 ond
- the dimension of the painted molecule- Since:
- Marvin 5.3 12/01/2009
-
getBondWidth
@Deprecated public double getBondWidth()
Deprecated.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 public void setBondWidth(double w)
Deprecated.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
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 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
@Deprecated public int getDisplayQuality()
Deprecated.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 public void setDisplayQuality(int q)
Deprecated.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
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.- Parameters:
width
-
-
setMarginInPt
public void setMarginInPt(double marginPt)
Sets the Margin of the painted molecule.- Parameters:
marginPt
-
-
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- Parameters:
stereoFontRatio
-
-
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- Parameters:
isFormatted
-
-
isSgroupDataFormatted
public boolean isSgroupDataFormatted()
Returns whether the Sgroup data is formatted.
-
-