프로젝트

일반

사용자정보

개정판 6a19b48d

ID6a19b48d4d65f0132542748dacd26fb0b1c9c89a
상위 c1946e9c
하위 d2050059, f5f788c2

김태성이(가) 약 2년 전에 추가함

issue #00000 페이지 이미지 download 로직 수정

Change-Id: I4da03c36b5a135eea80b57b20ada38239afd1082

차이점 보기:

FinalServiceV3/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs
1
using IFinalPDF;
2
using iTextSharp.text.pdf;
1
using iTextSharp.text.pdf;
2
using log4net;
3 3
using MarkupToPDF.Controls.Common;
4 4
using MarkupToPDF.Serialize.Core;
5 5
using MarkupToPDF.Serialize.S_Control;
6 6
using Markus.EntityModel;
7 7
using Markus.Fonts;
8
using Markus.Service.Helper;
9
using Markus.Service.Interface;
8 10
using System;
9 11
using System.Collections.Generic;
10 12
using System.Configuration;
......
12 14
using System.Linq;
13 15
using System.Net;
14 16
using System.Runtime.InteropServices;
17
using System.ServiceModel;
18
using System.ServiceModel.Security.Tokens;
15 19
using System.Text;
16 20
using System.Web;
17 21
using System.Windows;
......
21 25
{
22 26
    public class MarkupToPDF : IDisposable
23 27
    {
28
        protected static ILog logger;
24 29

  
25 30
        #region 초기 데이터
26 31
        private static iTextSharp.text.Rectangle mediaBox;
......
29 34
        private string _FinalPDFStorgeLocal = null;
30 35
        private string _FinalPDFStorgeRemote = null;
31 36
        private string OriginFileName = null;
32
        public FINAL_PDF FinalItem;
37

  
33 38
        public DOCINFO DocInfoItem = null;
34 39
        public List<DOCPAGE> DocPageItem = null;
35 40
        public MARKUP_INFO MarkupInfoItem = null;
36 41
        public List<MARKUP_DATA> MarkupDataSet = null;
37 42
        //private string _PrintPDFStorgeLocal = null;
38 43
        //private string _PrintPDFStorgeRemote = null;
39
        public event EventHandler<MakeFinalErrorArgs> FinalMakeError;
40
        public event EventHandler<EndFinalEventArgs> EndFinal;
41
        public event EventHandler<StatusChangedEventArgs> StatusChanged;
44
        //public event EventHandler<StatusChangedEventArgs> StatusChanged;
42 45

  
43 46
        private iTextSharp.text.Rectangle pdfSize { get; set; }
44 47
        private double pageW = 0;
......
49 52
        #endregion
50 53

  
51 54
        #region 추가 함수
55
        private DOCPAGE CurrentPage;
56
        private int TotalPage;
52 57
        private string MarkusConnectionString;
53 58
        private string CIConnectionString;
59
        private string FinalID;
60
        private string ProjectNo;
61
        private Markus.Service.WcfClient.FinalService.FinalServiceClient FinalServiceClient;
54 62

  
55 63
        /// <summary>
56 64
        /// 
57 65
        /// </summary>
58
        /// <param name="markusConnectionString">Encrypt.AESEncrypter.Decrypt Connection String </param>
59
        /// <param name="CI_ConnectionString">Encrypt.AESEncrypter.Decrypt Connection String </param>
60
        public MarkupToPDF(string markusConnectionString, string CI_ConnectionString)
66
        public MarkupToPDF(ProcessContext processContext)
61 67
        {
62
            MarkusConnectionString = markusConnectionString;
63
            CIConnectionString = CI_ConnectionString;
68
            logger = LogManager.GetLogger(typeof(MarkupToPDF));
69

  
70
            MarkusConnectionString = processContext.MarkusConnectionString;
71
            CIConnectionString = processContext.CI_ConnectionString;
72
            FinalID = processContext.FinalID;
73

  
74
            BasicHttpBinding myBinding = new BasicHttpBinding { TransferMode = TransferMode.Buffered };
75

  
76
            myBinding.CloseTimeout = new TimeSpan(0, 10, 0);
77
            myBinding.ReceiveTimeout = new TimeSpan(0, 10, 0);
78
            myBinding.SendTimeout = new TimeSpan(0, 10, 0);
79
            myBinding.OpenTimeout = new TimeSpan(0, 10, 0);
80

  
81
            EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate(processContext.ServiceUri));
82

  
83
            FinalServiceClient = new Markus.Service.WcfClient.FinalService.FinalServiceClient(myBinding, myEndpoint);
84

  
64 85
        }
65 86

  
66 87
        #endregion
......
87 108
            return false;
88 109
        }
89 110

  
90
        private void SetNotice(string finalID, string message)
111
        private void FinalStatusChange(StatusCodeType status, string message)
112
        {
113
            int currentPage = 0;
114
            int totalPage = 0;
115

  
116
            if (CurrentPage != null)
117
            {
118
                currentPage = CurrentPage.PAGE_NUMBER;
119
                totalPage = CurrentPage.PAGE_NUMBER;
120
            }
121

  
122
            logger.Info($"ID:{FinalID} Status:{status.ToString()} message:{message}");
123

  
124
#if ProcessDebug
125
            Console.WriteLine($"FinalID :{FinalID} status :{status.ToString()}, current Page :{currentPage} totalPage : {totalPage}");
126

  
127
            if (status != StatusCodeType.Complated)
128
            {
129
                Console.WriteLine(message);
130
            }
131
#else
132
            if (status == StatusCodeType.Complated)
133
            {
134
                FinalServiceClient.FinalFinish(FinalID, (int)status, currentPage, totalPage, "");
135
            }
136
            else
137
            {
138
                FinalServiceClient.FinalFinish(FinalID, (int)status, currentPage, totalPage, message);
139
            }
140
#endif
141

  
142

  
143
        }
144

  
145
        private void FinalMakeError(string message, StatusCodeType status)
91 146
        {
92
            if (FinalMakeError != null)
147
            int currentPage = 0;
148
            int totalPage = 0;
149

  
150
            if(CurrentPage != null)
93 151
            {
94
                FinalMakeError(this, new MakeFinalErrorArgs { FinalID = finalID, Message = message });
152
                currentPage = CurrentPage.PAGE_NUMBER;
153
                totalPage = CurrentPage.PAGE_NUMBER;
95 154
            }
155

  
156
            logger.Error($"ID:{FinalID} Status:{status.ToString()} CurrentPage:{currentPage} totolPage:{totalPage} Message:{message}");
157

  
158
#if ProcessDebug
159
            Console.WriteLine($"FinalID :{FinalID} status :{status.ToString()}, current Page :{currentPage} totalPage : {totalPage}");
160
#else
161
            FinalServiceClient.FinalFinish(FinalID,(int)status, currentPage, totalPage, message);
162
#endif
163

  
96 164
        }
97 165

  
98 166
        private string GetFileName(string hrefLink)
......
159 227
            return angle;
160 228
        }
161 229

  
162
        #endregion
230
#endregion
163 231

  
164 232
        public bool AddStamp(string stampData)
165 233
        {
......
269 337
            return result;
270 338
        }
271 339

  
272
        #region 생성자 & 소멸자
273
        public void MakeFinalPDF(object _FinalPDF)
340
#region 생성자 & 소멸자
341
        public void MakeFinalPDF()
