private void FillData(NMeshSurfaceSeries surface)
{
try
{
DataTable dt = (DataTable)gridControl1.DataSource;
int rowcount = 0;
now_realMaxValue = double.MinValue;
now_realMinValue = double.MaxValue;
//surface.Data.Clear();
foreach (DataRow dr in dt.Rows)
{
for (int t = 0; t < dt.Columns.Count; t++)
{
double value = 0;
if (m_viewtype == ViewType.Easy || m_viewtype == ViewType.Decimal)
{
value = Convert.ToInt32(dr[t]);
}
else if (m_viewtype == ViewType.Hexadecimal)
{
value = Convert.ToInt32(dr[t].ToString(), 16);
}
if (m_viewtype != ViewType.Decimal && m_viewtype != ViewType.Hexadecimal && m_viewtype != ViewType.ASCII)
{
value *= correction_factor;
if (!_isCompareViewer) value += correction_offset;
}
surface.Data.SetValue(rowcount, t, value, /*y_axisvalues.GetValue(rowcount)*/ rowcount, /*x_axisvalues.GetValue(t)*/ t);
if (value > now_realMaxValue) now_realMaxValue = value;
if (value < now_realMinValue) now_realMinValue = value;
}
rowcount++;
}
if (now_realMaxValue != double.MinValue)
{
surface.Palette.Clear();
double diff = now_realMaxValue - now_realMinValue;
if (m_OnlineMode)
{
surface.Palette.Add(now_realMinValue, Color.Wheat);
surface.Palette.Add(now_realMinValue + 0.25 * diff, Color.LightBlue);
surface.Palette.Add(now_realMinValue + 0.50 * diff, Color.SteelBlue);
surface.Palette.Add(now_realMinValue + 0.75 * diff, Color.Blue);
surface.Palette.Add(now_realMinValue + diff, Color.DarkBlue);
}
else
{
surface.Palette.Add(now_realMinValue, Color.Green);
surface.Palette.Add(now_realMinValue + 0.25 * diff, Color.Yellow);
surface.Palette.Add(now_realMinValue + 0.50 * diff, Color.Orange);
surface.Palette.Add(now_realMinValue + 0.75 * diff, Color.OrangeRed);
surface.Palette.Add(now_realMinValue + diff, Color.Red);
}
surface.PaletteSteps = 4;
surface.AutomaticPalette = false;
}
/*if (m_issixteenbit)
{
for (int tel = 0; tel < m_map_content.Length; tel+=2)
{
}
}
else
{
for (int tel = 0; tel < m_map_content.Length; tel++)
{
int _y = tel / m_TableWidth;
int _x = tel % m_TableWidth;
surface.Data.SetValue(_x, _y, Convert.ToInt32(m_map_content[tel]));
}
}*/
}
catch (Exception E)
{
Console.WriteLine("FillData: " + E.Message);
}
}