개정판 fc5ed14c
issue #0000 compar기능을 client에서 하도록 수정
Change-Id: I5654925814de0f9fbace8b8f0a224f878dc4f258
KCOM/Common/ViewerDataModel.cs | ||
---|---|---|
1275 | 1275 |
} |
1276 | 1276 |
} |
1277 | 1277 |
|
1278 |
private int _SyncPageCount { get; set; } |
|
1279 |
|
|
1280 |
/// <summary> |
|
1281 |
/// Sync Page No |
|
1282 |
/// </summary> |
|
1283 |
public int SyncPageCount |
|
1284 |
{ |
|
1285 |
get |
|
1286 |
{ |
|
1287 |
return _SyncPageCount; |
|
1288 |
} |
|
1289 |
set |
|
1290 |
{ |
|
1291 |
if (_SyncPageCount != value) |
|
1292 |
{ |
|
1293 |
_SyncPageCount = value; |
|
1294 |
OnPropertyChanged("SyncPageCount"); |
|
1295 |
} |
|
1296 |
} |
|
1297 |
} |
|
1298 |
|
|
1278 | 1299 |
public double AngleOffsetX |
1279 | 1300 |
{ |
1280 | 1301 |
get |
KCOM/Controls/Sample.xaml.cs | ||
---|---|---|
321 | 321 |
{ |
322 | 322 |
var number = selectItem.PageNumber; |
323 | 323 |
|
324 |
if (ViewerDataModel.Instance.SyncPageNumber != number)
|
|
324 |
if (CurrentPage?.PageNumber != number)
|
|
325 | 325 |
{ |
326 | 326 |
/* |
327 | 327 |
#region 페이지 전환 시 Markup 데이터를 업데이트 |
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
743 | 743 |
|
744 | 744 |
#endregion 페이지가 벗어난 경우 |
745 | 745 |
|
746 |
|
|
747 |
if (pageNavigator.PageCount < BalancePoint) |
|
748 |
{ |
|
749 |
BalancePoint = pageNavigator.PageCount; |
|
750 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
|
751 |
} |
|
752 |
|
|
753 |
if (ViewerDataModel.Instance.SyncPageCount < BalancePoint) |
|
754 |
{ |
|
755 |
BalancePoint = ViewerDataModel.Instance.SyncPageCount; |
|
756 |
} |
|
757 |
|
|
746 | 758 |
ViewerDataModel.Instance.SyncPageNumber = BalancePoint; |
747 | 759 |
|
748 | 760 |
var pageWidth = Convert.ToDouble(currentPage.PAGE_WIDTH); |
... | ... | |
811 | 823 |
else |
812 | 824 |
{ |
813 | 825 |
Logger.sendCheckLog("Compare Image Download", 1); |
814 |
string compareImageUri = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint); |
|
815 |
ComparePageLoad(compareImageUri,false);
|
|
826 |
|
|
827 |
ComparePageLoad(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber, false);
|
|
816 | 828 |
} |
817 |
|
|
818 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
|
819 | 829 |
} |
820 | 830 |
|
821 | 831 |
SearchFocusBorder.Visibility = Visibility.Collapsed; |
... | ... | |
823 | 833 |
this.pageNavigator.ChangePage(changePageNumber); |
824 | 834 |
} |
825 | 835 |
|
826 |
private void ComparePageLoad(string pageUri, bool IsOriginalSize)
|
|
836 |
private void ComparePageLoad(string documentID,int PageNo, bool IsOriginalSize)
|
|
827 | 837 |
{ |
838 |
if (PageNo > ViewerDataModel.Instance.SyncPageCount) |
|
839 |
{ |
|
840 |
return; |
|
841 |
} |
|
842 |
|
|
843 |
tlSyncPageNum.Text = String.Format($"Current Page : {ViewerDataModel.Instance.SyncPageNumber}/{ViewerDataModel.Instance.SyncPageCount}"); |
|
844 |
|
|
845 |
string pageUri = this.GetImageURL(documentID, ViewerDataModel.Instance.SyncPageNumber); |
|
846 |
|
|
828 | 847 |
/// 현재 보고 있는 VP와 같은 크기로 로딩 |
829 | 848 |
ViewerDataModel.Instance.ImageViewPath_C = null; |
830 | 849 |
|
... | ... | |
5172 | 5191 |
ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
5173 | 5192 |
} |
5174 | 5193 |
|
5175 |
if (ViewerDataModel.Instance.SyncPageNumber == pageNavigator.PageCount && balancePoint > 0) |
|
5176 |
{ |
|
5177 |
} |
|
5178 |
else if ((ViewerDataModel.Instance.SyncPageNumber + balancePoint) >= 1) |
|
5194 |
if ((ViewerDataModel.Instance.SyncPageNumber + balancePoint) >= 1 |
|
5195 |
&& ViewerDataModel.Instance.SyncPageNumber + balancePoint <= ViewerDataModel.Instance.SyncPageCount) |
|
5179 | 5196 |
{ |
5180 | 5197 |
ViewerDataModel.Instance.SyncPageNumber += balancePoint; |
5181 | 5198 |
} |
... | ... | |
5212 | 5229 |
} |
5213 | 5230 |
else |
5214 | 5231 |
{ |
5215 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber); |
|
5216 |
|
|
5217 | 5232 |
var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber); |
5218 |
ComparePageLoad(uri, isOriginalSize); |
|
5233 |
|
|
5234 |
ComparePageLoad(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber, isOriginalSize); |
|
5219 | 5235 |
} |
5220 | 5236 |
|
5221 | 5237 |
//강인구 추가(페이지 이동시 코멘트 재 호출) |
... | ... | |
5232 | 5248 |
} |
5233 | 5249 |
} |
5234 | 5250 |
|
5235 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.SyncPageNumber); |
|
5236 | 5251 |
} |
5237 | 5252 |
} |
5238 | 5253 |
} |
... | ... | |
5344 | 5359 |
else |
5345 | 5360 |
{ |
5346 | 5361 |
IsSyncPDFMode = false; |
5347 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
|
5348 |
|
|
5349 |
ComparePageLoad(uri,false); |
|
5362 |
ComparePageLoad(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber, false); |
|
5350 | 5363 |
|
5351 | 5364 |
zoomAndPanControl2.ApplyTemplate(); |
5352 | 5365 |
zoomAndPanControl2.UpdateLayout(); |
... | ... | |
5454 | 5467 |
canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
5455 | 5468 |
} |
5456 | 5469 |
|
5457 |
private void btnSync_Click(object sender, RoutedEventArgs e) |
|
5470 |
private async void btnSync_Click(object sender, RoutedEventArgs e)
|
|
5458 | 5471 |
{ |
5459 | 5472 |
gridViewHistory_Busy.IsBusy = true; |
5460 | 5473 |
|
... | ... | |
5462 | 5475 |
if (instance.CommandParameter != null) |
5463 | 5476 |
{ |
5464 | 5477 |
CurrentRev = instance.CommandParameter as VPRevision; |
5478 |
|
|
5479 |
var pageinfo = await BaseTaskClient.GetDocInfoAsync(new KCOM_BasicParam {projectNo = _ViewInfo.ProjectNO,documentID = CurrentRev.DOCUMENT_ID }); |
|
5480 |
|
|
5481 |
if (pageinfo != null) |
|
5482 |
{ |
|
5483 |
ViewerDataModel.Instance.SyncPageCount = pageinfo.PAGE_COUNT; |
|
5484 |
} |
|
5485 |
else |
|
5486 |
{ |
|
5487 |
ViewerDataModel.Instance.SyncPageCount = -1; |
|
5488 |
} |
|
5489 |
|
|
5465 | 5490 |
System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null; |
5466 | 5491 |
|
5467 | 5492 |
GetSyncMarkupInfoItemshandler = (sen, ea) => |
... | ... | |
5486 | 5511 |
} |
5487 | 5512 |
gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
5488 | 5513 |
|
5489 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
|
5490 |
ComparePageLoad(uri,false); |
|
5514 |
ComparePageLoad(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber, false); |
|
5491 | 5515 |
|
5492 | 5516 |
Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
5493 | 5517 |
|
... | ... | |
5505 | 5529 |
ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
5506 | 5530 |
|
5507 | 5531 |
tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
5508 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
|
5509 | 5532 |
|
5510 | 5533 |
zoomAndPanControl.ScaleToFit(); |
5511 | 5534 |
zoomAndPanControl2.ScaleToFit(); |
... | ... | |
5534 | 5557 |
|
5535 | 5558 |
private void OriginalSizeMode_Click(object sender,RoutedEventArgs e) |
5536 | 5559 |
{ |
5537 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber); |
|
5538 | 5560 |
var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber); |
5539 | 5561 |
|
5540 | 5562 |
canvas_compareBorder.Visibility = Visibility.Hidden; |
5541 | 5563 |
ClearCompareRect(); |
5542 | 5564 |
|
5543 |
ComparePageLoad(uri, OriginalSizeMode.IsChecked);
|
|
5565 |
ComparePageLoad(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber, OriginalSizeMode.IsChecked);
|
|
5544 | 5566 |
} |
5545 | 5567 |
|
5546 | 5568 |
private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e) |
... | ... | |
5592 | 5614 |
} |
5593 | 5615 |
gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
5594 | 5616 |
|
5595 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
|
5596 |
|
|
5597 | 5617 |
Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
5598 | 5618 |
|
5599 |
ComparePageLoad(uri,false);
|
|
5619 |
ComparePageLoad(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber, false);
|
|
5600 | 5620 |
|
5601 | 5621 |
zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
5602 | 5622 |
zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
... | ... | |
5611 | 5631 |
//} |
5612 | 5632 |
|
5613 | 5633 |
tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
5614 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
|
5634 |
|
|
5615 | 5635 |
gridViewHistory_Busy.IsBusy = false; |
5616 | 5636 |
} |
5617 | 5637 |
//Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
Markus.ImageComparer/ImageCompareBase.cs | ||
---|---|---|
19 | 19 |
{ |
20 | 20 |
public class ImageCompareBase : IDisposable |
21 | 21 |
{ |
22 |
Mat OriginalImageData = null; |
|
23 |
Mat TargatImageData = null; |
|
24 |
|
|
25 | 22 |
double contoursLongCount = 0; |
26 | 23 |
int ComparisonCount = 0; |
27 | 24 |
public CompareProgress Progress = new CompareProgress(); |
... | ... | |
54 | 51 |
|
55 | 52 |
// 원본이미지의 크키와 Format24bppRgb로 타켓 이미지를 변경 |
56 | 53 |
// 크기가 틀린 경우 비교시 바이트배열 오류 발생 |
57 |
OriginalImageData = OpenCvSharp.Extensions.BitmapConverter.ToMat(Originalbitmap); |
|
58 |
TargatImageData = OpenCvSharp.Extensions.BitmapConverter.ToMat(TargatBitmap); |
|
59 |
|
|
60 |
if (OriginalImageData.Size() != TargatImageData.Size()) |
|
54 |
using (Mat OriginalImageData = OpenCvSharp.Extensions.BitmapConverter.ToMat(Originalbitmap)) |
|
61 | 55 |
{ |
62 |
Cv2.Resize(TargatImageData, TargatImageData, OriginalImageData.Size()); |
|
56 |
using (Mat TargatImageData = OpenCvSharp.Extensions.BitmapConverter.ToMat(TargatBitmap)) |
|
57 |
{ |
|
58 |
if (OriginalImageData.Size() != TargatImageData.Size()) |
|
59 |
{ |
|
60 |
Cv2.Resize(TargatImageData, TargatImageData, OriginalImageData.Size()); |
|
61 |
} |
|
62 |
|
|
63 |
Cv2.CvtColor(OriginalImageData, OriginalImageData, ColorConversionCodes.BGR2GRAY); |
|
64 |
Cv2.CvtColor(TargatImageData, TargatImageData, ColorConversionCodes.BGR2GRAY); |
|
65 |
|
|
66 |
using (Mat outputData = new Mat(new OpenCvSharp.Size(resultSize.Width, resultSize.Height), MatType.CV_8UC1)) |
|
67 |
{ |
|
68 |
Cv2.Absdiff(OriginalImageData, TargatImageData, outputData); |
|
69 |
// 틀린부분을 반환 |
|
70 |
Cv2.BitwiseNot(outputData, result); |
|
71 |
} |
|
72 |
} |
|
63 | 73 |
} |
64 |
|
|
65 |
Cv2.CvtColor(OriginalImageData, OriginalImageData, ColorConversionCodes.BGR2GRAY); |
|
66 |
Cv2.CvtColor(TargatImageData, TargatImageData, ColorConversionCodes.BGR2GRAY); |
|
67 |
|
|
68 |
Mat outputData = new Mat(new OpenCvSharp.Size(resultSize.Width, resultSize.Height), MatType.CV_8UC1); |
|
69 |
|
|
70 |
Cv2.Absdiff(OriginalImageData, TargatImageData, outputData); |
|
71 |
|
|
72 |
// 틀린부분을 반환 |
|
73 |
Cv2.BitwiseNot(outputData, result); |
|
74 | 74 |
} |
75 | 75 |
catch (Exception ex) |
76 | 76 |
{ |
... | ... | |
102 | 102 |
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); |
103 | 103 |
stopwatch.Start(); |
104 | 104 |
|
105 |
Mat outputMat = new Mat(data.Size(), MatType.CV_8UC1); |
|
105 |
//Mat outputMat = new Mat(data.Size(), MatType.CV_8UC1);
|
|
106 | 106 |
|
107 | 107 |
HierarchyIndex[] hierarchy; |
108 | 108 |
OpenCvSharp.Point[][] contours; |
... | ... | |
120 | 120 |
// .Select(points => GetRectList(points, block)) |
121 | 121 |
// .SelectMany(x => x); |
122 | 122 |
|
123 |
var rects = contours.AsParallel() |
|
124 |
.SelectMany(points => GetRectList(points, block)); |
|
123 |
var rects = contours.SelectMany(points => GetRectList(points, block)); |
|
125 | 124 |
|
126 | 125 |
results.AddRange(rects); |
127 | 126 |
|
128 | 127 |
return results; |
129 | 128 |
} |
130 | 129 |
|
131 |
private List<System.Windows.Rect> GetRectList(OpenCvSharp.Point[] points, Size block) |
|
130 |
private List<System.Windows.Rect> GetRectListAsParallel(OpenCvSharp.Point[] points, Size block)
|
|
132 | 131 |
{ |
133 | 132 |
List<System.Windows.Rect> result = new List<System.Windows.Rect>(); |
134 | 133 |
ConcurrentBag<System.Windows.Rect> rectBag = new ConcurrentBag<System.Windows.Rect>(); |
135 | 134 |
|
136 | 135 |
Parallel.For(0, points.Length, i => |
137 | 136 |
{ |
137 |
if (i >= points.Length) return; // 배열 길이 확인 |
|
138 |
|
|
138 | 139 |
var rect = new System.Windows.Rect |
139 | 140 |
{ |
140 | 141 |
X = points[i].X - block.Width / 2, |
... | ... | |
183 | 184 |
} |
184 | 185 |
|
185 | 186 |
|
186 |
private List<System.Windows.Rect> GetRectList2(OpenCvSharp.Point[] points,Size block)
|
|
187 |
private List<System.Windows.Rect> GetRectList(OpenCvSharp.Point[] points,Size block) |
|
187 | 188 |
{ |
188 | 189 |
List<System.Windows.Rect> result = new List<System.Windows.Rect>(); |
189 | 190 |
|
... | ... | |
294 | 295 |
// 이 코드를 변경하지 마세요. 위의 Dispose(bool disposing)에 정리 코드를 입력하세요. |
295 | 296 |
Dispose(true); |
296 | 297 |
|
297 |
|
|
298 |
if (OriginalImageData != null) |
|
299 |
{ |
|
300 |
OriginalImageData.Dispose(); |
|
301 |
} |
|
302 |
|
|
303 |
if (TargatImageData != null) |
|
304 |
{ |
|
305 |
TargatImageData.Dispose(); |
|
306 |
} |
|
307 |
|
|
308 | 298 |
// TODO: 위의 종료자가 재정의된 경우 다음 코드 줄의 주석 처리를 제거합니다. |
309 | 299 |
// GC.SuppressFinalize(this); |
310 | 300 |
GC.Collect(); |
내보내기 Unified diff