프로젝트

일반

사용자정보

개정판 e0f00e26

IDe0f00e26121274aaf0cb8117441d590817c4a364
상위 dd0f7089
하위 a7a123cc

김동진이(가) 5년 이상 전에 추가함

issue #1115: queue 작업 수정. 작업중 PDF가 있을 경우 종료 처리 되도록 수정.

Change-Id: I6e4ebf418da750304fb112f17821deb336e2e25e

차이점 보기:

FinalService/KCOM_FinalService/KCOM_FinalService/Remoting/RemFinalPDFStation.cs
3 3
using KCOMDataModel.Common;
4 4
using KCOMDataModel.DataModel;
5 5
using System;
6
using System.Collections.Concurrent;
6 7
using System.Collections.Generic;
7 8
using System.IO;
8 9
using System.Linq;
9 10
using System.Runtime.Remoting.Channels.Tcp;
10 11
using System.Threading;
12
using System.Threading.Tasks;
11 13

  
12 14
namespace KCOM_FinalService.Remoting
13 15
{
......
24 26
        Properties.Settings _SettingPlace = null;
25 27

  
26 28
        Queue<FINAL_PDF> _WorkItem = new Queue<FINAL_PDF>();
29
        ConcurrentQueue<FINAL_PDF> PdfQueue = null;
27 30
        List<FINAL_PDF> _Thread = new List<FINAL_PDF>();
28 31
        #endregion
29 32

  
......
66 69
                _Channel = new TcpChannel(Properties.Settings.Default.RemotingPort);
67 70
                System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(_Channel, false);
68 71
                System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemFinalPDFObject), "remFinalPDF", System.Runtime.Remoting.WellKnownObjectMode.Singleton);
72
                PdfQueue = new ConcurrentQueue<FINAL_PDF>();
73

  
69 74
            }
70 75
            catch (Exception EX)
71 76
            {
......
108 113
                System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(_Channel);
109 114
            }
110 115
        }
111

  
116
        private void FinalPDFEnqueue(FINAL_PDF pdf)
117
        {
118
            Task tEnq = Task.Factory.StartNew(() =>
119
            {
120
                PdfQueue.Enqueue(pdf);
121
                Thread.Sleep(100);                
122
            });
123
        }
124
        private void FinalPDFThreadStart()
125
        {
126
            _FinalPDFThread = new Thread(new ThreadStart(FinalPDFDequeueandProcessing));
127
            _FinalPDFThread.SetApartmentState(ApartmentState.STA);
128
            _FinalPDFThread.Start();
129
        }
130
        private void FinalPDFDequeueandProcessing()
131
        {
132
            Task tDeq = Task.Factory.StartNew(() =>
133
            {
134
                FINAL_PDF _item;
135
                try
136
                {
137
                    while (PdfQueue.Count > 0)
138
                    {
139
                        if (PdfQueue.TryDequeue(out _item))
140
                        {
141
                            if (_Thread.Count() < Properties.Settings.Default.MultipleFinalCount)
142
                            {
143
                                if (_item.STATUS == (int)FinalStatus.Insert)
144
                                {
145
                                    _item.STATUS = (int)(FinalStatus.Wait);
146
                                    using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
147
                                    {
148
                                        var selectItem = _entity.FINAL_PDF.Where(data => data.ID == _item.ID).FirstOrDefault();
149

  
150
                                        selectItem.STATUS = (int)(FinalStatus.Wait);
151

  
152
                                        _entity.SaveChanges();
153
                                    }
154
                                }
155
                                var _identPathItem = _Thread.Where(item => item.DOCINFO_ID == _item.DOCINFO_ID);
156

  
157
                                if (_identPathItem.Count() > 0)
158
                                {
159
                                    FinalPDFEnqueue(_item);
160
                                }
161
                                else
162
                                {
163
                                    MarkupToPDF.MarkupToPDF _markuptoPDF = new MarkupToPDF.MarkupToPDF();
164
                                    _markuptoPDF.FinalMakeError += new EventHandler<MarkupToPDF.MakeFinalErrorArgs>(_markuptoPDF_FinalMakeError);
165
                                    _markuptoPDF.EndFinal += new EventHandler<MarkupToPDF.EndFinalEventArgs>(_markuptoPDF_EndFinal);
166
                                    Thread _stathread = new Thread(new ParameterizedThreadStart(_markuptoPDF.MakeFinalPDF));
167
                                    _stathread.Name = _item.ID.ToString();
168
                                    SetFinalState(_item.ID, IFinalPDF.FinalStatus.Create);
169
                                    //_stathread.Priority = ThreadPriority.Normal;
170
                                    _stathread.SetApartmentState(ApartmentState.STA);
171
                                    _stathread.Start(_item);
172
                                    _Thread.Add(_item);
173
                                }
174
                            }
175
                        }
176
                        Thread.Sleep(100);
177
                    }
178
                }
179
                catch (Exception ex)
180
                {
181
                    _Log.Write("FinalPDFDequeueandProcessing error:" + ex.ToString());
182
                }
183
                
184
            });
185
        }
112 186
        public FinalPDFResult Notify(string ProjectNo, string FinalID)
113 187
        {
114 188
            using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
115 189
            {
116
                var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalID);
117
                FinalPDFProcessStart(finalList.ToList());
190
                var finalpdf = _entity.FINAL_PDF.Where(final => final.ID == FinalID).FirstOrDefault();
191
                FinalPDFEnqueue(finalpdf);
192
                //FinalPDFProcessStart(finalList.ToList());
118 193
            }
119

  
194
            _FinalPDFThread = new Thread(new ThreadStart(FinalPDFDequeueandProcessing));
195
            _FinalPDFThread.SetApartmentState(ApartmentState.STA);
196
            _FinalPDFThread.Start();
120 197
            ///TODO: why return FinalPDFResult?
121 198
            return new FinalPDFResult();
122 199
        }
......
139 216
        private void FinalPDFProcess()