274 342
        {
275 343
            DOCUMENT_ITEM documentItem;
276
            FINAL_PDF FinalPDF = (FINAL_PDF)_FinalPDF;
277
            FinalItem = FinalPDF;
344
            FINAL_PDF FinalPDF = null;
278 345

  
279 346

  
280 347
            string PdfFilePathRoot = null;
281 348
            string TestFile = System.IO.Path.GetTempFileName();
282 349

  
283
            #region 문서 경로를 가져오는 것과 Status를 Create (1단계) 로 수정
350
#region 문서 경로를 가져오는 것과 Status를 Create (1단계) 로 수정
284 351
            try
285 352
            {
286 353
                using (Markus.EntityModel.MarkusModel _entity = new Markus.EntityModel.MarkusModel(MarkusConnectionString))
287 354
                {
355
                    var items = _entity.FINAL_PDF.Where(x => x.ID == FinalID);
356

  
357
                    if (items.Count() > 0)
358
                    {
359
                        FinalPDF = items.First();
360
                    }
361
                    else
362
                    {
363
                        FinalMakeError( "FinalPDF not Found",StatusCodeType.Error);
364
                        return;
365
                    }
366

  
288 367
                    var _properties = _entity.PROPERTIES.Where(pro => pro.PROPERTY == FinalPDF.PROJECT_NO);
289 368

  
290 369
                    if (_properties.Count() > 0)
291 370
                    {
292 371
                        if (_properties.Where(t => t.TYPE == PropertiesType.Const_TileSorcePath).Count() == 0)
293 372
                        {
294
                            SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : TileSourcePath Not Found.");
373
                            FinalMakeError($"Project {FinalPDF.PROJECT_NO} : TileSourcePath Not Found.", StatusCodeType.Error);
295 374
                            return;
296 375
                        }
297 376
                        else
......
301 380

  
302 381
                        if (_properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeLocal).Count() == 0)
303 382
                        {
304
                            SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeLocal Not Found.");
383
                            FinalMakeError( $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeLocal Not Found.", StatusCodeType.Error);
305 384
                            return;
306 385
                        }
307 386
                        else
......
312 391

  
313 392
                        if (_properties.Where(t => t.TYPE == PropertiesType.Const_FinalPDFStorgeRemote).Count() == 0)
314 393
                        {
315
                            SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeRemote Not Found.");
394
                            FinalMakeError($"Project {FinalPDF.PROJECT_NO} : FinalPDFStorgeRemote Not Found.", StatusCodeType.Error);
316 395
                            return;
317 396
                        }
318 397
                        else
......
322 401
                    }
323 402
                    else
324 403
                    {
325
                        SetNotice(FinalPDF.ID, $"Project {FinalPDF.PROJECT_NO} : Final PDF Properties Not Found.");
404
                        FinalMakeError($"Project {FinalPDF.PROJECT_NO} : Final PDF Properties Not Found.", StatusCodeType.Error);
326 405
                        return;
327 406
                    }
328

  
329
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID);
330

  
331
                    if (finalList.Count() > 0)
332
                    {
333
                        finalList.FirstOrDefault().START_DATETIME = DateTime.Now;
334
                        finalList.FirstOrDefault().STATUS = (int)FinalStatus.Create;
335
                        _entity.SaveChanges();
336
                    }
337

  
338 407
                }
339 408
            }
340 409
            catch (Exception ex)
341 410
            {
342
                SetNotice(FinalPDF.ID, "프로퍼티 에러: " + ex.ToString());
411
                FinalMakeError( "프로퍼티 에러: " + ex.ToString(), StatusCodeType.Error);
343 412
                return;
344 413
            }
345
            #endregion
414
#endregion
346 415

  
347
            #region 문서 복사
416
#region 문서 복사
348 417
            try
349 418
            {
419
                FinalStatusChange(StatusCodeType.Create,null);
420

  
350 421
                using (Markus.EntityModel.MarkusModel _entity = new Markus.EntityModel.MarkusModel(CIConnectionString))
351 422
                {
352 423
                    var _DOCINFO = _entity.DOCINFO.Where(doc => doc.ID == FinalPDF.DOCINFO_ID);
......
393 464

  
394 465
                        var _files = new DirectoryInfo(PdfFilePathRoot).GetFiles("*.pdf"); //해당 폴더에 파일을 
395 466

  
396
                        #region 파일 체크
467
#region 파일 체크
397 468
                        if (_files.Count() == 1)
398 469
                        {
399 470
                            /// 문서 관리 시스템의 원본 PDF 파일과 비교 --> 삭제될 예정
......
401 472
                            //{
402 473
                            OriginFileName = _files.First().Name;
403 474
                            PdfFilePath = _files.First().CopyTo(TestFile, true);
404
                            StatusChange($"Copy File  file Count = 1 : {PdfFilePath}", 0);
475
                            //StatusChange($"Copy File  file Count = 1 : {PdfFilePath}", 0);
405 476
                            //}
406 477
                            //else
407 478
                            //{
......
420 491
                            {
421 492
                                OriginFileName = originalFile.Name;
422 493
                                PdfFilePath = originalFile.CopyTo(TestFile, true);
423
                                StatusChange($"Copy File file Count  > 1 : {PdfFilePath}", 0);
494
                                //StatusChange($"Copy File file Count  > 1 : {PdfFilePath}", 0);
424 495
                            }
425 496
                        }
426 497
                        else
427 498
                        {
428 499
                            throw new FileNotFoundException("PDF를 찾지 못하였습니다");
429 500
                        }
430
                        #endregion
501
#endregion
431 502

  
432
                        #region 예외처리
503
#region 예외처리
433 504
                        if (PdfFilePath == null)
434 505
                        {
435 506
                            throw new Exception("작업에 필요한 PDF가 정상적으로 복사되지 않았거나 DB정보가 상이합니다");
......
438 509
                        {
439 510
                            throw new Exception("PDF원본이 존재하지 않습니다");
440 511
                        }
441
                        #endregion
512
#endregion
442 513

  
443 514
                    }
444 515
                    else
......
451 522
            {
452 523
                if (ex.Message == "사용 가능한" || ex.Message == "작업을 완료했습니다")
453 524
                {
454
                    SetNotice(FinalPDF.ID, "Desktop 내 힙메모리 부족으로 서비스 진행이 되지 않아 재시작 합니다");
525
                    FinalMakeError("Desktop 내 힙메모리 부족으로 서비스 진행이 되지 않아 재시작 합니다", StatusCodeType.Error);
455 526
                    //System.Diagnostics.Process process = new System.Diagnostics.Process();
456 527
                    //process.StartInfo.FileName = "cmd";
457 528
                    //process.StartInfo.Arguments = "/c net stop \"FinalService\" & net start \"FinalService\"";
......
459 530
                }
460 531
                else
461 532
                {
462
                    SetNotice(FinalPDF.ID, "PDF를 Stamp 중 에러 : " + ex.Message);
533
                    FinalMakeError("PDF를 Stamp 중 에러 : " + ex.Message, StatusCodeType.Error);
463 534
                }
464 535
            }
465
            #endregion
536
#endregion
466 537

  
467 538
            try
468 539
            {
540
                FinalStatusChange(StatusCodeType.Stamp, null);
541

  
469 542
                using (Markus.EntityModel.MarkusModel _entity = new Markus.EntityModel.MarkusModel(MarkusConnectionString))
470 543
                {
471 544
                    var finalList = _entity.FINAL_PDF.Where(final => final.ID == FinalPDF.ID);
......
475 548
                        //TestFile = SetFlattingPDF(TestFile);
476 549
                        //StatusChange($"SetFlattingPDF : {TestFile}", 0);
477 550

  
478
                        SetStampInPDF(FinalItem, TestFile, MarkupInfoItem);
479

  
480
                        StatusChange($"SetStampInPDF : {TestFile}", 0);
551
                        SetStampInPDF(FinalPDF, TestFile, MarkupInfoItem);
552
                        FinalStatusChange(StatusCodeType.Complated, "");
481 553
                    }
482
                }
483
                if (EndFinal != null)
484
                {
485
                    EndFinal(this, new EndFinalEventArgs
554
                    else
486 555
                    {
487
                        FinalPDFRemotePath = _FinalPDFStorgeRemote + @"\" + FinalPDFPath.Name,
488
                        OriginPDFName = OriginFileName,
489
                        FinalPDFPath = FinalPDFPath.FullName,
490
                        Error = "",
491
                        Message = "",
492
                        FinalPDF = FinalPDF,
493
                    });
556
                        FinalMakeError("FinalPDF DB Not Found",StatusCodeType.Error);
557
                    }
494 558
                }
559

  
495 560
            }
