프로젝트

일반

사용자정보

개정판 ff665e73

IDff665e738d1fe118a86e3cfd025342c0c4bb25cc
상위 d5096d58
하위 23d0d512

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

PDF 교체 후 원본 PDF의 페이지수가 변경된 경우 이전 markup의 페이지를 찾지 못해 수정함.

Change-Id: I80e5ebb86c826107df694bdf8fd488ade6856c37

차이점 보기:

FinalService/KCOM_FinalService/MarkupToPDF/MarkupToPDF.cs
655 655

  
656 656
                            foreach (var markupItem in MarkupDataSet)
657 657
                            {
658
                                pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
659
                                var currentPage = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER).FirstOrDefault();
658
                                /// 2020.11.13 김태성
659
                                /// 원본 PDF의 페이지수가 변경된 경우 이전 markup의 페이지를 찾지 못해 수정함.
660
                                var pageitems = DocPageItem.Where(d => d.PAGE_NUMBER == markupItem.PAGENUMBER);
660 661

  
661
                                mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
662
                                var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);                                
663

  
664
                                /// media box와 crop box가 다를 경우 media box를 crop box와 일치시킨다
665
                                if (cropBox != null && 
666
                                    (cropBox.Left != mediaBox.Left || cropBox.Top != mediaBox.Top || cropBox.Right != mediaBox.Right || cropBox.Bottom != mediaBox.Bottom))
662
                                if(pageitems.Count() > 0)
667 663
                                {
668
                                    PdfDictionary dict = pdfReader.GetPageN(markupItem.PAGENUMBER);
664
                                    var currentPage = pageitems.First();
665
                                    pdfSize = pdfReader.GetPageSizeWithRotation(markupItem.PAGENUMBER);
666
                                    //try
667
                                    //{
668
                        
669
                                    //}
670
                                    //catch (Exception ex)
671
                                    //{
672
                                    //    SetNotice(finaldata.ID, $"GetPageSizeWithRotation Error PageNO : {markupItem.PAGENUMBER} " + ex.ToString());
673
                                    //}
674
                                    //finally
675
                                    //{
676
                                    //    pdfSize = new iTextSharp.text.Rectangle(0, 0, float.Parse(currentPage.PAGE_WIDTH), float.Parse(currentPage.PAGE_HEIGHT));
677
                                    //}
678

  
679
                                    mediaBox = pdfReader.GetPageSize(markupItem.PAGENUMBER);
680
                                    var cropBox = pdfReader.GetCropBox(markupItem.PAGENUMBER);
681

  
682
                                    /// media box와 crop box가 다를 경우 media box를 crop box와 일치시킨다
683
                                    if (cropBox != null &&
684
                                        (cropBox.Left != mediaBox.Left || cropBox.Top != mediaBox.Top || cropBox.Right != mediaBox.Right || cropBox.Bottom != mediaBox.Bottom))
685
                                    {
686
                                        PdfDictionary dict = pdfReader.GetPageN(markupItem.PAGENUMBER);
669 687

  
670
                                    PdfArray oNewMediaBox = new PdfArray();
671
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Left));
672
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Top));
673
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Right));
674
                                    oNewMediaBox.Add(new PdfNumber(cropBox.Bottom));
675
                                    dict.Put(PdfName.MEDIABOX, oNewMediaBox);
688
                                        PdfArray oNewMediaBox = new PdfArray();
689
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Left));
690
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Top));
691
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Right));
692
                                        oNewMediaBox.Add(new PdfNumber(cropBox.Bottom));
693
                                        dict.Put(PdfName.MEDIABOX, oNewMediaBox);
676 694

  
677
                                    pdfSize = cropBox; 
678
                                }
679
                                scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
680
                                scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
695
                                        pdfSize = cropBox;
696
                                    }
681 697

  
682
                                pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER;
683
                                _entity.SaveChanges();
698
                                    scaleWidth = float.Parse(currentPage.PAGE_WIDTH) / pdfSize.Width;
699
                                    scaleHeight = float.Parse(currentPage.PAGE_HEIGHT) / pdfSize.Height;
684 700

  
685
                                string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
701
                                    pdfLink.CURRENT_PAGE = markupItem.PAGENUMBER;
702
                                    _entity.SaveChanges();
686 703

  
687
                                PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
704
                                    string[] markedData = markupItem.DATA.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
688 705

  
689
                                foreach (var data in markedData)
