I've made a lot of progress in the last few hours; this description definitely helps.




Miguel wrote:

I want to be able to draw a molecule -- just a simple alkene or alcohol,
nothing crazy. I can't figure out *where* to do that though.



Before you draw the molecule, you need to be able to read it.

You should next port the org.jmol.adapter.smarter package.

Write a small test program that instantiates a SmarterAdapter. Then read
in a file using it.

You do not need to store the contents anyplace, but you need to iterate
through all the atoms and all the bonds.



Yes! I ported this and I can now read in a Mol file. There's a bit of a hiccup in that the .NET equivealent of BufferedReader doesn't have a "reset" method, but that's easily worked around.




Control flow:
I'm rather confused by the rendering pipeline -- Graphics3D, Viewer,
FrameRenderer, Frame, Platform3D -- so many related classes,



Graphics3D and Platform3D provide rendering primitives. You have
demonstrated that part working, so don't worry about them anny more.



I just needed to step through the code to figure out the control flow. It also turned out that the Java->C# converter messes up the conversion of virtual methods, so that the base class virtual method gets called unless the subclass method is marked "override." Crazy, I thought virtual methods *meant* that the subclasses version would be called. Again, stepping through the code revealed the issue here.




How does it relate to FrameRenderer?
Why does a FrameRenderer need a Frame?



The FrameRenderer's job is to render the Frame. It does this by delegating
to BallsRenderer, SticksRenderer, RibbonsRenderer, etc.


I'm almost there! I'm pretending that everything uses a BallsRenderer for now.



Data structures:
I want to be able to say something like myJmol.AddAtom(new Carbon(x, y,
z))
or myJmol.addBond(thisCarbon, thatCarbon, BondType.SINGLE_BOND)
In other words, I'm constructing my model programmatically at run time,
not from a filie.



Not possible.

If you do not want to do it from a file you do not have to. But you must
go through an implementation of the JmolAdapter interface.



Okay -- now that I'm getting a grip on the SmarterJmolAdapter, I think I'll be able to move things around so I can create the model programmatically.




It looked to me like the way to do that would be to make an
implementation of JmolAdapter , and make it iterate over my data
structure with an AtomIterator. Then I'd give an instance MyAdapater to
the instance of org.jmol.viewer.Viewer. Is that the right general idea?



Correct.



Or should I get the SmarterAdapter working first?



I think that you should get the SmarterAdapter working first.



Help? I need to make some progress with this soon or it's back to
Direct3D for me :(



The issues that you are struggling with now have nothing to do with Direct3D.



Ah, but they do, but not how you think -- if I can't get this Jmol port to work, I have to go back to my lame built-from-scratch Direct3D molecule viewer.


You need a data model to hold data structures that represent the atoms of
your molecule.

If you want, you could write your own ... directly on top of org.jmol.g3d
Or, you can continue trying to translate to C#.


Jmol is super-fantastic. It's worth the porting effort. The various rendering styles are the main reason I wanted to use Jmol -- and the ability to read so many file types. The organic chemistry professor I work with said something like "it would be SPECTACULAR if we could use Jmol."


The port is going to work, tonight I think! I've got the SmarterJmolAdapter reading in mol files, and I've got g3d, and I understand how the ModelManager and Frame work -- I'm moments away. Thanks for all the help.

-sascha

Thanks for the help.



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to