프로젝트

일반

사용자정보

개정판 6a7573b0

ID6a7573b0a7b8afc29c604e8407f5f9e17cfcc54b
상위 4d2571ab
하위 03110d25

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

dev issue #366 : Mirror 기능 및 Drawing 크기 구하는 방식 변경

Change-Id: I7c87b78b185832403f62b18783c50861c70bb208

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
288 288
        /// <returns></returns>
289 289
        private bool DocumentCoordinateCorrection()
290 290
        {
291
            double maxX = 0;
292
            double maxY = 0;
293
            foreach (object drawingObj in radApp.ActiveDocument.ActiveSheet.DrawingObjects)
291
            if (Settings.Default.DrawingX != 0 && Settings.Default.DrawingY != 0)
294 292
            {
295
                Ingr.RAD2D.SmartFrame2d smartFrame2d = drawingObj as Ingr.RAD2D.SmartFrame2d;
296
                if (smartFrame2d != null)
297
                {
298
                    double x1 = 0;
299
                    double x2 = 0;
300
                    double y1 = 0;
301
                    double y2 = 0;
302
                    smartFrame2d.Range(out x1, out y1, out x2, out y2);
303
                    maxX = Math.Max(x2, maxX);
304
                    maxY = Math.Max(y2, maxY);
305
                }
306
            }
307
            if (maxX != 0 && maxY != 0)
308
            {
309
                document.SetSPPIDLocation(maxX, maxY);
293
                document.SetSPPIDLocation(Settings.Default.DrawingX, Settings.Default.DrawingY);
310 294
                document.CoordinateCorrection();
311 295
                return true;
312 296
            }
......
466 450
            try
467 451
            {
468 452
#endif
469
            // OWNERSYMBOL Attribute, 값을 가지고 있을 경우
470
            BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(attr => attr.ATTRIBUTE == "OWNERSYMBOL");
471
            if (itemAttribute != null && string.IsNullOrEmpty(itemAttribute.VALUE) && itemAttribute.VALUE != "None")
472
                return;
473
            // 이미 모델링 됐을 경우
474
            else if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
475
                return;
476

  
477
            LMSymbol _LMSymbol = null;
478

  
479
            string mappingPath = symbol.SPPID.MAPPINGNAME;
480
            double x = symbol.SPPID.ORIGINAL_X;
481
            double y = symbol.SPPID.ORIGINAL_Y;
482
            int mirror = 0;
483
            double angle = symbol.ANGLE;
484

  
485
            SPPIDUtil.ConvertGridPoint(ref x, ref y);
486

  
487
            // OPC 일경우 180도 일때 Mirror
488
            if (mappingPath.Contains("Piping OPC's") && angle == Math.PI)
489
                mirror = 1;
453
                // OWNERSYMBOL Attribute, 값을 가지고 있을 경우
454
                BaseModel.Attribute itemAttribute = symbol.ATTRIBUTES.Find(attr => attr.ATTRIBUTE == "OWNERSYMBOL");
455
                if (itemAttribute != null && string.IsNullOrEmpty(itemAttribute.VALUE) && itemAttribute.VALUE != "None")
456
                    return;
457
                // 이미 모델링 됐을 경우
458
                else if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
459
                    return;
460

  
461
                LMSymbol _LMSymbol = null;
462

  
463
                string mappingPath = symbol.SPPID.MAPPINGNAME;
464
                double x = symbol.SPPID.ORIGINAL_X;
465
                double y = symbol.SPPID.ORIGINAL_Y;
466
                int mirror = 0;
467
                double angle = symbol.ANGLE;
468

  
469
                SPPIDUtil.ConvertGridPoint(ref x, ref y);
470

  
471
                // OPC 일경우 180도 일때 Mirror
472
                if (mappingPath.Contains("Piping OPC's") && angle == Math.PI)
473
                    mirror = 1;
474

  
475
                // Mirror 계산
476
                if (symbol.FLIP == 1)
477
                {
478
                    mirror = 1;
479
                    angle += Math.PI;
480
                }
490 481

  
491
            if (targetSymbol != null && !string.IsNullOrEmpty(targetSymbol.SPPID.RepresentationId))
492
            {
493
                LMSymbol _TargetItem = dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId);
494
                Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, symbol.UID, targetSymbol);
495
                if (connector != null)
496
                    GetTargetSymbolConnectorPoint(connector, targetSymbol, ref x, ref y);
482
                if (targetSymbol != null && !string.IsNullOrEmpty(targetSymbol.SPPID.RepresentationId))
483
                {
484
                    LMSymbol _TargetItem = dataSource.GetSymbol(targetSymbol.SPPID.RepresentationId);
485
                    Connector connector = SPPIDUtil.FindSymbolConnectorByUID(document, symbol.UID, targetSymbol);
486
                    if (connector != null)
487
                        GetTargetSymbolConnectorPoint(connector, targetSymbol, ref x, ref y);
497 488

  
498
                _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: _TargetItem);
499
                ReleaseCOMObjects(_TargetItem);
500
            }
501
            else
502
                _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle);
489
                    _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle, TargetItem: _TargetItem);
490
                    ReleaseCOMObjects(_TargetItem);
491
                }
492
                else
493
                    _LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle);
503 494

  
504 495

  
505
            if (_LMSymbol != null)
506
            {
507
                _LMSymbol.Commit();
508
                symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
509
                symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID();
496
                if (_LMSymbol != null)
497
                {
498
                    _LMSymbol.Commit();
499
                    symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id;
500
                    symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID();
510 501

  
511
                foreach (var item in symbol.ChildSymbols)
512
                    CreateChildSymbol(item, _LMSymbol);
513
            }
502
                    foreach (var item in symbol.ChildSymbols)
503
                        CreateChildSymbol(item, _LMSymbol);
504
                }
514 505

  
515
            ReleaseCOMObjects(_LMSymbol);
516
            SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount);
506
                ReleaseCOMObjects(_LMSymbol);
507
                SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount);
517 508
#if DEBUG
518 509

  
519 510
            }

내보내기 Unified diff

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