개정판 c73426a9
issue #926 이미지생성오류(imagecontrol, 외부이미지붙여넣기, symbol)
Change-Id: I5376bab4a5bff122eee8e0f38aa49b0e64d18c0b
KCOM/Events/Implementation/TopMenuEvent.cs | ||
---|---|---|
1749 | 1749 |
br.Close(); |
1750 | 1750 |
|
1751 | 1751 |
string filepath = fileUploader.Run(App.ViewInfo.ProjectNO, instanceMain.dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile, data); |
1752 |
Uri uri; |
|
1753 |
if (!(Uri.TryCreate(filepath, UriKind.Absolute, out uri) && uri.Scheme == Uri.UriSchemeHttp)) |
|
1754 |
{ |
|
1755 |
throw new Exception(); |
|
1756 |
} |
|
1752 |
|
|
1753 |
Check_Uri.UriCheck(filepath); |
|
1754 |
|
|
1757 | 1755 |
instanceMain.dzMainMenu.filename = filepath; |
1758 | 1756 |
|
1759 | 1757 |
fStream.Close(); |
... | ... | |
2869 | 2867 |
//외부 이미지 붙여넣기 |
2870 | 2868 |
else if (Clipboard.GetImage() != null) |
2871 | 2869 |
{ |
2872 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
2873 |
|
|
2874 |
//강인구 Undo/Redo 보류 |
|
2875 |
UndoData = new Undo_data() |
|
2870 |
try |
|
2876 | 2871 |
{ |
2877 |
IsUndo = false, |
|
2878 |
Event = Event_Type.Create, |
|
2879 |
EventTime = DateTime.Now, |
|
2880 |
Markup_List = new List<Multi_Undo_data>() |
|
2881 |
}; |
|
2872 |
Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
|
2882 | 2873 |
|
2874 |
//강인구 Undo/Redo 보류 |
|
2875 |
UndoData = new Undo_data() |
|
2876 |
{ |
|
2877 |
IsUndo = false, |
|
2878 |
Event = Event_Type.Create, |
|
2879 |
EventTime = DateTime.Now, |
|
2880 |
Markup_List = new List<Multi_Undo_data>() |
|
2881 |
}; |
|
2883 | 2882 |
|
2884 |
string temppath = System.IO.Path.GetTempPath(); |
|
2885 |
//string filename = KCOM.Events.Save.shortCommentKey(); |
|
2886 |
string filename = KCOM.Events.Save.shortFileKey(); |
|
2887 | 2883 |
|
2888 |
System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
2889 |
clipboardImage.Save(temppath + "\\" + filename); |
|
2884 |
string temppath = System.IO.Path.GetTempPath(); |
|
2885 |
//string filename = KCOM.Events.Save.shortCommentKey(); |
|
2886 |
string filename = KCOM.Events.Save.shortFileKey(); |
|
2890 | 2887 |
|
2891 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
|
2892 |
String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
|
2893 |
long numByte = fileInfo.Length; |
|
2894 |
double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
|
2895 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
|
2888 |
System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
2889 |
clipboardImage.Save(temppath + "\\" + filename); |
|
2896 | 2890 |
|
2897 |
if (dLen < 4) |
|
2898 |
{ |
|
2899 |
System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
|
2900 |
System.IO.FileMode.Open, System.IO.FileAccess.Read); |
|
2901 |
System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
|
2902 |
byte[] data = br.ReadBytes((int)numByte); |
|
2891 |
System.IO.FileInfo fileInfo = new System.IO.FileInfo(temppath + "\\" + filename); |
|
2892 |
String strFile = System.IO.Path.GetFileName(fileInfo.FullName); |
|
2893 |
long numByte = fileInfo.Length; |
|
2894 |
double dLen = Convert.ToDouble(fileInfo.Length / 1000000); |
|
2895 |
kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
|
2903 | 2896 |
|
2904 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
|
2905 |
br.Close(); |
|
2906 |
fStream.Close(); |
|
2907 |
fStream.Dispose(); |
|
2908 |
} |
|
2909 |
else |
|
2910 |
{ |
|
2911 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
|
2912 |
return; |
|
2913 |
} |
|
2897 |
if (dLen < 4) |
|
2898 |
{ |
|
2899 |
System.IO.FileStream fStream = new System.IO.FileStream(fileInfo.FullName, |
|
2900 |
System.IO.FileMode.Open, System.IO.FileAccess.Read); |
|
2901 |
System.IO.BinaryReader br = new System.IO.BinaryReader(fStream); |
|
2902 |
byte[] data = br.ReadBytes((int)numByte); |
|
2914 | 2903 |
|
2915 |
fileInfo.Delete(); |
|
2904 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, this.ParentOfType<MainWindow>().dzMainMenu._DocItem.DOCUMENT_NO, App.ViewInfo.UserID, strFile + ".png", data); |
|
2905 |
Check_Uri.UriCheck(filename); |
|
2906 |
br.Close(); |
|
2907 |
fStream.Close(); |
|
2908 |
fStream.Dispose(); |
|
2909 |
} |
|
2910 |
else |
|
2911 |
{ |
|
2912 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert("Available Memory less than 4 mega byte", "Alert"); |
|
2913 |
return; |
|
2914 |
} |
|
2916 | 2915 |
|
2917 |
//System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
2918 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
|
2919 |
IntPtr hBitmap = bmp.GetHbitmap(); |
|
2920 |
System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
|
2921 |
Image img = new Image(); |
|
2922 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
|
2923 |
if (filename.Contains(".svg")) |
|
2924 |
{ |
|
2925 |
byte[] imageData = null; |
|
2926 |
DrawingImage image = null; |
|
2927 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
|
2916 |
fileInfo.Delete(); |
|
2917 |
|
|
2918 |
//System.Drawing.Image clipboardImage = System.Windows.Forms.Clipboard.GetImage(); |
|
2919 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(clipboardImage); |
|
2920 |
IntPtr hBitmap = bmp.GetHbitmap(); |
|
2921 |
System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); |
|
2922 |
Image img = new Image(); |
|
2923 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(filename)); |
|
2924 |
if (filename.Contains(".svg")) |
|
2928 | 2925 |
{ |
2929 |
imageData = web.DownloadData(new Uri(filename)); |
|
2930 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
|
2931 |
image = SvgReader.Load(stream); |
|
2926 |
byte[] imageData = null; |
|
2927 |
DrawingImage image = null; |
|
2928 |
using (System.Net.WebClient web = new System.Net.WebClient()) |
|
2929 |
{ |
|
2930 |
imageData = web.DownloadData(new Uri(filename)); |
|
2931 |
System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
|
2932 |
image = SvgReader.Load(stream); |
|
2933 |
} |
|
2934 |
img.Source = image; |
|
2935 |
} |
|
2936 |
else |
|
2937 |
{ |
|
2938 |
img.Source = new BitmapImage(new Uri(filename)); |
|
2932 | 2939 |
} |
2933 |
img.Source = image; |
|
2934 |
} |
|
2935 |
else |
|
2936 |
{ |
|
2937 |
img.Source = new BitmapImage(new Uri(filename)); |
|
2938 |
} |
|
2939 | 2940 |
|
2940 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
|
2941 |
{ |
|
2942 |
PointSet = new List<Point>(), |
|
2943 |
//FilePath = img.Source.ToString(), |
|
2944 |
FilePath = filename, |
|
2945 |
ImageData = img.Source, |
|
2946 |
StartPoint = new Point(100, 100), |
|
2947 |
EndPoint = new Point(200, 200), |
|
2948 |
TopRightPoint = new Point(100, 200), |
|
2949 |
LeftBottomPoint = new Point(200, 100) |
|
2950 |
}; |
|
2941 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl
|
|
2942 |
{
|
|
2943 |
PointSet = new List<Point>(),
|
|
2944 |
//FilePath = img.Source.ToString(),
|
|
2945 |
FilePath = filename,
|
|
2946 |
ImageData = img.Source,
|
|
2947 |
StartPoint = new Point(100, 100),
|
|
2948 |
EndPoint = new Point(200, 200),
|
|
2949 |
TopRightPoint = new Point(100, 200),
|
|
2950 |
LeftBottomPoint = new Point(200, 100)
|
|
2951 |
};
|
|
2951 | 2952 |
|
2952 |
currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y); |
|
2953 |
currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height); |
|
2954 |
currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height); |
|
2953 |
currentControl.TopRightPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y);
|
|
2954 |
currentControl.LeftBottomPoint = new Point(currentControl.StartPoint.X, currentControl.StartPoint.Y + clipboardImage.Height);
|
|
2955 |
currentControl.EndPoint = new Point(currentControl.StartPoint.X + clipboardImage.Width, currentControl.StartPoint.Y + clipboardImage.Height);
|
|
2955 | 2956 |
|
2956 |
currentControl.PointSet = new List<Point> |
|
2957 |
currentControl.PointSet = new List<Point>
|
|
2957 | 2958 |
{ |
2958 | 2959 |
currentControl.StartPoint, |
2959 | 2960 |
currentControl.LeftBottomPoint, |
... | ... | |
2961 | 2962 |
currentControl.TopRightPoint, |
2962 | 2963 |
}; |
2963 | 2964 |
|
2964 |
multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
2965 |
UndoData.Markup_List.Add(multi_Undo_Data); |
|
2966 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
2967 |
|
|
2968 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
2969 |
currentControl.CommentID = Events.Save.shortGuid(); |
|
2965 |
multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
2966 |
UndoData.Markup_List.Add(multi_Undo_Data); |
|
2967 |
ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
|
2970 | 2968 |
|
2971 |
currentControl.ApplyTemplate();
|
|
2972 |
currentControl.SetImage();
|
|
2969 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
2970 |
currentControl.CommentID = Events.Save.shortGuid();
|
|
2973 | 2971 |
|
2974 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
2975 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
|
2976 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final); |
|
2972 |
currentControl.ApplyTemplate(); |
|
2973 |
currentControl.SetImage(); |
|
2977 | 2974 |
|
2978 |
double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2);
|
|
2979 |
double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2);
|
|
2980 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY));
|
|
2975 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
2976 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo);
|
|
2977 |
this.ParentOfType<MainWindow>().dzMainMenu.SelectLayer.Children.Add(final);
|
|
2981 | 2978 |
|
2979 |
double realPointX = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
|
2980 |
double realPointY = this.ParentOfType<MainWindow>().dzMainMenu.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
|
2981 |
final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
|
2982 |
} |
|
2983 |
catch(Exception ex) |
|
2984 |
{ |
|
2985 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("" + ex, "Alert"); |
|
2986 |
} |
|
2982 | 2987 |
} |
2983 | 2988 |
} |
2984 | 2989 |
|
내보내기 Unified diff