Skip to content

Commit

Permalink
Re #5731. Made the test on instrument emptiness a little smarter.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Aug 28, 2012
1 parent 70836f0 commit 18caac5
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,22 @@ m_sampleActor(NULL)
/// Cache a map (actually a vector) to workspace indexes.
shared_workspace->getDetectorIDToWorkspaceIndexVector(m_id2wi_vector, m_id2wi_offset, false);

auto instrument = getInstrument();

// If the instrument is empty, maybe only having the sample and source
if (getInstrument()->nelements() < 3)
int nelements = instrument->nelements();
if (nelements == 0 ||
nelements == 1 && (instrument->getSource() || instrument->getSample()) ||
nelements == 2 && instrument->getSource() && instrument->getSample()
)
{
QMessageBox::warning(NULL,"MantidPlot - Warning","The instrument is probably empty","OK");
}

// this adds actors for all instrument components to the scene and fills in m_detIDs
m_scene.addActor(new CompAssemblyActor(*this,getInstrument()->getComponentID()));
m_scene.addActor(new CompAssemblyActor(*this,instrument->getComponentID()));

FindComponentVisitor findVisitor(getInstrument()->getSample()->getComponentID());
FindComponentVisitor findVisitor(instrument->getSample()->getComponentID());
accept(findVisitor);
const ObjComponentActor* samplePosActor = dynamic_cast<const ObjComponentActor*>(findVisitor.getActor());

Expand Down

0 comments on commit 18caac5

Please sign in to comment.