astex
Class MoleculeRenderer

java.lang.Object
  extended by astex.MoleculeRenderer

public class MoleculeRenderer
extends java.lang.Object

Class for drawing a molecule into our renderer.


Field Summary
static int ANGLE_PICK
          Angle picking mode.
 int contourSize
          The current contour grid size.
 boolean debug
          Are we debugging.
 boolean dirty
          Has something changed the scene.
 boolean displayAsCylinders
           
static int DISTANCE_PICK
          Distance picking mode.
 java.util.Hashtable groups
          The set of defined groups.
 boolean hersheyFonts
           
 java.lang.String lastScriptFile
          The last script we executed.
 MoleculeViewer moleculeViewer
          The moleucle viewer class that we are drawing for.
static int NORMAL_PICK
          Normal picking mode.
 DynamicArray pickedAtoms
          The list of atoms that have been picked so far.
 int pickMode
          The current pick mode.
 Renderer renderer
          The Renderer that will do the work.
 boolean shadows
          Are shadows on.
static int TORSION_PICK
          Angle picking mode.
 
Constructor Summary
MoleculeRenderer()
          Default constructor.
 
Method Summary
 void addAngle(Atom firstAtom, Atom secondAtom, Atom thirdAtom)
          Add a set of atoms to the angle list.
 void addBumpPair(Atom atom1, Atom atom2)
          Add a pair of bump atoms.
 void addContourLevel(double level, int color, boolean display, int style)
          Add a contour level.
 void addDistance(Atom firstAtom, Atom secondAtom)
          Add a pair of atoms to the distance list.
 void addDistance(Distance d)
          Add a distance monitor to the list.
 void addDistance2(Atom firstAtom, Atom secondAtom)
          Add a pair of atoms to the distance list.
 void addDistanceBetweenSelectedAtoms()
          Add a distance monitor between the selected atoms.
 void addGraphicalObject(Tmesh object)
           
 void addLabelledAtom(Atom atom)
          Add a labelled atom.
 void addMap(Map map)
          Add a map to the scene.
 void addMolecule(Molecule molecule)
          Add a molecule to the scene.
 void addMolecule(java.lang.String filename, java.lang.String name)
          Add a molecule to the scene.
 void addMoleculeRendererListener(MoleculeRendererListener l)
          Add a MoleculeRendererListener.
 void addSelectedAtom(Atom atom)
          Add a selected atom.
 void addSymmetryAtoms(Molecule molecule, Point3d center, double radius, Matrix transform, Molecule symmetryMolecule)
          Add the symmetry atoms that overlap.
 void addTorsion(Atom firstAtom, Atom secondAtom, Atom thirdAtom, Atom fourthAtom)
          Add a set of atoms to the angle list.
 void assignSymmetryAtomColors(Molecule molecule)
          Assign atom colors.
 void calculateHbonds(DynamicArray atoms, Arguments args)
          Calculate hydrogen bonds.
 void clipContour(Tmesh contour, double radius)
          Clip the contour object to the molecule.
 void clipMap(Map map, DynamicArray selection, boolean inside)
          Clip this map.
 void clipMaps()
          Clip around center point.
 void clipMaps(java.lang.String namePattern, DynamicArray selection, boolean inside)
          Clip any maps we are displaying to show only unoccupied density.
 boolean clipped(Point3d p, DynamicArray selection)
          Is this point inside an atom in the molecule.
 void colorByAtom()
          Color by atom type.
 void colorByBFactor()
          Color by bFactor.
 void colorByChain()
          Color by chain.
 void colorByPropertyRange(int property)
          Color by b-factor but bin the colors according to range.
 void colorByRainbow(DynamicArray selectedAtoms)
          Color a set of atoms with rainbow hue.
 void colorBySpecifiedColor(int color)
          Color by bFactor.
 void contourMap(Map map, int contour)
          Generate one specific contour level for the map.
 void contourMaps()
          Contour the maps that we are displaying.
 Tmesh contourRegion(Map map, int contourNumber, int style)
          Contour the data that is in stored in the map.
 void deleteAtom(Atom atom)
          Actually delete an atom.
 void determineRegion(Map map)
          Figure out the region of the map we will contour.
 void determineSymmetry()
          Determine the set of symmetry operators.
 void displayBondTypes(boolean b)
          Set whether or not we display bond types.
 void drawAngle(Atom a1, Atom a2, Atom a3)
          Draw an angle marker.
 void drawAngles()
          Draw the angle markers.
 void drawAtom(Atom atom, int crossPixels)
          Draw one atom.
 void drawBond(Bond bond, double w)
          Draw one bond.
 void drawBumpPairs()
          Draw the bump atoms.
 void drawDashedLine(double ax, double ay, double az, double bx, double by, double bz, double on, double off, double radius, int color)
          Draw the distance marker line.
 void drawDistance(Atom atom1, Atom atom2, boolean displayDistance)
          Draw a distance between two atoms.
 void drawDistanceObject(Distance distance)
          Draw the specific distance.
 void drawDistances()
          Draw the distance markers.
 void drawDistances2()
          Draw the distance markers.
 void drawDottedLine(Atom atom1, Atom atom2, double gap, int color)
          Draw a dotted line.
 void drawLabelledAtoms()
          Draw all of the labelled atoms.
 void drawMap(Map map)
           
 void drawMaps()
           
 void drawMolecules()
          Draw the molecule.
 void drawTorsion(Atom a1, Atom a2, Atom a3, Atom a4)
          Draw a torsion marker.
 void drawTorsions()
          Draw the angle markers.
 void drawTrace(Molecule molecule)
          Draw the molecule as a trace.
 void drawTwinColourDottedLine(Atom atom1, Atom atom2, double gap, int color1, int color2)
          Draw a dotted line.
 void ensureColorRampDefined()
           
 void execute(java.lang.String command)
           
 void execute2(java.lang.String command)
          Main interface for command processing.
 void execute22(java.lang.String command)
           
 void executeInternal(java.lang.String command)
           
 void executeScript(java.lang.String filename)
          Execute a script of commands.
 void expandSelection(Molecule molecule, int[] inSphere)
          Expand the selected atoms to include the whole residue.
 void expandSelection1(Molecule molecule, int[] inSphere)
          Expand the selected atoms to include the whole residue.
 void fireAtomSelectedEvent(Atom atom)
          Fire an atom selected event.
 void fireGenericAddedEvent(Generic generic)
          Fire a distance added event.
 void fireGenericRemovedEvent(Generic generic)
          Fire a generic removed event.
 void fireMapAddedEvent(Map map)
          Fire a map added event.
 void fireMapRemovedEvent(Map map)
          Fire a map added event.
 void fireMoleculeAddedEvent(Molecule molecule)
          Fire a molecule added event.
 void fireMoleculeRemovedEvent(Molecule molecule)
          Fire a molecule removed event.
 java.lang.String generateAtomLabel(Atom atom)
          Generate the atom label.
 void generateAtomLabels(java.lang.String format, DynamicArray selectedAtoms)
          Generate an atom label according to the format statments.
 void generateBumps(Atom atom)
          Generate the bump atoms around the specified atom.
 void generateBumps(DynamicArray bumpAtoms)
          Generate bumps for the specified set of atoms.
 void generateMaps()
          Generate the map display.
 void generateSymmetry()
          Generate the symmetry copies of the molecules.
 Molecule generateSymmetry(Point3d center, double radius)
          Generate symmetry for the molecules we are displaying.
 Molecule generateSymmetryMolecule(Point3d center, double radius)
          Acutally generate the symmetry atoms.
 int getAtomCount()
          Return the total number of atoms in the renderer.
 AtomIterator getAtomIterator()
          Get a atom iterator.
 java.lang.String getAtomLabelFormat()
          Get the atom label format.
 DynamicArray getAtomsAroundSelection(DynamicArray selection, double radius, boolean include)
          Return atoms in a shell around the specified selection.
 DynamicArray getAtomsInLigands()
          Wrapper around getAtomsInLigands.
 void getAtomsInLigands(DynamicArray selectedAtoms)
          Get atoms that are part of ligands.
 DynamicArray getAtomsInResidue(java.lang.String residueSpecification)
          Return the atoms in a particular residue.
 DynamicArray getAtomsInSelection(java.lang.String expression)
          Evaluate a selection expression.
 DynamicArray getAtomsInSphere(Point3d c, double r)
          Return the atoms in the specified sphere.
 BondIterator getBondIterator()
          Get a bond iterator.
 DynamicArray getBondsInSelection(DynamicArray selectedAtoms)
          Return bonds where both atoms are in selectedAtoms.
 DynamicArray getBumpAtoms()
          Get the bump atoms.
 Point3d getCenter(DynamicArray selection)
          Return the geometric center of the atoms in the selection.
 Tmesh getContourGraphicalObject(Map map, int contour)
          Get tmesh of contour for particular map.
 java.lang.String getContourGraphicalObjectName(Map map, int contour)
          Get name of contour for particular map.
 boolean getDisplayBumps()
          Return the state of bump display.
 boolean getDisplayDistances()
          Return the distance display flag.
 Distance getDistance(int i)
          Return a specific distance.
 int getDistanceCount()
          Return how many distances.
 DynamicArray getLabelledAtoms()
          Return the atoms that are currently labelled.
 Map getMap(int i)
          Return the specified map.
 Map getMap(java.lang.String name)
          Return the specified map from its name.
 int getMapCount()
          Return the total count of maps.
 DynamicArray getMaps(java.lang.String name)
          Return the specified map from its name.
 Molecule getMolecule(int i)
          Return the specified molecule.
 Molecule getMolecule(java.lang.String name)
          Return the first molecule that matches the specified name.
 int getMoleculeCount()
          Return the total number of molecules.
 DynamicArray getMolecules()
          Return the DynamicArray of molecules.
 Atom getNearestAtom(int x, int y)
          Find atom with screen coordinates nearest to the specified point.
 java.lang.String getNextMapName()
          Return the name for the next molecule.
 java.lang.String getNextMoleculeName()
          Return the name for the next molecule.
 double getRadius(DynamicArray selection)
          Return the radius of the atoms in the selection.
 double getRadius(DynamicArray selection, Point3d center)
          Return the radius of the atoms in the selection.
 ResidueIterator getResidueIterator()
          Get a residue iterator.
 boolean getSelectCount()
          Return whether we are printing select counts.
 int getSelectedAtomCount()
          Return the number of selected atoms.
 DynamicArray getSelectedAtoms()
          Return the atoms that are currently selected.
 DynamicArray getSelectedOrLabelledAtoms()
          Return the atoms that are currently labelled or selected.
 DynamicArray getSelectedResidues()
          Return the residues that are currently selected.
 DynamicArray getSomeAtoms(boolean selected, boolean labelled)
          Return the atoms that are currently labelled.
 java.lang.String getStatusLabelFormat()
          Get the status label format.
 void handleDeleteCommand(DynamicArray selectedAtoms)
          Handle a delete atoms command.
 void handleDistanceCommand(Arguments args)
          Handle a distance command.
 void handleEditCommand(java.lang.String name, java.lang.String value, DynamicArray selectedAtoms)
          Handle an atom edit command.
 void handleHbondCommand(Arguments args)
          Handle a hydrogen bond command.
 void handleLightCommand(int l, Arguments args)
          Handle a light command.
 void handleMapCommand(java.lang.String name, Arguments args)
          Interpret a new style map command.
 void handleObjectCommand(java.lang.String namePattern, Arguments args)
          Handle an object command.
 void handlePick(Atom pickedAtom)
          Handle a pick on the screen and label the appropriate item.
 void handleSelectionCommand(java.lang.String command, Arguments args)
          Handle a selection stack command.
 void handleSlideCommand(Arguments args)
          Handle a slide command.
 void handleTextureCommand(Arguments args)
          Interpret a texture command.
 void handleUpdateCommand(Arguments args, FloatArray fa)
          Handle a command that updates the properties of atoms.
 void handleUserCommand(java.lang.String command, Arguments args)
          Handle a user command.
 void handleWriteCommand(Arguments args)
          Interpret a molecule write command.
static double hbondEnergy(Atom n, Point3d h, Atom o, Atom c, double fq1q2)
          Calculate the energy of an hbond as defined in Kabsch and Sander, 'Dictionary of Protein Secondary Structure: Pattern Recognition of Hydrogen-Bonded and Geometrical Features', Biopolymers, 22, 2577-2637 (1983).
 void initialise()
          Initialise the MoleculeRenderer.
 void initialiseCenter()
          Figure out the molecule center and scale to make it just fit.
 boolean inSameplanarRing(Atom atom1, Atom atom2)
          Are the two atoms in the same planar ring.
 boolean labelledAtomsContains(Atom atom)
          Do we already have a label for this atom.
 void mapAtomColors(Tmesh tmesh, DynamicArray mapAtoms, int defaultColor, double dmax, double wmax)
          Map the colors of a set of atoms to the object.
 boolean moleculeMatches(java.lang.String pattern, Molecule mol)
           
 void moveAtom(Atom atom, int dx, int dy)
          Move an atom in the plane of the screen.
 void paint()
          Paint the rendered image into the screen.
 DynamicArray peekSelection(int i)
          Peek a selection on the stack.
 DynamicArray popSelection()
          Pop a selection from the selection stack.
 void printMatrix()
          Print the matrix out.
 void pushSelection(DynamicArray atoms)
          Push a selection onto the stack.
 void readMap(Map map)
          Read the maps that we are displaying.
 void readMaps()
           
 void reExecute()
           
 void removeAllAngles()
          Remove all the angles.
 void removeAllBumpAtoms()
          Remove all bump atoms.
 void removeAllDistances()
          Remove all the distance monitors.
 void removeAllLabelledAtoms()
          Remove all labelled atoms.
 void removeAllSelectedAtoms()
          Remove all selected atoms.
 void removeAllTorsions()
          Remove all the torsion monitors.
 void removeContourLevels()
          Remove the displayed maps.
 void removeGraphicalObjects(java.lang.String prefix)
           
 void removeGraphicalObjectsBeginningWith(java.lang.String prefix)
           
 void removeMap(Map map)
           
 void removeMap(java.lang.String pattern)
          Remove maps.
 void removeMaps()
          Remove the maps rather than the contour levels.
 void removeMolecule(java.lang.String pattern)
          Remove a molecule.
 void removeMoleculeByName(java.lang.String pattern)
          Remove a molecule.
 void removeMoleculeRendererListener(MoleculeRendererListener l)
          Remove a MoleculeRendererListener.
 void removeSpaceGroup()
          Remove the stored space group information.
 void removeSymmetry()
          Remove the symmetry molecule if there is one.
 void repaint()
           
 void reset()
          Remove everything from the renderer.
 void resetContourLevels()
          Reset the contour levels.
 void resetTransformationMatrix()
          Reset the transformation matrix.
 void resetView()
          Reset the view of the renderer.
 void resetWideBonds()
          Reset the wide bonds flags.
 void setAtomLabelFormat(java.lang.String s)
          Set the label format that is used for atoms on screen.
 void setBumpInSameMolecule(boolean b)
           
 void setCenter(double x, double y, double z)
          Set the center for the renderer.
 void setCenter(DynamicArray selectedAtoms)
          Set the center from a set of atoms.
 void setCenter(Point3d newCenter)
           
 void setCenter(Point3d newCenter, boolean setClipping)
          Set the center for the renderer.
 void setClip(double distance)
          Set the clip distance allowing for minimum clip distance.
 void setContourSize(int cs)
           
 void setDisplayAtomLabel(boolean b)
          Set whether we should display the atom label.
 void setDisplayBumps(boolean state)
          Set whether we display bumps.
 void setDisplayDistances(boolean d)
          Set the distance display flag.
 void setDisplayMaps(boolean state)
          Should we display maps.
 void setDisplaySolvent(boolean state)
          Set whether we display solvent.
 void setDisplayStatusString(boolean b)
          Should we display status strings.
 void setMapContourColour(java.lang.String name, int contour, int colour)
          Change the value of a contour level.
 void setMapContourDisplayed(java.lang.String name, int contour, int visible)
          Turn contour level on/off of a contour level.
 void setMapContourLevel(java.lang.String name, int contour, double level)
          Change the value of a contour level.
 void setMapContourLineWidth(java.lang.String name, int contour, double w)
          Change the line width.
 void setMapContourTransparency(java.lang.String name, int contour, int t)
          Change the line width.
 int setMoleculeVariable(java.lang.String pattern, java.lang.String name, java.lang.String value)
           
 int setMoleculeVisibility(java.lang.String pattern, java.lang.String action)
          Change molecule visibility.
 void setPickMode(int pick)
          Set the picking mode.
 void setRadius(double radius)
          Set the radius allowing for minimum value for renderer.
 void setSelectCount(boolean b)
          Set whether or not we print select counts.
 void setSelected(DynamicArray selection)
          Set the specified atoms as selected.
 void setSelected(DynamicArray selection, boolean exclude)
          Set the specified atoms as selected.
 void setStatusAtom(Atom a)
          Set the atom that will produce the status label.
 void setStatusLabelFormat(java.lang.String s)
          Set the status label format.
 void setSymmetry(boolean state)
          Set whether we display symmetry.
 void setupContourLevels(java.lang.String contourLevels)
          Setup the contour levels from the passed string.
 void setWideBonds()
          Set which bonds are drawn wide.
 void setWideBonds(DynamicArray selectedAtoms)
          Set wide bonds for the atoms in the selection.
 void swapAxes(Point3d p, Map map)
          Map the point coordinates back into the map ordering.
 void transformContourPoints(Map map, Tmesh contour)
          Transform the contour points into real space.
 void transformMolecule()
          Apply the current transform to the molecule.
 void translateCenter(int dx, int dy)
          Translate the center of the view.
 void writeMoleculeToFile(Molecule mol, java.lang.String fileString, boolean debugConnect, java.lang.String type)
          Write the molecule to the specified file.
 java.lang.String writeMoleculeToUrl(Molecule mol, java.lang.String urlString, boolean debugConnect, java.lang.String type, java.lang.String parameterName)
          Write the molecule to the url.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

