public void modifycoords(int id, string newcoord, PointF[] newpoints) { int index = 0; StructNFE[] tmpdata = new StructNFE[this.data.Length]; for (int i = 0; i < this.data.Length; i++) { if (data[i].id == id) { index = i; tmpdata[i] = new StructNFE(); tmpdata[i] = data[i]; tmpdata[i].coords = newpoints; tmpdata[i].coord = newcoord; tmpdata[i].count_coords = newpoints.Length - 1; } else { tmpdata[i] = new StructNFE(); tmpdata[i] = data[i]; } } updateCoordString(index); this.edit = true; }
public void updateStructNFE(StructNFE tmp) { StructNFE[] tmpdata; if (this.data.Length == 0) { tmpdata = new StructNFE[1]; tmpdata[0] = new StructNFE(); tmpdata[0] = tmp; this.data = new StructNFE[tmpdata.Length]; this.data = tmpdata; this.cnt = 0; } else { tmpdata = new StructNFE[this.data.Length + 1]; for (int i = 0; i < this.data.Length; i++) { tmpdata[i] = new StructNFE(); tmpdata[i] = data[i]; } tmpdata[this.data.Length] = new StructNFE(); tmpdata[this.data.Length] = tmp; this.data = tmpdata; } updateCoordString(this.data.Length - 1); this.cnt = cnt + 1; this.edit = true; }
public void deleteNFE(int id) { StructNFE[] tmpdata = new StructNFE[this.data.Length - 1]; int j = 0; for (int i = 0; i < this.data.Length; i++) { if (data[i].id != id) { tmpdata[j] = new StructNFE(); tmpdata[j] = data[i]; j++; } } this.data = tmpdata; this.cnt = cnt - 1; this.edit = true; }
private void loadData() { try { if (File.Exists(this.fullpath)) { FileStream fileStream = File.Open(this.fullpath, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryReader binaryReader = new BinaryReader(fileStream, Encoding.ASCII); this.cnt = binaryReader.ReadInt32(); data = new StructNFE[this.cnt]; for (int i = 1; i <= this.cnt; i++) { data[i - 1] = new StructNFE(); data[i - 1].id = binaryReader.ReadInt32(); data[i - 1].type = binaryReader.ReadInt32(); data[i - 1].count_coords = binaryReader.ReadInt32(); data[i - 1].coords = new PointF[data[i - 1].count_coords + 1]; for (int j = 1; j <= data[i - 1].count_coords; j++) { int x = binaryReader.ReadInt32(); int y = mirrory(binaryReader.ReadInt32()); data[i - 1].coords[j - 1].X = x; data[i - 1].coords[j - 1].Y = y; data[i - 1].coord = data[i - 1].coord + j + ". (" + ((x * 5.25) + Hexcnv.GetCoords(this.filename, 1)) + ", " + (((3072 - y) * 5.25) + Hexcnv.GetCoords(this.filename, 2)) + ")"; if (j - 1 == 0) { data[i - 1].coords[data[i - 1].count_coords] = new Point(x, y); } } } binaryReader.Close(); fileStream.Close(); this.error = false; this.check = true; } } catch { this.error = true; this.MapImg = new Bitmap(3072, 3072); this.check = false; } }