[Kalzium] Qt-4-based Molecular Editor

Benoît Jacob jacob at math.jussieu.fr
Sat Aug 19 19:52:04 CEST 2006


Hi Carsten, Geoff and Donald
 
I haven't had a look yet at avogadro as I'm trying to finish something urgent 
for Eigen today. But, Geoff and Donald, just to help you determine what you 
don't need to do, here are a few things that Kalzium already does:

- efficient rendering of spheres and cylinders. Spheres are achieved 
as "Geospheres", that is, you start with an icosahedron (20 triangular faces) 
and then split each triangle into smaller triangles, and project that back on 
the sphere. That's quite efficient, gives nice-looking spheres without too 
many triangles.
Classes: VertexArray, Sphere, Cylinder
Files: kalziumglhelperclasses.h, .cpp

- rendering of molecules with multiple bonds, in a memory-efficient way. That 
is, if you have 500 atoms, it doesn't generate a complex model. Instead it 
renders 500 times the same unique sphere, with different modelview matrices. 
The same is done for bonds (cylinders). Of course, GL_NORMALIZE is necessary 
for cylinders (for spheres, GL_RESCALE_NORMAL does the job), but that's still 
much better than replicating geometric data. 
Methods of KalziumGLWidget : drawAtom, drawBond, renderScene
Files: kalziumglwidget.h, .cpp

- OpenGL selection using the selection buffer. Uses the same rendering method 
as normal rendering : renderScene.

- As for navigation: it'll come soon, once I've finished some Eigen stuff 
(btw: Eigen is Qt-only, you could use it). But I've got a quite precise idea 
of what I want to do, so here it is:

it'll be 100% mouse-based, and use only the left and right-button (with 
optional support for mouse wheel), so as to be friendly to users of 
laptops/macs where I guess 3rd mouse button is missing. (On macs with 
one-button-mouse, I'm told that a special key emulated right button).

When you click and drag&drop on an atom, it does the following:
- Left button: an arrow pointing from below the camera (think gun in Doom) to 
the clicked atom is drawn. When you move the mouse upwards/downwards, it 
moves the camera closer/farther away from the clicked atom. When you move the 
mouse to the left/right, it twists the arrow and rotates the view around the 
axis of the arrow.
- Right button: two perpendicular arrows are drawn on the clicked atom, mapped 
on a sphere slightly bigger than the atom itself, to suggest rotation around 
that atom. When you move the mouse, it rotates around the atom.

Moreover, when you click on an atom and immediately release the mouse button 
without moving the mouse (two-pixel tolerance added here), it does the 
following:
- Left button: select/deselect the atom (just like items in a multi-selectable 
view).
- Right button: one can discuss what to do here, I was thinking perhaps show 
either a contextual menu (that might be convenient in an editor) or 
contextual help on that atom.

What do you think?
Benoît

Le samedi 19 août 2006 18:04, vous avez écrit :
> Am Samstag, den 19.08.2006, 09:07 -0400 schrieb Geoffrey Hutchison:
> > On Aug 19, 2006, at 7:03 AM, Carsten Niehaus wrote:
> >
> > It's a SourceForge project:
> > http://sourceforge.net/projects/avogadro/
> >
> > SVN:
> > svn co https://svn.sourceforge.net/svnroot/avogadro/trunk avogadro
>
> Ah! I finally found that you don't use autohell to compile but qMake!
>
> Benoit: In case you compile Avogadro: Simply enter the src/ directory,
> type "qmake" and then "make". Geoff, you could remove those Makefile.am
> and whatnot-crap, it took me almost an hour to compile it. When I found
> out about qmake it took me 20 seconds to have a working Makefile :(
> Well, I even tried to convert it to cmake but didn't really succeed.
>
> I think your GLWidget : public QGLWidget is 100% what KalziumGLWidget
> is, just that Benoits Widget is more advanced.
>
> Then, I wonder if void MainWindow::open() really has to be that
> complicated... Why not making the dialog modal?
>
> Why are you using all those setting/getting of var's like
> _leftButtonPressed? Not not asking the QMouseEvent directly?
>
> Carsten


More information about the Kalzium mailing list