renderer

public Renderer renderer
The Renderer that will do the work.


moleculeViewer

public transient MoleculeViewer moleculeViewer
The moleucle viewer class that we are drawing for.


groups

public java.util.Hashtable groups
The set of defined groups.


NORMAL_PICK

public static int NORMAL_PICK
Normal picking mode.


DISTANCE_PICK

public static int DISTANCE_PICK
Distance picking mode.


ANGLE_PICK

public static int ANGLE_PICK
Angle picking mode.


TORSION_PICK

public static int TORSION_PICK
Angle picking mode.


pickMode

public int pickMode
The current pick mode.


debug

public boolean debug
Are we debugging.


contourSize

public int contourSize
The current contour grid size. The number of grid points we contour around the map center.


hersheyFonts

public boolean hersheyFonts

pickedAtoms

public DynamicArray pickedAtoms
The list of atoms that have been picked so far.


displayAsCylinders

public boolean displayAsCylinders

shadows

public boolean shadows
Are shadows on.


dirty

public boolean dirty
Has something changed the scene.


lastScriptFile

public java.lang.String lastScriptFile
The last script we executed.

Constructor Detail

MoleculeRenderer

public MoleculeRenderer()
Default constructor.

Method Detail

repaint

public void repaint()

setContourSize

public void setContourSize(int cs)

