개정판 bc639f0b
Fix: ID2 Line도 외부 앱에서 볼 수 있도록 수정
Compare에서 AutoCAD의 Original Color를 유지하는 기능 추가
Change-Id: If67b64e42812f9143228f0f171a10d7c28a68d28
DTI_PID/DTI_PID/Shapes/EngineeringLineItem.py | ||
---|---|---|
2262 | 2262 |
deleteAction.triggered.connect(self.contextDelete) |
2263 | 2263 |
menu.addAction(deleteAction) |
2264 | 2264 |
|
2265 |
ShowOnOtherAppAction = QAction('Show on other App', None) |
|
2266 |
ShowOnOtherAppAction.triggered.connect(self.contextShowOnOtherApp) |
|
2267 |
menu.addAction(ShowOnOtherAppAction) |
|
2268 |
|
|
2265 | 2269 |
menu.exec_(event.screenPos()) |
2266 | 2270 |
|
2267 | 2271 |
def contextIntersection(self): |
... | ... | |
2371 | 2375 |
event = QKeyEvent(QEvent.KeyPress, Qt.Key_Delete, Qt.NoModifier) |
2372 | 2376 |
self.scene().keyPressEvent(event) |
2373 | 2377 |
|
2378 |
def contextShowOnOtherApp(self): |
|
2379 |
from TcpServer import TcpSocket |
|
2380 |
from AppDocData import AppDocData |
|
2381 |
|
|
2382 |
app_doc_data = AppDocData.instance() |
|
2383 |
configs = app_doc_data.getConfigs('app', 'conn port') |
|
2384 |
port = 3030 |
|
2385 |
if configs and 1 == len(configs): |
|
2386 |
port = int(configs[0].value) |
|
2387 |
tcpserver = TcpSocket(port) |
|
2388 |
|
|
2389 |
origin_x = (self.start_point()[0] + self.end_point()[0]) * 0.5 |
|
2390 |
origin_y = (self.start_point()[1] + self.end_point()[1]) * 0.5 |
|
2391 |
min_x = min(self.start_point()[0], self.end_point()[0]) |
|
2392 |
min_y = min(self.start_point()[1], self.end_point()[1]) |
|
2393 |
max_x = max(self.start_point()[0], self.end_point()[0]) |
|
2394 |
max_y = max(self.start_point()[1], self.end_point()[1]) |
|
2395 |
size_x = max_x - min_x |
|
2396 |
if not size_x: size_x = 1 |
|
2397 |
size_y = max_y - min_y |
|
2398 |
if not size_y: size_y = 1 |
|
2399 |
tcpserver.sendMessage(f"{str(self.uid)},{origin_x},{origin_y},{size_x},{size_y}," |
|
2400 |
f"{app_doc_data.imgName}") |
|
2401 |
|
|
2374 | 2402 |
def contextArrow(self): |
2375 | 2403 |
event = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier) |
2376 | 2404 |
self.scene().keyPressEvent(event) |
ID2.Manager/ID2.Manager.Compare/Controls/Verification.Designer.cs | ||
---|---|---|
163 | 163 |
this.radToggleSwitchCasesensitive = new Telerik.WinControls.UI.RadToggleSwitch(); |
164 | 164 |
this.splitPanel5 = new Telerik.WinControls.UI.SplitPanel(); |
165 | 165 |
this.splitPanel3 = new Telerik.WinControls.UI.SplitPanel(); |
166 |
this.radToggleSwitchOriginalColor = new Telerik.WinControls.UI.RadToggleSwitch(); |
|
167 |
this.radLabel7 = new Telerik.WinControls.UI.RadLabel(); |
|
166 | 168 |
this.designCompare = new Xtractor.Viewer.MyModel(this.components); |
167 | 169 |
((System.ComponentModel.ISupportInitialize)(this.radSplitContainer1)).BeginInit(); |
168 | 170 |
this.radSplitContainer1.SuspendLayout(); |
... | ... | |
219 | 221 |
((System.ComponentModel.ISupportInitialize)(this.radToggleSwitchCasesensitive)).BeginInit(); |
220 | 222 |
((System.ComponentModel.ISupportInitialize)(this.splitPanel5)).BeginInit(); |
221 | 223 |
((System.ComponentModel.ISupportInitialize)(this.splitPanel3)).BeginInit(); |
224 |
((System.ComponentModel.ISupportInitialize)(this.radToggleSwitchOriginalColor)).BeginInit(); |
|
225 |
((System.ComponentModel.ISupportInitialize)(this.radLabel7)).BeginInit(); |
|
222 | 226 |
((System.ComponentModel.ISupportInitialize)(this.designCompare)).BeginInit(); |
223 | 227 |
this.SuspendLayout(); |
224 | 228 |
// |
... | ... | |
398 | 402 |
// |
399 | 403 |
// tableLayoutPanel2 |
400 | 404 |
// |
401 |
this.tableLayoutPanel2.ColumnCount = 1;
|
|
405 |
this.tableLayoutPanel2.ColumnCount = 3;
|
|
402 | 406 |
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); |
407 |
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); |
|
408 |
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F)); |
|
403 | 409 |
this.tableLayoutPanel2.Controls.Add(this.designAutoCAD, 0, 1); |
404 | 410 |
this.tableLayoutPanel2.Controls.Add(this.radLabelAutoCAD, 0, 0); |
411 |
this.tableLayoutPanel2.Controls.Add(this.radToggleSwitchOriginalColor, 2, 0); |
|
412 |
this.tableLayoutPanel2.Controls.Add(this.radLabel7, 1, 0); |
|
405 | 413 |
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; |
406 | 414 |
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); |
407 | 415 |
this.tableLayoutPanel2.Name = "tableLayoutPanel2"; |
... | ... | |
416 | 424 |
this.designAutoCAD.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
417 | 425 |
| System.Windows.Forms.AnchorStyles.Left) |
418 | 426 |
| System.Windows.Forms.AnchorStyles.Right))); |
427 |
this.tableLayoutPanel2.SetColumnSpan(this.designAutoCAD, 3); |
|
419 | 428 |
this.designAutoCAD.Cursor = System.Windows.Forms.Cursors.Default; |
420 | 429 |
this.designAutoCAD.Location = new System.Drawing.Point(3, 33); |
421 | 430 |
this.designAutoCAD.Name = "designAutoCAD"; |
... | ... | |
774 | 783 |
this.splitPanel3.TabIndex = 0; |
775 | 784 |
this.splitPanel3.TabStop = false; |
776 | 785 |
// |
786 |
// radToggleSwitchOriginalColor |
|
787 |
// |
|
788 |
this.radToggleSwitchOriginalColor.Dock = System.Windows.Forms.DockStyle.Fill; |
|
789 |
this.radToggleSwitchOriginalColor.Location = new System.Drawing.Point(615, 3); |
|
790 |
this.radToggleSwitchOriginalColor.Name = "radToggleSwitchOriginalColor"; |
|
791 |
this.radToggleSwitchOriginalColor.Size = new System.Drawing.Size(44, 24); |
|
792 |
this.radToggleSwitchOriginalColor.TabIndex = 2; |
|
793 |
this.radToggleSwitchOriginalColor.Value = false; |
|
794 |
// |
|
795 |
// radLabel7 |
|
796 |
// |
|
797 |
this.radLabel7.Anchor = System.Windows.Forms.AnchorStyles.Right; |
|
798 |
this.radLabel7.Location = new System.Drawing.Point(525, 6); |
|
799 |
this.radLabel7.Name = "radLabel7"; |
|
800 |
this.radLabel7.Size = new System.Drawing.Size(84, 18); |
|
801 |
this.radLabel7.TabIndex = 3; |
|
802 |
this.radLabel7.Text = "Original Color : "; |
|
803 |
// |
|
777 | 804 |
// designCompare |
778 | 805 |
// |
779 | 806 |
this.designCompare.Cursor = System.Windows.Forms.Cursors.Default; |
... | ... | |
854 | 881 |
((System.ComponentModel.ISupportInitialize)(this.radToggleSwitchCasesensitive)).EndInit(); |
855 | 882 |
((System.ComponentModel.ISupportInitialize)(this.splitPanel5)).EndInit(); |
856 | 883 |
((System.ComponentModel.ISupportInitialize)(this.splitPanel3)).EndInit(); |
884 |
((System.ComponentModel.ISupportInitialize)(this.radToggleSwitchOriginalColor)).EndInit(); |
|
885 |
((System.ComponentModel.ISupportInitialize)(this.radLabel7)).EndInit(); |
|
857 | 886 |
((System.ComponentModel.ISupportInitialize)(this.designCompare)).EndInit(); |
858 | 887 |
this.ResumeLayout(false); |
859 | 888 |
|
... | ... | |
904 | 933 |
private Telerik.WinControls.UI.RadLabel radLabel2; |
905 | 934 |
private Telerik.WinControls.UI.RadToggleSwitch radToggleSwitchCasesensitive; |
906 | 935 |
private Xtractor.Viewer.MyModel designCompare; |
936 |
private Telerik.WinControls.UI.RadToggleSwitch radToggleSwitchOriginalColor; |
|
937 |
private Telerik.WinControls.UI.RadLabel radLabel7; |
|
907 | 938 |
} |
908 | 939 |
} |
ID2.Manager/ID2.Manager.Compare/Controls/Verification.cs | ||
---|---|---|
2 | 2 |
using devDept.Eyeshot.Entities; |
3 | 3 |
using devDept.Eyeshot.Translators; |
4 | 4 |
using devDept.Geometry.Entities; |
5 |
using ID2.Manager.Classes; |
|
5 | 6 |
using System; |
6 | 7 |
using System.Collections.Generic; |
7 | 8 |
using System.ComponentModel; |
... | ... | |
48 | 49 |
private static double Tolerance = 0; |
49 | 50 |
private static double LengthToleranceRatio { get; set; } = 0.1; |
50 | 51 |
private static bool Casesensitive { get; set; } = false; |
52 |
|
|
53 |
private static bool OriginalColor{ get; set; } = false; |
|
51 | 54 |
#endregion |
52 | 55 |
|
53 | 56 |
private RadProgressBarElement _progressBar = null; |
... | ... | |
84 | 87 |
this.radCheckedDropDownListAVEVA.ItemCheckedChanged += RadCheckedDropDownListAVEVA_ItemCheckedChanged; |
85 | 88 |
this.radCheckBoxRevCloud.CheckStateChanged += RadCheckBoxRevCloud_CheckStateChanged; |
86 | 89 |
this.radToggleSwitchCasesensitive.ValueChanged += RadToggleSwitchCasesensitive_ValueChanged; |
90 |
this.radToggleSwitchOriginalColor.ValueChanged += RadToggleSwitchOriginalColor_ValueChanged; |
|
87 | 91 |
|
88 | 92 |
_progressBar = progressBar; |
89 | 93 |
|
... | ... | |
110 | 114 |
#endregion |
111 | 115 |
} |
112 | 116 |
|
117 |
private void RadToggleSwitchOriginalColor_ValueChanged(object sender, EventArgs e) |
|
118 |
{ |
|
119 |
bool value = this.radToggleSwitchOriginalColor.Value; |
|
120 |
Verification.OriginalColor = value; |
|
121 |
Classes.ID2Helper.IniWriteValue(IniFilePath, "Verification", "AutoCAD Original Color", value.ToString()); |
|
122 |
} |
|
123 |
|
|
113 | 124 |
private void RadToggleSwitchCasesensitive_ValueChanged(object sender, EventArgs e) |
114 | 125 |
{ |
115 | 126 |
bool value = this.radToggleSwitchCasesensitive.Value; |
... | ... | |
294 | 305 |
Verification.Tolerance = toler; |
295 | 306 |
} |
296 | 307 |
|
308 |
/// <summary> |
|
309 |
/// 환경 설정 파일을 읽는다. |
|
310 |
/// </summary> |
|
311 |
/// <param name="sender"></param> |
|
312 |
/// <param name="e"></param> |
|
297 | 313 |
private void Verification_Load(object sender, EventArgs e) |
298 | 314 |
{ |
299 | 315 |
string Toler = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "Tolerance"); |
... | ... | |
408 | 424 |
Casesensitive = Convert.ToBoolean(_Casesensitive); |
409 | 425 |
} |
410 | 426 |
|
427 |
string _OriginalColor = Classes.ID2Helper.IniReadValue(IniFilePath, "Verification", "AutoCAD Original Color"); |
|
428 |
if (!string.IsNullOrEmpty(_OriginalColor)) |
|
429 |
{ |
|
430 |
OriginalColor = Convert.ToBoolean(OriginalColor); |
|
431 |
} |
|
432 |
|
|
411 | 433 |
#region Except Layer를 로딩한다. |
412 | 434 |
LoadLayerSettings(); |
413 | 435 |
#endregion |
... | ... | |
579 | 601 |
} |
580 | 602 |
|
581 | 603 |
/// <summary> |
604 |
/// 주어진 엔터티의 색상을 리턴한다. |
|
605 |
/// </summary> |
|
606 |
/// <param name="layers"></param> |
|
607 |
/// <param name="ent"></param> |
|
608 |
/// <returns></returns> |
|
609 |
private Color GetEntColor(LayerKeyedCollection layers, Entity ent) |
|
610 |
{ |
|
611 |
Color res; |
|
612 |
|
|
613 |
if(ent.ColorMethod == colorMethodType.byLayer) |
|
614 |
{ |
|
615 |
var layer = layers.Find(x => x.Name.Equals(ent.LayerName)); |
|
616 |
res = layer.Color; |
|
617 |
} |
|
618 |
else |
|
619 |
{ |
|
620 |
res = ent.Color; |
|
621 |
} |
|
622 |
|
|
623 |
return res; |
|
624 |
} |
|
625 |
|
|
626 |
/// <summary> |
|
582 | 627 |
/// 블럭 참조를 깨어 블럭의 구성 요소들을 리트스트 리턴한다. |
583 | 628 |
/// </summary> |
584 | 629 |
/// <param name="design"></param> |
... | ... | |
586 | 631 |
/// <param name="LayerName"></param> |
587 | 632 |
/// <param name="color"></param> |
588 | 633 |
/// <returns></returns> |
589 |
private List<Entity> ExplodeBlockReference(BlockKeyedCollection Blocks, BlockReference blkref, string LayerName, Color color) |
|
634 |
private List<Entity> ExplodeBlockReference(BlockKeyedCollection Blocks, BlockReference blkref, LayerKeyedCollection Layers, string LayerName, Color color)
|
|
590 | 635 |
{ |
591 | 636 |
var res = new List<Entity>(); |
592 | 637 |
|
... | ... | |
595 | 640 |
var entities = blkref.Explode(Blocks); |
596 | 641 |
entities.ToList().ForEach(y => |
597 | 642 |
{ |
598 |
#region 블럭 이름이 ARROW로 시작되는 경우 Hatch로 화살표를 그려준다. |
|
599 |
if (y is LinearPath arrow && arrow.Vertices.Length == 2 && blkref.BlockName.StartsWith("ARROW")) |
|
643 |
#region 블럭 이름이 ARROW로 시작되는 경우 Hatch로 화살표를 그려준다.
|
|
644 |
if (y is LinearPath arrow && arrow.Vertices.Length == 2 && blkref.BlockName.StartsWith("ARROW"))
|
|
600 | 645 |
{ |
601 | 646 |
double weight = arrow.LineWeight * blkref.GetScaleFactorY(); |
602 | 647 |
var dir = new devDept.Geometry.Vector3D(arrow.Vertices[0], arrow.Vertices[1]); |
... | ... | |
604 | 649 |
var cross = devDept.Geometry.Vector3D.Cross(devDept.Geometry.Vector3D.AxisZ, dir); |
605 | 650 |
var pts = new devDept.Geometry.Point3D[] |
606 | 651 |
{ |
607 |
arrow.Vertices[1] + cross * weight * 0.5, |
|
608 |
arrow.Vertices[0], |
|
609 |
arrow.Vertices[1] - cross * weight * 0.5 |
|
652 |
arrow.Vertices[1] + cross * weight * 0.5,
|
|
653 |
arrow.Vertices[0],
|
|
654 |
arrow.Vertices[1] - cross * weight * 0.5
|
|
610 | 655 |
}; |
611 | 656 |
|
612 | 657 |
var hatch = new Hatch("SOLID", new List<ICurve>() { new LinearPath(pts) }); |
613 | 658 |
res.Add(hatch); |
614 | 659 |
} |
615 |
#endregion |
|
616 |
else if (y is LinearPath lp) |
|
660 |
#endregion
|
|
661 |
else if (y is LinearPath lp)
|
|
617 | 662 |
{ |
618 | 663 |
int count = Convert.ToInt32(lp.Vertices.Length); |
619 | 664 |
for (int i = 0; i < count - 1; ++i) |
... | ... | |
623 | 668 |
LayerName = lp.LayerName, |
624 | 669 |
LineWeight = lp.LineWeight, |
625 | 670 |
LineTypeMethod = colorMethodType.byEntity, |
626 |
Color = lp.Color,
|
|
671 |
Color = color != Color.Empty ? color : GetEntColor(Layers, blkref),
|
|
627 | 672 |
ColorMethod = colorMethodType.byEntity |
628 | 673 |
}; |
629 | 674 |
res.Add(line); |
630 | 675 |
} |
631 | 676 |
} |
632 |
/// PORT, ARROW로 시작하는 블럭은 제외 |
|
633 |
else if (y is BlockReference subblkref && subblkref.BlockName != "PORT") |
|
677 |
/// PORT, ARROW로 시작하는 블럭은 제외 |
|
678 |
else if (y is BlockReference subblkref && subblkref.BlockName != "PORT") |
|
679 |
{ |
|
680 |
res.AddRange(ExplodeBlockReference(Blocks, subblkref, Layers, LayerName, color)); |
|
681 |
} |
|
682 |
else |
|
634 | 683 |
{ |
635 |
res.AddRange(ExplodeBlockReference(Blocks, subblkref, LayerName, color)); |
|
684 |
y.Color = color != Color.Empty ? color : GetEntColor(Layers, blkref); |
|
685 |
y.ColorMethod = colorMethodType.byEntity; |
|
636 | 686 |
} |
637 | 687 |
}); |
638 | 688 |
|
... | ... | |
647 | 697 |
} |
648 | 698 |
#endregion |
649 | 699 |
txt.LayerName = LayerName; |
650 |
txt.Color = color; |
|
700 |
txt.Color = color != Color.Empty ? color : GetEntColor(Layers, txt);
|
|
651 | 701 |
txt.ColorMethod = colorMethodType.byEntity; |
652 |
KeyValuePair<string, AttributeReference>? kp = attributes.FirstOrDefault(z => z.Key == txt.Tag);
|
|
702 |
KeyValuePair<string, AttributeReference>? kp = attributes.Find(z => z.Key == txt.Tag);
|
|
653 | 703 |
if (kp.HasValue) |
654 | 704 |
{ |
655 | 705 |
///attributes.RemoveAll(x => x.Key == txt.Tag); |
... | ... | |
688 | 738 |
foreach (var ent in res) ent.LayerName = LayerName; |
689 | 739 |
|
690 | 740 |
blkref.Attributes.Clear(); |
691 |
///blkref.UpdateBoundingBox(new TraversalParams(design)); |
|
692 | 741 |
} |
693 | 742 |
catch(Exception ex) |
694 | 743 |
{ |
... | ... | |
699 | 748 |
} |
700 | 749 |
|
701 | 750 |
/// AutoCAD P&ID 파일을 화면에 표시한다. |
702 |
private void ShowAutoCADFile(string FilePath, Design design, bool clear = true) |
|
751 |
private void ShowAutoCADFile(string FilePath, Design design, bool OriginalColor, bool clear = true)
|
|
703 | 752 |
{ |
704 | 753 |
if (clear) design.Clear(); |
705 | 754 |
var AddEntities = new List<Entity>(); |
... | ... | |
726 | 775 |
|
727 | 776 |
if (ent is BlockReference blkref) |
728 | 777 |
{ |
729 |
AddEntities.AddRange(ExplodeBlockReference(ra.Blocks, blkref, Verification.AutoCADLayer, Verification.AutoCADColor)); |
|
778 |
AddEntities.AddRange(ExplodeBlockReference(ra.Blocks, blkref, ra.Layers, Verification.AutoCADLayer |
|
779 |
, !OriginalColor ? Verification.AutoCADColor : Color.Empty)); |
|
730 | 780 |
} |
731 | 781 |
} |
732 | 782 |
ra.AddToScene(design); |
... | ... | |
856 | 906 |
#region 레이어 변경 |
857 | 907 |
foreach (var ent in design.Entities) |
858 | 908 |
{ |
859 |
ent.Color = Verification.AutoCADColor; |
|
909 |
if (!OriginalColor) ent.Color = Verification.AutoCADColor; |
|
910 |
else ent.Color = GetEntColor(design.Layers, ent); |
|
860 | 911 |
ent.ColorMethod = colorMethodType.byEntity; |
912 |
|
|
861 | 913 |
if (!Forms.ExceptLayer.ExceptLayers.Exists(x => x.Name.ToUpper() == ent.LayerName.ToUpper())) |
862 | 914 |
{ |
863 | 915 |
ent.LayerName = Verification.AutoCADLayer; |
... | ... | |
877 | 929 |
design.Entities.RemoveAll(x => x is Line line && line.Length() < 0.001); |
878 | 930 |
#endregion |
879 | 931 |
|
880 |
ColorEntities(design, design.Entities, Verification.AutoCADColor); |
|
932 |
if(!OriginalColor) ColorEntities(design, design.Entities, Verification.AutoCADColor);
|
|
881 | 933 |
|
882 | 934 |
// Sets the view as Top |
883 | 935 |
design.SetView(viewType.Top); |
... | ... | |
970 | 1022 |
{ |
971 | 1023 |
if (blkref.BlockName != "LBRK" && blkref.BlockName != "PSNODE" && blkref.BlockName != "PENODE") |
972 | 1024 |
{ |
973 |
AddEntities.AddRange(ExplodeBlockReference(ra.Blocks, blkref, Verification.AVEVALayer, Verification.AVEVAColor)); |
|
1025 |
AddEntities.AddRange(ExplodeBlockReference(ra.Blocks, blkref, ra.Layers, Verification.AVEVALayer, Verification.AVEVAColor));
|
|
974 | 1026 |
} |
975 | 1027 |
} |
976 | 1028 |
|
... | ... | |
997 | 1049 |
{ |
998 | 1050 |
if (x is BlockReference blkref) |
999 | 1051 |
{ |
1000 |
AddEntities.AddRange(ExplodeBlockReference(design.Blocks, blkref, Verification.AVEVALayer, Verification.AVEVAColor)); |
|
1052 |
AddEntities.AddRange(ExplodeBlockReference(design.Blocks, blkref, design.Layers, Verification.AVEVALayer, Verification.AVEVAColor));
|
|
1001 | 1053 |
} |
1002 | 1054 |
}); |
1003 | 1055 |
design.Entities.RemoveAll(x => |
... | ... | |
1027 | 1079 |
string dwgExtension = ".dwg"; |
1028 | 1080 |
string ID2DrawingFolder = Program.AutoCADFolder; |
1029 | 1081 |
string dwgFilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}{dwgExtension}"); |
1030 |
if (!ResultOnly) ShowAutoCADFile(dwgFilePath, this.designAutoCAD); |
|
1031 |
ShowAutoCADFile(dwgFilePath, this.designCompare); |
|
1082 |
if (!ResultOnly) ShowAutoCADFile(dwgFilePath, this.designAutoCAD, OriginalColor);
|
|
1083 |
ShowAutoCADFile(dwgFilePath, this.designCompare, false);
|
|
1032 | 1084 |
|
1033 | 1085 |
string AVEVAPIDFolder = Program.AVEVAPIDFolder; |
1034 | 1086 |
string AVEVAPIDFilePath = string.Empty; |
... | ... | |
1123 | 1175 |
#endregion |
1124 | 1176 |
} |
1125 | 1177 |
|
1178 |
public Entity CreateRectEntity(double x, double y, double size_x, double size_y) |
|
1179 |
{ |
|
1180 |
try |
|
1181 |
{ |
|
1182 |
devDept.Eyeshot.Entities.Region profile = devDept.Eyeshot.Entities.Region.CreatePolygon(new devDept.Geometry.Point2D[] |
|
1183 |
{ |
|
1184 |
new devDept.Geometry.Point2D(x, y), |
|
1185 |
new devDept.Geometry.Point2D(x + size_x, y), |
|
1186 |
new devDept.Geometry.Point2D(x + size_x, y + size_y), |
|
1187 |
new devDept.Geometry.Point2D(x, y + size_y) |
|
1188 |
}); |
|
1189 |
|
|
1190 |
profile.ColorMethod = colorMethodType.byEntity; |
|
1191 |
profile.Color = Color.FromArgb(50, Color.Red); |
|
1192 |
|
|
1193 |
return profile; |
|
1194 |
} |
|
1195 |
catch (Exception ex) |
|
1196 |
{ |
|
1197 |
ex = ex; |
|
1198 |
} |
|
1199 |
|
|
1200 |
return null; |
|
1201 |
} |
|
1202 |
|
|
1126 | 1203 |
/// <summary> |
1127 | 1204 |
/// ID2에서 넘어온 영역을 Zoom한다. |
1128 | 1205 |
/// </summary> |
... | ... | |
1135 | 1212 |
this.Invoke(new Action(() => |
1136 | 1213 |
{ |
1137 | 1214 |
var ID2DefaultSize = new Size(9600, 6787); |
1215 |
double OffsetX = 47, OffsetY = 36; |
|
1138 | 1216 |
double margin = 5; |
1139 | 1217 |
|
1140 |
if (!dwgFilePath.Equals(this.designCompare.Tag)) ShowAutoCADFile(dwgFilePath, this.designCompare); |
|
1218 |
if (!dwgFilePath.Equals(this.designCompare.Tag)) ShowAutoCADFile(dwgFilePath, this.designCompare, false);
|
|
1141 | 1219 |
|
1142 |
double ScaleX = this.designCompare.Entities.BoxSize.X / ID2DefaultSize.Width; |
|
1143 |
double ScaleY = this.designCompare.Entities.BoxSize.Y / ID2DefaultSize.Height; |
|
1220 |
double ScaleX = this.designCompare.Entities.BoxSize.X / (ID2DefaultSize.Width - OffsetX * 2); |
|
1221 |
double ScaleY = this.designCompare.Entities.BoxSize.Y / (ID2DefaultSize.Height - OffsetY * 2); |
|
1222 |
x -= OffsetX; |
|
1223 |
y -= OffsetY; |
|
1144 | 1224 |
x *= ScaleX; |
1145 | 1225 |
y *= ScaleY; |
1146 | 1226 |
y = this.designCompare.Entities.BoxSize.Y - y; |
... | ... | |
1151 | 1231 |
var ItemRect = new OrientedBoundingRect(new devDept.Geometry.Point2D(x, y), sizex, sizey); |
1152 | 1232 |
|
1153 | 1233 |
CustomZoomFit(this.designCompare, |
1154 |
new devDept.Geometry.Point3D(x - sizex * margin, y - sizey * margin),
|
|
1155 |
new devDept.Geometry.Point3D(x + sizex * margin * 2, y + sizey * margin * 2));
|
|
1234 |
new devDept.Geometry.Point3D(x - margin, y - margin),
|
|
1235 |
new devDept.Geometry.Point3D(x + (sizex + margin * 2), y + (sizey + margin * 2)));
|
|
1156 | 1236 |
this.designCompare.Entities.ClearSelection(); |
1157 | 1237 |
this.designCompare.Entities.ForEach(param => |
1158 | 1238 |
{ |
1159 | 1239 |
var obr = new OrientedBoundingRect(param.BoxMin, param.BoxSize.X, param.BoxSize.Y); |
1160 | 1240 |
if(OrientedBoundingRect.DoOverlap(ItemRect, obr)) param.Selected = true; |
1161 | 1241 |
}); |
1242 |
|
|
1243 |
#if false |
|
1244 |
var rect = CreateRectEntity(x, y, sizex, sizey); |
|
1245 |
if(rect != null) this.designCompare.Entities.Add(rect); |
|
1246 |
#endif |
|
1247 |
|
|
1162 | 1248 |
this.designCompare.Invalidate(); |
1163 | 1249 |
})); |
1164 | 1250 |
} |
내보내기 Unified diff