using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace vcsTUNNEL_gnuplot { public partial class Form1 : Form { double pi = Math.PI; int Nmax = 2000; public Form1() { InitializeComponent(); } //-------------------------------------------------------------------------------------------- private void Form1_Load(object sender, EventArgs e) { pictureBox1.Visible = true; toolStripStatusLabel1.Text = "size and Png file name"; } //-------------------------------------------------------------------------------------------- private void toolStripButton1_Click(object sender, EventArgs e) { main_part(); } //-------------------------------------------------------------------------------------------- private void main_part() { System.IO.StreamReader sr; string fnameR = ""; string fnameW = ""; string fnameF = ""; string fnameZ = ""; string dat; string[] sbuf; char delim = ','; int ksp; double D0, Tc, Tx, W, ts, tp, theta; int[] bboxv = new int[4]; double B, H, Ae, Ac, Ls; int iii, nnn; openFileDialog1.InitialDirectory = System.IO.Directory.GetCurrentDirectory(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { fnameR = openFileDialog1.FileName; } sr = new System.IO.StreamReader(fnameR, System.Text.Encoding.Default); dat = sr.ReadLine();sbuf = dat.Split(delim); nnn = int.Parse(sbuf[0]); for (iii = 1; iii <= nnn; iii++) { dat = sr.ReadLine();sbuf = dat.Split(delim); fnameW = sbuf[0].Trim(); //コマンド記述ファイル名*/ fnameF = sbuf[1].Trim(); //出力画像ファイル名*/ ksp = int.Parse(sbuf[2]); //鉄管の有無(-1:モデル図,0:鉄管無し,1:鉄管有り*/ D0 = double.Parse(sbuf[3]); //水路内径*/ Tc = double.Parse(sbuf[4]); //覆工厚*/ Tx = double.Parse(sbuf[5]); //インバート部付加厚*/ W = double.Parse(sbuf[6]); //掘削インバート幅*/ ts = double.Parse(sbuf[7]); //吹付厚*/ tp = double.Parse(sbuf[8]); //設計線から支払線までの距離*/ bboxv[0] = int.Parse(sbuf[9]); //BoundingBox bboxv[1] = int.Parse(sbuf[10]); //BoundingBox bboxv[2] = int.Parse(sbuf[11]); //BoundingBox bboxv[3] = int.Parse(sbuf[12]); //BoundingBox fnameW = System.IO.Path.GetDirectoryName(fnameR) + "\\" + fnameW; theta = CAL_THETA(D0, Tc, Tx, W); // 掘削面積 (Pay line)*/ B = D0 + 2.0 * Tc + 2.0 * ts + 2.0 * tp; H = D0 + 2.0 * Tc + Tx + ts + 2.0 * tp; Ae = CAL_AREA(B, H, theta); Ae = Ae * 1e-6; // 覆工面積 (Concrete)*/ B = D0 + 2.0 * Tc; H = D0 + 2.0 * Tc + Tx; Ac = CAL_AREA(B, H, theta) - 0.25 * pi * D0 * D0; Ac = Ac * 1e-6; // 吹付長 (Shotcrete)*/ B = D0 + 2.0 * Tc + 2.0 * ts; H = D0 + 2.0 * Tc + Tx + ts; Ls = CAL_LENG(B, H, theta); Ls = Ls * 1e-3; if (ksp < 0) { WGPLmodel(fnameW, fnameF, D0, Tc, Tx, W, ts, tp, theta); }else{ WGPL(fnameW, fnameF, ksp, D0, Tc, Tx, W, ts, tp, theta, Ae, Ac, Ls); } //fnameF のフルパス指定 fnameF = System.IO.Path.GetDirectoryName(fnameR) + "\\" + fnameF; //************************************************************** //gnuplot 起動+epsファイル作成 (fnameW: コマンド記述ファイル名) //************************************************************** GPL(fnameW); System.Threading.Thread.Sleep(1000); //1秒待つ //************************************************************** //eps の BoundingBox 修正 (fnameF: eps画像ファイル名) //************************************************************** fnameZ = fnameF.Replace("_eps_", "_eps_z_"); BBOX(fnameF, fnameZ, bboxv); //************************************************************** //ImageMagick による png 画像作成 (fnameZ: eps画像ファイル名) //************************************************************** IMCVT(fnameZ); //************************************************************** //ImageMagick による 白背景合成 (fnameZ: png画像ファイル名) //************************************************************** fnameZ = fnameZ.Replace("eps", "png"); IMCMP(fnameZ); System.Threading.Thread.Sleep(1000); //1秒待つ //************************************************************** //png 画像画面表示 (fnameZ: png画像ファイル名) //************************************************************** fnameZ = fnameZ.Replace("_png_z_", "_png_zw_"); VIEWPNG(fnameZ); } sr.Close(); MessageBox.Show("計算完了","完了通知"); } //-------------------------------------------------------------------------------------------- private void GPL(string fnameR) { //***************************************************** //gnuplot 起動+epsファイル作成 //***************************************************** System.Diagnostics.Process pr; System.IO.StreamWriter sw; string dir = ""; string fname = ""; string dat = ""; dir = System.IO.Path.GetDirectoryName(fnameR); System.IO.Directory.SetCurrentDirectory(dir); fname = System.IO.Path.GetFileName(fnameR); pr = new System.Diagnostics.Process(); pr.StartInfo.FileName = "gnuplot.exe"; pr.StartInfo.RedirectStandardInput = true; pr.StartInfo.RedirectStandardOutput = true; pr.StartInfo.UseShellExecute = false; pr.StartInfo.CreateNoWindow = true; pr.Start(); sw = pr.StandardInput; dat = string.Format("load \"{0:s}\"", fname); sw.WriteLine(dat); sw.Close(); pr.WaitForExit(); pr.Close(); } //-------------------------------------------------------------------------------------------- private void BBOX(string fnameR, string fnameW, int[] bboxv) { System.IO.StreamReader sr; System.IO.StreamWriter sw; string dat; int i; Console.WriteLine("BBOX:fnameR=" + fnameR); Console.WriteLine("BBOX:fnameW=" + fnameW); //データ入力 sr = new System.IO.StreamReader(fnameR, System.Text.Encoding.Default); sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); i = 0; while (!sr.EndOfStream) { i = i + 1; dat = sr.ReadLine(); if (i == 6) dat = string.Format("%%BoundingBox: {0:D} {1:D} {2:D} {3:D}", bboxv[0], bboxv[1], bboxv[2], bboxv[3]); sw.WriteLine(dat); } sr.Close(); sw.Close(); } //-------------------------------------------------------------------------------------------- private void IMCVT(string fnameF) { //***************************************************** //ImageMagick convert で png 画像作成 //***************************************************** string fnameP; System.Diagnostics.Process pr; System.IO.StreamWriter sw; string dat = ""; fnameP = fnameF.Replace("eps", "png"); pr = new System.Diagnostics.Process(); pr.StartInfo.FileName = "cmd.exe"; pr.StartInfo.RedirectStandardInput = true; pr.StartInfo.RedirectStandardOutput = true; pr.StartInfo.UseShellExecute = false; pr.StartInfo.CreateNoWindow = true; pr.Start(); sw = pr.StandardInput; dat = string.Format("convert -density 300 {0:s} {1:s}", fnameF, fnameP); sw.WriteLine(dat); sw.Close(); pr.WaitForExit(); pr.Close(); } //-------------------------------------------------------------------------------------------- private void IMCMP(string fnameZ) { //***************************************************** //ImageMagick convert で 白背景合成画像作成 //***************************************************** string fnameP; string fnameB; System.Diagnostics.Process pr; System.IO.StreamWriter sw; string dat = ""; Image img; int ww; int hh; img = Image.FromFile(fnameZ); ww = img.Width; hh = img.Height; img.Dispose(); fnameP = fnameZ.Replace("_z_", "_zw_"); fnameB = System.IO.Path.GetDirectoryName(fnameP) + "\\base.png"; pr = new System.Diagnostics.Process(); pr.StartInfo.FileName = "cmd.exe"; pr.StartInfo.RedirectStandardInput = true; pr.StartInfo.RedirectStandardOutput = true; pr.StartInfo.UseShellExecute = false; pr.StartInfo.CreateNoWindow = true; pr.Start(); sw = pr.StandardInput; dat = string.Format("convert -size {0:D}x{1:D} xc:\"#FFFFFF\" {2:s}", ww, hh, fnameB); sw.WriteLine(dat); dat = string.Format("convert {0:s} {1:s} -composite {2:s}", fnameB, fnameZ, fnameP); sw.WriteLine(dat); sw.Close(); pr.WaitForExit(); pr.Close(); Console.WriteLine(fnameB + " " + fnameZ + " " + fnameP); } //-------------------------------------------------------------------------------------------- private void VIEWPNG(string fnameZ) { //***************************************************** //png 画像画面表示 (50%縮尺) //***************************************************** Image img; Bitmap bmp; Graphics g; float ratio = 0.5f; int ww; int hh; int w_org; int h_org; img = Image.FromFile(fnameZ); w_org = img.Width; h_org = img.Height; ww = (int)(ratio * w_org); hh = (int)(ratio * h_org); pictureBox1.Size = new Size(ww, hh); bmp = new Bitmap(ww, hh); pictureBox1.Image = bmp; g = Graphics.FromImage(pictureBox1.Image); g.DrawImage(img, 0, 0, ww, hh); g.Dispose(); img.Dispose(); pictureBox1.Left = 0; pictureBox1.Top = toolStrip1.Height; this.ClientSize = new Size(pictureBox1.Width, pictureBox1.Height + toolStrip1.Height + statusStrip1.Height); toolStripStatusLabel1.Text = string.Format("{0:D} x {1:D} : {2:s}", w_org, h_org, fnameZ); } //-------------------------------------------------------------------------------------------- private double CAL_AREA(double B, double H, double theta) { double rr, hh, ang, A0, A1, A2; ang = theta / 180.0 * pi; rr = 0.5 * B; hh = H - rr - rr * Math.Sin(ang); A0 = (2.0 * rr * Math.Cos(ang) - hh * Math.Tan(ang)) * hh; // 高さhhの台形の面積 */ A1 = rr * rr * (ang + 0.5 * pi); // 扇の面積 */ A2 = rr * rr * Math.Sin(ang) * Math.Cos(ang); // 三角形の面積 */ return A0 + A1 + A2; } //-------------------------------------------------------------------------------------------- private double CAL_LENG(double B, double H, double theta) { double rr, hh, ang, L0, L1; ang = theta / 180.0 * pi; rr = 0.5 * B; hh = H - rr - rr * Math.Sin(ang); L0 = rr * (pi + 2.0 * ang); // 扇の周長 */ L1 = hh / Math.Cos(ang); // 片側直線部の長さ */ return L0 + 2.0 * L1; } //-------------------------------------------------------------------------------------------- private double CAL_THETA(double D0, double Tc, double Tx, double W) { // 角度設定 (degree) */ double r, x1, x2, x3, f1, f2, f3; r = 0.5 * D0 + Tc; x1 = 0.0; x2 = 90.0; x3 = 0.5 * (x1 + x2); do { f1 = CAL_F(x1, W, r, Tx); f2 = CAL_F(x2, W, r, Tx); f3 = CAL_F(x3, W, r, Tx); if (f1 * f3 < 0) { x2 = x3; x3 = 0.5 * (x1 + x2); } if (f3 * f2 < 0) { x1 = x3; x3 = 0.5 * (x1 + x2); } } while (Math.Abs(x1 - x2) > 1e-6); return 0.5 * (x1 + x2); } //-------------------------------------------------------------------------------------------- private double CAL_F(double ang, double W, double r, double Tx) { return W - (2.0 * r * Math.Cos(ang / 180.0 * pi) - 2.0 * (r + Tx - r * Math.Sin(ang / 180.0 * pi)) * Math.Tan(ang / 180.0 * pi)); } //-------------------------------------------------------------------------------------------- private void WGPL(string fnameW, string fnameF, int ksp, double D0, double Tc, double Tx, double W, double ts, double tp, double theta, double Ae, double Ac, double Ls) { System.IO.StreamWriter sw; double x1, y1, x2, y2, x3, y3, x4, y4, h; double BB, HU, HL, ds, dss, dl, dsh, phi; string dat, str; BB = D0 + 2.0 * Tc + 2.0 * ts + 2.0 * tp; HU = 0.5 * D0 + Tc + ts + tp; HL = 0.5 * D0 + Tc + Tx + tp; sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); dat = "reset"; sw.WriteLine(dat); dat = "set terminal postscript eps enhanced font \"Helvetica\" 16"; sw.WriteLine(dat); dat = string.Format("set output \"{0:s}\"", fnameF); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set multiplot"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set origin 0,0"; sw.WriteLine(dat); dat = "set size ratio -1"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set xrange [-8000:8000]"; sw.WriteLine(dat); dat = "set yrange [-8000:8000]"; sw.WriteLine(dat); dat = "set border 0"; sw.WriteLine(dat); dat = "set xtics 0,0,0"; sw.WriteLine(dat); dat = "set ytics 0,0,0"; sw.WriteLine(dat); dat = "set xtics nomirror"; sw.WriteLine(dat); dat = "set ytics nomirror"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set style arrow 1 size graph 0.02,10 filled nohead linewidth 1 linetype 5"; sw.WriteLine(dat);//一点鎖線*/ dat = "set style arrow 2 size graph 0.02,10 filled nohead linewidth 1 linetype 1"; sw.WriteLine(dat);//実線*/ dat = "set style arrow 3 size graph 0.02,10 filled heads linewidth 1 linetype 1"; sw.WriteLine(dat); //両矢印*/ dat = "set style arrow 4 size graph 0.02,10 filled linewidth 1 linetype 1"; sw.WriteLine(dat); //片矢印*/ dat = "#"; sw.WriteLine(dat); //一点鎖線*/ ds = 1000.0; dss = 200.0; dl = 400.0; x1 = 0.5 * BB + ds + dss; y1 = 0.0; x2 = -(0.5 * BB + 0.5 * ds); y2 = 0.0; x3 = 0.0; y3 = -HL - 0.5 * ds; x4 = 0.0; y4 = HU + 0.5 * ds; dat = string.Format("set arrow as 1 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set arrow as 1 from {0:F3},{1:F3} to {2:F3},{3:F3}", x3, y3, x4, y4); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //実線*/ x1 = 0.0; y1 = 0.5 * D0 + Tc; x2 = 0.5 * BB + ds + ds + dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.0; y1 = 0.5 * D0; x2 = 0.5 * BB + ds + dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = 0.5 * BB + ds + dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.0; y1 = -0.5 * D0; x2 = 0.5 * BB + ds + dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.5 * W; y1 = -(0.5 * D0 + Tc + Tx); x2 = 0.5 * BB + ds + ds + dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); str = string.Format("{0:F3}{1:s}", theta, "{/Symbol {\\260}}"); x1 = 0.0; y1 = 0.0; x2 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y2 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x3 = 0.5 * (0.5 * D0) * Math.Cos(theta / 180.0 * pi) - dl * Math.Sin(theta / 180.0 * pi); y3 = -0.5 * (0.5 * D0) * Math.Sin(theta / 180.0 * pi) - dl * Math.Cos(theta / 180.0 * pi); dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotat by {3:F3}", str, x3, y3, -theta); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); x1 = -(0.5 * D0 + Tc); y1 = 0.0; x2 = x1; y2 = -HL - ds - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = -0.5 * W; y1 = -HL + tp; x2 = -0.5 * W; y2 = -HL - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.5 * W; y1 = -HL + tp; x2 = 0.5 * W; y2 = -HL - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = x1; y2 = -HL - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = (0.5 * D0 + Tc); y1 = 0.0; x2 = x1; y2 = -HL - ds - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //両矢印*/ str = (0.5 * D0).ToString("0"); x1 = 0.5 * BB + ds; y1 = 0.5 * D0; x2 = x1; y2 = 0.0; x3 = x1 - dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 90", str, x3, y3); sw.WriteLine(dat); str = ((0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi)).ToString("0"); x1 = 0.5 * BB + ds; y1 = 0.0; x2 = x1; y2 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x3 = x1 + dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 90", str, x3, y3); sw.WriteLine(dat); str = (0.5 * D0 - (0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi)).ToString("0"); x1 = 0.5 * BB + ds; y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = x1; y2 = -(0.5 * D0); x3 = x1 - dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 90", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); str = (D0 + 2.0 * Tc + Tx).ToString("0"); x1 = 0.5 * BB + ds + ds; y1 = -HL; x2 = x1; y2 = HU - ts; x3 = x1 + dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 90", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); str = (0.5 * D0 + Tc - 0.5 * W).ToString("0"); x1 = -(0.5 * D0 + Tc); y1 = -HL - ds; x2 = -0.5 * W; y2 = y1; x3 = 0.5 * (x1 + x2); y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = W.ToString("0"); x1 = -0.5 * W; y1 = -HL - ds; x2 = 0.5 * W; y2 = y1; x3 = 0.0; y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = ((0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi) - 0.5 * W).ToString("0"); x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -HL - ds; x2 = 0.5 * W; y2 = y1; x3 = 0.5 * (x1 + x2); y3 = y2 + dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); str = (D0 + 2.0 * Tc).ToString("0"); x1 = -(0.5 * D0 + Tc); y1 = -HL - ds - ds; x2 = 0.5 * D0 + Tc; y2 = y1; x3 = 0.5 * (x1 + x2); y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //片矢印*/ dsh = 0.8 * ds; str = Tc.ToString("0"); x1 = 0.5 * BB + ds; y1 = 0.5 * D0 + Tc + dsh; x2 = x1; y2 = 0.5 * D0 + Tc; x3 = x1 + dl; y3 = 0.5 * (y2 + 0.5 * D0); dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 90", str, x3, y3); sw.WriteLine(dat); str = (Tc + Tx).ToString("0"); x1 = 0.5 * BB + ds; y1 = -(0.5 * D0 + Tc + Tx + dsh); x2 = x1; y2 = -(0.5 * D0 + Tc + Tx); x3 = x1 + dl; y3 = 0.5 * (y2 - 0.5 * D0); dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 90", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); str = ((0.5 * D0 + Tc) * (1.0 - Math.Cos(theta / 180.0 * pi))).ToString("0"); x1 = 0.5 * D0 + Tc + dsh; y1 = -HL - ds; x2 = 0.5 * D0 + Tc; y2 = y1; x3 = 0.5 * (x2 + (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi)); y3 = y2 - dl; dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //Shotcrete*/ phi = 40.0; str = string.Format("t={0:F0}", ts); h = 0.5 * D0 + Tc + ts; x1 = -(h + dsh) * Math.Cos(phi / 180.0 * pi); y1 = (h + dsh) * Math.Sin(phi / 180.0 * pi); x2 = -h * Math.Cos(phi / 180.0 * pi); y2 = h * Math.Sin(phi / 180.0 * pi); x3 = x1; y3 = y1 + 0.5 * dl; dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = "Shotcrete"; y3 = y3 + 1.2 * dl; dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); if (ksp != 0) { //Steel pipe (t0=50mm)*/ phi = 75.0; str = "Steel pipe"; h = 0.5 * D0 + Tc + ts; x1 = -(h + dsh) * Math.Cos(phi / 180.0 * pi); y1 = (h + dsh) * Math.Sin(phi / 180.0 * pi); h = 0.5 * D0 + 50.0; x2 = -h * Math.Cos(phi / 180.0 * pi); y2 = h * Math.Sin(phi / 180.0 * pi); x3 = x1; y3 = y1 + 0.5 * dl; dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); } //水路内径*/ str = string.Format("r={0:F0}", 0.5 * D0); x1 = 0.0; y1 = 0.0; x2 = 0.5 * D0 * Math.Cos(45.0 / 180.0 * pi); y2 = 0.5 * D0 * Math.Sin(45.0 / 180.0 * pi); x3 = 0.5 * x2 - dl * Math.Sin(45.0 / 180.0 * pi); y3 = 0.5 * y2 + dl * Math.Cos(45.0 / 180.0 * pi); dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center rotate by 45", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //数量描画*/ x3 = 0.0; str = string.Format("Ae={0:F1}{1:s}", Ae,"m^{/=10 2}"); y3 = 7500.0; dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3}", str, x3, y3); sw.WriteLine(dat); str = string.Format("Ac={0:F1}{1:2}", Ac, "m^{/=10 2}"); y3 = 6750.0; dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3}", str, x3, y3); sw.WriteLine(dat); str = string.Format("Ls={0:F1} m", Ls); y3 = 6000.0; dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3}", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //骨材記号描画*/ AGR(sw, D0, Tc, Tx, W, theta); dat = "#"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //構造線描画*/ dat = "plot \"-\" with lines linewidth 3 linetype 1 notitle,\\"; sw.WriteLine(dat); //覆工外形線*/ dat = "\"-\" with lines linewidth 3 linetype 1 notitle"; sw.WriteLine(dat); //掘削外形線*/ //覆工外形*/ x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = 0.5 * W; y2 = -(0.5 * D0 + Tc + Tx); x3 = -x2; y3 = y2; x4 = -x1; y4 = y1; dat = string.Format("{0:F3} {1:F3}", x1, y1); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x2, y2); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x3, y3); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x4, y4); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); //掘削外形*/ x1 = (0.5 * D0 + Tc + ts) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc + ts) * Math.Sin(theta / 180.0 * pi); x2 = 0.5 * W + ts / Math.Cos(theta / 180.0 * pi); y2 = -(0.5 * D0 + Tc + Tx); x3 = -x2; y3 = y2; x4 = -x1; y4 = y1; dat = string.Format("{0:F3} {1:F3}", x1, y1); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x2, y2); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x3, y3); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x4, y4); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //円形部描画*/ dat = "set origin 0,0"; sw.WriteLine(dat); dat = "set polar"; sw.WriteLine(dat); dat = "set angles degree"; sw.WriteLine(dat); dat = "set samples 720"; sw.WriteLine(dat); dat = "set trange [0:360]"; sw.WriteLine(dat); if (ksp == 0) { dat = string.Format("plot {0:F3} with lines linewidth 3 linetype 1 notitle", 0.5 * D0); sw.WriteLine(dat); //水路内径*/ } else { dat = string.Format("plot {0:F3} with lines linewidth 3 linetype 1 notitle,\\", 0.5 * D0); sw.WriteLine(dat); //鉄管内径*/ dat = string.Format("{0:F3} with lines linewidth 3 linetype 1 notitle", 0.5 * D0 + 50.0); sw.WriteLine(dat); //鉄管外径(t0=50mm)*/ } dat = "#"; sw.WriteLine(dat); dat = "set origin 0,0"; sw.WriteLine(dat); dat = string.Format("set trange [{0:F3}:{1:F3}]", -theta, 180.0 + theta); sw.WriteLine(dat); dat = string.Format("plot {0:F3} with lines linewidth 3 linetype 1 notitle,\\", 0.5 * D0 + Tc); sw.WriteLine(dat); //覆工外径*/ dat = string.Format("{0:F3} with lines linewidth 2 linetype 1 notitle", 0.5 * D0 + Tc + ts); sw.WriteLine(dat); //掘削径*/ dat = "#"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "unset multiplot"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); sw.Close(); } //-------------------------------------------------------------------------------------------- private void AGR(System.IO.StreamWriter sw, double D0, double Tc, double Tx, double W, double theta) { //骨材マークの描画*/ int i, MG, MT; double[] x = new double[Nmax]; double[] y = new double[Nmax]; double dr1 = 500.0, dr2 = 200.0; double t1 = 0.0, t2 = 360.0; string dat; CAL_XYARRAY(t1, t2, dr1, dr2, x, y, out MG, out MT, D0, Tc, Tx, W, theta); for (i = 0; i <= MG; i++) { dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center font \"arial,{3:D}\"", "o", x[i], y[i], 10); sw.WriteLine(dat); } for (i = MG + 1; i <= MT; i++) { dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center font \"arial,{3:D}\"", "o", x[i], y[i], 3); sw.WriteLine(dat); } } //-------------------------------------------------------------------------------------------- private void CAL_XY(double t1, double t2, double D0, double Tc, double Tx, double W, double theta, out double xx, out double yy) { ///**************************/ // 乱数での座標設定 */ ///**************************/ double rr, tt, r1, r2; double phi1, phi2; double x1, y1, x2, y2, a1, b1, a2, b2, a3, b3; Random rand = new Random(); int irmax = 32767; int ir; r2 = 0.0; x1 = 0.5 * W; y1 = (0.5 * D0 + Tc + Tx); phi1 = 270.0 - Math.Atan(x1 / y1) / pi * 180.0; x1 = -(0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = -0.5 * W; y2 = -(0.5 * D0 + Tc + Tx); a1 = (y2 - y1) / (x2 - x1); b1 = (x2 * y1 - x1 * y2) / (x2 - x1); a2 = 0.0; b2 = -(0.5 * D0 + Tc + Tx); x1 = 0.5 * W; y1 = (0.5 * D0 + Tc + Tx); phi2 = 270.0 + Math.Atan(x1 / y1) / pi * 180.0; x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = 0.5 * W; y2 = -(0.5 * D0 + Tc + Tx); a3 = (y2 - y1) / (x2 - x1); b3 = (x2 * y1 - x1 * y2) / (x2 - x1); ir = rand.Next(irmax); tt = t1 + (double)ir / (double)irmax * (t2 - t1); r1 = 0.5 * D0 + 100.0; if (0.0 <= tt && tt <= 180.0 + theta) r2 = 0.5 * D0 + Tc; if (180.0 + theta < tt && tt <= phi1) r2 = Math.Abs(b1 / (Math.Sin(tt / 180.0 * pi) - a1 * Math.Cos(tt / 180.0 * pi))); if (phi1 < tt && tt <= phi2) r2 = Math.Abs(b2 / (Math.Sin(tt / 180.0 * pi) - a2 * Math.Cos(tt / 180.0 * pi))); if (phi2 < tt && tt <= 360.0 - theta) r2 = Math.Abs(b3 / (Math.Sin(tt / 180.0 * pi) - a3 * Math.Cos(tt / 180.0 * pi))); if (360.0 - theta < tt && tt <= 360.0) r2 = 0.5 * D0 + Tc; ir = rand.Next(irmax); r2 = r2 - 100.0; rr = r1 + (double)ir / (double)irmax * (r2 - r1); xx = rr * Math.Cos(tt / 180.0 * pi); yy = rr * Math.Sin(tt / 180.0 * pi); } //-------------------------------------------------------------------------------------------- private void CAL_XYARRAY(double t1, double t2, double dr1, double dr2, double[] x, double[] y, out int MG, out int MT, double D0, double Tc, double Tx, double W, double theta) { ///**************************/ // 骨材を描画する座標の設定 */ ///**************************/ int i, k, l1, l2, mflag, iflag; double xx, yy; CAL_XY(t1, t2, D0, Tc, Tx, W, theta, out xx, out yy); x[0] = xx; y[0] = yy; k = 0; l1 = 0; do { l2 = 0; do { CAL_XY(t1, t2, D0, Tc, Tx, W, theta, out xx, out yy); mflag = 1; for (i = 0; i <= k; i++) { if (dr1 < Math.Sqrt((xx - x[i]) * (xx - x[i]) + (yy - y[i]) * (yy - y[i]))) { iflag = 1; } else { iflag = 0; } mflag = mflag * iflag; } if (mflag == 1) break; l2 = l2 + 1; } while (l2 < (int)(Nmax / 2)); if (mflag == 1) { k = k + 1; x[k] = xx; y[k] = yy; } l1 = l1 + 1; } while (l1 < (int)(Nmax / 2)); MG = k; l1 = 0; do { l2 = 0; do { CAL_XY(t1, t2, D0, Tc, Tx, W, theta, out xx, out yy); mflag = 1; for (i = 0; i <= k; i++) { if (dr2 < Math.Sqrt((xx - x[i]) * (xx - x[i]) + (yy - y[i]) * (yy - y[i]))) { iflag = 1; } else { iflag = 0; } mflag = mflag * iflag; } if (mflag == 1) break; l2 = l2 + 1; } while (l2 < (int)(Nmax / 2)); if (mflag == 1) { k = k + 1; x[k] = xx; y[k] = yy; } l1 = l1 + 1; } while (l1 < (int)(Nmax / 2)); MT = k; } //-------------------------------------------------------------------------------------------- private void WGPLmodel(string fnameW, string fnameF, double D0, double Tc, double Tx, double W, double ts, double tp, double theta) { System.IO.StreamWriter sw; double x1, y1, x2, y2, x3, y3, x4, y4, h; double BB, HU, HL, ds, dss, dl; string dat, str; BB = D0 + 2.0 * Tc + 2.0 * ts + 2.0 * tp; HU = 0.5 * D0 + Tc + ts + tp; HL = 0.5 * D0 + Tc + Tx + tp; ds = 1000.0; dss = 200.0; dl = 500.0; sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.Default); dat = "reset"; sw.WriteLine(dat); dat = "set terminal postscript eps enhanced font \"Helvetica\" 20"; sw.WriteLine(dat); dat = string.Format("set output \"{0:s}\"", fnameF); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set multiplot"; sw.WriteLine(dat); dat = "#"; dat = "set origin 0,0"; sw.WriteLine(dat); dat = "set size ratio -1"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set xrange [-10000:10000]"; sw.WriteLine(dat); dat = "set yrange [-10000:10000]"; sw.WriteLine(dat); dat = "set border 0"; sw.WriteLine(dat); dat = "set xtics 0,0,0"; sw.WriteLine(dat); dat = "set ytics 0,0,0"; sw.WriteLine(dat); dat = "set xtics nomirror"; sw.WriteLine(dat); dat = "set ytics nomirror"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "set style arrow 1 size graph 0.02,10 filled nohead linewidth 1 linetype 5"; sw.WriteLine(dat);//一点鎖線*/ dat = "set style arrow 2 size graph 0.02,10 filled nohead linewidth 1 linetype 1"; sw.WriteLine(dat);//実線*/ dat = "set style arrow 3 size graph 0.02,10 filled heads linewidth 1 linetype 1"; sw.WriteLine(dat); //両矢印*/ dat = "set style arrow 4 size graph 0.02,10 filled linewidth 1 linetype 1"; sw.WriteLine(dat); //片矢印*/ //一点鎖線*/ x1 = 0.5 * BB + 0.5 * ds; y1 = 0.0; x2 = -x1; y2 = 0.0; x3 = 0.0; y3 = -HL - 0.5 * ds; x4 = 0.0; y4 = HU + 0.5 * ds; dat = string.Format("set arrow as 1 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set arrow as 1 from {0:F3},{1:F3} to {2:F3},{3:F3}", x3, y3, x4, y4); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //実線*/ x1 = 0.0; y1 = 0.5 * D0 + Tc + ts; x2 = 0.5 * BB + ds + dss; y2 = 0.5 * D0 + Tc + ts; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.0; y1 = 0.5 * D0 + Tc; x2 = 0.5 * BB + ds + dss; y2 = 0.5 * D0 + Tc; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.0; y1 = 0.5 * D0; x2 = 0.5 * BB + ds + dss; y2 = 0.5 * D0; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.0; y1 = -0.5 * D0; x2 = 0.5 * BB + ds + dss; y2 = -0.5 * D0; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.0; y1 = -(0.5 * D0 + Tc); x2 = 0.5 * BB + ds + dss; y2 = -(0.5 * D0 + Tc); dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.5 * W; y1 = -(0.5 * D0 + Tc + Tx); x2 = 0.5 * BB + ds + dss; y2 = -(0.5 * D0 + Tc + Tx); dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); str = "{/Symbol q}"; x1 = 0.0; y1 = 0.0; x2 = -(0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y2 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x3 = 0.5 * x2; y3 = 0.25 * y2; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = "{/Symbol q}"; x1 = 0.0; y1 = 0.0; x2 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y2 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x3 = 0.5 * x2; y3 = 0.25 * y2; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); x1 = -0.5 * W; y1 = -HL + tp; x2 = -0.5 * W; y2 = -HL - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = 0.5 * W; y1 = -HL + tp; x2 = 0.5 * W; y2 = -HL - ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = -(0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = x1; y2 = -HL - 2.0 * ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = x1; y2 = -HL - 2.0 * ds - dss; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = -(0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = -0.5 * BB - ds - dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); x1 = -0.5 * W; y1 = -HL + tp; x2 = -0.5 * BB - ds - dss; y2 = y1; dat = string.Format("set arrow as 2 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); //両矢印*/ dl = 500.0; str = "T{/=14 c}"; x1 = 0.5 * BB + ds; y1 = 0.5 * D0 + Tc; x2 = x1; y2 = 0.5 * D0; x3 = x1 + dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} left", str, x3, y3); sw.WriteLine(dat); str = "D{/=14 0}"; x1 = 0.5 * BB + ds; y1 = 0.5 * D0; x2 = x1; y2 = -0.5 * D0; x3 = x1 + dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} left", str, x3, y3); sw.WriteLine(dat); str = "T{/=14 c}"; x1 = 0.5 * BB + ds; y1 = -0.5 * D0; x2 = x1; y2 = -(0.5 * D0 + Tc); x3 = x1 + dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} left", str, x3, y3); sw.WriteLine(dat); str = "W"; x1 = -0.5 * W; y1 = -HL - ds; x2 = 0.5 * W; y2 = y1; x3 = 0.0; y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = "h*tan{/Symbol q}"; x1 = -(0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -HL - ds; x2 = -0.5 * W; y2 = y1; x3 = 0.5 * (x1 + x2); y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = "h*tan{/Symbol q}"; x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -HL - ds; x2 = 0.5 * W; y2 = y1; x3 = 0.5 * (x1 + x2); y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = "2(D{/=14 0}/2+T{/=14 c})*cos{/Symbol q}"; x1 = -(0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -HL - 2.0 * ds; x2 = -x1; y2 = y1; x3 = 0.0; y3 = y2 - dl; dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); str = "h"; x1 = -0.5 * BB - ds; y1 = -(0.5 * D0 + Tc + Tx); x2 = x1; y2 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x3 = x1 - dl; y3 = 0.5 * (y1 + y2); dat = string.Format("set arrow as 3 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} center", str, x3, y3); sw.WriteLine(dat); //片矢印*/ str = "t{/=14 s}"; x1 = 0.5 * BB + ds; y1 = 0.5 * D0 + Tc + ts + ds; x2 = x1; y2 = 0.5 * D0 + Tc + ts; x3 = x1 + dl; y3 = 0.5 * (y2 + 0.5 * D0 + Tc); dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} left", str, x3, y3); sw.WriteLine(dat); str = "T{/=14 x}"; x1 = 0.5 * BB + ds; y1 = -(0.5 * D0 + Tc + Tx + ds); x2 = x1; y2 = -(0.5 * D0 + Tc + Tx); x3 = x1 + dl; y3 = 0.5 * (y2 - (0.5 * D0 + Tc)); dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} left", str, x3, y3); sw.WriteLine(dat); h = 0.5 * D0 + Tc + ts; x1 = -(h - ds) * Math.Cos(45.0 / 180.0 * pi); y1 = (h - ds) * Math.Sin(45.0 / 180.0 * pi); x2 = -h * Math.Cos(45.0 / 180.0 * pi); y2 = h * Math.Sin(45.0 / 180.0 * pi); dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); str = " t{/=14 p}"; h = 0.5 * D0 + Tc + ts + tp; x1 = -(h + ds) * Math.Cos(45.0 / 180.0 * pi); y1 = (h + ds) * Math.Sin(45.0 / 180.0 * pi); x2 = -h * Math.Cos(45.0 / 180.0 * pi); y2 = h * Math.Sin(45.0 / 180.0 * pi); x3 = x1; y3 = y1; dat = string.Format("set arrow as 4 from {0:F3},{1:F3} to {2:F3},{3:F3}", x1, y1, x2, y2); sw.WriteLine(dat); dat = string.Format("set label \"{0:s}\" at {1:F3},{2:F3} right rotate by -45", str, x3, y3); sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //構造線描画*/ dat = "plot \"-\" with lines linewidth 5 linetype 1 notitle,\\"; sw.WriteLine(dat); //覆工外形線*/ dat = "\"-\" with lines linewidth 5 linetype 1 notitle,\\"; sw.WriteLine(dat); //掘削外形線*/ dat = "\"-\" with lines linewidth 3 linetype 3 notitle"; sw.WriteLine(dat); //支払外形線*/ //覆工外形*/ x1 = (0.5 * D0 + Tc) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc) * Math.Sin(theta / 180.0 * pi); x2 = 0.5 * W; y2 = -(0.5 * D0 + Tc + Tx); x3 = -x2; y3 = y2; x4 = -x1; y4 = y1; dat = string.Format("{0:F3} {1:F3}", x1, y1); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x2, y2); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x3, y3); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x4, y4); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); //掘削外形*/ x1 = (0.5 * D0 + Tc + ts) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc + ts) * Math.Sin(theta / 180.0 * pi); x2 = 0.5 * W + ts / Math.Cos(theta / 180.0 * pi); y2 = -(0.5 * D0 + Tc + Tx); x3 = -x2; y3 = y2; x4 = -x1; y4 = y1; dat = string.Format("{0:F3} {1:F3}", x1, y1); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x2, y2); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x3, y3); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x4, y4); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); //支払外形*/ x1 = (0.5 * D0 + Tc + ts + tp) * Math.Cos(theta / 180.0 * pi); y1 = -(0.5 * D0 + Tc + ts + tp) * Math.Sin(theta / 180.0 * pi); h = 0.5 * D0 + Tc + Tx + tp - (0.5 * D0 + Tc + ts + tp) * Math.Sin(theta / 180.0 * pi); x2 = x1 - h * Math.Sin(theta / 180.0 * pi); y2 = -(0.5 * D0 + Tc + Tx + tp); x3 = -x2; y3 = y2; x4 = -x1; y4 = y1; dat = string.Format("{0:F3} {1:F3}", x1, y1); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x2, y2); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x3, y3); sw.WriteLine(dat); dat = string.Format("{0:F3} {1:F3}", x4, y4); sw.WriteLine(dat); dat = "e"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); //円形部描画*/ dat = "set origin 0,0"; sw.WriteLine(dat); dat = "set polar"; sw.WriteLine(dat); dat = "set angles degree"; sw.WriteLine(dat); dat = "set samples 720"; sw.WriteLine(dat); dat = "set trange [0:360]"; sw.WriteLine(dat); dat = string.Format("plot {0:F3} with lines linewidth 5 linetype 1 notitle,\\", 0.5 * D0); sw.WriteLine(dat); //水路内径*/ dat = string.Format("{0:F3} with lines linewidth 5 linetype 3 notitle", 0.5 * D0 + Tc); sw.WriteLine(dat); //覆工外径円*/ dat = "#"; sw.WriteLine(dat); dat = "set origin 0,0"; sw.WriteLine(dat); dat = string.Format("set trange [{0:F3}:{1:F3}]", -theta, 180.0 + theta); sw.WriteLine(dat); dat = string.Format("plot {0:F3} with lines linewidth 5 linetype 1 notitle,\\", 0.5 * D0 + Tc); sw.WriteLine(dat); //覆工外径*/ dat = string.Format("{0:F3} with lines linewidth 5 linetype 1 notitle,\\", 0.5 * D0 + Tc + ts); sw.WriteLine(dat); //掘削径*/ dat = string.Format("{0:F3} with lines linewidth 3 linetype 2 notitle", 0.5 * D0 + Tc + ts + tp); sw.WriteLine(dat); //支払径*/ dat = "#"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); dat = "unset multiplot"; sw.WriteLine(dat); dat = "#"; sw.WriteLine(dat); sw.Close(); } //-------------------------------------------------------------------------------------------- } }