프로젝트

일반

사용자정보

개정판 d9794a6c

IDd9794a6cdd09dea15f3564c911c4032d28bb7468
상위 3b2d7bd8
하위 1a591b2e

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

dev issue #1163 : overlap symbol remodeling

Change-Id: I00cd01da3731196836242712e7cf970a7071f071

차이점 보기:

DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs
162 162
            {
163 163
                if (_GridSetting.Unit == GridUnit.Inch)
164 164
                {
165
                    double length = _GridSetting.Density * 0.0254;
166 165
                    double temp = value;
167
                    value = Math.Round(value / length) * length;
166
                    value = Math.Round(value / _GridSetting.Length) * _GridSetting.Length;
168 167
                }
169 168
            }
170 169
        }
......
178 177
            else
179 178
            {
180 179
                double angle = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI;
181
                if (angle <= 10)
180
                if (angle <= 15)
182 181
                    return SlopeType.HORIZONTAL;
183
                else if (angle >= 80)
182
                else if (angle >= 75)
184 183
                    return SlopeType.VERTICAL;
185 184
                else
186 185
                    return SlopeType.Slope;
......
455 454

  
456 455
            return findChild;
457 456
        }
457

  
458
        public static bool IsBranchLine(Line line1, Line line2)
459
        {
460
            bool result = true;
461

  
462
            Connector conn1 = line1.CONNECTORS.Find(x => x.CONNECTEDITEM == line2.UID);
463
            Connector conn2 = line2.CONNECTORS.Find(x => x.CONNECTEDITEM == line1.UID);
464

  
465
            if (conn1 != null && conn2 != null)
466
                result = false;
467

  
468
            return result;
469
        }
470

  
471
        public static bool IsOverlap(double[] range1, double[] range2, ref double x, ref double y)
472
        {
473
            bool result = false;
474

  
475
            if (range1[0] <= range2[2] && range1[2] >= range2[0])
476
            {
477
                result = true;
478
                x = Math.Min(Math.Abs(range1[0] - range2[2]), Math.Abs(range1[2] - range2[0]));
479
            }
480

  
481
            if (range1[1] <= range2[3] && range1[3] >= range2[1])
482
            {
483
                result = true;
484
                y = Math.Min(Math.Abs(range1[1] - range2[3]), Math.Abs(range1[3] - range2[1]));
485
            }
486

  
487
            return result;
488
        }
489

  
490
        public static void CalcNewCoordinateForSymbol(Symbol symbol, Symbol prevSymbol, double distanceX, double distanceY)
491
        {
492
            SlopeType slopeType = SPPIDUtil.CalcSlope(prevSymbol.SPPID.ORIGINAL_X, prevSymbol.SPPID.ORIGINAL_Y, symbol.SPPID.ORIGINAL_X, symbol.SPPID.ORIGINAL_Y);
493
            GridSetting _GridSetting = GridSetting.GetInstance();
494
            if (slopeType == SlopeType.HORIZONTAL)
495
            {
496
                double length = (Math.Ceiling(distanceX / _GridSetting.Length) + 1) * _GridSetting.Length;
497
                if (prevSymbol.SPPID.ORIGINAL_X < symbol.SPPID.ORIGINAL_X)
498
                    symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X + length;
499
                else
500
                    symbol.SPPID.ORIGINAL_X = symbol.SPPID.ORIGINAL_X - length;
501
            }
502
            else if (slopeType == SlopeType.VERTICAL)
503
            {
504
                double length = (Math.Ceiling(distanceY / _GridSetting.Length) + 1) * _GridSetting.Length;
505
                if (prevSymbol.SPPID.ORIGINAL_Y < symbol.SPPID.ORIGINAL_Y)
506
                    symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y + length;
507
                else
508
                    symbol.SPPID.ORIGINAL_Y = symbol.SPPID.ORIGINAL_Y - length;
509
            }
510
        }
458 511
    }
459 512
}

내보내기 Unified diff

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