setPickMode

public void setPickMode(int pick)
Set the picking mode.


setSelectCount

public void setSelectCount(boolean b)
Set whether or not we print select counts.


getSelectCount

public boolean getSelectCount()
Return whether we are printing select counts.


handleDeleteCommand

public void handleDeleteCommand(DynamicArray selectedAtoms)
Handle a delete atoms command.


handleEditCommand

public void handleEditCommand(java.lang.String name,
                              java.lang.String value,
                              DynamicArray selectedAtoms)
Handle an atom edit command.


deleteAtom

public void deleteAtom(Atom atom)
Actually delete an atom.


handlePick

public void handlePick(Atom pickedAtom)
Handle a pick on the screen and label the appropriate item.


handleUpdateCommand

public void handleUpdateCommand(Arguments args,
                                FloatArray fa)
Handle a command that updates the properties of atoms.


handleMapCommand

public void handleMapCommand(java.lang.String name,
                             Arguments args)
Interpret a new style map command.


handleUserCommand

public void handleUserCommand(java.lang.String command,
                              Arguments args)
                       throws java.lang.Throwable
Handle a user command. These are of the form user -class classname [args]; The method will load the class and then pass the argument object to it and the moleculeViewer instance.

Throws:
java.lang.Throwable

handleWriteCommand

public void handleWriteCommand(Arguments args)
Interpret a molecule write command. write -file 'filename' -url 'urlname' -molecule 'molecule_name' ;


writeMoleculeToFile

