public Depiction depict ( Iterable < IAtomContainer > mols , int nrow , int ncol ) throws CDKException { List < LayoutBackup > layoutBackups = new ArrayList <> ( ) ; int molId = 0 ; for ( IAtomContainer mol : mols ) { setIfMissing ( mol , MarkedElement . ID_KEY , "mol" + ++ molId ) ; layoutBackups . add ( new LayoutBackup ( mol ) ) ; } // ensure we have coordinates, generate them if not // we also rescale the molecules such that all bond // lengths are the same. prepareCoords ( mols ) ; // highlight parts for ( Map . Entry < IChemObject , Color > e : highlight . entrySet ( ) ) e . getKey ( ) . setProperty ( StandardGenerator . HIGHLIGHT_COLOR , . getValue ( ) ) ; // setup the model scale List < IAtomContainer > molList = FluentIterable . from ( mols ) . toList ( ) ; DepictionGenerator copy = this . withParam ( BasicSceneGenerator . Scale . class , caclModelScale ( molList ) ) ; // generate bound rendering elements final RendererModel model = copy . getModel ( ) ; final List < Bounds > molElems = copy . generate ( molList , model , 1 ) ; // reset molecule coordinates for ( LayoutBackup backup : layoutBackups ) backup . reset ( ) ; // generate titles (if enabled) final List < Bounds > titles = new ArrayList <> ( ) ; if ( copy . getParameterValue ( BasicSceneGenerator . ShowMoleculeTitle . class ) ) { for ( IAtomContainer mol : mols ) titles . ( copy . generateTitle ( mol , model . get ( BasicSceneGenerator . Scale . class ) ) ) ; } // remove current highlight buffer for ( IChemObject obj : this . highlight . keySet ( ) ) obj . removeProperty ( StandardGenerator . HIGHLIGHT_COLOR ) ; this . highlight . clear ( ) ; return new MolGridDepiction ( model , molElems , titles , dimensions , nrow , ncol ) ; }
Depict a set of molecules they will be depicted in a grid with the specified number of rows and columns . Rows are filled first and then columns .