Hi,

Our Chemists pointed out that sometimes our chemical images were
incorrectly rendering stereo chemistry bonds when non were present.

Rather than always calling .setStereoElements() for our rendering code...

atomContainer.setStereoElements(
StereoElementFactory.using3DCoordinates(atomContainer)
      .createAll());

I noticed we had to check if three dimensional points were present before
calling .setStereoElements()


if( checkHas3D( atomContainer ) ){
   atomContainer.setStereoElements(
StereoElementFactory.using3DCoordinates(atomContainer)
         .createAll());
}


private boolean checkHas3D( IAtomContainer atomContainer ) {

   boolean has3D = false;
   for( int i = 0 ; i < atomContainer.getAtomCount() ; i++ ){
      IAtom atom = atomContainer.getAtom( i );
      Point3d point3d = atom.getPoint3d();
      if( ( null != point3d) && point3d.z != 0d ){
         has3D = true;
         break;
      }

   }
   return has3D;
}


This cleaned up the image for our chemists.  It seems that we should be
able to call .setStereoElements()  and not have to worry about the 3D check
- it should just work.

Are we not using the API correctly or have we stumbled on a bug?

The issue was initially identified in version 1.5.11.  Although we have
since upgraded to version 1.5.13 as I indicated separately, we have not
retested with the new version.

- steve
------------------------------------------------------------------------------
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to