690
                                {
691
                                    var item = JsonSerializerHelper.UnCompressString(data);
692
                                    var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
693
                              
694
                                    try
706
                                    PdfContentByte contentByte = pdfStamper.GetOverContent(markupItem.PAGENUMBER);
707

  
708
                                    foreach (var data in markedData)
695 709
                                    {
696
                                        switch (ControlT.Name)
710
                                        var item = JsonSerializerHelper.UnCompressString(data);
711
                                        var ControlT = JsonSerializerHelper.JsonDeserialize<S_BaseControl>(item);
712

  
713
                                        try
697 714
                                        {
698
                                            #region LINE
699
                                            case "LineControl":
700
                                                {
701
                                                    using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
715
                                            switch (ControlT.Name)
716
                                            {
717
                                                #region LINE
718
                                                case "LineControl":
702 719
                                                    {
703
                                                        DrawLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
720
                                                        using (S_LineControl control = JsonSerializerHelper.JsonDeserialize<S_LineControl>(item))
721
                                                        {
722
                                                            DrawLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
723
                                                        }
704 724
                                                    }
705
                                                }
706
                                                break;
707
                                            #endregion
708
                                            #region ArrowControlMulti
709
                                            case "ArrowControl_Multi":
710
                                                {
711
                                                    using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
725
                                                    break;
726
                                                #endregion
727
                                                #region ArrowControlMulti
728
                                                case "ArrowControl_Multi":
712 729
                                                    {
713
                                                       DrawMultiArrowLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
730
                                                        using (S_ArrowControl_Multi control = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
731
                                                        {
732
                                                            DrawMultiArrowLine(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
733
                                                        }
714 734
                                                    }
715
                                                }
716
                                                break;
717
                                            #endregion
718
                                            #region PolyControl
719
                                            case "PolygonControl":
720
                                                using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
721
                                                {
722
                                                    string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
723
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
724
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
725
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
726
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
727
                                                    double Opacity = control.Opac;
728
                                                    DoubleCollection DashSize = control.DashSize;
729

  
730
                                                    Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
731
                                                }
732
                                                break;
733
                                            #endregion
734
                                            #region ArcControl or ArrowArcControl
735
                                            case "ArcControl":
736
                                            case "ArrowArcControl":
737
                                                {
738
                                                    using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
735
                                                    break;
736
                                                #endregion
737
                                                #region PolyControl
738
                                                case "PolygonControl":
739
                                                    using (S_PolyControl control = JsonSerializerHelper.JsonDeserialize<S_PolyControl>(item))
739 740
                                                    {
740 741
                                                        string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
741 742
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
742 743
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
743
                                                        Point MidPoint = GetPdfPointSystem(control.MidPoint);
744
                                                        DoubleCollection DashSize = control.DashSize;
745 744
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
746

  
747
                                                        var Opacity = control.Opac;
748
                                                        string UserID = control.UserID;
749 745
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
750
                                                        bool IsTransOn = control.IsTransOn;
746
                                                        double Opacity = control.Opac;
747
                                                        DoubleCollection DashSize = control.DashSize;
751 748

  
752
                                                        if (control.IsTransOn)
753
                                                        {
754
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
755
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
756
                                                        }
757
                                                        else
749
                                                        Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
750
                                                    }
751
                                                    break;
752
                                                #endregion
753
                                                #region ArcControl or ArrowArcControl
754
                                                case "ArcControl":
755
                                                case "ArrowArcControl":
756
                                                    {
757
                                                        using (S_ArcControl control = JsonSerializerHelper.JsonDeserialize<S_ArcControl>(item))
758 758
                                                        {
759
                                                            Controls_PDF.DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
760
                                                        }
759
                                                            string[] InnerData = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
760
                                                            Point StartPoint = GetPdfPointSystem(control.StartPoint);
761
                                                            Point EndPoint = GetPdfPointSystem(control.EndPoint);
762
                                                            Point MidPoint = GetPdfPointSystem(control.MidPoint);
763
                                                            DoubleCollection DashSize = control.DashSize;
764
                                                            List<Point> PointSet = GetPdfPointSystem(control.PointSet);
765

  
766
                                                            var Opacity = control.Opac;
767
                                                            string UserID = control.UserID;
768
                                                            double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(InnerData.First()));
769
                                                            bool IsTransOn = control.IsTransOn;
770

  
771
                                                            if (control.IsTransOn)
772
                                                            {
773
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, StartPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
774
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity, true);
775
                                                            }
776
                                                            else
777
                                                            {
778
                                                                Controls_PDF.DrawSet_Arc.DrawArc(StartPoint, MidPoint, EndPoint, (int)LineSize, contentByte, _SetColor, Opacity);
779
                                                            }
761 780

  
762
                                                        if (ControlT.Name == "ArrowArcControl")
763
                                                        {
764
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
765
                                                            Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
781
                                                            if (ControlT.Name == "ArrowArcControl")
782
                                                            {
783
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(StartPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
784
                                                                Controls_PDF.DrawSet_Arrow.SingleAllow(EndPoint, MidPoint, LineSize, contentByte, _SetColor, Opacity);
785
                                                            }
766 786
                                                        }
767 787
                                                    }
768
                                                }
769
                                                break;
770
                                            #endregion
771
                                            #region RectangleControl
772
                                            case "RectangleControl":
773
                                                using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
774
                                                {
775
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
776
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
777
                                                    var PaintStyle = control.PaintState;
778
                                                    double Angle = control.Angle;
779
                                                    DoubleCollection DashSize = control.DashSize;
780
                                                    double Opacity = control.Opac;
781
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
782

  
783
                                                    Controls_PDF.DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
784
                                                }
785
                                                break;
786
                                            #endregion
787
                                            #region TriControl
788
                                            case "TriControl":
789
                                                using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
790
                                                {
791
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
792
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
793
                                                    var PaintStyle = control.Paint;
794
                                                    double Angle = control.Angle;
795
                                                    //StrokeColor = _SetColor, //색상은 레드
796
                                                    DoubleCollection DashSize = control.DashSize;
797
                                                    double Opacity = control.Opac;
798
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
799

  
800
                                                    Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
801
                                                }
802
                                                break;
803
                                            #endregion
804
                                            #region CircleControl
805
                                            case "CircleControl":
806
                                                using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
807
                                                {
808
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
809
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
810
                                                    var StartPoint = GetPdfPointSystem(control.StartPoint);
811
                                                    var EndPoint = GetPdfPointSystem(control.EndPoint);
812
                                                    var PaintStyle = control.PaintState;
813
                                                    double Angle = control.Angle;
814
                                                    DoubleCollection DashSize = control.DashSize;
815
                                                    double Opacity = control.Opac;
816
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
817
                                                    Controls_PDF.DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
818

  
819
                                                }
820
                                                break;
821
                                            #endregion
822
                                            #region RectCloudControl
823
                                            case "RectCloudControl":
824
                                                using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
825
                                                {
826
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
827
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
828
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
829
                                                    double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
830

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

  
833
                                                    var PaintStyle = control.PaintState;
834
                                                    double Opacity = control.Opac;
835
                                                    DoubleCollection DashSize = control.DashSize;
836

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

  
840
                                                    double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
841
                                                    bool reverse = (area < 0);
842
                                                    if (PaintStyle == PaintSet.None)
788
                                                    break;
789
                                                #endregion
790
                                                #region RectangleControl
791
                                                case "RectangleControl":
792
                                                    using (S_RectControl control = JsonSerializerHelper.JsonDeserialize<S_RectControl>(item))
843 793
                                                    {
844
                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
794
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
795
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
796
                                                        var PaintStyle = control.PaintState;
797
                                                        double Angle = control.Angle;
798
                                                        DoubleCollection DashSize = control.DashSize;
799
                                                        double Opacity = control.Opac;
800
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
801

  
802
                                                        Controls_PDF.DrawSet_Shape.DrawRectangle(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
845 803
                                                    }
846
                                                    else
804
                                                    break;
805
                                                #endregion
806
                                                #region TriControl
807
                                                case "TriControl":
808
                                                    using (S_TriControl control = JsonSerializerHelper.JsonDeserialize<S_TriControl>(item))
847 809
                                                    {
848
                                                        Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
810
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
811
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
812
                                                        var PaintStyle = control.Paint;
813
                                                        double Angle = control.Angle;
814
                                                        //StrokeColor = _SetColor, //색상은 레드
815
                                                        DoubleCollection DashSize = control.DashSize;
816
                                                        double Opacity = control.Opac;
817
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
818

  
819
                                                        Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity);
849 820
                                                    }
850
                                                }
851
                                                break;
852
                                            #endregion
853
                                            #region CloudControl
854
                                            case "CloudControl":
855
                                                using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
856
                                                {
857
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
858
                                                    double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
859
                                                    double Toler = control.Toler;
860
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
861
                                                    double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
862
                                                    var PaintStyle = control.PaintState;
863
                                                    double Opacity = control.Opac;
864
                                                    bool isTransOn = control.IsTrans;
865
                                                    bool isChain = control.IsChain;
866

  
867
                                                    DoubleCollection DashSize = control.DashSize;
868

  
869
                                                    if (isChain)
821
                                                    break;
822
                                                #endregion
823
                                                #region CircleControl
824
                                                case "CircleControl":
825
                                                    using (S_CircleControl control = JsonSerializerHelper.JsonDeserialize<S_CircleControl>(item))
870 826
                                                    {
871
                                                        Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
827
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
828
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
829
                                                        var StartPoint = GetPdfPointSystem(control.StartPoint);
830
                                                        var EndPoint = GetPdfPointSystem(control.EndPoint);
831
                                                        var PaintStyle = control.PaintState;
832
                                                        double Angle = control.Angle;
833
                                                        DoubleCollection DashSize = control.DashSize;
834
                                                        double Opacity = control.Opac;
835
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
836
                                                        Controls_PDF.DrawSet_Shape.DrawCircle(StartPoint, EndPoint, LineSize, contentByte, DashSize, _SetColor, PaintStyle, Opacity, Angle, PointSet);
837

  
872 838
                                                    }
873
                                                    else
839
                                                    break;
840
                                                #endregion
841
                                                #region RectCloudControl
842
                                                case "RectCloudControl":
843
                                                    using (S_RectCloudControl control = JsonSerializerHelper.JsonDeserialize<S_RectCloudControl>(item))
874 844
                                                    {
875
                                                        if (isTransOn)
845
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
846
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
847
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
848
                                                        double size = MathSet.DistanceTo(GetPdfPointSystem(control.StartPoint), GetPdfPointSystem(control.EndPoint));
849

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

  
852
                                                        var PaintStyle = control.PaintState;
853
                                                        double Opacity = control.Opac;
854
                                                        DoubleCollection DashSize = control.DashSize;
855

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

  
859
                                                        double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
860
                                                        bool reverse = (area < 0);
861
                                                        if (PaintStyle == PaintSet.None)
876 862
                                                        {
877
                                                            double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
878
                                                            bool reverse = (area < 0);
863
                                                            Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
864
                                                        }
865
                                                        else
866
                                                        {
867
                                                            Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
868
                                                        }
869
                                                    }
870
                                                    break;
871
                                                #endregion
872
                                                #region CloudControl
873
                                                case "CloudControl":
874
                                                    using (S_CloudControl control = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(item))
875
                                                    {
876
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
877
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
878
                                                        double Toler = control.Toler;
879
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
880
                                                        double ArcLength = (control.ArcLength == 0 ? 10 : control.ArcLength) / (scaleWidth > scaleHeight ? scaleWidth : scaleHeight);
881
                                                        var PaintStyle = control.PaintState;
882
                                                        double Opacity = control.Opac;
883
                                                        bool isTransOn = control.IsTrans;
884
                                                        bool isChain = control.IsChain;
885

  
886
                                                        DoubleCollection DashSize = control.DashSize;
879 887

  
880
                                                            if (PaintStyle == PaintSet.None)
888
                                                        if (isChain)
889
                                                        {
890
                                                            Controls_PDF.DrawSet_Line.DrawLine(PointSet, LineSize, contentByte, DashSize, _SetColor, Opacity);
891
                                                        }
892
                                                        else
893
                                                        {
894
                                                            if (isTransOn)
881 895
                                                            {
882
                                                                Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
896
                                                                double area = MathSet.AreaOf(GetPdfPointSystem(control.PointSet));
897
                                                                bool reverse = (area < 0);
898

  
899
                                                                if (PaintStyle == PaintSet.None)
900
                                                                {
901
                                                                    Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
902
                                                                }
903
                                                                else
904
                                                                {
905
                                                                    Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
906
                                                                }
883 907
                                                            }
884 908
                                                            else
885 909
                                                            {
886
                                                                Controls_PDF.DrawSet_Cloud.DrawCloud(PointSet, LineSize, ArcLength, contentByte, control.DashSize, _SetColor, _SetColor, PaintStyle, Opacity);
910
                                                                Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
887 911
                                                            }
888 912
                                                        }
889
                                                        else
913
                                                    }
914
                                                    break;
915
                                                #endregion
916
                                                #region TEXT
917
                                                case "TextControl":
918
                                                    using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
919
                                                    {
920
                                                        DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
921
                                                    }
922
                                                    break;
923
                                                #endregion
924
                                                #region ArrowTextControl
925
                                                case "ArrowTextControl":
926
                                                    using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
927
                                                    {
928
                                                        //using (S_TextControl textcontrol = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
929
                                                        //{
930
                                                        //    textcontrol.Angle = control.Angle;
931
                                                        //    textcontrol.BoxH = control.BoxHeight;
932
                                                        //    textcontrol.BoxW = control.BoxWidth;
933
                                                        //    textcontrol.EndPoint = control.EndPoint;
934
                                                        //    textcontrol.FontColor = "#FFFF0000";
935
                                                        //    textcontrol.Name = "TextControl";
936
                                                        //    textcontrol.Opac = control.Opac;
937
                                                        //    textcontrol.PointSet = new List<Point>();
938
                                                        //    textcontrol.SizeSet = string.Join(delimiterChars2.First(), control.SizeSet.First(), control.fontConfig[3]);
939
                                                        //    textcontrol.StartPoint = control.StartPoint;
940
                                                        //    textcontrol.Text = control.ArrowText;
941
                                                        //    textcontrol.TransformPoint = control.TransformPoint;
942
                                                        //    textcontrol.UserID = null;
943
                                                        //    textcontrol.fontConfig = control.fontConfig;
944
                                                        //    textcontrol.isHighLight = control.isHighLight;
945
                                                        //    textcontrol.paintMethod = 1;
946

  
947
                                                        //    DrawTextBox(textcontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
948
                                                        //}
949

  
950
                                                        //using (S_ArrowControl_Multi linecontrol = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
951
                                                        //{
952
                                                        //    linecontrol.Angle = control.Angle;
953
                                                        //    linecontrol.DashSize = new DoubleCollection(new[] {(double)999999 });
954
                                                        //    linecontrol.EndPoint = control.EndPoint;
955
                                                        //    linecontrol.MidPoint = control.MidPoint;
956
                                                        //    linecontrol.Name = "ArrowControl_Multi";
957
                                                        //    linecontrol.Opac = control.Opac;
958
                                                        //    linecontrol.PointSet = control.PointSet;
959
                                                        //    linecontrol.SizeSet = control.SizeSet;
960
                                                        //    linecontrol.StartPoint = control.StartPoint;
961
                                                        //    linecontrol.StrokeColor = control.StrokeColor;
962
                                                        //    linecontrol.TransformPoint = control.TransformPoint;
963

  
964
                                                        //    DrawMultiArrowLine(linecontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
965
                                                        //}
966
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
967
                                                        Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
968
                                                        Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
969
                                                        Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
970
                                                        bool isUnderLine = false;
971
                                                        string Text = "";
972
                                                        double fontsize = 30;
973

  
974
                                                        System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
975
                                                        Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
976
                                                        List<Point> tempPoint = new List<Point>();
977

  
978
                                                        double Angle = control.Angle;
979

  
980
                                                        if (Math.Abs(Angle).ToString() == "90")
890 981
                                                        {
891
                                                            Controls_PDF.DrawSet_Shape.DrawPolygon(PointSet, LineSize, contentByte, control.DashSize, _SetColor, PaintStyle, Opacity);
982
                                                            Angle = 270;
892 983
                                                        }
893
                                                    }
894
                                                }
895
                                                break;
896
                                            #endregion
897
                                            #region TEXT
898
                                            case "TextControl":
899
                                                using (S_TextControl control = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
900
                                                {
901
                                                    DrawTextBox(control, contentByte, delimiterChars, delimiterChars2, _SetColor);
902
                                                 }
903
                                                break;
904
                                            #endregion
905
                                            #region ArrowTextControl
906
                                            case "ArrowTextControl":
907
                                                using (S_ArrowTextControl control = JsonSerializerHelper.JsonDeserialize<S_ArrowTextControl>(item))
908
                                                {
909
                                                    //using (S_TextControl textcontrol = JsonSerializerHelper.JsonDeserialize<S_TextControl>(item))
910
                                                    //{
911
                                                    //    textcontrol.Angle = control.Angle;
912
                                                    //    textcontrol.BoxH = control.BoxHeight;
913
                                                    //    textcontrol.BoxW = control.BoxWidth;
914
                                                    //    textcontrol.EndPoint = control.EndPoint;
915
                                                    //    textcontrol.FontColor = "#FFFF0000";
916
                                                    //    textcontrol.Name = "TextControl";
917
                                                    //    textcontrol.Opac = control.Opac;
918
                                                    //    textcontrol.PointSet = new List<Point>();
919
                                                    //    textcontrol.SizeSet = string.Join(delimiterChars2.First(), control.SizeSet.First(), control.fontConfig[3]);
920
                                                    //    textcontrol.StartPoint = control.StartPoint;
921
                                                    //    textcontrol.Text = control.ArrowText;
922
                                                    //    textcontrol.TransformPoint = control.TransformPoint;
923
                                                    //    textcontrol.UserID = null;
924
                                                    //    textcontrol.fontConfig = control.fontConfig;
925
                                                    //    textcontrol.isHighLight = control.isHighLight;
926
                                                    //    textcontrol.paintMethod = 1;
927

  
928
                                                    //    DrawTextBox(textcontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
929
                                                    //}
930

  
931
                                                    //using (S_ArrowControl_Multi linecontrol = JsonSerializerHelper.JsonDeserialize<S_ArrowControl_Multi>(item))
932
                                                    //{
933
                                                    //    linecontrol.Angle = control.Angle;
934
                                                    //    linecontrol.DashSize = new DoubleCollection(new[] {(double)999999 });
935
                                                    //    linecontrol.EndPoint = control.EndPoint;
936
                                                    //    linecontrol.MidPoint = control.MidPoint;
937
                                                    //    linecontrol.Name = "ArrowControl_Multi";
938
                                                    //    linecontrol.Opac = control.Opac;
939
                                                    //    linecontrol.PointSet = control.PointSet;
940
                                                    //    linecontrol.SizeSet = control.SizeSet;
941
                                                    //    linecontrol.StartPoint = control.StartPoint;
942
                                                    //    linecontrol.StrokeColor = control.StrokeColor;
943
                                                    //    linecontrol.TransformPoint = control.TransformPoint;
944

  
945
                                                    //    DrawMultiArrowLine(linecontrol, contentByte, delimiterChars, delimiterChars2, _SetColor);
946
                                                    //}
947
                                                string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
948
                                                Point tempStartPoint = GetPdfPointSystem(control.StartPoint);
949
                                                Point tempMidPoint = GetPdfPointSystem(control.MidPoint);
950
                                                Point tempEndPoint = GetPdfPointSystem(control.EndPoint);
951
                                                bool isUnderLine = false;
952
                                                string Text = "";
953
                                                double fontsize = 30;
954

  
955
                                                System.Drawing.SizeF sizeF = new System.Drawing.SizeF((float)control.BoxWidth, (float)control.BoxHeight);
956
                                                Rect rect = new Rect(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight));
957
                                                List<Point> tempPoint = new List<Point>();
958

  
959
                                                double Angle = control.Angle;
960

  
961
                                                if (Math.Abs(Angle).ToString() == "90")
962
                                                {
963
                                                    Angle = 270;
964
                                                }
965
                                                else if (Math.Abs(Angle).ToString() == "270")
966
                                                {
967
                                                    Angle = 90;
968
                                                }
969

  
970
                                                var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
971
                                                tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
972
                                                tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
973
                                                tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
974
                                                tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
975

  
976
                                                var newStartPoint = tempStartPoint;
977
                                                var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
978
                                                var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
979

  
980
                                                    //Point testPoint = tempEndPoint;
981
                                                    //if (Angle != 0)
982
                                                    //{
983
                                                    //    testPoint = GetArrowTextControlTestPoint(0, newMidPoint, tempPoint, control.isFixed);
984
                                                    //   //testPoint = Test(rect, newMidPoint);
985
                                                    //}
986

  
987
                                                double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
988
                                                SolidColorBrush FontColor = _SetColor;
989
                                                bool isHighlight = control.isHighLight;
990
                                                double Opacity = control.Opac;
991
                                                PaintSet Paint = PaintSet.None;
992

  
993
                                                switch (control.ArrowStyle)
994
                                                {
995
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
984
                                                        else if (Math.Abs(Angle).ToString() == "270")
996 985
                                                        {
997
                                                            Paint = PaintSet.None;
986
                                                            Angle = 90;
987
                                                        }
988

  
989
                                                        var tempRectMidPoint = MathSet.getRectMiddlePoint(rect);
990
                                                        tempPoint.Add(new Point(rect.Left, tempRectMidPoint.Y));
991
                                                        tempPoint.Add(new Point(tempRectMidPoint.X, rect.Top));
992
                                                        tempPoint.Add(new Point(rect.Right, tempRectMidPoint.Y));
993
                                                        tempPoint.Add(new Point(tempRectMidPoint.X, rect.Bottom));
994

  
995
                                                        var newStartPoint = tempStartPoint;
996
                                                        var newEndPoint = MathSet.getNearPoint(tempPoint, tempMidPoint);
997
                                                        var newMidPoint = MathSet.getMiddlePoint(newStartPoint, newEndPoint);
998

  
999
                                                        //Point testPoint = tempEndPoint;
1000
                                                        //if (Angle != 0)
1001
                                                        //{
1002
                                                        //    testPoint = GetArrowTextControlTestPoint(0, newMidPoint, tempPoint, control.isFixed);
1003
                                                        //   //testPoint = Test(rect, newMidPoint);
1004
                                                        //}
1005

  
1006
                                                        double LineSize = Common.ConverterLineSize.Convert(Convert.ToInt32(data2.First()));
1007
                                                        SolidColorBrush FontColor = _SetColor;
1008
                                                        bool isHighlight = control.isHighLight;
1009
                                                        double Opacity = control.Opac;
1010
                                                        PaintSet Paint = PaintSet.None;
1011

  
1012
                                                        switch (control.ArrowStyle)
1013
                                                        {
1014
                                                            case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Normal:
1015
                                                                {
1016
                                                                    Paint = PaintSet.None;
1017
                                                                }
1018
                                                                break;
1019
                                                            case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
1020
                                                                {
1021
                                                                    Paint = PaintSet.Hatch;
1022
                                                                }
1023
                                                                break;
1024
                                                            case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
1025
                                                                {
1026
                                                                    Paint = PaintSet.Fill;
1027
                                                                }
1028
                                                                break;
1029
                                                            default:
1030
                                                                break;
998 1031
                                                        }
999
                                                        break;
1000
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud:
1032
                                                        if (control.isHighLight) Paint |= PaintSet.Highlight;
1033

  
1034
                                                        if (Paint == PaintSet.Hatch)
1001 1035
                                                        {
1002
                                                            Paint = PaintSet.Hatch;
1036
                                                            Text = control.ArrowText;
1003 1037
                                                        }
1004
                                                        break;
1005
                                                    case Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect:
1038
                                                        else
1006 1039
                                                        {
1007
                                                            Paint = PaintSet.Fill;
1040
                                                            Text = control.ArrowText;
1008 1041
                                                        }
1009
                                                        break;
1010
                                                    default:
1011
                                                        break;
1012
                                                }
1013
                                                if (control.isHighLight) Paint |= PaintSet.Highlight;
1014

  
1015
                                                if (Paint == PaintSet.Hatch)
1016
                                                {
1017
                                                    Text = control.ArrowText;
1018
                                                }
1019
                                                else
1020
                                                {
1021
                                                    Text = control.ArrowText;
1022
                                                }
1023

  
1024
                                                try
1025
                                                {
1026
                                                    if (control.fontConfig.Count == 4)
1027
                                                    {
1028
                                                        fontsize = Convert.ToDouble(control.fontConfig[3]);
1029
                                                    }
1030 1042

  
1031
                                                    //강인구 수정(2018.04.17)
1032
                                                    var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
1043
                                                        try
1044
                                                        {
1045
                                                            if (control.fontConfig.Count == 4)
1046
                                                            {
1047
                                                                fontsize = Convert.ToDouble(control.fontConfig[3]);
1048
                                                            }
1033 1049

  
1034
                                                    FontStyle fontStyle = FontStyles.Normal;
1035
                                                    if (FontStyles.Italic == TextStyle)
1036
                                                    {
1037
                                                        fontStyle = FontStyles.Italic;
1038
                                                    }
1050
                                                            //강인구 수정(2018.04.17)
1051
                                                            var TextStyle = Common.StringToFont.ConFontStyle(control.fontConfig[1]);
1039 1052

  
1040
                                                    FontWeight fontWeight = FontWeights.Black;
1053
                                                            FontStyle fontStyle = FontStyles.Normal;
1054
                                                            if (FontStyles.Italic == TextStyle)
1055
                                                            {
1056
                                                                fontStyle = FontStyles.Italic;
1057
                                                            }
1041 1058

  
1042
                                                    var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
1043
                                                    if (FontWeights.Bold == TextWeight)
1044
                                                    {
1045
                                                        fontWeight = FontWeights.Bold;
1046
                                                    }
1059
                                                            FontWeight fontWeight = FontWeights.Black;
1047 1060

  
1048
                                                    TextDecorationCollection decoration = TextDecorations.Baseline;
1049
                                                    if (control.fontConfig.Count() == 5)
1050
                                                    {
1051
                                                        decoration = TextDecorations.Underline;
1052
                                                    }
1061
                                                            var TextWeight = Common.StringToFont.ConFontWeight(control.fontConfig[2]);
1062
                                                            if (FontWeights.Bold == TextWeight)
1063
                                                            {
1064
                                                                fontWeight = FontWeights.Bold;
1065
                                                            }
1053 1066

  
1054
                                                    if (control.isTrans)
1055
                                                    {
1056
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1057
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1058
                                                            newStartPoint, tempMidPoint, newEndPoint, control.isFixed,
1059
                                                            LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1060
                                                    }
1061
                                                    else
1062
                                                    {
1063
                                                        if (control.isFixed)
1064
                                                        {
1065
                                                            var testP = new Point(0, 0);
1066
                                                            if (control.isFixed)
1067
                                                            TextDecorationCollection decoration = TextDecorations.Baseline;
1068
                                                            if (control.fontConfig.Count() == 5)
1067 1069
                                                            {
1068
                                                                if (tempPoint[1] == newEndPoint)
1069
                                                                {
1070
                                                                    testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
1071
                                                                }
1072
                                                                else if (tempPoint[3] == newEndPoint)
1073
                                                                {
1074
                                                                    testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
1075
                                                                }
1076
                                                                else if (tempPoint[0] == newEndPoint)
1070
                                                                decoration = TextDecorations.Underline;
1071
                                                            }
1072

  
1073
                                                            if (control.isTrans)
1074
                                                            {
1075
                                                                //인구 수정 Arrow Text Style적용 되도록 변경
1076
                                                                Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1077
                                                                newStartPoint, tempMidPoint, newEndPoint, control.isFixed,
1078
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1079
                                                            }
1080
                                                            else
1081
                                                            {
1082
                                                                if (control.isFixed)
1077 1083
                                                                {
1078
                                                                    testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
1084
                                                                    var testP = new Point(0, 0);
1085
                                                                    if (control.isFixed)
1086
                                                                    {
1087
                                                                        if (tempPoint[1] == newEndPoint)
1088
                                                                        {
1089
                                                                            testP = new Point(newEndPoint.X, newEndPoint.Y - 10);
1090
                                                                        }
1091
                                                                        else if (tempPoint[3] == newEndPoint)
1092
                                                                        {
1093
                                                                            testP = new Point(newEndPoint.X, newEndPoint.Y + 10);
1094
                                                                        }
1095
                                                                        else if (tempPoint[0] == newEndPoint)
1096
                                                                        {
1097
                                                                            testP = new Point(newEndPoint.X - 10, newEndPoint.Y);
1098
                                                                        }
1099
                                                                        else if (tempPoint[2] == newEndPoint)
1100
                                                                        {
1101
                                                                            testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
1102
                                                                        }
1103
                                                                    }
1104
                                                                    //인구 수정 Arrow Text Style적용 되도록 변경
1105
                                                                    Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1106
                                                                        tempStartPoint, testP, tempEndPoint, control.isFixed,
1107
                                                                        LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
1108
                                                                    FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1079 1109
                                                                }
1080
                                                                else if (tempPoint[2] == newEndPoint)
1110
                                                                else
1081 1111
                                                                {
1082
                                                                    testP = new Point(newEndPoint.X + 10, newEndPoint.Y);
1112
                                                                    //인구 수정 Arrow Text Style적용 되도록 변경
1113
                                                                    Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1114
                                                                        newStartPoint, tempMidPoint, tempEndPoint, control.isFixed,
1115
                                                                        LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1083 1116
                                                                }
1084 1117
                                                            }
1085
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1086
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1087
                                                                tempStartPoint, testP, tempEndPoint, control.isFixed,
1088
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight,
1089
                                                            FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1090 1118
                                                        }
1091
                                                        else
1119
                                                        catch (Exception ex)
1092 1120
                                                        {
1093
                                                            //인구 수정 Arrow Text Style적용 되도록 변경
1094
                                                            Controls_PDF.DrawSet_Text.DrawString_ArrowText(tempEndPoint, new Point(tempEndPoint.X + control.BoxWidth / scaleWidth, tempEndPoint.Y - control.BoxHeight / scaleHeight),
1095
                                                                newStartPoint, tempMidPoint, tempEndPoint, control.isFixed,
1096
                                                                LineSize, contentByte, _SetColor, Paint, fontsize, isHighlight, FontHelper.GetFontFamily(control.fontConfig[0]), fontStyle, fontWeight, decoration, Text, sizeF, Opacity, Angle);
1121
                                                            throw ex;
1097 1122
                                                        }
1123

  
1098 1124
                                                    }
1099
                                                }
1100
                                                catch (Exception ex)
1101
                                                {
1102
                                                    throw ex;
1103
                                                }
1104

  
1105
                                                }
1106
                                                break;
1107
                                            #endregion
1108
                                            #region SignControl
1109
                                            case "SignControl":
1110
                                                using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
1111
                                                {
1112

  
1113
                                                    double Angle = control.Angle;
1114
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1115
                                                    Point TopRightPoint = GetPdfPointSystem(control.TR);
1116
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1117
                                                    Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1118
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1119
                                                    double Opacity = control.Opac;
1120
                                                    string UserNumber = control.UserNumber;
1121
                                                    Controls_PDF.DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO);
1122
                                                }
1123
                                                break;
1124
                                            #endregion
1125
                                            #region MyRegion
1126
                                            case "DateControl":
1127
                                                using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item))
1128
                                                {
1129
                                                    string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1130
                                                    string Text = control.Text;
1131
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1132
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1133
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1134
                                                    SolidColorBrush FontColor = _SetColor;
1135
                                                    double Angle = control.Angle;
1136
                                                    double Opacity = control.Opac;
1137
                                                    Controls_PDF.PDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1138
                                                }
1139
                                                break;
1140
                                            #endregion
1141
                                            #region SymControlN (APPROVED)
1142
                                            case "SymControlN":
1143
                                                using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1144
                                                {
1145
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1146
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1147
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1148
                                                    SolidColorBrush FontColor = _SetColor;
1149
                                                    double Angle = control.Angle;
1150
                                                    double Opacity = control.Opac;
1151

  
1152
                                                    var stamp = _entity.PROPERTIES.Where(x => x.TYPE == "STAMP");
1153

  
1154
                                                    if (stamp.Count() > 0)
1125
                                                    break;
1126
                                                #endregion
1127
                                                #region SignControl
1128
                                                case "SignControl":
1129
                                                    using (S_SignControl control = JsonSerializerHelper.JsonDeserialize<S_SignControl>(item))
1155 1130
                                                    {
1156
                                                        var xamldata = Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(stamp.First().VALUE);
1157 1131

  
1158
                                                        Controls_PDF.PDFLib_DrawSet_Symbol.DrawApprovalXamlData(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, xamldata);
1132
                                                        double Angle = control.Angle;
1133
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
1134
                                                        Point TopRightPoint = GetPdfPointSystem(control.TR);
1135
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
1136
                                                        Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1137
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1138
                                                        double Opacity = control.Opac;
1139
                                                        string UserNumber = control.UserNumber;
1140
                                                        Controls_PDF.DrawSet_Image.DrawSign(StartPoint, EndPoint, PointSet, contentByte, UserNumber, Angle, Opacity, finaldata.PROJECT_NO);
1141
                                                    }
1142
                                                    break;
1143
                                                #endregion
1144
                                                #region MyRegion
1145
                                                case "DateControl":
1146
                                                    using (S_DateControl control = JsonSerializerHelper.JsonDeserialize<S_DateControl>(item))
1147
                                                    {
1148
                                                        string[] data2 = control.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries);
1149
                                                        string Text = control.Text;
1150
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
1151
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
1152
                                                        List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1153
                                                        SolidColorBrush FontColor = _SetColor;
1154
                                                        double Angle = control.Angle;
1155
                                                        double Opacity = control.Opac;
1156
                                                        Controls_PDF.PDFLib_DrawSet_Text.DrawDate(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Text, Angle, Opacity);
1159 1157
                                                    }
1158
                                                    break;
1159
                                                #endregion
1160
                                                #region SymControlN (APPROVED)
1161
                                                case "SymControlN":
1162
                                                    using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1163
                                                    {
1164
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
1165
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
1166
                                                        List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1167
                                                        SolidColorBrush FontColor = _SetColor;
1168
                                                        double Angle = control.Angle;
1169
                                                        double Opacity = control.Opac;
1170

  
1171
                                                        var stamp = _entity.PROPERTIES.Where(x => x.TYPE == "STAMP");
1172

  
1173
                                                        if (stamp.Count() > 0)
1174
                                                        {
1175
                                                            var xamldata = Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(stamp.First().VALUE);
1176

  
1177
                                                            Controls_PDF.PDFLib_DrawSet_Symbol.DrawApprovalXamlData(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, xamldata);
1178
                                                        }
1179

  
1180
                                                        string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", "");
1181

  
1182
                                                    }
1183
                                                    break;
1184
                                                case "SymControl":
1185
                                                    using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1186
                                                    {
1187
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
1188
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
1189
                                                        List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1190
                                                        SolidColorBrush FontColor = _SetColor;
1191
                                                        double Angle = control.Angle;
1192
                                                        double Opacity = control.Opac;
1193

  
1194
                                                        string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", "");
1195
                                                        Controls_PDF.PDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1196
                                                    }
1197
                                                    break;
1198
                                                #endregion
1199
                                                #region Image
1200
                                                case "ImgControl":
1201
                                                    using (S_ImgControl control = JsonSerializerHelper.JsonDeserialize<S_ImgControl>(item))
1202
                                                    {
1203
                                                        double Angle = control.Angle;
1204
                                                        Point StartPoint = GetPdfPointSystem(control.StartPoint);
1205
                                                        Point TopRightPoint = GetPdfPointSystem(control.TR);
1206
                                                        Point EndPoint = GetPdfPointSystem(control.EndPoint);
1207
                                                        Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1208
                                                        List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1209
                                                        double Opacity = control.Opac;
1210
                                                        string FilePath = control.ImagePath;
1211
                                                        //Uri uri = new Uri(s.ImagePath);
1212

  
1213
                                                        Controls_PDF.DrawSet_Image.DrawImage(StartPoint, EndPoint, PointSet, contentByte, FilePath, Angle, Opacity);
1214
                                                    }
1215
                                                    break;
1216
                                                #endregion
1217
                                                default:
1218
                                                    StatusChange($"{ControlT.Name} Not Support", 0);
1219
                                                    break;
1220
                                            }
1160 1221

  
1161
                                                    string imgpath = CommonLib.Common.GetConfigString("ApprovedImgPath", "URL", "");
1162
                                                    
1163
                                                }
1164
                                                break;
1165
                                            case "SymControl":
1166
                                                using (S_SymControl control = JsonSerializerHelper.JsonDeserialize<S_SymControl>(item))
1167
                                                {
1168
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1169
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1170
                                                    List<Point> pointSet = GetPdfPointSystem(control.PointSet);
1171
                                                    SolidColorBrush FontColor = _SetColor;
1172
                                                    double Angle = control.Angle;
1173
                                                    double Opacity = control.Opac;
1174

  
1175
                                                    string imgpath = CommonLib.Common.GetConfigString("CheckmarkImgPath", "URL", "");
1176
                                                    Controls_PDF.PDFLib_DrawSet_Symbol.DrawCheckMark(StartPoint, EndPoint, pointSet, contentByte, _SetColor, Angle, Opacity, imgpath);
1177
                                                }
1178
                                                break;
1179
                                            #endregion
1180
                                            #region Image
1181
                                            case "ImgControl":
1182
                                                using (S_ImgControl control = JsonSerializerHelper.JsonDeserialize<S_ImgControl>(item))
1183
                                                {
1184
                                                    double Angle = control.Angle;
1185
                                                    Point StartPoint = GetPdfPointSystem(control.StartPoint);
1186
                                                    Point TopRightPoint = GetPdfPointSystem(control.TR);
1187
                                                    Point EndPoint = GetPdfPointSystem(control.EndPoint);
1188
                                                    Point LeftBottomPoint = GetPdfPointSystem(control.LB);
1189
                                                    List<Point> PointSet = GetPdfPointSystem(control.PointSet);
1190
                                                    double Opacity = control.Opac;
1191
                                                    string FilePath = control.ImagePath;
1192
                                                    //Uri uri = new Uri(s.ImagePath);
1193

  
1194
                                                    Controls_PDF.DrawSet_Image.DrawImage(StartPoint, EndPoint, PointSet, contentByte, FilePath, Angle, Opacity);
1195
                                                }
1196
                                                break;
1197
                                            #endregion
1198
                                            default:
1199
                                                StatusChange($"{ControlT.Name} Not Support", 0);
1200
                                                break;
1201 1222
                                        }
1202
                                        
1203
                                    }
1204
                                    catch (Exception ex)
1205
                                    {
1206
                                        StatusChange($"markupItem : {markupItem.ID}" + ex.ToString(), 0);
1223
                                        catch (Exception ex)
1224
                                        {
1225
                                            StatusChange($"markupItem : {markupItem.ID}" + ex.ToString(), 0);
1226
                                        }
1207 1227
                                    }
1208 1228
                                }
1229

  
1209 1230
                            }
1210 1231
                            pdfStamper.Outlines = root;
1211 1232
                            pdfStamper.Close();

내보내기 Unified diff

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