public void writeMoleculeToFile(Molecule mol,
                                java.lang.String fileString,
                                boolean debugConnect,
                                java.lang.String type)
Write the molecule to the specified file.


writeMoleculeToUrl

public java.lang.String writeMoleculeToUrl(Molecule mol,
                                           java.lang.String urlString,
                                           boolean debugConnect,
                                           java.lang.String type,
                                           java.lang.String parameterName)
Write the molecule to the url. This uses the POST method to communicate with the server. The additional parameters are stripped off and sent along with the pdb file, which is appended as the pdb=.... parameter. This uses the POST implementation described in 'Dodge the traps hiding in the URLConnection class' http://www.javaworld.com/javaworld/jw-03-2001/jw-0323-traps.html I would suggest not changing anything to do with the URLConnection methods unless you know much more about this than I do.


handleDistanceCommand

public void handleDistanceCommand(Arguments args)
Handle a distance command.


handleHbondCommand

public void handleHbondCommand(Arguments args)
Handle a hydrogen bond command.


calculateHbonds

public void calculateHbonds(DynamicArray atoms,
                            Arguments args)
Calculate hydrogen bonds.


hbondEnergy

public static double hbondEnergy(Atom n,
                                 Point3d h,
                                 Atom o,
                                 Atom c,
                                 double fq1q2)
Calculate the energy of an hbond as defined in Kabsch and Sander, 'Dictionary of Protein Secondary Structure: Pattern Recognition of Hydrogen-Bonded and Geometrical Features', Biopolymers, 22, 2577-2637 (1983).


handleTextureCommand

public void handleTextureCommand(Arguments args)
Interpret a texture command.


handleLightCommand

public void handleLightCommand(int l,
                               Arguments args)
Handle a light command.


handleObjectCommand

public void handleObjectCommand(java.lang.String namePattern,
                                Arguments args)
Handle an object command.


mapAtomColors

public void mapAtomColors(Tmesh tmesh,
                          DynamicArray mapAtoms,
                          int defaultColor,
                          double dmax,
                          double wmax)
Map the colors of a set of atoms to the object.


initialise

public void initialise()
Initialise the MoleculeRenderer.


setStatusLabelFormat

public void setStatusLabelFormat(java.lang.String s)
Set the status label format.


getStatusLabelFormat

public java.lang.String getStatusLabelFormat()
Get the status label format.


setStatusAtom

public void setStatusAtom(Atom a)
Set the atom that will produce the status label.


setDisplayStatusString

public void setDisplayStatusString(boolean b)
Should we display status strings.


setRadius

public void setRadius(double radius)
Set the radius allowing for minimum value for renderer.


setClip

public void setClip(double distance)
Set the clip distance allowing for minimum clip distance.


removeGraphicalObjectsBeginningWith

public void removeGraphicalObjectsBeginningWith(java.lang.String prefix)

removeGraphicalObjects

public void removeGraphicalObjects(java.lang.String prefix)

addGraphicalObject

public void addGraphicalObject(Tmesh object)

setupContourLevels

public void setupContourLevels(java.lang.String contourLevels)
Setup the contour levels from the passed string.


setSymmetry

public void setSymmetry(boolean state)
Set whether we display symmetry.


removeSpaceGroup

public void removeSpaceGroup()
Remove the stored space group information.


addMoleculeRendererListener

public void addMoleculeRendererListener(MoleculeRendererListener l)
Add a MoleculeRendererListener.


removeMoleculeRendererListener

public void removeMoleculeRendererListener(MoleculeRendererListener l)
Remove a MoleculeRendererListener.


fireMoleculeAddedEvent

public void fireMoleculeAddedEvent(Molecule molecule)
Fire a molecule added event.


fireMoleculeRemovedEvent

public void fireMoleculeRemovedEvent(Molecule molecule)
Fire a molecule removed event.


fireGenericAddedEvent

public void fireGenericAddedEvent(Generic generic)
Fire a distance added event.


fireGenericRemovedEvent

public void fireGenericRemovedEvent(Generic generic)
Fire a generic removed event.


fireMapAddedEvent

public void fireMapAddedEvent(Map map)
Fire a map added event.


fireMapRemovedEvent

public void fireMapRemovedEvent(Map map)
Fire a map added event.


fireAtomSelectedEvent

public void fireAtomSelectedEvent(Atom atom)
Fire an atom selected event.


addMolecule

public void addMolecule(Molecule molecule)
Add a molecule to the scene.


addMolecule

public void addMolecule(java.lang.String filename,
                        java.lang.String name)
Add a molecule to the scene.


getMoleculeCount

public int getMoleculeCount()
Return the total number of molecules.


getMolecule

public Molecule getMolecule(int i)
Return the specified molecule.


getMolecule

public Molecule getMolecule(java.lang.String name)
Return the first molecule that matches the specified name.


getMolecules

public DynamicArray getMolecules()
Return the DynamicArray of molecules.


removeMoleculeByName

public void removeMoleculeByName(java.lang.String pattern)
Remove a molecule.


removeMolecule

public void removeMolecule(java.lang.String pattern)
Remove a molecule.


moleculeMatches

public boolean moleculeMatches(java.lang.String pattern,
                               Molecule mol)

getNextMoleculeName

public java.lang.String getNextMoleculeName()
Return the name for the next molecule.


removeMap

public void removeMap(java.lang.String pattern)
Remove maps.


removeMap

public void removeMap(Map map)

addMap

public void addMap(Map map)
Add a map to the scene.


getNextMapName

public java.lang.String getNextMapName()
Return the name for the next molecule.


setMapContourTransparency

public void setMapContourTransparency(java.lang.String name,
                                      int contour,
                                      int t)
Change the line width.


setMapContourLineWidth

public void setMapContourLineWidth(java.lang.String name,
                                   int contour,
                                   double w)
Change the line width.


setMapContourLevel

public void setMapContourLevel(java.lang.String name,
                               int contour,
                               double level)
Change the value of a contour level.


setMapContourColour

public void setMapContourColour(java.lang.String name,
                                int contour,
                                int colour)
Change the value of a contour level.


setMapContourDisplayed

public void setMapContourDisplayed(java.lang.String name,
                                   int contour,
                                   int visible)
Turn contour level on/off of a contour level.


getMapCount

public int getMapCount()
Return the total count of maps.


getMap

public Map getMap(int i)
Return the specified map.


getMap

public Map getMap(java.lang.String name)
Return the specified map from its name.


getMaps

public DynamicArray getMaps(java.lang.String name)
Return the specified map from its name.


getResidueIterator

public ResidueIterator getResidueIterator()
Get a residue iterator.


getBondIterator

public BondIterator getBondIterator()
Get a bond iterator.


getAtomIterator

public AtomIterator getAtomIterator()
Get a atom iterator.


setDisplayAtomLabel

public void setDisplayAtomLabel(boolean b)
Set whether we should display the atom label.


addLabelledAtom

public void addLabelledAtom(Atom atom)
Add a labelled atom.


labelledAtomsContains

public boolean labelledAtomsContains(Atom atom)
Do we already have a label for this atom.


addSelectedAtom

public void addSelectedAtom(Atom atom)
Add a selected atom.


addBumpPair

public void addBumpPair(Atom atom1,
                        Atom atom2)
Add a pair of bump atoms.


generateBumps

public void generateBumps(Atom atom)
Generate the bump atoms around the specified atom.


generateBumps

public void generateBumps(DynamicArray bumpAtoms)
Generate bumps for the specified set of atoms.


addDistance

public void addDistance(Distance d)
Add a distance monitor to the list.


getDistanceCount

public int getDistanceCount()
Return how many distances.


getDistance

public Distance getDistance(int i)
Return a specific distance.


addDistanceBetweenSelectedAtoms

public void addDistanceBetweenSelectedAtoms()
Add a distance monitor between the selected atoms.


addDistance

public void addDistance(Atom firstAtom,
                        Atom secondAtom)
Add a pair of atoms to the distance list.


addDistance2

public void addDistance2(Atom firstAtom,
                         Atom secondAtom)
Add a pair of atoms to the distance list.


addAngle

public void addAngle(Atom firstAtom,
                     Atom secondAtom,
                     Atom thirdAtom)
Add a set of atoms to the angle list.


addTorsion

public void addTorsion(Atom firstAtom,
                       Atom secondAtom,
                       Atom thirdAtom,
                       Atom fourthAtom)
Add a set of atoms to the angle list.


reset

public void reset()
Remove everything from the renderer.


removeAllAngles

public void removeAllAngles()
Remove all the angles.


removeAllDistances

public void removeAllDistances()
Remove all the distance monitors.


removeAllTorsions

public void removeAllTorsions()
Remove all the torsion monitors.


removeAllLabelledAtoms

public void removeAllLabelledAtoms()
Remove all labelled atoms.


removeAllSelectedAtoms

public void removeAllSelectedAtoms()
Remove all selected atoms.


removeAllBumpAtoms

public void removeAllBumpAtoms()
Remove all bump atoms.


getBumpAtoms

public DynamicArray getBumpAtoms()
Get the bump atoms.


generateSymmetry

public Molecule generateSymmetry(Point3d center,
                                 double radius)
Generate symmetry for the molecules we are displaying.


generateSymmetryMolecule

public Molecule generateSymmetryMolecule(Point3d center,
                                         double radius)
Acutally generate the symmetry atoms.


addSymmetryAtoms

public void addSymmetryAtoms(Molecule molecule,
                             Point3d center,
                             double radius,
                             Matrix transform,
                             Molecule symmetryMolecule)
Add the symmetry atoms that overlap.


getAtomCount

public int getAtomCount()
Return the total number of atoms in the renderer.


setMoleculeVariable

public int setMoleculeVariable(java.lang.String pattern,
                               java.lang.String name,
                               java.lang.String value)

setMoleculeVisibility

public int setMoleculeVisibility(java.lang.String pattern,
                                 java.lang.String action)
Change molecule visibility.


expandSelection

public void expandSelection(Molecule molecule,
                            int[] inSphere)
Expand the selected atoms to include the whole residue.


expandSelection1

public void expandSelection1(Molecule molecule,
                             int[] inSphere)
Expand the selected atoms to include the whole residue.


determineSymmetry

public void determineSymmetry()
Determine the set of symmetry operators.


handleSelectionCommand

public void handleSelectionCommand(java.lang.String command,
                                   Arguments args)
Handle a selection stack command.


pushSelection

public void pushSelection(DynamicArray atoms)
Push a selection onto the stack.


