Skip to content

Commit

Permalink
Removed all table related code
Browse files Browse the repository at this point in the history
Refs #8503
  • Loading branch information
DanNixon committed Jul 17, 2014
1 parent 206267d commit 75c7a5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 95 deletions.
96 changes: 4 additions & 92 deletions Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp
Expand Up @@ -718,19 +718,6 @@ Spectrogram* MantidMatrix::plotSpectrogram(Graph* plot, ApplicationWindow* app,
return spgrm;
}

void MantidMatrix::setBinGraph(MultiLayer *ml, Table* t)
{
MantidUI::setUpBinGraph(ml,name(),workspace());
connect(ml, SIGNAL(closedWindow(MdiSubWindow*)), this, SLOT(dependantClosed(MdiSubWindow*)));
if (t)
{
m_plots1D[ml] = t;
connect(t, SIGNAL(closedWindow(MdiSubWindow*)), this, SLOT(dependantClosed(MdiSubWindow*)));
}
else
m_plots2D<<ml;
}

/// Returns a list of the selected rows
const QList<int>& MantidMatrix::getSelectedRows() const
{
Expand Down Expand Up @@ -787,39 +774,16 @@ bool MantidMatrix::setSelectedColumns()

void MantidMatrix::dependantClosed(MdiSubWindow* w)
{
if( w->isA("Table") )
{
QMap<MultiLayer*,Table*>::iterator itr;
for( itr = m_plots1D.begin(); itr != m_plots1D.end(); ++itr )
{
if( itr.value() == dynamic_cast<Table*>(w) )
{
m_plots1D.erase(itr);
break;
}
}
}
else if (w->isA("MultiLayer"))
if (w->isA("MultiLayer"))
{
int i = m_plots2D.indexOf(dynamic_cast<MultiLayer*>(w));
if (i >= 0)m_plots2D.remove(i);
else
{QMap<MultiLayer*,Table*>::iterator i = m_plots1D.find(dynamic_cast<MultiLayer*>(w));
if (i != m_plots1D.end())
{
if (i.value() != 0)
{
i.value()->confirmClose(false);
i.value()->close();
}
m_plots1D.erase(i);
}
}
if (i >= 0)
m_plots2D.remove(i);
}
}

/**
Repaints all 1D and 2D plots attached to this MantidMatrix
Repaints all 2D plots attached to this MantidMatrix
*/
void MantidMatrix::repaintAll()
{
Expand All @@ -831,49 +795,6 @@ void MantidMatrix::repaintAll()
{
(*vItr)->activeGraph()->replot();
}

// Updates the 1D plots by modifying the attached tables
QMap<MultiLayer*,Table*>::iterator mEnd = m_plots1D.end();
for(QMap<MultiLayer*,Table*>::iterator mItr = m_plots1D.begin(); mItr != mEnd; ++mItr)
{
Table* t = mItr.value();
if ( !t ) continue;
int charsToRemove = t->name().size() + 1;
int nTableCols(t->numCols());
for(int col = 1; col < nTableCols; ++col)
{
QString colName = t->colName(col).remove(0,charsToRemove);
if( colName.isEmpty() ) break;
//Need to determine whether the table was created from plotting a spectrum
//or a time bin. A spectrum has a Y column name YS and a bin YB
QString ident = colName.left(2);
colName.remove(0,2); //This now contains the number in the MantidMatrix
int matrixNumber = colName.toInt();
if( matrixNumber < 0 ) break;
bool errs = (ident[0] == QChar('E')) ? true : false;
if( ident[1] == QChar('S') )
{
if( matrixNumber >= numRows() ) break;
int endCount = numCols();
for(int j = 0; j < endCount; ++j)
{
if( errs ) t->setCell(j, col, dataE(matrixNumber, j));
else t->setCell(j, col, dataY(matrixNumber, j));
}
}
else
{
if( matrixNumber >= numCols() ) break;
int endCount = numRows();
for(int j = 0; j < endCount; ++j)
{
if( errs ) t->setCell(j, col, dataE(j, matrixNumber));
else t->setCell(j, col, dataY(j, matrixNumber));
}
}
}
t->notifyChanges();
}
}

void MantidMatrix::afterReplaceHandle(const std::string& wsName,const boost::shared_ptr<Mantid::API::Workspace> ws)
Expand Down Expand Up @@ -934,7 +855,6 @@ void MantidMatrix::changeWorkspace(Mantid::API::MatrixWorkspace_sptr ws)
invalidateBoundingRect();

repaintAll();

}

void MantidMatrix::closeDependants()
Expand All @@ -945,14 +865,6 @@ void MantidMatrix::closeDependants()
ml->confirmClose(false);
ml->close();// this calls slot dependantClosed() which removes the pointer from m_plots2D
}

while(m_plots1D.size())
{
MultiLayer* ml = m_plots1D.begin().key();
ml->confirmClose(false);
ml->close();// this calls slot dependantClosed() which removes the pointer from m_plots1D
}

}

void MantidMatrix::setNumberFormat(const QChar& f,int prec, bool all)
Expand Down
3 changes: 0 additions & 3 deletions Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.h
Expand Up @@ -114,8 +114,6 @@ class MantidMatrix : public MdiSubWindow, MantidQt::API::WorkspaceObserver
// Creates a MultiLayer graph and plots this MantidMatrix as a Spectrogram
MultiLayer* plotGraph2D(Graph::CurveType type);

void setBinGraph(MultiLayer* ml, Table* t=0);

bool setSelectedRows();
bool setSelectedColumns();
const QList<int>& getSelectedRows() const;
Expand Down Expand Up @@ -262,7 +260,6 @@ class MantidMatrix : public MdiSubWindow, MantidQt::API::WorkspaceObserver

// MDI windows created by this MantidMatrix
QVector<MultiLayer*> m_plots2D;
QMap< MultiLayer*,Table* > m_plots1D;

//MantidMatrixFunction m_funct;
int m_column_width;
Expand Down

0 comments on commit 75c7a5b

Please sign in to comment.