Package chemaxon.struc
Class MDocument
- java.lang.Object
-
- chemaxon.struc.MDocument
-
- All Implemented Interfaces:
chemaxon.core.structure.DocumentForBuilder
,MTransformable
,Serializable
- Direct Known Subclasses:
MSelectionDocument
@PublicAPI public class MDocument extends Object implements MTransformable, Serializable, chemaxon.core.structure.DocumentForBuilder
Marvin document. Stores molecules and graphics objects. There are two main groups of graphic objects. One of them contains simple objects without chemical meaning, these are stored directly in this document. The other group, called extra objects, has chemical meaning and belongs to a chemical structure. Extra object are:- reaction arrow
- S-group bracket
- Since:
- Marvin 3.1.4
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MDocument.CheckerMark
Provides informations for Structure Checker higlightclass
MDocument.Prop
Property that stores an MDocument.
-
Field Summary
Fields Modifier and Type Field Description protected MChemicalStruct
mainMChemicalStruct
protected chemaxon.struc.graphics.MMoleculeMovie
mainMMoleculeMovie
protected MObject
objectContainingSelection
protected List<MObject>
objects
static int
SETCOLOR_COLORLESS
The atom/bond set is colorless, normal (CPK, Monochrome etc.) colors are used.static int
SETCOLOR_DEFAULT
Default set colors are used for coloring the atom/bond set.static int
SETCOLOR_SPECIFIED
The user specified set colors are used for coloring the atom/bond set.protected Map<String,chemaxon.struc.util.MDocumentCloneable>
temporaryObjects
-
Constructor Summary
Constructors Modifier Constructor Description MDocument(MDocument doc)
Copy constructor.protected
MDocument(MDocument doc, boolean cloneobjs)
Copy constructor.MDocument(Molecule[] mols)
Creates a document for the specified molecule animation.MDocument(MoleculeGraph m)
Creates a document for the specified molecule graph.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCheckerMark(MDocument.CheckerMark mark)
Adds a checker mark to the document.void
addObject(MObject o)
Adds an object to the document.DPoint3
calcCenter()
Calculates the geometrical center.DPoint3
calcCenter(CTransform3D t)
Calculates the geometrical center.void
clear()
Clears the document.void
clearCheckerMarks()
Clears the checker marksvoid
clearSets()
Clears the atomSets and the bondSets.Object
clone()
Creates a clone.MDocument
cloneDocument()
Creates a clone.Molecule
cloneMainMolecule()
Creates a clone.MoleculeGraph
cloneMainMoleculeGraph()
Creates a clone.void
cloneSets(MDocument doc)
Clones the atom/bond sets from doc.protected void
cloneTemporraryObjects(MDocument doc)
boolean
contains(MDocument doc)
Tests whether the document contains all objects of another document.boolean
contains(MObject o)
Searches an object in the document.boolean
containsOnlyOne(Class cl)
Tests whether the document contains only one object of the specified class.byte[]
exportToBinFormat(String fmt)
Deprecated.As of release 5.7, replaced byMolExporter.exportToBinFormat(MDocument, String)
.String
exportToFormat(String fmt)
Deprecated.As of release 5.7, replaced byMolExporter.exportToFormat(MDocument, String)
Object
exportToObject(String fmt)
Deprecated.As of release 5.7, replaced byMolExporter.exportToObject(MDocument, String)
static void
fixElectronContainers(MDocument doc, boolean lonePairsAutoCalc, boolean lonePairsVisible)
Removes unnecesarry MElectronContainers from the give MDocument corresponding to lone pair display options, if an electron of a MEFlow arrow has been removed the arrow is removed as well.Molecule[]
getAllMolecules()
Gets an array containing all molecule objects.Molecule[]
getAllNonEmptyMolecules()
Gets an array containing all non-empty molecule objects.List<MObject>
getAllObjects()
Gets all objects stored in this document and from the chemical structure of the document.Color
getAtomSetColor(int seq)
Gets an atom set color.int
getAtomSetColorMode(int seq)
Gets the atom set coloring mode.MFont
getAtomSetFont(int seq)
Gets an atom set font.int
getAtomSetRGB(int seq)
Gets an atom set color.int
getAtomSetSize()
Gets the size of the atom set.Color
getBondSetColor(int seq)
Gets a bond set color.int
getBondSetColorMode(int seq)
Gets the bond set coloring mode.int
getBondSetRGB(int seq)
Gets a bond set color.int
getBondSetSize()
Gets the bond set size.double
getBondSetThickness(int seq)
Gets a bond set thickness.MDocument.CheckerMark[]
getCheckerMarks()
Returns the array of checker marks NOTE: checker marks will be reset on any molecule changeMObject
getConnectedObject(int i)
Gets an object from the document or from the chemical structure of the document.int
getConnectedObjectCount()
Gets the number of objects in this document and in the chemical structure of this document.MObject
getDraggedObject()
Gets the dragged objectint
getElectronCount()
Returns the number of electrons.long
getEndPosition()
Gets the end position of this document in the input file.int
getExplicitLonePairCount()
Returns the number of Lone Pair electrons set by the user.int
getExtraLabelSetColorMode(int seq)
Gets the coloring mode of extra label set sequences.MFont
getExtraLabelSetFont(int seq)
long
getExtraLabelSetRGBs(int seq)
int
getExtraLabelSetSize()
MObject
getFocus()
Gets the focused objectint
getFreeAtomSetIndex()
Returns the first unused atomset index.int
getFreeBondSetIndex()
Returns the first unused bondset index.MPropertyContainer
getGUIPropertyContainer()
String
getInputFormat()
Gets the input file format.int
getLonePairCount()
Returns the number of Lone Pair electrons.MoleculeGraph
getMainMoleculeGraph()
Gets the main molecule graph.MChemicalStruct
getMChemicalStruct()
chemaxon.struc.graphics.MMoleculeMovie
getMoleculeMovie()
Gets the molecule movie.MProp
getMProp()
Gets the document as a property.MObject
getObject(int i)
Gets an object from the document.MObject
getObjectContainingSelection()
Gets the object that contains the selection.int
getObjectCount()
Gets the number of objects in this document.chemaxon.struc.PageSettings
getPageSettings()
Gets the page settings of multipage molecular document.Molecule
getPrimaryMolecule()
Gets the primary molecule object.Molecule[]
getPrimaryMolecules()
Gets an array containing the primary molecule objects.int
getRadicalCount()
Returns the number of Radical electrons.long
getStartPosition()
Gets the starting position of this document in the input file.boolean
hasElectrons()
Returns whether MDocument contains any electrons.boolean
hasExplicitLonePairs()
Returns true if the MDocument has any electrons drawn by the user.boolean
hasRadicals()
Returns true if the MDocument has any Radical Electrons.void
highlight(MObject o)
Highlight an object.int
indexOf(MObject o)
Searches for an object in the document or in the chemical structure that belongs to the document.boolean
isAtomSetColorModeSet()
Decides whether the atomset coloring mode is set.boolean
isEmpty()
Tests whether the document is empty: the main molecule object in the document is empty no graphic object is included (neither simple nor extra)boolean
isExtraObject(MObject o)
Decides whether a graphic object belongs to the main chemical structure of the document.boolean
isHighlighted(MObject o)
Is the specified object currently highlighted?boolean
isSimpleMolecule()
Tests whether the document is equivalent to a simple molecule.void
moveMainMoleculeGraphToFront()
Move the main molecule graph to the top of stack.void
moveMoleculeMovieToFront()
Move the molecule movie (if exists) to the top of stack.void
moveObject(MObject o, int i)
Move an object to another place in the stack.static MDocument
parseMRV(String sval)
Deprecated.As of release 5.7, replaced byMolImporter.parseMRV(String)
MPropertyContainer
properties()
Gets the property container.void
removeAtom(MolAtom a)
Removes an atom from all the chemical graphs and removes all graphics objects that contain its reference.void
removeAtom(MolAtom a, int cleanupFlags)
Removes an atom from all the chemical graphs and removes all graphics objects that contain its reference.void
removeAtomFromGraphs(MolAtom node)
Removes the specified node from all molecule graphs.void
removeColorsFromMolecules()
Removes coloring from all molecular objects in the document.void
removeElectronsOf(MolAtom targetAtom)
Removes the Electron containers belongs to targetAtom,void
removeObject(int i)
Removes an object from the document.void
removeObject(MObject o)
Removes an object from the document or from the chemical structure of the document.void
selectAllConnectedObjects(boolean s)
Selects or unselects all objects in this document and objects that belong to the chemical structure of this document.void
selectAllObjects(boolean s)
Selects or unselects all objects.void
setAtomSetColorMode(int seq, int m)
Sets the atom set coloring mode.void
setAtomSetFont(int seq, MFont font)
Sets the font of an atom set.void
setAtomSetRGB(int seq, int rgb)
Sets the color of an atom set.void
setBondSetColorMode(int seq, int m)
Sets the bond set coloring mode.void
setBondSetRGB(int seq, int rgb)
Sets the color of a bond set.void
setBondSetThickness(int seq, double thickness)
Sets the thickness of a bond set.void
setDraggedObject(MObject o)
Sets the dragged object.void
setEndPosition(long off)
Sets the end position of this document in the input file.void
setExtraLabelColorsForDocument(Molecule mol)
Sets the coloring mode sets and colors of extra labelsvoid
setExtraLabelSetColorMode(int seq, int mode)
void
setExtraLabelSetRGBs(int seq, int rgb)
void
setExtraLabelSetRGBs(int seq, int rgb1, int rgb2)
void
setFocus(MObject o)
Focus to the specified object.void
setGUIPropertyContainer(MPropertyContainer gpc)
Sets the property container storing MarvinPane settingsvoid
setGUIProperyContainer(MPropertyContainer gpc)
Deprecated.As of Marvin 6.1, replaced bysetGUIPropertyContainer(MPropertyContainer)
.void
setInputFormat(String format)
Sets the input file format.void
setMainMoleculeGraph(MoleculeGraph m)
Sets the main molecule graph.void
setMoleculeMovie(chemaxon.struc.graphics.MMoleculeMovie mmm)
Sets the molecule movie.void
setObject(MObject o, int i)
Sets an objectvoid
setObjectContainingSelection(MObject o)
Sets the object that contains the selection.void
setPageSettings(chemaxon.struc.PageSettings pageSettings)
Sets the page settings of multipage molecular document.void
setStartPosition(long off)
Sets the starting position of this document in the input file.void
simplifyMolecule()
Simplifies the main molecule object if possible.String
toString()
Overrides Object.toString() to ease debugging.void
transform(CTransform3D t)
Transforms all object's coordinates.void
transform(CTransform3D t, int opts)
Transforms all object's coordinates.void
transform(CTransform3D t, int opts, CTransform3D trot)
Transforms all object's coordinates.void
transform(CTransform3D t, CTransform3D textBoxT, int opts, CTransform3D trot)
Transforms all object's coordinates.void
unhighlight(MObject o)
Unhighlights an object.void
unhighlightAll()
Unhighlights all objects.
-
-
-
Field Detail
-
SETCOLOR_DEFAULT
public static final int SETCOLOR_DEFAULT
Default set colors are used for coloring the atom/bond set.- Since:
- Marvin 4.1, 05/31/2006
- See Also:
getAtomSetColorMode(int)
,getBondSetColorMode(int)
, Constant Field Values
-
SETCOLOR_SPECIFIED
public static final int SETCOLOR_SPECIFIED
The user specified set colors are used for coloring the atom/bond set.- Since:
- Marvin 4.1, 05/31/2006
- See Also:
getAtomSetColorMode(int)
,getBondSetColorMode(int)
, Constant Field Values
-
SETCOLOR_COLORLESS
public static final int SETCOLOR_COLORLESS
The atom/bond set is colorless, normal (CPK, Monochrome etc.) colors are used.- Since:
- Marvin 4.1, 05/31/2006
- See Also:
getAtomSetColorMode(int)
,getBondSetColorMode(int)
, Constant Field Values
-
mainMChemicalStruct
protected transient MChemicalStruct mainMChemicalStruct
-
mainMMoleculeMovie
protected transient chemaxon.struc.graphics.MMoleculeMovie mainMMoleculeMovie
-
objectContainingSelection
protected transient MObject objectContainingSelection
-
-
Constructor Detail
-
MDocument
public MDocument(MoleculeGraph m)
Creates a document for the specified molecule graph.- Parameters:
m
- the main molecule graph- Throws:
IllegalArgumentException
- if the given molecule has a parent (root, rgroup, component)
-
MDocument
public MDocument(Molecule[] mols)
Creates a document for the specified molecule animation.- Parameters:
mols
- the molecule animation- Since:
- Marvin 4.0, 06/30/2005
-
MDocument
public MDocument(MDocument doc)
Copy constructor.- Parameters:
doc
- the source
-
MDocument
protected MDocument(MDocument doc, boolean cloneobjs)
Copy constructor.- Parameters:
doc
- the sourcecloneobjs
- whether to clone objects- Since:
- Marvin 3.5, 11/06/2004
-
-
Method Detail
-
getMChemicalStruct
public MChemicalStruct getMChemicalStruct()
-
cloneTemporraryObjects
protected void cloneTemporraryObjects(MDocument doc)
-
cloneSets
public void cloneSets(MDocument doc)
Clones the atom/bond sets from doc.- Parameters:
doc
- the document to clone from.
-
parseMRV
@Deprecated public static MDocument parseMRV(String sval) throws IOException
Deprecated.As of release 5.7, replaced byMolImporter.parseMRV(String)
Parses a document from a string in Marvin Document (MRV) format.- Parameters:
sval
- the string- Returns:
- The document
- Throws:
IOException
- if an exception occurs during parsing- Since:
- Marvin 4.1, 11/20/2005
-
cloneDocument
public MDocument cloneDocument()
Creates a clone.- Returns:
- the clone
- Since:
- Marvin 3.5.1, 11/20/2004
-
cloneMainMolecule
public final Molecule cloneMainMolecule()
Creates a clone.- Returns:
- the main molecule of the clone
- Throws:
ClassCastException
- if the main molecule graph is not a Molecule instance- Since:
- Marvin 3.5.1, 11/20/2004
-
cloneMainMoleculeGraph
public final MoleculeGraph cloneMainMoleculeGraph()
Creates a clone.- Returns:
- the main molecule graph of the clone
- Since:
- Marvin 3.5.1, 11/20/2004
-
clone
public final Object clone()
Creates a clone.
-
removeAtomFromGraphs
public void removeAtomFromGraphs(MolAtom node)
Removes the specified node from all molecule graphs.- Parameters:
node
- the node to remove
-
selectAllObjects
public void selectAllObjects(boolean s)
Selects or unselects all objects.
-
selectAllConnectedObjects
public void selectAllConnectedObjects(boolean s)
Selects or unselects all objects in this document and objects that belong to the chemical structure of this document.
-
getObjectContainingSelection
public MObject getObjectContainingSelection()
Gets the object that contains the selection.- Returns:
- the object or null
-
setObjectContainingSelection
public void setObjectContainingSelection(MObject o)
Sets the object that contains the selection. All other objects's contents are unselected.- Parameters:
o
- the object or null
-
isHighlighted
public boolean isHighlighted(MObject o)
Is the specified object currently highlighted?- Returns:
- true if it is highlighted, false otherwise
-
highlight
public void highlight(MObject o)
Highlight an object.- Parameters:
o
- the object to highlight
-
unhighlight
public void unhighlight(MObject o)
Unhighlights an object.- Parameters:
o
- the object to unhighlight
-
unhighlightAll
public void unhighlightAll()
Unhighlights all objects.
-
getDraggedObject
public MObject getDraggedObject()
Gets the dragged object- Returns:
- the dragged object or null
-
setDraggedObject
public void setDraggedObject(MObject o)
Sets the dragged object.- Parameters:
o
- the object
-
getFocus
public MObject getFocus()
Gets the focused object- Returns:
- the focused object or null
-
setFocus
public void setFocus(MObject o)
Focus to the specified object.- Parameters:
o
- the object
-
getMainMoleculeGraph
public MoleculeGraph getMainMoleculeGraph()
Gets the main molecule graph.- Returns:
- the molecule graph
-
setMainMoleculeGraph
public void setMainMoleculeGraph(MoleculeGraph m)
Sets the main molecule graph.- Parameters:
m
- the molecule graph
-
getMoleculeMovie
public chemaxon.struc.graphics.MMoleculeMovie getMoleculeMovie()
Gets the molecule movie.- Returns:
- the molecule movie or null
- Since:
- Marvin 4.0, 06/30/2005
-
getPrimaryMolecule
public Molecule getPrimaryMolecule()
Gets the primary molecule object. The main molecule graph is returned if it is a molecule, unless it is empty and a molecule movie is also present. In that case, the current molecule of the movie is returned. WARNING! Do not change the returned molecule object! The document may become corrupted.- Returns:
- the array of molecules
- Since:
- Marvin 4.0, 06/30/2005
-
getPrimaryMolecules
public Molecule[] getPrimaryMolecules()
Gets an array containing the primary molecule objects. The main molecule graph is returned if it is a molecule, unless it is empty and a molecule movie is also present. In that case, the molecules of the movie are returned. WARNING! Do not change the returned molecule objects! The document may become corrupted.- Returns:
- the array of molecules
- Since:
- Marvin 4.0, 06/30/2005
-
getAllMolecules
public Molecule[] getAllMolecules()
Gets an array containing all molecule objects. WARNING! Do not change the returned molecule objects! The document may become corrupted.- Returns:
- the array of molecules
- Since:
- Marvin 4.0, 06/30/2005
-
getAllNonEmptyMolecules
public Molecule[] getAllNonEmptyMolecules()
Gets an array containing all non-empty molecule objects. WARNING! Do not change the returned molecule objects! The document may become corrupted.- Returns:
- the array of molecules
- Since:
- Marvin 4.0, 06/30/2005
-
setMoleculeMovie
public void setMoleculeMovie(chemaxon.struc.graphics.MMoleculeMovie mmm)
Sets the molecule movie.- Parameters:
mmm
- the molecule movie- Since:
- Marvin 4.0, 06/30/2005
-
indexOf
public int indexOf(MObject o)
Searches for an object in the document or in the chemical structure that belongs to the document.- Parameters:
o
- the object- Returns:
- the object's index if found, -1 otherwise
-
moveObject
public void moveObject(MObject o, int i)
Move an object to another place in the stack.- Parameters:
o
- the objecti
- the new position
-
moveMainMoleculeGraphToFront
public void moveMainMoleculeGraphToFront()
Move the main molecule graph to the top of stack.
-
moveMoleculeMovieToFront
public void moveMoleculeMovieToFront()
Move the molecule movie (if exists) to the top of stack.- Since:
- Marvin 4.0, 06/30/2005
-
contains
public boolean contains(MObject o)
Searches an object in the document.- Parameters:
o
- the object- Returns:
- true if the document contains the object, false otherwise
-
contains
public boolean contains(MDocument doc)
Tests whether the document contains all objects of another document.- Parameters:
doc
- the other document- Returns:
- true if the document contains the objects of the other document, false otherwise
- Since:
- Marvin 3.4
-
containsOnlyOne
public boolean containsOnlyOne(Class cl)
Tests whether the document contains only one object of the specified class.- Parameters:
cl
- MObject.class or a derived class- Returns:
- true if no more and not less than one non-empty object is instance of the specified class
- Since:
- Marvin 3.5, 07/12/2004
-
addObject
public void addObject(MObject o)
Adds an object to the document.- Parameters:
o
- the object
-
isExtraObject
public boolean isExtraObject(MObject o)
Decides whether a graphic object belongs to the main chemical structure of the document.- Parameters:
o
- the graphic object- Returns:
- true if the graphic object belongs to the main chemical structure, false otherwise.
-
removeObject
public void removeObject(MObject o)
Removes an object from the document or from the chemical structure of the document.- Parameters:
o
- the object
-
removeObject
public void removeObject(int i)
Removes an object from the document.- Parameters:
i
- the object index
-
getObjectCount
public int getObjectCount()
Gets the number of objects in this document.- Returns:
- the number of objects
-
getConnectedObjectCount
public int getConnectedObjectCount()
Gets the number of objects in this document and in the chemical structure of this document.- Returns:
- the number of objects
-
getObject
public MObject getObject(int i)
Gets an object from the document.- Parameters:
i
- the index of the object- Returns:
- the object at the specified index.
-
getConnectedObject
public MObject getConnectedObject(int i)
Gets an object from the document or from the chemical structure of the document.- Parameters:
i
- the index of the object- Returns:
- the object at the specified index.
-
getAllObjects
public List<MObject> getAllObjects()
Gets all objects stored in this document and from the chemical structure of the document.- Returns:
- the list of objects
-
setObject
public void setObject(MObject o, int i)
Sets an object- Parameters:
o
- the objecti
- the index
-
removeAtom
public void removeAtom(MolAtom a)
Removes an atom from all the chemical graphs and removes all graphics objects that contain its reference.- Parameters:
a
- the atom to remove- Since:
- Marvin 3.5, 07/05/2004
-
removeAtom
public void removeAtom(MolAtom a, int cleanupFlags)
Removes an atom from all the chemical graphs and removes all graphics objects that contain its reference.- Parameters:
a
- the atom to removecleanupFlags
- cleanup options- Since:
- Marvin 4.1, 03/07/2006
-
clear
public void clear()
Clears the document. Removes all objects except the main molecule graph, from which all atoms, bonds and other objects are removed.
-
clearSets
public void clearSets()
Clears the atomSets and the bondSets.
-
isEmpty
public boolean isEmpty()
Tests whether the document is empty:- the main molecule object in the document is empty
- no graphic object is included (neither simple nor extra)
- Returns:
- true if the document is empty, false otherwise
-
isSimpleMolecule
public boolean isSimpleMolecule()
Tests whether the document is equivalent to a simple molecule.- Returns:
- true if the document does not have extra properties, false otherwise
- Since:
- Marvin 4.1, 11/19/2005
-
simplifyMolecule
public void simplifyMolecule()
Simplifies the main molecule object if possible. Note that it makes the original molecule object invalid.- Since:
- Marvin 4.1.13, 09/20/2007
- See Also:
Molecule.getSimplifiedMolecule()
-
transform
public void transform(CTransform3D t)
Transforms all object's coordinates.- Specified by:
transform
in interfaceMTransformable
- Parameters:
t
- the transformation matrix
-
transform
public void transform(CTransform3D t, int opts)
Transforms all object's coordinates.- Parameters:
t
- the transformation matrixopts
- the transformation options- See Also:
MObject.transform(CTransform3D, int, CTransform3D)
-
transform
public void transform(CTransform3D t, int opts, CTransform3D trot)
Transforms all object's coordinates.- Parameters:
t
- the transformation matrixopts
- the transformation optionstrot
- the viewing transformation- Since:
- Marvin 4.1, 04/28/2006
- See Also:
MObject.transform(CTransform3D, int, CTransform3D)
-
transform
public void transform(CTransform3D t, CTransform3D textBoxT, int opts, CTransform3D trot)
Transforms all object's coordinates.- Parameters:
t
- the transformation matrixtextBoxT
- the object transformation matrixopts
- the transformation optionstrot
- the viewing transformation- Since:
- Marvin 4.1, 04/28/2006
- See Also:
MObject.transform(CTransform3D, int, CTransform3D)
-
calcCenter
public DPoint3 calcCenter()
Calculates the geometrical center.- Returns:
- the center in `absolute' coordinates
-
calcCenter
public DPoint3 calcCenter(CTransform3D t)
Calculates the geometrical center.- Parameters:
t
- the viewing transformation or null- Returns:
- the center in transformed coordinates
- Since:
- Marvin 4.1, 04/28/2006
-
getStartPosition
public long getStartPosition()
Gets the starting position of this document in the input file.- Returns:
- the starting position
-
setStartPosition
public void setStartPosition(long off)
Sets the starting position of this document in the input file.- Parameters:
off
- the starting position
-
getEndPosition
public long getEndPosition()
Gets the end position of this document in the input file.- Returns:
- the end position
-
setEndPosition
public void setEndPosition(long off)
Sets the end position of this document in the input file.- Parameters:
off
- the end position
-
getInputFormat
public final String getInputFormat()
Gets the input file format. Set by the import module if the molecule is from a file.- Returns:
- the input file format for the document
-
setInputFormat
public void setInputFormat(String format)
Sets the input file format.- Parameters:
format
- the input format
-
exportToFormat
@Deprecated public final String exportToFormat(String fmt) throws IOException
Deprecated.As of release 5.7, replaced byMolExporter.exportToFormat(MDocument, String)
Creates a string representation of the document. The format descriptor string can also contain export options. Format and options are separated by a colon, multiple options can be separated by commas. See the text formats and their options on the File Formats in Marvin page. Examples:s1 = doc.exportToFormat("mol"); s2 = doc.exportToFormat("smiles:a-H"); // aromatize and remove Hydrogens
- Parameters:
fmt
- the format descriptor string- Returns:
- string representation of the document in the specified format
- Throws:
MolExportException
- Export errorIllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of security reasons (firewall).IOException
- Since:
- Marvin 4.0, 07/01/2005
- See Also:
exportToBinFormat(java.lang.String)
,exportToObject(java.lang.String)
,Molecule.exportToFormat(java.lang.String)
-
exportToBinFormat
@Deprecated public final byte[] exportToBinFormat(String fmt) throws IOException
Deprecated.As of release 5.7, replaced byMolExporter.exportToBinFormat(MDocument, String)
.Creates a binary representation of the document. Works with all the text formats that are supported by theexportToFormat
method, and also with the binary image formats (jpeg, msbmp, png). When creating an image, display options can also be specified in the format descriptor string. Format and options are separated by a colon, multiple options can be separated by commas. See the possible formats and their options on the File Formats in Marvin page. Examples:byte[] d1 = doc.exportToBinFormat("mrv"); byte[] d2 = doc.exportToBinFormat("smiles:a-H"); // aromatize and remove H byte[] d3 = doc.exportToBinFormat("png:w300,h300,b32,#00ffff00"); byte[] d4 = doc.exportToBinFormat("jpeg:w300,h300,Q95,#ffff00,spacefill");
- Parameters:
fmt
- the format descriptor string- Returns:
- a binary representation of the document in the specified format
- Throws:
MolExportException
- Export error.IllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of security reasons (firewall).IOException
- Since:
- Marvin 4.0, 07/01/2005
- See Also:
exportToFormat(java.lang.String)
,exportToObject(java.lang.String)
,Molecule.exportToBinFormat(java.lang.String)
-
exportToObject
@Deprecated public Object exportToObject(String fmt) throws IOException
Deprecated.As of release 5.7, replaced byMolExporter.exportToObject(MDocument, String)
Creates a String, byte[] array or Image representation of the molecule. When creating an image, display options can also be specified in the format descriptor string. Format and options are separated by a colon, multiple options can be separated by commas. See the possible formats and their options on the File Formats in Marvin page. Examples:import java.awt.Image; ... String s1 = (String)doc.exportToObject("mol"); String s2 = (String)doc.exportToObject("smiles:a-H"); // aromatize, remove H Image img = (Image)doc.exportToObject("image:w300,h300,#ffff00"); byte[] d3 = (byte[])doc.exportToObject("png:w300,h300,b32,#00ffff00"); byte[] d4 = (byte[])doc.exportToObject("jpeg:w300,h300,Q95,#ffff00,spacefill");
- Parameters:
fmt
- the format descriptor string- Returns:
- a String, a byte[] array or an Image
- Throws:
MolExportException
- Export error.IllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of security reasons (firewall).IOException
- Since:
- Marvin 4.0, 07/01/2005
- See Also:
exportToFormat(java.lang.String)
,exportToBinFormat(java.lang.String)
,Molecule.exportToObject(java.lang.String)
-
getMProp
public MProp getMProp()
Gets the document as a property.- Since:
- Marvin 4.1, 08/01/2006
-
properties
public MPropertyContainer properties()
Gets the property container.- Since:
- Marvin 4.0, 06/18/2005
-
getAtomSetFont
public MFont getAtomSetFont(int seq)
Gets an atom set font.- Parameters:
seq
- the atom set sequence number- Returns:
- the font
- Since:
- Marvin 4.0.3, 06/10/2005
-
setAtomSetFont
public void setAtomSetFont(int seq, MFont font)
Sets the font of an atom set.- Parameters:
seq
- atom set sequence number (0, ...,MolAtom.SETSEQ_MAX
)font
-- Since:
- Marvin 4.0.3, 06/10/2005
-
getAtomSetColorMode
public int getAtomSetColorMode(int seq)
Gets the atom set coloring mode.- Parameters:
seq
- the atom set sequence number- Returns:
- the mode
- Since:
- Marvin 4.1, 05/31/2006
- See Also:
SETCOLOR_DEFAULT
,SETCOLOR_SPECIFIED
,SETCOLOR_COLORLESS
-
setAtomSetColorMode
public void setAtomSetColorMode(int seq, int m)
Sets the atom set coloring mode.- Parameters:
seq
- the atom set sequence numberm
- the mode- Since:
- Marvin 4.1, 05/31/2006
- See Also:
SETCOLOR_DEFAULT
,SETCOLOR_SPECIFIED
,SETCOLOR_COLORLESS
-
isAtomSetColorModeSet
public boolean isAtomSetColorModeSet()
Decides whether the atomset coloring mode is set.- Returns:
- true if the coloring mode is set for at lease one atomset false otherwise.
-
setExtraLabelSetColorMode
public void setExtraLabelSetColorMode(int seq, int mode)
-
getAtomSetSize
public int getAtomSetSize()
Gets the size of the atom set.- Returns:
- the atom set size
-
getExtraLabelSetSize
public int getExtraLabelSetSize()
-
getAtomSetRGB
public int getAtomSetRGB(int seq)
Gets an atom set color.- Parameters:
seq
- the atom set sequence number- Returns:
- the RGB values or -1 if unset or default atom coloring is used
- Since:
- Marvin 4.0, 03/02/2005
-
getExtraLabelSetRGBs
public long getExtraLabelSetRGBs(int seq)
-
getExtraLabelSetColorMode
public int getExtraLabelSetColorMode(int seq)
Gets the coloring mode of extra label set sequences.- Parameters:
seq
- the atom sequence number- Returns:
- the coloring mode
- Since:
- Marvin 4.1, 07/06/2006
- See Also:
SETCOLOR_DEFAULT
,SETCOLOR_SPECIFIED
,SETCOLOR_COLORLESS
-
getExtraLabelSetFont
public MFont getExtraLabelSetFont(int seq)
-
setExtraLabelColorsForDocument
public void setExtraLabelColorsForDocument(Molecule mol)
Sets the coloring mode sets and colors of extra labels- Parameters:
mol
- the graph union in the document
-
setAtomSetRGB
public void setAtomSetRGB(int seq, int rgb)
Sets the color of an atom set. It also sets the color mode of the set toSETCOLOR_SPECIFIED
.- Parameters:
seq
- atom set sequence number (0, ...,MolAtom.SETSEQ_MAX
)rgb
- the RGB values- Since:
- Marvin 4.0, 03/02/2005
-
setExtraLabelSetRGBs
public void setExtraLabelSetRGBs(int seq, int rgb)
-
setExtraLabelSetRGBs
public void setExtraLabelSetRGBs(int seq, int rgb1, int rgb2)
-
getAtomSetColor
public Color getAtomSetColor(int seq)
Gets an atom set color.- Parameters:
seq
- the atom set sequence number- Returns:
- the color or
null
if unset or default bond coloring is used - Since:
- Marvin 4.0, 03/02/2005
-
getBondSetSize
public int getBondSetSize()
Gets the bond set size.- Returns:
- the bond set size
-
getBondSetThickness
public double getBondSetThickness(int seq)
Gets a bond set thickness.- Parameters:
seq
- the atom set sequence number- Returns:
- the thickness
- Since:
- Marvin 4.0.3, 10/14/2005
-
setBondSetThickness
public void setBondSetThickness(int seq, double thickness)
Sets the thickness of a bond set.- Parameters:
seq
- bond set sequence number (0, ...,MolAtom.SETSEQ_MAX
)thickness
-- Since:
- Marvin 4.0.3, 10/14/2005
-
getBondSetColorMode
public int getBondSetColorMode(int seq)
Gets the bond set coloring mode.- Parameters:
seq
- the bond set sequence number- Returns:
- the mode
- Since:
- Marvin 4.1, 05/31/2006
- See Also:
SETCOLOR_DEFAULT
,SETCOLOR_SPECIFIED
,SETCOLOR_COLORLESS
-
setBondSetColorMode
public void setBondSetColorMode(int seq, int m)
Sets the bond set coloring mode.- Parameters:
seq
- the bond set sequence numberm
- the mode- Since:
- Marvin 4.1, 05/31/2006
- See Also:
SETCOLOR_DEFAULT
,SETCOLOR_SPECIFIED
,SETCOLOR_COLORLESS
-
getBondSetRGB
public int getBondSetRGB(int seq)
Gets a bond set color.- Parameters:
seq
- the bond set sequence number- Returns:
- the RGB values or -1 if unset or default coloring is used
- Since:
- Marvin 4.0, 03/02/2005
-
setBondSetRGB
public void setBondSetRGB(int seq, int rgb)
Sets the color of a bond set. It also sets the color mode of the set toSETCOLOR_SPECIFIED
.- Parameters:
seq
- bond set sequence number (1, ...,MolBond.SETSEQ_MAX
)rgb
- the RGB values- Since:
- Marvin 4.0, 03/02/2005
-
getBondSetColor
public Color getBondSetColor(int seq)
Gets a bond set color.- Parameters:
seq
- the bond set sequence number- Returns:
- the color or
null
if unset or default bond coloring is used - Since:
- Marvin 4.0, 03/02/2005
-
addCheckerMark
public void addCheckerMark(MDocument.CheckerMark mark)
Adds a checker mark to the document. The checker mark containts atom indexes, bond indexes, and a color NOTE: checker marks will be reset on any molecule change- Parameters:
mark
- is the checker mark information- Since:
- Marvin 5.3
-
clearCheckerMarks
public void clearCheckerMarks()
Clears the checker marks- Since:
- Marvin 5.3
- See Also:
addCheckerMark(CheckerMark)
-
getCheckerMarks
public MDocument.CheckerMark[] getCheckerMarks()
Returns the array of checker marks NOTE: checker marks will be reset on any molecule change- Returns:
- atom indexes or
null
- Since:
- Marvin 5.3
- See Also:
addCheckerMark(CheckerMark)
-
toString
public String toString()
Overrides Object.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object. If the main molecule graph is not empty, then the string also contains the number of nodes and edges in "[Na,Mb]" form.
-
getPageSettings
public chemaxon.struc.PageSettings getPageSettings()
Gets the page settings of multipage molecular document.- Returns:
- the page settings
- Since:
- Marvin 4.1, 01/09/2006
-
setPageSettings
public void setPageSettings(chemaxon.struc.PageSettings pageSettings)
Sets the page settings of multipage molecular document.- Parameters:
pageSettings
- the page settings- Since:
- Marvin 4.1, 01/09/2006
-
setGUIPropertyContainer
public void setGUIPropertyContainer(MPropertyContainer gpc)
Sets the property container storing MarvinPane settings- Parameters:
gpc
-- Since:
- 5.2.2 11/05/2009
-
setGUIProperyContainer
@Deprecated public void setGUIProperyContainer(MPropertyContainer gpc)
Deprecated.As of Marvin 6.1, replaced bysetGUIPropertyContainer(MPropertyContainer)
.Sets the property container storing MarvinPane settings- Parameters:
gpc
-- Since:
- 4.1 11/04/2006
-
getGUIPropertyContainer
public MPropertyContainer getGUIPropertyContainer()
- Returns:
- the property container storing GUI settings or null
- Since:
- 4.1 11/04/2006
-
getFreeAtomSetIndex
public int getFreeAtomSetIndex()
Returns the first unused atomset index.- Returns:
- the atomset index
-
getFreeBondSetIndex
public int getFreeBondSetIndex()
Returns the first unused bondset index.- Returns:
- the bondset index
-
removeColorsFromMolecules
public void removeColorsFromMolecules()
Removes coloring from all molecular objects in the document. Removes coloring of atoms, bonds and extra labels. Removes all color sets from the document.
-
removeElectronsOf
public void removeElectronsOf(MolAtom targetAtom)
Removes the Electron containers belongs to targetAtom,- Parameters:
targetAtom
-
-
fixElectronContainers
public static void fixElectronContainers(MDocument doc, boolean lonePairsAutoCalc, boolean lonePairsVisible)
Removes unnecesarry MElectronContainers from the give MDocument corresponding to lone pair display options, if an electron of a MEFlow arrow has been removed the arrow is removed as well.- Parameters:
doc
-lonePairsAutoCalc
-lonePairsVisible
-
-
hasExplicitLonePairs
public boolean hasExplicitLonePairs()
Returns true if the MDocument has any electrons drawn by the user.- Returns:
- true if any electrons if set by the user.
- Since:
- Marvin 15.9.21
-
getExplicitLonePairCount
public int getExplicitLonePairCount()
Returns the number of Lone Pair electrons set by the user.- Returns:
- number of user drawn lone pairs.
- Since:
- Marvin 15.9.21
-
getLonePairCount
public int getLonePairCount()
Returns the number of Lone Pair electrons.- Returns:
- number of user lone pairs.
- Since:
- Marvin 15.9.21
-
hasRadicals
public boolean hasRadicals()
Returns true if the MDocument has any Radical Electrons.- Returns:
- true if MDocument has any radical electrons.
- Since:
- Marvin 15.9.21
-
getRadicalCount
public int getRadicalCount()
Returns the number of Radical electrons.- Returns:
- number of Radical electrons.
- Since:
- Marvin 15.9.21
-
hasElectrons
public boolean hasElectrons()
Returns whether MDocument contains any electrons.- Returns:
- true if the MDocument contains any electrons.
- Since:
- Marvin 15.9.21
-
getElectronCount
public int getElectronCount()
Returns the number of electrons.- Returns:
- number of electrons.
- Since:
- Marvin 15.9.21
-
-