如何创建 PointPairLists 列表?
How Create a List of PointPairLists?
我有一些 PointPairLists,我想将它们添加到列表;但我遇到异常索引超出范围:AllPhiLines[0].Add(Quartz[0]);
我尝试了以下代码:
PointPairList Quartz = new PointPairList(7000);
PointPairList Calcite = new PointPairList(7000);
PointPairList Dolomite = new PointPairList(7000);
double[] XQuartz = { -2.05E+00, -1.05E+00, -4.01E-01, 4.25E-01, 1.31E+00, 2.08E+00 };
double[] YQuartz = {2.64E+00 ,2.62E+00 ,2.61E+00 ,2.59E+00 ,2.57E+00 ,2.55E+00 };
double[] XCalcite = {-2.83E-01 ,7.19E-01 ,1.90E+00 ,2.96E+00 ,4.02E+00 ,5.02E+00 ,6.03E+00 ,7.09E+00 };
double[] YCalcite = {2.71E+00 ,2.69E+00 ,2.68E+00 ,2.66E+00 ,2.64E+00 ,2.62E+00 ,2.60E+00 ,2.58E+00 };
double[] XDolomite = {1.31E+00 ,2.67E+00 ,4.02E+00 ,5.32E+00 ,6.62E+00 ,7.79E+00 ,9.03E+00 };
double[] YDolomite = {2.88E+00 ,2.86E+00 ,2.84E+00 ,2.82E+00 ,2.80E+00 ,2.78E+00 ,2.76E+00 };
for (int i=0; i<6; i++)
{
Quartz.Add(XQuartz[i], YQuartz[i]);
}
for (int i=0; i<8; i++)
{
Calcite.Add(XCalcite[i], YCalcite[i]);
}
for (int i=0; i<7; i++)
{
Dolomite.Add(XDolomite[i], YDolomite[i]);
}
List<PointPairList> AllPhiLines = new List<PointPairList>();
AllPhiLines[0].Add(Quartz[0]);
AllPhiLines[0].Add(Calcite[0]);
AllPhiLines[0].Add(Dolomite[0]);
LineItem AllPhiLinesCurve = pane1.AddCurve("Phi", AllPhiLines[0], Color.Gray, SymbolType.None)
希望大家帮我解决一下
AllPhiLines
还不包含任何值,因此您无法解决项目 0。创建 AllPhiLines
之后,您首先必须向其中添加一个项目,例如
AllPhiLines.Add(new PointPairList(7000));
我有一些 PointPairLists,我想将它们添加到列表;但我遇到异常索引超出范围:AllPhiLines[0].Add(Quartz[0]);
我尝试了以下代码:
PointPairList Quartz = new PointPairList(7000);
PointPairList Calcite = new PointPairList(7000);
PointPairList Dolomite = new PointPairList(7000);
double[] XQuartz = { -2.05E+00, -1.05E+00, -4.01E-01, 4.25E-01, 1.31E+00, 2.08E+00 };
double[] YQuartz = {2.64E+00 ,2.62E+00 ,2.61E+00 ,2.59E+00 ,2.57E+00 ,2.55E+00 };
double[] XCalcite = {-2.83E-01 ,7.19E-01 ,1.90E+00 ,2.96E+00 ,4.02E+00 ,5.02E+00 ,6.03E+00 ,7.09E+00 };
double[] YCalcite = {2.71E+00 ,2.69E+00 ,2.68E+00 ,2.66E+00 ,2.64E+00 ,2.62E+00 ,2.60E+00 ,2.58E+00 };
double[] XDolomite = {1.31E+00 ,2.67E+00 ,4.02E+00 ,5.32E+00 ,6.62E+00 ,7.79E+00 ,9.03E+00 };
double[] YDolomite = {2.88E+00 ,2.86E+00 ,2.84E+00 ,2.82E+00 ,2.80E+00 ,2.78E+00 ,2.76E+00 };
for (int i=0; i<6; i++)
{
Quartz.Add(XQuartz[i], YQuartz[i]);
}
for (int i=0; i<8; i++)
{
Calcite.Add(XCalcite[i], YCalcite[i]);
}
for (int i=0; i<7; i++)
{
Dolomite.Add(XDolomite[i], YDolomite[i]);
}
List<PointPairList> AllPhiLines = new List<PointPairList>();
AllPhiLines[0].Add(Quartz[0]);
AllPhiLines[0].Add(Calcite[0]);
AllPhiLines[0].Add(Dolomite[0]);
LineItem AllPhiLinesCurve = pane1.AddCurve("Phi", AllPhiLines[0], Color.Gray, SymbolType.None)
希望大家帮我解决一下
AllPhiLines
还不包含任何值,因此您无法解决项目 0。创建 AllPhiLines
之后,您首先必须向其中添加一个项目,例如
AllPhiLines.Add(new PointPairList(7000));