boolean assignLayout ( IAtomContainer container ) { try { // create the library key to lookup an entry, we also store // the canonical out ordering int n = container . getAtomCount ( ) ; int [ ] ordering = new int [ n ] ; String smiles = cansmi ( container , ordering ) ; // find the points in the library for ( Point2d [ ] points : templateMap . get ( smiles ) ) { // set the points for ( int i = 0 ; i < n ; i ++ ) { container . getAtom ( i ) . setPoint2d ( new Point2d ( points [ ordering [ i ] ] ) ) ; } return true ; } } catch ( CDKException e ) { // ignored } return false ; }
Assign a 2D layout to the atom container using the contents of the library . If multiple coordinates are available the first is choosen .