• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kalzium

Avogadro::BondCentricTool

Avogadro::BondCentricTool Class Reference

#include <bondcentrictool.h>

Inheritance diagram for Avogadro::BondCentricTool:

Inheritance graph
[legend]

List of all members.


Detailed Description

Bond Centric Molecule Manipulation Tool.

Author:
Shahzad Ali, Ross Braithwaite, James Bunt
This class is a molecule manipulation system based on bond-centric design as apposed to points in free space design. It is based off the NavigationTool class by Marcus D. Hanwell.

Definition at line 63 of file bondcentrictool.h.


Public Slots

void showAnglesChanged (int state)
void snapToAngleChanged (int newAngle)
void snapToCheckBoxChanged (int state)

Public Member Functions

 BondCentricTool (QObject *parent=0)
virtual bool paint (GLWidget *widget)
virtual void readSettings (QSettings &settings)
void setMolecule (Molecule *molecule)
virtual QWidget * settingsWidget ()
virtual int usefulness () const
virtual void writeSettings (QSettings &settings) const
virtual ~BondCentricTool ()
Description methods
virtual QString description () const
virtual QString name () const
Tool Methods
virtual QUndoCommand * mouseMove (GLWidget *widget, const QMouseEvent *event)
virtual QUndoCommand * mousePress (GLWidget *widget, const QMouseEvent *event)
virtual QUndoCommand * mouseRelease (GLWidget *widget, const QMouseEvent *event)
virtual QUndoCommand * wheel (GLWidget *widget, const QWheelEvent *event)

Protected Member Functions

void clearData ()
Eigen::Vector3d performRotation (double angle, Eigen::Vector3d rotationVector, Eigen::Vector3d centerVector, Eigen::Vector3d positionVector)
Construction Plane/Angles Methods
Eigen::Vector3d * calculateSnapTo (Bond *bond, Eigen::Vector3d *referencePoint, double maximumAngle)
void drawAngles (GLWidget *widget, Atom *atom, Bond *bond)
void drawAngleSector (GLWidget *widget, Eigen::Vector3d origin, Eigen::Vector3d direction1, Eigen::Vector3d direction2, bool alternateAngle=false)
void drawAtomAngles (GLWidget *widget, Atom *atom)
void drawDihedralAngle (GLWidget *widget, Atom *A, Atom *D, Bond *BC, bool alternateAngle=false)
void drawDihedralAngles (GLWidget *widget, Atom *A, Bond *BC)
void drawDihedralRectangle (GLWidget *widget, Bond *bond, Atom *atom, double rgb[3])
void drawDihedralRectanglesOfAtom (GLWidget *widget, Bond *bond, Atom *atom, double rgb[3])
void drawManipulationRectangle (GLWidget *widget, Bond *bond, Eigen::Vector3d *referencePoint, double rgb[3])
void drawSingleDihedralAngles (GLWidget *widget, Atom *A, Bond *BC)
void drawSkeletonAngles (GLWidget *widget, SkeletonTree *skeleton)
void drawSphere (GLWidget *widget, const Eigen::Vector3d &center, double radius, float alpha)
bool isAtomInBond (Atom *atom, Bond *bond)

Protected Attributes

Atom * m_clickedAtom
Bond * m_clickedBond
Eigen::Vector3d * m_currentReference
Eigen::Vector3d * m_directionVector
QPoint m_lastDraggingPosition
QGridLayout * m_layout
bool m_leftButtonPressed
bool m_midButtonPressed
Molecule * m_molecule
bool m_movedSinceButtonPressed
Eigen::Vector3d * m_referencePoint
bool m_rightButtonPressed
Bond * m_selectedBond
QWidget * m_settingsWidget
bool m_showAngles
QCheckBox * m_showAnglesBox
SkeletonTree * m_skeleton
bool m_snapped
int m_snapToAngle
QSpinBox * m_snapToAngleBox
QLabel * m_snapToAngleLabel
QCheckBox * m_snapToCheckBox
bool m_snapToEnabled
QLabel * m_spacer
ToolGroup * m_toolGroup
QUndoCommand * m_undo

Constructor & Destructor Documentation

Avogadro::BondCentricTool::BondCentricTool ( QObject *  parent = 0  ) 

Constructor.

Definition at line 65 of file bondcentrictool.cpp.

Avogadro::BondCentricTool::~BondCentricTool (  )  [virtual]

Deconstructor.