496 561
            catch (Exception ex)
497 562
            {
498
                SetNotice(FinalPDF.ID, "MarkFinalPDF Error : " + ex.Message);
563
                FinalMakeError("MarkFinalPDF Error : " + ex.Message, StatusCodeType.Error);
499 564
            }
500 565
        }
501
        #endregion
566
#endregion
502 567

  
503
        #region PDF
568
#region PDF
504 569
        public static float scaleWidth = 0;
505 570
        public static float scaleHeight = 0;
506 571

  
......
576 641
            File.WriteAllBytes(dest, array);
577 642
        }
578 643

  
579
        public void StatusChange(string message,int CurrentPage)
580
        {
581
            if(StatusChanged != null)
582
            {
583
                //var sb = new StringBuilder();
584
                //sb.AppendLine(message);
585

  
586
                StatusChanged(this, new StatusChangedEventArgs { CurrentPage = CurrentPage, Message = message });
587
            }
588
        }
589

  
590
        public bool SetStampInPDF(FINAL_PDF finaldata, string testFile, MARKUP_INFO markupInfo)
644
        public bool SetStampInPDF(FINAL_PDF finalPDF, string testFile, MARKUP_INFO markupInfo)
591 645
        {
592 646
            try
593 647
            {
......
601 655

  
602 656
                string pdfFilePath = Path.Combine(_FinalPDFStorgeLocal, tempFileInfo.Name);
603 657

  
604

  
605
                using (Markus.EntityModel.MarkusModel _entity = new Markus.EntityModel.MarkusModel(MarkusConnectionString))
606
                {
607
                    FINAL_PDF pdfLink = _entity.FINAL_PDF.Where(data => data.ID == finaldata.ID).FirstOrDefault();
608

  
609
                    #region 코멘트 적용 + 커버시트
658
#region 코멘트 적용 + 커버시트
610 659
                    using (Stream pdfStream = new FileInfo(testFile).Open(FileMode.Open, FileAccess.ReadWrite)) //
611 660
                    {
612
                        StatusChange("comment Cover",0);
661
                        FinalStatusChange(StatusCodeType.Stamp, "comment Cover");
613 662

  
614
                        using (PdfReader pdfReader = new PdfReader(pdfStream))
615
                        { 
616
                            //List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>();
617
                            Dictionary<string, object> bookmark;
618
                            List<Dictionary<string, object>> outlines;
663
                    using (PdfReader pdfReader = new PdfReader(pdfStream))
664
                    { 
665
                        //List<Dictionary<string, object>> lstoutlineTop = new List<Dictionary<string, object>>();
666
                        Dictionary<string, object> bookmark;
667
                        List<Dictionary<string, object>> outlines;
619 668

  
620
                            outlines = new List<Dictionary<string, object>>();
621
                            List<Dictionary<string, object>> root = new List<Dictionary<string, object>>();
669
                        outlines = new List<Dictionary<string, object>>();
670
                        List<Dictionary<string, object>> root = new List<Dictionary<string, object>>();
622 671

  
623
                            var dic = new Dictionary<string, object>();
672
                        var dic = new Dictionary<string, object>();
624 673

  
625
                            foreach (var data in MarkupDataSet)
626
                            {
627
                                //StatusChange("MarkupDataSet", 0);
674
                        foreach (var data in MarkupDataSet)
675
                        {
676
                            //StatusChange("MarkupDataSet", 0);
628 677

  
629
                                string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
678
                            string userid = data.MARKUP_INFO_VERSION.MARKUP_INFO.USER_ID;
630 679

  
631
                                string username = "";
632
                                string userdept = "";
680
                            string username = "";
681
                            string userdept = "";
633 682

  
634
                                using (Markus.EntityModel.MarkusModel _ciEntity = new Markus.EntityModel.MarkusModel(CIConnectionString))
635
                                {
636
                                    var memberlist = _ciEntity.MEMBER.Where(x=>x.ID == userid);
683
                            using (Markus.EntityModel.MarkusModel _ciEntity = new Markus.EntityModel.MarkusModel(CIConnectionString))
684
                            {
685
                                var memberlist = _ciEntity.MEMBER.Where(x=>x.ID == userid);
637 686

  
638
                                    if(memberlist.Count() > 0)
639
                                    {
640
                                        username = memberlist.First().NAME;
641
                                        userdept = memberlist.First().DEPARTMENT;
642
                                    }
687
                                if(memberlist.Count() > 0)
688
                                {
689
                                    username = memberlist.First().NAME;
690
                                    userdept = memberlist.First().DEPARTMENT;
643 691
                                }
644

  
645
                                bookmark = new Dictionary<string, object>();
646
                                bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER));
647
                                bookmark.Add("Page", data.PAGENUMBER + " Fit");
648
                                bookmark.Add("Action", "GoTo");
649
                                bookmark.Add("Kids", outlines);
650
                                root.Add(bookmark);
651 692
                            }
652 693

  
653
                            iTextSharp.text.Version.GetInstance();
654
                            using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
694
                            bookmark = new Dictionary<string, object>();
695
                            bookmark.Add("Title", string.Format("User:{0}[{1}] Commented Page : {2}", username, userdept, data.PAGENUMBER));
696
                            bookmark.Add("Page", data.PAGENUMBER + " Fit");
697
                            bookmark.Add("Action", "GoTo");
698
                            bookmark.Add("Kids", outlines);
699
                            root.Add(bookmark);
700
                        }
701

  
702
                        iTextSharp.text.Version.GetInstance();
703
                        using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfFilePath, FileMode.Create)))
704
                        {
705
                            try
655 706
                            {
656
                                try
707
                                if (pdfStamper.AcroFields != null && pdfStamper.AcroFields.GenerateAppearances != true)
657 708
                                {
658
                                    if (pdfStamper.AcroFields != null && pdfStamper.AcroFields.GenerateAppearances != true)
659
                                    {
660
                                        pdfStamper.AcroFields.GenerateAppearances = true;
661
                                    }
709
                                    pdfStamper.AcroFields.GenerateAppearances = true;
662 710
                                }
663
                                catch (Exception ex)
664
                                {
665
                                    SetNotice(FinalItem.ID, "this pdf is not AcroForm.");
666
                                }
667

  
668
                                System.Drawing.Color _SetColor = System.Drawing.Color.FromArgb(255, System.Drawing.Color.Red);
711
                            }
712
                            catch (Exception ex)
713
                            {
714
                                FinalMakeError("this pdf is not AcroForm.", StatusCodeType.FileError);
715
                            }
716
 
717
                            System.Drawing.Color _SetColor = System.Drawing.Color.FromArgb(255, System.Drawing.Color.Red);
669 718
                                
670 719

  
671
                                string[] delimiterChars = { "|DZ|" };
672
                                string[] delimiterChars2 = { "|" };
720
                            string[] delimiterChars = { "|DZ|" };
721
                            string[] delimiterChars2 = { "|" };
673 722

  
674
                                //pdfStamper.FormFlattening = true; //이미 선처리 작업함
675
                                pdfStamper.SetFullCompression();
676
                                _SetColor = System.Drawing.Color.FromArgb(255, System.Drawing.Color.Red);
723
                            //pdfStamper.FormFlattening = true; //이미 선처리 작업함
724
                            pdfStamper.SetFullCompression();
725
                            _SetColor = System.Drawing.Color.FromArgb(255, System.Drawing.Color.Red);
677 726

  
678
                                StringBuilder strLog = new StringBuilder();
679
                                int lastPageNo = 0;
727
                            StringBuilder strLog = new StringBuilder();
728
               
729
                            strLog.Append($"Write {DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")} markup Count : {MarkupDataSet.Count()} / ");
680 730

  
681
                                strLog.Append($"Write {DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")} markup Count : {MarkupDataSet.Count()} / ");
731
                            foreach (var markupItem in MarkupDataSet)
732
                            {
733
                                /// 2020.11.13 김태성
734
                                /// 원본 PDF의 페이지수가 변경된 경우 이전 markup의 페이지를 찾지 못해 수정함.
735
                                var pageitems = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER);
682 736

  
683
                                foreach (var markupItem in MarkupDataSet)
737
                                if (pageitems.Count() > 0)
684 738
                                {
685
                                    /// 2020.11.13 김태성
686
                                    /// 원본 PDF의 페이지수가 변경된 경우 이전 markup의 페이지를 찾지 못해 수정함.
687
                                    var pageitems = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER);
688

  
689
                                    if (pageitems.Count() > 0)
739
                                    CurrentPage = pageitems.First();
740
                                    pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
741
                                    //try
742
                                    //{
743

  
744
                                    //}
745
                                    //catch (Exception ex)
746
                                    //{
747
                                    //    SetNotice(finaldata.ID, $"GetPageSizeWithRotation Error PageNO : {markupItem.PAGENUMBER} " + ex.ToString());
748
                                    //}
749
                                    //finally
750
                                    //{
751
                                    //    pdfSize = new iTextSharp.text.Rectangle(0, 0, float.Parse(currentPage.PAGE_WIDTH), float.Parse(currentPage.PAGE_HEIGHT));
752
                                    //}
753

  
754
                                    mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
755
                                    var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);
756

  
757
                                    /// media box와 crop box가 다를 경우 media box를 crop box와 일치시킨다
758
                                    if (cropBox != null &&
759
                                        (cropBox.Left != mediaBox.Left || cropBox.Top != mediaBox.Top || cropBox.Right != mediaBox.Right || cropBox.Bottom != mediaBox.Bottom))
690 760
                                    {
691
                                        var currentPage = pageitems.First();
692
                                        pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
693
                                        lastPageNo = markupItem.PAGENUMBER;
694
                                        //try
695
                                        //{
696

  
697
                                        //}
698
                                        //catch (Exception ex)
699
                                        //{
700
                                        //    SetNotice(finaldata.ID, $"GetPageSizeWithRotation Error PageNO : {markupItem.PAGENUMBER} " + ex.ToString());
701
                                        //}
702
                                        //finally
703
                                        //{
704
                                        //    pdfSize = new iTextSharp.text.Rectangle(0, 0, float.Parse(currentPage.PAGE_WIDTH), float.Parse(currentPage.PAGE_HEIGHT));
705
                                        //}
706

  
707
                                        mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
708
                                        var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);
709

  
710
                                        /// media box와 crop box가 다를 경우 media box를 crop box와 일치시킨다
711
                                        if (cropBox != null &&
712
                                            (cropBox.Left != mediaBox.Left || cropBox.Top != mediaBox.Top || cropBox.Right != mediaBox.Right || cropBox.Bottom != mediaBox.Bottom))
713
                                        {
714
                                            PdfDictionary dict = pdfReader.GetPageN(markupItem.PAGENUMBER);
761
                                        PdfDictionary dict = pdfReader.GetPageN(markupItem.PAGENUMBER);
715 762

  
716
                                            PdfArray oNewMediaBox = new PdfArray();
717
                                            oNewMediaBox.Add(new PdfNumber(cropBox.Left));
718
                                            oNewMediaBox.Add(new PdfNumber(cropBox.Top));
719
                                            oNewMediaBox.Add(new PdfNumber(cropBox.Right));
720
                                            oNewMediaBox.Add(new PdfNumber(cropBox.Bottom));
721
                                            dict.Put(PdfName.MEDIABOX, oNewMediaBox);
763
                                        PdfArray oNewMediaBox = new PdfArray();
764
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Left));
765
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Top));
766
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Right));
767
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Bottom));
768
                                        dict.Put(PdfName.MEDIABOX, oNewMediaBox);