140 217
        {
141 218
            //CurrentCountUpdater(); 잠시보류
142

  
143

  
219
            
144 220
            while (_WorkItem.Count() > 0)
145 221
            {
146 222
                if (_Thread.Count() < Properties.Settings.Default.MultipleFinalCount)
147 223
                {
148
                    FINAL_PDF _item = _WorkItem.Dequeue();
149
                    if (_item.STATUS == (int)FinalStatus.Insert)
224
                    try
150 225
                    {
151
                        _item.STATUS = (int)(FinalStatus.Wait);
152
                        using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
226
                        FINAL_PDF _item = _WorkItem.Dequeue();
227
                        if (_item.STATUS == (int)FinalStatus.Insert)
153 228
                        {
154
                            var selectItem = _entity.FINAL_PDF.Where(data => data.ID == _item.ID).FirstOrDefault();
229
                            _item.STATUS = (int)(FinalStatus.Wait);
230
                            using (KCOMDataModel.DataModel.KCOMEntities _entity = new KCOMDataModel.DataModel.KCOMEntities(KCOMDataModel.Common.ConnectStringBuilder.KCOMConnectionString().ToString()))
231
                            {
232
                                var selectItem = _entity.FINAL_PDF.Where(data => data.ID == _item.ID).FirstOrDefault();
155 233

  
156
                            selectItem.STATUS = (int)(FinalStatus.Wait);
234
                                selectItem.STATUS = (int)(FinalStatus.Wait);
157 235

  
158
                            _entity.SaveChanges();
236
                                _entity.SaveChanges();
237
                            }
159 238
                        }
160
                    }
161
                    var _identPathItem = _Thread.Where(item => item.DOCINFO_ID == _item.DOCINFO_ID);
239
                        var _identPathItem = _Thread.Where(item => item.DOCINFO_ID == _item.DOCINFO_ID);
162 240

  
163
                    if (_identPathItem.Count() > 0)
164
                    {
165
                        _WorkItem.Enqueue(_item);
241
                        if (_identPathItem.Count() > 0)
242
                        {
243
                            _WorkItem.Enqueue(_item);
244
                        }
245
                        else
246
                        {
247
                            /// 메일 전송
248
                            //EmailClient.EmailClient _client = new EmailClient.EmailClient("H2011357");
249
                            //System.Text.StringBuilder _bl = new System.Text.StringBuilder();
250
                            //_bl.AppendLine("Project No : " + _item.ProjectNo);
251
                            //_bl.AppendLine();
252
                            //_bl.AppendLine("MarkupInfoID : " + _item.MarkupInfoID);
253
                            //_bl.AppendLine();
254
                            //_bl.AppendLine("CreateUserID : " + _item.CreateUserID);
255
                            //_bl.AppendLine();
256
                            //_bl.AppendLine("CreateUserID : " + _item.CreateUserID);
257

  
258
                            //string subject = String.Format("새로운 파이널 서비스가 들어왔습니당");
259
                            //_client.SendEmail("H2011357", "H2011357", subject, _bl.ToString(), false);
260
                            /// up to here
261
                            MarkupToPDF.MarkupToPDF _markuptoPDF = new MarkupToPDF.MarkupToPDF();
262
                            _markuptoPDF.FinalMakeError += new EventHandler<MarkupToPDF.MakeFinalErrorArgs>(_markuptoPDF_FinalMakeError);
263
                            _markuptoPDF.EndFinal += new EventHandler<MarkupToPDF.EndFinalEventArgs>(_markuptoPDF_EndFinal);
264
                            Thread _stathread = new Thread(new ParameterizedThreadStart(_markuptoPDF.MakeFinalPDF));
265
                            _stathread.Name = _item.ID.ToString();
266
                            SetFinalState(_item.ID, IFinalPDF.FinalStatus.Create);
267
                            //_stathread.Priority = ThreadPriority.Normal;
268
                            _stathread.SetApartmentState(ApartmentState.STA);
269
                            _stathread.Start(_item);
270
                            _Thread.Add(_item);
271
                        }
166 272
                    }
167
                    else
273
                    catch (Exception ex)
168 274
                    {
169
                        /// 메일 전송
170
                        //EmailClient.EmailClient _client = new EmailClient.EmailClient("H2011357");
171
                        //System.Text.StringBuilder _bl = new System.Text.StringBuilder();
172
                        //_bl.AppendLine("Project No : " + _item.ProjectNo);
173
                        //_bl.AppendLine();
174
                        //_bl.AppendLine("MarkupInfoID : " + _item.MarkupInfoID);
175
                        //_bl.AppendLine();
176
                        //_bl.AppendLine("CreateUserID : " + _item.CreateUserID);
177
                        //_bl.AppendLine();
178
                        //_bl.AppendLine("CreateUserID : " + _item.CreateUserID);
179

  
180
                        //string subject = String.Format("새로운 파이널 서비스가 들어왔습니당");
181
                        //_client.SendEmail("H2011357", "H2011357", subject, _bl.ToString(), false);
182
                        /// up to here
183
                        MarkupToPDF.MarkupToPDF _markuptoPDF = new MarkupToPDF.MarkupToPDF();
184
                        _markuptoPDF.FinalMakeError += new EventHandler<MarkupToPDF.MakeFinalErrorArgs>(_markuptoPDF_FinalMakeError);
185
                        _markuptoPDF.EndFinal += new EventHandler<MarkupToPDF.EndFinalEventArgs>(_markuptoPDF_EndFinal);
186
                        Thread _stathread = new Thread(new ParameterizedThreadStart(_markuptoPDF.MakeFinalPDF));
187
                        _stathread.Name = _item.ID.ToString();
188
                        SetFinalState(_item.ID, IFinalPDF.FinalStatus.Create);
189
                        //_stathread.Priority = ThreadPriority.Normal;
190
                        _stathread.SetApartmentState(ApartmentState.STA);
191
                        _stathread.Start(_item);
192
                        _Thread.Add(_item);
275
                        _Log.Write("FinalPDFProcess error:"+ex.ToString());
193 276
                    }
277
                    
194 278
                }
279
                
280
                
195 281
            }
196 282
        }
197 283

  
FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs
165 165
                        return;
166 166
                    }
167 167

  
168
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID);
168
                    var inglist = _entity.FINAL_PDF.Where(x => x.ID != FinalPDF.ID && x.DOCUMENT_ID == FinalPDF.DOCUMENT_ID && (x.STATUS == (int)FinalStatus.Create)).ToList();
169
                    if(inglist.Count > 0 )
170
                    {
171
                        SetNotice(FinalPDF.ID, "이미 생성중인 Final PDF가 있습니다.");
172
                        return;
173
                    }
169 174

  
175
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID);
170 176
                    if (finalList.Count() > 0)
171 177
                    {
172 178
                        finalList.FirstOrDefault().START_DATETIME = DateTime.Now;
173 179
                        finalList.FirstOrDefault().STATUS = (int)FinalStatus.Create;
174 180
                        _entity.SaveChanges();
175 181
                    }
182

  
176 183
                }
177 184
            }
178 185
            catch (Exception ex)
......
216 223
                            }
217 224
                        }
218 225

  
219
                        using (CIEntities _ci_Internal = new CIEntities(ConnectStringBuilder.ProjectCIConnectString(FinalPDF.PROJECT_NO).ToString()))
226
                        documentItem = _entity.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == DocInfoItem.DOCUMENT_ID).FirstOrDefault();
227
                        if (documentItem == null)