Definition at line 100 of file bondcentrictool.cpp.


Member Function Documentation

Eigen::Vector3d * Avogadro::BondCentricTool::calculateSnapTo ( Bond *  bond,
Eigen::Vector3d *  referencePoint,
double  maximumAngle 
) [protected]

Calculates whether the manipulation plane is close enough to any atoms (that are 1 bond away from either of the atoms attached to the given bond) to 'snap-to' them.

NOTE: Any atoms that lie along the same line as the bond are disregarded in the calculations otherwise the plane would always try snap-to them as their angle is 0.

Parameters:
bond The bond through which the manipulation plane lies.
referencePoint The current reference point that defines the manipulation plane.
maximumAngle The maximum angle between the current reference point and any atom that determines whether or not the plane is close enough to snap-to the atom.
Returns:
A vector representing the closest Atom to the manipulation plane, to be used as the reference point for drawing the plane, if any atom is close enough. If no atom is close enough to 'snap-to', NULL is returned.

Definition at line 1430 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::clearData (  )  [protected]

Clears any data and frees up any memory that is used by the tool.

This procedure should be used when the tool is changed, the molecule cleared, or the program exits etc.

Definition at line 124 of file bondcentrictool.cpp.

virtual QString Avogadro::BondCentricTool::description (  )  const [inline, virtual]

Tool Description (ie. Draws atoms and bonds).

Reimplemented from Avogadro::Tool.

Definition at line 78 of file bondcentrictool.h.

void Avogadro::BondCentricTool::drawAngles ( GLWidget *  widget,
Atom *  atom,
Bond *  bond 
) [protected]

Draws sectors around a given atom representing the angles between neighbouring atoms bonded with this atom and an atom bonded to this atom by a given bond.

Parameters:
widget The widget the angle-sectors will be drawn on.
atom The atom whose angles are being drawn.
bond The bond attached to the given atom that will be used as a reference point for all the angles.
Precondition:
The given atom must be either the begin or end atom of the given bond.

Definition at line 1052 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawAngleSector ( GLWidget *  widget,
Eigen::Vector3d  origin,
Eigen::Vector3d  direction1,
Eigen::Vector3d  direction2,
bool  alternateAngle = false 
) [protected]

Draws a sector that shows the angle between two lines from a given origin.

Parameters:
widget The widget this angle-sector will be drawn on.
origin The origin around which this angle is being calculated.
direction1 A vector that defines the line from the given origin through this point.
direction2 A vector that defines the line from the given origin through this second point.

Definition at line 959 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawAtomAngles ( GLWidget *  widget,
Atom *  atom 
) [protected]

Draws sectors around a given atom representing the angles between neighbouring atoms bonded with this atom.

Parameters:
widget The widget the angle-sectors will be drawn on.
atom The atom whose angles are being drawn.

Definition at line 1025 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawDihedralAngle ( GLWidget *  widget,
Atom *  A,
Atom *  D,
Bond *  BC,
bool  alternateAngle = false 
) [protected]

Definition at line 1130 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawDihedralAngles ( GLWidget *  widget,
Atom *  A,
Bond *  BC 
) [protected]

Definition at line 1175 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawDihedralRectangle ( GLWidget *  widget,
Bond *  bond,
Atom *  atom,
double  rgb[3] 
) [protected]

Definition at line 1586 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawDihedralRectanglesOfAtom ( GLWidget *  widget,
Bond *  bond,
Atom *  atom,
double  rgb[3] 
) [protected]

Definition at line 1674 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawManipulationRectangle ( GLWidget *  widget,
Bond *  bond,
Eigen::Vector3d *  referencePoint,
double  rgb[3] 
) [protected]

Draws a rectangle through a bond that can be used as a construction plane to manipulate the bond itself, or the atoms at either end of the bond.

Parameters:
widget The widget the rectangle will be drawn on.
bond The bond through which the rectangle will be drawn.
referencePoint A point orthagonal to the bond that defines the plane the rectangle will be drawn on.
rgb An array of doubles representing the red/green/blue values of the color for the rectangle.

Definition at line 1544 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawSingleDihedralAngles ( GLWidget *  widget,
Atom *  A,
Bond *  BC 
) [protected]

Definition at line 1289 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawSkeletonAngles ( GLWidget *  widget,
SkeletonTree *  skeleton 
) [protected]

Draws sectors around the root Atom of a given SkeletonTree based on the root Bond of the tree and whether or not adjacent Atoms form a part of the skeleton or not.