popSelection

public DynamicArray popSelection()
Pop a selection from the selection stack.


peekSelection

public DynamicArray peekSelection(int i)
Peek a selection on the stack.


getAtomsInSelection

public DynamicArray getAtomsInSelection(java.lang.String expression)
Evaluate a selection expression.


getAtomsInResidue

public DynamicArray getAtomsInResidue(java.lang.String residueSpecification)
Return the atoms in a particular residue.


getAtomsInSphere

public DynamicArray getAtomsInSphere(Point3d c,
                                     double r)
Return the atoms in the specified sphere.


getAtomsAroundSelection

public DynamicArray getAtomsAroundSelection(DynamicArray selection,
                                            double radius,
                                            boolean include)
Return atoms in a shell around the specified selection.


getAtomsInLigands

public void getAtomsInLigands(DynamicArray selectedAtoms)
Get atoms that are part of ligands.


getAtomsInLigands

public DynamicArray getAtomsInLigands()
Wrapper around getAtomsInLigands.


getSelectedAtomCount

public int getSelectedAtomCount()
Return the number of selected atoms.


getSelectedAtoms

public DynamicArray getSelectedAtoms()
Return the atoms that are currently selected.


getLabelledAtoms

public DynamicArray getLabelledAtoms()
Return the atoms that are currently labelled.


getSelectedOrLabelledAtoms

public DynamicArray getSelectedOrLabelledAtoms()
Return the atoms that are currently labelled or selected.


getSomeAtoms

public DynamicArray getSomeAtoms(boolean selected,
                                 boolean labelled)
Return the atoms that are currently labelled.


getSelectedResidues

public DynamicArray getSelectedResidues()
Return the residues that are currently selected.


setSelected

public void setSelected(DynamicArray selection)
Set the specified atoms as selected.


setSelected

public void setSelected(DynamicArray selection,
                        boolean exclude)
Set the specified atoms as selected.


getCenter

public Point3d getCenter(DynamicArray selection)
Return the geometric center of the atoms in the selection.


getRadius

public double getRadius(DynamicArray selection)
Return the radius of the atoms in the selection.


getRadius

public double getRadius(DynamicArray selection,
                        Point3d center)
Return the radius of the atoms in the selection.


resetWideBonds

public void resetWideBonds()
Reset the wide bonds flags.


inSameplanarRing

public boolean inSameplanarRing(Atom atom1,
                                Atom atom2)
Are the two atoms in the same planar ring.


setCenter

public void setCenter(double x,
                      double y,
                      double z)
Set the center for the renderer.


setCenter

public void setCenter(Point3d newCenter)

setCenter

public void setCenter(Point3d newCenter,
                      boolean setClipping)
Set the center for the renderer.


setCenter

public void setCenter(DynamicArray selectedAtoms)
Set the center from a set of atoms.


generateMaps

public void generateMaps()
Generate the map display.


removeContourLevels

public void removeContourLevels()
Remove the displayed maps.


removeMaps

public void removeMaps()
Remove the maps rather than the contour levels.


setDisplayMaps

public void setDisplayMaps(boolean state)
Should we display maps.


setDisplayBumps

public void setDisplayBumps(boolean state)
Set whether we display bumps.


setBumpInSameMolecule

public void setBumpInSameMolecule(boolean b)

setDisplayDistances

public void setDisplayDistances(boolean d)
Set the distance display flag.


getDisplayDistances

public boolean getDisplayDistances()
Return the distance display flag.


getDisplayBumps

public boolean getDisplayBumps()
Return the state of bump display.


setDisplaySolvent

public void setDisplaySolvent(boolean state)
Set whether we display solvent.


setWideBonds

public void setWideBonds()
Set which bonds are drawn wide.


getBondsInSelection

public DynamicArray getBondsInSelection(DynamicArray selectedAtoms)
Return bonds where both atoms are in selectedAtoms.


setWideBonds

public void setWideBonds(DynamicArray selectedAtoms)
Set wide bonds for the atoms in the selection.


addContourLevel

public void addContourLevel(double level,
                            int color,
                            boolean display,
                            int style)
Add a contour level.


resetContourLevels

public void resetContourLevels()
Reset the contour levels.


generateSymmetry

public void generateSymmetry()
Generate the symmetry copies of the molecules.


removeSymmetry

public void removeSymmetry()
Remove the symmetry molecule if there is one.


assignSymmetryAtomColors

public void assignSymmetryAtomColors(Molecule molecule)
Assign atom colors.


readMap

public void readMap(Map map)
Read the maps that we are displaying.


readMaps

public void readMaps()

contourMaps

public void contourMaps()
Contour the maps that we are displaying.


getContourGraphicalObjectName

public java.lang.String getContourGraphicalObjectName(Map map,
                                                      int contour)
Get name of contour for particular map.


getContourGraphicalObject

public Tmesh getContourGraphicalObject(Map map,
                                       int contour)
Get tmesh of contour for particular map.


contourMap

public void contourMap(Map map,
                       int contour)
Generate one specific contour level for the map.


determineRegion

public void determineRegion(Map map)
Figure out the region of the map we will contour.


contourRegion

public Tmesh contourRegion(Map map,
                           int contourNumber,
                           int style)
Contour the data that is in stored in the map.


clipContour

public void clipContour(Tmesh contour,
                        double radius)