220 228
                        {
221
                            documentItem = _ci_Internal.DOCUMENT_ITEM.Where(data => data.DOCUMENT_ID == DocInfoItem.DOCUMENT_ID).FirstOrDefault();
222
                            if (documentItem == null)
223
                            {
224
                                throw new Exception("DocInfo와 DocumentItem의 documentItemID가 같지 않습니다. 데이터를 확인해주세요");
225
                            }
229
                            throw new Exception("DocInfo와 DocumentItem의 documentItemID가 같지 않습니다. 데이터를 확인해주세요");
230
                        }
226 231

  
227
                            var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 
232
                        var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 
228 233

  
229
                            #region 파일 체크
230
                            if (_files.Count() == 1)
231
                            {
232
                                if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower()))
233
                                {
234
                                    OriginFileName = _files.First().Name;
235
                                    PdfFilePath = _files.First().CopyTo(TestFile, true);
236
                                }
237
                                else
238
                                {
239
                                    throw new Exception("현재 폴더 내 파일명이 데이터베이스와 상이합니다.filename:" + _files.First().Name.ToLower() + ",url:" + HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower());
240
                                }
241
                            }
242
                            else if (_files.Count() > 1)
234
                        #region 파일 체크
235
                        if (_files.Count() == 1)
236
                        {
237
                            if (_files.First().Name.ToLower() == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower()))
243 238
                            {
244
                                var originalFile = _files.Where(data => data.Name == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE))).FirstOrDefault();
245

  
246
                                if (originalFile == null)
247
                                {
248
                                    throw new Exception("해당 폴더에 복수로 PDF들 존재하고 document_Item의 문서는 존재하지 않습니다");
249
                                }
250
                                else
251
                                {
252
                                    OriginFileName = originalFile.Name;
253
                                    PdfFilePath = originalFile.CopyTo(TestFile, true);
254
                                }
239
                                OriginFileName = _files.First().Name;
240
                                PdfFilePath = _files.First().CopyTo(TestFile, true);
255 241
                            }
256 242
                            else
257 243
                            {
258
                                throw new Exception("PDF를 찾지 못하였습니다");
244
                                throw new Exception("현재 폴더 내 파일명이 데이터베이스와 상이합니다.filename:" + _files.First().Name.ToLower() + ",url:" + HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE).ToLower());
259 245
                            }
260
                            #endregion
246
                        }
247
                        else if (_files.Count() > 1)
248
                        {
249
                            var originalFile = _files.Where(data => data.Name == GetFileName(HttpUtility.UrlDecode(documentItem.ORIGINAL_FILE))).FirstOrDefault();
261 250

  
262
                            #region 예외처리
263
                            if (PdfFilePath == null)
251
                            if (originalFile == null)
264 252
                            {
265
                                throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다");
253
                                throw new Exception("해당 폴더에 복수로 PDF들 존재하고 document_Item의 문서는 존재하지 않습니다");
266 254
                            }
267
                            if (!PdfFilePath.Exists)
255
                            else
268 256
                            {
269
                                throw new Exception("PDF원본이 존재하지 않습니다");
257
                                OriginFileName = originalFile.Name;
258
                                PdfFilePath = originalFile.CopyTo(TestFile, true);
270 259
                            }
271
                            #endregion
272 260
                        }
261
                        else
262
                        {
263
                            throw new Exception("PDF를 찾지 못하였습니다");
264
                        }
265
                        #endregion
266

  
267
                        #region 예외처리
268
                        if (PdfFilePath == null)
269
                        {
270
                            throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다");
271
                        }
272
                        if (!PdfFilePath.Exists)
273
                        {
274
                            throw new Exception("PDF원본이 존재하지 않습니다");
275
                        }
276
                        #endregion
277
                        
273 278
                    }
274 279
                    else
275 280
                    {
......
409 414

  
410 415
        public bool SetStampInPDF(FINAL_PDF finaldata, string testFile, MARKUP_INFO markupInfo)
411 416
        {
412
            string pdfFilePath = null;
413
            List<MEMBER> memberlist = null;
414
            FileInfo tempFileInfo = new FileInfo(testFile);
415

  
416
            if (!Directory.Exists(_FinalPDFStorgeLocal))
417
            {
418
                Directory.CreateDirectory(_FinalPDFStorgeLocal);
419
            }
420
            pdfFilePath = _FinalPDFStorgeLocal + @"\" + tempFileInfo.Name;
421
            using (CIEntities cIEntities = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(finaldata.PROJECT_NO).ToString()))
422
            {
423
                memberlist = cIEntities.MEMBER.ToList();
424
            }
425
            using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
417
            try
426 418
            {
427
                FINAL_PDF pdfLink = _entity.FINAL_PDF.Where(data => data.ID == finaldata.ID).FirstOrDefault();
419
                string pdfFilePath = null;
420
                List<MEMBER> memberlist = null;
421
                FileInfo tempFileInfo = new FileInfo(testFile);
428 422

  
429
                #region 코멘트 적용 + 커버시트
430
                using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) //
423
                if (!Directory.Exists(_FinalPDFStorgeLocal))
431 424
                {
432
                    PdfReader pdfReader = new PdfReader(pdfStream);
433
                    //List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>();
434
                    Dictionary<string, object> bookmark;
435
                    List<Dictionary<string, object>> outlines;
436
                    outlines = new List<Dictionary<string, object>>();
437
                    List<Dictionary<string, object>> root = new List<Dictionary<string, object>>();
438

  
439
                    var dic = new Dictionary<string, object>();
440
                    foreach (var data in MarkupDataSet)
441
                    {
442

  
443
                        string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
444

  
445
                        var member = memberlist.Where(u => u.ID == userid).FirstOrDefault();
446
                        string username = member.NAME;
447
                        string userdept = member.DEPARTMENT;
448
                        bookmark = new Dictionary<string, object>();
449
                        bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER));
450
                        bookmark.Add("Page", data.PAGENUMBER + " Fit");
451
                        bookmark.Add("Action", "GoTo");
452
                        bookmark.Add("Kids", outlines);
453
                        root.Add(bookmark);
454
                    }
455

  
425
                    Directory.CreateDirectory(_FinalPDFStorgeLocal);
426
                }
427
                pdfFilePath = _FinalPDFStorgeLocal + @"\" + tempFileInfo.Name;
428
                using (CIEntities cIEntities = new CIEntities(KCOMDataModel.Common.ConnectStringBuilder.ProjectCIConnectString(finaldata.PROJECT_NO).ToString()))
429
                {
430
                    memberlist = cIEntities.MEMBER.ToList();
431
                }
432
                using (KCOMEntities _entity = new KCOMEntities(ConnectStringBuilder.KCOMConnectionString().ToString()))