Parameters:
widget The widget the angle-sectors will be drawn on.
skeleton The SkeletonTree whose root Atom's angles are to be drawn.

Definition at line 1088 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::drawSphere ( GLWidget *  widget,
const Eigen::Vector3d &  center,
double  radius,
float  alpha 
) [protected]

Draws a sphere of a given radius around a given vector.

Parameters:
widget The widget the sphere will be drawn on.
center The center of the sphere.
radius The radius of the sphere.
alpha The alpha value that determines the opacity of the sphere.

Definition at line 1709 of file bondcentrictool.cpp.

bool Avogadro::BondCentricTool::isAtomInBond ( Atom *  atom,
Bond *  bond 
) [protected]

Methods used to construct and draw the angle-sectors, the construction plane, and the rotation-sphere.

Checks whether a given atom is at either end of a given bond.

Parameters:
atom The atom that is being examined for membership of the given bond.
bond The bond that is being examined to see if the given atom is attached to it.
Returns:
True if the given atom is the begin or end atom of the given bond, false otherwise, or if either of the pointers point to NULL.

Definition at line 944 of file bondcentrictool.cpp.

QUndoCommand * Avogadro::BondCentricTool::mouseMove ( GLWidget *  widget,
const QMouseEvent *  event 
) [virtual]

Response to mouse movement.

Parameters:
widget the GLWidget where the even occurred
event the mouse event information

Implements Avogadro::Tool.

Definition at line 432 of file bondcentrictool.cpp.

QUndoCommand * Avogadro::BondCentricTool::mousePress ( GLWidget *  widget,
const QMouseEvent *  event 
) [virtual]

Callback methods for ui.actions on the canvas.

Implements Avogadro::Tool.

Definition at line 190 of file bondcentrictool.cpp.

QUndoCommand * Avogadro::BondCentricTool::mouseRelease ( GLWidget *  widget,
const QMouseEvent *  event 
) [virtual]

Response to mouse release.

Parameters:
widget the GLWidget where the even occurred
event the mouse event information

Implements Avogadro::Tool.

Definition at line 396 of file bondcentrictool.cpp.

virtual QString Avogadro::BondCentricTool::name (  )  const [inline, virtual]

Tool Name (ie Draw).

Implements Avogadro::Tool.

Definition at line 76 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::paint ( GLWidget *  widget  )  [virtual]

Called by the GLWidget allowing overlay painting by the tool.

Tools get painted last in the overall scheme.

Parameters:
widget the GLWidget to paint to

Reimplemented from Avogadro::Tool.

Definition at line 829 of file bondcentrictool.cpp.

Eigen::Vector3d Avogadro::BondCentricTool::performRotation ( double  angle,
Eigen::Vector3d  rotationVector,
Eigen::Vector3d  centerVector,
Eigen::Vector3d  positionVector 
) [protected]

Performs a rotation on a vector.

Parameters:
angle The angle to rotate by in radians.
rotationVector The Vector3d to rotate around, must be a unit vector.
centerVector The Vector3d postion around which to rotate.
postionVector The Vector3d postion of the vector to rotate.
Returns:
A Vector3d with the final postion after the rotation is performed.
Precondition:
rotationVector must be a unit vector (of length 1).

Definition at line 1720 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::readSettings ( QSettings &  settings  )  [virtual]

Read in the settings that have been saved for the tool instance.

Reimplemented from Avogadro::Tool.

Definition at line 1952 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::setMolecule ( Molecule *  molecule  )  [virtual]

Functnion to be called when the molecule is changed.

Parameters:
previous The previous Molecule.
next The new Molecule.

Reimplemented from Avogadro::Tool.

Definition at line 145 of file bondcentrictool.cpp.

QWidget * Avogadro::BondCentricTool::settingsWidget (  )  [virtual]

Returns:
the settings widget for the tool.

Reimplemented from Avogadro::Tool.

Definition at line 1806 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::showAnglesChanged ( int  state  )  [slot]

Sets whether or not to show angles.

Parameters:
state The state of the check box relating to whether or not to show angles.
Qt:Checked - show angles. Qt:Unchecked - don't show angles.

Definition at line 1733 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::snapToAngleChanged ( int  newAngle  )  [slot]

Sets the snap-to angle to a given angle in degrees.

Parameters:
newAngle The new value for the snap-to angle.

Definition at line 1776 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::snapToCheckBoxChanged ( int  state  )  [slot]

