프로젝트

일반

사용자정보

개정판 b66a2996

IDb66a2996b29cbc6ce67eea79c84ed12a1143fba4
상위 51ae61b9
하위 def4a668

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #497 : Snap Line Grid Fix

Change-Id: Iecca9e6942d9906ba109b43d40acccbb2a981ec6

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
101 101
                    SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true);
102 102
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStep, AllCount);
103 103
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText);
104
                    //Thread.Sleep(1000);
105
                    //SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd);
106
                    //Thread.Sleep(1000);
107 104

  
108 105
                    SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Group Symbol Modeling");
109 106
                    List<List<Symbol>> symbolGroups = SPPIDUtil.GetThreeConnectedSymbolGroup(document);
......
200 197
            {
201 198
                application.ActiveWindow.Fit();
202 199

  
203
                if (newDrawing != null)
200
                if (radApp.ActiveDocument != null)
204 201
                {
205
                    radApp.ActiveDocument.SaveOnClose = false;
206
                    radApp.ActiveDocument.Save();
202
                    //radApp.ActiveDocument.Save();
203
                    //radApp.ActiveDocument.SaveOnClose = false;
204
                    //radApp.ActiveDocument.Close(false);
205

  
207 206
                    ReleaseCOMObjects(newDrawing);
208 207
                }
209 208

  
......
220 219
        /// </summary>
221 220
        private void CreateDocument()
222 221
        {
223
            newDrawing = application.Drawings.Add(document.Unit, document.Template, document.DrawingNumber, document.DrawingName);
222
            string drawingName = document.DrawingName;
223
            string drawingNumber = document.DrawingNumber;
224

  
225
            GetDrawingNameAndNumber(ref drawingName, ref drawingNumber);
226

  
227
            newDrawing = application.Drawings.Add(document.Unit, document.Template, drawingNumber, drawingName);
224 228
            application.ActiveWindow.Fit();
225 229
            Thread.Sleep(1000);
226 230
            application.ActiveWindow.Zoom = 2000;
227 231
            Thread.Sleep(2000);
232

  
233
            
234
        }
235

  
236
        private void GetDrawingNameAndNumber(ref string drawingName, ref string drawingNumber)
237
        {
238
            LMDrawings drawings = new LMDrawings();
239
            drawings.Collect(dataSource);
240

  
241
            List<string> drawingNameList = new List<string>();
242
            List<string> drawingNumberList = new List<string>();
243

  
244
            foreach (LMDrawing item in drawings)
245
            {
246
                drawingNameList.Add(item.Attributes["Name"].get_Value().ToString());
247
                drawingNumberList.Add(item.Attributes["DrawingNumber"].get_Value().ToString());
248
            }
249

  
250
            int nameLength = drawingName.Length;
251
            while (drawingNameList.Contains(drawingName))
252
            {
253
                if (nameLength == drawingName.Length)
254
                    drawingName += "-1";
255
                else
256
                {
257
                    int index = Convert.ToInt32(drawingName.Remove(0, nameLength + 1));
258
                    drawingName = drawingName.Substring(0, nameLength + 1);
259
                    drawingName += ++index;
260
                }
261
            }
262

  
263
            int numberLength = drawingNumber.Length;
264
            while (drawingNameList.Contains(drawingNumber))
265
            {
266
                if (numberLength == drawingNumber.Length)
267
                    drawingNumber += "-1";
268
                else
269
                {
270
                    int index = Convert.ToInt32(drawingNumber.Remove(0, numberLength + 1));
271
                    drawingNumber = drawingNumber.Substring(0, numberLength + 1);
272
                    drawingNumber += ++index;
273
                }
274
            }
275

  
276
            ReleaseCOMObjects(drawings);
228 277
        }
229 278

  
230 279
        /// <summary>
......
963 1012
                SlopeType slopeType = SPPIDUtil.CalcSlope(line.SPPID.START_X, line.SPPID.START_Y, line.SPPID.END_X, line.SPPID.END_Y);
964 1013
                // Symbol일 경우 바로 Input Point
965 1014
                if (item.Item1 == "SYMBOL")
966
                {
967 1015
                    placeRunInputs.AddSymbolTarget(item.Item3 as LMSymbol, x, y);
968
                    prevX = x;
969
                    prevY = y;
970
                    prevSlopeType = slopeType;
971
                    continue;
972
                }
973

  
974
                SPPIDUtil.ConvertGridPoint(ref x, ref y);
975
                // i == 0은 그대로 사용
976
                if (i != 0)
1016
                else
977 1017
                {
978
                    Tuple<string, Line, object, double, double> prevItem = linePointInfo[i - 1];
979
                    // y 좌표가 같아야함
980
                    if (prevSlopeType == SlopeType.HORIZONTAL)
981
                        y = prevY;
982
                    else if (prevSlopeType == SlopeType.VERTICAL)
983
                        x = prevX;
984

  
985
                    if (i + 1 == linePointInfo.Count - 1 && linePointInfo[i + 1].Item1 == "SYMBOL")
1018
                    SPPIDUtil.ConvertGridPoint(ref x, ref y);
1019
                    // i == 0은 그대로 사용
1020
                    if (i != 0)
986 1021
                    {
987
                        Line nextLine = linePointInfo[i + 1].Item2;
988
                        SlopeType nextSlopeType = SPPIDUtil.CalcSlope(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y);
989
                        if (slopeType == SlopeType.HORIZONTAL)
990
                            y = linePointInfo[i + 1].Item5;
991
                        else if (slopeType == SlopeType.VERTICAL)
992
                            x = linePointInfo[i + 1].Item4;
1022
                        Tuple<string, Line, object, double, double> prevItem = linePointInfo[i - 1];
1023
                        // y 좌표가 같아야함 및 Symbol 좌표가 정확하지 않으므로 한번더 보정
1024
                        if (prevSlopeType == SlopeType.HORIZONTAL)
1025
                        {
1026
                            y = prevY;
1027
                            SPPIDUtil.ConvertGridPointOnlyOnePoint(ref y);
1028
                        }
1029
                        else if (prevSlopeType == SlopeType.VERTICAL)
1030
                        {
1031
                            x = prevX;
1032
                            SPPIDUtil.ConvertGridPointOnlyOnePoint(ref x);
1033
                        }
1034

  
1035
                        // 마지막이 Symbol일 경우는 Symbol의 좌표를 따라감
1036
                        if (i + 1 == linePointInfo.Count - 1 && linePointInfo[i + 1].Item1 == "SYMBOL")
1037
                        {
1038
                            Line nextLine = linePointInfo[i + 1].Item2;
1039
                            SlopeType nextSlopeType = SPPIDUtil.CalcSlope(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y);
1040
                            if (slopeType == SlopeType.HORIZONTAL)
1041
                                y = linePointInfo[i + 1].Item5;
1042
                            else if (slopeType == SlopeType.VERTICAL)
1043
                                x = linePointInfo[i + 1].Item4;
1044
                        }
993 1045
                    }
994
                }
995 1046

  
996
                if (item.Item1 == "LINE")
997
                    placeRunInputs.AddConnectorTarget(item.Item3 as LMConnector, x, y);
998
                else
999
                    placeRunInputs.AddPoint(x, y);
1047
                    if (item.Item1 == "LINE")
1048
                        placeRunInputs.AddConnectorTarget(item.Item3 as LMConnector, x, y);
1049
                    else
1050
                        placeRunInputs.AddPoint(x, y);
1051
                }
1000 1052

  
1001 1053
                prevX = x;
1002 1054
                prevY = y;
......
1101 1153
        private void BranchLineModeling(Tuple<string, Line, Line> branch)
1102 1154
        {
1103 1155
            List<Line> lines = SPPIDUtil.FindLinesByModelId(document, branch.Item1);
1156

  
1104 1157
            Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(branch.Item1);
1105 1158

  
1106 1159
            LMConnector _StartConnector = null;

내보내기 Unified diff

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