433
                {
434
                    FINAL_PDF pdfLink = _entity.FINAL_PDF.Where(data => data.ID == finaldata.ID).FirstOrDefault();
456 435

  
457
                    using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
436
                    #region 코멘트 적용 + 커버시트
437
                    using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) //
458 438
                    {
459
                        var _SetColor = new SolidColorBrush(Colors.Red);
439
                        PdfReader pdfReader = new PdfReader(pdfStream);
440
                        //List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>();
441
                        Dictionary<string, object> bookmark;
442
                        List<Dictionary<string, object>> outlines;
443
                        outlines = new List<Dictionary<string, object>>();
444
                        List<Dictionary<string, object>> root = new List<Dictionary<string, object>>();
445

  
446
                        var dic = new Dictionary<string, object>();
447
                        foreach (var data in MarkupDataSet)
448
                        {
460 449

  
461
                        string[] delimiterChars = { "|DZ|" };
462
                        string[] delimiterChars2 = { "|" };
450
                            string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
451

  
452
                            var member = memberlist.Where(u => u.ID == userid).FirstOrDefault();
453
                            string username = member.NAME;
454
                            string userdept = member.DEPARTMENT;
455
                            bookmark = new Dictionary<string, object>();
456
                            bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER));
457
                            bookmark.Add("Page", data.PAGENUMBER + " Fit");
458
                            bookmark.Add("Action", "GoTo");
459
                            bookmark.Add("Kids", outlines);
460
                            root.Add(bookmark);
461
                        }
463 462

  
464
                        //pdfStamper.FormFlattening = true; //이미 선처리 작업함
465
                        pdfStamper.SetFullCompression();
466
                        _SetColor = new SolidColorBrush(Colors.Red);
467 463

  
468
                        foreach (var markupItem in MarkupDataSet)
464
                        using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
469 465
                        {
470
                            pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
471
                            var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault();
466
                            var _SetColor = new SolidColorBrush(Colors.Red);
472 467

  
473
                            mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
474
                            var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);
468
                            string[] delimiterChars = { "|DZ|" };
469
                            string[] delimiterChars2 = { "|" };
475 470

  
476
                            //scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width;
477
                            //scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height;
471
                            //pdfStamper.FormFlattening = true; //이미 선처리 작업함
472
                            pdfStamper.SetFullCompression();
473
                            _SetColor = new SolidColorBrush(Colors.Red);
478 474

  
479
                            //강인구 테스트
480
                            scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
481
                            scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
482

  
483
                            if (cropBox != null && cropBox.Width < mediaBox.Width || cropBox.Height < mediaBox.Height)
475
                            foreach (var markupItem in MarkupDataSet)
484 476
                            {
485
                                mediaBox = cropBox;
486
                            }
477
                                pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
478
                                var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault();
487 479

  
488
                            pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER;
489
                            _entity.SaveChanges();
480
                                mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
481
                                var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);
490 482

  
491
                            string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
483
                                //scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / mediaBox.Width;
484
                                //scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / mediaBox.Height;
492 485

  
493
                            PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
486
                                //강인구 테스트
487
                                scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
488
                                scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
494 489

  
490
                                if (cropBox != null && cropBox.Width < mediaBox.Width || cropBox.Height < mediaBox.Height)
491
                                {
492
                                    mediaBox = cropBox;
493
                                }
495 494

  
496
                            foreach (var data in markedData)
497
                            {
498
                                var item = JsonSerializerHelper.UnCompressString(data);
499
                                var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
495
                                pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER;
496
                                _entity.SaveChanges();
500 497

  
501
                                try
498
                                string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
499

  
500
                                PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
501

  
502

  
503
                                foreach (var data in markedData)
502 504
                                {
503
                                    switch (ControlT.Name)
505
                                    var item = JsonSerializerHelper.UnCompressString(data);
506
                                    var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
507

  
508
                                    try
504 509
                                    {
505
                                        #region LINE
506
                                        case "LineControl":
507
                                            {
508
                                                using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
510
                                        switch (ControlT.Name)
511
                                        {
512
                                            #region LINE
513
                                            case "LineControl":
509 514
                                                {
510
                                                    string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
511
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
512
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
513
                                                    DoubleCollection DashSize = control.DashSize;
514
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
515

  
516
                                                    var Opacity = control.Opac;
517
                                                    string UserID = control.UserID;
518
                                                    double Interval = control.Interval;
519
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
520
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, control.DashSize, _SetColor, Opacity);
521
                                                    switch (control.LineStyleSet)
515
                                                    using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
522 516
                                                    {
523
                                                        case LineStyleSet.ArrowLine:
524
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
525
                                                            break;
526
                                                        case LineStyleSet.CancelLine:
527
                                                            {
528
                                                                var x = Math.Abs((Math.Abs(StartPoint.X) - Math.Abs(EndPoint.X)));
529
                                                                var y = Math.Abs((Math.Abs(StartPoint.Y) - Math.Abs(EndPoint.Y)));
530

  
531
                                                                if (x > y)
517
                                                        string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
518
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
519
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
520
                                                        DoubleCollection DashSize = control.DashSize;
521
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
522

  
523
                                                        var Opacity = control.Opac;
524
                                                        string UserID = control.UserID;
525
                                                        double Interval = control.Interval;
526
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
527
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, control.DashSize, _SetColor, Opacity);
528
                                                        switch (control.LineStyleSet)
529
                                                        {
530
                                                            case LineStyleSet.ArrowLine:
531
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
532
                                                                break;
533
                                                            case LineStyleSet.CancelLine:
532 534
                                                                {
533
                                                                    StartPoint = new Point(StartPoint.X, StartPoint.Y - (float)(control.Interval / 3.0));
534
                                                                    EndPoint = new Point(EndPoint.X, EndPoint.Y - (float)(control.Interval / 3.0));
535
                                                                    Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, Opacity);
535
                                                                    var x = Math.Abs((Math.Abs(StartPoint.X) - Math.Abs(EndPoint.X)));
536
                                                                    var y = Math.Abs((Math.Abs(StartPoint.Y) - Math.Abs(EndPoint.Y)));
537

  
538
                                                                    if (x > y)
539
                                                                    {
540
                                                                        StartPoint = new Point(StartPoint.X, StartPoint.Y - (float)(control.Interval / 3.0));
541
                                                                        EndPoint = new Point(EndPoint.X, EndPoint.Y - (float)(control.Interval / 3.0));
542
                                                                        Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, Opacity);
543
                                                                    }
536 544
                                                                }
537
                                                            }
538
                                                            break;
539
                                                        case LineStyleSet.TwinLine:
540
                                                            {
541
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
542
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
543
                                                            }
544
                                                            break;
545
                                                        case LineStyleSet.DimLine:
546
                                                            {
547
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Arrow.DimAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
548
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
549
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
550
                                                            }
551
                                                            break;
552
                                                        default:
553
                                                            break;
554
                                                    }
545
                                                                break;
546
                                                            case LineStyleSet.TwinLine:
547
                                                                {
548
                                                                    Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
549
                                                                    Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
550
                                                                }
551
                                                                break;
552
                                                            case LineStyleSet.DimLine:
553
                                                                {
554
                                                                    Controls_PDF.HoneyPDFLib_DrawSet_Arrow.DimAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
555
                                                                    Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
556
                                                                    Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(StartPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
557
                                                                }
558
                                                                break;
559
                                                            default:
560
                                                                break;
561
                                                        }
555 562

  
556 563

  
564
                                                    }
557 565
                                                }
558
                                            }
