MCPcopy Create free account
hub / github.com/NatLabRockies/SAM / MatrixToGrid

Method MatrixToGrid

src/widgets.cpp:5001–5078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4999
5000
5001void AFDataMatrixCtrl::MatrixToGrid()
5002{
5003 m_data = m_gridTable->GetMatrix();
5004 int r, nr = m_data.nrows();
5005 int c, nc = m_data.ncols();
5006
5007 m_grid->Freeze();
5008 m_grid->SetTable(m_gridTable);
5009
5010 m_numRows->SetValue(nr);
5011 m_numCols->SetValue(nc);
5012
5013
5014 if (!m_rowFormat.IsEmpty())
5015 {
5016 for (r = 0; r<nr; r++)
5017 {
5018 wxString label = m_rowFormat;
5019 label.Replace("#", wxString::Format("%lg", m_rowY2*((double)r) / ((double)nr) + r*m_rowY1 + m_rowY0));
5020 m_grid->SetRowLabelValue(r, label);
5021 }
5022 }
5023
5024 if (!m_colFormat.IsEmpty())
5025 {
5026 for (c = 0; c<nc; c++)
5027 {
5028 wxString label = m_colFormat;
5029 label.Replace("#", wxString::Format("%lg", m_colY2*((double)c) / ((double)nc) + c*m_colY1 + m_colY0));
5030 m_grid->SetColLabelValue(c, label);
5031 }
5032 }
5033
5034 if (m_showRowLabels)
5035 {
5036 wxArrayString as = wxStringTokenize(m_rowLabels, ",");
5037 for (r = 0; r<(int)as.Count() && r < m_grid->GetNumberRows(); r++)
5038 {
5039 m_grid->SetRowLabelValue(r, as[r]);
5040 }
5041 m_grid->SetRowLabelSize(wxGRID_AUTOSIZE);
5042 }
5043 else
5044 {
5045 m_grid->SetRowLabelSize(1);
5046 }
5047
5048 if (m_showColLabels)
5049 {
5050 wxArrayString as = wxStringTokenize(m_colLabels, ",");
5051 for (c = 0; c<(int)as.Count() && c < m_grid->GetNumberCols(); c++)
5052 {
5053 m_grid->SetColLabelValue(c, as[c]);
5054 m_grid->AutoSizeColLabelSize(c);
5055 }
5056 m_grid->SetColLabelSize(wxGRID_AUTOSIZE);
5057 }
5058 else

Callers

nothing calls this directly

Calls 9

GetMatrixMethod · 0.80
nrowsMethod · 0.80
ncolsMethod · 0.80
CountMethod · 0.80
SetValueMethod · 0.45
SetColLabelValueMethod · 0.45
GetNumberRowsMethod · 0.45
GetNumberColsMethod · 0.45
SetLabelMethod · 0.45

Tested by

no test coverage detected