개정판 8b085570
dev issue #000 : 이름 변경 및 로직 변경
Change-Id: I1fc663d34917bc0a486c8397bf687b43eff7479a
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
92 | 92 |
BranchLineModeling(item); |
93 | 93 |
} |
94 | 94 |
|
95 |
foreach (LineNumber lineNumber in document.LINENUMBERS) |
|
96 |
{ |
|
97 | 95 |
|
98 |
foreach (LineRun run in lineNumber.RUNS) |
|
99 |
{ |
|
100 |
JoinRunLine(run); |
|
101 |
} |
|
102 |
} |
|
103 | 96 |
|
104 |
foreach (TrimLine trimLine in document.TRIMLINES) |
|
105 |
{ |
|
106 |
foreach (LineRun run in trimLine.RUNS) |
|
107 |
{ |
|
108 |
JoinRunLine(run); |
|
109 |
} |
|
110 |
} |
|
97 |
//foreach (LineNumber lineNumber in document.LINENUMBERS) |
|
98 |
//{ |
|
99 |
|
|
100 |
// foreach (LineRun run in lineNumber.RUNS) |
|
101 |
// { |
|
102 |
// JoinRunLine(run); |
|
103 |
// } |
|
104 |
//} |
|
105 |
|
|
106 |
//foreach (TrimLine trimLine in document.TRIMLINES) |
|
107 |
//{ |
|
108 |
// foreach (LineRun run in trimLine.RUNS) |
|
109 |
// { |
|
110 |
// JoinRunLine(run); |
|
111 |
// } |
|
112 |
//} |
|
111 | 113 |
} |
112 | 114 |
catch (Exception ex) |
113 | 115 |
{ |
... | ... | |
508 | 510 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, branch.Item1); |
509 | 511 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(branch.Item1); |
510 | 512 |
|
511 |
LMConnector _LMConnectorStart = null;
|
|
512 |
LMConnector _LMConnectorEnd = null;
|
|
513 |
LMConnector _StartConnector = null;
|
|
514 |
LMConnector _EndConnector = null;
|
|
513 | 515 |
double lengthStart = double.MaxValue; |
514 | 516 |
double lengthEnd = double.MaxValue; |
515 | 517 |
List<double[]> startPoints = new List<double[]>(); |
... | ... | |
526 | 528 |
double distance = SPPIDUtil.CalcLineToPointDistance(targetLine.SPPID.START_X, targetLine.SPPID.START_Y, targetLine.SPPID.END_X, targetLine.SPPID.END_Y, point[0], point[1]); |
527 | 529 |
if (lengthStart > distance) |
528 | 530 |
{ |
529 |
_LMConnectorStart = item.Key;
|
|
531 |
_StartConnector = item.Key;
|
|
530 | 532 |
lengthStart = distance; |
531 | 533 |
startPoints = item.Value; |
532 | 534 |
} |
... | ... | |
538 | 540 |
double distance = SPPIDUtil.CalcLineToPointDistance(targetLine.SPPID.START_X, targetLine.SPPID.START_Y, targetLine.SPPID.END_X, targetLine.SPPID.END_Y, point[0], point[1]); |
539 | 541 |
if (lengthEnd > distance) |
540 | 542 |
{ |
541 |
_LMConnectorEnd = item.Key;
|
|
543 |
_EndConnector = item.Key;
|
|
542 | 544 |
lengthEnd = distance; |
543 | 545 |
endPoints = item.Value; |
544 | 546 |
} |
... | ... | |
546 | 548 |
} |
547 | 549 |
} |
548 | 550 |
#region Branch가 양쪽 전부일 때 |
549 |
if (_LMConnectorStart != null && _LMConnectorStart == _LMConnectorEnd)
|
|
551 |
if (_StartConnector != null && _StartConnector == _EndConnector)
|
|
550 | 552 |
{ |
551 |
_placement.PIDRemovePlacement(_LMConnectorStart.AsLMRepresentation());
|
|
553 |
_placement.PIDRemovePlacement(_StartConnector.AsLMRepresentation());
|
|
552 | 554 |
|
553 | 555 |
_LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME); |
554 | 556 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
555 | 557 |
|
556 | 558 |
Dictionary<LMConnector, List<double[]>> startConnectorVertices = GetPipeRunVertices(branch.Item2.SPPID.ModelItemId); |
557 |
LMConnector startTargetConnector = FindTargetLMConnector(startConnectorVertices, startPoints[0][0], startPoints[0][1], startPoints[1][0], startPoints[1][1]);
|
|
559 |
LMConnector _StartTargetConnector = FindTargetLMConnector(startConnectorVertices, startPoints[0][0], startPoints[0][1], startPoints[1][0], startPoints[1][1]);
|
|
558 | 560 |
Dictionary<LMConnector, List<double[]>> endConnectorVertices = GetPipeRunVertices(branch.Item3.SPPID.ModelItemId); |
559 |
LMConnector endTargetConnector = FindTargetLMConnector(endConnectorVertices,
|
|
561 |
LMConnector _EndTargetConnector = FindTargetLMConnector(endConnectorVertices,
|
|
560 | 562 |
startPoints[startPoints.Count - 1][0], |
561 | 563 |
startPoints[startPoints.Count - 1][1], |
562 | 564 |
startPoints[startPoints.Count - 2][0], |
... | ... | |
566 | 568 |
{ |
567 | 569 |
double[] point = startPoints[i]; |
568 | 570 |
if (i == 0) |
569 |
placeRunInputs.AddConnectorTarget(startTargetConnector, point[0], point[1]);
|
|
571 |
placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1]);
|
|
570 | 572 |
else if (i == startPoints.Count - 1) |
571 |
placeRunInputs.AddConnectorTarget(endTargetConnector, point[0], point[1]);
|
|
573 |
placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1]);
|
|
572 | 574 |
else |
573 | 575 |
placeRunInputs.AddPoint(point[0], point[1]); |
574 | 576 |
} |
... | ... | |
590 | 592 |
ReleaseCOMObjects(_LMConnector); |
591 | 593 |
} |
592 | 594 |
#endregion |
593 |
#region 한쪽만 Branch
|
|
595 |
#region 양쪽이 다른 Branch
|
|
594 | 596 |
else |
595 | 597 |
{ |
596 | 598 |
_LMAItem _LMAItem = _placement.PIDCreateItem(lines[0].SPPID.MAPPINGNAME); |
597 | 599 |
PlaceRunInputs placeRunInputs = new PlaceRunInputs(); |
598 | 600 |
|
599 | 601 |
// Branch 시작 Connector |
600 |
if (_LMConnectorStart != null)
|
|
602 |
if (_StartConnector != null)
|
|
601 | 603 |
{ |
602 |
LMConnector endTargetConnector = null;
|
|
603 |
LMSymbol endTargetSymbol = null;
|
|
604 |
LMConnector _EndTargetConnector = null;
|
|
605 |
LMSymbol _EndTargetSymbol = null;
|
|
604 | 606 |
// Branch 반대편이 Line |
605 | 607 |
foreach (var item in connectorVertices) |
606 | 608 |
{ |
607 |
if (item.Key == _LMConnectorStart)
|
|
609 |
if (item.Key == _StartConnector)
|
|
608 | 610 |
continue; |
609 | 611 |
|
610 |
if (item.Key.ConnectItem1SymbolID == _LMConnectorStart.ConnectItem2SymbolID || |
|
611 |
item.Key.ConnectItem2SymbolID == _LMConnectorStart.ConnectItem2SymbolID) |
|
612 |
if (item.Key.ConnectItem1SymbolID == _StartConnector.ConnectItem2SymbolID) |
|
612 | 613 |
{ |
613 |
endTargetConnector = item.Key;
|
|
614 |
_EndTargetConnector = item.Key;
|
|
614 | 615 |
break; |
615 | 616 |
} |
616 | 617 |
} |
617 | 618 |
// Branch 반대편이 Symbol |
618 |
if (endTargetConnector == null)
|
|
619 |
if (_EndTargetConnector == null)
|
|
619 | 620 |
{ |
620 | 621 |
foreach (var line in lines) |
621 | 622 |
{ |
... | ... | |
624 | 625 |
Symbol symbol = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as Symbol; |
625 | 626 |
if (symbol != null) |
626 | 627 |
{ |
627 |
endTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
|
|
628 |
_EndTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
|
|
628 | 629 |
break; |
629 | 630 |
} |
630 | 631 |
} |
631 | 632 |
} |
632 | 633 |
} |
633 | 634 |
|
634 |
_placement.PIDRemovePlacement(_LMConnectorStart.AsLMRepresentation());
|
|
635 |
_placement.PIDRemovePlacement(_StartConnector.AsLMRepresentation());
|
|
635 | 636 |
|
636 | 637 |
Dictionary<LMConnector, List<double[]>> startConnectorVertices = GetPipeRunVertices(branch.Item2.SPPID.ModelItemId); |
637 |
LMConnector startTargetConnector = FindTargetLMConnector(startConnectorVertices, startPoints[0][0], startPoints[0][1], startPoints[1][0], startPoints[1][1]);
|
|
638 |
LMConnector _StartTargetConnector = FindTargetLMConnector(startConnectorVertices, startPoints[0][0], startPoints[0][1], startPoints[1][0], startPoints[1][1]);
|
|
638 | 639 |
|
639 | 640 |
for (int i = 0; i < startPoints.Count; i++) |
640 | 641 |
{ |
641 | 642 |
double[] point = startPoints[i]; |
642 | 643 |
if (i == 0) |
643 |
placeRunInputs.AddConnectorTarget(startTargetConnector, point[0], point[1]);
|
|
644 |
placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1]);
|
|
644 | 645 |
else if (i == startPoints.Count - 1) |
645 | 646 |
{ |
646 |
if (endTargetConnector != null)
|
|
647 |
placeRunInputs.AddConnectorTarget(endTargetConnector, point[0], point[1]);
|
|
648 |
else if (endTargetSymbol != null)
|
|
649 |
placeRunInputs.AddSymbolTarget(endTargetSymbol, point[0], point[1]);
|
|
647 |
if (_EndTargetConnector != null)
|
|
648 |
placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1]);
|
|
649 |
else if (_EndTargetSymbol != null)
|
|
650 |
placeRunInputs.AddSymbolTarget(_EndTargetSymbol, point[0], point[1]);
|
|
650 | 651 |
else |
651 | 652 |
placeRunInputs.AddPoint(point[0], point[1]); |
652 | 653 |
} |
... | ... | |
657 | 658 |
LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
658 | 659 |
if (_LMConnector != null ) |
659 | 660 |
{ |
660 |
if (endTargetConnector != null)
|
|
661 |
if (_EndTargetConnector != null)
|
|
661 | 662 |
{ |
662 |
JoinPipeRun(_LMConnector.ModelItemID, endTargetConnector.ModelItemID);
|
|
663 |
JoinPipeRun(_LMConnector.ModelItemID, _EndTargetConnector.ModelItemID);
|
|
663 | 664 |
} |
664 | 665 |
else |
665 | 666 |
{ |
... | ... | |
671 | 672 |
ReleaseCOMObjects(_LMConnector); |
672 | 673 |
} |
673 | 674 |
|
674 |
if (endTargetConnector != null)
|
|
675 |
ReleaseCOMObjects(endTargetConnector);
|
|
676 |
if (endTargetSymbol != null)
|
|
677 |
ReleaseCOMObjects(endTargetSymbol);
|
|
675 |
if (_EndTargetConnector != null)
|
|
676 |
ReleaseCOMObjects(_EndTargetConnector);
|
|
677 |
if (_EndTargetSymbol != null)
|
|
678 |
ReleaseCOMObjects(_EndTargetSymbol);
|
|
678 | 679 |
foreach (var item in startConnectorVertices) |
679 | 680 |
ReleaseCOMObjects(item.Key); |
680 | 681 |
|
681 | 682 |
} |
682 | 683 |
// Branch 끝 Connector |
683 |
if (_LMConnectorEnd != null)
|
|
684 |
if (_EndConnector != null)
|
|
684 | 685 |
{ |
685 |
LMConnector startTargetConnector = null;
|
|
686 |
LMSymbol startTargetSymbol = null;
|
|
686 |
LMConnector _StartTargetConnector = null;
|
|
687 |
LMSymbol _StartTargetSymbol = null;
|
|
687 | 688 |
// Branch 반대편이 Line |
688 | 689 |
foreach (var item in connectorVertices) |
689 | 690 |
{ |
690 |
if (item.Key == _LMConnectorEnd)
|
|
691 |
if (item.Key == _EndConnector)
|
|
691 | 692 |
continue; |
692 | 693 |
|
693 |
if (item.Key.ConnectItem1SymbolID == _LMConnectorEnd.ConnectItem1SymbolID || |
|
694 |
item.Key.ConnectItem2SymbolID == _LMConnectorEnd.ConnectItem1SymbolID) |
|
694 |
if (item.Key.ConnectItem2SymbolID == _EndConnector.ConnectItem1SymbolID) |
|
695 | 695 |
{ |
696 |
startTargetConnector = item.Key;
|
|
696 |
_StartTargetConnector = item.Key;
|
|
697 | 697 |
break; |
698 | 698 |
} |
699 | 699 |
} |
700 | 700 |
// Branch 반대편이 Symbol |
701 |
if (startTargetConnector == null)
|
|
701 |
if (_StartTargetConnector == null)
|
|
702 | 702 |
{ |
703 | 703 |
foreach (var line in lines) |
704 | 704 |
{ |
... | ... | |
707 | 707 |
Symbol symbol = SPPIDUtil.FindObjectByUID(document, connector.CONNECTEDITEM) as Symbol; |
708 | 708 |
if (symbol != null) |
709 | 709 |
{ |
710 |
startTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
|
|
710 |
_StartTargetSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
|
|
711 | 711 |
break; |
712 | 712 |
} |
713 | 713 |
} |
714 | 714 |
} |
715 | 715 |
} |
716 | 716 |
|
717 |
_placement.PIDRemovePlacement(_LMConnectorEnd.AsLMRepresentation());
|
|
717 |
_placement.PIDRemovePlacement(_EndConnector.AsLMRepresentation());
|
|
718 | 718 |
|
719 | 719 |
Dictionary<LMConnector, List<double[]>> startConnectorVertices = GetPipeRunVertices(branch.Item3.SPPID.ModelItemId); |
720 |
LMConnector endTargetConnector = FindTargetLMConnector(startConnectorVertices,
|
|
720 |
LMConnector _EndTargetConnector = FindTargetLMConnector(startConnectorVertices,
|
|
721 | 721 |
endPoints[endPoints.Count - 1][0], |
722 | 722 |
endPoints[endPoints.Count - 1][1], |
723 | 723 |
endPoints[endPoints.Count - 2][0], |
... | ... | |
728 | 728 |
double[] point = endPoints[i]; |
729 | 729 |
if (i == 0) |
730 | 730 |
{ |
731 |
if (startTargetConnector != null)
|
|
732 |
placeRunInputs.AddConnectorTarget(startTargetConnector, point[0], point[1]);
|
|
733 |
else if (startTargetSymbol != null)
|
|
734 |
placeRunInputs.AddSymbolTarget(startTargetSymbol, point[0], point[1]);
|
|
731 |
if (_StartTargetConnector != null)
|
|
732 |
placeRunInputs.AddConnectorTarget(_StartTargetConnector, point[0], point[1]);
|
|
733 |
else if (_StartTargetSymbol != null)
|
|
734 |
placeRunInputs.AddSymbolTarget(_StartTargetSymbol, point[0], point[1]);
|
|
735 | 735 |
else |
736 | 736 |
placeRunInputs.AddPoint(point[0], point[1]); |
737 | 737 |
} |
738 | 738 |
else if (i == endPoints.Count - 1) |
739 | 739 |
{ |
740 |
placeRunInputs.AddConnectorTarget(endTargetConnector, point[0], point[1]);
|
|
740 |
placeRunInputs.AddConnectorTarget(_EndTargetConnector, point[0], point[1]);
|
|
741 | 741 |
} |
742 | 742 |
else |
743 | 743 |
placeRunInputs.AddPoint(point[0], point[1]); |
... | ... | |
746 | 746 |
LMConnector _LMConnector = _placement.PIDPlaceRun(_LMAItem, placeRunInputs); |
747 | 747 |
if (_LMConnector != null) |
748 | 748 |
{ |
749 |
if (startTargetConnector != null)
|
|
749 |
if (_StartTargetConnector != null)
|
|
750 | 750 |
{ |
751 |
JoinPipeRun(_LMConnector.ModelItemID, startTargetConnector.ModelItemID);
|
|
751 |
JoinPipeRun(_LMConnector.ModelItemID, _StartTargetConnector.ModelItemID);
|
|
752 | 752 |
} |
753 | 753 |
else |
754 | 754 |
{ |
... | ... | |
760 | 760 |
ReleaseCOMObjects(_LMConnector); |
761 | 761 |
} |
762 | 762 |
|
763 |
if (startTargetConnector != null)
|
|
764 |
ReleaseCOMObjects(startTargetConnector);
|
|
765 |
if (startTargetSymbol != null)
|
|
766 |
ReleaseCOMObjects(startTargetSymbol);
|
|
763 |
if (_StartTargetConnector != null)
|
|
764 |
ReleaseCOMObjects(_StartTargetConnector);
|
|
765 |
if (_StartTargetSymbol != null)
|
|
766 |
ReleaseCOMObjects(_StartTargetSymbol);
|
|
767 | 767 |
foreach (var item in startConnectorVertices) |
768 | 768 |
ReleaseCOMObjects(item.Key); |
769 | 769 |
} |
... | ... | |
773 | 773 |
} |
774 | 774 |
#endregion |
775 | 775 |
|
776 |
if (_LMConnectorStart != null)
|
|
777 |
ReleaseCOMObjects(_LMConnectorStart);
|
|
778 |
if (_LMConnectorEnd != null)
|
|
779 |
ReleaseCOMObjects(_LMConnectorEnd);
|
|
776 |
if (_StartConnector != null)
|
|
777 |
ReleaseCOMObjects(_StartConnector);
|
|
778 |
if (_EndConnector != null)
|
|
779 |
ReleaseCOMObjects(_EndConnector);
|
|
780 | 780 |
foreach (var item in connectorVertices) |
781 | 781 |
ReleaseCOMObjects(item.Key); |
782 | 782 |
|
DTI_PID/SPPIDConverter/ConverterForm.cs | ||
---|---|---|
515 | 515 |
private void btnRun_Click(object sender, EventArgs e) |
516 | 516 |
{ |
517 | 517 |
#if DEBUG |
518 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
|
|
519 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml"); |
|
518 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml"); |
|
519 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml");
|
|
520 | 520 |
document.SymbolMappings = symbolMappings; |
521 | 521 |
document.LineMappings = lineMappings; |
522 | 522 |
document.LineNumberMappings = lineNumberMappings; |
내보내기 Unified diff