개정판 c73426a9
issue #926 이미지생성오류(imagecontrol, 외부이미지붙여넣기, symbol)
Change-Id: I5376bab4a5bff122eee8e0f38aa49b0e64d18c0b
KCOM/Events/Event_KeyEvent.cs | ||
---|---|---|
330 | 330 |
//외부 이미지 붙여넣기 |
331 | 331 |
else if (Clipboard.GetImage() != null) |
332 | 332 |
{ |
333 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
334 |
|
|
335 |
//강인구 Undo/Redo 보류 |
|
336 |
UndoData = new Undo_data() |
|
333 |
try |
|
337 | 334 |
{ |
338 |
IsUndo = false, |
|
339 |
Event = Event_Type.Create, |
|
340 |
EventTime = DateTime.Now, |
|
341 |
Markup_List = new List<Multi_Undo_data>() |
|
342 |
}; |
|
335 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
343 | 336 |
|
344 |
string temppath = System.IO.Path.GetTempPath(); |
|
345 |
//string filename = KCOM.Events.Save.shortCommentKey(); |
|
346 |
string filename = KCOM.Events.Save.shortFileKey(); |
|
347 |
|
|
348 |
System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
349 |
clipboardImage.Save(temppath + "\\" + filename); |
|
350 |
|
|
351 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
|
352 |
String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
|
353 |
long numByte = fileInfo.Length; |
|
354 |
double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
|
355 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
|
337 |
//강인구 Undo/Redo 보류 |
|
338 |
UndoData = new Undo_data() |
|
339 |
{ |
|
340 |
IsUndo = false, |
|
341 |
Event = Event_Type.Create, |
|
342 |
EventTime = DateTime.Now, |
|
343 |
Markup_List = new List<Multi_Undo_data>() |
|
344 |
}; |
|
345 |
|
|
346 |
string temppath = System.IO.Path.GetTempPath(); |
|
347 |
//string filename = KCOM.Events.Save.shortCommentKey(); |
|
348 |
string filename = KCOM.Events.Save.shortFileKey(); |
|
349 |
|
|
350 |
System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
351 |
clipboardImage.Save(temppath + "\\" + filename); |
|
352 |
|
|
353 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
|
354 |
String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
|
355 |
long numByte = fileInfo.Length; |
|
356 |
double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
|
357 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
|
358 |
|
|
359 |
if (dLen < 4) |
|
360 |
{ |
|
361 |
System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
|
362 |
System.IO.FileMode.Open, System.IO.FileAccess.Read); |
|
363 |
System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
|
364 |
byte[] data = br.ReadBytes((int)numByte); |
|
356 | 365 |
|
357 |
if (dLen < 4) |
|
358 |
{ |
|
359 |
System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
|
360 |
System.IO.FileMode.Open, System.IO.FileAccess.Read); |
|
361 |
System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
|
362 |
byte[] data = br.ReadBytes((int)numByte); |
|
363 |
|
|
364 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
|
365 |
br.Close(); |
|
366 |
fStream.Close(); |
|
367 |
fStream.Dispose(); |
|
368 |
} |
|
369 |
else |
|
370 |
{ |
|
371 |
dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
|
372 |
return; |
|
373 |
} |
|
366 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
|
374 | 367 |
|
375 |
fileInfo.Delete();
|
|
368 |
Check_Uri.UriCheck(filename);
|
|
376 | 369 |
|
377 |
//System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
378 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
|
379 |
IntPtr hBitmap = bmp.GetHbitmap(); |
|
380 |
System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
|
381 |
Image img = new Image(); |
|
382 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
|
383 |
if (filename.Contains(".svg")) |
|
384 |
{ |
|
385 |
byte[] imageData = null; |
|
386 |
DrawingImage image = null; |
|
387 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
|
370 |
br.Close(); |
|
371 |
fStream.Close(); |
|
372 |
fStream.Dispose(); |
|
373 |
} |
|
374 |
else |
|
388 | 375 |
{ |
389 |
imageData = web.DownloadData(new Uri(filename)); |
|
390 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
|
391 |
image = SvgReader.Load(stream); |
|
376 |
dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
|
377 |
return; |
|
392 | 378 |
} |
393 |
img.Source = image; |
|
394 |
} |
|
395 |
else |
|
396 |
{ |
|
397 |
img.Source = new BitmapImage(new Uri(filename)); |
|
398 |
} |
|
399 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
|
400 |
{ |
|
401 |
PointSet = new List<Point>(), |
|
402 |
//FilePath = img.Source.ToString(), |
|
403 |
FilePath = filename, |
|
404 |
ImageData = img.Source, |
|
405 |
StartPoint = new Point(100, 100), |
|
406 |
EndPoint = new Point(200, 200), |
|
407 |
TopRightPoint = new Point(100, 200), |
|
408 |
LeftBottomPoint = new Point(200, 100) |
|
409 |
}; |
|
410 | 379 |
|
411 |
currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
|
412 |
currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
|
413 |
currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
|
380 |
fileInfo.Delete(); |
|
414 | 381 |
|
415 |
currentControl.PointSet = new List<Point> |
|
382 |
//System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
383 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
|
384 |
IntPtr hBitmap = bmp.GetHbitmap(); |
|
385 |
System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
|
386 |
Image img = new Image(); |
|
387 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
|
388 |
if (filename.Contains(".svg")) |
|
389 |
{ |
|
390 |
byte[] imageData = null; |
|
391 |
DrawingImage image = null; |
|
392 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
|
393 |
{ |
|
394 |
imageData = web.DownloadData(new Uri(filename)); |
|
395 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
|
396 |
image = SvgReader.Load(stream); |
|
397 |
} |
|
398 |
img.Source = image; |
|
399 |
} |
|
400 |
else |
|
401 |
{ |
|
402 |
img.Source = new BitmapImage(new Uri(filename)); |
|
403 |
} |
|
404 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
|
405 |
{ |
|
406 |
PointSet = new List<Point>(), |
|
407 |
//FilePath = img.Source.ToString(), |
|
408 |
FilePath = filename, |
|
409 |
ImageData = img.Source, |
|
410 |
StartPoint = new Point(100, 100), |
|
411 |
EndPoint = new Point(200, 200), |
|
412 |
TopRightPoint = new Point(100, 200), |
|
413 |
LeftBottomPoint = new Point(200, 100) |
|
414 |
}; |
|
415 |
|
|
416 |
currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
|
417 |
currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
|
418 |
currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
|
419 |
|
|
420 |
currentControl.PointSet = new List<Point> |
|
416 | 421 |
{ |
417 | 422 |
currentControl.StartPoint, |
418 | 423 |
currentControl.LeftBottomPoint, |
... | ... | |
420 | 425 |
currentControl.TopRightPoint, |
421 | 426 |
}; |
422 | 427 |
|
423 |
multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
424 |
UndoData.Markup_List.Add(multi_Undo_Data); |
|
425 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
428 |
multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
429 |
UndoData.Markup_List.Add(multi_Undo_Data);
|
|
430 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData);
|
|
426 | 431 |
|
427 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
428 |
currentControl.CommentID = Events.Save.shortGuid(); |
|
432 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
433 |
currentControl.CommentID = Events.Save.shortGuid();
|
|
429 | 434 |
|
430 |
currentControl.ApplyTemplate(); |
|
431 |
currentControl.SetImage(); |
|
435 |
currentControl.ApplyTemplate();
|
|
436 |
currentControl.SetImage();
|
|
432 | 437 |
|
433 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
434 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
435 |
this.dzMainMenu.SelectLayer.Children.Add(final); |
|
438 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
439 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
440 |
this.dzMainMenu.SelectLayer.Children.Add(final);
|
|
436 | 441 |
|
437 |
double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
|
438 |
double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
|
439 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
|
440 |
|
|
441 |
#region 주석 |
|
442 |
double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
|
|
443 |
double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
|
|
444 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
|
|
445 |
|
|
446 |
#region 주석
|
|
442 | 447 |
|
443 |
//주석 |
|
444 |
//ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
445 |
//Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
446 |
//this.dzMainMenu.SelectLayer.Children.Add(final); |
|
448 |
//주석
|
|
449 |
//ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
450 |
//Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
451 |
//this.dzMainMenu.SelectLayer.Children.Add(final);
|
|
447 | 452 |
|
448 |
//string MarkupData = ""; |
|
453 |
//string MarkupData = "";
|
|
449 | 454 |
|
450 |
//if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl)) |
|
451 |
//{ |
|
452 |
// markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID); |
|
453 |
// MarkupData += "|OR|" + markupReturn.ConvertData; |
|
454 |
//} |
|
455 |
//Clipboard.SetText(MarkupData); |
|
456 |
//this.dzMainMenu.SelectLayer.Children.Clear(); |
|
455 |
//if (!ViewerDataModel.Instance.MarkupControls.Contains(currentControl))
|
|
456 |
//{
|
|
457 |
// markupReturn = layer.MarkupToString(currentControl, App.ViewInfo.UserID);
|
|
458 |
// MarkupData += "|OR|" + markupReturn.ConvertData;
|
|
459 |
//}
|
|
460 |
//Clipboard.SetText(MarkupData);
|
|
461 |
//this.dzMainMenu.SelectLayer.Children.Clear();
|
|
457 | 462 |
|
458 |
//List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
|
463 |
//List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
|
|
459 | 464 |
|
460 |
//string[] delimiterChars = { "|OR|" }; |
|
461 |
//string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
|
465 |
//string[] delimiterChars = { "|OR|" };
|
|
466 |
//string[] data1 = Clipboard.GetText().Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
|
|
462 | 467 |
|
463 |
//this.dzMainMenu.ReleaseAdorner(); |
|
468 |
//this.dzMainMenu.ReleaseAdorner();
|
|
464 | 469 |
|
465 |
//foreach (string parse in data1) |
|
466 |
//{ |
|
467 |
// if (parse != "") |
|
468 |
// { |
|
469 |
// System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
|
470 |
// (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
|
470 |
//foreach (string parse in data1)
|
|
471 |
//{
|
|
472 |
// if (parse != "")
|
|
473 |
// {
|
|
474 |
// System.Windows.Controls.Control item = layer.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER);
|
|
475 |
// (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid();
|
|
471 | 476 |
|
472 |
// ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
|
473 |
// ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
|
477 |
// ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo);
|
|
478 |
// ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo);
|
|
474 | 479 |
|
475 |
// adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
|
480 |
// adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo);
|
|
476 | 481 |
|
477 |
// //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo); |
|
478 |
// //this.dzMainMenu.SelectLayer.Children.Add(final); |
|
479 |
// } |
|
480 |
//} |
|
481 |
//Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
|
482 |
// //Controls.AdornerFinal final = new Controls.AdornerFinal(item as MarkupToPDF.Common.CommentUserInfo);
|
|
483 |
// //this.dzMainMenu.SelectLayer.Children.Add(final);
|
|
484 |
// }
|
|
485 |
//}
|
|
486 |
//Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
|
|
482 | 487 |
|
483 |
//double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
|
484 |
//double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
|
485 |
//final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
|
488 |
//double realPointX = this.dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
|
|
489 |
//double realPointY = this.dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
|
|
490 |
//final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
|
|
486 | 491 |
|
487 |
//if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
|
488 |
//{ |
|
489 |
// final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
|
490 |
//} |
|
492 |
//if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null)
|
|
493 |
//{
|
|
494 |
// final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy
|
|
495 |
//}
|
|
491 | 496 |
|
492 |
//this.dzMainMenu.SelectLayer.Children.Add(final); |
|
493 |
#endregion |
|
497 |
//this.dzMainMenu.SelectLayer.Children.Add(final);
|
|
498 |
#endregion
|
|
494 | 499 |
|
500 |
} |
|
501 |
catch(Exception ex) |
|
502 |
{ |
|
503 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.DialogMessage_Alert("" + ex, "Alert"); |
|
504 |
} |
|
495 | 505 |
} |
496 |
} |
|
497 |
|
|
506 |
} |
|
498 | 507 |
} |
499 | 508 |
break; |
500 | 509 |
#endregion |
내보내기 Unified diff