722 769

  
723
                                            pdfSize = cropBox;
724
                                        }
770
                                        pdfSize = cropBox;
771
                                    }
725 772

  
726
                                        scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
727
                                        scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
773
                                    scaleWidth = float.Parse(CurrentPage.PAGE_WIDTH) / pdfSize.Width;
774
                                    scaleHeight = float.Parse(CurrentPage.PAGE_HEIGHT) / pdfSize.Height;
728 775

  
729
                                        pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER;
730
                                        _entity.SaveChanges();
776
                                    string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
731 777

  
732
                                        string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
778
                                    PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
779
                                    strLog.Append($"p.{markupItem.PAGENUMBER}:{markupItem.DATA_TYPE}/");
733 780

  
734
                                        PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
735
                                        strLog.Append($"p.{markupItem.PAGENUMBER}:{markupItem.DATA_TYPE}/");
781
                                    foreach (var data in markedData)
782
                                    {
783
                                        var item = JsonSerializerHelper.UnCompressString(data);
784
                                        var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
736 785

  
737
                                        foreach (var data in markedData)
786
                                        try
738 787
                                        {
739
                                            var item = JsonSerializerHelper.UnCompressString(data);
740
                                            var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
741

  
742
                                            try
788
                                            switch (ControlT.Name)
743 789
                                            {
744
                                                switch (ControlT.Name)
745
                                                {
746
                                                    #region LINE
747
                                                    case "LineControl":
790
#region LINE
791
                                                case "LineControl":
792
                                                    {
793
                                                        using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
748 794
                                                        {
749
                                                            using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
750
                                                            {
751
                                                                DrawLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
752
                                                            }
795
                                                            DrawLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
753 796
                                                        }
754
                                                        break;
755
                                                    #endregion
756
                                                    #region ArrowControlMulti
757
                                                    case "ArrowControl_Multi":
797
                                                    }
798
                                                    break;
799
#endregion
800
#region ArrowControlMulti
801
                                                case "ArrowControl_Multi":
802
                                                    {
803
                                                        using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
758 804
                                                        {
759
                                                            using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
760
                                                            {
761
                                                                DrawMultiArrowLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
762
                                                            }
805
                                                            DrawMultiArrowLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
763 806
                                                        }
764
                                                        break;
765
                                                    #endregion
766
                                                    #region PolyControl
767
                                                    case "PolygonControl":
768
                                                        using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
807
                                                    }
808
                                                    break;
809
#endregion
810
#region PolyControl
811
                                                case "PolygonControl":
812
                                                    using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
813
                                                    {
814
                                                        string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
815
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
816
                                                        var PaintStyle = control.PaintState;
817
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
818
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
819
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
820
                                                        double Opacity = control.Opac;
821
                                                        DoubleCollection DashSize = control.DashSize;
822

  
823
                                                        Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor,PaintStyle| PaintSet.Outline, Opacity);
824
                                                        //Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
825
                                                    }
826
                                                    break;
827
#endregion
828
#region ArcControl or ArrowArcControl
829
                                                case "ArcControl":
830
                                                case "ArrowArcControl":
831
                                                    {
832
                                                        using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
769 833
                                                        {
770 834
                                                            string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
771 835
                                                            Point StartPoint = GetPdfPointSystem(control.StartPoint);
772
                                                            var PaintStyle = control.PaintState;
773 836
                                                            Point EndPoint = GetPdfPointSystem(control.EndPoint);
837
                                                            Point MidPoint = GetPdfPointSystem(control.MidPoint);
838
                                                            DoubleCollection DashSize = control.DashSize;
774 839
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
840

  
841
                                                            var Opacity = control.Opac;
842
                                                            string UserID = control.UserID;
775 843
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
776
                                                            double Opacity = control.Opac;
777
                                                            DoubleCollection DashSize = control.DashSize;
844
                                                            bool IsTransOn = control.IsTransOn;
778 845

  
779
                                                            Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor,PaintStyle| PaintSet.Outline, Opacity);
780
                                                            //Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
846
                                                            if (control.IsTransOn)
847
                                                            {
848
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
849
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
850
                                                            }
851
                                                            else
852
                                                            {
853
                                                                Controls_PDF.DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, LineSize, contentByte, _SetColor, Opacity);
854
                                                            }
855

  
856
                                                            if (ControlT.Name == "ArrowArcControl")
857
                                                            {
858
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
859
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
860
                                                            }
781 861
                                                        }
782
                                                        break;
783
                                                    #endregion
784
                                                    #region ArcControl or ArrowArcControl
785
                                                    case "ArcControl":
786
                                                    case "ArrowArcControl":
862
                                                    }
863
                                                    break;
864
#endregion
865
#region RectangleControl
866
                                                case "RectangleControl":
867
                                                    using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
868
                                                    {
869
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
870
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
871
                                                        var PaintStyle = control.PaintState;
872
                                                        double Angle = control.Angle;
873
                                                        DoubleCollection DashSize = control.DashSize;
874
                                                        double Opacity = control.Opac;
875
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
876

  
877
                                                        Controls_PDF.DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
878
                                                    }
879
                                                    break;
880
#endregion
881
#region TriControl
882
                                                case "TriControl":
883
                                                    using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
884
                                                    {
885
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
886
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
887
                                                        var PaintStyle = control.Paint;
888
                                                        double Angle = control.Angle;
889
                                                        //StrokeColor = _SetColor, //색상은 레드
890
                                                        DoubleCollection DashSize = control.DashSize;
891
                                                        double Opacity = control.Opac;
892
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
893

  
894
                                                        Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle | PaintSet.Outline, Opacity);
895
                                                    }
