91 |
91 |
int count = 0;
|
92 |
92 |
for (int i = 0; i < _Docs.Count - 1; ++i)
|
93 |
93 |
{
|
94 |
|
string FirstDocNo = _Docs.ElementAt(i).DocumentNo;
|
95 |
|
string FirstFilePath = _Docs.ElementAt(i).LocalDrawingFilePath;
|
96 |
|
if (!System.IO.File.Exists(FirstFilePath))
|
|
94 |
try
|
97 |
95 |
{
|
98 |
|
UpdateProgress(count++, sum, "Comparing....", worker);
|
99 |
|
continue;
|
100 |
|
}
|
101 |
|
|
102 |
|
#region 첫 번째 도면을 연다.
|
103 |
|
_FirstWorkspace.Invoke(new Action(() =>
|
104 |
|
{
|
105 |
|
_FirstWorkspace.Entities.Clear();
|
106 |
|
_FirstWorkspace.Blocks.Clear();
|
107 |
|
}));
|
108 |
|
|
109 |
|
OpenDrawing(_FirstWorkspace, FirstFilePath);
|
110 |
|
#endregion
|
111 |
|
var FirstEntities = IgnoreText ? _FirstWorkspace.Entities.Where(x => !(x is Text)).ToList() : _FirstWorkspace.Entities.ToList();
|
112 |
|
for (int j = i + 1; j < _Docs.Count; ++j)
|
113 |
|
{
|
114 |
|
if (Cancelled(worker, doWorkEventArgs)) break;
|
115 |
|
|
116 |
|
string SecondDocNo = _Docs.ElementAt(j).DocumentNo;
|
117 |
|
string SecondFilePath = _Docs.ElementAt(j).LocalDrawingFilePath;
|
118 |
|
if (!System.IO.File.Exists(SecondFilePath))
|
|
96 |
string FirstDocNo = _Docs[i].DocumentNo;
|
|
97 |
string FirstFilePath = _Docs[i].LocalDrawingFilePath;
|
|
98 |
if (!System.IO.File.Exists(FirstFilePath))
|
119 |
99 |
{
|
120 |
100 |
UpdateProgress(count++, sum, "Comparing....", worker);
|
121 |
101 |
continue;
|
122 |
102 |
}
|
123 |
103 |
|
124 |
|
#region 두 번째 도면을 연다.
|
125 |
|
_SecondWorkspace.Invoke(new Action(() =>
|
|
104 |
#region 첫 번째 도면을 연다.
|
|
105 |
_FirstWorkspace.Invoke(new Action(() =>
|
126 |
106 |
{
|
127 |
|
_SecondWorkspace.Entities.Clear();
|
128 |
|
_SecondWorkspace.Blocks.Clear();
|
|
107 |
_FirstWorkspace.Entities.Clear();
|
|
108 |
_FirstWorkspace.Blocks.Clear();
|
129 |
109 |
}));
|
130 |
|
OpenDrawing(_SecondWorkspace, SecondFilePath);
|
131 |
|
#endregion
|
132 |
110 |
|
133 |
|
var SecondEntities = IgnoreText ? _SecondWorkspace.Entities.Where(x => !(x is Text)).ToList() : _SecondWorkspace.Entities.ToList();
|
134 |
|
if (FirstEntities.Any() && SecondEntities.Any())
|
|
111 |
OpenDrawing(_FirstWorkspace, FirstFilePath);
|
|
112 |
#endregion
|
|
113 |
var FirstEntities = IgnoreText ? _FirstWorkspace.Entities.Where(x => !(x is Text)).ToList() : _FirstWorkspace.Entities.ToList();
|
|
114 |
for (int j = i + 1; j < _Docs.Count; ++j)
|
135 |
115 |
{
|
136 |
|
double simularity = 100 - CompareDrawing(_FirstWorkspace, _SecondWorkspace, FirstEntities, SecondEntities);
|
137 |
|
if (simularity >= Simularity)
|
|
116 |
if (Cancelled(worker, doWorkEventArgs)) break;
|
|
117 |
|
|
118 |
try
|
138 |
119 |
{
|
139 |
|
var group = DrawingGroupColl.FirstOrDefault(x => x.Drawings.Exists(y => y.Equals(FirstDocNo) || y.Equals(SecondDocNo)));
|
140 |
|
if (group != null)
|
|
120 |
string SecondDocNo = _Docs[j].DocumentNo;
|
|
121 |
string SecondFilePath = _Docs[j].LocalDrawingFilePath;
|
|
122 |
if (!System.IO.File.Exists(SecondFilePath))
|
141 |
123 |
{
|
142 |
|
if (!group.Drawings.Exists(x => x.Equals(FirstDocNo))) group.Drawings.Add(FirstDocNo);
|
143 |
|
if (!group.Drawings.Exists(x => x.Equals(SecondDocNo))) group.Drawings.Add(SecondDocNo);
|
|
124 |
UpdateProgress(count++, sum, "Comparing....", worker);
|
|
125 |
continue;
|
144 |
126 |
}
|
145 |
|
else
|
|
127 |
|
|
128 |
#region 두 번째 도면을 연다.
|
|
129 |
_SecondWorkspace.Invoke(new Action(() =>
|
|
130 |
{
|
|
131 |
_SecondWorkspace.Entities.Clear();
|
|
132 |
_SecondWorkspace.Blocks.Clear();
|
|
133 |
}));
|
|
134 |
OpenDrawing(_SecondWorkspace, SecondFilePath);
|
|
135 |
#endregion
|
|
136 |
|
|
137 |
var SecondEntities = IgnoreText ? _SecondWorkspace.Entities.Where(x => !(x is Text)).ToList() : _SecondWorkspace.Entities.ToList();
|
|
138 |
if (FirstEntities.Any() && SecondEntities.Any())
|
146 |
139 |
{
|
147 |
|
group = new ID2.Manager.Controls.Classify.DrawingGroup();
|
148 |
|
group.Drawings.Add(FirstDocNo);
|
149 |
|
group.Drawings.Add(SecondDocNo);
|
150 |
|
DrawingGroupColl.Add(group);
|
|
140 |
double simularity = 100 - CompareDrawing(_FirstWorkspace, _SecondWorkspace, FirstEntities, SecondEntities);
|
|
141 |
if (simularity >= Simularity)
|
|
142 |
{
|
|
143 |
var group = DrawingGroupColl.Find(x => x.Drawings.Exists(y => y.Equals(FirstDocNo) || y.Equals(SecondDocNo)));
|
|
144 |
if (group != null)
|
|
145 |
{
|
|
146 |
if (!group.Drawings.Exists(x => x.Equals(FirstDocNo))) group.Drawings.Add(FirstDocNo);
|
|
147 |
if (!group.Drawings.Exists(x => x.Equals(SecondDocNo))) group.Drawings.Add(SecondDocNo);
|
|
148 |
}
|
|
149 |
else
|
|
150 |
{
|
|
151 |
group = new ID2.Manager.Controls.Classify.DrawingGroup();
|
|
152 |
group.Drawings.Add(FirstDocNo);
|
|
153 |
group.Drawings.Add(SecondDocNo);
|
|
154 |
DrawingGroupColl.Add(group);
|
|
155 |
}
|
|
156 |
}
|
151 |
157 |
}
|
|
158 |
|
|
159 |
UpdateProgress(count++, sum, "Comparing....", worker);
|
|
160 |
}
|
|
161 |
catch(Exception ex)
|
|
162 |
{
|
|
163 |
this.AppendToLog($"{_Docs[i].DocumentNo} - {_Docs[j].DocumentNo} : {ex.Message}");
|
152 |
164 |
}
|
153 |
165 |
}
|
154 |
|
|
155 |
|
UpdateProgress(count++, sum, "Comparing....", worker);
|
|
166 |
if (Cancelled(worker, doWorkEventArgs)) break;
|
|
167 |
}
|
|
168 |
catch(Exception ex)
|
|
169 |
{
|
|
170 |
this.AppendToLog($"{_Docs[i].DocumentNo} : {ex.Message}");
|
156 |
171 |
}
|
157 |
|
if (Cancelled(worker, doWorkEventArgs)) break;
|
158 |
172 |
}
|
159 |
173 |
}
|
160 |
174 |
|
... | ... | |
796 |
810 |
{
|
797 |
811 |
group.Drawings.ForEach(x =>
|
798 |
812 |
{
|
799 |
|
var doc = _Docs.FirstOrDefault(y => y.DocumentNo.Equals(x));
|
|
813 |
var doc = _Docs.Find(y => y.DocumentNo.Equals(x));
|
800 |
814 |
if (doc != null)
|
801 |
815 |
{
|
802 |
816 |
if(_FieldName)
|
... | ... | |
807 |
821 |
});
|
808 |
822 |
}
|
809 |
823 |
|
810 |
|
RadMessageBox.Show("Evaluation of simularity is complete.");
|
|
824 |
if (!string.IsNullOrEmpty(this.Log))
|
|
825 |
{
|
|
826 |
RadMessageBox.Show("Evaluation of simularity has error(s).", "Caption", MessageBoxButtons.OK, RadMessageIcon.Info, this.Log);
|
|
827 |
}
|
|
828 |
else
|
|
829 |
{
|
|
830 |
RadMessageBox.Show("Evaluation of simularity is complete.");
|
|
831 |
}
|
811 |
832 |
}
|
812 |
833 |
catch (Exception ex)
|
813 |
834 |
{
|