개정판 0c575433
issue #0000 compare 수정
Change-Id: I9b57c124b64674f7ae618978955093b399008da5
KCOM_API/ServiceDeepView.svc.cs | ||
---|---|---|
258 | 258 |
/// <param name="isInternalAddress"></param> |
259 | 259 |
/// <returns></returns> |
260 | 260 |
[OperationContract] |
261 |
public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress)
|
|
261 |
public List<Rect> GetCompareRectsTargetSize(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, bool IsResultTargatSize, string isInternalAddress)
|
|
262 | 262 |
{ |
263 | 263 |
List<Rect> result = new List<Rect>(); |
264 | 264 |
|
... | ... | |
267 | 267 |
|
268 | 268 |
try |
269 | 269 |
{ |
270 |
string sOriginFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToInt64(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID); |
|
271 |
string sTagetFolder = targetDocItem_ID.All(char.IsDigit) ? (Convert.ToInt64(targetDocItem_ID) / 100).ToString() : (targetDocItem_ID.Length >= 5 ? targetDocItem_ID.Substring(0, 5) : targetDocItem_ID); |
|
270 |
//string sOriginFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToInt64(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID);
|
|
271 |
//string sTagetFolder = targetDocItem_ID.All(char.IsDigit) ? (Convert.ToInt64(targetDocItem_ID) / 100).ToString() : (targetDocItem_ID.Length >= 5 ? targetDocItem_ID.Substring(0, 5) : targetDocItem_ID);
|
|
272 | 272 |
|
273 |
if (Boolean.Parse(isInternalAddress)) |
|
274 |
{ |
|
273 |
string sOriginFolder = GetSubPath(originDocItem_ID); |
|
274 |
string sTagetFolder = GetSubPath(targetDocItem_ID); |
|
275 |
|
|
276 |
//if (Boolean.Parse(isInternalAddress)) |
|
277 |
//{ |
|
275 | 278 |
originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sOriginFolder, originDocItem_ID, originPageNo); |
276 | 279 |
targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sTagetFolder, targetDocItem_ID, targetPageNo); |
280 |
//} |
|
281 |
//else |
|
282 |
//{ |
|
283 |
// originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
|
284 |
// targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
|
285 |
//} |
|
286 |
|
|
287 |
|
|
288 |
System.Drawing.Size? resultSize = null; |
|
289 |
|
|
290 |
string sCIConnString = ConfigurationManager.ConnectionStrings["CIConnectionString"].ConnectionString; |
|
291 |
using (CIEntities _ci = new CIEntities(sCIConnString)) |
|
292 |
{ |
|
293 |
string docItemID = originDocItem_ID; |
|
294 |
int pageNo = Convert.ToInt32(originPageNo); |
|
295 |
|
|
296 |
if (IsResultTargatSize) |
|
297 |
{ |
|
298 |
docItemID = targetDocItem_ID; |
|
299 |
pageNo = Convert.ToInt32(targetPageNo); |
|
300 |
} |
|
301 |
|
|
302 |
var doc = _ci.DOCINFO.Where(data => data.DOCUMENT_ID == docItemID).FirstOrDefault(); |
|
303 |
if (doc != null) |
|
304 |
{ |
|
305 |
var pages = doc.DOCPAGE.Where(page=>page.PAGE_NUMBER == pageNo); |
|
306 |
|
|
307 |
if(pages.Count() > 0) |
|
308 |
{ |
|
309 |
resultSize = new System.Drawing.Size(Convert.ToInt32(pages.First().PAGE_WIDTH), Convert.ToInt32(pages.First().PAGE_HEIGHT)); |
|
310 |
} |
|
311 |
} |
|
277 | 312 |
} |
278 |
else |
|
313 |
|
|
314 |
using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare()) |
|
279 | 315 |
{ |
280 |
originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
|
281 |
targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
|
316 |
if (resultSize != null) |
|
317 |
{ |
|
318 |
result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20),resultSize); |
|
319 |
} |
|
320 |
else |
|
321 |
{ |
|
322 |
result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20), IsResultTargatSize); |
|
323 |
} |
|
282 | 324 |
} |
325 |
} |
|
326 |
catch (Exception ex) |
|
327 |
{ |
|
328 |
System.Diagnostics.Trace.WriteLine("KCOM_API - GetCompareRect : " + ex.ToString()); |
|
329 |
throw new FaultException("system Error."); |
|
330 |
//throw new FaultException($"{originFile} {targetFile} " + ex.ToString() + " Inner Exception : " + ex.InnerException?.ToString()); |
|
331 |
} |
|
332 |
|
|
333 |
|
|
334 |
return result; |
|
335 |
} |
|
336 |
|
|
337 |
/// <summary> |
|
338 |
/// 두 페이지를 비교하여 결과를 리턴한다 |
|
339 |
/// </summary> |
|
340 |
/// <param name="projectNo"></param> |
|
341 |
/// <param name="originDocItem_ID"></param> |
|
342 |
/// <param name="targetDocItem_ID"></param> |
|
343 |
/// <param name="originPageNo"></param> |
|
344 |
/// <param name="targetPageNo"></param> |
|
345 |
/// <param name="isInternalAddress"></param> |
|
346 |
/// <returns></returns> |
|
347 |
[OperationContract] |
|
348 |
public List<Rect> GetCompareRect(string projectNo, string originDocItem_ID, string targetDocItem_ID, string originPageNo, string targetPageNo, string isInternalAddress) |
|
349 |
{ |
|
350 |
List<Rect> result = new List<Rect>(); |
|
351 |
|
|
352 |
string originFile = ""; |
|
353 |
string targetFile = ""; |
|
354 |
|
|
355 |
try |
|
356 |
{ |
|
357 |
//string sOriginFolder = originDocItem_ID.All(char.IsDigit) ? (Convert.ToInt64(originDocItem_ID) / 100).ToString() : (originDocItem_ID.Length >= 5 ? originDocItem_ID.Substring(0, 5) : originDocItem_ID); |
|
358 |
//string sTagetFolder = targetDocItem_ID.All(char.IsDigit) ? (Convert.ToInt64(targetDocItem_ID) / 100).ToString() : (targetDocItem_ID.Length >= 5 ? targetDocItem_ID.Substring(0, 5) : targetDocItem_ID); |
|
359 |
|
|
360 |
string sOriginFolder = GetSubPath(originDocItem_ID); |
|
361 |
string sTagetFolder = GetSubPath(targetDocItem_ID); |
|
362 |
|
|
363 |
//if (Boolean.Parse(isInternalAddress)) |
|
364 |
//{ |
|
365 |
originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sOriginFolder, originDocItem_ID, originPageNo); |
|
366 |
targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath, projectNo, sTagetFolder, targetDocItem_ID, targetPageNo); |
|
367 |
//} |
|
368 |
//else |
|
369 |
//{ |
|
370 |
// originFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, originDocItem_ID, originPageNo); |
|
371 |
// targetFile = String.Format(KCOM_API.Properties.Settings.Default.TileSoucePath_SUB, projectNo, targetDocItem_ID, targetPageNo); |
|
372 |
//} |
|
283 | 373 |
|
284 | 374 |
using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare()) |
285 | 375 |
{ |
286 |
result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20));
|
|
376 |
result = compareLib.CompareReturnRects(originFile, targetFile,new System.Drawing.Size(20, 20),false);
|
|
287 | 377 |
} |
288 | 378 |
} |
289 | 379 |
catch (Exception ex) |
... | ... | |
296 | 386 |
return result; |
297 | 387 |
} |
298 | 388 |
|
299 |
|
|
389 |
public string GetSubPath(string DocumentID) |
|
390 |
{ |
|
391 |
Int64 outValue = 0; |
|
392 |
if (Int64.TryParse(DocumentID, out outValue)) |
|
393 |
{ |
|
394 |
return (System.Convert.ToInt64(DocumentID) / 100).ToString(); |
|
395 |
} |
|
396 |
else |
|
397 |
{ |
|
398 |
return DocumentID.Substring(0, 5).ToString(); |
|
399 |
} |
|
400 |
} |
|
300 | 401 |
|
301 | 402 |
/// <summary> |
302 | 403 |
/// 두 페이지를 비교하여 결과를 리턴한다 |
... | ... | |
335 | 436 |
using (Markus.Image.ImageCompare compareLib = new Markus.Image.ImageCompare()) |
336 | 437 |
{ |
337 | 438 |
|
338 |
result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20)); |
|
439 |
result = compareLib.CompareReturnRects(originFile, targetFile, new System.Drawing.Size(20, 20),false);
|
|
339 | 440 |
} |
340 | 441 |
} |
341 | 442 |
catch (Exception ex) |
내보내기 Unified diff