Clip the contour object to the molecule.


transformContourPoints

public void transformContourPoints(Map map,
                                   Tmesh contour)
Transform the contour points into real space.


swapAxes

public void swapAxes(Point3d p,
                     Map map)
Map the point coordinates back into the map ordering.


clipMaps

public void clipMaps()
Clip around center point.


clipMaps

public void clipMaps(java.lang.String namePattern,
                     DynamicArray selection,
                     boolean inside)
Clip any maps we are displaying to show only unoccupied density.


clipMap

public void clipMap(Map map,
                    DynamicArray selection,
                    boolean inside)
Clip this map.


clipped

public boolean clipped(Point3d p,
                       DynamicArray selection)
Is this point inside an atom in the molecule.


paint

public void paint()
Paint the rendered image into the screen.


drawMaps

public void drawMaps()

drawMap

public void drawMap(Map map)

initialiseCenter

public void initialiseCenter()
Figure out the molecule center and scale to make it just fit.


resetTransformationMatrix

public void resetTransformationMatrix()
Reset the transformation matrix.


resetView

public void resetView()
Reset the view of the renderer.


printMatrix

public void printMatrix()
Print the matrix out.


transformMolecule

public void transformMolecule()
Apply the current transform to the molecule.


drawMolecules

public void drawMolecules()
Draw the molecule.


drawTrace

public void drawTrace(Molecule molecule)
Draw the molecule as a trace.


drawDistances

public void drawDistances()
Draw the distance markers.


drawDistanceObject

public void drawDistanceObject(Distance distance)
Draw the specific distance. The dash on and off values are adjusted to give a half off gap at each end of the line.


drawDashedLine

public void drawDashedLine(double ax,
                           double ay,
                           double az,
                           double bx,
                           double by,
                           double bz,
                           double on,
                           double off,
                           double radius,
                           int color)
Draw the distance marker line.


drawDistances2

public void drawDistances2()
Draw the distance markers.


drawTorsions

public void drawTorsions()
Draw the angle markers.


drawTorsion

public void drawTorsion(Atom a1,
                        Atom a2,
                        Atom a3,
                        Atom a4)
Draw a torsion marker. Very simple initial implementation.


drawAngles

public void drawAngles()
Draw the angle markers.


drawAngle

public void drawAngle(Atom a1,
                      Atom a2,
                      Atom a3)
Draw an angle marker. Very simple initial implementation.


drawBumpPairs

public void drawBumpPairs()
Draw the bump atoms.


drawDistance

public void drawDistance(Atom atom1,
                         Atom atom2,
                         boolean displayDistance)
Draw a distance between two atoms.


drawDottedLine

public void drawDottedLine(Atom atom1,
                           Atom atom2,
                           double gap,
                           int color)
Draw a dotted line.


drawTwinColourDottedLine

public void drawTwinColourDottedLine(Atom atom1,
                                     Atom atom2,
                                     double gap,
                                     int color1,
                                     int color2)
Draw a dotted line.


drawLabelledAtoms

public void drawLabelledAtoms()
Draw all of the labelled atoms.


setAtomLabelFormat

public void setAtomLabelFormat(java.lang.String s)
Set the label format that is used for atoms on screen.


getAtomLabelFormat

public java.lang.String getAtomLabelFormat()
Get the atom label format.


generateAtomLabel

public java.lang.String generateAtomLabel(Atom atom)
Generate the atom label.


generateAtomLabels

public void generateAtomLabels(java.lang.String format,
                               DynamicArray selectedAtoms)
Generate an atom label according to the format statments.


drawAtom

public void drawAtom(Atom atom,
                     int crossPixels)
Draw one atom.


drawBond

public void drawBond(Bond bond,
                     double w)
Draw one bond.


displayBondTypes

public void displayBondTypes(boolean b)
Set whether or not we display bond types.


getNearestAtom

public Atom getNearestAtom(int x,
                           int y)
Find atom with screen coordinates nearest to the specified point.


moveAtom

public void moveAtom(Atom atom,
                     int dx,
                     int dy)
Move an atom in the plane of the screen.


translateCenter

public void translateCenter(int dx,
                            int dy)
Translate the center of the view.


colorByChain

public void colorByChain()
Color by chain.


colorByAtom

public void colorByAtom()
Color by atom type.


colorBySpecifiedColor

public void colorBySpecifiedColor(int color)
Color by bFactor.


colorByBFactor

public void colorByBFactor()
Color by bFactor. This method uses a fixed range to set the b-factor colors as the absolute value has meaning.


ensureColorRampDefined

public void ensureColorRampDefined()

colorByPropertyRange

public void colorByPropertyRange(int property)
Color by b-factor but bin the colors according to range.


colorByRainbow

public void colorByRainbow(DynamicArray selectedAtoms)
Color a set of atoms with rainbow hue. Rainbow goes from blue to red.


handleSlideCommand

public void handleSlideCommand(Arguments args)
Handle a slide command.


execute2

public void execute2(java.lang.String command)
Main interface for command processing. Not used... the below stack based method is used now.


execute22

public void execute22(java.lang.String command)

execute

public void execute(java.lang.String command)

executeInternal

public void executeInternal(java.lang.String command)

reExecute

public void reExecute()

executeScript

public void executeScript(java.lang.String filename)
Execute a script of commands.