896
                                                    break;
897
#endregion
898
#region CircleControl
899
                                                case "CircleControl":
900
                                                    using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
901
                                                    {
902
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
903
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
904
                                                        var StartPoint = GetPdfPointSystem(control.StartPoint);
905
                                                        var EndPoint = GetPdfPointSystem(control.EndPoint);
906
                                                        var PaintStyle = control.PaintState;
907
                                                        double Angle = control.Angle;
908
                                                        DoubleCollection DashSize = control.DashSize;
909
                                                        double Opacity = control.Opac;
910
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
911
                                                        Controls_PDF.DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
912

  
913
                                                    }
914
                                                    break;
915
#endregion
916
#region RectCloudControl
917
                                                case "RectCloudControl":
918
                                                    using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
919
                                                    {
920
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
921
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
922
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
923
                                                        double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
924

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

  
927
                                                        var PaintStyle = control.PaintState;
928
                                                        double Opacity = control.Opac;
929
                                                        DoubleCollection DashSize = control.DashSize;
930

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

  
934
                                                        double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
935
                                                        bool reverse = (area < 0);
936
                                                    
937
                                                        Controls_PDF.DrawSet_Cloud.DrawCloudRect(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
938
                                                    }
939
                                                    break;
940
#endregion
941
#region CloudControl
942
                                                case "CloudControl":
943
                                                    using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
944
                                                    {
945
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
946
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
947
                                                        double Toler = control.Toler;
948
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
949
                                                        double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
950
                                                        var PaintStyle = control.PaintState;
951
                                                        double Opacity = control.Opac;
952
                                                        bool isTransOn = control.IsTrans;
953
                                                        bool isChain = control.IsChain;
954

  
955
                                                        DoubleCollection DashSize = control.DashSize;
956

  
957
                                                        if (isChain)
958
                                                        {
959
                                                            Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
960
                                                        }
961
                                                        else
787 962
                                                        {
788
                                                            using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
963
                                                            if (isTransOn)
789 964
                                                            {
790
                                                                string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
791
                                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
792
                                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
793
                                                                Point MidPoint = GetPdfPointSystem(control.MidPoint);
794
                                                                DoubleCollection DashSize = control.DashSize;
795
                                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
796

  
797
                                                                var Opacity = control.Opac;
798
                                                                string UserID = control.UserID;
799
                                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
800
                                                                bool IsTransOn = control.IsTransOn;
965
                                                                double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
966
                                                                bool reverse = (area < 0);
801 967

  
802
                                                                if (control.IsTransOn)
968
                                                                if (PaintStyle == PaintSet.None)
803 969
                                                                {
804
                                                                    Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
805
                                                                    Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
970
                                                                    Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
806 971
                                                                }
807 972
                                                                else
808 973
                                                                {
809
                                                                    Controls_PDF.DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, LineSize, contentByte, _SetColor, Opacity);
810
                                                                }
811

  
812
                                                                if (ControlT.Name == "ArrowArcControl")
813
                                                                {
814
                                                                    Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
815
                                                                    Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
974
                                                                    Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
816 975
                                                                }
817 976
                                                            }
977
                                                            else
978
                                                            {
979
                                                                Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
980
                                                            }
818 981
                                                        }
819
                                                        break;
820
                                                    #endregion
821
                                                    #region RectangleControl
822
                                                    case "RectangleControl":
823
                                                        using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
824
                                                        {
825
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
826
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
827
                                                            var PaintStyle = control.PaintState;
828
                                                            double Angle = control.Angle;
829
                                                            DoubleCollection DashSize = control.DashSize;
830
                                                            double Opacity = control.Opac;
831
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
832

  
833
                                                            Controls_PDF.DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
834
                                                        }
835
                                                        break;
836
                                                    #endregion
837
                                                    #region TriControl
838
                                                    case "TriControl":
839
                                                        using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
982
                                                    }
983
                                                    break;
984
#endregion
985
#region TEXT
986
                                                case "TextControl":
987
                                                    using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
988
                                                    {
989
                                                        DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
990
                                                    }
991
                                                    break;
992
#endregion
993
#region ArrowTextControl
994
                                                case "ArrowTextControl":
995
                                                    using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