Sets whether or not snap-to is enabled.

Parameters:
state The state of the check box relating to whether or not snap-to is enabled.
Qt:Checked - enable snap-to. Qt:Unchecked - disable snap-to.

Definition at line 1744 of file bondcentrictool.cpp.

int Avogadro::BondCentricTool::usefulness (  )  const [virtual]

Determines the ordering of the tools.

More useful tools are placed first. It is up to the tool designer to be humble about their usefulness value.

Returns:
usefulness value

Reimplemented from Avogadro::Tool.

Definition at line 183 of file bondcentrictool.cpp.

QUndoCommand * Avogadro::BondCentricTool::wheel ( GLWidget *  widget,
const QWheelEvent *  event 
) [virtual]

Response to mouse wheel movement.

Parameters:
widget the GLWidget where the even occurred
event the mouse wheel event information

Implements Avogadro::Tool.

Definition at line 788 of file bondcentrictool.cpp.

void Avogadro::BondCentricTool::writeSettings ( QSettings &  settings  )  const [virtual]

Write the tool settings so that they can be saved between sessions.

Reimplemented from Avogadro::Tool.

Definition at line 1944 of file bondcentrictool.cpp.


Member Data Documentation

Atom* Avogadro::BondCentricTool::m_clickedAtom [protected]

Definition at line 148 of file bondcentrictool.h.

Bond* Avogadro::BondCentricTool::m_clickedBond [protected]

Definition at line 149 of file bondcentrictool.h.

Eigen::Vector3d* Avogadro::BondCentricTool::m_currentReference [protected]

Definition at line 155 of file bondcentrictool.h.

Eigen::Vector3d* Avogadro::BondCentricTool::m_directionVector [protected]

Definition at line 156 of file bondcentrictool.h.

QPoint Avogadro::BondCentricTool::m_lastDraggingPosition [protected]

Definition at line 173 of file bondcentrictool.h.

QGridLayout* Avogadro::BondCentricTool::m_layout [protected]

Definition at line 180 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_leftButtonPressed [protected]

Definition at line 163 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_midButtonPressed [protected]

Definition at line 164 of file bondcentrictool.h.

Molecule* Avogadro::BondCentricTool::m_molecule [protected]

Definition at line 144 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_movedSinceButtonPressed [protected]

Definition at line 166 of file bondcentrictool.h.

Eigen::Vector3d* Avogadro::BondCentricTool::m_referencePoint [protected]

Definition at line 154 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_rightButtonPressed [protected]

Definition at line 165 of file bondcentrictool.h.

Bond* Avogadro::BondCentricTool::m_selectedBond [protected]

Definition at line 150 of file bondcentrictool.h.

QWidget* Avogadro::BondCentricTool::m_settingsWidget [protected]

Definition at line 145 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_showAngles [protected]

Definition at line 168 of file bondcentrictool.h.

QCheckBox* Avogadro::BondCentricTool::m_showAnglesBox [protected]

Definition at line 177 of file bondcentrictool.h.

SkeletonTree* Avogadro::BondCentricTool::m_skeleton [protected]

Definition at line 152 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_snapped [protected]

Definition at line 158 of file bondcentrictool.h.

int Avogadro::BondCentricTool::m_snapToAngle [protected]

Definition at line 171 of file bondcentrictool.h.

QSpinBox* Avogadro::BondCentricTool::m_snapToAngleBox [protected]

Definition at line 179 of file bondcentrictool.h.

QLabel* Avogadro::BondCentricTool::m_snapToAngleLabel [protected]

Definition at line 175 of file bondcentrictool.h.

QCheckBox* Avogadro::BondCentricTool::m_snapToCheckBox [protected]

Definition at line 178 of file bondcentrictool.h.

bool Avogadro::BondCentricTool::m_snapToEnabled [protected]

Definition at line 169 of file bondcentrictool.h.

QLabel* Avogadro::BondCentricTool::m_spacer [protected]

Definition at line 176 of file bondcentrictool.h.

ToolGroup* Avogadro::BondCentricTool::m_toolGroup [protected]

Definition at line 159 of file bondcentrictool.h.

QUndoCommand* Avogadro::BondCentricTool::m_undo [protected]

Definition at line 161 of file bondcentrictool.h.


The documentation for this class was generated from the following files:
  • bondcentrictool.h
  • bondcentrictool.cpp

kalzium

Skip menu "kalzium"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal