프로젝트

일반

사용자정보

개정판 45af3335

ID45af3335b1fceda6f006a0c3fbe58478ca767658
상위 a836ff3b
하위 cbce7526

조봉훈이(가) 약 2년 전에 추가함

Insert Auxiliary Graphic

Change-Id: Ied5b02bfede0dcb89919d8a355ed936d4f2ca2f5

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
22 22
using Microsoft.VisualBasic;
23 23
using Newtonsoft.Json;
24 24
using DevExpress.XtraSplashScreen;
25
using System.IO;
26

  
25 27
namespace Converter.SPPID
26 28
{
27 29
    [Flags]
......
101 103
                    Log.Write("Start Modeling");
102 104
                    SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true);
103 105
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd);
104
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 25);
106
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 26);
105 107
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText);
106 108

  
107 109
                    // VendorPackage Modeling
......
174 176
                    RunETC();
175 177
                    // input bulk attribute
176 178
                    RunBulkAttribute();
179
                    // Graphic Modeling
180
                    RunGraphicModeling();
177 181
                    // log file 생성
178 182
                    document.CheckModelingResult();
179 183
                }
......
1091 1095
                SPPIDUtil.BulkAttribute(dataSource, select, BulkAttributeItemType.Symbol);
1092 1096
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
1093 1097
        }
1098
        private void RunGraphicModeling()
1099
        {
1100
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
1101
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Graphic Modeling");
1102
            foreach (var item in document.Graphics)
1103
            {
1104
                try
1105
                {
1106
                    GraphicModeling(item);
1107
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null);
1108
                }
1109
                catch (Exception ex)
1110
                {
1111
                    Log.Write("Error in GrahicModeling");
1112
                    Log.Write("UID : " + item.UID);
1113
                    Log.Write(ex.Message);
1114
                    Log.Write(ex.StackTrace);
1115
                }
1116
            }
1117
        }
1094 1118
        /// <summary>
1095 1119
        /// 도면 생성 메서드
1096 1120
        /// </summary>
......
2176 2200
            }
2177 2201
        }
2178 2202

  
2203
        private void GraphicModeling(Graphic graphic)
2204
        {
2205
            Ingr.RAD2D.SmartFrame2d borderFrame = radApp.ActiveDocument.ActiveSheet.SmartFrames2d[0];
2206
            string styleName = "SFStyleConverter";
2207
            string projectPah = Settings.Default.ProjectPath;
2208
            string graphicDirectory = Path.Combine(projectPah, "graphic");
2209
            string filePath = Path.Combine(graphicDirectory, string.Format("{0}.igr", graphic.NAME));
2210
            if (!File.Exists(filePath)) return;
2211

  
2212
            int styleCount = radApp.ActiveDocument.SmartFrame2dStyles.Count(c => c.Name.StartsWith(styleName));
2213
            styleName = string.Format("{0}_{1}", styleName, styleCount);
2214
            Ingr.RAD2D.SmartFrame2dStyle StyleConverter = radApp.ActiveDocument.SmartFrame2dStyles.Add(styleName, "");
2215

  
2216
            Ingr.RAD2D.SmartFrame2d smartFrame = radApp.ActiveDocument.ActiveSheet.SmartFrames2d.AddBy2Points(styleName, 0.01, 0.01, 0.1, 0.1, false, filePath);
2217
            smartFrame.BorderVisible = false;
2218
            smartFrame.SetLayerDisplay("default", true);
2219

  
2220
            double oMinx = 0, oMinY = 0, oMaxX = 0, oMaxY = 0;
2221
            smartFrame.Range(out oMinx, out oMinY, out oMaxX, out oMaxY);
2222
            double cWidth = oMaxX - oMinx;
2223
            double cHeight = oMaxY - oMinY;
2224
            double height = Math.Abs(graphic.SPPIDGraphicLocation.Y2 - graphic.SPPIDGraphicLocation.Y1);
2225
            double width = Math.Abs(graphic.SPPIDGraphicLocation.X2 - graphic.SPPIDGraphicLocation.X1);
2226
            double scaleFactor = width / cWidth;
2227
            smartFrame.ScaleFactor = scaleFactor;
2228
            smartFrame.SetOrigin(graphic.SPPIDGraphicLocation.X1, graphic.SPPIDGraphicLocation.Y1);
2229
        }
2230

  
2179 2231
        /// <summary>
2180 2232
        /// 첫 진입점
2181 2233
        /// </summary>
......
6453 6505
        /// <param name="originY"></param>
6454 6506
        /// <param name="SPPIDLabelLocation"></param>
6455 6507
        /// <param name="location"></param>
6456
        private void CalcLabelLocation(ref double x, ref double y, double originX, double originY, SPPIDLabelLocationInfo SPPIDLabelLocation, Location location)
6508
        private void CalcLabelLocation(ref double x, ref double y, double originX, double originY, SPPIDEtcLocationInfo SPPIDLabelLocation, Location location)
6457 6509
        {
6458 6510
            if (location == Location.None)
6459 6511
            {

내보내기 Unified diff

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