996
                                                    {
997
                                                        //using (S_TextControl textcontrol = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
998
                                                        //{
999
                                                        //    textcontrol.Angle = control.Angle;
1000
                                                        //    textcontrol.BoxH = control.BoxHeight;
1001
                                                        //    textcontrol.BoxW = control.BoxWidth;
1002
                                                        //    textcontrol.EndPoint = control.EndPoint;
1003
                                                        //    textcontrol.FontColor = "#FFFF0000";
1004
                                                        //    textcontrol.Name = "TextControl";
1005
                                                        //    textcontrol.Opac = control.Opac;
1006
                                                        //    textcontrol.PointSet = new List<Point>();
1007
                                                        //    textcontrol.SizeSet = string.Join(delimiterChars2.First(), control.SizeSet.First(), control.fontConfig[3]);
1008
                                                        //    textcontrol.StartPoint = control.StartPoint;
1009
                                                        //    textcontrol.Text = control.ArrowText;
1010
                                                        //    textcontrol.TransformPoint = control.TransformPoint;
1011
                                                        //    textcontrol.UserID = null;
1012
                                                        //    textcontrol.fontConfig = control.fontConfig;
1013
                                                        //    textcontrol.isHighLight = control.isHighLight;
1014
                                                        //    textcontrol.paintMethod = 1;
1015

  
1016
                                                        //    DrawTextBox(textcontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
1017
                                                        //}
1018

  
1019
                                                        //using (S_ArrowControl_Multi linecontrol = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
1020
                                                        //{
1021
                                                        //    linecontrol.Angle = control.Angle;
1022
                                                        //    linecontrol.DashSize = new DoubleCollection(new[] {(double)999999 });
1023
                                                        //    linecontrol.EndPoint = control.EndPoint;
1024
                                                        //    linecontrol.MidPoint = control.MidPoint;
1025
                                                        //    linecontrol.Name = "ArrowControl_Multi";
1026
                                                        //    linecontrol.Opac = control.Opac;
1027
                                                        //    linecontrol.PointSet = control.PointSet;
1028
                                                        //    linecontrol.SizeSet = control.SizeSet;
1029
                                                        //    linecontrol.StartPoint = control.StartPoint;
1030
                                                        //    linecontrol.StrokeColor = control.StrokeColor;
1031
                                                        //    linecontrol.TransformPoint = control.TransformPoint;
1032

  
1033
                                                        //    DrawMultiArrowLine(linecontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
1034
                                                        //}
1035
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1036
                                                        Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
1037
                                                        Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
1038
                                                        Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
1039
                                                        bool isUnderLine = false;
1040
                                                        string Text = "";
1041
                                                        double fontsize = 30;
1042

  
1043
                                                        System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
1044
                                                        Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
1045
                                                        List<Point> tempPoint = new List<Point>();
1046

  
1047
                                                        double Angle = control.Angle;
1048

  
1049
                                                        if (Math.Abs(Angle).ToString() == "90")
840 1050
                                                        {
841
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
842
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
843
                                                            var PaintStyle = control.Paint;
844
                                                            double Angle = control.Angle;
845
                                                            //StrokeColor = _SetColor, //색상은 레드
846
                                                            DoubleCollection DashSize = control.DashSize;
847
                                                            double Opacity = control.Opac;
848
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
849

  
850
                                                            Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle | PaintSet.Outline, Opacity);
1051
                                                            Angle = 270;
851 1052
                                                        }
852
                                                        break;
853
                                                    #endregion
854
                                                    #region CircleControl
855
                                                    case "CircleControl":
856
                                                        using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
1053
                                                        else if (Math.Abs(Angle).ToString() == "270")
857 1054
                                                        {
858
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
859
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
860
                                                            var StartPoint = GetPdfPointSystem(control.StartPoint);
861
                                                            var EndPoint = GetPdfPointSystem(control.EndPoint);
862
                                                            var PaintStyle = control.PaintState;
863
                                                            double Angle = control.Angle;
864
                                                            DoubleCollection DashSize = control.DashSize;
865
                                                            double Opacity = control.Opac;
866
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
867
                                                            Controls_PDF.DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
868

  
1055
                                                            Angle = 90;
869 1056
                                                        }
870
                                                        break;
871
                                                    #endregion
872
                                                    #region RectCloudControl
873
                                                    case "RectCloudControl":
874
                                                        using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
