Skip to content
Snippets Groups Projects
Commit b51035eb authored by marco's avatar marco
Browse files

catch exceptions thrown during PDB import

Fixes BZDNG-145

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2640 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent e7b42c92
No related branches found
No related tags found
No related merge requests found
...@@ -374,15 +374,19 @@ void FileLoader::LoadPDB(const QString& filename, const QString& selection) ...@@ -374,15 +374,19 @@ void FileLoader::LoadPDB(const QString& filename, const QString& selection)
conop::BuilderP builder=conop::Conopology::Instance().GetBuilder("DEFAULT"); conop::BuilderP builder=conop::Conopology::Instance().GetBuilder("DEFAULT");
while (reader.HasNext()){ while (reader.HasNext()){
mol::EntityHandle ent=mol::CreateEntity(); mol::EntityHandle ent=mol::CreateEntity();
reader.Import(ent); try {
reader.Import(ent);
} catch (io::IOException &e) {
LOGN_ERROR(e.what());
continue;
}
conop::Conopology::Instance().ConnectAll(builder,ent,0); conop::Conopology::Instance().ConnectAll(builder,ent,0);
entities.append(ent); entities.append(ent);
} }
QFileInfo file_info(filename); QFileInfo file_info(filename);
if(entities.empty()){ if(entities.empty()){
FileLoader::HandleError(Message(QString("No entities found in file: "+ filename).toStdString()),INFO,filename); FileLoader::HandleError(Message(QString("No entities found in file: "+ filename).toStdString()),INFO,filename);
} }else if (entities.size()==1){
else if(entities.size()==1){
gfx::EntityP gfx_ent(new gfx::Entity(file_info.baseName().toStdString(),entities.first(),mol::Query(selection.toStdString()))); gfx::EntityP gfx_ent(new gfx::Entity(file_info.baseName().toStdString(),entities.first(),mol::Query(selection.toStdString())));
try{ try{
gfx::Scene::Instance().Add(gfx_ent); gfx::Scene::Instance().Add(gfx_ent);
...@@ -393,9 +397,8 @@ void FileLoader::LoadPDB(const QString& filename, const QString& selection) ...@@ -393,9 +397,8 @@ void FileLoader::LoadPDB(const QString& filename, const QString& selection)
if (gfx::Scene::Instance().GetRootNode()->GetChildCount()==1) { if (gfx::Scene::Instance().GetRootNode()->GetChildCount()==1) {
gfx::Scene::Instance().SetCenter(gfx_ent->GetCenter()); gfx::Scene::Instance().SetCenter(gfx_ent->GetCenter());
} }
} } else {
else{ try {
try{
for(int i = 0 ; i<entities.size(); i++){ for(int i = 0 ; i<entities.size(); i++){
gfx::EntityP gfx_ent(new gfx::Entity(QString(file_info.baseName()+" ("+QString::number(i)+")").toStdString(),entities[i],mol::Query(selection.toStdString()))); gfx::EntityP gfx_ent(new gfx::Entity(QString(file_info.baseName()+" ("+QString::number(i)+")").toStdString(),entities[i],mol::Query(selection.toStdString())));
gfx::Scene::Instance().Add(gfx_ent); gfx::Scene::Instance().Add(gfx_ent);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment