-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
646 lines (560 loc) · 26.4 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
using CloneExtensions;
using iText=iTextSharp.text;
using Microsoft.Win32;
using OxyPlot;
using OxyPlot.Wpf;
using RcDesign;
using RcDesign.InteractionDiagram;
using RcDesign.Material;
using RcDesign.Section;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UnitsNet.Extensions.NumberToPressure;
using iTextSharp.text.pdf;
using System.Drawing;
namespace EtkilesimDiyagram
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
const string mFileFilter = "Karşılıklı Etkileşim Diyagram (*.xml)|*.xml";
AppFileTemplate oldFile = null;
string mFilePath;
public MainWindow()
{
InitializeComponent();
DataContext = AppFileTemplate.CreateTemplate();
oldFile = ((AppFileTemplate)DataContext).GetClone();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
(DataContext as AppFileTemplate).PropertyChanged += DataContextPropertyChangedEventHandler;
}
private void DataContextPropertyChangedEventHandler(object sender, PropertyChangedEventArgs e)
{
List<string> prpNames = new List<string> { "ShowNominalDiagram", "ShowAllDiagram" , "ShowLeftDiagram", "ShowRightDiagram", "ShowGridLines", "ShowLoads", "ShowTitle" };
if (prpNames.Contains(e.PropertyName))
{
PlotView.Model = (DataContext as AppFileTemplate).GetModel();
}
WriteToInfoBox();
}
private void mDosyaYeni_Click(object sender, RoutedEventArgs e)
{
string pFilePath = mFilePath;
sbFileName.Text = mFilePath = SaveFile("", "Yeni", mFileFilter);
if (string.IsNullOrEmpty(mFilePath))
{
sbFileName.Text = mFilePath = pFilePath;
return;
}
else
{
if (File.Exists(mFilePath))
File.Delete(mFilePath);
DataContext = AppFileTemplate.CreateTemplate();
AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath);
(DataContext as AppFileTemplate).PropertyChanged -= DataContextPropertyChangedEventHandler;
(DataContext as AppFileTemplate).PropertyChanged += DataContextPropertyChangedEventHandler;
PlotView.Model = (DataContext as AppFileTemplate).GetModel();
WriteToInfoBox();
}
}
private void mDosyaAc_Click(object sender, RoutedEventArgs e)
{
string pFilePath = mFilePath;
sbFileName.Text = mFilePath = OpenFile("", "Aç", mFileFilter);
if (string.IsNullOrEmpty(mFilePath))
{
sbFileName.Text = mFilePath = pFilePath;
return;
}
else
{
DataContext = AppFileTemplate.DeSerialize(mFilePath);
(DataContext as AppFileTemplate).PropertyChanged -= DataContextPropertyChangedEventHandler;
(DataContext as AppFileTemplate).PropertyChanged += DataContextPropertyChangedEventHandler;
PlotView.Model = (DataContext as AppFileTemplate).GetModel();
WriteToInfoBox();
}
}
private void mDosyaKaydet_Click(object sender, RoutedEventArgs e)
{
string pFilePath = mFilePath;
if (!File.Exists(mFilePath))
{
sbFileName.Text = mFilePath = SaveFile("", "Kaydet", mFileFilter);
if (string.IsNullOrEmpty(mFilePath))
{
sbFileName.Text = mFilePath = pFilePath;
return;
}
else
{
if (DataContext == null)
DataContext = AppFileTemplate.CreateTemplate();
oldFile = (AppFileTemplate)DataContext;
AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath);
}
}
else
{
AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath);
}
}
private void mDosyaFarkliKaydet_Click(object sender, RoutedEventArgs e)
{
string pFilePath = mFilePath;
if (File.Exists(mFilePath))
{
sbFileName.Text = mFilePath = SaveFile("", "Farklı Kaydet", mFileFilter);
if (string.IsNullOrEmpty(mFilePath))
{
sbFileName.Text = mFilePath = pFilePath;
return;
}
else
{
if (File.Exists(mFilePath))
File.Delete(mFilePath);
AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath);
(DataContext as AppFileTemplate).PropertyChanged -= DataContextPropertyChangedEventHandler;
(DataContext as AppFileTemplate).PropertyChanged += DataContextPropertyChangedEventHandler;
}
}
else
{
MessageBox.Show("Aktif bir dosya bulunamadı!", Properties.Settings.Default.AppName, MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
private void mCikis_Click(object sender, RoutedEventArgs e)
{
DataContext = oldFile;
this.Close();
}
private void menuKesit_Click(object sender, RoutedEventArgs e)
{
SectionGeometryWnd sWnd = new SectionGeometryWnd();
sWnd.Owner = this;
sWnd.ShowDialog();
}
private void menuHesapla_Click(object sender, RoutedEventArgs e)
{
PlotView.Model = (DataContext as AppFileTemplate).GetModel();
WriteToInfoBox();
}
private void menuShowFullDiagram_Click(object sender, RoutedEventArgs e)
{
if (!menuShowLeftDiagram.IsChecked && !menuShowRightDiagram.IsChecked)
{
menuShowFullDiagram.IsChecked = true;
toolbarShowFullDiagram.IsChecked = true;
return;
}
if(menuShowFullDiagram.IsChecked)
{
menuShowLeftDiagram.IsChecked = false;
menuShowRightDiagram.IsChecked = false;
toolbarShowLeftDiagram.IsChecked = false;
toolbarShowRightDiagram.IsChecked = false;
}
}
private void menuShowRightDiagram_Click(object sender, RoutedEventArgs e)
{
if (!menuShowLeftDiagram.IsChecked && !menuShowFullDiagram.IsChecked)
{
menuShowRightDiagram.IsChecked = true;
toolbarShowRightDiagram.IsChecked = true;
return;
}
if (menuShowRightDiagram.IsChecked)
{
menuShowLeftDiagram.IsChecked = false;
menuShowFullDiagram.IsChecked = false;
toolbarShowLeftDiagram.IsChecked = false;
toolbarShowFullDiagram.IsChecked = false;
}
}
private void menuShowLeftDiagram_Click(object sender, RoutedEventArgs e)
{
if (!menuShowRightDiagram.IsChecked && !menuShowFullDiagram.IsChecked)
{
menuShowLeftDiagram.IsChecked = true;
toolbarShowLeftDiagram.IsChecked = true;
return;
}
if (menuShowLeftDiagram.IsChecked)
{
menuShowRightDiagram.IsChecked = false;
menuShowFullDiagram.IsChecked = false;
toolbarShowRightDiagram.IsChecked = false;
toolbarShowFullDiagram.IsChecked = false;
}
}
private void toolbarShowFullDiagram_Click(object sender, RoutedEventArgs e)
{
if ((!toolbarShowLeftDiagram.IsChecked) == true && (!toolbarShowRightDiagram.IsChecked) == true)
{
toolbarShowFullDiagram.IsChecked = true;
menuShowFullDiagram.IsChecked = true;
return;
}
if (toolbarShowFullDiagram.IsChecked == true)
{
toolbarShowLeftDiagram.IsChecked = false;
toolbarShowRightDiagram.IsChecked = false;
menuShowLeftDiagram.IsChecked = false;
menuShowRightDiagram.IsChecked = false;
}
}
private void toolbarShowLeftDiagram_Click(object sender, RoutedEventArgs e)
{
if (!toolbarShowRightDiagram.IsChecked == true && !toolbarShowFullDiagram.IsChecked == true)
{
toolbarShowLeftDiagram.IsChecked = true;
menuShowLeftDiagram.IsChecked = true;
return;
}
if (toolbarShowLeftDiagram.IsChecked == true)
{
toolbarShowRightDiagram.IsChecked = false;
toolbarShowFullDiagram.IsChecked = false;
menuShowRightDiagram.IsChecked = false;
menuShowFullDiagram.IsChecked = false;
}
}
private void toolbarShowRightDiagram_Click(object sender, RoutedEventArgs e)
{
if ((!toolbarShowLeftDiagram.IsChecked) == true && (!toolbarShowFullDiagram.IsChecked) == true)
{
toolbarShowRightDiagram.IsChecked = true;
menuShowRightDiagram.IsChecked = true;
return;
}
if (toolbarShowRightDiagram.IsChecked == true)
{
toolbarShowLeftDiagram.IsChecked = false;
toolbarShowFullDiagram.IsChecked = false;
menuShowLeftDiagram.IsChecked = false;
menuShowFullDiagram.IsChecked = false;
}
}
private void menuDonati_Click(object sender, RoutedEventArgs e)
{
ReinforcingWnd sWnd = new ReinforcingWnd();
sWnd.Owner = this;
sWnd.ShowDialog();
}
private void menuYukler_Click(object sender, RoutedEventArgs e)
{
LoadsWnd sWnd = new LoadsWnd();
sWnd.Owner = this;
sWnd.ShowDialog();
}
private void menuGenelBilgi_Click(object sender, RoutedEventArgs e)
{
GenelBilgiWnd sWnd = new GenelBilgiWnd();
sWnd.Owner = this;
sWnd.ShowDialog();
}
private void menuMalzeme_Click(object sender, RoutedEventArgs e)
{
MalzemeWnd sWnd = new MalzemeWnd();
sWnd.Owner = this;
sWnd.ShowDialog();
}
private void menuKapasiteAzaltma_Click(object sender, RoutedEventArgs e)
{
KapasiteAzaltmaWnd sWnd = new KapasiteAzaltmaWnd();
sWnd.Owner = this;
sWnd.ShowDialog();
}
public void WriteToInfoBox()
{
AppFileTemplate f = (AppFileTemplate)DataContext;
FlowDocument flowDoc = new FlowDocument();
Paragraph para = new Paragraph();
para.Inlines.Add(new Bold(new Run("MALZEME:\n")));
para.Inlines.Add(new Run(string.Format("fc={0:0} MPa\n", f.fc)));
para.Inlines.Add(new Run(string.Format("fcd={0:0.00} MPa\n", f.Beton().fcd.TonnesForcePerSquareMeter().Megapascals)));
para.Inlines.Add(new Run(string.Format("k1={0:0.000} MPa\n", f.Beton().k1)));
para.Inlines.Add(new Run(string.Format("Ec={0} MPa\n", f.Beton().E.TonnesForcePerSquareMeter().Megapascals)));
para.Inlines.Add(new Run(string.Format("fy={0:0.00} MPa\n", f.fy)));
para.Inlines.Add(new Run(string.Format("fyd={0:0.00} MPa\n", f.DonatiCeligi().fyd.TonnesForcePerSquareMeter().Megapascals)));
para.Inlines.Add(new Run(string.Format("Es={0} MPa\n\n", f.DonatiCeligi().E.TonnesForcePerSquareMeter().Megapascals)));
para.Inlines.Add(new Bold(new Run("KESİT:\n")));
para.Inlines.Add(new Run(string.Format("b={0} cm\n", f.b)));
para.Inlines.Add(new Run(string.Format("h={0} cm\n", f.h)));
para.Inlines.Add(new Run(string.Format("Alan={0} cm²\n\n", f.b * f.h)));
para.Inlines.Add(new Bold(new Run("DONATI:\n")));
int j = 1;
foreach (var rb in f.ReinforcingBars)
{
para.Inlines.Add(new Run(string.Format("As{2}={0:0.00} cm² d{2}={1:0.00} cm\n", rb.As, rb.di, j)));
j++;
}
para.Inlines.Add(new Run(string.Format("r=%{0:0.00}\n", 100.0 * f.ReinforcingBars.Sum(i => i.As) / (f.b * f.h))));
flowDoc.Blocks.Add(para);
infoBox.Document = flowDoc;
}
public static string OpenFile(string directoryPath, string title, string filter)
{
OpenFileDialog opd = new OpenFileDialog();
//opd.InitialDirectory = directoryPath;
opd.Filter = filter;
opd.Title = title;
opd.Multiselect = false;
bool? rs = opd.ShowDialog();
if (rs == true)
{
return opd.FileName;
}
else
return null;
}
public static string SaveFile(string directoryPath, string title, string filter)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = filter;
sfd.Title = title;
sfd.OverwritePrompt = true;
bool? rs = sfd.ShowDialog();
if (rs == true)
{
return sfd.FileName;
}
else
return null;
}
private void menuCreateMNReport_Click(object sender, RoutedEventArgs e)
{
string fileName = SaveFile("", "Kaydet", "Metin dsoyası (*.txt)|*.txt");
if (!string.IsNullOrEmpty(fileName))
{
AppFileTemplate f = (AppFileTemplate)DataContext;
InteractionDiagramItem.WriteToFile(f.GetItems(), fileName);
}
}
private void menuCopyClipboard_Click(object sender, RoutedEventArgs e)
{
var pngExporter = new PngExporter { Width = 600, Height = 400, Background = OxyColors.White };
var bitmap = pngExporter.ExportToBitmap(PlotView.Model);
Clipboard.SetImage(bitmap);
}
private void menuSaveAsPng_Click(object sender, RoutedEventArgs e)
{
string fileName = SaveFile("", "Kaydet", "İmaj dosyası (*.png)|*.png");
if (!string.IsNullOrEmpty(fileName))
{
var pngExporter = new PngExporter { Width = 600, Height = 400, Background = OxyColors.White };
pngExporter.ExportToFile(PlotView.Model, fileName);
}
}
private void menuSaveAsPdf_Click(object sender, RoutedEventArgs e)
{
string fileName = SaveFile("", "Kaydet", "Pdf dosyası (*.pdf)|*.pdf");
if (!string.IsNullOrEmpty(fileName))
{
using (var stream = File.Create(fileName))
{
var pdfExporter = new PdfExporter { Width = 600, Height = 400 };
pdfExporter.Export(PlotView.Model, stream);
}
}
}
private void menuCreatePdfReport_Click(object sender, RoutedEventArgs e)
{
string fileName = SaveFile("", "Kaydet", "Pdf dsoyası (*.pdf)|*.pdf");
if (!string.IsNullOrEmpty(fileName))
{
try
{
CreateReport(fileName);
}
catch (PdfException de)
{
MessageBox.Show(de.Message);
}
catch (IOException ioe)
{
MessageBox.Show(ioe.Message);
}
}
}
private void CreateReport(string filePath)
{
AppFileTemplate f = (AppFileTemplate)DataContext;
// margins
float left = 30;
float right = 10;
float top = 10;
float bottom = 10;
float headH = 20;
float indent = 5;
//string fontName = "C:\\WINDOWS\\FONTS\\CALIBRI.TTF";
string fontName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "CALIBRI.TTF");
iText.Font NormalSatirFont = iText.FontFactory.GetFont(fontName, "CP1254", 10, iText.Font.NORMAL);
iText.Font BoldSatirFont = iText.FontFactory.GetFont(fontName, "CP1254", 10, iText.Font.BOLD);
iText.Font NormalRiseFont = iText.FontFactory.GetFont(fontName, "CP1254", 8, iText.Font.NORMAL);
iText.Font NormalSymbolFont = iText.FontFactory.GetFont(iText.FontFactory.SYMBOL, 10, iText.Font.NORMAL);
iText.Document doc = new iText.Document(iText.PageSize.A4, left, right, top, bottom);
float xLL = doc.GetLeft(left);
float yLL = doc.GetBottom(bottom);
float xUR = doc.GetRight(right);
float yUR = doc.GetTop(top);
float w = xUR - xLL;
float h = yUR - yLL;
float xUL = xLL;
float yUL = yUR;
float xLR = xUR;
float yLR = yLL;
//float graphW = w - 10;
//float graphH = graphW * 2 / 3;
float graphH = 3 * h / 5;
float graphW = w - 10;
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(filePath, FileMode.Create));
doc.Open();
// direct content
PdfContentByte cb = writer.DirectContent;
// çizgiler
DrawLine(cb, xUR - w, yUR, xUR, yUR);
DrawLine(cb, xUR - w, yUR, xLL, yLL);
DrawLine(cb, xLL, yLL, xLL + w, yLL);
DrawLine(cb, xLL + w, yLL, xUR, yUR);
DrawLine(cb, xUL, yUL - headH, xUR, yUR - headH);
DrawLine(cb, xUL, yUL - headH - graphH, xUR, yUR - headH - graphH);
// başlık
ColumnText ct = new ColumnText(cb);
ct.Indent = indent;
iText.Phrase txt = new iText.Phrase();
txt.Add(new iText.Chunk(f.ReportTitle, NormalSatirFont));
ct.SetSimpleColumn(txt, xUL, yUL - headH, xUR, yUR, headH / 1.5f, iText.Element.ALIGN_LEFT | iText.Element.ALIGN_MIDDLE);
ct.Go();
var stream = new MemoryStream();
var pngExporter = new PngExporter { Width = (int)graphW, Height = (int)graphH, Background = OxyColors.White };
pngExporter.Export(PlotView.Model, stream);
iText.Image png = iText.Image.GetInstance(stream.GetBuffer());
png.Alignment = iText.Element.ALIGN_CENTER | iText.Element.ALIGN_MIDDLE;
png.SetAbsolutePosition(xUL, yUL - headH - graphH);
doc.Add(png);
float kstW = w/2;
float kstH = (h - headH - graphH) / 1.5f;
ColumnText ctKesit = new ColumnText(cb);
ctKesit.Indent = indent;
txt = new iText.Phrase();
txt.Add(new iText.Chunk("Kesit\n", BoldSatirFont));
txt.Add(new iText.Chunk(String.Format("Genişlik, b = {0:0} cm\n", f.b), NormalSatirFont));
txt.Add(new iText.Chunk(String.Format("Yükseklik, h = {0:0} cm\n", f.h), NormalSatirFont));
txt.Add(new iText.Chunk(String.Format("Alan, bxh = {0:0} cm²\n", f.b * f.h), NormalSatirFont));
txt.Add(new iText.Chunk("\nMalzeme\n", BoldSatirFont));
txt.Add(new iText.Chunk("f", NormalSatirFont));
txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa ", f.Beton().fc.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
txt.Add(new iText.Chunk("f", NormalSatirFont));
txt.Add(new iText.Chunk("y", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().fy.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
txt.Add(new iText.Chunk("f", NormalSatirFont));
txt.Add(new iText.Chunk("cd", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa ", f.Beton().fcd.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
txt.Add(new iText.Chunk("f", NormalSatirFont));
txt.Add(new iText.Chunk("yd", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().fyd.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
txt.Add(new iText.Chunk("E", NormalSatirFont));
txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa ", f.Beton().E.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
txt.Add(new iText.Chunk("E", NormalSatirFont));
txt.Add(new iText.Chunk("s", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0} MPa\n", f.DonatiCeligi().E.TonnesForcePerSquareMeter().Megapascals), NormalSatirFont));
txt.Add(new iText.Chunk("e", NormalSymbolFont));
txt.Add(new iText.Chunk("cu", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0.0000} m/m ", f.Beton().Ecu), NormalSatirFont));
txt.Add(new iText.Chunk("e", NormalSymbolFont));
txt.Add(new iText.Chunk("yd", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0.00000} m/m\n", f.DonatiCeligi().Eyd), NormalSatirFont));
txt.Add(new iText.Chunk("k", NormalSatirFont));
txt.Add(new iText.Chunk("1", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(String.Format(" = {0:0.000}\n", f.Beton().k1), NormalSatirFont));
ctKesit.SetSimpleColumn(txt, xUL, yUL - headH - graphH - kstH, xUL + kstW, yUL - headH - graphH, 15, iText.Element.ALIGN_LEFT);
ctKesit.Go();
ColumnText ctDonati = new ColumnText(cb);
txt = new iText.Phrase();
txt.Add(new iText.Chunk("Donatı\n", BoldSatirFont));
int j = 1;
foreach (var rb in f.ReinforcingBars)
{
txt.Add(new iText.Chunk("A", NormalSatirFont));
txt.Add(new iText.Chunk(string.Format("s{0}", j), NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format("={0:0.00} cm², ", rb.As), NormalSatirFont));
txt.Add(new iText.Chunk("d", NormalSatirFont));
txt.Add(new iText.Chunk(string.Format("{0}", j), NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format("={0:0.00} cm\n", rb.di), NormalSatirFont));
j++;
}
txt.Add(new iText.Chunk("r", NormalSymbolFont));
txt.Add(new iText.Chunk(string.Format("=%{0:0.00}\n", 100.0 * f.ReinforcingBars.Sum(i => i.As) / (f.b * f.h)), NormalSatirFont));
txt.Add(new iText.Chunk("(d", NormalSatirFont));
txt.Add(new iText.Chunk("i", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(":Kesit basınç yüzeyinin donatı eksenine uzaklığı)\n", NormalSatirFont));
txt.Add(new iText.Chunk("\nDayanım Azaltma Katsayıları\n", BoldSatirFont));
txt.Add(new iText.Chunk("f", NormalSymbolFont));
txt.Add(new iText.Chunk("a", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format(" = {0:0.00}, ", f.PhiA), NormalSatirFont));
txt.Add(new iText.Chunk("f", NormalSymbolFont));
txt.Add(new iText.Chunk("b", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format(" = {0:0.00}, ", f.PhiB), NormalSatirFont));
txt.Add(new iText.Chunk("f", NormalSymbolFont));
txt.Add(new iText.Chunk("c", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format(" = {0:0.00}", f.PhiC), NormalSatirFont));
//txt.Add(new iText.Chunk("\n\nTasarım:\n", BoldSatirFont));
//txt.Add(new iText.Chunk(f.Code.ToString(), NormalSatirFont));
ctDonati.SetSimpleColumn(txt, xUL + kstW, yUL - headH - graphH - kstH, xUL + 2 * kstW, yUL - headH - graphH, 15, iText.Element.ALIGN_LEFT);
ctDonati.Go();
ColumnText ctTesir = new ColumnText(cb);
ctTesir.Indent = indent;
txt = new iText.Phrase();
txt.Add(new iText.Chunk("Maksimum eksenel basınç, N", NormalSatirFont));
txt.Add(new iText.Chunk("max", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t\n", f.Pmax), NormalSatirFont));
txt.Add(new iText.Chunk("Maksimum eksenel çekme, N", NormalSatirFont));
txt.Add(new iText.Chunk("min", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t\n\n", f.Pmin), NormalSatirFont));
txt.Add(new iText.Chunk("Yönetmelik maksimum eksenel basınç sınırı, N", NormalSatirFont));
txt.Add(new iText.Chunk("max", NormalRiseFont).SetTextRise(-1.0f));
txt.Add(new iText.Chunk(string.Format(" = {0:0.00} t", f.ActualPmax), NormalSatirFont));
ctTesir.SetSimpleColumn(txt, xUL, yUL - headH - graphH - 1.5f * kstH, xUL + kstW, yUL - headH - graphH - kstH, 15, iText.Element.ALIGN_LEFT);
ctTesir.Go();
doc.Close();
}
private void DrawLine(PdfContentByte cb, float x1, float y1, float x2, float y2)
{
cb.MoveTo(x1, y1);
cb.LineTo(x2, y2);
cb.Stroke();
}
private void DrawText(PdfContentByte cb, float x, float y, BaseFont font, float fonSize, string txt)
{
cb.BeginText();
cb.SetTextMatrix(x, y);
cb.SetFontAndSize(font, fonSize);
cb.ShowText(txt);
cb.EndText();
}
}
}