MViewPane and 3D structures

User c0e481a82c

03-03-2006 16:40:29

Hi,





I'm using an MViewPane in a table cell renderer, to display molecules in a JTable. The input for this JTable can be from an SD file. Sometimes, the SD file may contain 3D co-ordinates, and other times not. Some of the files that the users here produce have a mixture of flat and 3D molecules. This leads to a rather confusing table, where some molecules are in the 2D renderer, and some are in the 3D. For the the table, I would prefer that ALL molecules be in 2D. The 3D renderer is not as easy for them to look at and immediately recognise their structure.





How can I get the MViewPane to display the structures in 2D all the time. I'm aware that I could clean each molecule (which works by the way), but this can take a long time (the table can be up to a couple of thousand structures), even if I make it such that any given molecule will only be cleaned when it is requested. The problem there is that the user may have selected the particular orientation for a reason, and in cleaning the molecule, I may loose that orientation.





Basically, what I'm looking for is something like in ISIS Draw/Base where a 3D structure is drawn using the same effect as 2D; the structure looks flat, but may or may not be in fact flat. Even if the "flattening" is as simple as ignoring/removing the Z-coordinates, that would be fine I think. Or does one of the clean options do this? My only alternative other than cleaning is to remove the Z-coordinate myself, using the Molfile, but that can be quite time consuming, although quite easy to do.





Thanks for your help.





Regards,





Phil.

ChemAxon 7c2d26e5cf

04-03-2006 01:20:28

Use UserSettings.setViewRendering3d(String) and UserSettings.setViewMolbg2d(Color) methods to update rendering style and background color for 3D molecules. Gets the color of 2D mode and the 2D rendering style from MViewPane.UserSettings() and set these values to 3D.
Quote:
//Creates the MViewPane


MViewPane mr = new MViewPane();


UserSettings settings = mr.getUserSettings();


settings.setViewMolbg3d(settings.getViewMolbg2d());


settings.setViewRendering3d(settings.getViewRendering2d());
Updating UserSettings has to be done at two places in the code (in JTableExample.setUpMolEditor() and in MolRenderer's constructor).

User c0e481a82c

09-03-2006 11:15:21

Thanks for that, it worked great!





Regards,





Phil.