875
                                                        {
876
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
877
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
878
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
879
                                                            double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
880

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

  
883
                                                            var PaintStyle = control.PaintState;
884
                                                            double Opacity = control.Opac;
885
                                                            DoubleCollection DashSize = control.DashSize;
886

  
887
                                                            //드로잉 방식이 표현되지 않음
888
                                                            var rrrr = returnAngle(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
889 1057

  
890
                                                            double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
891
                                                            bool reverse = (area < 0);
892
                                                    
893
                                                            Controls_PDF.DrawSet_Cloud.DrawCloudRect(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
894
                                                        }
895
                                                        break;
896
                                                    #endregion
897
                                                    #region CloudControl
898
                                                    case "CloudControl":
899
                                                        using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
1058
                                                        var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
1059
                                                        tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
1060
                                                        tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
1061
                                                        tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
1062
                                                        tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
1063

  
1064
                                                        var newStartPoint = tempStartPoint;
1065
                                                        var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
1066
                                                        var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
1067

  
1068
                                                        //Point testPoint = tempEndPoint;
1069
                                                        //if (Angle != 0)
1070
                                                        //{
1071
                                                        //    testPoint = GetArrowTextControlTestPoint(0, newMidPoint, tempPoint, control.isFixed);
1072
                                                        //   //testPoint = Test(rect, newMidPoint);
1073
                                                        //}
1074

  
1075
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
1076
                                                        System.Drawing.Color FontColor = _SetColor;
1077
                                                        bool isHighlight = control.isHighLight;
1078
                                                        double Opacity = control.Opac;
1079
                                                        PaintSet Paint = PaintSet.None;
1080

  
1081
                                                        switch (control.ArrowStyle)
900 1082
                                                        {
901
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
902
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
903
                                                            double Toler = control.Toler;
904
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
905
                                                            double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
906
                                                            var PaintStyle = control.PaintState;
907
                                                            double Opacity = control.Opac;
908
                                                            bool isTransOn = control.IsTrans;
909
                                                            bool isChain = control.IsChain;
910

  
911
                                                            DoubleCollection DashSize = control.DashSize;
912

  
913
                                                            if (isChain)
914
                                                            {
915
                                                                Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
916
                                                            }
917
                                                            else
918
                                                            {
919
                                                                if (isTransOn)
1083
                                                            case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
920 1084
                                                                {
921
                                                                    double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
922
                                                                    bool reverse = (area < 0);
923

  
924
                                                                    if (PaintStyle == PaintSet.None)
925
                                                                    {
926
                                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
927
                                                                    }
928
                                                                    else
929
                                                                    {
930
                                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
931
                                                                    }
1085
                                                                    Paint = PaintSet.None;
932 1086
                                                                }
933
                                                                else
1087
                                                                break;
1088
                                                            case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
934 1089
                                                                {
935
                                                                    Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
1090
                                                                    Paint = PaintSet.Hatch;
936 1091
                                                                }
937
                                                            }
1092
                                                                break;
1093
                                                            case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
1094
                                                                {
1095
                                                                    Paint = PaintSet.Fill;
1096
                                                                }
1097
                                                                break;
1098
                                                            default:
1099
                                                                break;
938 1100
                                                        }
939
                                                        break;
940
                                                    #endregion
941
                                                    #region TEXT
942
                                                    case "TextControl":
943
                                                        using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
1101
                                                        if (control.isHighLight) Paint |= PaintSet.Highlight;
1102

  
1103
                                                        if (Paint == PaintSet.Hatch)
944 1104
                                                        {
945
                                                            DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
1105
                                                            Text = control.ArrowText;
946 1106
                                                        }
947
                                                        break;
948
                                                    #endregion
949
                                                    #region ArrowTextControl
950
                                                    case "ArrowTextControl":
951
                                                        using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
1107
                                                        else
952 1108
                                                        {
953
                                                            //using (S_TextControl textcontrol = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
954
                                                            //{
955
                                                            //    textcontrol.Angle = control.Angle;
956
                                                            //    textcontrol.BoxH = control.BoxHeight;
957
                                                            //    textcontrol.BoxW = control.BoxWidth;
958
                                                            //    textcontrol.EndPoint = control.EndPoint;
959
                                                            //    textcontrol.FontColor = "#FFFF0000";
960
                                                            //    textcontrol.Name = "TextControl";
961
                                                            //    textcontrol.Opac = control.Opac;
962
                                                            //    textcontrol.PointSet = new List<Point>();
963
                                                            //    textcontrol.SizeSet = string.Join(delimiterChars2.First(), control.SizeSet.First(), control.fontConfig[3]);
964
                                                            //    textcontrol.StartPoint = control.StartPoint;
965
                                                            //    textcontrol.Text = control.ArrowText;
966
                                                            //    textcontrol.TransformPoint = control.TransformPoint;
967
                                                            //    textcontrol.UserID = null;
968
                                                            //    textcontrol.fontConfig = control.fontConfig;
969
                                                            //    textcontrol.isHighLight = control.isHighLight;
970
                                                            //    textcontrol.paintMethod = 1;
971

  
972
                                                            //    DrawTextBox(textcontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
973
                                                            //}
974

  
975
                                                            //using (S_ArrowControl_Multi linecontrol = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
976
                                                            //{
977
                                                            //    linecontrol.Angle = control.Angle;
978
                                                            //    linecontrol.DashSize = new DoubleCollection(new[] {(double)999999 });
979
                                                            //    linecontrol.EndPoint = control.EndPoint;
980
                                                            //    linecontrol.MidPoint = control.MidPoint;
981
                                                            //    linecontrol.Name = "ArrowControl_Multi";
982
                                                            //    linecontrol.Opac = control.Opac;
983
                                                            //    linecontrol.PointSet = control.PointSet;
984
                                                            //    linecontrol.SizeSet = control.SizeSet;
985
                                                            //    linecontrol.StartPoint = control.StartPoint;
986
                                                            //    linecontrol.StrokeColor = control.StrokeColor;
987
                                                            //    linecontrol.TransformPoint = control.TransformPoint;
988

  
989
                                                            //    DrawMultiArrowLine(linecontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
990
                                                            //}
991
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
992
                                                            Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
993
                                                            Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
994
                                                            Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
995
                                                            bool isUnderLine = false;
996
                                                            string Text = "";
997
                                                            double fontsize = 30;
998

  
999
                                                            System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
1000
                                                            Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
1001
                                                            List<Point> tempPoint = new List<Point>();
1002

  
1003
                                                            double Angle = control.Angle;
1004

  
1005
                                                            if (Math.Abs(Angle).ToString() == "90")
1109
                                                            Text = control.ArrowText;
1110
                                                        }
1111

  
1112
                                                        try
1113
                                                        {
1114
                                                            if (control.fontConfig.Count == 4)
1006 1115
                                                            {
1007
                                                                Angle = 270;
1116
                                                                fontsize = Convert.ToDouble(control.fontConfig[3]);
1008 1117
                                                            }
1009
                                                            else if (Math.Abs(Angle).ToString() == "270")
1118

  
1119
                                                            //강인구 수정(2018.04.17)
1120
                                                            var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
1121

  
1122
                                                            FontStyle fontStyle = FontStyles.Normal;
1123
                                                            if (FontStyles.Italic == TextStyle)
1010 1124
                                                            {
1011
                                                                Angle = 90;
1125
                                                                fontStyle = FontStyles.Italic;
1012 1126
                                                            }
1013 1127

  
1014
                                                            var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
1015
                                                            tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
1016
                                                            tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
1017
                                                            tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
1018
                                                            tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
1019

  
1020
                                                            var newStartPoint = tempStartPoint;
1021
                                                            var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
1022
                                                            var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
1023

  
1024
                                                            //Point testPoint = tempEndPoint;
1025
                                                            //if (Angle != 0)
1026
                                                            //{
1027
                                                            //    testPoint = GetArrowTextControlTestPoint(0, newMidPoint, tempPoint, control.isFixed);
1028
                                                            //   //testPoint = Test(rect, newMidPoint);
1029
                                                            //}
1030

  
1031
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
1032
                                                            System.Drawing.Color FontColor = _SetColor;
1033
                                                            bool isHighlight = control.isHighLight;
1034
                                                            double Opacity = control.Opac;
1035
                                                            PaintSet Paint = PaintSet.None;
1036

  
1037
                                                            switch (control.ArrowStyle)
1128
                                                            FontWeight fontWeight = FontWeights.Black;
1129

  
1130
                                                            var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
1131
                                                            if (FontWeights.Bold == TextWeight)
1038 1132
                                                            {
1039
                                                                case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
1040
                                                                    {
1041
                                                                        Paint = PaintSet.None;
1042
                                                                    }
1043
                                                                    break;
1044
                                                                case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
1045
                                                                    {
1046
                                                                        Paint = PaintSet.Hatch;
1047
                                                                    }
1048
                                                                    break;
1049
                                                                case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
1050
                                                                    {
1051
                                                                        Paint = PaintSet.Fill;
1052
                                                                    }
1053
                                                                    break;
1054
                                                                default:
1055
                                                                    break;
1133
                                                                fontWeight = FontWeights.Bold;
1056 1134
                                                            }
1057
                                                            if (control.isHighLight) Paint |= PaintSet.Highlight;
1058 1135

  
1059
                                                            if (Paint == PaintSet.Hatch)
1136
                                                            TextDecorationCollection decoration = TextDecorations.Baseline;
1137
                                                            if (control.fontConfig.Count() == 5)
1060 1138
                                                            {
1061
                                                                Text = control.ArrowText;
1139
                                                                decoration = TextDecorations.Underline;
1062 1140
                                                            }
1063
                                                            else
1141

  
1142
                                                            if (control.isTrans)
1064 1143
                                                            {
1065
                                                                Text = control.ArrowText;
1144
                                                                //인구 수정 Arrow Text Style적용 되도록 변경
1145
                                                                Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1146
                                                                newStartPoint, tempMidPoint, newEndPoint, control.isFixed,
1147
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1066 1148
                                                            }
1067

  
1068
                                                            try
1149
                                                            else
1069 1150
                                                            {
1070
                                                                if (control.fontConfig.Count == 4)
1071
                                                                {
1072
                                                                    fontsize = Convert.ToDouble(control.fontConfig[3]);
1073
                                                                }
1074

  
1075
                                                                //강인구 수정(2018.04.17)
1076
                                                                var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
1077

  
1078
                                                                FontStyle fontStyle = FontStyles.Normal;
1079
                                                                if (FontStyles.Italic == TextStyle)
1080
                                                                {
1081
                                                                    fontStyle = FontStyles.Italic;
1082
                                                                }
1083

  
1084
                                                                FontWeight fontWeight = FontWeights.Black;
1085

  
1086
                                                                var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
1087
                                                                if (FontWeights.Bold == TextWeight)
1088
                                                                {
1089
                                                                    fontWeight = FontWeights.Bold;
1090
                                                                }
1091

  
1092
                                                                TextDecorationCollection decoration = TextDecorations.Baseline;
1093
                                                                if (control.fontConfig.Count() == 5)
1094
                                                                {
1095
                                                                    decoration = TextDecorations.Underline;
1096
                                                                }
1097

  
1098
                                                                if (control.isTrans)
1099
                                                                {
1100
                                                                    //인구 수정 Arrow Text Style적용 되도록 변경
1101
                                                                    Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1102
                                                                    newStartPoint, tempMidPoint, newEndPoint, control.isFixed,
1103
                                                                    LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1104
                                                                }
1105
                                                                else
1151
                                                                if (control.isFixed)
1106 1152
                                                                {
1153
                                                                    var testP = new Point(0, 0);
1107 1154
                                                                    if (control.isFixed)
1108 1155
                                                                    {
1109
                                                                        var testP = new Point(0, 0);
1110
                                                                        if (control.isFixed)
1156
                                                                        if (tempPoint[1] == newEndPoint)
1111 1157
                                                                        {
1112
                                                                            if (tempPoint[1] == newEndPoint)
1113
                                                                            {
1114
                                                                                testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
1115
                                                                            }
1116
                                                                            else if (tempPoint[3] == newEndPoint)
1117
                                                                            {
1118
                                                                                testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
1119
                                                                            }
1120
                                                                            else if (tempPoint[0] == newEndPoint)
1121
                                                                            {
1122
                                                                                testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
1123
                                                                            }
1124
                                                                            else if (tempPoint[2] == newEndPoint)
1125
                                                                            {
1126
                                                                                testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
1127
                                                                            }
1158
                                                                            testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
1159
                                                                        }
1160
                                                                        else if (tempPoint[3] == newEndPoint)
1161
                                                                        {
1162
                                                                            testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
1163
                                                                        }
1164
                                                                        else if (tempPoint[0] == newEndPoint)
1165
                                                                        {
1166
                                                                            testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
1167
                                                                        }
1168
                                                                        else if (tempPoint[2] == newEndPoint)
1169
                                                                        {
1170
                                                                            testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
1128 1171
                                                                        }
1129
                                                                        //인구 수정 Arrow Text Style적용 되도록 변경
1130
                                                                        Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1131
                                                                            tempStartPoint, testP, tempEndPoint, control.isFixed,
1132
                                                                            LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
1133
                                                                        FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1134
                                                                    }
1135
                                                                    else
1136
                                                                    {
1137
                                                                        //인구 수정 Arrow Text Style적용 되도록 변경
1138
                                                                        Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1139
                                                                            newStartPoint, tempMidPoint, tempEndPoint, control.isFixed,
1140
                                                                            LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1141 1172
                                                                    }
1142
                                                                }
1143
                                                            }
1144
                                                            catch (Exception ex)
1145
                                                            {
1146
                                                                throw ex;
1147
                                                            }
1148

  
1149
                                                        }
1150
                                                        break;
1151
                                                    #endregion
1152
                                                    #region SignControl
1153
                                                    case "SignControl":
1154
                                                        string signStr = null;
1155

  
1156
                                                        using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
1157
                                                        {
1158
                                                            using (Markus.EntityModel.MarkusModel cIEntity = new Markus.EntityModel.MarkusModel(CIConnectionString))
1159
                                                            {
1160
                                                                var sIGNINFO = from sin in cIEntity.SIGN_INFO
1161
                                                                               where sin.MEMBER_USER_ID == control.UserNumber
1162
                                                                               select sin;
1163

  
1164
                                                                if (sIGNINFO.Count() > 0)
1165
                                                                {
1166
                                                                    signStr = sIGNINFO.First().SIGN_STR;
1167

  
1168
                                                                    double Angle = control.Angle;
1169
                                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1170
                                                                    Point TopRightPoint = GetPdfPointSystem(control.TR);
1171
                                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1172
                                                                    Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1173
                                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1174
                                                                    double Opacity = control.Opac;
1175
                                                                    Controls_PDF.DrawSet_Image.DrawSign(signStr, StartPoint, EndPoint, PointSet, contentByte, Angle, Opacity);
1173
                                                                    //인구 수정 Arrow Text Style적용 되도록 변경
1174
                                                                    Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1175
                                                                        tempStartPoint, testP, tempEndPoint, control.isFixed,
1176
                                                                        LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
1177
                                                                    FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1176 1178
                                                                }
1177 1179
                                                                else
1178 1180
                                                                {
1179
                                                                    StatusChange ($"Sign Not Found. UserID : {control.UserNumber}.", 0);
1181
                                                                    //인구 수정 Arrow Text Style적용 되도록 변경
1182
                                                                    Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1183
                                                                        newStartPoint, tempMidPoint, tempEndPoint, control.isFixed,
1184
                                                                        LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1180 1185
                                                                }
1181 1186
                                                            }
1182 1187
                                                        }
1183
                                                        break;
1184
                                                    #endregion
1185
                                                    #region MyRegion
1186
                                                    case "DateControl":
1187
                                                        using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item))