559
                                            break;
560
                                        #endregion
561
                                        #region ArrowControlMulti
562
                                        case "ArrowControl_Multi":
563
                                            {
564
                                                using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
566
                                                break;
567
                                            #endregion
568
                                            #region ArrowControlMulti
569
                                            case "ArrowControl_Multi":
565 570
                                                {
566
                                                    string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
567
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
568
                                                    Point MidPoint = GetPdfPointSystem(control.MidPoint);
569
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
570
                                                    DoubleCollection DashSize = control.DashSize;
571
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
572
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
571
                                                    using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
572
                                                    {
573
                                                        string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
574
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
575
                                                        Point MidPoint = GetPdfPointSystem(control.MidPoint);
576
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
577
                                                        DoubleCollection DashSize = control.DashSize;
578
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
579
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
573 580

  
574
                                                    double Opacity = control.Opac;
581
                                                        double Opacity = control.Opac;
575 582

  
576
                                                    if (EndPoint == MidPoint)
577
                                                    {
578
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
579
                                                    }
580
                                                    else
581
                                                    {
582
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
583
                                                    }
583
                                                        if (EndPoint == MidPoint)
584
                                                        {
585
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity);
586
                                                        }
587
                                                        else
588
                                                        {
589
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, (int)LineSize, contentByte, _SetColor, Opacity);
590
                                                        }
584 591

  
585
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
592
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
586 593

  
594
                                                    }
587 595
                                                }
588
                                            }
589
                                            break;
590
                                        #endregion
591
                                        #region PolyControl
592
                                        case "PolygonControl":
593
                                            using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
594
                                            {
595
                                                string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
596
                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
597
                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
598
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
599
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
600
                                                double Opacity = control.Opac;
601
                                                DoubleCollection DashSize = control.DashSize;
602

  
603
                                                Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
604
                                            }
605
                                            break;
606
                                        #endregion
607
                                        #region ArcControl
608
                                        case "ArcControl":
609
                                            {
610
                                                using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
596
                                                break;
597
                                            #endregion
598
                                            #region PolyControl
599
                                            case "PolygonControl":
600
                                                using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
611 601
                                                {
612 602
                                                    string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
613 603
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
614 604
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
615
                                                    Point MidPoint = GetPdfPointSystem(control.MidPoint);
616
                                                    DoubleCollection DashSize = control.DashSize;
617 605
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
618

  
619
                                                    var Opacity = control.Opac;
620
                                                    string UserID = control.UserID;
621 606
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
622
                                                    bool IsTransOn = control.IsTransOn;
623

  
624
                                                    if (control.IsTransOn)
625
                                                    {
626
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
627
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
628
                                                    }
629
                                                    else
630
                                                    {
631
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
632
                                                    }
607
                                                    double Opacity = control.Opac;
608
                                                    DoubleCollection DashSize = control.DashSize;
633 609

  
634
                                                }
635
                                            }
636
                                            break;
637
                                        #endregion
638
                                        #region RectangleControl
639
                                        case "RectangleControl":
640
                                            using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
641
                                            {
642
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
643
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
644
                                                var PaintStyle = control.PaintState;
645
                                                double Angle = control.Angle;
646
                                                DoubleCollection DashSize = control.DashSize;
647
                                                double Opacity = control.Opac;
648
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
649

  
650
                                                Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
651
                                            }
652
                                            break;
653
                                        #endregion
654
                                        #region TriControl
655
                                        case "TriControl":
656
                                            using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
657
                                            {
658
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
659
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
660
                                                var PaintStyle = control.Paint;
661
                                                double Angle = control.Angle;
662
                                                //StrokeColor = _SetColor, //색상은 레드
663
                                                DoubleCollection DashSize = control.DashSize;
664
                                                double Opacity = control.Opac;
665
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
666

  
667
                                                Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
668
                                            }
669
                                            break;
670
                                        #endregion
671
                                        #region CircleControl
672
                                        case "CircleControl":
673
                                            using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
674
                                            {
675
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
676
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
677
                                                var StartPoint = GetPdfPointSystem(control.StartPoint);
678
                                                var EndPoint = GetPdfPointSystem(control.EndPoint);
679
                                                var PaintStyle = control.PaintState;
680
                                                double Angle = control.Angle;
681
                                                DoubleCollection DashSize = control.DashSize;
682
                                                double Opacity = control.Opac;
683
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
684
                                                Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
685

  
686
                                            }
687
                                            break;
688
                                        #endregion
689
                                        #region RectCloudControl
690
                                        case "RectCloudControl":
691
                                            using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
692
                                            {
693
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
694
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
695
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
696
                                                double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
697

  
698
                                                double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
699

  
700
                                                var PaintStyle = control.PaintState;
701
                                                double Opacity = control.Opac;
702
                                                DoubleCollection DashSize = control.DashSize;
703

  
704
                                                //드로잉 방식이 표현되지 않음
705
                                                var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
706

  
707
                                                double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
708
                                                bool reverse = (area < 0);
709
                                                if (PaintStyle == PaintSet.None)
710
                                                {
711
                                                    Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
712
                                                }
713
                                                else
714
                                                {
715
                                                    Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
716
                                                }
717
                                            }
718
                                            break;
719
                                        #endregion
720
                                        #region CloudControl
721
                                        case "CloudControl":
722
                                            using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
