|
@@ -123,6 +123,7 @@ namespace OTSIncAReportGrids
|
|
|
if(!selectNameGroup.ContainsKey(selectParticles[i].TypeId))
|
|
|
{
|
|
|
List<OTSIncAReportApp.DataOperation.Model.Particle> particles = new List<OTSIncAReportApp.DataOperation.Model.Particle>();
|
|
|
+ particles.Add(selectParticles[i]);
|
|
|
selectNameGroup.Add(selectParticles[i].TypeId, particles);
|
|
|
}
|
|
|
else
|
|
@@ -131,7 +132,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- double particlesCount = 0, areaSum = 0,avg = 0,max = 0;
|
|
|
+ double areaSum = 0,avg = 0,max = 0;
|
|
|
DataTable dtUelect = new DataTable();
|
|
|
dtUelect.Columns.Add("typeid");
|
|
|
dtUelect.Columns.Add("TypeName");
|
|
@@ -142,8 +143,7 @@ namespace OTSIncAReportGrids
|
|
|
dtUelect.Columns.Add("max");
|
|
|
foreach (KeyValuePair<int, List<OTSIncAReportApp.DataOperation.Model.Particle>> kv in selectNameGroup)
|
|
|
{
|
|
|
- particlesCount = areaSum = avg = max = 0;
|
|
|
- particlesCount = kv.Value.Count;
|
|
|
+ areaSum = avg = max = 0;
|
|
|
for(int i=0;i< kv.Value.Count;i++)
|
|
|
{
|
|
|
areaSum += kv.Value[i].Area;
|
|
@@ -179,12 +179,11 @@ namespace OTSIncAReportGrids
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- avg = avg / particlesCount;
|
|
|
- dtUelect.Rows.Add(kv.Key, kv.Value[0].TypeName, kv.Value[0].TypeColor, kv.Value[0].TypeName, areaSum, avg, max);
|
|
|
+ avg = avg / kv.Value.Count;
|
|
|
+ dtUelect.Rows.Add(kv.Key, kv.Value[0].TypeName, kv.Value[0].TypeColor, kv.Value.Count, areaSum, avg, max);
|
|
|
}
|
|
|
-
|
|
|
totalArea = OTSIncAReportApp.frmReportApp.selectedRegion.Width * OTSIncAReportApp.frmReportApp.selectedRegion.Height;
|
|
|
- dt = dtUelect.Clone();
|
|
|
+ dt = dtUelect.Copy();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -304,7 +303,7 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- gridView.Rows[add_rowindex].Cells[k].Value = Math.Round((double)(dt.Rows[i]["Area"]) * 100/ totalArea, 5);
|
|
|
+ gridView.Rows[add_rowindex].Cells[k].Value = Math.Round(Convert.ToDouble(dt.Rows[i]["Area"]) * 100/ totalArea, 5);
|
|
|
}
|
|
|
gridView.Rows[add_rowindex].Cells[k].Style.BackColor = Color.Azure;
|
|
|
|