我试图在棋盘格(as pictured in the screenshot)制作图表,但我想不出它的构造算法。如何更改算法以便构建它?
// location for the first point
double x = FirstStationX;
double y = FirstStationY;
double x1 = 0, y1 = 0;
// button separation inline
double spacingX = InlineStations * (InlineSpacing - 1);
// button separation crossline
double spacingY = CrosslineStations * (CrosslineSpacing - 1);
// Cycle by number of blocks (buttons) along the X axis
for (int i = 0; i < InlineButtons; i++)
{
if (i > 0) x = x1 + spacingX + InlineSeparation;
// Cycle by number of blocks (buttons) along the Y axis
for(int j = 0; j < CrosslineButtons; j++)
{
if (j > 0)
{
y = y1 + spacingY + CrosslineSeparation;
}
// Cycle by number of point in buttons along the X axis
for(int k = 0; k < InlineStations; k++)
{
if (k == 0) x1 = x;
else x1 = x1 + InlineSpacing;
// Cycle by number of point in buttons along the Y axis
for(int h = 0; h < CrosslineStations; h++)
{
if (h == 0) y1 = y;
else y1 = y1 + CrosslineSpacing;
listPointsButtonStation.Add(new ObservablePoint(x1, y1));
}
}
}
}