723
                                            {
724
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
725
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
726
                                                double Toler = control.Toler;
727
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
728
                                                double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
729
                                                var PaintStyle = control.PaintState;
730
                                                double Opacity = control.Opac;
731
                                                bool isTransOn = control.IsTrans;
732
                                                bool isChain = control.IsChain;
733

  
734
                                                DoubleCollection DashSize = control.DashSize;
735

  
736
                                                if (isChain)
737
                                                {
738 610
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
739 611
                                                }
740
                                                else
612
                                                break;
613
                                            #endregion
614
                                            #region ArcControl
615
                                            case "ArcControl":
741 616
                                                {
742
                                                    if (isTransOn)
617
                                                    using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
743 618
                                                    {
744
                                                        double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
745
                                                        bool reverse = (area < 0);
746

  
747
                                                        if (PaintStyle == PaintSet.None)
619
                                                        string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
620
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
621
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
622
                                                        Point MidPoint = GetPdfPointSystem(control.MidPoint);
623
                                                        DoubleCollection DashSize = control.DashSize;
624
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
625

  
626
                                                        var Opacity = control.Opac;
627
                                                        string UserID = control.UserID;
628
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
629
                                                        bool IsTransOn = control.IsTransOn;
630

  
631
                                                        if (control.IsTransOn)
748 632
                                                        {
749
                                                            Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
633
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
634
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
750 635
                                                        }
751 636
                                                        else
752 637
                                                        {
753
                                                            Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
638
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
754 639
                                                        }
755
                                                    }
756
                                                    else
757
                                                    {
758
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
640

  
759 641
                                                    }
760 642
                                                }
761
                                            }
762
                                            break;
763
                                        #endregion
764
                                        #region TEXT
765
                                        case "TextControl":
766
                                            using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
767
                                            {
768
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
769
                                                string Text = control.Text;
770

  
771
                                                bool isUnderline = false;
772
                                                control.BoxW -= scaleWidth;
773
                                                control.BoxH -= scaleHeight;
774
                                                System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxW, (float)control.BoxH);
775
                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
776
                                                Point EndPoint = GetPdfPointSystem(new Point(control.StartPoint.X + control.BoxW, control.StartPoint.Y + control.BoxH));
777

  
778
                                                List<Point> pointSet = new List<Point>();
779
                                                pointSet.Add(StartPoint);
780
                                                pointSet.Add(EndPoint);
781

  
782
                                                PaintSet paint = PaintSet.None;
783
                                                switch (control.paintMethod)
643
                                                break;
644
                                            #endregion
645
                                            #region RectangleControl
646
                                            case "RectangleControl":
647
                                                using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
784 648
                                                {
785
                                                    case 1:
786
                                                        {
787
                                                            paint = PaintSet.Fill;
788
                                                        }
789
                                                        break;
790
                                                    case 2:
791
                                                        {
792
                                                            paint = PaintSet.Hatch;
793
                                                        }
794
                                                        break;
795
                                                    default:
796
                                                        break;
649
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
650
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
651
                                                    var PaintStyle = control.PaintState;
652
                                                    double Angle = control.Angle;
653
                                                    DoubleCollection DashSize = control.DashSize;
654
                                                    double Opacity = control.Opac;
655
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
656

  
657
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
797 658
                                                }
798
                                                if (control.isHighLight) paint |= PaintSet.Highlight;
799

  
800
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
801
                                                double TextSize = Convert.ToDouble(data2[1]);
802
                                                SolidColorBrush FontColor = _SetColor;
803
                                                double Angle = control.Angle;
804
                                                double Opacity = control.Opac;
805
                                                FontFamily fontfamilly = new FontFamily(control.fontConfig[0]);
806
                                                var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
807

  
808
                                                FontStyle fontStyle = FontStyles.Normal;
809
                                                if (FontStyles.Italic == TextStyle)
659
                                                break;
660
                                            #endregion
661
                                            #region TriControl
662
                                            case "TriControl":
663
                                                using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
810 664
                                                {
811
                                                    fontStyle = FontStyles.Italic;
812
                                                }
813

  
814
                                                FontWeight fontWeight = FontWeights.Black;
665
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
666
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
667
                                                    var PaintStyle = control.Paint;
668
                                                    double Angle = control.Angle;
669
                                                    //StrokeColor = _SetColor, //색상은 레드
670
                                                    DoubleCollection DashSize = control.DashSize;
671
                                                    double Opacity = control.Opac;
672
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
815 673

  
816
                                                var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
817
                                                //강인구 수정(2018.04.17)
818
                                                if (FontWeights.Bold == TextWeight)
819
                                                //if (FontWeights.ExtraBold == TextWeight)
820
                                                {
821
                                                    fontWeight = FontWeights.Bold;
674
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
822 675
                                                }
823

  
824
                                                TextDecorationCollection decoration = TextDecorations.Baseline;
825
                                                if (control.fontConfig.Count() == 4)
676
                                                break;
677
                                            #endregion
678
                                            #region CircleControl
679
                                            case "CircleControl":
680
                                                using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
826 681
                                                {
827
                                                    decoration = TextDecorations.Underline;
682
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
683
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
684
                                                    var StartPoint = GetPdfPointSystem(control.StartPoint);
685
                                                    var EndPoint = GetPdfPointSystem(control.EndPoint);
686
                                                    var PaintStyle = control.PaintState;
687
                                                    double Angle = control.Angle;
688
                                                    DoubleCollection DashSize = control.DashSize;
689
                                                    double Opacity = control.Opac;
690
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
691
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
692

  
828 693
                                                }
694
                                                break;
695
                                            #endregion
696
                                            #region RectCloudControl
697
                                            case "RectCloudControl":
698
                                                using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
699
                                                {
700
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
701
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
702
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
703
                                                    double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
704

  
705
                                                    double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
706

  
707
                                                    var PaintStyle = control.PaintState;
708
                                                    double Opacity = control.Opac;
709
                                                    DoubleCollection DashSize = control.DashSize;
829 710

  
830
                                                Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
831
                                            }
832
                                            break;
833
                                        #endregion
834
                                        #region ArrowTextControl
835
                                        case "ArrowTextControl":
836
                                            using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
837
                                            {
838
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
839
                                                Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
840
                                                Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
841
                                                Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
842
                                                bool isUnderLine = false;
843
                                                string Text = "";
844
                                                double fontsize = 30;
845

  
846
                                                System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
847
                                                Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
848
                                                List<Point> tempPoint = new List<Point>();
849

  
850
                                                var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
851

  
852
                                                tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
853
                                                tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
854
                                                tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
855
                                                tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
856
                                                double Angle = control.Angle;
857
                                                var newStartPoint = tempStartPoint;
858
                                                var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
859
                                                var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
860

  
861
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
862
                                                SolidColorBrush FontColor = _SetColor;
863
                                                bool isHighlight = control.isHighLight;
864
                                                double Opacity = control.Opac;
865
                                                PaintSet Paint = PaintSet.None;
866

  
867
                                                switch (control.ArrowStyle)
711
                                                    //드로잉 방식이 표현되지 않음
712
                                                    var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
713

  
714
                                                    double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
715
                                                    bool reverse = (area < 0);
716
                                                    if (PaintStyle == PaintSet.None)
717
                                                    {
718
                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
719
                                                    }
720
                                                    else
721
                                                    {
722
                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
723
                                                    }
724
                                                }
725
                                                break;
726
                                            #endregion
727
                                            #region CloudControl
728
                                            case "CloudControl":
729
                                                using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