1188
                                                        catch (Exception ex)
1188 1189
                                                        {
1189
                                                            string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1190
                                                            string Text = control.Text;
1191
                                                            Point StartPoint = GetPdfPointSystem(control.StartPoint);
1192
                                                            Point EndPoint = GetPdfPointSystem(control.EndPoint);
1193
                                                            List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1194
                                                            System.Drawing.Color FontColor = _SetColor;
1195
                                                            double Angle = control.Angle;
1196
                                                            double Opacity = control.Opac;
1197
                                                            Controls_PDF.PDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1190
                                                            throw ex;
1198 1191
                                                        }
1199
                                                        break;
1200
                                                    #endregion
1201
                                                    #region SymControlN (APPROVED)
1202
                                                    case "SymControlN":
1203
                                                        using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1192

  
1193
                                                    }
1194
                                                    break;
1195
#endregion
1196
#region SignControl
1197
                                                case "SignControl":
1198
                                                    string signStr = null;
1199

  
1200
                                                    using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
1201
                                                    {
1202
                                                        using (Markus.EntityModel.MarkusModel cIEntity = new Markus.EntityModel.MarkusModel(CIConnectionString))
1204 1203
                                                        {
1205
                                                            Point StartPoint = GetPdfPointSystem(control.StartPoint);
1206
                                                            Point EndPoint = GetPdfPointSystem(control.EndPoint);
1207
                                                            List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1208
                                                            System.Drawing.Color FontColor = _SetColor;
1209
                                                            double Angle = control.Angle;
1210
                                                            double Opacity = control.Opac;
1204
                                                            var sIGNINFO = from sin in cIEntity.SIGN_INFO
1205
                                                                            where sin.MEMBER_USER_ID == control.UserNumber
1206
                                                                            select sin;
1207

  
1208
                                                            if (sIGNINFO.Count() > 0)
1209
                                                            {
1210
                                                                signStr = sIGNINFO.First().SIGN_STR;
1211 1211

  
1212
                                                                double Angle = control.Angle;
1213
                                                                Point StartPoint = GetPdfPointSystem(control.StartPoint);
1214
                                                                Point TopRightPoint = GetPdfPointSystem(control.TR);
1215
                                                                Point EndPoint = GetPdfPointSystem(control.EndPoint);
1216
                                                                Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1217
                                                                List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1218
                                                                double Opacity = control.Opac;
1219
                                                                Controls_PDF.DrawSet_Image.DrawSign(signStr, StartPoint, EndPoint, PointSet, contentByte, Angle, Opacity);
1220
                                                            }
1221
                                                            else
1222
                                                            {
1223
                                                                FinalMakeError($"Sign Not Found. UserID : {control.UserNumber}.", StatusCodeType.SignError);
1224
                                                            }
1225
                                                        }
1226
                                                    }
1227
                                                    break;
1228
#endregion
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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