public static AcreCoordinate[] GetGrid(int width, int height) { var result = new AcreCoordinate[width * height]; int i = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { result[i++] = new AcreCoordinate(x, y); } } return(result); }
public static AcreCoordinate[] GetGridWithExterior(int width, int height) { var result = new AcreCoordinate[width * height]; int i = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var xn = (x == 0) ? 'L' : x == width - 1 ? 'R' : (char)('0' + x - 1); var yn = (y == 0) ? 'T' : y == height - 1 ? 'B' : (char)('A' + y - 1); result[i++] = new AcreCoordinate(xn, yn, x, y); } } return(result); }
private void LoadComboBoxes() { foreach (var acre in MapGrid.Acres) CB_Acre.Items.Add(acre.Name); var exterior = AcreCoordinate.GetGridWithExterior(9, 8); foreach (var acre in exterior) CB_MapAcre.Items.Add(acre.Name); CB_MapAcreSelect.DisplayMember = nameof(ComboItem.Text); CB_MapAcreSelect.ValueMember = nameof(ComboItem.Value); CB_MapAcreSelect.DataSource = ComboItemUtil.GetArray<ushort>(typeof(OutsideAcre)); NUD_MapAcreTemplateOutside.Value = SAV.OutsideFieldTemplateUniqueId; NUD_MapAcreTemplateField.Value = SAV.MainFieldParamUniqueID; }