868 730
                                                {
869
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
870
                                                        {
871
                                                            Paint = PaintSet.None;
872
                                                        }
873
                                                        break;
874
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
731
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
732
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
733
                                                    double Toler = control.Toler;
734
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
735
                                                    double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
736
                                                    var PaintStyle = control.PaintState;
737
                                                    double Opacity = control.Opac;
738
                                                    bool isTransOn = control.IsTrans;
739
                                                    bool isChain = control.IsChain;
740

  
741
                                                    DoubleCollection DashSize = control.DashSize;
742

  
743
                                                    if (isChain)
744
                                                    {
745
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
746
                                                    }
747
                                                    else
748
                                                    {
749
                                                        if (isTransOn)
875 750
                                                        {
876
                                                            Paint = PaintSet.Hatch;
751
                                                            double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
752
                                                            bool reverse = (area < 0);
753

  
754
                                                            if (PaintStyle == PaintSet.None)
755
                                                            {
756
                                                                Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
757
                                                            }
758
                                                            else
759
                                                            {
760
                                                                Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
761
                                                            }
877 762
                                                        }
878
                                                        break;
879
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
763
                                                        else
880 764
                                                        {
881
                                                            Paint = PaintSet.Fill;
765
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
882 766
                                                        }
883
                                                        break;
884
                                                    default:
885
                                                        break;
886
                                                }
887
                                                if (control.isHighLight) Paint |= PaintSet.Highlight;
888

  
889
                                                if (Paint == PaintSet.Hatch)
890
                                                {
891
                                                    Text = control.ArrowText;
767
                                                    }
892 768
                                                }
893
                                                else
769
                                                break;
770
                                            #endregion
771
                                            #region TEXT
772
                                            case "TextControl":
773
                                                using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
894 774
                                                {
895
                                                    Text = control.ArrowText;
896
                                                }
775
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
776
                                                    string Text = control.Text;
897 777

  
898
                                                try
899
                                                {
900
                                                    if (control.fontConfig.Count == 4)
778
                                                    bool isUnderline = false;
779
                                                    control.BoxW -= scaleWidth;
780
                                                    control.BoxH -= scaleHeight;
781
                                                    System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxW, (float)control.BoxH);
782
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
783
                                                    Point EndPoint = GetPdfPointSystem(new Point(control.StartPoint.X + control.BoxW, control.StartPoint.Y + control.BoxH));
784

  
785
                                                    List<Point> pointSet = new List<Point>();
786
                                                    pointSet.Add(StartPoint);
787
                                                    pointSet.Add(EndPoint);
788

  
789
                                                    PaintSet paint = PaintSet.None;
790
                                                    switch (control.paintMethod)
901 791
                                                    {
902
                                                        fontsize = Convert.ToDouble(control.fontConfig[3]);
792
                                                        case 1:
793
                                                            {
794
                                                                paint = PaintSet.Fill;
795
                                                            }
796
                                                            break;
797
                                                        case 2:
798
                                                            {
799
                                                                paint = PaintSet.Hatch;
800
                                                            }
801
                                                            break;
802
                                                        default:
803
                                                            break;
903 804
                                                    }
805
                                                    if (control.isHighLight) paint |= PaintSet.Highlight;
904 806

  
905
                                                    //강인구 수정(2018.04.17)
807
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
808
                                                    double TextSize = Convert.ToDouble(data2[1]);
809
                                                    SolidColorBrush FontColor = _SetColor;
810
                                                    double Angle = control.Angle;
811
                                                    double Opacity = control.Opac;
812
                                                    FontFamily fontfamilly = new FontFamily(control.fontConfig[0]);
906 813
                                                    var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
907 814

  
908 815
                                                    FontStyle fontStyle = FontStyles.Normal;
......
914 821
                                                    FontWeight fontWeight = FontWeights.Black;
915 822

  
916 823
                                                    var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
824
                                                    //강인구 수정(2018.04.17)
917 825
                                                    if (FontWeights.Bold == TextWeight)
826
                                                    //if (FontWeights.ExtraBold == TextWeight)
918 827
                                                    {
919 828
                                                        fontWeight = FontWeights.Bold;
920 829
                                                    }
921 830

  
922 831
                                                    TextDecorationCollection decoration = TextDecorations.Baseline;
923
                                                    if (control.fontConfig.Count() == 5)
832
                                                    if (control.fontConfig.Count() == 4)
924 833
                                                    {
925 834
                                                        decoration = TextDecorations.Underline;
926 835
                                                    }
927 836

  
928
                                                    if (control.isTrans)
837
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString(StartPoint, EndPoint, LineSize, contentByte, _SetColor, paint, TextSize, fontfamilly, fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
838
                                                }
839
                                                break;
840
                                            #endregion
841
                                            #region ArrowTextControl
842
                                            case "ArrowTextControl":
843
                                                using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
