public class MDocument extends Object implements MTransformable, Serializable, chemaxon.core.structure.DocumentForBuilder
Modifier and Type | Class and Description |
---|---|
static class |
MDocument.CheckerMark
Provides informations for Structure Checker higlight
|
class |
MDocument.Prop
Property that stores an MDocument.
|
Modifier and Type | Field and Description |
---|---|
protected MChemicalStruct |
mainMChemicalStruct |
protected chemaxon.struc.graphics.MMoleculeMovie |
mainMMoleculeMovie |
protected MObject |
objectContainingSelection |
protected ArrayList<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.
|
Modifier | Constructor and 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.
|
Modifier and Type | Method and 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 marks
|
void |
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 by
MolExporter.exportToBinFormat(MDocument, String) . |
String |
exportToFormat(String fmt)
Deprecated.
As of release 5.7, replaced by
MolExporter.exportToFormat(MDocument, String) |
Object |
exportToObject(String fmt)
Deprecated.
As of release 5.7, replaced by
MolExporter.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 change
|
MObject |
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 object
|
long |
getEndPosition()
Gets the end position of this document in the input file.
|
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 object
|
int |
getFreeAtomSetIndex()
Returns the first unused atomset index.
|
int |
getFreeBondSetIndex()
Returns the first unused bondset index.
|
MPropertyContainer |
getGUIPropertyContainer() |
String |
getInputFormat()
Gets the input file format.
|
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.
|
long |
getStartPosition()
Gets the starting position of this document in the input file.
|
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 by
MolImporter.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 labels
|
void |
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 settings
|
void |
setGUIProperyContainer(MPropertyContainer gpc)
Deprecated.
As of Marvin 6.1, replaced by
setGUIPropertyContainer(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 object
|
void |
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 |
unhighlight(MObject o)
Unhighlights an object.
|
void |
unhighlightAll()
Unhighlights all objects.
|
public static final int SETCOLOR_DEFAULT
getAtomSetColorMode(int)
,
getBondSetColorMode(int)
,
Constant Field Valuespublic static final int SETCOLOR_SPECIFIED
getAtomSetColorMode(int)
,
getBondSetColorMode(int)
,
Constant Field Valuespublic static final int SETCOLOR_COLORLESS
getAtomSetColorMode(int)
,
getBondSetColorMode(int)
,
Constant Field Valuesprotected transient MChemicalStruct mainMChemicalStruct
protected transient chemaxon.struc.graphics.MMoleculeMovie mainMMoleculeMovie
protected transient MObject objectContainingSelection
public MDocument(MoleculeGraph m)
m
- the main molecule graphIllegalArgumentException
- if the given molecule has a parent (root, rgroup,
component)public MDocument(Molecule[] mols)
mols
- the molecule animationpublic MDocument(MDocument doc)
doc
- the sourceprotected MDocument(MDocument doc, boolean cloneobjs)
doc
- the sourcecloneobjs
- whether to clone objectspublic MChemicalStruct getMChemicalStruct()
protected void cloneTemporraryObjects(MDocument doc)
public void cloneSets(MDocument doc)
doc
- the document to clone from.@Deprecated public static MDocument parseMRV(String sval) throws IOException
MolImporter.parseMRV(String)
sval
- the stringIOException
- if an exception occurs during parsingpublic MDocument cloneDocument()
public final Molecule cloneMainMolecule()
ClassCastException
- if the main molecule graph is
not a Molecule instancepublic final MoleculeGraph cloneMainMoleculeGraph()
public final Object clone()
public void removeAtomFromGraphs(MolAtom node)
node
- the node to removepublic void selectAllObjects(boolean s)
public void selectAllConnectedObjects(boolean s)
public MObject getObjectContainingSelection()
public void setObjectContainingSelection(MObject o)
o
- the object or nullpublic boolean isHighlighted(MObject o)
public void highlight(MObject o)
o
- the object to highlightpublic void unhighlight(MObject o)
o
- the object to unhighlightpublic void unhighlightAll()
public MObject getDraggedObject()
public void setDraggedObject(MObject o)
o
- the objectpublic MObject getFocus()
public void setFocus(MObject o)
o
- the objectpublic MoleculeGraph getMainMoleculeGraph()
public void setMainMoleculeGraph(MoleculeGraph m)
m
- the molecule graphpublic chemaxon.struc.graphics.MMoleculeMovie getMoleculeMovie()
public Molecule getPrimaryMolecule()
public Molecule[] getPrimaryMolecules()
public Molecule[] getAllMolecules()
public Molecule[] getAllNonEmptyMolecules()
public void setMoleculeMovie(chemaxon.struc.graphics.MMoleculeMovie mmm)
mmm
- the molecule moviepublic int indexOf(MObject o)
o
- the objectpublic void moveObject(MObject o, int i)
o
- the objecti
- the new positionpublic void moveMainMoleculeGraphToFront()
public void moveMoleculeMovieToFront()
public boolean contains(MObject o)
o
- the objectpublic boolean contains(MDocument doc)
doc
- the other documentpublic boolean containsOnlyOne(Class cl)
cl
- MObject.class or a derived classpublic void addObject(MObject o)
o
- the objectpublic boolean isExtraObject(MObject o)
o
- the graphic objectpublic void removeObject(MObject o)
o
- the objectpublic void removeObject(int i)
i
- the object indexpublic int getObjectCount()
public int getConnectedObjectCount()
public MObject getObject(int i)
i
- the index of the objectpublic MObject getConnectedObject(int i)
i
- the index of the objectpublic List<MObject> getAllObjects()
public void setObject(MObject o, int i)
o
- the objecti
- the indexpublic void removeAtom(MolAtom a)
a
- the atom to removepublic void removeAtom(MolAtom a, int cleanupFlags)
a
- the atom to removecleanupFlags
- cleanup optionspublic void clear()
public void clearSets()
public boolean isEmpty()
public boolean isSimpleMolecule()
public void simplifyMolecule()
Molecule.getSimplifiedMolecule()
public void transform(CTransform3D t)
transform
in interface MTransformable
t
- the transformation matrixpublic void transform(CTransform3D t, int opts)
t
- the transformation matrixopts
- the transformation optionsMObject.transform(CTransform3D, int, CTransform3D)
public void transform(CTransform3D t, int opts, CTransform3D trot)
t
- the transformation matrixopts
- the transformation optionstrot
- the viewing transformationMObject.transform(CTransform3D, int, CTransform3D)
public DPoint3 calcCenter()
public DPoint3 calcCenter(CTransform3D t)
t
- the viewing transformation or nullpublic long getStartPosition()
public void setStartPosition(long off)
off
- the starting positionpublic long getEndPosition()
public void setEndPosition(long off)
off
- the end positionpublic final String getInputFormat()
public void setInputFormat(String format)
format
- the input format@Deprecated public final String exportToFormat(String fmt) throws IOException
MolExporter.exportToFormat(MDocument, String)
s1 = doc.exportToFormat("mol"); s2 = doc.exportToFormat("smiles:a-H"); // aromatize and remove Hydrogens
fmt
- the format descriptor stringMolExportException
- Export errorIllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of
security reasons (firewall).IOException
exportToBinFormat(java.lang.String)
,
exportToObject(java.lang.String)
,
Molecule.exportToFormat(java.lang.String)
@Deprecated public final byte[] exportToBinFormat(String fmt) throws IOException
MolExporter.exportToBinFormat(MDocument, String)
.exportToFormat
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");
fmt
- the format descriptor stringMolExportException
- Export error.IllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of
security reasons (firewall).IOException
exportToFormat(java.lang.String)
,
exportToObject(java.lang.String)
,
Molecule.exportToBinFormat(java.lang.String)
@Deprecated public Object exportToObject(String fmt) throws IOException
MolExporter.exportToObject(MDocument, String)
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");
fmt
- the format descriptor stringMolExportException
- Export error.IllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of
security reasons (firewall).IOException
exportToFormat(java.lang.String)
,
exportToBinFormat(java.lang.String)
,
Molecule.exportToObject(java.lang.String)
public MProp getMProp()
public MPropertyContainer properties()
public MFont getAtomSetFont(int seq)
seq
- the atom set sequence numberpublic void setAtomSetFont(int seq, MFont font)
seq
- atom set sequence number
(0, ..., MolAtom.SETSEQ_MAX
)font
- public int getAtomSetColorMode(int seq)
seq
- the atom set sequence numberSETCOLOR_DEFAULT
,
SETCOLOR_SPECIFIED
,
SETCOLOR_COLORLESS
public void setAtomSetColorMode(int seq, int m)
seq
- the atom set sequence numberm
- the modeSETCOLOR_DEFAULT
,
SETCOLOR_SPECIFIED
,
SETCOLOR_COLORLESS
public boolean isAtomSetColorModeSet()
public void setExtraLabelSetColorMode(int seq, int mode)
public int getAtomSetSize()
public int getExtraLabelSetSize()
public int getAtomSetRGB(int seq)
seq
- the atom set sequence numberpublic long getExtraLabelSetRGBs(int seq)
public int getExtraLabelSetColorMode(int seq)
seq
- the atom sequence numberSETCOLOR_DEFAULT
,
SETCOLOR_SPECIFIED
,
SETCOLOR_COLORLESS
public MFont getExtraLabelSetFont(int seq)
public void setExtraLabelColorsForDocument(Molecule mol)
mol
- the graph union in the documentpublic void setAtomSetRGB(int seq, int rgb)
SETCOLOR_SPECIFIED
.seq
- atom set sequence number
(0, ..., MolAtom.SETSEQ_MAX
)rgb
- the RGB valuespublic void setExtraLabelSetRGBs(int seq, int rgb)
public void setExtraLabelSetRGBs(int seq, int rgb1, int rgb2)
public Color getAtomSetColor(int seq)
seq
- the atom set sequence numbernull
if unset or default bond coloring is usedpublic int getBondSetSize()
public double getBondSetThickness(int seq)
seq
- the atom set sequence numberpublic void setBondSetThickness(int seq, double thickness)
seq
- bond set sequence number
(0, ..., MolAtom.SETSEQ_MAX
)thickness
- public int getBondSetColorMode(int seq)
seq
- the bond set sequence numberSETCOLOR_DEFAULT
,
SETCOLOR_SPECIFIED
,
SETCOLOR_COLORLESS
public void setBondSetColorMode(int seq, int m)
seq
- the bond set sequence numberm
- the modeSETCOLOR_DEFAULT
,
SETCOLOR_SPECIFIED
,
SETCOLOR_COLORLESS
public int getBondSetRGB(int seq)
seq
- the bond set sequence numberpublic void setBondSetRGB(int seq, int rgb)
SETCOLOR_SPECIFIED
.seq
- bond set sequence number
(1, ..., MolBond.SETSEQ_MAX
)rgb
- the RGB valuespublic Color getBondSetColor(int seq)
seq
- the bond set sequence numbernull
if unset or default bond coloring is usedpublic void addCheckerMark(MDocument.CheckerMark mark)
mark
- is the checker mark informationpublic void clearCheckerMarks()
addCheckerMark(CheckerMark)
public MDocument.CheckerMark[] getCheckerMarks()
null
addCheckerMark(CheckerMark)
public String toString()
@
', 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.public chemaxon.struc.PageSettings getPageSettings()
public void setPageSettings(chemaxon.struc.PageSettings pageSettings)
pageSettings
- the page settingspublic void setGUIPropertyContainer(MPropertyContainer gpc)
gpc
- @Deprecated public void setGUIProperyContainer(MPropertyContainer gpc)
setGUIPropertyContainer(MPropertyContainer)
.gpc
- public MPropertyContainer getGUIPropertyContainer()
public int getFreeAtomSetIndex()
public int getFreeBondSetIndex()
public void removeColorsFromMolecules()
public void removeElectronsOf(MolAtom targetAtom)
targetAtom
- public static void fixElectronContainers(MDocument doc, boolean lonePairsAutoCalc, boolean lonePairsVisible)
doc
- lonePairsAutoCalc
- lonePairsVisible
-