コード例 #1
0
        public void LoadFile(IChemFileWrapper file)
        {
            renderSource = new ChemRenderingSource3D(file.chemFile);
            if (renderContext != null)
            {
                renderContext.ChemRenderSource = renderSource;
                renderContext.OnResize(Width, Height);
                //renderContext.Render(null);
            }

            // load structures if available
            //if (file.results.FileFormat is PDBFormat)
            //{
            //    object frame = ChemModel.CreateJMOLFrameFromCDKFile(file.chemFile, renderContext.Device);
            //    // need to render 1 struct/shape at a time
            //    NuSceneBuffer3D sceneBuffer = ChemModel.RenderShapes(frame, ChemModel.ShapesType.Ribbons);
            //    renderSource.sceneBuffer = sceneBuffer;

            //    renderContext.ribbons = new ChemEntityRibbon(sceneBuffer);
            //    renderContext.ribbons.Init(renderContext.Device, outputDesc.GeneralStructuresShadingDesc);

            //    //sceneBuffer = ChemModel.RenderShapes(frame, ChemModel.ShapesType.Cartoon);

            //    //renderContext.cartoons = new ChemEntityCartoon(sceneBuffer);
            //    //renderContext.cartoons.Init(renderContext.Device, outputDesc.GeneralStructuresShadingDesc);
            //}

            /*SmilesGenerator gen = new SmilesGenerator(file.chemFile.Builder);
             * moleculeSMILESRawString = gen.createSMILES(file.chemFile.ChemSequences[0].ChemModels[0].SetOfMolecules.Molecules[0]);
             */
            renderFrame = true;
            renderingThread.Start();

            UleDlg dlg = new UleDlg(file.results, file.progress);

            dlg.ShowDialog();
            dlg.Dispose();
        }
コード例 #2
0
        public void LoadFile(string file)
        {
            MoleculeLoadingResults results = null;

            try
            {
                renderSource = new ChemRenderingSource3D(MoleculeLoader.LoadFromFile(file, settings, MoleculeLoader.FileUsage.ThreeD, null, out results));
                if (renderContext != null)
                {
                    renderContext.ChemRenderSource = renderSource;
                    renderContext.OnResize(Width, Height);
                    renderContext.Render(null);
                }
            }
            catch (UserLevelException ule)
            {
                // post to user
                MessageBox.Show(ule.Message, "Loading File", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            UleDlg dlg = new UleDlg(results, null);

            dlg.ShowDialog();
            dlg.Dispose();
        }
コード例 #3
0
        public void LoadFile(IChemFileWrapper file)
        {
            renderSource = new ChemRenderingSource3D(file.chemFile);
            if (renderContext != null)
            {
                renderContext.ChemRenderSource = renderSource;
                renderContext.OnResize(Width, Height);
                //renderContext.Render(null);
            }

            // load structures if available
            //if (file.results.FileFormat is PDBFormat)
            //{
            //    object frame = ChemModel.CreateJMOLFrameFromCDKFile(file.chemFile, renderContext.Device);
            //    // need to render 1 struct/shape at a time
            //    NuSceneBuffer3D sceneBuffer = ChemModel.RenderShapes(frame, ChemModel.ShapesType.Ribbons);
            //    renderSource.sceneBuffer = sceneBuffer;

            //    renderContext.ribbons = new ChemEntityRibbon(sceneBuffer);
            //    renderContext.ribbons.Init(renderContext.Device, outputDesc.GeneralStructuresShadingDesc);

            //    //sceneBuffer = ChemModel.RenderShapes(frame, ChemModel.ShapesType.Cartoon);

            //    //renderContext.cartoons = new ChemEntityCartoon(sceneBuffer);
            //    //renderContext.cartoons.Init(renderContext.Device, outputDesc.GeneralStructuresShadingDesc);
            //}

            /*SmilesGenerator gen = new SmilesGenerator(file.chemFile.Builder);
            moleculeSMILESRawString = gen.createSMILES(file.chemFile.ChemSequences[0].ChemModels[0].SetOfMolecules.Molecules[0]);
            */
            renderFrame = true;
            renderingThread.Start();

            UleDlg dlg = new UleDlg(file.results, file.progress);
            dlg.ShowDialog();
            dlg.Dispose();
        }
コード例 #4
0
 public void LoadFile(string file)
 {
     MoleculeLoadingResults results = null;
     try
     {
         renderSource = new ChemRenderingSource3D(MoleculeLoader.LoadFromFile(file, settings, MoleculeLoader.FileUsage.ThreeD, null, out results));
         if (renderContext != null)
         {
             renderContext.ChemRenderSource = renderSource;
             renderContext.OnResize(Width, Height);
             renderContext.Render(null);
         }
     }
     catch (UserLevelException ule)
     {
         // post to user
         MessageBox.Show(ule.Message, "Loading File", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     UleDlg dlg = new UleDlg(results, null);
     dlg.ShowDialog();
     dlg.Dispose();
 }