844
                                                {
845
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
846
                                                    Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
847
                                                    Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
848
                                                    Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
849
                                                    bool isUnderLine = false;
850
                                                    string Text = "";
851
                                                    double fontsize = 30;
852

  
853
                                                    System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
854
                                                    Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
855
                                                    List<Point> tempPoint = new List<Point>();
856

  
857
                                                    var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
858

  
859
                                                    tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
860
                                                    tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
861
                                                    tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
862
                                                    tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
863
                                                    double Angle = control.Angle;
864
                                                    var newStartPoint = tempStartPoint;
865
                                                    var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
866
                                                    var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
867

  
868
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
869
                                                    SolidColorBrush FontColor = _SetColor;
870
                                                    bool isHighlight = control.isHighLight;
871
                                                    double Opacity = control.Opac;
872
                                                    PaintSet Paint = PaintSet.None;
873

  
874
                                                    switch (control.ArrowStyle)
929 875
                                                    {
930
                                                        //인구 수정 Arrow Text Style적용 되도록 변경
931
                                                        Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
932
                                                            newStartPoint, tempMidPoint,
933
                                                            LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
876
                                                        case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
877
                                                            {
878
                                                                Paint = PaintSet.None;
879
                                                            }
880
                                                            break;
881
                                                        case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
882
                                                            {
883
                                                                Paint = PaintSet.Hatch;
884
                                                            }
885
                                                            break;
886
                                                        case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
887
                                                            {
888
                                                                Paint = PaintSet.Fill;
889
                                                            }
890
                                                            break;
891
                                                        default:
892
                                                            break;
893
                                                    }
894
                                                    if (control.isHighLight) Paint |= PaintSet.Highlight;
895

  
896
                                                    if (Paint == PaintSet.Hatch)
897
                                                    {
898
                                                        Text = control.ArrowText;
934 899
                                                    }
935 900
                                                    else
936 901
                                                    {
937
                                                        if (control.isFixed)
902
                                                        Text = control.ArrowText;
903
                                                    }
904

  
905
                                                    try
906
                                                    {
907
                                                        if (control.fontConfig.Count == 4)
938 908
                                                        {
939
                                                            var testP = new Point(0, 0);
940
                                                            if (control.isFixed)
941
                                                            {
942
                                                                if (tempPoint[1] == newEndPoint)
943
                                                                {
944
                                                                    testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
945
                                                                }
946
                                                                else if (tempPoint[3] == newEndPoint)
947
                                                                {
948
                                                                    testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
949
                                                                }
950
                                                                else if (tempPoint[0] == newEndPoint)
951
                                                                {
952
                                                                    testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
953
                                                                }
954
                                                                else if (tempPoint[2] == newEndPoint)
955
                                                                {
956
                                                                    testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
957
                                                                }
958
                                                            }
959
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
960
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
961
                                                                tempStartPoint, testP,
962
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
963
                                                            new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
909
                                                            fontsize = Convert.ToDouble(control.fontConfig[3]);
964 910
                                                        }
965
                                                        else
911

  
912
                                                        //강인구 수정(2018.04.17)
913
                                                        var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
914

  
915
                                                        FontStyle fontStyle = FontStyles.Normal;
916
                                                        if (FontStyles.Italic == TextStyle)
917
                                                        {
918
                                                            fontStyle = FontStyles.Italic;
919
                                                        }
920

  
921
                                                        FontWeight fontWeight = FontWeights.Black;
922

  
923
                                                        var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
924
                                                        if (FontWeights.Bold == TextWeight)
925
                                                        {
926
                                                            fontWeight = FontWeights.Bold;
927
                                                        }
928

  
929
                                                        TextDecorationCollection decoration = TextDecorations.Baseline;
930
                                                        if (control.fontConfig.Count() == 5)
931
                                                        {
932
                                                            decoration = TextDecorations.Underline;
933
                                                        }
934

  
935
                                                        if (control.isTrans)
966 936
                                                        {
967 937
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
968 938
                                                            Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
969
                                                                newStartPoint, newMidPoint,
939
                                                                newStartPoint, tempMidPoint,
970 940
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
971 941
                                                        }
942
                                                        else
943
                                                        {
944
                                                            if (control.isFixed)
945
                                                            {
946
                                                                var testP = new Point(0, 0);
947
                                                                if (control.isFixed)
948
                                                                {
949
                                                                    if (tempPoint[1] == newEndPoint)
950
                                                                    {
951
                                                                        testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
952
                                                                    }
953
                                                                    else if (tempPoint[3] == newEndPoint)
954
                                                                    {
955
                                                                        testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
956
                                                                    }
957
                                                                    else if (tempPoint[0] == newEndPoint)
958
                                                                    {
959
                                                                        testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
960
                                                                    }
961
                                                                    else if (tempPoint[2] == newEndPoint)
962
                                                                    {
963
                                                                        testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
964
                                                                    }
965
                                                                }
966
                                                                //인구 수정 Arrow Text Style적용 되도록 변경
967
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
968
                                                                    tempStartPoint, testP,
969
                                                                    LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
970
                                                                new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
971
                                                            }
972
                                                            else
973
                                                            {
974
                                                                //인구 수정 Arrow Text Style적용 되도록 변경
975
                                                                Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
976
                                                                    newStartPoint, newMidPoint,
977
                                                                    LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, new FontFamily(), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
978
                                                            }
979
                                                        }
972 980
                                                    }
981
                                                    catch (Exception ex)
982
                                                    {
983

  
984
                                                    }
985
                                                }
986
                                                break;
987
                                            #endregion
988
                                            #region SignControl
989
                                            case "SignControl":
990
                                                using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
991
                                                {
992

  
993
                                                    double Angle = control.Angle;
994
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
995
                                                    Point TopRightPoint = GetPdfPointSystem(control.TR);
996
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
997
                                                    Point LeftBottomPoint = GetPdfPointSystem(control.LB);
998
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
999
                                                    double Opacity = control.Opac;
1000
                                                    string UserNumber = control.UserNumber;
1001
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO);
1002
                                                }
1003
                                                break;
1004
                                            #endregion
1005
                                            #region MyRegion
1006
                                            case "DateControl":
1007
                                                using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item))
1008
                                                {
1009
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1010
                                                    string Text = control.Text;
1011
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1012
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1013
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1014
                                                    SolidColorBrush FontColor = _SetColor;
1015
                                                    double Angle = control.Angle;
1016
                                                    double Opacity = control.Opac;
1017
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
973 1018
                                                }
974
                                                catch (Exception ex)
1019
                                                break;
1020
                                            #endregion
1021
                                            #region SymControlN (APPROVED)
1022
                                            case "SymControlN":
1023
                                                using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
975 1024
                                                {
1025
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1026
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1027
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1028
                                                    SolidColorBrush FontColor = _SetColor;
1029
                                                    double Angle = control.Angle;
1030
                                                    double Opacity = control.Opac;
1031

  
1032
                                                    string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", "");
1033
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawApproval(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1034
                                                }
1035
                                                break;
1036
                                            case "SymControl":
1037
                                                using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1038
                                                {
1039
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1040
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1041
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1042
                                                    SolidColorBrush FontColor = _SetColor;
1043
                                                    double Angle = control.Angle;
1044
                                                    double Opacity = control.Opac;
976 1045

  
1046
                                                    string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", "");
1047
                                                    Controls_PDF.HoneyPDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
977 1048
                                                }
978
                                            }
979
                                            break;
980
                                        #endregion
981
                                        #region SignControl
982
                                        case "SignControl":
983
                                            using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
984
                                            {
985

  
986
                                                double Angle = control.Angle;
987
                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
988
                                                Point TopRightPoint = GetPdfPointSystem(control.TR);
989
                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
990
                                                Point LeftBottomPoint = GetPdfPointSystem(control.LB);
991
                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
992
                                                double Opacity = control.Opac;
993
                                                string UserNumber = control.UserNumber;
994
                                                Controls_PDF.HoneyPDFLib_DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO);
995
                                            }
996
                                            break;
997
                                        #endregion
998
                                        #region MyRegion
999
                                        case "DateControl":
1000
                                            using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item))
1001
                                            {
1002
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1003
                                                string Text = control.Text;
1004
                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
1005
                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
1006
                                                List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1007
                                                SolidColorBrush FontColor = _SetColor;
1008
                                                double Angle = control.Angle;
1009
                                                double Opacity = control.Opac;
1010
                                                Controls_PDF.HoneyPDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1011
                                            }
1012
                                            break;
1013
                                        #endregion
1014
                                        #region SymControlN (APPROVED)
1015
                                        case "SymControlN":
1016
                                            using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1017
                                            {
1018
                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
1019
                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)