markus / KCOM / Views / MainMenu.xaml.cs @ 943b7d05
이력 | 보기 | 이력해설 | 다운로드 (292 KB)
1 |
using IKCOM; |
---|---|
2 |
using KCOM.Common; |
3 |
using KCOM.Controls; |
4 |
using KCOM.Events; |
5 |
using KCOMDataModel.DataModel; |
6 |
using MarkupToPDF.Common; |
7 |
using MarkupToPDF.Controls.Cad; |
8 |
using MarkupToPDF.Controls.Common; |
9 |
using MarkupToPDF.Controls.Etc; |
10 |
using MarkupToPDF.Controls.Line; |
11 |
using MarkupToPDF.Controls.Parsing; |
12 |
using MarkupToPDF.Controls.Polygon; |
13 |
using MarkupToPDF.Controls.Shape; |
14 |
using MarkupToPDF.Controls.Text; |
15 |
using System; |
16 |
using System.Collections.Generic; |
17 |
using System.Diagnostics; |
18 |
using System.Linq; |
19 |
using System.Reflection; |
20 |
using System.Runtime.InteropServices; |
21 |
using System.Text; |
22 |
using System.Threading; |
23 |
using System.Threading.Tasks; |
24 |
using System.Web; |
25 |
using System.Windows; |
26 |
using System.Windows.Controls; |
27 |
using System.Windows.Ink; |
28 |
using System.Windows.Input; |
29 |
using System.Windows.Media; |
30 |
using System.Windows.Media.Imaging; |
31 |
using System.Windows.Shapes; |
32 |
using System.Windows.Threading; |
33 |
using Telerik.Windows.Controls; |
34 |
using Telerik.Windows.Controls.GridView; |
35 |
using Telerik.Windows.Data; |
36 |
//using static KCOM.TempFile; |
37 |
|
38 |
namespace KCOM.Views |
39 |
{ |
40 |
public static class ControlExtensions |
41 |
{ |
42 |
public static T Clone<T>(this T controlToClone) |
43 |
where T : System.Windows.Controls.Control |
44 |
{ |
45 |
System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); |
46 |
|
47 |
T instance = Activator.CreateInstance<T>(); |
48 |
|
49 |
foreach (PropertyInfo propInfo in controlProperties) |
50 |
{ |
51 |
if (propInfo.CanWrite) |
52 |
{ |
53 |
if (propInfo.Name != "WindowTarget") |
54 |
propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null); |
55 |
} |
56 |
} |
57 |
return instance; |
58 |
} |
59 |
} |
60 |
|
61 |
public class MyConsole |
62 |
{ |
63 |
private readonly System.Threading.ManualResetEvent _readLineSignal; |
64 |
private string _lastLine; |
65 |
|
66 |
public MyConsole() |
67 |
{ |
68 |
_readLineSignal = new System.Threading.ManualResetEvent(false); |
69 |
Gui = new TextBox(); |
70 |
Gui.AcceptsReturn = true; |
71 |
Gui.KeyUp += OnKeyUp; |
72 |
} |
73 |
|
74 |
private void OnKeyUp(object sender, KeyEventArgs e) |
75 |
{ |
76 |
// this is always fired on UI thread |
77 |
if (e.Key == Key.Enter) |
78 |
{ |
79 |
// quick and dirty, but that is not relevant to your question |
80 |
_lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last(); |
81 |
// now, when you detected that user typed a line, set signal |
82 |
_readLineSignal.Set(); |
83 |
} |
84 |
} |
85 |
|
86 |
public TextBox Gui { get; private set; } |
87 |
|
88 |
public string ReadLine() |
89 |
{ |
90 |
// that should always be called from non-ui thread |
91 |
if (Gui.Dispatcher.CheckAccess()) |
92 |
throw new Exception("Cannot be called on UI thread"); |
93 |
// reset signal |
94 |
_readLineSignal.Reset(); |
95 |
// wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that |
96 |
_readLineSignal.WaitOne(); |
97 |
// we got signalled - return line user typed. |
98 |
return _lastLine; |
99 |
} |
100 |
|
101 |
public void WriteLine(string line) |
102 |
{ |
103 |
if (!Gui.Dispatcher.CheckAccess()) |
104 |
{ |
105 |
Gui.Dispatcher.Invoke(new Action(() => WriteLine(line))); |
106 |
return; |
107 |
} |
108 |
|
109 |
Gui.Text += line + Environment.NewLine; |
110 |
} |
111 |
} |
112 |
|
113 |
/// <summary> |
114 |
/// MainMenu.xaml에 대한 상호 작용 논리 |
115 |
/// </summary> |
116 |
public partial class MainMenu : UserControl |
117 |
{ |
118 |
#region 프로퍼티 |
119 |
|
120 |
private BitmapFrame tempPageImage =null; |
121 |
|
122 |
public UndoDataGroup UndoDataGroup { get; set; } |
123 |
public CommentUserInfo previousControl { get; set; } |
124 |
public CommentUserInfo currentControl { get; set; } |
125 |
public ControlType controlType { get; set; } |
126 |
private Move move = new Move(); |
127 |
private double[] rotateValue = { 0, 90, 180, 270 }; |
128 |
public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None; |
129 |
private static readonly double DragThreshold = 5; |
130 |
private System.Windows.Input.Cursor cursor { get; set; } |
131 |
|
132 |
/// <summary> |
133 |
/// 문서의 마우스 위치 |
134 |
/// </summary> |
135 |
public Point CanvasDrawingMouseDownPoint; |
136 |
|
137 |
public string filename { get; set; } |
138 |
private Point canvasZoomPanningMouseDownPoint; |
139 |
public Point getCurrentPoint; |
140 |
private Point canvasZoommovingMouseDownPoint; |
141 |
private List<object> ControlList = new List<object>(); |
142 |
private ListBox listBox = new ListBox(); |
143 |
private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>(); |
144 |
private bool isDraggingSelectionRect = false; |
145 |
private DrawingAttributes inkDA = new DrawingAttributes(); |
146 |
private VPRevision CurrentRev { get; set; } |
147 |
public RadRibbonButton btnConsolidate { get; set; } |
148 |
public RadRibbonButton btnFinalPDF { get; set; } |
149 |
public RadRibbonButton btnTeamConsolidate { get; set; } |
150 |
public RadRibbonButton btnConsolidateFinalPDF { get; set; } |
151 |
|
152 |
public string Filename_ { get; set; } |
153 |
public double L_Size = 0; |
154 |
public AdornerFinal adorner_; |
155 |
public UndoData multi_UndoData; |
156 |
public string Symbol_ID = ""; |
157 |
|
158 |
/// <summary> |
159 |
/// Set to 'true' when the left mouse-button is down. |
160 |
/// </summary> |
161 |
public bool isLeftMouseButtonDownOnWindow = false; |
162 |
|
163 |
public InkPresenter _InkBoard = null; |
164 |
private Stroke stroke; |
165 |
private Boolean IsDrawing = false; |
166 |
private StylusPointCollection strokePoints; |
167 |
|
168 |
//StylusPointCollection erasePoints; |
169 |
private RenderTargetBitmap canvasImage; |
170 |
|
171 |
private Point Sync_Offset_Point; |
172 |
|
173 |
//강인구 테스트 |
174 |
private Path _SelectionPath { get; set; } |
175 |
|
176 |
public Path SelectionPath |
177 |
{ |
178 |
get |
179 |
{ |
180 |
return _SelectionPath; |
181 |
} |
182 |
set |
183 |
{ |
184 |
if (_SelectionPath != value) |
185 |
{ |
186 |
_SelectionPath = value; |
187 |
RaisePropertyChanged("SelectionPath"); |
188 |
} |
189 |
} |
190 |
} |
191 |
|
192 |
private System.Windows.Controls.Image _imageViewer { get; set; } |
193 |
|
194 |
public System.Windows.Controls.Image imageViewer |
195 |
{ |
196 |
get |
197 |
{ |
198 |
if (_imageViewer == null) |
199 |
{ |
200 |
_imageViewer = new System.Windows.Controls.Image(); |
201 |
return _imageViewer; |
202 |
} |
203 |
else |
204 |
{ |
205 |
return _imageViewer; |
206 |
} |
207 |
} |
208 |
set |
209 |
{ |
210 |
if (_imageViewer != value) |
211 |
{ |
212 |
_imageViewer = value; |
213 |
} |
214 |
} |
215 |
} |
216 |
|
217 |
public bool IsSyncPDFMode { get; set; } |
218 |
|
219 |
private System.Windows.Controls.Image _imageViewer_Compare { get; set; } |
220 |
|
221 |
public System.Windows.Controls.Image imageViewer_Compare |
222 |
{ |
223 |
get |
224 |
{ |
225 |
if (_imageViewer_Compare == null) |
226 |
{ |
227 |
_imageViewer_Compare = new System.Windows.Controls.Image(); |
228 |
return _imageViewer_Compare; |
229 |
} |
230 |
else |
231 |
{ |
232 |
return _imageViewer_Compare; |
233 |
} |
234 |
} |
235 |
set |
236 |
{ |
237 |
if (_imageViewer_Compare != value) |
238 |
{ |
239 |
_imageViewer_Compare = value; |
240 |
} |
241 |
} |
242 |
} |
243 |
|
244 |
#endregion 프로퍼티 |
245 |
|
246 |
public MainMenu() |
247 |
{ |
248 |
//App.splashString(ISplashMessage.MAINMENU_0); |
249 |
InitializeComponent(); |
250 |
|
251 |
tempPageImage = BitmapFrame.Create(new Uri(@"pack://application:,,,/KCOM;component/Resources/Images/ExtImage/blank.png"), BitmapCreateOptions.None, BitmapCacheOption.OnLoad); |
252 |
//List<testItem> testItems = new List<testItem> |
253 |
//{ |
254 |
// new testItem{Title = "test1"}, |
255 |
// new testItem{Title = "test2"}, |
256 |
// new testItem{Title = "test3"}, |
257 |
// new testItem{Title = "test4"}, |
258 |
//}; |
259 |
|
260 |
//lstSymbolPrivate.ItemsSource = testItems; |
261 |
|
262 |
this.Loaded += MainMenu_Loaded; |
263 |
} |
264 |
|
265 |
public class TempDt |
266 |
{ |
267 |
public int PageNumber { get; set; } |
268 |
public string CommentID { get; set; } |
269 |
public string ConvertData { get; set; } |
270 |
public int DATA_TYPE { get; set; } |
271 |
public string MarkupInfoID { get; set; } |
272 |
public int IsUpdate { get; set; } |
273 |
} |
274 |
|
275 |
private List<TempDt> tempDtList = new List<TempDt>(); |
276 |
|
277 |
public void SetCursor() |
278 |
{ |
279 |
this.Cursor = cursor; |
280 |
} |
281 |
|
282 |
/// <summary> |
283 |
/// get image url |
284 |
/// </summary> |
285 |
/// <author>humkyung</author> |
286 |
/// <param name="sDocumentID"></param> |
287 |
/// <returns></returns> |
288 |
public string GetImageURL(string sDocumentID, int iPageNo) |
289 |
{ |
290 |
string uri = string.Empty; |
291 |
|
292 |
string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt64(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID); |
293 |
if (userData.COMPANY != "EXT") |
294 |
{ |
295 |
uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, iPageNo); |
296 |
} |
297 |
else |
298 |
{ |
299 |
uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, iPageNo); |
300 |
} |
301 |
|
302 |
return uri; |
303 |
} |
304 |
|
305 |
/// <summary> |
306 |
/// 외부망에서의 Original PDF Download 를 위한 리소스 web path 경로로 치환 |
307 |
/// </summary> |
308 |
/// <returns></returns> |
309 |
public string GetOriginalPDFURL() |
310 |
{ |
311 |
string uri = string.Empty; |
312 |
string sDocumentID = this._DocItem.DOCUMENT_ID; |
313 |
string filename = string.Empty; |
314 |
if (this._DocInfo.ORIGINAL_FILE.Contains("fileName")) |
315 |
{ |
316 |
filename = HttpUtility.ParseQueryString(this._DocInfo.ORIGINAL_FILE).Get("fileName"); |
317 |
} |
318 |
else |
319 |
{ |
320 |
filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE); |
321 |
} |
322 |
|
323 |
var directUri = CommonLib.Common.GetConfigString("DocumentDownloadPath", "url", ""); |
324 |
|
325 |
if (!string.IsNullOrWhiteSpace(directUri)) |
326 |
{ |
327 |
uri = string.Format(directUri, filename); |
328 |
} |
329 |
else |
330 |
{ |
331 |
string sFolder = sDocumentID.All(char.IsDigit) ? (Convert.ToUInt64(sDocumentID) / 100).ToString() : (sDocumentID.Length >= 5 ? sDocumentID.Substring(0, 5) : sDocumentID); |
332 |
if (userData.COMPANY != "EXT") |
333 |
{ |
334 |
uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sFolder, sDocumentID, filename); |
335 |
} |
336 |
else |
337 |
{ |
338 |
uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, sDocumentID, filename); |
339 |
} |
340 |
uri = uri.Replace(".png", ""); |
341 |
} |
342 |
|
343 |
return uri; |
344 |
} |
345 |
|
346 |
private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
347 |
{ |
348 |
if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
349 |
zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
350 |
(_canvasZoomPanningMouseDownPoint.Y > 0 && |
351 |
zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
352 |
{ |
353 |
return true; |
354 |
} |
355 |
|
356 |
return false; |
357 |
} |
358 |
|
359 |
private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
360 |
{ |
361 |
if (rotate.Angle == 90 || rotate.Angle == 270) |
362 |
{ |
363 |
if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
364 |
zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) && |
365 |
(_canvasZoomPanningMouseDownPoint.Y > 0 && |
366 |
zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y)) |
367 |
{ |
368 |
return true; |
369 |
} |
370 |
} |
371 |
else |
372 |
{ |
373 |
if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
374 |
zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
375 |
(_canvasZoomPanningMouseDownPoint.Y > 0 && |
376 |
zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
377 |
{ |
378 |
return true; |
379 |
} |
380 |
} |
381 |
|
382 |
return false; |
383 |
} |
384 |
|
385 |
/// <summary> |
386 |
/// 주어진 레이어를 삭제한다. |
387 |
/// </summary> |
388 |
/// <param name="item"></param> |
389 |
public void DeleteItem(MarkupInfoItem item) |
390 |
{ |
391 |
if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0) |
392 |
{ |
393 |
App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID; |
394 |
} |
395 |
|
396 |
#region Consolidate 또는 AvoidConsolidate한 레이어만 삭제한다. Team Consolidate 추가 |
397 |
if (item.Consolidate == 1 || item.AvoidConsolidate == 1 || item.PartConsolidate == 1) |
398 |
{ |
399 |
ViewerDataModel.Instance._markupInfoList.Remove(item); |
400 |
if(item.PartConsolidate == 1) |
401 |
{ |
402 |
if(ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1).Count() > 0) |
403 |
{ |
404 |
foreach (var comment in ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID && x.PartConsolidate == 1)) |
405 |
{ |
406 |
comment.userDelete = true; |
407 |
} |
408 |
} |
409 |
else |
410 |
{ |
411 |
foreach (var comment in ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID)) |
412 |
{ |
413 |
comment.userDelete = true; |
414 |
} |
415 |
} |
416 |
} |
417 |
gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
418 |
gridViewMarkup.Rebind(); |
419 |
} |
420 |
#endregion |
421 |
|
422 |
#region item에 속한 컨트롤들을 삭제한다. |
423 |
ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
424 |
{ |
425 |
ViewerDataModel.Instance.MarkupControls.Remove(a); |
426 |
}); |
427 |
|
428 |
ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
429 |
{ |
430 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(a); |
431 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.MarkupListUpdate( |
432 |
null, EventType.Delete, a.CommentID, null); |
433 |
}); |
434 |
#endregion |
435 |
|
436 |
ViewerDataModel.Instance.MyMarkupList.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
437 |
{ |
438 |
ViewerDataModel.Instance.MyMarkupList.Remove(a); |
439 |
//임시파일에서도 삭제 |
440 |
//TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
441 |
}); |
442 |
|
443 |
if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.FirstOrDefault(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID) == null) |
444 |
{ |
445 |
if (!gridViewMarkup.Items.Cast<MarkupInfoItem>().Any(d => d.UserID == App.ViewInfo.UserID)) |
446 |
{ |
447 |
var infoId = Commons.shortGuid(); |
448 |
PreviewUserMarkupInfoItem = new MarkupInfoItem |
449 |
{ |
450 |
CreateTime = DateTime.Now, |
451 |
Depatment = userData.DEPARTMENT, |
452 |
UpdateTime = DateTime.Now, |
453 |
DisplayColor = "#FFFF0000", |
454 |
UserID = userData.ID, |
455 |
UserName = userData.NAME, |
456 |
PageCount = 1, |
457 |
Description = "", |
458 |
MarkupInfoID = infoId, |
459 |
MarkupList = null, |
460 |
MarkupVersionID = Commons.shortGuid(), |
461 |
Consolidate = 0, |
462 |
PartConsolidate = 0, |
463 |
userDelete = true, |
464 |
AvoidConsolidate = 0, |
465 |
IsPreviewUser = true |
466 |
}; |
467 |
App.Custom_ViewInfoId = infoId; |
468 |
} |
469 |
} |
470 |
|
471 |
BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID); |
472 |
} |
473 |
|
474 |
/// <summary> |
475 |
/// delete selected comments |
476 |
/// </summary> |
477 |
/// <param name="sender"></param> |
478 |
/// <param name="e"></param> |
479 |
public void DeleteCommentEvent(object sender, RoutedEventArgs e) |
480 |
{ |
481 |
//ReadOnly 권한이 어떻게 들어오는지 모르겠음. |
482 |
//NewCommentPermission으로 일단 처리 함. (2024-06-05 IRON) |
483 |
if (App.ViewInfo.NewCommentPermission) |
484 |
{ |
485 |
//정말 삭제 하시겠습니까? |
486 |
DialogParameters parameters = new DialogParameters() |
487 |
{ |
488 |
Owner = Application.Current.MainWindow, |
489 |
Content = new TextBlock() |
490 |
{ |
491 |
MinWidth = 400, |
492 |
FontSize = 11, |
493 |
Text = "Are you sure you want to delete?", |
494 |
TextWrapping = System.Windows.TextWrapping.Wrap |
495 |
}, |
496 |
Header = "Confirm", |
497 |
Theme = new VisualStudio2013Theme(), |
498 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
499 |
OkButtonContent = "Yes", |
500 |
CancelButtonContent = "No", |
501 |
Closed = delegate (object windowSender, WindowClosedEventArgs wc) |
502 |
{ |
503 |
if (wc.DialogResult == true) |
504 |
{ |
505 |
//선택된 어도너가 있을시 삭제가 되지 않음 |
506 |
SelectionSet.Instance.UnSelect(this); |
507 |
|
508 |
Button content = (sender as Button); |
509 |
MarkupInfoItem item = content.CommandParameter as MarkupInfoItem; |
510 |
|
511 |
DeleteItem(item); |
512 |
} |
513 |
} |
514 |
}; |
515 |
RadWindow.Confirm(parameters); |
516 |
} |
517 |
} |
518 |
|
519 |
private System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation(); |
520 |
|
521 |
private static Timer timer; |
522 |
private int InitInterval = KCOM.Properties.Settings.Default.InitInterval; |
523 |
|
524 |
private void MainMenu_Loaded(object sender, RoutedEventArgs e) |
525 |
{ |
526 |
//InitializeComponent(); |
527 |
//System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms"); |
528 |
|
529 |
if (App.ParameterMode) |
530 |
{ |
531 |
|
532 |
App.splashString(ISplashMessage.MAINMENU_1); |
533 |
this.pageNavigator.ThumbInitialized += pageNavigator_ThumbInitialized; |
534 |
this.pageNavigator.PageChanging += pageNavigator_PageChanging; |
535 |
this.pageNavigator.PageChanged += PageNavigator_PageChanged; |
536 |
|
537 |
imageViewer_Compare = new Image(); |
538 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
539 |
da.From = 0.8; |
540 |
da.To = 0; |
541 |
da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
542 |
da.AutoReverse = true; |
543 |
da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever; |
544 |
|
545 |
if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
546 |
{ |
547 |
this.SymbolPane.Visibility = Visibility.Collapsed; |
548 |
this.FavoritePane.Visibility = Visibility.Collapsed; |
549 |
this.drawingRotateCanvas.IsHitTestVisible = false; |
550 |
} |
551 |
thumbnailPanel.Width = Convert.ToInt32(CommonLib.Common.GetConfigString("SetThumbnail", "WIDTH", "250")); |
552 |
} |
553 |
|
554 |
//timer = new Timer(timercallback, null, 0, InitInterval * 60000); |
555 |
} |
556 |
|
557 |
/// <summary> |
558 |
/// 검색을 위해 원본 PDF 파일을 다운로드한다. |
559 |
/// </summary> |
560 |
private void DownloadOriginalFile() |
561 |
{ |
562 |
#region 임시파일 다운로드 |
563 |
instnaceFile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName().Split('.')[0] + ".pdf"); |
564 |
|
565 |
var directUri = CommonLib.Common.GetConfigString("DocumentDownloadPath", "url", ""); |
566 |
|
567 |
bool isRestDownload = Convert.ToBoolean(CommonLib.Common.GetConfigString("DocumentDownloadPath", "IsRest", "False")); |
568 |
|
569 |
|
570 |
if (!string.IsNullOrWhiteSpace(directUri)) |
571 |
{ |
572 |
if (directUri.ToLower() == "full") |
573 |
{ |
574 |
downloadurl = this._DocInfo.ORIGINAL_FILE; |
575 |
} |
576 |
else |
577 |
{ |
578 |
isRestDownload = true; |
579 |
filename = System.IO.Path.GetFileName(this._DocInfo.ORIGINAL_FILE); |
580 |
|
581 |
downloadurl = string.Format(directUri, filename); |
582 |
} |
583 |
} |
584 |
else |
585 |
{ |
586 |
downloadurl = GetOriginalPDFURL(); |
587 |
} |
588 |
|
589 |
ViewerDataModel.Instance.OriginalTempFile = instnaceFile; |
590 |
|
591 |
string endpoint = Common.Commons.shortGuid() + "file"; |
592 |
IIpc.WcfServer wcfServer = new IIpc.WcfServer(endpoint); |
593 |
wcfServer.IpcFileDownloadReceived += WcfServer_IpcFileDownloadReceived; |
594 |
wcfServer.Start(); |
595 |
|
596 |
DownloadProcess.FileDownloader(endpoint, ViewerDataModel.Instance.IsAdmin, downloadurl, instnaceFile, isRestDownload); |
597 |
#endregion |
598 |
} |
599 |
|
600 |
string instnaceFile; |
601 |
string downloadurl; |
602 |
|
603 |
private void WcfServer_IpcFileDownloadReceived(object sender, IIpc.IpcDownloadStatusArgs e) |
604 |
{ |
605 |
try |
606 |
{ |
607 |
Dispatcher.BeginInvoke((Action)delegate () |
608 |
{ |
609 |
if ((sender as IIpc.WcfServer).IsOpen) |
610 |
{ |
611 |
ViewerDataModel.Instance.DownloadFileProgress = (int)e.Progress; |
612 |
} |
613 |
|
614 |
}); |
615 |
|
616 |
if ((sender as IIpc.WcfServer).IsOpen) |
617 |
{ |
618 |
if (e.IsFinish) |
619 |
{ |
620 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.searchPanel_Instance.SetSerachPDFFile(instnaceFile); |
621 |
ViewerDataModel.Instance.IsDownloadOriginal = true; |
622 |
(sender as IIpc.WcfServer).Stop(); |
623 |
(sender as IIpc.WcfServer).IpcFileDownloadReceived -= WcfServer_IpcFileDownloadReceived; |
624 |
} |
625 |
} |
626 |
} |
627 |
catch (Exception ex) |
628 |
{ |
629 |
throw; |
630 |
} |
631 |
} |
632 |
|
633 |
/// <summary> |
634 |
/// update my markuplist |
635 |
/// - update existing markup data if already exist |
636 |
/// - add new markup data if control is new |
637 |
/// </summary> |
638 |
public void UpdateMyMarkupList() |
639 |
{ |
640 |
Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1); |
641 |
|
642 |
/// add or update markup list |
643 |
foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
644 |
{ |
645 |
var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID); |
646 |
|
647 |
var exist = ViewerDataModel.Instance.MyMarkupList.Find(data => data.ID == root.CommentID); |
648 |
if (exist != null) //신규 추가 된 코멘트 |
649 |
{ |
650 |
if (exist.Data != root.ConvertData) //코멘트가 같은지 |
651 |
{ |
652 |
exist.Data = root.ConvertData; |
653 |
exist.IsUpdate = true; |
654 |
} |
655 |
} |
656 |
else if (root.CommentID != null) |
657 |
{ |
658 |
ViewerDataModel.Instance.MyMarkupList.Add(new MarkupItemEx |
659 |
{ |
660 |
ID = control.CommentID, |
661 |
Data = root.ConvertData, |
662 |
Data_Type = root.DATA_TYPE, |
663 |
MarkupInfoID = App.Custom_ViewInfoId, |
664 |
PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
665 |
Symbol_ID = control.SymbolID, |
666 |
//Group_ID = control.GroupID, |
667 |
}); |
668 |
} |
669 |
} |
670 |
|
671 |
//if (this.pageNavigator.CurrentPage != null) |
672 |
//{ |
673 |
// /// delete markup list |
674 |
// int iPageNo = this.pageNavigator.CurrentPage.PageNumber; |
675 |
|
676 |
// var deleted = (from markup in ViewerDataModel.Instance.MyMarkupList |
677 |
// where (markup.PageNumber == iPageNo) |
678 |
// && (null == ViewerDataModel.Instance.MarkupControls_USER.Where(control => control.CommentID == markup.ID).FirstOrDefault()) |
679 |
// select markup).ToList(); |
680 |
|
681 |
// foreach (var markup in deleted) |
682 |
// { |
683 |
// ViewerDataModel.Instance.MyMarkupList.Remove(markup); |
684 |
// } |
685 |
//} |
686 |
//else |
687 |
//{ |
688 |
// System.Diagnostics.Debug.WriteLine("UpdateMyMarkupList : this.pageNavigator.CurrentPage null "); |
689 |
//} |
690 |
|
691 |
/// up to here |
692 |
|
693 |
//if (modified) |
694 |
//{ |
695 |
// if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null) |
696 |
// { |
697 |
// ComingNewBieEnd = true; |
698 |
// ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
699 |
// PreviewUserMarkupInfoItem.IsPreviewUser = false; |
700 |
// gridViewMarkup.ItemsSource = null; |
701 |
// gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
702 |
// gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
703 |
|
704 |
// GroupDescriptor descriptor = new GroupDescriptor(); |
705 |
// descriptor.Member = "Depatment"; |
706 |
// descriptor.DisplayContent = "DEPT"; |
707 |
// descriptor.SortDirection = ListSortDirection.Ascending; |
708 |
// gridViewMarkup.GroupDescriptors.Add(descriptor); |
709 |
// } |
710 |
//} |
711 |
} |
712 |
|
713 |
/// <summary> |
714 |
/// start page changing |
715 |
/// - save controls if page is modified |
716 |
/// - starting download page image |
717 |
/// </summary> |
718 |
/// <param name="sender"></param> |
719 |
/// <param name="e"></param> |
720 |
private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
721 |
{ |
722 |
System.Diagnostics.Debug.WriteLine("pageNavigator PageChanging"); |
723 |
// await PageLoadAsync(e.CurrentPage,e.PageNumber); |
724 |
//} |
725 |
//private async Task PageLoadAsync(DOCPAGE page, int PageNo) |
726 |
//{ |
727 |
DOCPAGE page = e.CurrentPage; |
728 |
int PageNo = e.PageNumber; |
729 |
|
730 |
ViewerDataModel.Instance.PageAngle = page.PAGE_ANGLE; |
731 |
|
732 |
// 페이지 이미지 변경 |
733 |
|
734 |
/// 컨트롤을 새로 생성한다. |
735 |
ViewerDataModel.Instance.ImageViewPath = tempPageImage; |
736 |
ViewerDataModel.Instance.ImageViewWidth = 1; |
737 |
ViewerDataModel.Instance.ImageViewHeight = 1; |
738 |
|
739 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Clear(); |
740 |
Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
741 |
Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
742 |
|
743 |
await PageChangingAsync(page, PageNo, ViewerDataModel.Instance.NewPagImageCancelToken()); |
744 |
|
745 |
await MarkupLoadAsync(PageNo, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken()); |
746 |
|
747 |
//var pagechangeTask = PageChangingAsync(page, page.PAGE_NUMBER, ViewerDataModel.Instance.NewPagImageCancelToken()); |
748 |
|
749 |
//var markupLoadTask = MarkupLoadAsync(page.PAGE_NUMBER, ViewerDataModel.Instance.PageAngle, ViewerDataModel.Instance.NewMarkupCancelToken()); |
750 |
|
751 |
//await Task.WhenAll(pagechangeTask, markupLoadTask); |
752 |
} |
753 |
|
754 |
private async Task PageChangingAsync(DOCPAGE currentPage, int changePageNumber,CancellationToken token) |
755 |
{ |
756 |
var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? changePageNumber + ViewerDataModel.Instance.PageBalanceNumber : changePageNumber; |
757 |
|
758 |
#region 페이지가 벗어난 경우 |
759 |
|
760 |
if (BalancePoint < 1) |
761 |
{ |
762 |
BalancePoint = 1; |
763 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
764 |
} |
765 |
|
766 |
if (pageNavigator.PageCount < BalancePoint) |
767 |
{ |
768 |
BalancePoint = pageNavigator.PageCount; |
769 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
770 |
} |
771 |
|
772 |
#endregion 페이지가 벗어난 경우 |
773 |
|
774 |
ViewerDataModel.Instance.SyncPageNumber = BalancePoint; |
775 |
|
776 |
var pageWidth = Convert.ToDouble(currentPage.PAGE_WIDTH); |
777 |
var pageHeight = Convert.ToDouble(currentPage.PAGE_HEIGHT); |
778 |
var contentScale = zoomAndPanControl.ContentScale; |
779 |
|
780 |
#region 페이지 이미지 로딩 수정 |
781 |
|
782 |
|
783 |
ViewerDataModel.Instance.ImageViewPath = await App.PageStorage.GetPageImageAsync(token,changePageNumber); |
784 |
|
785 |
if(token.IsCancellationRequested) |
786 |
{ |
787 |
return; |
788 |
} |
789 |
|
790 |
ScaleImage(pageWidth, pageHeight); |
791 |
|
792 |
ViewerDataModel.Instance.ImageViewWidth = pageWidth; |
793 |
ViewerDataModel.Instance.ImageViewHeight = pageHeight; |
794 |
|
795 |
zoomAndPanCanvas.Width = pageWidth; |
796 |
zoomAndPanCanvas.Height = pageHeight; |
797 |
|
798 |
Common.ViewerDataModel.Instance.ContentWidth = pageWidth; |
799 |
Common.ViewerDataModel.Instance.ContentHeight = pageHeight; |
800 |
|
801 |
inkBoard.Width = pageWidth; |
802 |
inkBoard.Height = pageHeight; |
803 |
|
804 |
#endregion 페이지 이미지 로딩 수정 |
805 |
|
806 |
if (!testPanel2.IsHidden) |
807 |
{ |
808 |
Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1); |
809 |
//PDF모드일때 잠시 대기(강인구) |
810 |
if (IsSyncPDFMode) |
811 |
{ |
812 |
Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
813 |
var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber))); |
814 |
|
815 |
Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1); |
816 |
if (pdfpath.IsDownloading) |
817 |
{ |
818 |
pdfpath.DownloadCompleted += (ex, arg) => |
819 |
{ |
820 |
Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1); |
821 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
822 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
823 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
824 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
825 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
826 |
}; |
827 |
} |
828 |
else |
829 |
{ |
830 |
Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1); |
831 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
832 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
833 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
834 |
|
835 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
836 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
837 |
} |
838 |
} |
839 |
else |
840 |
{ |
841 |
Logger.sendCheckLog("Compare Image Download", 1); |
842 |
string compareImageUri = this.GetImageURL(CurrentRev.DOCUMENT_ID, BalancePoint); |
843 |
ComparePageLoad(compareImageUri,false); |
844 |
} |
845 |
|
846 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
847 |
} |
848 |
|
849 |
SearchFocusBorder.Visibility = Visibility.Collapsed; |
850 |
|
851 |
this.pageNavigator.ChangePage(changePageNumber); |
852 |
} |
853 |
|
854 |
private void ComparePageLoad(string pageUri, bool IsOriginalSize) |
855 |
{ |
856 |
/// 현재 보고 있는 VP와 같은 크기로 로딩 |
857 |
ViewerDataModel.Instance.ImageViewPath_C = null; |
858 |
|
859 |
if (IsOriginalSize && OriginalSizeMode.IsChecked) |
860 |
{ |
861 |
ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri); |
862 |
} |
863 |
else |
864 |
{ |
865 |
var imageSize = new Size(ViewerDataModel.Instance.ImageViewWidth, ViewerDataModel.Instance.ImageViewHeight); |
866 |
ViewerDataModel.Instance.ImageViewPath_C = ImageSourceHelper.GetDownloadImage(pageUri, imageSize); |
867 |
} |
868 |
|
869 |
if (ViewerDataModel.Instance.ImageViewPath_C != null) |
870 |
{ |
871 |
ViewerDataModel.Instance.ImageViewWidth_C = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth; |
872 |
ViewerDataModel.Instance.ImageViewHeight_C = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight; |
873 |
zoomAndPanCanvas2.Width = ViewerDataModel.Instance.ImageViewPath_C.PixelWidth; |
874 |
zoomAndPanCanvas2.Height = ViewerDataModel.Instance.ImageViewPath_C.PixelHeight; |
875 |
|
876 |
zoomAndPanControl.ZoomTo(new Rect |
877 |
{ |
878 |
X = 0, |
879 |
Y = 0, |
880 |
Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
881 |
Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
882 |
}); |
883 |
|
884 |
if (Sync.IsChecked) |
885 |
{ |
886 |
Sync_Click(null, new RoutedEventArgs()); |
887 |
} |
888 |
|
889 |
if (CompareMode.IsChecked) |
890 |
{ |
891 |
SyncCompare_Click(null, new RoutedEventArgs()); |
892 |
} |
893 |
} |
894 |
} |
895 |
|
896 |
/// <summary> |
897 |
/// called after page is changed |
898 |
/// </summary> |
899 |
/// <param name="sender"></param> |
900 |
/// <param name="e"></param> |
901 |
private async void PageNavigator_PageChanged(object sender, Sample.PageChangeEventArgs e) |
902 |
{ |
903 |
//if (zoomAndPanCanvas.Width.IsNaN()) |
904 |
//{ |
905 |
//await zoomAndPanControl.Dispatcher.InvokeAsync(() => |
906 |
// zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }) |
907 |
// ); |
908 |
//} |
909 |
|
910 |
var instanceMain = ViewerDataModel.Instance.SystemMain; |
911 |
|
912 |
instanceMain.dzMainMenu.CanvasDrawingMouseDownPoint = new Point(ViewerDataModel.Instance.ImageViewWidth / 2, ViewerDataModel.Instance.ImageViewHeight / 2); |
913 |
|
914 |
instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
915 |
instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
916 |
|
917 |
instanceMain.dzTopMenu.rotateOffSet = 0; |
918 |
var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault(); |
919 |
drawingPannelRotate(pageinfo.PAGE_ANGLE); |
920 |
|
921 |
/// 페이지의 모든 마크업을 로드한 후 호출 |
922 |
/// 좌측 마크업 list의 아이템을 클릭하는 경우 MarkupControls_USER가 0으로 나와서 추가함. |
923 |
ViewerDataModel.Instance.LoadPageMarkupFinish(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }); |
924 |
|
925 |
//Point startPoint = new Point(15, 15); |
926 |
|
927 |
//var markupinfo = ViewerDataModel.Instance._markupInfoList.Where(x => x.UserID == App.ViewInfo.UserID).First(); |
928 |
|
929 |
////var rect = GetRectControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint); |
930 |
|
931 |
////var txtApproved = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, |
932 |
//// "APPROVED",30, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, 15); |
933 |
|
934 |
////var txtCreator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
935 |
//// , "By HYOSUNG", 18, FontWeights.Bold, TextAlignment.Center, rect.ItemRect, txtApproved.StartPoint.Y + txtApproved.BoxHeight + 3); |
936 |
|
937 |
//var symCtrl = GetSymNControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID, startPoint); |
938 |
|
939 |
//var bottom = Rect.Offset(symCtrl.ItemRect, new Vector(0, symCtrl.ItemRect.Height)); |
940 |
|
941 |
//var txtOriginator = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
942 |
// , App.ViewInfo.UserID, 18, FontWeights.Bold, TextAlignment.Left, bottom, bottom.Top + 3); |
943 |
|
944 |
//var dtfi = new System.Globalization.DateTimeFormatInfo { DateSeparator = "-", ShortDatePattern = @"yyyy/MM/dd" }; |
945 |
|
946 |
//var txtDate = GetTextControl(Convert.ToDouble(pageinfo.PAGE_WIDTH), Convert.ToDouble(pageinfo.PAGE_HEIGHT), markupinfo.UserID, markupinfo.MarkupInfoID |
947 |
// , DateTime.Now.ToString("d", dtfi), 18, FontWeights.Bold, TextAlignment.Left, bottom, txtOriginator.StartPoint.Y + txtOriginator.BoxHeight + 2); |
948 |
|
949 |
//ViewerDataModel.Instance.MarkupControls_USER.Add(symCtrl); |
950 |
////ViewerDataModel.Instance.MarkupControls_USER.Add(txtApproved); |
951 |
////ViewerDataModel.Instance.MarkupControls_USER.Add(txtCreator); |
952 |
//ViewerDataModel.Instance.MarkupControls_USER.Add(txtOriginator); |
953 |
//ViewerDataModel.Instance.MarkupControls_USER.Add(txtDate); |
954 |
|
955 |
//symCtrl.ApplyTemplate(); |
956 |
////txtApproved.ApplyTemplate(); |
957 |
////txtCreator.ApplyTemplate(); |
958 |
//txtOriginator.ApplyTemplate(); |
959 |
//txtDate.ApplyTemplate(); |
960 |
|
961 |
////SetTextControl(txtApproved); |
962 |
////SetTextControl(txtCreator); |
963 |
//SetTextControl(txtOriginator); |
964 |
//SetTextControl(txtDate); |
965 |
|
966 |
//multi_UndoData = new Multi_UndoData(); |
967 |
|
968 |
//MarkupToPDF.Common.UndoData UndoData = new UndoData() |
969 |
//{ |
970 |
// IsUndo = false, |
971 |
// Event = EventType.Create, |
972 |
// EventTime = DateTime.Now, |
973 |
// MarkupDataColl = new List<Multi_UndoData>() |
974 |
//}; |
975 |
|
976 |
//multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(symCtrl as MarkupToPDF.Common.CommentUserInfo); |
977 |
//UndoData.MarkupDataColl.Add(multi_UndoData); |
978 |
|
979 |
////multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtApproved as MarkupToPDF.Common.CommentUserInfo); |
980 |
////UndoData.MarkupDataColl.Add(multi_UndoData); |
981 |
|
982 |
////multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtCreator as MarkupToPDF.Common.CommentUserInfo); |
983 |
////UndoData.MarkupDataColl.Add(multi_UndoData); |
984 |
|
985 |
//multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtOriginator as MarkupToPDF.Common.CommentUserInfo); |
986 |
//UndoData.MarkupDataColl.Add(multi_UndoData); |
987 |
|
988 |
//multi_UndoData = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.Control_Style(txtDate as MarkupToPDF.Common.CommentUserInfo); |
989 |
//UndoData.MarkupDataColl.Add(multi_UndoData); |
990 |
|
991 |
//ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
992 |
|
993 |
//System.Diagnostics.Debug.WriteLine(symCtrl.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
994 |
////System.Diagnostics.Debug.WriteLine(txtApproved.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
995 |
////System.Diagnostics.Debug.WriteLine(txtCreator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
996 |
//System.Diagnostics.Debug.WriteLine(txtOriginator.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
997 |
//System.Diagnostics.Debug.WriteLine(txtDate.GetMarkupData(App.ViewInfo.UserID, 1, markupinfo.MarkupVersionID).DATA); |
998 |
} |
999 |
|
1000 |
private void SetTextControl(TextControl textControl) |
1001 |
{ |
1002 |
textControl.Base_TextBlock.Margin = new Thickness(0, 0, 10, 0); |
1003 |
textControl.Base_TextBox.Visibility = Visibility.Collapsed; |
1004 |
textControl.Base_TextBlock.Visibility = Visibility.Visible; |
1005 |
} |
1006 |
|
1007 |
private SymControlN GetSymNControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition) |
1008 |
{ |
1009 |
SymControlN result = null; |
1010 |
|
1011 |
try |
1012 |
{ |
1013 |
double height = 80; |
1014 |
double itemWidth = 180; |
1015 |
|
1016 |
System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
1017 |
System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height); |
1018 |
System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height); |
1019 |
System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y); |
1020 |
|
1021 |
result = new SymControlN |
1022 |
{ |
1023 |
CommentID = Commons.shortGuid(), |
1024 |
MarkupInfoID = markupInfoId, |
1025 |
UserID = userId, |
1026 |
PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint }, |
1027 |
StartPoint = startPoint, |
1028 |
EndPoint = endPoint, |
1029 |
CommentAngle = 0, |
1030 |
LeftBottomPoint = leftBottomPoint, |
1031 |
TopRightPoint = topRightPoint, |
1032 |
Opacity = 1, |
1033 |
PathXathData = "eJy1Ul1PwjAU/SvN9c3EdY5g1FAShyIxRgygxsemu7AbupZ0Vae/3g42/Azxxfuw9Z7Tnpx72t6lo4zdyAIFyHUBqwptSgG596tTzkuVYyHLqCDlbGnnPlK24C9k5hVP4viIV7LQfOWwROOlJ2ug36tVo1Sq5cLZJ5P1e1OrKRtYbV3qnsqcrZcC9oZNARuvpCL/KiCODoHxfo//EJmg8tIsNLKpd+hVLmBIWkPd2iU2cnGoFprlpJYGyzBOt8WuyeCVJSNgUstCM/1WHNgDZT5oJ3E4M0Ja5F7A8QmwgTTPIYlrnAfgIIm6W2hmVy3CN9M3GUzsyznOyVAdTBlG+NxvxffXx37nOlF3Fx3vppNd5P6nnL8bnWHlU23VktUrAWe3t5Px/cU5sKE1/qFRuKi8k6nV2Qae0ltIshPXncPNtX25lZF19BY2Sn2maWGK8GQEDMIXHbB7dJ7Ur1RrUcDmbXx3l76y0eN4endz+Qd/yX/663xk2v7eAQ==", |
1034 |
Memo = null |
1035 |
}; |
1036 |
} |
1037 |
catch (Exception ex) |
1038 |
{ |
1039 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1040 |
} |
1041 |
|
1042 |
return result; |
1043 |
} |
1044 |
|
1045 |
private RectangleControl GetRectControl(double PageWidth, double PageHeight, string userId, string markupInfoId, Point startPosition) |
1046 |
{ |
1047 |
RectangleControl result = null; |
1048 |
|
1049 |
try |
1050 |
{ |
1051 |
double height = 80; |
1052 |
double itemWidth = 180; |
1053 |
|
1054 |
System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
1055 |
System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y + height); |
1056 |
System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + height); |
1057 |
System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + itemWidth, startPosition.Y); |
1058 |
|
1059 |
result = new RectangleControl |
1060 |
{ |
1061 |
CommentID = Commons.shortGuid(), |
1062 |
MarkupInfoID = markupInfoId, |
1063 |
LineSize = 5, |
1064 |
Paint = MarkupToPDF.Controls.Common.PaintSet.None, |
1065 |
StartPoint = startPoint, |
1066 |
EndPoint = endPoint, |
1067 |
CommentAngle = 0, |
1068 |
StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0x0, 0x0)), |
1069 |
//StrokeColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 64, 224, 208)), |
1070 |
FillColor = null, |
1071 |
DashSize = new System.Windows.Media.DoubleCollection(new[] { 999999.0 }), |
1072 |
Opacity = 1, |
1073 |
LeftBottomPoint = leftBottomPoint, |
1074 |
TopRightPoint = topRightPoint, |
1075 |
PointSet = new List<Point> { startPoint, leftBottomPoint, endPoint, topRightPoint }, |
1076 |
UserID = userId, |
1077 |
Memo = null |
1078 |
}; |
1079 |
} |
1080 |
catch (Exception ex) |
1081 |
{ |
1082 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
1083 |
} |
1084 |
|
1085 |
return result; |
1086 |
} |
1087 |
|
1088 |
private TextControl GetTextControl(double PageWidth, double PageHeight, string userId, string markupInfoId, string Text, double fontSize, FontWeight fontWeight, TextAlignment textAlignment, Rect parentRect, double positionY) |
1089 |
{ |
1090 |
TextControl result = null; |
1091 |
|
1092 |
try |
1093 |
{ |
1094 |
var txtSize = ShapeMeasure(new TextBlock { Text = Text, FontSize = fontSize, FontWeight = fontWeight, FontFamily = new FontFamily("Tahoma") }); |
1095 |
|
1096 |
double startPositionX = parentRect.X; |
1097 |
|
1098 |
switch (textAlignment) |
1099 |
{ |
1100 |
case TextAlignment.Right: |
1101 |
startPositionX = parentRect.X + parentRect.Width - txtSize.Width; |
1102 |
break; |
1103 |
|
1104 |
case TextAlignment.Center: |
1105 |
startPositionX = parentRect.X + parentRect.Width / 2 - txtSize.Width / 2 - 3; |
1106 |
break; |
1107 |
} |
1108 |
|
1109 |
Point startPosition = new Point |
1110 |
{ |
1111 |
X = startPositionX, |
1112 |
Y = positionY |
1113 |
}; |
1114 |
|
1115 |
System.Windows.Point startPoint = new System.Windows.Point(startPosition.X, startPosition.Y); |
1116 |
System.Windows.Point endPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y + txtSize.Height); |
1117 |
System.Windows.Point leftBottomPoint = new System.Windows.Point(startPosition.X, startPosition.Y + txtSize.Height); |
1118 |
System.Windows.Point topRightPoint = new System.Windows.Point(startPosition.X + txtSize.Width, startPosition.Y); |
1119 |
|
1120 |
result = new TextControl |
1121 |
{ |
1122 |
CommentID = Commons.shortGuid(), |
1123 |
MarkupInfoID = markupInfoId, |
1124 |
Text = Text, |
1125 |
StartPoint = startPoint, |
1126 |
EndPoint = endPoint, |
1127 |
CanvasX = startPosition.X, |
1128 |
CanvasY = startPosition.Y, |
1129 |
BoxWidth = txtSize.Width, |
1130 |
BoxHeight = txtSize.Height, |
1131 |
ControlType_No = 0, |
1132 |
LineSize = new Thickness(5), |
1133 |
TextSize = fontSize, |
1134 |
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0)), |
1135 |
FontSize = 10, |
1136 |
UserID = userId, |
1137 |
IsHighLight = false, |
1138 |
CommentAngle = 0, |
1139 |
PointSet = new List<Point>(), |
1140 |
Opacity = 1, |
1141 |
IsSelected = false, |
1142 |
TextFamily = new FontFamily("Tahoma"), |
1143 |
TextStyle = FontStyles.Normal, |
1144 |
TextWeight = FontWeights.Bold |
1145 |
}; |
1146 |
} |
1147 |
catch (Exception ex) |
1148 |
{ |
1149 |
} |
1150 |
|
1151 |
return result; |
1152 |
} |
1153 |
|
1154 |
public static Size ShapeMeasure(UIElement e) |
1155 |
{ |
1156 |
// Measured Size is bounded to be less than maxSize |
1157 |
Size maxSize = new Size( |
1158 |
double.PositiveInfinity, |
1159 |
double.PositiveInfinity); |
1160 |
e.Measure(maxSize); |
1161 |
return e.DesiredSize; |
1162 |
} |
1163 |
|
1164 |
private async Task MarkupLoadAsync(int pageNumber,Double PageAngle, CancellationToken cts) |
1165 |
{ |
1166 |
System.Diagnostics.Stopwatch stopwatch = new Stopwatch(); |
1167 |
stopwatch.Start(); |
1168 |
|
1169 |
/// 컨트롤을 새로 생성한다. |
1170 |
Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
1171 |
Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
1172 |
|
1173 |
System.Diagnostics.Debug.WriteLine("MarkupLoad - Clear " + new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
1174 |
|
1175 |
foreach (var markup in ViewerDataModel.Instance.MyMarkupList.Where(param => param.PageNumber == pageNumber)) |
1176 |
{ |
1177 |
if (cts.IsCancellationRequested) |
1178 |
{ |
1179 |
return; |
1180 |
} |
1181 |
|
1182 |
var info = ViewerDataModel.Instance._markupInfoList.Where(param => param.MarkupInfoID == markup.MarkupInfoID).FirstOrDefault(); |
1183 |
if (info != null) |
1184 |
{ |
1185 |
string sColor = (info.UserID == App.ViewInfo.UserID) ? "#FFFF0000" : info.DisplayColor; |
1186 |
if (info.UserID == App.ViewInfo.UserID) |
1187 |
{ |
1188 |
var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, PageAngle, sColor, "", |
1189 |
markup.MarkupInfoID, markup.ID); |
1190 |
control.Visibility = Visibility.Hidden; |
1191 |
} |
1192 |
else |
1193 |
{ |
1194 |
var control = await MarkupParser.ParseExAsync(App.BaseAddress, cts, App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, PageAngle, sColor, "", |
1195 |
markup.MarkupInfoID, markup.ID); |
1196 |
control.Visibility = Visibility.Hidden; |
1197 |
} |
1198 |
} |
1199 |
}; |
1200 |
/// up to here |
1201 |
|
1202 |
System.Diagnostics.Debug.WriteLine("MarkupLoad - MarkupParser " + new TimeSpan(stopwatch.ElapsedTicks).ToString()); |
1203 |
|
1204 |
/// fire selection event |
1205 |
// DIG 요청으로 첫 로드시 전체 선택 되도록 수정 2024-06-04 IRON |
1206 |
// 다른 페이지 넘어갈 시 메시지 박스가 여러개 떠서 추가기능 주석 처리 2024-06-05 IRON |
1207 |
//gridViewMarkup.SelectAll(); |
1208 |
List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
1209 |
this.gridViewMarkup.UnselectAll(); |
1210 |
this.gridViewMarkup.Select(gridSelectionItem); |
1211 |
|
1212 |
if (!testPanel2.IsHidden) |
1213 |
{ |
1214 |
ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
1215 |
ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
1216 |
ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
1217 |
|
1218 |
Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
1219 |
List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
1220 |
|
1221 |
foreach (var item in gridSelectionRevItem) |
1222 |
{ |
1223 |
var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == pageNumber).ToList(); |
1224 |
|
1225 |
foreach (var markupitem in markupitems) |
1226 |
{ |
1227 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,PageAngle, item.DisplayColor, "", item.MarkupInfoID); |
1228 |
|
1229 |
//if (cts.IsCancellationRequested) |
1230 |
//{ |
1231 |
// return; |
1232 |
//} |
1233 |
} |
1234 |
} |
1235 |
} |
1236 |
|
1237 |
SetCommentPages(cts); |
1238 |
} |
1239 |
|
1240 |
public void SetCommentPages(CancellationToken? cts) |
1241 |
{ |
1242 |
Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1); |
1243 |
List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>(); |
1244 |
foreach (var item in ViewerDataModel.Instance._markupInfoList) |
1245 |
{ |
1246 |
//Comment 가 존재할 경우에만 Thumbnail 에 추가 |
1247 |
if (item.MarkupList != null) |
1248 |
{ |
1249 |
UsersCommentPagesMember instance = new UsersCommentPagesMember(); |
1250 |
instance.UserName = item.UserName; |
1251 |
instance.Depart = item.Depatment; |
1252 |
instance.MarkupInfoID = item.MarkupInfoID; |
1253 |
instance.IsSelected = true; |
1254 |
instance.isConSolidation = item.Consolidate; |
1255 |
instance.SetColor = item.DisplayColor; |
1256 |
if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID) |
1257 |
{ |
1258 |
instance.PageNumber = ViewerDataModel.Instance.MyMarkupList.Select(d => d.PageNumber).ToList(); |
1259 |
} |
1260 |
else |
1261 |
{ |
1262 |
instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList(); |
1263 |
} |
1264 |
_pages.Add(instance); |
1265 |
} |
1266 |
|
1267 |
if (cts != null) |
1268 |
{ |
1269 |
if (cts.Value.IsCancellationRequested) |
1270 |
return; |
1271 |
} |
1272 |
} |
1273 |
|
1274 |
this.pageNavigator.SetCommentList(_pages.ToList(),cts); |
1275 |
} |
1276 |
|
1277 |
public void MarkupitemViewUpdate(string markupinfo_id) |
1278 |
{ |
1279 |
//db에 업데이트 한 list 를 view 에 업데이트 |
1280 |
string sDocID = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu._DocInfo.ID; |
1281 |
List<MarkupInfoItem> results = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, sDocID); |
1282 |
MarkupInfoItem dbinfo = results.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault(); |
1283 |
MarkupInfoItem viewinfo = Common.ViewerDataModel.Instance._markupInfoList.Where(x => x.MarkupInfoID == markupinfo_id).FirstOrDefault(); |
1284 |
if (dbinfo.MarkupList.Count > 0) |
1285 |
{ |
1286 |
if (viewinfo.MarkupList != null) |
1287 |
{ |
1288 |
viewinfo.MarkupList.Clear(); |
1289 |
viewinfo.MarkupList = null; |
1290 |
} |
1291 |
|
1292 |
viewinfo.MarkupList = new List<MarkupItem>(); |
1293 |
foreach (var item in dbinfo.MarkupList) |
1294 |
{ |
1295 |
System.Diagnostics.Debug.WriteLine(item.ID); |
1296 |
viewinfo.MarkupList.Add(item); |
1297 |
} |
1298 |
} |
1299 |
} |
1300 |
|
1301 |
private async void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
1302 |
{ |
1303 |
var instance = ViewerDataModel.Instance; |
1304 |
|
1305 |
if (instance.IsWheelPageChanage) |
1306 |
{ |
1307 |
return; |
1308 |
} |
1309 |
|
1310 |
if (instance.IsPressCtrl) // && !instance.IsWheelPageChanage) |
1311 |
{ |
1312 |
int changePage = 0; |
1313 |
|
1314 |
if (e.Delta > 0) |
1315 |
{ |
1316 |
if (0 < instance.ContentOffsetY) |
1317 |
{ |
1318 |
Vector dragOffset = new Vector(0, e.Delta); |
1319 |
MoveZoomAndPanControl(dragOffset); |
1320 |
} |
1321 |
//else |
1322 |
//{ |
1323 |
// if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber > 1) |
1324 |
// { |
1325 |
// instance.IsWheelPageChanage = true; |
1326 |
// changePage -= 1; |
1327 |
// } |
1328 |
//} |
1329 |
} |
1330 |
else if (e.Delta < 0) |
1331 |
{ |
1332 |
if (instance.ContentHeight > instance.ContentOffsetY + instance.ContentViewportHeight) |
1333 |
{ |
1334 |
Vector dragOffset = new Vector(0, e.Delta); |
1335 |
MoveZoomAndPanControl(dragOffset); |
1336 |
} |
1337 |
//else |
1338 |
//{ |
1339 |
// if (instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber < instance.SystemMain.dzMainMenu.pageNavigator.PageCount) |
1340 |
// { |
1341 |
// instance.IsWheelPageChanage = true; |
1342 |
// changePage += 1; |
1343 |
// } |
1344 |
//} |
1345 |
} |
1346 |
|
1347 |
//if (changePage != 0) |
1348 |
//{ |
1349 |
// await Task.Factory.StartNew(() => |
1350 |
// { |
1351 |
// double beforeScale = instance.ContentScale; |
1352 |
|
1353 |
// EventHandler<Sample.PageChangeEventArgs> handler = null; |
1354 |
|
1355 |
// handler = (snd, evt) => |
1356 |
// { |
1357 |
// /// 최상단으로 이전 zoomScale로 위치한다 |
1358 |
// //Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
1359 |
// //zoomAndPanControl.ZoomAboutPoint(beforeScale, new Point(currentContentMousePoint.X, 0)); |
1360 |
// instance.IsWheelPageChanage = false; |
1361 |
// pageNavigator.PageChanged -= handler; |
1362 |
// }; |
1363 |
|
1364 |
// pageNavigator.PageChanged += handler; |
1365 |
|
1366 |
// pageNavigator.GotoPage(Convert.ToInt32(instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber) + changePage); |
1367 |
// }); |
1368 |
|
1369 |
//} |
1370 |
} |
1371 |
else |
1372 |
{ |
1373 |
e.Handled = true; |
1374 |
if (e.Delta > 0) |
1375 |
{ |
1376 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
1377 |
ZoomIn(currentContentMousePoint); |
1378 |
} |
1379 |
else |
1380 |
{ |
1381 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
1382 |
ZoomOut(currentContentMousePoint); |
1383 |
} |
1384 |
} |
1385 |
} |
1386 |
|
1387 |
private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e) |
1388 |
{ |
1389 |
e.Handled = true; |
1390 |
if (e.Delta > 0) |
1391 |
{ |
1392 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
1393 |
ZoomIn_Sync(currentContentMousePoint); |
1394 |
} |
1395 |
else |
1396 |
{ |
1397 |
Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
1398 |
ZoomOut_Sync(currentContentMousePoint); |
1399 |
} |
1400 |
} |
1401 |
|
1402 |
#region ZoomIn & ZoomOut |
1403 |
|
1404 |
private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e) |
1405 |
{ |
1406 |
ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX, |
1407 |
zoomAndPanControl.ContentZoomFocusY)); |
1408 |
} |
1409 |
|
1410 |
private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e) |
1411 |
{ |
1412 |
ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX, |
1413 |
zoomAndPanControl.ContentZoomFocusY)); |
1414 |
} |
1415 |
|
1416 |
//강인구 추가 (줌 인아웃 수치 변경) |
1417 |
//큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼 |
1418 |
private void ZoomOut(Point contentZoomCenter) |
1419 |
{ |
1420 |
if (zoomAndPanControl.ContentScale > 0.39) |
1421 |
{ |
1422 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter); |
1423 |
} |
1424 |
else |
1425 |
{ |
1426 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter); |
1427 |
} |
1428 |
|
1429 |
if (zoomAndPanControl2 != null && Sync.IsChecked) |
1430 |
{ |
1431 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1432 |
} |
1433 |
} |
1434 |
|
1435 |
private void ZoomIn(Point contentZoomCenter) |
1436 |
{ |
1437 |
if (zoomAndPanControl.ContentScale > 0.19) |
1438 |
{ |
1439 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter); |
1440 |
} |
1441 |
else |
1442 |
{ |
1443 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter); |
1444 |
} |
1445 |
|
1446 |
if (zoomAndPanControl2 != null && Sync.IsChecked) |
1447 |
{ |
1448 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1449 |
} |
1450 |
} |
1451 |
|
1452 |
private void ZoomOut_Sync(Point contentZoomCenter) |
1453 |
{ |
1454 |
if (zoomAndPanControl2.ContentScale > 0.39) |
1455 |
{ |
1456 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter); |
1457 |
} |
1458 |
else |
1459 |
{ |
1460 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter); |
1461 |
} |
1462 |
|
1463 |
if (Sync.IsChecked) |
1464 |
{ |
1465 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
1466 |
} |
1467 |
} |
1468 |
|
1469 |
private void ZoomIn_Sync(Point contentZoomCenter) |
1470 |
{ |
1471 |
if (zoomAndPanControl2.ContentScale > 0.19) |
1472 |
{ |
1473 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter); |
1474 |
} |
1475 |
else |
1476 |
{ |
1477 |
zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter); |
1478 |
} |
1479 |
|
1480 |
if (Sync.IsChecked) |
1481 |
{ |
1482 |
zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
1483 |
} |
1484 |
} |
1485 |
|
1486 |
private void ZoomOut() |
1487 |
{ |
1488 |
zoomAndPanControl.ContentScale -= 0.1; |
1489 |
//if (zoomAndPanControl2 != null) |
1490 |
//{ |
1491 |
// zoomAndPanControl2.ContentScale -= 0.1; |
1492 |
//} |
1493 |
} |
1494 |
|
1495 |
private void ZoomIn() |
1496 |
{ |
1497 |
zoomAndPanControl.ContentScale += 0.1; |
1498 |
//if (zoomAndPanControl2 != null) |
1499 |
//{ |
1500 |
// zoomAndPanControl2.ContentScale += 0.1; |
1501 |
//} |
1502 |
} |
1503 |
|
1504 |
#endregion ZoomIn & ZoomOut |
1505 |
|
1506 |
public void init() |
1507 |
{ |
1508 |
foreach (var item in ViewerDataModel.Instance.MarkupControls) |
1509 |
{ |
1510 |
ControlList.Clear(); |
1511 |
listBox.Items.Clear(); |
1512 |
selected_item.Clear(); |
1513 |
|
1514 |
(item as IMarkupCommonData).IsSelected = false; |
1515 |
} |
1516 |
} |
1517 |
|
1518 |
private HitTestResultBehavior MyCallback(HitTestResult result) |
1519 |
{ |
1520 |
//this.cursor = Cursors.UpArrow; |
1521 |
var element = result.VisualHit; |
1522 |
while (element != null && !(element is CommentUserInfo)) |
1523 |
element = VisualTreeHelper.GetParent(element); |
1524 |
|
1525 |
if (element == null) |
1526 |
{ |
1527 |
return HitTestResultBehavior.Stop; |
1528 |
} |
1529 |
else |
1530 |
{ |
1531 |
if (element is CommentUserInfo) |
1532 |
{ |
1533 |
if (!hitList.Contains(element)) |
1534 |
{ |
1535 |
hitList.Add((CommentUserInfo)element); |
1536 |
} |
1537 |
else |
1538 |
{ |
1539 |
return HitTestResultBehavior.Stop; |
1540 |
} |
1541 |
} |
1542 |
} |
1543 |
return HitTestResultBehavior.Continue; |
1544 |
} |
1545 |
|
1546 |
public void ReleaseSelectPath() |
1547 |
{ |
1548 |
if (SelectionPath == null) |
1549 |
{ |
1550 |
SelectionPath = new Path(); |
1551 |
SelectionPath.Name = ""; |
1552 |
} |
1553 |
if (SelectionPath.Name != "") |
1554 |
{ |
1555 |
SelectionPath.Name = "None"; |
1556 |
} |
1557 |
SelectionPath.Opacity = 0.01; |
1558 |
SelectionPath.RenderTransform = null; |
1559 |
SelectionPath.RenderTransformOrigin = new Point(0, 0); |
1560 |
} |
1561 |
|
1562 |
#region 컨트롤 초기화 |
1563 |
|
1564 |
public void Control_Init(object control) |
1565 |
{ |
1566 |
if (L_Size != 0 && (control as IPath) != null) |
1567 |
{ |
1568 |
(control as IPath).LineSize = L_Size; |
1569 |
L_Size = 0; |
1570 |
} |
1571 |
|
1572 |
switch (control.GetType().Name) |
1573 |
{ |
1574 |
case "RectangleControl": |
1575 |
{ |
1576 |
(control as RectangleControl).StrokeColor = Brushes.Red; |
1577 |
} |
1578 |
break; |
1579 |
|
1580 |
case "CircleControl": |
1581 |
{ |
1582 |
(control as CircleControl).StrokeColor = Brushes.Red; |
1583 |
} |
1584 |
break; |
1585 |
|
1586 |
case "TriControl": |
1587 |
{ |
1588 |
(control as TriControl).StrokeColor = Brushes.Red; |
1589 |
} |
1590 |
break; |
1591 |
|
1592 |
case "RectCloudControl": |
1593 |
{ |
1594 |
(control as RectCloudControl).StrokeColor = Brushes.Red; |
1595 |
} |
1596 |
break; |
1597 |
|
1598 |
case "CloudControl": |
1599 |
{ |
1600 |
(control as CloudControl).StrokeColor = Brushes.Red; |
1601 |
} |
1602 |
break; |
1603 |
|
1604 |
case "PolygonControl": |
1605 |
{ |
1606 |
(control as PolygonControl).StrokeColor = Brushes.Red; |
1607 |
} |
1608 |
break; |
1609 |
|
1610 |
case "ArcControl": |
1611 |
{ |
1612 |
(control as ArcControl).StrokeColor = Brushes.Red; |
1613 |
} |
1614 |
break; |
1615 |
|
1616 |
case "ArrowArcControl": |
1617 |
{ |
1618 |
(control as ArrowArcControl).StrokeColor = Brushes.Red; |
1619 |
} |
1620 |
break; |
1621 |
|
1622 |
case "LineControl": |
1623 |
{ |
1624 |
(control as LineControl).StrokeColor = Brushes.Red; |
1625 |
} |
1626 |
break; |
1627 |
|
1628 |
case "ArrowControl_Multi": |
1629 |
{ |
1630 |
(control as ArrowControl_Multi).StrokeColor = Brushes.Red; |
1631 |
} |
1632 |
break; |
1633 |
|
1634 |
case "TextControl": |
1635 |
{ |
1636 |
(control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
1637 |
} |
1638 |
break; |
1639 |
|
1640 |
case "ArrowTextControl": |
1641 |
{ |
1642 |
(control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
1643 |
} |
1644 |
break; |
1645 |
|
1646 |
case "InsideWhiteControl": |
1647 |
{ |
1648 |
(control as InsideWhiteControl).StrokeColor = Brushes.White; |
1649 |
} |
1650 |
break; |
1651 |
|
1652 |
case "OverlapWhiteControl": |
1653 |
{ |
1654 |
(control as OverlapWhiteControl).StrokeColor = Brushes.White; |
1655 |
} |
1656 |
break; |
1657 |
|
1658 |
case "ClipWhiteControl": |
1659 |
{ |
1660 |
(control as ClipWhiteControl).StrokeColor = Brushes.White; |
1661 |
} |
1662 |
break; |
1663 |
|
1664 |
case "CoordinateControl": |
1665 |
{ |
1666 |
(control as CoordinateControl).StrokeColor = Brushes.Black; |
1667 |
} |
1668 |
break; |
1669 |
} |
1670 |
} |
1671 |
|
1672 |
#endregion 컨트롤 초기화 |
1673 |
|
1674 |
public void firstCondition_MouseLeave(object sender, MouseEventArgs e) |
1675 |
{ |
1676 |
//Control_Init(e.Source); |
1677 |
} |
1678 |
|
1679 |
//private Window _dragdropWindow = null; |
1680 |
|
1681 |
[DllImport("user32.dll")] |
1682 |
[return: MarshalAs(UnmanagedType.Bool)] |
1683 |
internal static extern bool GetCursorPos(ref Win32Point pt); |
1684 |
|
1685 |
[StructLayout(LayoutKind.Sequential)] |
1686 |
internal struct Win32Point |
1687 |
{ |
1688 |
public Int32 X; |
1689 |
public Int32 Y; |
1690 |
}; |
1691 |
|
1692 |
/* |
1693 |
public string symbol_id = null; |
1694 |
public long symbol_group_id; |
1695 |
public int symbol_SelectedIndex; |
1696 |
public ImageSource symbol_img; |
1697 |
public string symbol_Data = null; |
1698 |
public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img) |
1699 |
{ |
1700 |
PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, new Point(zoomAndPanCanvas.ActualWidth / 2, |
1701 |
zoomAndPanCanvas.ActualHeight / 2)); |
1702 |
|
1703 |
if (this._dragdropWindow != null) |
1704 |
{ |
1705 |
this._dragdropWindow.Close(); |
1706 |
this._dragdropWindow = null; |
1707 |
} |
1708 |
|
1709 |
symbol_id = id; |
1710 |
symbol_group_id = group_id; |
1711 |
symbol_SelectedIndex = SelectedIndex; |
1712 |
symbol_Data = Data_; |
1713 |
symbol_img = img; |
1714 |
|
1715 |
CreateDragDropWindow2(img); |
1716 |
} |
1717 |
|
1718 |
private void CreateDragDropWindow2(ImageSource image) |
1719 |
{ |
1720 |
this._dragdropWindow = new Window(); |
1721 |
_dragdropWindow.Cursor = new Cursor(App.DefaultArrowCursorStream); |
1722 |
_dragdropWindow.WindowStyle = WindowStyle.None; |
1723 |
_dragdropWindow.AllowsTransparency = true; |
1724 |
_dragdropWindow.AllowDrop = false; |
1725 |
_dragdropWindow.Background = null; |
1726 |
_dragdropWindow.IsHitTestVisible = false; |
1727 |
_dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight; |
1728 |
_dragdropWindow.Topmost = true; |
1729 |
_dragdropWindow.ShowInTaskbar = false; |
1730 |
|
1731 |
Rectangle r = new Rectangle(); |
1732 |
r.Width = image.Width; |
1733 |
r.Height = image.Height; |
1734 |
r.Opacity = 0.5; |
1735 |
r.Fill = new ImageBrush(image); |
1736 |
this._dragdropWindow.Content = r; |
1737 |
|
1738 |
Win32Point w32Mouse = new Win32Point(); |
1739 |
GetCursorPos(ref w32Mouse); |
1740 |
|
1741 |
//w32Mouse.X = getCurrentPoint.X; |
1742 |
this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2); |
1743 |
this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); |
1744 |
this._dragdropWindow.Show(); |
1745 |
} |
1746 |
|
1747 |
*/ |
1748 |
|
1749 |
public void MoveZoomAndPanControl(Vector dragOffset) |
1750 |
{ |
1751 |
zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
1752 |
zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
1753 |
|
1754 |
if (Sync.IsChecked) |
1755 |
{ |
1756 |
ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
1757 |
ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
1758 |
} |
1759 |
} |
1760 |
|
1761 |
private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
1762 |
{ |
1763 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch" |
1764 |
|| Common.ViewerDataModel.Instance.SelectedControl == "MACRO") |
1765 |
//if(this.txtBatch.Visibility == Visibility.Visible) |
1766 |
{ |
1767 |
if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; } |
1768 |
|
1769 |
Point currentPos = e.GetPosition(rect); |
1770 |
|
1771 |
floatingTip.HorizontalOffset = currentPos.X + 20; |
1772 |
floatingTip.VerticalOffset = currentPos.Y; |
1773 |
} |
1774 |
|
1775 |
getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
1776 |
|
1777 |
if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
1778 |
{ |
1779 |
SetCursor(); |
1780 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1781 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
1782 |
|
1783 |
Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1784 |
|
1785 |
MoveZoomAndPanControl(dragOffset); |
1786 |
} |
1787 |
|
1788 |
if (mouseHandlingMode == MouseHandlingMode.Drawing && currentControl != null) |
1789 |
{ |
1790 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1791 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
1792 |
SetCursor(); |
1793 |
|
1794 |
if (currentControl != null) |
1795 |
{ |
1796 |
double moveX = currentCanvasDrawingMouseMovePoint.X - CanvasDrawingMouseDownPoint.X; |
1797 |
double moveY = currentCanvasDrawingMouseMovePoint.Y - CanvasDrawingMouseDownPoint.Y; |
1798 |
//강인구 추가 |
1799 |
currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity; |
1800 |
|
1801 |
if ((currentControl as IPath) != null) |
1802 |
{ |
1803 |
(currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize; |
1804 |
} |
1805 |
if ((currentControl as LineControl) != null) |
1806 |
{ |
1807 |
(currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval; |
1808 |
} |
1809 |
|
1810 |
if ((currentControl as IShapeControl) != null) |
1811 |
{ |
1812 |
(currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet; |
1813 |
} |
1814 |
if (currentControl is TextControl TextCtrl) |
1815 |
{ |
1816 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
1817 |
{ |
1818 |
TextCtrl.TextStyle = FontStyles.Italic; |
1819 |
} |
1820 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
1821 |
{ |
1822 |
TextCtrl.TextWeight = FontWeights.Bold; |
1823 |
} |
1824 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
1825 |
{ |
1826 |
TextCtrl.UnderLine = TextDecorations.Underline; |
1827 |
} |
1828 |
|
1829 |
TextCtrl.ArcLength = ViewerDataModel.Instance.ArcLength; |
1830 |
} |
1831 |
else if ((currentControl as ArrowTextControl) != null) |
1832 |
{ |
1833 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
1834 |
{ |
1835 |
(currentControl as ArrowTextControl).TextStyle = FontStyles.Italic; |
1836 |
} |
1837 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
1838 |
{ |
1839 |
(currentControl as ArrowTextControl).TextWeight = FontWeights.Bold; |
1840 |
} |
1841 |
if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
1842 |
{ |
1843 |
(currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline; |
1844 |
} |
1845 |
} |
1846 |
else if (currentControl is RectCloudControl RectCloudCtrl) |
1847 |
{ |
1848 |
RectCloudCtrl.ArcLength = ViewerDataModel.Instance.ArcLength; |
1849 |
} |
1850 |
else if (currentControl is CloudControl CloudCtrl) |
1851 |
{ |
1852 |
CloudCtrl.ArcLength = ViewerDataModel.Instance.ArcLength; |
1853 |
} |
1854 |
|
1855 |
#region // 모든 컨트롤의 공통기능 제어 |
1856 |
|
1857 |
if (controlType != ControlType.PenControl) |
1858 |
{ |
1859 |
currentControl.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift); |
1860 |
|
1861 |
|
1862 |
if(currentControl is MarkupToPDF.Controls.Polygon.PolygonControl && ((MarkupToPDF.Controls.Polygon.PolygonControl)currentControl).IsCompleted) |
1863 |
{ |
1864 |
var vControl = currentControl as MarkupToPDF.Controls.Polygon.PolygonControl; |
1865 |
var firstPoint = vControl.PointSet.First(); |
1866 |
vControl.DashSize = ViewerDataModel.Instance.DashSize; |
1867 |
vControl.LineSize = ViewerDataModel.Instance.LineSize; |
1868 |
vControl.PointSet.Add(firstPoint); |
1869 |
|
1870 |
vControl.ApplyOverViewData(); |
1871 |
|
1872 |
CreateCommand.Instance.Execute(currentControl); |
1873 |
vControl.UpdateControl(); |
1874 |
currentControl = null; |
1875 |
} |
1876 |
else if(currentControl is MarkupToPDF.Controls.Polygon.CloudControl && ((MarkupToPDF.Controls.Polygon.CloudControl)currentControl).IsCompleted) |
1877 |
{ |
1878 |
var vControl = currentControl as MarkupToPDF.Controls.Polygon.CloudControl; |
1879 |
|
1880 |
CreateCommand.Instance.Execute(currentControl); |
1881 |
|
1882 |
vControl.isTransOn = true; |
1883 |
var firstPoint = vControl.PointSet.First(); |
1884 |
|
1885 |
vControl.PointSet.Add(firstPoint); |
1886 |
vControl.DrawingCloud(); |
1887 |
vControl.ApplyOverViewData(); |
1888 |
|
1889 |
currentControl = null; |
1890 |
} |
1891 |
|
1892 |
ViewerDataModel.Instance.IsMarkupUpdate = true; |
1893 |
} |
1894 |
|
1895 |
#endregion // 모든 컨트롤의 공통기능 제어 |
1896 |
|
1897 |
#region // 각 컨트롤의 특별한 기능을 제어한다. |
1898 |
|
1899 |
switch (controlType) |
1900 |
{ |
1901 |
case (ControlType.Coordinate): |
1902 |
{ |
1903 |
var control = currentControl as CoordinateControl; |
1904 |
if (control != null) |
1905 |
{ |
1906 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1907 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1908 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1909 |
} |
1910 |
} |
1911 |
break; |
1912 |
|
1913 |
case (ControlType.InsideWhite): |
1914 |
{ |
1915 |
var control = currentControl as InsideWhiteControl; |
1916 |
if (control != null) |
1917 |
{ |
1918 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1919 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1920 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1921 |
control.Paint = PaintSet.Fill; |
1922 |
} |
1923 |
} |
1924 |
break; |
1925 |
|
1926 |
case ControlType.OverlapWhite: |
1927 |
{ |
1928 |
var control = currentControl as OverlapWhiteControl; |
1929 |
if (control != null) |
1930 |
{ |
1931 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1932 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1933 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1934 |
control.Paint = PaintSet.Fill; |
1935 |
} |
1936 |
} |
1937 |
break; |
1938 |
|
1939 |
case ControlType.ClipWhite: |
1940 |
{ |
1941 |
var control = currentControl as ClipWhiteControl; |
1942 |
if (control != null) |
1943 |
{ |
1944 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1945 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1946 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1947 |
control.Paint = PaintSet.Fill; |
1948 |
} |
1949 |
} |
1950 |
break; |
1951 |
|
1952 |
case ControlType.RectCloud: |
1953 |
{ |
1954 |
var control = currentControl as RectCloudControl; |
1955 |
if (control != null) |
1956 |
{ |
1957 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1958 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1959 |
control.Paint = ViewerDataModel.Instance.paintSet; |
1960 |
} |
1961 |
} |
1962 |
break; |
1963 |
|
1964 |
case ControlType.SingleLine: |
1965 |
case ControlType.CancelLine: |
1966 |
case ControlType.ArrowLine: |
1967 |
case ControlType.TwinLine: |
1968 |
case ControlType.DimLine: |
1969 |
{ |
1970 |
var control = currentControl as LineControl; |
1971 |
if (control != null) |
1972 |
{ |
1973 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1974 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1975 |
} |
1976 |
} |
1977 |
break; |
1978 |
|
1979 |
case ControlType.ArcLine: |
1980 |
{ |
1981 |
var control = currentControl as ArcControl; |
1982 |
if (control != null) |
1983 |
{ |
1984 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1985 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1986 |
} |
1987 |
} |
1988 |
break; |
1989 |
|
1990 |
case ControlType.ArcArrow: |
1991 |
{ |
1992 |
var control = currentControl as ArrowArcControl; |
1993 |
if (control != null) |
1994 |
{ |
1995 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1996 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
1997 |
} |
1998 |
} |
1999 |
break; |
2000 |
|
2001 |
case ControlType.ArrowMultiLine: |
2002 |
{ |
2003 |
var control = currentControl as ArrowControl_Multi; |
2004 |
if (control != null) |
2005 |
{ |
2006 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2007 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2008 |
} |
2009 |
} |
2010 |
break; |
2011 |
|
2012 |
case ControlType.Circle: |
2013 |
{ |
2014 |
var control = currentControl as CircleControl; |
2015 |
|
2016 |
if (control != null) |
2017 |
{ |
2018 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2019 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2020 |
control.Paint = ViewerDataModel.Instance.paintSet; |
2021 |
} |
2022 |
} |
2023 |
break; |
2024 |
|
2025 |
case ControlType.PolygonCloud: |
2026 |
{ |
2027 |
var control = currentControl as CloudControl; |
2028 |
if (control != null) |
2029 |
{ |
2030 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2031 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2032 |
control.Paint = ViewerDataModel.Instance.paintSet; |
2033 |
} |
2034 |
} |
2035 |
break; |
2036 |
|
2037 |
case ControlType.Triangle: |
2038 |
{ |
2039 |
var control = currentControl as TriControl; |
2040 |
if (control != null) |
2041 |
{ |
2042 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2043 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2044 |
control.Paint = ViewerDataModel.Instance.paintSet; |
2045 |
} |
2046 |
} |
2047 |
break; |
2048 |
|
2049 |
case ControlType.ImgControl: |
2050 |
{ |
2051 |
var control = currentControl as ImgControl; |
2052 |
if (control != null) |
2053 |
{ |
2054 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2055 |
} |
2056 |
} |
2057 |
break; |
2058 |
|
2059 |
case ControlType.Date: |
2060 |
{ |
2061 |
var control = currentControl as DateControl; |
2062 |
if (control != null) |
2063 |
{ |
2064 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2065 |
} |
2066 |
} |
2067 |
break; |
2068 |
|
2069 |
case ControlType.ArrowTextControl: |
2070 |
case ControlType.ArrowTransTextControl: |
2071 |
case ControlType.ArrowTextBorderControl: |
2072 |
case ControlType.ArrowTransTextBorderControl: |
2073 |
case ControlType.ArrowTextCloudControl: |
2074 |
case ControlType.ArrowTransTextCloudControl: |
2075 |
{ |
2076 |
var control = currentControl as ArrowTextControl; |
2077 |
if (control != null) |
2078 |
{ |
2079 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2080 |
} |
2081 |
} |
2082 |
break; |
2083 |
|
2084 |
case ControlType.PolygonControl: |
2085 |
case ControlType.ChainLine: |
2086 |
{ |
2087 |
var control = currentControl as PolygonControl; |
2088 |
if (control != null) |
2089 |
{ |
2090 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2091 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2092 |
control.Paint = ViewerDataModel.Instance.paintSet; |
2093 |
} |
2094 |
} |
2095 |
break; |
2096 |
|
2097 |
case ControlType.Sign: |
2098 |
{ |
2099 |
var control = currentControl as SignControl; |
2100 |
if (control != null) |
2101 |
{ |
2102 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2103 |
} |
2104 |
} |
2105 |
break; |
2106 |
|
2107 |
case ControlType.Symbol: |
2108 |
{ |
2109 |
var control = currentControl as SymControl; |
2110 |
if (control != null) |
2111 |
{ |
2112 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2113 |
} |
2114 |
} |
2115 |
break; |
2116 |
|
2117 |
case ControlType.Stamp: |
2118 |
{ |
2119 |
var control = currentControl as SymControlN; |
2120 |
if (control != null) |
2121 |
{ |
2122 |
if (control.STAMP != null) |
2123 |
{ |
2124 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2125 |
} |
2126 |
else |
2127 |
{ |
2128 |
currentControl = null; |
2129 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2130 |
DialogMessage_Alert("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "안내"); |
2131 |
} |
2132 |
} |
2133 |
} |
2134 |
break; |
2135 |
|
2136 |
case ControlType.Rectangle: |
2137 |
case ControlType.Mark: |
2138 |
{ |
2139 |
var control = currentControl as RectangleControl; |
2140 |
if (control != null) |
2141 |
{ |
2142 |
//control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
2143 |
if (control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill; |
2144 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
2145 |
} |
2146 |
} |
2147 |
break; |
2148 |
|
2149 |
case ControlType.PenControl: |
2150 |
{ |
2151 |
stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
2152 |
//inkBoard.Strokes.Add(stroke); |
2153 |
} |
2154 |
break; |
2155 |
|
2156 |
default: |
2157 |
break; |
2158 |
} |
2159 |
|
2160 |
#endregion // 각 컨트롤의 특별한 기능을 제어한다. |
2161 |
|
2162 |
if (ViewerDataModel.Instance.MarkupAngleVisibility == Visibility.Visible) |
2163 |
{ |
2164 |
ViewerDataModel.Instance.MarkupAngle = currentControl.CommentAngle; |
2165 |
} |
2166 |
} |
2167 |
} |
2168 |
else if (mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed) |
2169 |
{ |
2170 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
2171 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
2172 |
SetCursor(); |
2173 |
if (currentControl == null) |
2174 |
{ |
2175 |
switch (controlType) |
2176 |
{ |
2177 |
case ControlType.PenControl: |
2178 |
{ |
2179 |
if (inkBoard.Tag.ToString() == "Ink") |
2180 |
{ |
2181 |
stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
2182 |
} |
2183 |
else if (inkBoard.Tag.ToString() == "EraseByPoint") |
2184 |
{ |
2185 |
RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
2186 |
} |
2187 |
else if (inkBoard.Tag.ToString() == "EraseByStroke") |
2188 |
{ |
2189 |
RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
2190 |
} |
2191 |
|
2192 |
//inkBoard.Strokes.Add(stroke); |
2193 |
} |
2194 |
break; |
2195 |
} |
2196 |
return; |
2197 |
} |
2198 |
} |
2199 |
else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || |
2200 |
((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || |
2201 |
((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom)) |
2202 |
{ |
2203 |
Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
2204 |
|
2205 |
if (isDraggingSelectionRect) |
2206 |
{ |
2207 |
UpdateDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint); |
2208 |
e.Handled = true; |
2209 |
} |
2210 |
else if (isLeftMouseButtonDownOnWindow) |
2211 |
{ |
2212 |
var dragDelta = curMouseDownPoint - CanvasDrawingMouseDownPoint; |
2213 |
double dragDistance = Math.Abs(dragDelta.Length); |
2214 |
|
2215 |
if (dragDistance > DragThreshold) |
2216 |
{ |
2217 |
isDraggingSelectionRect = true; |
2218 |
InitDragSelectionRect(CanvasDrawingMouseDownPoint, curMouseDownPoint); |
2219 |
} |
2220 |
|
2221 |
e.Handled = true; |
2222 |
} |
2223 |
|
2224 |
if (CanvasDrawingMouseDownPoint == curMouseDownPoint) |
2225 |
{ |
2226 |
} |
2227 |
else |
2228 |
{ |
2229 |
e.Handled = true; |
2230 |
} |
2231 |
} |
2232 |
/* |
2233 |
else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol) |
2234 |
{ //symbol |
2235 |
if(_dragdropWindow != null) |
2236 |
{ |
2237 |
Win32Point w32Mouse = new Win32Point(); |
2238 |
GetCursorPos(ref w32Mouse); |
2239 |
|
2240 |
this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2); |
2241 |
this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2); |
2242 |
} |
2243 |
} |
2244 |
*/ |
2245 |
else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && |
2246 |
(e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
2247 |
{ |
2248 |
//var comment = drawingRotateCanvas.FindDistanceComment(getCurrentPoint); |
2249 |
|
2250 |
|
2251 |
//if (comment != null) |
2252 |
//{ |
2253 |
// comment.IsMouseEnter = true; |
2254 |
|
2255 |
// if (enterMouse != comment) |
2256 |
// { |
2257 |
// if (enterMouse != null) |
2258 |
// enterMouse.IsSelected = false; |
2259 |
|
2260 |
// enterMouse = comment; |
2261 |
// } |
2262 |
//} |
2263 |
//else |
2264 |
//{ |
2265 |
// if(enterMouse != null) |
2266 |
// enterMouse.IsSelected = false; |
2267 |
//} |
2268 |
|
2269 |
|
2270 |
var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault(); |
2271 |
if (control != null) |
2272 |
{ |
2273 |
this.cursor = Cursors.Hand; |
2274 |
SetCursor(); |
2275 |
} |
2276 |
else |
2277 |
{ |
2278 |
if (this.Cursor != Cursors.None) |
2279 |
{ |
2280 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2281 |
SetCursor(); |
2282 |
} |
2283 |
} |
2284 |
} |
2285 |
else |
2286 |
{ |
2287 |
|
2288 |
} |
2289 |
} |
2290 |
|
2291 |
private CommentUserInfo enterMouse = null; |
2292 |
|
2293 |
private object IntersectsControls(Point mousePosition,Canvas drawingRotateCanvas) |
2294 |
{ |
2295 |
object result = null; |
2296 |
|
2297 |
// 검색할 정사각형의 크기 및 반경 설정 |
2298 |
double squareSize = 1; |
2299 |
Rect searchRect = new Rect( |
2300 |
mousePosition.X - squareSize, |
2301 |
mousePosition.Y - squareSize, |
2302 |
squareSize * 2, |
2303 |
squareSize * 2 |
2304 |
); |
2305 |
|
2306 |
foreach (CommentUserInfo child in drawingRotateCanvas.ChildrenOfType<CommentUserInfo>()) |
2307 |
{ |
2308 |
if (child is CommentUserInfo comment) |
2309 |
{ |
2310 |
// 검색 영역과 Rectangle의 경계가 겹치는지 확인합니다. |
2311 |
if (searchRect.IntersectsWith(child.ItemRect)) |
2312 |
{ |
2313 |
child.IsMouseEnter = true; |
2314 |
result = (object)child; |
2315 |
// Geometry를 적용하거나 원하는 작업을 수행합니다. |
2316 |
// 예: rectangle.Fill = new SolidColorBrush(Colors.Red); |
2317 |
} |
2318 |
else |
2319 |
{ |
2320 |
child.IsMouseEnter = false; |
2321 |
} |
2322 |
} |
2323 |
} |
2324 |
|
2325 |
return result; |
2326 |
} |
2327 |
|
2328 |
private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e) |
2329 |
{ |
2330 |
if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
2331 |
{ |
2332 |
SetCursor(); |
2333 |
Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2); |
2334 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2); |
2335 |
|
2336 |
Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
2337 |
|
2338 |
ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X; |
2339 |
ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y; |
2340 |
|
2341 |
if (Sync.IsChecked) |
2342 |
{ |
2343 |
zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX; |
2344 |
zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY; |
2345 |
} |
2346 |
} |
2347 |
} |
2348 |
|
2349 |
private List<CommentUserInfo> hitList = new List<CommentUserInfo>(); |
2350 |
|
2351 |
private EllipseGeometry hitArea = new EllipseGeometry(); |
2352 |
|
2353 |
private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e) |
2354 |
{ |
2355 |
IsDrawing = false; |
2356 |
|
2357 |
if (mouseHandlingMode != MouseHandlingMode.None) |
2358 |
{ |
2359 |
if (mouseHandlingMode == MouseHandlingMode.Drawing) |
2360 |
{ |
2361 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2362 |
|
2363 |
SetCursor(); |
2364 |
|
2365 |
switch (controlType) |
2366 |
{ |
2367 |
case ControlType.None: |
2368 |
break; |
2369 |
|
2370 |
case ControlType.Rectangle: |
2371 |
{ |
2372 |
} |
2373 |
break; |
2374 |
|
2375 |
case ControlType.PenControl: |
2376 |
{ |
2377 |
} |
2378 |
break; |
2379 |
|
2380 |
default: |
2381 |
break; |
2382 |
} |
2383 |
} |
2384 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left) |
2385 |
{ |
2386 |
if (isLeftMouseButtonDownOnWindow) |
2387 |
{ |
2388 |
bool wasDragSelectionApplied = false; |
2389 |
|
2390 |
if (isDraggingSelectionRect) |
2391 |
{ |
2392 |
if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl) |
2393 |
{ |
2394 |
dragCaptureBorder.Visibility = Visibility.Collapsed; |
2395 |
mouseHandlingMode = MouseHandlingMode.None; |
2396 |
Point endPoint = e.GetPosition(zoomAndPanCanvas); |
2397 |
symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex; |
2398 |
Set_Symbol_Capture(endPoint); |
2399 |
ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
2400 |
ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
2401 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
2402 |
} |
2403 |
else if (mouseHandlingMode == MouseHandlingMode.Capture) |
2404 |
{ |
2405 |
dragCaptureBorder.Visibility = Visibility.Collapsed; |
2406 |
mouseHandlingMode = MouseHandlingMode.None; |
2407 |
Set_Capture(); |
2408 |
|
2409 |
ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
2410 |
ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
2411 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
2412 |
} |
2413 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2414 |
{ |
2415 |
ApplyDragSelectionRect(); |
2416 |
} |
2417 |
else |
2418 |
{ |
2419 |
double x = Canvas.GetLeft(dragZoomBorder); |
2420 |
double y = Canvas.GetTop(dragZoomBorder); |
2421 |
double width = dragZoomBorder.Width; |
2422 |
double height = dragZoomBorder.Height; |
2423 |
Rect dragRect = new Rect(x, y, width, height); |
2424 |
|
2425 |
ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect); |
2426 |
|
2427 |
dragZoomBorder.Visibility = Visibility.Collapsed; |
2428 |
} |
2429 |
|
2430 |
isDraggingSelectionRect = false; |
2431 |
e.Handled = true; |
2432 |
wasDragSelectionApplied = true; |
2433 |
} |
2434 |
|
2435 |
if (isLeftMouseButtonDownOnWindow) |
2436 |
{ |
2437 |
isLeftMouseButtonDownOnWindow = false; |
2438 |
this.ReleaseMouseCapture(); |
2439 |
e.Handled = true; |
2440 |
} |
2441 |
|
2442 |
if (!wasDragSelectionApplied) |
2443 |
{ |
2444 |
init(); |
2445 |
} |
2446 |
} |
2447 |
} |
2448 |
else if (e.RightButton == MouseButtonState.Pressed) |
2449 |
{ |
2450 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2451 |
SetCursor(); |
2452 |
} |
2453 |
|
2454 |
zoomAndPanControl.ReleaseMouseCapture(); |
2455 |
|
2456 |
e.Handled = true; |
2457 |
} |
2458 |
else |
2459 |
{ |
2460 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2461 |
SetCursor(); |
2462 |
} |
2463 |
|
2464 |
///mouseButtonDown = MouseButton.Left; |
2465 |
//controlType = ControlType.SingleLine; |
2466 |
} |
2467 |
|
2468 |
public void Set_Symbol_Capture(Point endPoint) |
2469 |
{ |
2470 |
double x = CanvasDrawingMouseDownPoint.X; |
2471 |
double y = CanvasDrawingMouseDownPoint.Y; |
2472 |
if (x > endPoint.X) |
2473 |
{ |
2474 |
x = endPoint.X; |
2475 |
y = endPoint.Y; |
2476 |
} |
2477 |
|
2478 |
double width = dragCaptureBorder.Width; |
2479 |
double height = dragCaptureBorder.Height; |
2480 |
|
2481 |
canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
2482 |
|
2483 |
if (x < 0) |
2484 |
{ |
2485 |
width += x; |
2486 |
x = 0; |
2487 |
} |
2488 |
if (y < 0) |
2489 |
{ |
2490 |
height += y; |
2491 |
y = 0; |
2492 |
|
2493 |
width = (int)canvasImage.PixelWidth - x; |
2494 |
} |
2495 |
if (x + width > canvasImage.PixelWidth) |
2496 |
{ |
2497 |
width = (int)canvasImage.PixelWidth - x; |
2498 |
} |
2499 |
if (y + height > canvasImage.PixelHeight) |
2500 |
{ |
2501 |
height = (int)canvasImage.PixelHeight - y; |
2502 |
} |
2503 |
var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height); |
2504 |
|
2505 |
string uri = this.GetImageURL(_ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber); |
2506 |
var defaultBitmapImage = new BitmapImage(); |
2507 |
defaultBitmapImage.BeginInit(); |
2508 |
defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
2509 |
defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
2510 |
defaultBitmapImage.UriSource = new Uri(uri); |
2511 |
defaultBitmapImage.EndInit(); |
2512 |
|
2513 |
//GC.Collect(); |
2514 |
|
2515 |
if (defaultBitmapImage.IsDownloading) |
2516 |
{ |
2517 |
defaultBitmapImage.DownloadCompleted += (ex, arg) => |
2518 |
{ |
2519 |
defaultBitmapImage.Freeze(); |
2520 |
//GC.Collect(); |
2521 |
BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect); |
2522 |
Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height); |
2523 |
}; |
2524 |
} |
2525 |
} |
2526 |
|
2527 |
private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e) |
2528 |
{ |
2529 |
///mouseButtonDown = MouseButton.Left; |
2530 |
} |
2531 |
|
2532 |
private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e) |
2533 |
{ |
2534 |
///mouseButtonDown = MouseButton.Left; |
2535 |
//this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2536 |
} |
2537 |
|
2538 |
private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
2539 |
{ |
2540 |
} |
2541 |
|
2542 |
/// <summary> |
2543 |
/// select items by dragging |
2544 |
/// </summary> |
2545 |
private void ApplyDragSelectionRect() |
2546 |
{ |
2547 |
dragSelectionBorder.Visibility = Visibility.Collapsed; |
2548 |
|
2549 |
double x = Canvas.GetLeft(dragSelectionBorder); |
2550 |
double y = Canvas.GetTop(dragSelectionBorder); |
2551 |
double width = dragSelectionBorder.Width; |
2552 |
double height = dragSelectionBorder.Height; |
2553 |
Boolean Flag = false; |
2554 |
List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
2555 |
var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList(); |
2556 |
|
2557 |
Rect dragRect = new Rect(x, y, width, height); |
2558 |
///dragRect.Inflate(width / 10, height / 10); |
2559 |
|
2560 |
foreach (var item in Items) |
2561 |
{ |
2562 |
Flag = SelectionSet.Instance.SelectControl(item, dragRect); |
2563 |
|
2564 |
if (Flag) |
2565 |
{ |
2566 |
adornerSet.Add(item); |
2567 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
2568 |
Control_Style(item); |
2569 |
} |
2570 |
} |
2571 |
if (adornerSet.Count > 0) |
2572 |
{ |
2573 |
Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
2574 |
SelectLayer.Children.Add(final); |
2575 |
} |
2576 |
} |
2577 |
|
2578 |
private void InitDragSelectionRect(Point pt1, Point pt2) |
2579 |
{ |
2580 |
//캡쳐 중 |
2581 |
if (mouseHandlingMode == MouseHandlingMode.Capture) |
2582 |
{ |
2583 |
dragCaptureBorder.Visibility = Visibility.Visible; |
2584 |
} |
2585 |
//선택 중 |
2586 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2587 |
{ |
2588 |
dragSelectionBorder.Visibility = Visibility.Visible; |
2589 |
} |
2590 |
else |
2591 |
{ |
2592 |
dragZoomBorder.Visibility = Visibility.Visible; |
2593 |
} |
2594 |
UpdateDragSelectionRect(pt1, pt2); |
2595 |
} |
2596 |
|
2597 |
/// <summary> |
2598 |
/// Update the position and size of the rectangle used for drag selection. |
2599 |
/// </summary> |
2600 |
private void UpdateDragSelectionRect(Point pt1, Point pt2) |
2601 |
{ |
2602 |
double x, y, width, height; |
2603 |
|
2604 |
// |
2605 |
// Determine x,y,width and height of the rect inverting the points if necessary. |
2606 |
// |
2607 |
|
2608 |
if (pt2.X < pt1.X) |
2609 |
{ |
2610 |
x = pt2.X; |
2611 |
width = pt1.X - pt2.X; |
2612 |
} |
2613 |
else |
2614 |
{ |
2615 |
x = pt1.X; |
2616 |
width = pt2.X - pt1.X; |
2617 |
} |
2618 |
|
2619 |
if (pt2.Y < pt1.Y) |
2620 |
{ |
2621 |
y = pt2.Y; |
2622 |
height = pt1.Y - pt2.Y; |
2623 |
} |
2624 |
else |
2625 |
{ |
2626 |
y = pt1.Y; |
2627 |
height = pt2.Y - pt1.Y; |
2628 |
} |
2629 |
|
2630 |
// |
2631 |
// Update the coordinates of the rectangle used for drag selection. |
2632 |
// |
2633 |
//캡쳐 중 |
2634 |
if (mouseHandlingMode == MouseHandlingMode.Capture) |
2635 |
{ |
2636 |
Canvas.SetLeft(dragCaptureBorder, x); |
2637 |
Canvas.SetTop(dragCaptureBorder, y); |
2638 |
dragCaptureBorder.Width = width; |
2639 |
dragCaptureBorder.Height = height; |
2640 |
} |
2641 |
//선택 중 |
2642 |
else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2643 |
{ |
2644 |
Canvas.SetLeft(dragSelectionBorder, x); |
2645 |
Canvas.SetTop(dragSelectionBorder, y); |
2646 |
dragSelectionBorder.Width = width; |
2647 |
dragSelectionBorder.Height = height; |
2648 |
} |
2649 |
else |
2650 |
{ |
2651 |
Canvas.SetLeft(dragZoomBorder, x); |
2652 |
Canvas.SetTop(dragZoomBorder, y); |
2653 |
dragZoomBorder.Width = width; |
2654 |
dragZoomBorder.Height = height; |
2655 |
} |
2656 |
} |
2657 |
|
2658 |
private void drawingPannelRotate(double angle) |
2659 |
{ |
2660 |
Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
2661 |
rotate.Angle = angle; |
2662 |
var rotationNum = Math.Abs((rotate.Angle / 90)); |
2663 |
|
2664 |
if (angle == 90 || angle == 270) |
2665 |
{ |
2666 |
double emptySize = zoomAndPanCanvas.Width; |
2667 |
zoomAndPanCanvas.Width = zoomAndPanCanvas.Height; |
2668 |
zoomAndPanCanvas.Height = emptySize; |
2669 |
} |
2670 |
if (angle == 0) |
2671 |
{ |
2672 |
translate.X = 0; |
2673 |
translate.Y = 0; |
2674 |
} |
2675 |
else if (angle == 90) |
2676 |
{ |
2677 |
translate.X = zoomAndPanCanvas.Width; |
2678 |
translate.Y = 0; |
2679 |
} |
2680 |
else if (angle == 180) |
2681 |
{ |
2682 |
translate.X = zoomAndPanCanvas.Width; |
2683 |
translate.Y = zoomAndPanCanvas.Height; |
2684 |
} |
2685 |
else |
2686 |
{ |
2687 |
translate.X = 0; |
2688 |
translate.Y = zoomAndPanCanvas.Height; |
2689 |
} |
2690 |
|
2691 |
zoomAndPanControl.RotationAngle = rotate.Angle; |
2692 |
|
2693 |
if (!testPanel2.IsHidden) |
2694 |
{ |
2695 |
zoomAndPanControl2.RotationAngle = rotate.Angle; |
2696 |
zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width; |
2697 |
zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height; |
2698 |
} |
2699 |
|
2700 |
ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
2701 |
ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
2702 |
ViewerDataModel.Instance.AngleOffsetX = translate.X; |
2703 |
ViewerDataModel.Instance.AngleOffsetY = translate.Y; |
2704 |
ViewerDataModel.Instance.MarkupAngle = rotate.Angle; |
2705 |
} |
2706 |
|
2707 |
private void syncPannelRotate(double angle) |
2708 |
{ |
2709 |
//Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
2710 |
rotate.Angle = angle; |
2711 |
var rotationNum = Math.Abs((rotate.Angle / 90)); |
2712 |
|
2713 |
if (angle == 90 || angle == 270) |
2714 |
{ |
2715 |
double emptySize = zoomAndPanCanvas2.Width; |
2716 |
zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height; |
2717 |
zoomAndPanCanvas2.Height = emptySize; |
2718 |
} |
2719 |
if (angle == 0) |
2720 |
{ |
2721 |
translate2.X = 0; |
2722 |
translate2.Y = 0; |
2723 |
} |
2724 |
else if (angle == 90) |
2725 |
{ |
2726 |
translate2.X = zoomAndPanCanvas2.Width; |
2727 |
translate2.Y = 0; |
2728 |
} |
2729 |
else if (angle == 180) |
2730 |
{ |
2731 |
translate2.X = zoomAndPanCanvas2.Width; |
2732 |
translate2.Y = zoomAndPanCanvas2.Height; |
2733 |
} |
2734 |
else |
2735 |
{ |
2736 |
translate2.X = 0; |
2737 |
translate2.Y = zoomAndPanCanvas2.Height; |
2738 |
} |
2739 |
|
2740 |
zoomAndPanControl2.RotationAngle = rotate.Angle; |
2741 |
} |
2742 |
|
2743 |
public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint) |
2744 |
{ |
2745 |
string Data_ = ""; |
2746 |
|
2747 |
try |
2748 |
{ |
2749 |
//Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1); |
2750 |
Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex); |
2751 |
if (Data_ != null || Data_ != "") |
2752 |
{ |
2753 |
//Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
2754 |
} |
2755 |
else |
2756 |
{ |
2757 |
//Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
2758 |
} |
2759 |
|
2760 |
//MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
2761 |
//{ |
2762 |
// SYMBOL_ID = id,//InnerItem.Symbol_ID |
2763 |
// STATE = 0, |
2764 |
//}; |
2765 |
if (Data_ != null) |
2766 |
{ |
2767 |
Image img = new Image(); |
2768 |
//img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
2769 |
if (Data_.Contains(".svg")) |
2770 |
{ |
2771 |
SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(Data_); |
2772 |
img.Source = (DrawingImage)svgImage.ProvideValue(null); |
2773 |
} |
2774 |
else |
2775 |
{ |
2776 |
img.Source = new BitmapImage(new Uri(Data_)); |
2777 |
} |
2778 |
|
2779 |
var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
2780 |
{ |
2781 |
PointSet = new List<Point>(), |
2782 |
FilePath = Data_, |
2783 |
ImageData = img.Source, |
2784 |
StartPoint = canvasZoomPanningMouseDownPoint, |
2785 |
EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, |
2786 |
canvasZoomPanningMouseDownPoint.Y + img.Source.Height), |
2787 |
TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, |
2788 |
canvasZoomPanningMouseDownPoint.Y), |
2789 |
LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X, |
2790 |
canvasZoomPanningMouseDownPoint.Y + img.Source.Height) |
2791 |
}; |
2792 |
|
2793 |
currentControl.PointSet = new List<Point> |
2794 |
{ |
2795 |
currentControl.StartPoint, |
2796 |
currentControl.LeftBottomPoint, |
2797 |
currentControl.EndPoint, |
2798 |
currentControl.TopRightPoint, |
2799 |
}; |
2800 |
UndoData multi_UndoData = new UndoData(); |
2801 |
UndoDataGroup = new UndoDataGroup() |
2802 |
{ |
2803 |
IsUndo = false, |
2804 |
Event = EventType.Create, |
2805 |
EventTime = DateTime.Now, |
2806 |
MarkupDataColl = new List<UndoData>() |
2807 |
}; |
2808 |
ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
2809 |
{ |
2810 |
ViewerDataModel.Instance.UndoDataList.Remove(i); |
2811 |
}); |
2812 |
|
2813 |
//multi_UndoData = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2814 |
multi_UndoData = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2815 |
UndoDataGroup.MarkupDataColl.Add(multi_UndoData); |
2816 |
ViewerDataModel.Instance.UndoDataList.Add(UndoDataGroup); |
2817 |
|
2818 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2819 |
currentControl.CommentID = Commons.shortGuid(); |
2820 |
currentControl.SymbolID = id; |
2821 |
currentControl.GroupID = group_id; |
2822 |
currentControl.ApplyTemplate(); |
2823 |
currentControl.SetImage(); |
2824 |
|
2825 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2826 |
Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
2827 |
SelectLayer.Children.Add(final); |
2828 |
} |
2829 |
} |
2830 |
catch (Exception ex) |
2831 |
{ |
2832 |
this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
2833 |
} |
2834 |
} |
2835 |
|
2836 |
// 저장전 textbox 입력 완료 때문에 public로 하여 savecommand에서 호출하도록 임시로 함. |
2837 |
public async void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e) |
2838 |
{ |
2839 |
var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault(); |
2840 |
if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText)) |
2841 |
{ |
2842 |
set_option.Value = double.Parse(set_option.ContentText); |
2843 |
//set_option.Focusable = false; |
2844 |
zoomAndPanControl.Focus(); |
2845 |
} |
2846 |
|
2847 |
ConvertInkControlToPolygon(); |
2848 |
|
2849 |
// 텍스트가 없으면 삭제됨 |
2850 |
var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data => |
2851 |
(data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault(); |
2852 |
|
2853 |
if (text_item != null && (currentControl as ArrowTextControl) == null) |
2854 |
{ |
2855 |
UndoCommand.Instance.Push(EventType.Delete, new[] { text_item }); |
2856 |
} |
2857 |
|
2858 |
/// up to here |
2859 |
|
2860 |
foreach (var item in ViewerDataModel.Instance.MarkupControls_USER) |
2861 |
{ |
2862 |
if (item as ArrowTextControl != null) |
2863 |
{ |
2864 |
(item as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
2865 |
} |
2866 |
else if (item as TextControl != null) |
2867 |
{ |
2868 |
(item as TextControl).Base_TextBox.IsHitTestVisible = false; |
2869 |
} |
2870 |
} |
2871 |
|
2872 |
//if (currentControl != null) |
2873 |
{ |
2874 |
var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).IsEditingMode == true).FirstOrDefault(); |
2875 |
if (text_item_ != null) |
2876 |
{ |
2877 |
(text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible; |
2878 |
(text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed; |
2879 |
(text_item_ as TextControl).IsEditingMode = false; |
2880 |
currentControl = null; |
2881 |
} |
2882 |
|
2883 |
var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault(); |
2884 |
if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false)) |
2885 |
{ |
2886 |
(Arrowtext_item_ as ArrowTextControl).IsEditingMode = false; |
2887 |
(Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false; |
2888 |
currentControl = null; |
2889 |
} |
2890 |
} |
2891 |
|
2892 |
double Ang = 0; |
2893 |
if (rotate.Angle != 0) |
2894 |
{ |
2895 |
Ang = 360 - rotate.Angle; |
2896 |
} |
2897 |
|
2898 |
if (e.OriginalSource is System.Windows.Controls.Image) |
2899 |
{ |
2900 |
(e.OriginalSource as System.Windows.Controls.Image).Focus(); |
2901 |
} |
2902 |
/* |
2903 |
if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed) |
2904 |
{ |
2905 |
canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2906 |
if(symbol_id != null) |
2907 |
{ |
2908 |
PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint); |
2909 |
} |
2910 |
} |
2911 |
|
2912 |
if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed) |
2913 |
{ |
2914 |
if (this._dragdropWindow != null) |
2915 |
{ |
2916 |
this._dragdropWindow.Close(); |
2917 |
this._dragdropWindow = null; |
2918 |
symbol_id = null; |
2919 |
} |
2920 |
} |
2921 |
*/ |
2922 |
|
2923 |
if (e.LeftButton == MouseButtonState.Pressed) |
2924 |
{ |
2925 |
CanvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
2926 |
canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2927 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
2928 |
SetCursor(); |
2929 |
|
2930 |
if (!ViewerDataModel.Instance.IsPressCtrl) |
2931 |
{ |
2932 |
SelectionSet.Instance.UnSelect(this); |
2933 |
} |
2934 |
} |
2935 |
|
2936 |
if (e.MiddleButton == MouseButtonState.Pressed) |
2937 |
{ |
2938 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2939 |
cursor = Cursors.SizeAll; |
2940 |
SetCursor(); |
2941 |
} |
2942 |
if (e.RightButton == MouseButtonState.Pressed) |
2943 |
{ |
2944 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
2945 |
cursor = Cursors.SizeAll; |
2946 |
SetCursor(); |
2947 |
} |
2948 |
else if (e.XButton1 == MouseButtonState.Pressed) |
2949 |
{ |
2950 |
if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount) |
2951 |
{ |
2952 |
this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1); |
2953 |
} |
2954 |
|
2955 |
//this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber); |
2956 |
} |
2957 |
else if (e.XButton2 == MouseButtonState.Pressed) |
2958 |
{ |
2959 |
if (this.pageNavigator.CurrentPage.PageNumber > 1) |
2960 |
{ |
2961 |
this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1); |
2962 |
} |
2963 |
} |
2964 |
|
2965 |
bool isArrowTextEdit = false; |
2966 |
|
2967 |
if (currentControl is ArrowTextControl textControl) |
2968 |
{ |
2969 |
if (textControl.IsEditingMode) |
2970 |
isArrowTextEdit = true; |
2971 |
} |
2972 |
|
2973 |
if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null) |
2974 |
{ |
2975 |
if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2976 |
{ |
2977 |
if (SelectLayer.Children.Count == 0) |
2978 |
{ |
2979 |
isLeftMouseButtonDownOnWindow = true; |
2980 |
mouseHandlingMode = MouseHandlingMode.Selecting; |
2981 |
} |
2982 |
|
2983 |
if (controlType == ControlType.None) |
2984 |
{ |
2985 |
isLeftMouseButtonDownOnWindow = true; |
2986 |
} |
2987 |
} |
2988 |
|
2989 |
/// 캡쳐 모드 설정 |
2990 |
if (mouseHandlingMode == MouseHandlingMode.Capture) |
2991 |
{ |
2992 |
dragCaptureBorder.Visibility = Visibility.Visible; |
2993 |
isLeftMouseButtonDownOnWindow = true; |
2994 |
} |
2995 |
|
2996 |
/// 줌 모드 설정 |
2997 |
if (mouseHandlingMode == MouseHandlingMode.DragZoom) |
2998 |
{ |
2999 |
isLeftMouseButtonDownOnWindow = true; |
3000 |
} |
3001 |
|
3002 |
var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault(); |
3003 |
|
3004 |
if (control == null) |
3005 |
{ |
3006 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3007 |
} |
3008 |
else |
3009 |
{ |
3010 |
if (ControlTypeExtansions.LineTypes.Contains(control.ControlType)) |
3011 |
{ |
3012 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3013 |
} |
3014 |
|
3015 |
AdornerFinal final = null; |
3016 |
|
3017 |
if (!ViewerDataModel.Instance.IsPressCtrl) |
3018 |
{ |
3019 |
/// 기존 selection 해제 |
3020 |
SelectionSet.Instance.UnSelect(this); |
3021 |
|
3022 |
final = new AdornerFinal(control); |
3023 |
|
3024 |
this.Control_Style(control); |
3025 |
|
3026 |
if ((control as IPath) != null) |
3027 |
{ |
3028 |
if ((control as IPath).LineSize != 0) |
3029 |
{ |
3030 |
ViewerDataModel.Instance.LineSize = (control as IPath).LineSize; |
3031 |
} |
3032 |
} |
3033 |
if ((control as IShapeControl) != null) |
3034 |
{ |
3035 |
if ((control as IShapeControl).Paint == PaintSet.Hatch) |
3036 |
{ |
3037 |
ViewerDataModel.Instance.checkHatchShape = true; |
3038 |
} |
3039 |
else if ((control as IShapeControl).Paint == PaintSet.Fill) |
3040 |
{ |
3041 |
ViewerDataModel.Instance.checkFillShape = true; |
3042 |
} |
3043 |
else |
3044 |
{ |
3045 |
ViewerDataModel.Instance.checkHatchShape = false; |
3046 |
ViewerDataModel.Instance.checkFillShape = false; |
3047 |
} |
3048 |
ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint; |
3049 |
} |
3050 |
|
3051 |
ViewerDataModel.Instance.ControlOpacity = control.Opacity; |
3052 |
|
3053 |
if (control is TextControl TextCtrl) |
3054 |
{ |
3055 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont(TextCtrl.TextFamily); |
3056 |
|
3057 |
if (!(TextCtrl.EnableEditing)) |
3058 |
{ |
3059 |
TextCtrl.EnableEditing = true; |
3060 |
} |
3061 |
if (TextCtrl.TextStyle == FontStyles.Italic) |
3062 |
{ |
3063 |
ViewerDataModel.Instance.checkTextStyle = true; |
3064 |
} |
3065 |
else |
3066 |
{ |
3067 |
ViewerDataModel.Instance.checkTextStyle = false; |
3068 |
} |
3069 |
if (TextCtrl.TextWeight == FontWeights.Bold) |
3070 |
{ |
3071 |
ViewerDataModel.Instance.checkTextWeight = true; |
3072 |
} |
3073 |
else |
3074 |
{ |
3075 |
ViewerDataModel.Instance.checkTextWeight = false; |
3076 |
} |
3077 |
if (TextCtrl.UnderLine == TextDecorations.Underline) |
3078 |
{ |
3079 |
ViewerDataModel.Instance.checkUnderLine = true; |
3080 |
} |
3081 |
else |
3082 |
{ |
3083 |
ViewerDataModel.Instance.checkUnderLine = false; |
3084 |
} |
3085 |
ViewerDataModel.Instance.TextSize = TextCtrl.TextSize; |
3086 |
ViewerDataModel.Instance.checkHighlight = TextCtrl.IsHighLight; |
3087 |
ViewerDataModel.Instance.ArcLength = TextCtrl.ArcLength; |
3088 |
} |
3089 |
else if (control is ArrowTextControl ArrowTextCtrl) |
3090 |
{ |
3091 |
ViewerDataModel.Instance.SystemMain.dzTopMenu.SetFont((control as ArrowTextControl).TextFamily); |
3092 |
|
3093 |
if (!((control as ArrowTextControl).EnableEditing)) |
3094 |
{ |
3095 |
ArrowTextCtrl.EnableEditing = true; |
3096 |
} |
3097 |
if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
3098 |
{ |
3099 |
ViewerDataModel.Instance.checkTextStyle = true; |
3100 |
} |
3101 |
else |
3102 |
{ |
3103 |
ViewerDataModel.Instance.checkTextStyle = false; |
3104 |
} |
3105 |
if ((control as ArrowTextControl).TextWeight == FontWeights.Bold) |
3106 |
{ |
3107 |
ViewerDataModel.Instance.checkTextWeight = true; |
3108 |
} |
3109 |
else |
3110 |
{ |
3111 |
ViewerDataModel.Instance.checkTextWeight = false; |
3112 |
} |
3113 |
if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline) |
3114 |
{ |
3115 |
ViewerDataModel.Instance.checkUnderLine = true; |
3116 |
} |
3117 |
else |
3118 |
{ |
3119 |
ViewerDataModel.Instance.checkUnderLine = false; |
3120 |
} |
3121 |
ViewerDataModel.Instance.checkHighlight = ArrowTextCtrl.isHighLight; |
3122 |
ViewerDataModel.Instance.TextSize = ArrowTextCtrl.TextSize; |
3123 |
ViewerDataModel.Instance.ArcLength = ArrowTextCtrl.ArcLength; |
3124 |
} |
3125 |
else if (control is RectCloudControl RectCloudCtrl) |
3126 |
{ |
3127 |
ViewerDataModel.Instance.ArcLength = RectCloudCtrl.ArcLength; |
3128 |
} |
3129 |
else if (control is CloudControl CloudCtrl) |
3130 |
{ |
3131 |
ViewerDataModel.Instance.ArcLength = CloudCtrl.ArcLength; |
3132 |
} |
3133 |
} |
3134 |
else |
3135 |
{ |
3136 |
List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems; |
3137 |
SelectionSet.Instance.UnSelect(this); |
3138 |
comment.Add(control); |
3139 |
|
3140 |
Control_Style(control); |
3141 |
|
3142 |
final = new AdornerFinal(comment); |
3143 |
} |
3144 |
|
3145 |
if (final != null) |
3146 |
{ |
3147 |
this.SelectLayer.Children.Add(final); |
3148 |
} |
3149 |
} |
3150 |
} |
3151 |
else if (mouseHandlingMode == MouseHandlingMode.Drawing) |
3152 |
{ |
3153 |
init(); |
3154 |
//강인구 추가(우 클릭 일 경우 커서 변경 하지 않음) |
3155 |
if (cursor != Cursors.SizeAll) |
3156 |
{ |
3157 |
cursor = Cursors.Cross; |
3158 |
SetCursor(); |
3159 |
} |
3160 |
bool init_user = false; |
3161 |
foreach (var user in gridViewMarkup.Items) |
3162 |
{ |
3163 |
if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID) |
3164 |
{ |
3165 |
init_user = true; |
3166 |
} |
3167 |
} |
3168 |
if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed) |
3169 |
{ |
3170 |
// 기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요 |
3171 |
RadWindow.Alert(new DialogParameters |
3172 |
{ |
3173 |
Owner = Application.Current.MainWindow, |
3174 |
Theme = new VisualStudio2013Theme(), |
3175 |
Header = "Info", |
3176 |
Content = "Select a layer and write a comment.",//"Existing comments already existed. Select from the user list first", |
3177 |
}); |
3178 |
return; |
3179 |
} |
3180 |
else |
3181 |
{ |
3182 |
var item = gridViewMarkup.SelectedItems.FirstOrDefault(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID) as MarkupInfoItem; |
3183 |
if (item != null) |
3184 |
{ |
3185 |
App.Custom_ViewInfoId = item.MarkupInfoID; |
3186 |
} |
3187 |
} |
3188 |
|
3189 |
switch (controlType) |
3190 |
{ |
3191 |
case ControlType.Coordinate: |
3192 |
{ |
3193 |
if (e.LeftButton == MouseButtonState.Pressed) |
3194 |
{ |
3195 |
if (currentControl is CoordinateControl) |
3196 |
{ |
3197 |
if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3198 |
{ |
3199 |
return; |
3200 |
} |
3201 |
|
3202 |
CreateCommand.Instance.Execute(currentControl); |
3203 |
|
3204 |
currentControl = null; |
3205 |
this.cursor = Cursors.Arrow; |
3206 |
} |
3207 |
else |
3208 |
{ |
3209 |
this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
3210 |
if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber |
3211 |
&& d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0) |
3212 |
{ |
3213 |
currentControl = null; |
3214 |
this.cursor = Cursors.Arrow; |
3215 |
Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice"); |
3216 |
return; |
3217 |
} |
3218 |
else |
3219 |
{ |
3220 |
currentControl = new CoordinateControl |
3221 |
{ |
3222 |
Background = new SolidColorBrush(Colors.Black), |
3223 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3224 |
ControlType = ControlType.Coordinate |
3225 |
}; |
3226 |
|
3227 |
currentControl.CommentID = Commons.shortGuid(); |
3228 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3229 |
currentControl.IsNew = true; |
3230 |
|
3231 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3232 |
|
3233 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3234 |
} |
3235 |
} |
3236 |
} |
3237 |
} |
3238 |
break; |
3239 |
|
3240 |
case ControlType.InsideWhite: |
3241 |
{ |
3242 |
if (e.LeftButton == MouseButtonState.Pressed) |
3243 |
{ |
3244 |
if (currentControl is InsideWhiteControl) |
3245 |
{ |
3246 |
if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3247 |
{ |
3248 |
return; |
3249 |
} |
3250 |
|
3251 |
CreateCommand.Instance.Execute(currentControl); |
3252 |
|
3253 |
currentControl = null; |
3254 |
this.cursor = Cursors.Arrow; |
3255 |
} |
3256 |
else |
3257 |
{ |
3258 |
currentControl = new InsideWhiteControl |
3259 |
{ |
3260 |
Background = new SolidColorBrush(Colors.Black), |
3261 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3262 |
ControlType = ControlType.InsideWhite |
3263 |
}; |
3264 |
|
3265 |
currentControl.CommentID = Commons.shortGuid(); |
3266 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3267 |
currentControl.IsNew = true; |
3268 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3269 |
|
3270 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3271 |
} |
3272 |
} |
3273 |
} |
3274 |
break; |
3275 |
|
3276 |
case ControlType.OverlapWhite: |
3277 |
{ |
3278 |
if (e.LeftButton == MouseButtonState.Pressed) |
3279 |
{ |
3280 |
if (currentControl is OverlapWhiteControl) |
3281 |
{ |
3282 |
if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3283 |
{ |
3284 |
return; |
3285 |
} |
3286 |
|
3287 |
CreateCommand.Instance.Execute(currentControl); |
3288 |
|
3289 |
currentControl = null; |
3290 |
this.cursor = Cursors.Arrow; |
3291 |
} |
3292 |
else |
3293 |
{ |
3294 |
currentControl = new OverlapWhiteControl |
3295 |
{ |
3296 |
Background = new SolidColorBrush(Colors.Black), |
3297 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3298 |
ControlType = ControlType.OverlapWhite |
3299 |
}; |
3300 |
|
3301 |
currentControl.CommentID = Commons.shortGuid(); |
3302 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3303 |
currentControl.IsNew = true; |
3304 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3305 |
|
3306 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3307 |
} |
3308 |
} |
3309 |
} |
3310 |
break; |
3311 |
|
3312 |
case ControlType.ClipWhite: |
3313 |
{ |
3314 |
if (e.LeftButton == MouseButtonState.Pressed) |
3315 |
{ |
3316 |
if (currentControl is ClipWhiteControl) |
3317 |
{ |
3318 |
if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3319 |
{ |
3320 |
return; |
3321 |
} |
3322 |
|
3323 |
CreateCommand.Instance.Execute(currentControl); |
3324 |
|
3325 |
currentControl = null; |
3326 |
this.cursor = Cursors.Arrow; |
3327 |
} |
3328 |
else |
3329 |
{ |
3330 |
currentControl = new ClipWhiteControl |
3331 |
{ |
3332 |
Background = new SolidColorBrush(Colors.Black), |
3333 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3334 |
ControlType = ControlType.ClipWhite |
3335 |
}; |
3336 |
|
3337 |
currentControl.CommentID = Commons.shortGuid(); |
3338 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3339 |
currentControl.IsNew = true; |
3340 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3341 |
|
3342 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3343 |
} |
3344 |
} |
3345 |
} |
3346 |
break; |
3347 |
|
3348 |
case ControlType.Rectangle: |
3349 |
{ |
3350 |
if (e.LeftButton == MouseButtonState.Pressed) |
3351 |
{ |
3352 |
if (currentControl is RectangleControl) |
3353 |
{ |
3354 |
//20180906 LJY TEST IsRotationDrawingEnable |
3355 |
if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3356 |
{ |
3357 |
return; |
3358 |
} |
3359 |
|
3360 |
CreateCommand.Instance.Execute(currentControl); |
3361 |
currentControl = null; |
3362 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
3363 |
} |
3364 |
else |
3365 |
{ |
3366 |
currentControl = new RectangleControl |
3367 |
{ |
3368 |
Background = new SolidColorBrush(Colors.Black), |
3369 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3370 |
ControlType = ControlType.Rectangle |
3371 |
}; |
3372 |
|
3373 |
currentControl.CommentID = Commons.shortGuid(); |
3374 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3375 |
currentControl.IsNew = true; |
3376 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3377 |
|
3378 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3379 |
} |
3380 |
} |
3381 |
} |
3382 |
break; |
3383 |
|
3384 |
case ControlType.RectCloud: |
3385 |
{ |
3386 |
if (e.LeftButton == MouseButtonState.Pressed) |
3387 |
{ |
3388 |
if (currentControl is RectCloudControl) |
3389 |
{ |
3390 |
//20180906 LJY TEST IsRotationDrawingEnable |
3391 |
if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3392 |
{ |
3393 |
return; |
3394 |
} |
3395 |
|
3396 |
CreateCommand.Instance.Execute(currentControl); |
3397 |
|
3398 |
currentControl = null; |
3399 |
|
3400 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
3401 |
} |
3402 |
else |
3403 |
{ |
3404 |
currentControl = new RectCloudControl |
3405 |
{ |
3406 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3407 |
ControlType = ControlType.RectCloud, |
3408 |
Background = new SolidColorBrush(Colors.Black) |
3409 |
}; |
3410 |
|
3411 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3412 |
currentControl.CommentID = Commons.shortGuid(); |
3413 |
currentControl.IsNew = true; |
3414 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3415 |
} |
3416 |
} |
3417 |
} |
3418 |
break; |
3419 |
|
3420 |
case ControlType.Circle: |
3421 |
{ |
3422 |
if (e.LeftButton == MouseButtonState.Pressed) |
3423 |
{ |
3424 |
if (currentControl is CircleControl) |
3425 |
{ |
3426 |
//20180906 LJY TEST IsRotationDrawingEnable |
3427 |
if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3428 |
{ |
3429 |
return; |
3430 |
} |
3431 |
|
3432 |
CreateCommand.Instance.Execute(currentControl); |
3433 |
|
3434 |
currentControl = null; |
3435 |
} |
3436 |
else |
3437 |
{ |
3438 |
currentControl = new CircleControl |
3439 |
{ |
3440 |
StartPoint = this.CanvasDrawingMouseDownPoint, |
3441 |
LeftBottomPoint = this.CanvasDrawingMouseDownPoint, |
3442 |
Background = new SolidColorBrush(Colors.Black) |
3443 |
}; |
3444 |
|
3445 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3446 |
currentControl.CommentID = Commons.shortGuid(); |
3447 |
currentControl.IsNew = true; |
3448 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3449 |
} |
3450 |
} |
3451 |
} |
3452 |
break; |
3453 |
|
3454 |
case ControlType.Triangle: |
3455 |
{ |
3456 |
if (e.LeftButton == MouseButtonState.Pressed) |
3457 |
{ |
3458 |
if (currentControl is TriControl) |
3459 |
{ |
3460 |
var content = currentControl as TriControl; |
3461 |
if (content.MidPoint == new Point(0, 0)) |
3462 |
{ |
3463 |
content.MidPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y); |
3464 |
} |
3465 |
else |
3466 |
{ |
3467 |
//20180906 LJY TEST IsRotationDrawingEnable |
3468 |
if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3469 |
{ |
3470 |
return; |
3471 |
} |
3472 |
|
3473 |
CreateCommand.Instance.Execute(currentControl); |
3474 |
|
3475 |
currentControl = null; |
3476 |
} |
3477 |
} |
3478 |
else |
3479 |
{ |
3480 |
currentControl = new TriControl |
3481 |
{ |
3482 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3483 |
Background = new SolidColorBrush(Colors.Black), |
3484 |
}; |
3485 |
|
3486 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3487 |
currentControl.CommentID = Commons.shortGuid(); |
3488 |
currentControl.IsNew = true; |
3489 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3490 |
} |
3491 |
} |
3492 |
} |
3493 |
break; |
3494 |
case ControlType.CancelLine: |
3495 |
case ControlType.SingleLine: |
3496 |
case ControlType.ArrowLine: |
3497 |
case ControlType.TwinLine: |
3498 |
case ControlType.DimLine: |
3499 |
{ |
3500 |
if (e.LeftButton == MouseButtonState.Pressed) |
3501 |
{ |
3502 |
if (currentControl is LineControl) |
3503 |
{ |
3504 |
//20180906 LJY TEST IsRotationDrawingEnable |
3505 |
if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3506 |
{ |
3507 |
return; |
3508 |
} |
3509 |
|
3510 |
CreateCommand.Instance.Execute(currentControl); |
3511 |
currentControl = null; |
3512 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3513 |
} |
3514 |
else |
3515 |
{ |
3516 |
currentControl = new LineControl |
3517 |
{ |
3518 |
ControlType = this.controlType, |
3519 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3520 |
Background = new SolidColorBrush(Colors.Black) |
3521 |
}; |
3522 |
|
3523 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3524 |
currentControl.CommentID = Commons.shortGuid(); |
3525 |
currentControl.IsNew = true; |
3526 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3527 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3528 |
} |
3529 |
} |
3530 |
} |
3531 |
break; |
3532 |
case ControlType.PolygonControl: |
3533 |
{ |
3534 |
if (currentControl is PolygonControl) |
3535 |
{ |
3536 |
var control = currentControl as PolygonControl; |
3537 |
|
3538 |
if (e.RightButton == MouseButtonState.Pressed) |
3539 |
{ |
3540 |
control.IsCompleted = true; |
3541 |
} |
3542 |
|
3543 |
if (!control.IsCompleted) |
3544 |
{ |
3545 |
control.PointSet.Add(control.EndPoint); |
3546 |
} |
3547 |
else |
3548 |
{ |
3549 |
//20180906 LJY TEST IsRotationDrawingEnable |
3550 |
if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3551 |
{ |
3552 |
return; |
3553 |
} |
3554 |
|
3555 |
var firstPoint = control.PointSet.First(); |
3556 |
control.DashSize = ViewerDataModel.Instance.DashSize; |
3557 |
control.LineSize = ViewerDataModel.Instance.LineSize; |
3558 |
control.PointSet.Add(firstPoint); |
3559 |
|
3560 |
control.ApplyOverViewData(); |
3561 |
|
3562 |
CreateCommand.Instance.Execute(currentControl); |
3563 |
control.UpdateControl(); |
3564 |
currentControl = null; |
3565 |
} |
3566 |
} |
3567 |
else |
3568 |
{ |
3569 |
if (e.LeftButton == MouseButtonState.Pressed) |
3570 |
{ |
3571 |
currentControl = new PolygonControl |
3572 |
{ |
3573 |
PointSet = new List<Point>(), |
3574 |
}; |
3575 |
|
3576 |
var polygonControl = (currentControl as PolygonControl); |
3577 |
currentControl.CommentID = Commons.shortGuid(); |
3578 |
currentControl.IsNew = true; |
3579 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3580 |
polygonControl.StartPoint = CanvasDrawingMouseDownPoint; |
3581 |
polygonControl.EndPoint = CanvasDrawingMouseDownPoint; |
3582 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3583 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3584 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3585 |
polygonControl.ApplyTemplate(); |
3586 |
polygonControl.Visibility = Visibility.Visible; |
3587 |
} |
3588 |
} |
3589 |
} |
3590 |
break; |
3591 |
case ControlType.ChainLine: |
3592 |
{ |
3593 |
if (currentControl is PolygonControl) |
3594 |
{ |
3595 |
var control = currentControl as PolygonControl; |
3596 |
|
3597 |
if (e.RightButton == MouseButtonState.Pressed) |
3598 |
{ |
3599 |
//20180906 LJY TEST IsRotationDrawingEnable |
3600 |
if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3601 |
{ |
3602 |
return; |
3603 |
} |
3604 |
|
3605 |
CreateCommand.Instance.Execute(currentControl); |
3606 |
|
3607 |
currentControl = null; |
3608 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3609 |
return; |
3610 |
} |
3611 |
|
3612 |
if (!control.IsCompleted) |
3613 |
{ |
3614 |
control.PointSet.Add(control.EndPoint); |
3615 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3616 |
} |
3617 |
} |
3618 |
else |
3619 |
{ |
3620 |
if (e.LeftButton == MouseButtonState.Pressed) |
3621 |
{ |
3622 |
MainAngle.Visibility = Visibility.Visible; |
3623 |
currentControl = new PolygonControl |
3624 |
{ |
3625 |
PointSet = new List<Point>(), |
3626 |
//강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정) |
3627 |
ControlType = ControlType.ChainLine, |
3628 |
DashSize = ViewerDataModel.Instance.DashSize, |
3629 |
LineSize = ViewerDataModel.Instance.LineSize, |
3630 |
//PointC = new StylusPointSet() |
3631 |
}; |
3632 |
|
3633 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3634 |
//{ |
3635 |
var polygonControl = (currentControl as PolygonControl); |
3636 |
currentControl.CommentID = Commons.shortGuid(); |
3637 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3638 |
currentControl.IsNew = true; |
3639 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3640 |
//currentControl.OnApplyTemplate(); |
3641 |
//polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
3642 |
//polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
3643 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3644 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3645 |
//} |
3646 |
} |
3647 |
} |
3648 |
} |
3649 |
break; |
3650 |
case ControlType.ArcLine: |
3651 |
{ |
3652 |
if (e.LeftButton == MouseButtonState.Pressed) |
3653 |
{ |
3654 |
if (currentControl is ArcControl) |
3655 |
{ |
3656 |
//20180906 LJY TEST IsRotationDrawingEnable |
3657 |
if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3658 |
{ |
3659 |
return; |
3660 |
} |
3661 |
|
3662 |
CreateCommand.Instance.Execute(currentControl); |
3663 |
|
3664 |
currentControl = null; |
3665 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3666 |
} |
3667 |
else |
3668 |
{ |
3669 |
currentControl = new ArcControl |
3670 |
{ |
3671 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3672 |
Background = new SolidColorBrush(Colors.Black) |
3673 |
}; |
3674 |
currentControl.CommentID = Commons.shortGuid(); |
3675 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3676 |
currentControl.IsNew = true; |
3677 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3678 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3679 |
} |
3680 |
} |
3681 |
else if (e.RightButton == MouseButtonState.Pressed) |
3682 |
{ |
3683 |
if (currentControl != null) |
3684 |
{ |
3685 |
(currentControl as ArcControl).setClock(); |
3686 |
(currentControl as ArcControl).MidPoint = new Point(0, 0); |
3687 |
} |
3688 |
} |
3689 |
} |
3690 |
break; |
3691 |
case ControlType.ArcArrow: |
3692 |
{ |
3693 |
if (e.LeftButton == MouseButtonState.Pressed) |
3694 |
{ |
3695 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3696 |
//{ |
3697 |
if (currentControl is ArrowArcControl) |
3698 |
{ |
3699 |
//20180906 LJY TEST IsRotationDrawingEnable |
3700 |
if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3701 |
{ |
3702 |
return; |
3703 |
} |
3704 |
|
3705 |
CreateCommand.Instance.Execute(currentControl); |
3706 |
|
3707 |
currentControl = null; |
3708 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3709 |
} |
3710 |
else |
3711 |
{ |
3712 |
currentControl = new ArrowArcControl |
3713 |
{ |
3714 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3715 |
Background = new SolidColorBrush(Colors.Black) |
3716 |
}; |
3717 |
currentControl.CommentID = Commons.shortGuid(); |
3718 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3719 |
currentControl.IsNew = true; |
3720 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3721 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3722 |
} |
3723 |
//} |
3724 |
} |
3725 |
else if (e.RightButton == MouseButtonState.Pressed) |
3726 |
{ |
3727 |
if (currentControl != null) |
3728 |
{ |
3729 |
(currentControl as ArrowArcControl).setClock(); |
3730 |
(currentControl as ArrowArcControl).MiddlePoint = new Point(0, 0); |
3731 |
//(currentControl as ArcControl).ApplyTemplate(); |
3732 |
} |
3733 |
} |
3734 |
} |
3735 |
break; |
3736 |
case ControlType.ArrowMultiLine: |
3737 |
{ |
3738 |
if (e.LeftButton == MouseButtonState.Pressed) |
3739 |
{ |
3740 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3741 |
//{ |
3742 |
if (currentControl is ArrowControl_Multi) |
3743 |
{ |
3744 |
var content = currentControl as ArrowControl_Multi; |
3745 |
if (content.MiddlePoint == new Point(0, 0)) |
3746 |
{ |
3747 |
if (ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift) |
3748 |
{ |
3749 |
content.MiddlePoint = content.EndPoint; |
3750 |
} |
3751 |
else |
3752 |
{ |
3753 |
content.MiddlePoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y); |
3754 |
} |
3755 |
} |
3756 |
else |
3757 |
{ |
3758 |
//20180906 LJY TEST IsRotationDrawingEnable |
3759 |
if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3760 |
{ |
3761 |
return; |
3762 |
} |
3763 |
|
3764 |
CreateCommand.Instance.Execute(currentControl); |
3765 |
|
3766 |
currentControl = null; |
3767 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
3768 |
} |
3769 |
} |
3770 |
else |
3771 |
{ |
3772 |
currentControl = new ArrowControl_Multi |
3773 |
{ |
3774 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
3775 |
Background = new SolidColorBrush(Colors.Black) |
3776 |
}; |
3777 |
currentControl.CommentID = Commons.shortGuid(); |
3778 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3779 |
currentControl.IsNew = true; |
3780 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3781 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
3782 |
} |
3783 |
//} |
3784 |
} |
3785 |
} |
3786 |
break; |
3787 |
case ControlType.PolygonCloud: |
3788 |
{ |
3789 |
if (currentControl is CloudControl) |
3790 |
{ |
3791 |
var control = currentControl as CloudControl; |
3792 |
if (e.RightButton == MouseButtonState.Pressed) |
3793 |
{ |
3794 |
control.IsCompleted = true; |
3795 |
} |
3796 |
|
3797 |
if (!control.IsCompleted) |
3798 |
{ |
3799 |
control.PointSet.Add(control.EndPoint); |
3800 |
} |
3801 |
else |
3802 |
{ |
3803 |
//20180906 LJY TEST IsRotationDrawingEnable |
3804 |
if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3805 |
{ |
3806 |
return; |
3807 |
} |
3808 |
|
3809 |
CreateCommand.Instance.Execute(currentControl); |
3810 |
|
3811 |
control.isTransOn = true; |
3812 |
var firstPoint = control.PointSet.First(); |
3813 |
|
3814 |
control.PointSet.Add(firstPoint); |
3815 |
control.DrawingCloud(); |
3816 |
control.ApplyOverViewData(); |
3817 |
|
3818 |
currentControl = null; |
3819 |
} |
3820 |
} |
3821 |
else |
3822 |
{ |
3823 |
if (e.LeftButton == MouseButtonState.Pressed) |
3824 |
{ |
3825 |
currentControl = new CloudControl |
3826 |
{ |
3827 |
PointSet = new List<Point>(), |
3828 |
PointC = new StylusPointSet() |
3829 |
}; |
3830 |
|
3831 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3832 |
//{ |
3833 |
var polygonControl = (currentControl as CloudControl); |
3834 |
currentControl.CommentID = Commons.shortGuid(); |
3835 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3836 |
currentControl.IsNew = true; |
3837 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3838 |
|
3839 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3840 |
polygonControl.PointSet.Add(CanvasDrawingMouseDownPoint); |
3841 |
|
3842 |
//} |
3843 |
} |
3844 |
} |
3845 |
} |
3846 |
break; |
3847 |
|
3848 |
case ControlType.ImgControl: |
3849 |
{ |
3850 |
if (e.LeftButton == MouseButtonState.Pressed) |
3851 |
{ |
3852 |
if (currentControl is ImgControl) |
3853 |
{ |
3854 |
//20180906 LJY TEST IsRotationDrawingEnable |
3855 |
if (IsGetoutpoint((currentControl as ImgControl).PointSet.Find(data => IsRotationDrawingEnable(data)))) |
3856 |
{ |
3857 |
return; |
3858 |
} |
3859 |
|
3860 |
CreateCommand.Instance.Execute(currentControl); |
3861 |
controlType = ControlType.ImgControl; |
3862 |
currentControl = null; |
3863 |
} |
3864 |
else |
3865 |
{ |
3866 |
string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
3867 |
if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG") |
3868 |
{ |
3869 |
UriBuilder downloadUri = new UriBuilder(App.BaseAddress); |
3870 |
UriBuilder uri = new UriBuilder(filename); |
3871 |
uri.Host = downloadUri.Host; |
3872 |
uri.Port = downloadUri.Port; |
3873 |
|
3874 |
Image img = new Image(); |
3875 |
if (filename.Contains(".svg")) |
3876 |
{ |
3877 |
SharpVectors.Converters.SvgImageExtension svgImage = new SharpVectors.Converters.SvgImageExtension(uri.Uri.ToString()); |
3878 |
img.Source = (DrawingImage)svgImage.ProvideValue(null); |
3879 |
} |
3880 |
else |
3881 |
{ |
3882 |
img.Source = new BitmapImage(uri.Uri); |
3883 |
} |
3884 |
|
3885 |
currentControl = new ImgControl |
3886 |
{ |
3887 |
Background = new SolidColorBrush(Colors.Black), |
3888 |
PointSet = new List<Point>(), |
3889 |
FilePath = uri.Uri.ToString(), |
3890 |
ImageData = img.Source, |
3891 |
StartPoint = CanvasDrawingMouseDownPoint, |
3892 |
EndPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y + 100), |
3893 |
TopRightPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y + 100), |
3894 |
LeftBottomPoint = new Point(CanvasDrawingMouseDownPoint.X + 100, CanvasDrawingMouseDownPoint.Y), |
3895 |
ControlType = ControlType.ImgControl |
3896 |
}; |
3897 |
|
3898 |
currentControl.CommentID = Commons.shortGuid(); |
3899 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3900 |
currentControl.IsNew = true; |
3901 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3902 |
|
3903 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3904 |
(currentControl as ImgControl).CommentAngle -= rotate.Angle; |
3905 |
} |
3906 |
} |
3907 |
} |
3908 |
} |
3909 |
break; |
3910 |
|
3911 |
case ControlType.Date: |
3912 |
{ |
3913 |
if (e.LeftButton == MouseButtonState.Pressed) |
3914 |
{ |
3915 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3916 |
//{ |
3917 |
if (currentControl is DateControl) |
3918 |
{ |
3919 |
//20180906 LJY TEST IsRotationDrawingEnable |
3920 |
if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
3921 |
{ |
3922 |
return; |
3923 |
} |
3924 |
|
3925 |
CreateCommand.Instance.Execute(currentControl); |
3926 |
currentControl = null; |
3927 |
|
3928 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
3929 |
{ |
3930 |
controlType = ControlType.None; |
3931 |
IsSwingMode = false; |
3932 |
Common.ViewerDataModel.Instance.SelectedControl = ""; |
3933 |
Common.ViewerDataModel.Instance.ControlTag = null; |
3934 |
mouseHandlingMode = MouseHandlingMode.None; |
3935 |
this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
3936 |
txtBatch.Visibility = Visibility.Collapsed; |
3937 |
} |
3938 |
} |
3939 |
else |
3940 |
{ |
3941 |
currentControl = new DateControl |
3942 |
{ |
3943 |
StartPoint = CanvasDrawingMouseDownPoint, |
3944 |
Background = new SolidColorBrush(Colors.Black) |
3945 |
}; |
3946 |
currentControl.CommentID = Commons.shortGuid(); |
3947 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3948 |
currentControl.IsNew = true; |
3949 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3950 |
|
3951 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3952 |
if (currentControl is ImgControl) |
3953 |
{ |
3954 |
(currentControl as ImgControl).CommentAngle -= rotate.Angle; |
3955 |
} |
3956 |
} |
3957 |
//} |
3958 |
} |
3959 |
} |
3960 |
break; |
3961 |
|
3962 |
case ControlType.TextControl: |
3963 |
{ |
3964 |
if (e.LeftButton == MouseButtonState.Pressed) |
3965 |
{ |
3966 |
if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3967 |
{ |
3968 |
currentControl = new TextControl |
3969 |
{ |
3970 |
ControlType = controlType |
3971 |
}; |
3972 |
|
3973 |
currentControl.CommentID = Commons.shortGuid(); |
3974 |
currentControl.IsNew = true; |
3975 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3976 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3977 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3978 |
currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
3979 |
currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
3980 |
|
3981 |
(currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3982 |
(currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
3983 |
(currentControl as TextControl).ControlType_No = 0; |
3984 |
(currentControl as TextControl).CommentAngle -= rotate.Angle; |
3985 |
(currentControl as TextControl).ApplyTemplate(); |
3986 |
(currentControl as TextControl).Base_TextBox.Focus(); |
3987 |
(currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
3988 |
|
3989 |
if(previousControl == null) |
3990 |
{ |
3991 |
previousControl = currentControl as TextControl; |
3992 |
} |
3993 |
else |
3994 |
{ |
3995 |
var vPreviousControl = previousControl as TextControl; |
3996 |
if (string.IsNullOrEmpty(vPreviousControl.Text)) |
3997 |
{ |
3998 |
UndoCommand.Instance.Push(EventType.Delete, new[] { previousControl }); |
3999 |
previousControl = null; |
4000 |
} |
4001 |
else |
4002 |
{ |
4003 |
previousControl = currentControl as TextControl; |
4004 |
} |
4005 |
} |
4006 |
CreateCommand.Instance.Execute(currentControl); |
4007 |
if (previousControl == null) |
4008 |
previousControl = currentControl; |
4009 |
} |
4010 |
} |
4011 |
} |
4012 |
break; |
4013 |
|
4014 |
case ControlType.TextBorder: |
4015 |
{ |
4016 |
if (e.LeftButton == MouseButtonState.Pressed) |
4017 |
{ |
4018 |
if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4019 |
{ |
4020 |
currentControl = new TextControl |
4021 |
{ |
4022 |
ControlType = controlType |
4023 |
}; |
4024 |
|
4025 |
(currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4026 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4027 |
currentControl.CommentID = Commons.shortGuid(); |
4028 |
currentControl.IsNew = true; |
4029 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4030 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4031 |
currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
4032 |
currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
4033 |
|
4034 |
(currentControl as TextControl).ControlType_No = 1; |
4035 |
(currentControl as TextControl).CommentAngle = Ang; |
4036 |
(currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
4037 |
(currentControl as TextControl).ApplyTemplate(); |
4038 |
(currentControl as TextControl).Base_TextBox.Focus(); |
4039 |
(currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4040 |
|
4041 |
if (previousControl == null) |
4042 |
{ |
4043 |
previousControl = currentControl as TextControl; |
4044 |
} |
4045 |
else |
4046 |
{ |
4047 |
var vPreviousControl = previousControl as TextControl; |
4048 |
if (string.IsNullOrEmpty(vPreviousControl.Text)) |
4049 |
{ |
4050 |
UndoCommand.Instance.Push(EventType.Delete, new[] { previousControl }); |
4051 |
previousControl = null; |
4052 |
} |
4053 |
else |
4054 |
{ |
4055 |
previousControl = currentControl as TextControl; |
4056 |
} |
4057 |
} |
4058 |
CreateCommand.Instance.Execute(currentControl); |
4059 |
if (previousControl == null) |
4060 |
previousControl = currentControl; |
4061 |
} |
4062 |
} |
4063 |
} |
4064 |
break; |
4065 |
|
4066 |
case ControlType.TextCloud: |
4067 |
{ |
4068 |
if (e.LeftButton == MouseButtonState.Pressed) |
4069 |
{ |
4070 |
if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4071 |
{ |
4072 |
currentControl = new TextControl |
4073 |
{ |
4074 |
ControlType = controlType |
4075 |
}; |
4076 |
|
4077 |
(currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4078 |
currentControl.CommentID = Commons.shortGuid(); |
4079 |
currentControl.IsNew = true; |
4080 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4081 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4082 |
|
4083 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4084 |
currentControl.SetValue(TextControl.CanvasXProperty, CanvasDrawingMouseDownPoint.X); |
4085 |
currentControl.SetValue(TextControl.CanvasYProperty, CanvasDrawingMouseDownPoint.Y); |
4086 |
|
4087 |
(currentControl as TextControl).CommentAngle = Ang; |
4088 |
(currentControl as TextControl).ControlType_No = 2; |
4089 |
(currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
4090 |
(currentControl as TextControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
4091 |
(currentControl as TextControl).ApplyTemplate(); |
4092 |
|
4093 |
(currentControl as TextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4094 |
|
4095 |
(currentControl as TextControl).Base_TextBox.Focus(); |
4096 |
if (previousControl == null) |
4097 |
{ |
4098 |
previousControl = currentControl as TextControl; |
4099 |
} |
4100 |
else |
4101 |
{ |
4102 |
var vPreviousControl = previousControl as TextControl; |
4103 |
if (string.IsNullOrEmpty(vPreviousControl.Text)) |
4104 |
{ |
4105 |
UndoCommand.Instance.Push(EventType.Delete, new[] { previousControl }); |
4106 |
previousControl = null; |
4107 |
} |
4108 |
else |
4109 |
{ |
4110 |
previousControl = currentControl as TextControl; |
4111 |
} |
4112 |
} |
4113 |
CreateCommand.Instance.Execute(currentControl); |
4114 |
if (previousControl == null) |
4115 |
previousControl = currentControl; |
4116 |
|
4117 |
//currentControl = null; |
4118 |
} |
4119 |
} |
4120 |
} |
4121 |
break; |
4122 |
|
4123 |
case ControlType.ArrowTextControl: |
4124 |
{ |
4125 |
if (e.LeftButton == MouseButtonState.Pressed) |
4126 |
{ |
4127 |
if (currentControl is ArrowTextControl) |
4128 |
{ |
4129 |
//20180906 LJY TEST IsRotationDrawingEnable |
4130 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4131 |
{ |
4132 |
return; |
4133 |
} |
4134 |
|
4135 |
CreateCommand.Instance.Execute(currentControl); |
4136 |
|
4137 |
try |
4138 |
{ |
4139 |
if(!(currentControl as ArrowTextControl).IsEditingMode) |
4140 |
{ |
4141 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4142 |
} |
4143 |
} |
4144 |
catch (Exception ex) |
4145 |
{ |
4146 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
4147 |
} |
4148 |
(currentControl as ArrowTextControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
4149 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4150 |
(currentControl as ArrowTextControl).EnableEditing = false; |
4151 |
(currentControl as ArrowTextControl).IsNew = false; |
4152 |
currentControl = null; |
4153 |
} |
4154 |
else |
4155 |
{ |
4156 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4157 |
//{ |
4158 |
currentControl = new ArrowTextControl() |
4159 |
{ |
4160 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4161 |
}; |
4162 |
|
4163 |
currentControl.CommentID = Commons.shortGuid(); |
4164 |
currentControl.IsNew = true; |
4165 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4166 |
|
4167 |
try |
4168 |
{ |
4169 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4170 |
} |
4171 |
catch (Exception ex) |
4172 |
{ |
4173 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
4174 |
} |
4175 |
|
4176 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4177 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4178 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4179 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4180 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4181 |
|
4182 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4183 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4184 |
|
4185 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4186 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4187 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4188 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4189 |
|
4190 |
//} |
4191 |
} |
4192 |
} |
4193 |
} |
4194 |
break; |
4195 |
|
4196 |
case ControlType.ArrowTransTextControl: |
4197 |
{ |
4198 |
if (e.LeftButton == MouseButtonState.Pressed) |
4199 |
{ |
4200 |
if (currentControl is ArrowTextControl) |
4201 |
{ |
4202 |
//20180906 LJY TEST IsRotationDrawingEnable |
4203 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4204 |
{ |
4205 |
return; |
4206 |
} |
4207 |
|
4208 |
CreateCommand.Instance.Execute(currentControl); |
4209 |
|
4210 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4211 |
|
4212 |
currentControl.IsNew = false; |
4213 |
currentControl = null; |
4214 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4215 |
} |
4216 |
else |
4217 |
{ |
4218 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4219 |
//{ |
4220 |
currentControl = new ArrowTextControl() |
4221 |
{ |
4222 |
ControlType = ControlType.ArrowTransTextControl, |
4223 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4224 |
}; |
4225 |
currentControl.CommentID = Commons.shortGuid(); |
4226 |
currentControl.IsNew = true; |
4227 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4228 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4229 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4230 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4231 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4232 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4233 |
(currentControl as ArrowTextControl).isFixed = true; |
4234 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4235 |
|
4236 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4237 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4238 |
|
4239 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4240 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4241 |
(currentControl as ArrowTextControl).isTrans = true; |
4242 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4243 |
} |
4244 |
} |
4245 |
} |
4246 |
break; |
4247 |
|
4248 |
case ControlType.ArrowTextBorderControl: |
4249 |
{ |
4250 |
if (e.LeftButton == MouseButtonState.Pressed) |
4251 |
{ |
4252 |
if (currentControl is ArrowTextControl) |
4253 |
{ |
4254 |
//20180906 LJY TEST IsRotationDrawingEnable |
4255 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4256 |
{ |
4257 |
return; |
4258 |
} |
4259 |
|
4260 |
CreateCommand.Instance.Execute(currentControl); |
4261 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4262 |
currentControl.IsNew = false; |
4263 |
currentControl = null; |
4264 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4265 |
} |
4266 |
else |
4267 |
{ |
4268 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4269 |
//{ |
4270 |
currentControl = new ArrowTextControl() |
4271 |
{ |
4272 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect, |
4273 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4274 |
}; |
4275 |
currentControl.CommentID = Commons.shortGuid(); |
4276 |
currentControl.IsNew = true; |
4277 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4278 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4279 |
|
4280 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4281 |
|
4282 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4283 |
|
4284 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4285 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4286 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4287 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4288 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4289 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4290 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4291 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4292 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4293 |
//} |
4294 |
} |
4295 |
} |
4296 |
} |
4297 |
break; |
4298 |
|
4299 |
case ControlType.ArrowTransTextBorderControl: |
4300 |
{ |
4301 |
if (e.LeftButton == MouseButtonState.Pressed) |
4302 |
{ |
4303 |
if (currentControl is ArrowTextControl) |
4304 |
{ |
4305 |
//20180906 LJY TEST IsRotationDrawingEnable |
4306 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4307 |
{ |
4308 |
return; |
4309 |
} |
4310 |
CreateCommand.Instance.Execute(currentControl); |
4311 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4312 |
currentControl.IsNew = false; |
4313 |
currentControl = null; |
4314 |
|
4315 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4316 |
} |
4317 |
else |
4318 |
{ |
4319 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4320 |
//{ |
4321 |
currentControl = new ArrowTextControl() |
4322 |
{ |
4323 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect, |
4324 |
ControlType = ControlType.ArrowTransTextBorderControl, |
4325 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4326 |
}; |
4327 |
|
4328 |
currentControl.CommentID = Commons.shortGuid(); |
4329 |
currentControl.IsNew = true; |
4330 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4331 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4332 |
|
4333 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4334 |
|
4335 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4336 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4337 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4338 |
(currentControl as ArrowTextControl).isFixed = true; |
4339 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4340 |
|
4341 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4342 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4343 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4344 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4345 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4346 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4347 |
|
4348 |
//20180911 LJY |
4349 |
(currentControl as ArrowTextControl).isTrans = true; |
4350 |
|
4351 |
//} |
4352 |
} |
4353 |
} |
4354 |
} |
4355 |
break; |
4356 |
|
4357 |
case ControlType.ArrowTextCloudControl: |
4358 |
{ |
4359 |
if (e.LeftButton == MouseButtonState.Pressed) |
4360 |
{ |
4361 |
if (currentControl is ArrowTextControl) |
4362 |
{ |
4363 |
//20180906 LJY TEST IsRotationDrawingEnable |
4364 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4365 |
{ |
4366 |
return; |
4367 |
} |
4368 |
CreateCommand.Instance.Execute(currentControl); |
4369 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4370 |
currentControl.IsNew = false; |
4371 |
currentControl = null; |
4372 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4373 |
} |
4374 |
else |
4375 |
{ |
4376 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4377 |
//{ |
4378 |
currentControl = new ArrowTextControl() |
4379 |
{ |
4380 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud, |
4381 |
PageAngle = ViewerDataModel.Instance.PageAngle, |
4382 |
ControlType = ControlType.ArrowTextCloudControl |
4383 |
}; |
4384 |
currentControl.CommentID = Commons.shortGuid(); |
4385 |
currentControl.IsNew = true; |
4386 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4387 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4388 |
|
4389 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4390 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4391 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4392 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4393 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4394 |
(currentControl as ArrowTextControl).SetFontFamily((this.ParentOfType<MainWindow>().dzTopMenu.comboFontFamily.SelectedValue as Markus.Fonts.MarkusFont).FontFamily); |
4395 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4396 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4397 |
(currentControl as ArrowTextControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
4398 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4399 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4400 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4401 |
//} |
4402 |
} |
4403 |
} |
4404 |
} |
4405 |
break; |
4406 |
|
4407 |
case ControlType.ArrowTransTextCloudControl: |
4408 |
{ |
4409 |
if (e.LeftButton == MouseButtonState.Pressed) |
4410 |
{ |
4411 |
if (currentControl is ArrowTextControl) |
4412 |
{ |
4413 |
//20180906 LJY TEST IsRotationDrawingEnable |
4414 |
if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4415 |
{ |
4416 |
return; |
4417 |
} |
4418 |
CreateCommand.Instance.Execute(currentControl); |
4419 |
(currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
4420 |
currentControl.IsNew = false; |
4421 |
currentControl = null; |
4422 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Collapsed); |
4423 |
} |
4424 |
else |
4425 |
{ |
4426 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4427 |
//{ |
4428 |
currentControl = new ArrowTextControl() |
4429 |
{ |
4430 |
ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud, |
4431 |
ControlType = ControlType.ArrowTransTextCloudControl, |
4432 |
PageAngle = ViewerDataModel.Instance.PageAngle |
4433 |
}; |
4434 |
currentControl.CommentID = Commons.shortGuid(); |
4435 |
currentControl.IsNew = true; |
4436 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4437 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4438 |
currentControl.SetValue(Canvas.ZIndexProperty, 3); |
4439 |
|
4440 |
currentControl.SetValue(ArrowTextControl.StartPointProperty, CanvasDrawingMouseDownPoint); |
4441 |
currentControl.SetValue(ArrowTextControl.EndPointProperty, CanvasDrawingMouseDownPoint); |
4442 |
(currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4443 |
(currentControl as ArrowTextControl).isFixed = true; |
4444 |
(currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4445 |
|
4446 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4447 |
(currentControl as ArrowTextControl).CommentAngle -= rotate.Angle; |
4448 |
(currentControl as ArrowTextControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
4449 |
(currentControl as ArrowTextControl).SetFontFamily(this.ParentOfType<MainWindow>().dzTopMenu.GetFontFamily().FontFamily); |
4450 |
(currentControl as ArrowTextControl).ApplyTemplate(); |
4451 |
(currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4452 |
ViewerDataModel.Instance.SetAngleVisible(Visibility.Visible); |
4453 |
|
4454 |
//20180911 LJY |
4455 |
(currentControl as ArrowTextControl).isTrans = true; |
4456 |
//} |
4457 |
} |
4458 |
} |
4459 |
} |
4460 |
break; |
4461 |
//강인구 추가 |
4462 |
case ControlType.Sign: |
4463 |
{ |
4464 |
if (e.LeftButton == MouseButtonState.Pressed) |
4465 |
{ |
4466 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4467 |
//{ |
4468 |
var _sign = await BaseTaskClient.GetSignDataAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID); |
4469 |
|
4470 |
if (_sign == null) |
4471 |
{ |
4472 |
txtBatch.Visibility = Visibility.Collapsed; |
4473 |
mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
4474 |
controlType = ControlType.None; |
4475 |
|
4476 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
4477 |
this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
4478 |
return; |
4479 |
} |
4480 |
else |
4481 |
{ |
4482 |
if ( Application.Current.Resources.Keys.OfType<string>().Count(x => x == "UserSign") == 0) |
4483 |
{ |
4484 |
Application.Current.Resources.Add("UserSign", _sign); |
4485 |
} |
4486 |
else |
4487 |
{ |
4488 |
Application.Current.Resources["UserSign"] = _sign; |
4489 |
} |
4490 |
} |
4491 |
|
4492 |
if (currentControl is SignControl) |
4493 |
{ |
4494 |
//20180906 LJY TEST IsRotationDrawingEnable |
4495 |
if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4496 |
{ |
4497 |
return; |
4498 |
} |
4499 |
|
4500 |
CreateCommand.Instance.Execute(currentControl); |
4501 |
currentControl = null; |
4502 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
4503 |
{ |
4504 |
txtBatch.Text = "Place Date"; |
4505 |
controlType = ControlType.Date; |
4506 |
} |
4507 |
} |
4508 |
else |
4509 |
{ |
4510 |
currentControl = new SignControl |
4511 |
{ |
4512 |
Background = new SolidColorBrush(Colors.Black), |
4513 |
UserNumber = App.ViewInfo.UserID, |
4514 |
ProjectNO = App.ViewInfo.ProjectNO, |
4515 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4516 |
EndPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4517 |
ControlType = ControlType.Sign |
4518 |
}; |
4519 |
|
4520 |
currentControl.CommentID = Commons.shortGuid(); |
4521 |
currentControl.IsNew = true; |
4522 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4523 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4524 |
|
4525 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4526 |
(currentControl as SignControl).CommentAngle -= rotate.Angle; |
4527 |
} |
4528 |
//} |
4529 |
} |
4530 |
} |
4531 |
break; |
4532 |
|
4533 |
case ControlType.Mark: |
4534 |
{ |
4535 |
if (e.LeftButton == MouseButtonState.Pressed) |
4536 |
{ |
4537 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4538 |
//{ |
4539 |
if (currentControl is RectangleControl) |
4540 |
{ |
4541 |
//20180906 LJY TEST IsRotationDrawingEnable |
4542 |
if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4543 |
{ |
4544 |
return; |
4545 |
} |
4546 |
|
4547 |
CreateCommand.Instance.Execute(currentControl); |
4548 |
(currentControl as RectangleControl).ApplyOverViewData(); |
4549 |
currentControl = null; |
4550 |
|
4551 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
4552 |
|
4553 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
4554 |
{ |
4555 |
txtBatch.Text = "Place Signature"; |
4556 |
controlType = ControlType.Sign; |
4557 |
} |
4558 |
} |
4559 |
else |
4560 |
{ |
4561 |
currentControl = new RectangleControl |
4562 |
{ |
4563 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4564 |
Background = new SolidColorBrush(Colors.Black), |
4565 |
ControlType = ControlType.Mark, |
4566 |
Paint = PaintSet.Fill |
4567 |
}; |
4568 |
|
4569 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4570 |
currentControl.CommentID = Commons.shortGuid(); |
4571 |
currentControl.IsNew = true; |
4572 |
(currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
4573 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4574 |
} |
4575 |
//} |
4576 |
} |
4577 |
} |
4578 |
break; |
4579 |
|
4580 |
case ControlType.Symbol: |
4581 |
{ |
4582 |
if (e.LeftButton == MouseButtonState.Pressed) |
4583 |
{ |
4584 |
if (currentControl is SymControl) |
4585 |
{ |
4586 |
//20180906 LJY TEST IsRotationDrawingEnable |
4587 |
if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4588 |
{ |
4589 |
return; |
4590 |
} |
4591 |
CreateCommand.Instance.Execute(currentControl); |
4592 |
currentControl = null; |
4593 |
|
4594 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
4595 |
} |
4596 |
else |
4597 |
{ |
4598 |
currentControl = new SymControl |
4599 |
{ |
4600 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4601 |
Background = new SolidColorBrush(Colors.Black), |
4602 |
LineSize = ViewerDataModel.Instance.LineSize + 3, |
4603 |
ControlType = ControlType.Symbol |
4604 |
}; |
4605 |
|
4606 |
currentControl.IsNew = true; |
4607 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4608 |
currentControl.CommentID = Commons.shortGuid(); |
4609 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4610 |
|
4611 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4612 |
(currentControl as SymControl).CommentAngle -= rotate.Angle; |
4613 |
} |
4614 |
//} |
4615 |
} |
4616 |
} |
4617 |
break; |
4618 |
|
4619 |
case ControlType.Stamp: |
4620 |
{ |
4621 |
if (e.LeftButton == MouseButtonState.Pressed) |
4622 |
{ |
4623 |
//if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4624 |
//{ |
4625 |
if (currentControl is SymControlN) |
4626 |
{ |
4627 |
//20180906 LJY TEST IsRotationDrawingEnable |
4628 |
if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
4629 |
{ |
4630 |
return; |
4631 |
} |
4632 |
|
4633 |
CreateCommand.Instance.Execute(currentControl); |
4634 |
currentControl = null; |
4635 |
|
4636 |
this.cursor = new Cursor(App.DefaultArrowCursorStream); |
4637 |
} |
4638 |
else |
4639 |
{ |
4640 |
currentControl = new SymControlN |
4641 |
{ |
4642 |
StartPoint = new Point(CanvasDrawingMouseDownPoint.X, CanvasDrawingMouseDownPoint.Y), |
4643 |
Background = new SolidColorBrush(Colors.Black), |
4644 |
STAMP = App.SystemInfo.STAMP, |
4645 |
STAMP_Contents = App.SystemInfo.STAMP_CONTENTS, |
4646 |
ControlType = ControlType.Stamp |
4647 |
}; |
4648 |
|
4649 |
currentControl.IsNew = true; |
4650 |
currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4651 |
currentControl.CommentID = Commons.shortGuid(); |
4652 |
ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
4653 |
//20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4654 |
(currentControl as SymControlN).CommentAngle -= rotate.Angle; |
4655 |
} |
4656 |
//} |
4657 |
} |
4658 |
} |
4659 |
break; |
4660 |
|
4661 |
case ControlType.PenControl: |
4662 |
{ |
4663 |
if (inkBoard.Tag.ToString() == "Ink") |
4664 |
{ |
4665 |
inkBoard.IsEnabled = true; |
4666 |
StartNewStroke(CanvasDrawingMouseDownPoint); |
4667 |
} |
4668 |
else if (inkBoard.Tag.ToString() == "EraseByPoint") |
4669 |
{ |
4670 |
RemovePointStroke(CanvasDrawingMouseDownPoint); |
4671 |
} |
4672 |
else if (inkBoard.Tag.ToString() == "EraseByStroke") |
4673 |
{ |
4674 |
RemoveLineStroke(CanvasDrawingMouseDownPoint); |
4675 |
} |
4676 |
IsDrawing = true; |
4677 |
return; |
4678 |
} |
4679 |
default: |
4680 |
if (currentControl != null) |
4681 |
{ |
4682 |
currentControl.CommentID = null; |
4683 |
currentControl.IsNew = false; |
4684 |
} |
4685 |
break; |
4686 |
} |
4687 |
|
4688 |
try |
4689 |
{ |
4690 |
if (currentControl is ITextControl) |
4691 |
{ |
4692 |
var textBox = currentControl.ChildrenOfType<TextBox>().Where(x=> x.Name == "PART_ArrowTextBox" || x.Name == "Base_TextBox" || x.Name == "PART_TextBox"); |
4693 |
|
4694 |
if(textBox.Count() > 0) |
4695 |
{ |
4696 |
Behaviors.SpecialcharRemove specialcharRemove = new Behaviors.SpecialcharRemove(); |
4697 |
specialcharRemove.Attach(textBox.First()); |
4698 |
} |
4699 |
else |
4700 |
{ |
4701 |
|
4702 |
} |
4703 |
|
4704 |
} |
4705 |
} |
4706 |
catch (Exception ex) |
4707 |
{ |
4708 |
System.Diagnostics.Debug.WriteLine(ex); |
4709 |
|
4710 |
} |
4711 |
|
4712 |
if (currentControl is ArrowTextControl) |
4713 |
{ |
4714 |
(currentControl as ArrowTextControl).EditEnded += (snd, evt) => |
4715 |
{ |
4716 |
var control = snd as ArrowTextControl; |
4717 |
|
4718 |
if (string.IsNullOrEmpty(control.ArrowText)) |
4719 |
{ |
4720 |
UndoCommand.Instance.Push(EventType.Delete, new [] { control }); |
4721 |
} |
4722 |
}; |
4723 |
|
4724 |
} |
4725 |
|
4726 |
if (Common.ViewerDataModel.Instance.IsMacroCommand) |
4727 |
{ |
4728 |
if (currentControl == null && mouseHandlingMode == MouseHandlingMode.Drawing) |
4729 |
{ |
4730 |
MacroHelper.MacroAction(); |
4731 |
} |
4732 |
//if (currentControl.ControlType) |
4733 |
//txtBatch.Text = "Draw a TextBox"; |
4734 |
//controlType = ControlType.ArrowTextBorderControl; |
4735 |
} |
4736 |
|
4737 |
//if (currentControl != null) |
4738 |
//{ |
4739 |
// currentControl.PageAngle = pageNavigator.CurrentPage.Angle; |
4740 |
//} |
4741 |
} |
4742 |
if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed) |
4743 |
{ |
4744 |
// MACRO 버튼클릭하여 CLOUD RECT 그린 후 |
4745 |
|
4746 |
|
4747 |
if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
4748 |
{ |
4749 |
bool mouseOff = false; |
4750 |
foreach (var item in SelectLayer.Children) |
4751 |
{ |
4752 |
if (item is AdornerFinal) |
4753 |
{ |
4754 |
var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
4755 |
if (over != null) |
4756 |
{ |
4757 |
mouseOff = true; |
4758 |
} |
4759 |
|
4760 |
} |
4761 |
} |
4762 |
|
4763 |
if (!mouseOff) |
4764 |
{ |
4765 |
SelectionSet.Instance.UnSelect(this); |
4766 |
} |
4767 |
} |
4768 |
zoomAndPanControl.CaptureMouse(); |
4769 |
e.Handled = true; |
4770 |
} |
4771 |
|
4772 |
} |
4773 |
|
4774 |
private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
4775 |
{ |
4776 |
///mouseButtonDown = e.ChangedButton; |
4777 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
4778 |
} |
4779 |
|
4780 |
private void RemoveLineStroke(Point P) |
4781 |
{ |
4782 |
var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseEnter).FirstOrDefault(); |
4783 |
if (control != null) |
4784 |
{ |
4785 |
UndoCommand.Instance.Push(EventType.Delete, new List<CommentUserInfo>() { control }); |
4786 |
} |
4787 |
} |
4788 |
|
4789 |
private void RemovePointStroke(Point P) |
4790 |
{ |
4791 |
foreach (Stroke hits in inkBoard.Strokes) |
4792 |
{ |
4793 |
foreach (StylusPoint sty in hits.StylusPoints) |
4794 |
{ |
4795 |
} |
4796 |
if (hits.HitTest(P)) |
4797 |
{ |
4798 |
inkBoard.Strokes.Remove(hits); |
4799 |
return; |
4800 |
} |
4801 |
} |
4802 |
} |
4803 |
|
4804 |
private void StartNewStroke(Point P) |
4805 |
{ |
4806 |
strokePoints = new StylusPointCollection(); |
4807 |
StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
4808 |
strokePoints.Add(segment1Start); |
4809 |
stroke = new Stroke(strokePoints); |
4810 |
|
4811 |
stroke.DrawingAttributes.Color = Colors.Red; |
4812 |
stroke.DrawingAttributes.Width = 4; |
4813 |
stroke.DrawingAttributes.Height = 4; |
4814 |
|
4815 |
inkBoard.Strokes.Add(stroke); |
4816 |
} |
4817 |
|
4818 |
private async void btnConsolidate_Click(object sender, RoutedEventArgs e) |
4819 |
{ |
4820 |
//SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
4821 |
//// update mylist and gridview |
4822 |
//this.UpdateMyMarkupList(); |
4823 |
|
4824 |
//bool result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this); |
4825 |
|
4826 |
//if (result) |
4827 |
//{ |
4828 |
btnFinalPDF.IsEnabled = false; |
4829 |
btnConsolidate.IsEnabled = false; |
4830 |
var result = await ConsolidationMethod(); |
4831 |
|
4832 |
if(result) |
4833 |
{ |
4834 |
var consolidateItem = ViewerDataModel.Instance._markupInfoList.Where(x => x.Consolidate == 1 && x.AvoidConsolidate == 0); |
4835 |
|
4836 |
if(consolidateItem?.Count() > 0) |
4837 |
{ |
4838 |
gridViewMarkup.Select(consolidateItem); |
4839 |
} |
4840 |
} |
4841 |
else |
4842 |
{ |
4843 |
btnFinalPDF.IsEnabled = true; |
4844 |
btnConsolidate.IsEnabled = true; |
4845 |
} |
4846 |
} |
4847 |
|
4848 |
/// <summary> |
4849 |
/// execute TeamConsolidationCommand |
4850 |
/// </summary> |
4851 |
public async void TeamConsolidationMethod() |
4852 |
{ |
4853 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
4854 |
{ |
4855 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
4856 |
} |
4857 |
else |
4858 |
{ |
4859 |
foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
4860 |
{ |
4861 |
if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
4862 |
{ |
4863 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
4864 |
} |
4865 |
} |
4866 |
|
4867 |
var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync(); |
4868 |
if (isSave) |
4869 |
{ |
4870 |
var token = ViewerDataModel.Instance.NewMarkupCancelToken(); |
4871 |
|
4872 |
await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
4873 |
|
4874 |
#region 로그인 사용자가 같은 부서의 마크업을 취합하여 Team Consolidate을 수행한다. |
4875 |
List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
4876 |
foreach (var item in this.gridViewMarkup.SelectedItems) |
4877 |
{ |
4878 |
if((item as IKCOM.MarkupInfoItem).Depatment.Equals(this.userData.DEPARTMENT)) |
4879 |
MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
4880 |
} |
4881 |
|
4882 |
TeamConsolidateCommand.Instance.Execute(MySelectItem); |
4883 |
#endregion |
4884 |
} |
4885 |
} |
4886 |
} |
4887 |
|
4888 |
/// <summary> |
4889 |
/// Consolidate를 수행한다. |
4890 |
/// </summary> |
4891 |
/// <returns></returns> |
4892 |
public async Task<bool> ConsolidationMethod() |
4893 |
{ |
4894 |
bool result = false; |
4895 |
|
4896 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
4897 |
{ |
4898 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
4899 |
} |
4900 |
else |
4901 |
{ |
4902 |
var isSave = await this.ParentOfType<MainWindow>().dzTopMenu.SaveEventAsync(); |
4903 |
|
4904 |
if (isSave) |
4905 |
{ |
4906 |
var token = ViewerDataModel.Instance.NewMarkupCancelToken(); |
4907 |
await MarkupLoadAsync(pageNavigator.CurrentPage.PageNumber, ViewerDataModel.Instance.PageAngle, token); |
4908 |
|
4909 |
List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
4910 |
foreach (var item in this.gridViewMarkup.SelectedItems) |
4911 |
{ |
4912 |
MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
4913 |
} |
4914 |
int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text); |
4915 |
|
4916 |
result = await ConsolidateCommand.Instance.ExecuteAsync(MySelectItem, iPageNo); |
4917 |
} |
4918 |
} |
4919 |
|
4920 |
return result; |
4921 |
} |
4922 |
|
4923 |
/// <summary> |
4924 |
/// 조건에 맞게 Consolidate 버튼을 비활성화 시킨다. |
4925 |
/// </summary> |
4926 |
/// <param name="sender"></param> |
4927 |
/// <param name="e"></param> |
4928 |
private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
4929 |
{ |
4930 |
if (App.ViewInfo != null) |
4931 |
{ |
4932 |
btnConsolidate = (sender as RadRibbonButton); |
4933 |
if (!App.ViewInfo.NewCommentPermission) |
4934 |
{ |
4935 |
(sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
4936 |
} |
4937 |
} |
4938 |
} |
4939 |
|
4940 |
private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
4941 |
{ |
4942 |
TeamConsolidationMethod(); |
4943 |
} |
4944 |
|
4945 |
/// <summary> |
4946 |
/// 조건에 따라 Team Consoidate 버튼을 비활성화 시킨다. |
4947 |
/// </summary> |
4948 |
/// <param name="sender"></param> |
4949 |
/// <param name="e"></param> |
4950 |
private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
4951 |
{ |
4952 |
btnTeamConsolidate = sender as RadRibbonButton; |
4953 |
if (App.ViewInfo != null) |
4954 |
{ |
4955 |
if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
4956 |
{ |
4957 |
if (btnConsolidate != null) |
4958 |
{ |
4959 |
btnConsolidate.Visibility = Visibility.Collapsed; |
4960 |
} |
4961 |
|
4962 |
if (!App.ViewInfo.NewCommentPermission) |
4963 |
{ |
4964 |
btnTeamConsolidate.Visibility = Visibility.Collapsed; |
4965 |
} |
4966 |
} |
4967 |
else |
4968 |
{ |
4969 |
btnTeamConsolidate.Visibility = Visibility.Collapsed; |
4970 |
} |
4971 |
} |
4972 |
} |
4973 |
|
4974 |
private async void FinalPDFEvent(object sender, RoutedEventArgs e) |
4975 |
{ |
4976 |
SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
4977 |
// update mylist and gridview |
4978 |
this.UpdateMyMarkupList(); |
4979 |
|
4980 |
var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommandAsync(this); |
4981 |
|
4982 |
if(!result) |
4983 |
{ |
4984 |
|
4985 |
} |
4986 |
else |
4987 |
{ |
4988 |
var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
4989 |
|
4990 |
if (item != null) |
4991 |
{ |
4992 |
if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID)) |
4993 |
{ |
4994 |
//Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
4995 |
|
4996 |
BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
4997 |
|
4998 |
ViewerDataModel.Instance.FinalPDFTime = DateTime.Now; |
4999 |
} |
5000 |
else |
5001 |
{ |
5002 |
DialogMessage_Alert("Merged PDF가 수행중입니다", "안내"); |
5003 |
} |
5004 |
} |
5005 |
else |
5006 |
{ |
5007 |
//Consolidate 가 없는 경우 |
5008 |
DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
5009 |
} |
5010 |
} |
5011 |
|
5012 |
} |
5013 |
|
5014 |
private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
5015 |
{ |
5016 |
btnFinalPDF = sender as RadRibbonButton; |
5017 |
if (App.ViewInfo != null) |
5018 |
{ |
5019 |
//btnFinalPDF.IsEnabled = false; |
5020 |
|
5021 |
if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
5022 |
{ |
5023 |
btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
5024 |
if (btnConsolidate != null) |
5025 |
{ |
5026 |
btnConsolidate.Visibility = Visibility.Collapsed; |
5027 |
} |
5028 |
} |
5029 |
} |
5030 |
} |
5031 |
|
5032 |
private async void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e) |
5033 |
{ |
5034 |
//UpdateMyMarkupList(); |
5035 |
|
5036 |
if (this.gridViewMarkup.SelectedItems.Count == 0) |
5037 |
{ |
5038 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
5039 |
} |
5040 |
else |
5041 |
{ |
5042 |
//if ((App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
5043 |
//{ |
5044 |
//컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
5045 |
//ViewerDataModel.Instance.MarkupControls_USER.Remove(ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl); |
5046 |
//ViewerDataModel.Instance.SystemMain.dzMainMenu.currentControl = null; |
5047 |
|
5048 |
//SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
5049 |
//// update mylist and gridview |
5050 |
//this.UpdateMyMarkupList(); |
5051 |
|
5052 |
//var result = await this.ParentOfType<MainWindow>().dzTopMenu.ExecuteSaveCommand(this); |
5053 |
|
5054 |
Mouse.SetCursor(Cursors.Wait); |
5055 |
|
5056 |
bool result = await ConsolidationMethod(); |
5057 |
|
5058 |
//System.Threading.Thread.Sleep(500); |
5059 |
|
5060 |
if (result) |
5061 |
{ |
5062 |
var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5063 |
|
5064 |
var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
5065 |
if (item2 != null) |
5066 |
{ |
5067 |
if (BaseClient.FinalPDF_GetFinalPDFStatus(_DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID)) |
5068 |
{ |
5069 |
//Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
5070 |
|
5071 |
BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID); |
5072 |
BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5073 |
|
5074 |
ViewerDataModel.Instance.FinalPDFTime = DateTime.Now; |
5075 |
|
5076 |
Mouse.SetCursor(Cursors.Arrow); |
5077 |
} |
5078 |
else |
5079 |
{ |
5080 |
DialogMessage_Alert("Merged PDF가 수행중입니다. 잠시 후 수행가능합니다.", "안내"); |
5081 |
} |
5082 |
} |
5083 |
else |
5084 |
{ |
5085 |
DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
5086 |
} |
5087 |
} |
5088 |
else |
5089 |
{ |
5090 |
DialogMessage_Alert("서버가 원활하지 않습니다. 다시 수행 바랍니다.", "안내"); |
5091 |
} |
5092 |
|
5093 |
Mouse.SetCursor(Cursors.Arrow); |
5094 |
} |
5095 |
} |
5096 |
|
5097 |
private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e) |
5098 |
{ |
5099 |
btnConsolidateFinalPDF = (sender as RadRibbonButton); |
5100 |
#if Hyosung |
5101 |
btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
5102 |
#else |
5103 |
|
5104 |
//btnConsolidateFinalPDF.IsEnabled = false; |
5105 |
|
5106 |
if (App.ViewInfo != null) |
5107 |
{ |
5108 |
if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission) |
5109 |
{ |
5110 |
btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
5111 |
} |
5112 |
} |
5113 |
#endif |
5114 |
} |
5115 |
|
5116 |
private void btnColorList_Click(object sender, RoutedEventArgs e) |
5117 |
{ |
5118 |
|
5119 |
} |
5120 |
|
5121 |
private void SyncCompare_Click(object sender, RoutedEventArgs e) |
5122 |
{ |
5123 |
SetCompareRect(); |
5124 |
} |
5125 |
|
5126 |
private void Sync_Click(object sender, RoutedEventArgs e) |
5127 |
{ |
5128 |
if (Sync.IsChecked) |
5129 |
{ |
5130 |
ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
5131 |
ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
5132 |
ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
5133 |
} |
5134 |
} |
5135 |
|
5136 |
private void SyncUserListExpender_Click(object sender, RoutedEventArgs e) |
5137 |
{ |
5138 |
if (UserList.IsChecked) |
5139 |
{ |
5140 |
this.gridViewRevMarkup.Visibility = Visibility.Visible; |
5141 |
} |
5142 |
else |
5143 |
{ |
5144 |
this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
5145 |
} |
5146 |
} |
5147 |
|
5148 |
private void SyncPageBalance_Click(object sender, RoutedEventArgs e) |
5149 |
{ |
5150 |
if (BalanceMode.IsChecked) |
5151 |
{ |
5152 |
ViewerDataModel.Instance.PageBalanceMode = true; |
5153 |
} |
5154 |
else |
5155 |
{ |
5156 |
ViewerDataModel.Instance.PageBalanceMode = false; |
5157 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
5158 |
} |
5159 |
} |
5160 |
|
5161 |
private void SyncExit_Click(object sender, RoutedEventArgs e) |
5162 |
{ |
5163 |
//초기화 |
5164 |
testPanel2.IsHidden = true; |
5165 |
ViewerDataModel.Instance.PageBalanceMode = false; |
5166 |
ViewerDataModel.Instance.PageBalanceNumber = 0; |
5167 |
ViewerDataModel.Instance.SyncPageNumber = 0; |
5168 |
ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
5169 |
this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
5170 |
UserList.IsChecked = false; |
5171 |
BalanceMode.IsChecked = false; |
5172 |
} |
5173 |
|
5174 |
private async void SyncPageChange_Click(object sender, RoutedEventArgs e) |
5175 |
{ |
5176 |
if ((sender as System.Windows.Controls.Control).Tag != null) |
5177 |
{ |
5178 |
//Compare 초기화 |
5179 |
CompareMode.IsChecked = false; |
5180 |
var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag); |
5181 |
|
5182 |
if (ViewerDataModel.Instance.SyncPageNumber == 0) |
5183 |
{ |
5184 |
ViewerDataModel.Instance.SyncPageNumber = 1; |
5185 |
} |
5186 |
|
5187 |
if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount) |
5188 |
{ |
5189 |
} |
5190 |
else |
5191 |
{ |
5192 |
ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
5193 |
} |
5194 |
|
5195 |
if (ViewerDataModel.Instance.SyncPageNumber == pageNavigator.PageCount && balancePoint > 0) |
5196 |
{ |
5197 |
} |
5198 |
else if ((ViewerDataModel.Instance.SyncPageNumber + balancePoint) >= 1) |
5199 |
{ |
5200 |
ViewerDataModel.Instance.SyncPageNumber += balancePoint; |
5201 |
} |
5202 |
|
5203 |
//pageNavigator.GotoPage(ViewerDataModel.Instance.PageNumber); |
5204 |
|
5205 |
if (!testPanel2.IsHidden) |
5206 |
{ |
5207 |
if (IsSyncPDFMode) |
5208 |
{ |
5209 |
Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
5210 |
var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber))); |
5211 |
|
5212 |
if (pdfpath.IsDownloading) |
5213 |
{ |
5214 |
pdfpath.DownloadCompleted += (ex, arg) => |
5215 |
{ |
5216 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
5217 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
5218 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
5219 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
5220 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
5221 |
}; |
5222 |
} |
5223 |
else |
5224 |
{ |
5225 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
5226 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
5227 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
5228 |
|
5229 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
5230 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
5231 |
} |
5232 |
} |
5233 |
else |
5234 |
{ |
5235 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber); |
5236 |
|
5237 |
var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber); |
5238 |
ComparePageLoad(uri, isOriginalSize); |
5239 |
} |
5240 |
|
5241 |
//강인구 추가(페이지 이동시 코멘트 재 호출) |
5242 |
ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
5243 |
List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
5244 |
|
5245 |
foreach (var item in gridSelectionRevItem) |
5246 |
{ |
5247 |
var markupitems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList(); |
5248 |
foreach (var markupitem in markupitems) |
5249 |
{ |
5250 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync,0, item.DisplayColor, "", item.MarkupInfoID); |
5251 |
} |
5252 |
} |
5253 |
|
5254 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.SyncPageNumber); |
5255 |
} |
5256 |
} |
5257 |
} |
5258 |
|
5259 |
private void SyncRotation_Click(object sender,RoutedEventArgs e) |
5260 |
{ |
5261 |
var direction = int.Parse((sender as Telerik.Windows.Controls.RadPathButton).Tag.ToString()); |
5262 |
|
5263 |
double translateX = 0; |
5264 |
double translateY = 0; |
5265 |
double angle = rotate2.Angle; |
5266 |
|
5267 |
if (direction == 1) |
5268 |
{ |
5269 |
if (angle < 270) |
5270 |
{ |
5271 |
angle += 90; |
5272 |
} |
5273 |
else |
5274 |
{ |
5275 |
angle = 0; |
5276 |
} |
5277 |
} |
5278 |
else |
5279 |
{ |
5280 |
if (angle > 0) |
5281 |
{ |
5282 |
angle -= 90; |
5283 |
} |
5284 |
else |
5285 |
{ |
5286 |
angle = 270; |
5287 |
} |
5288 |
} |
5289 |
zoomAndPanControl2.RotationAngle = angle; |
5290 |
zoomAndPanControl2.ScaleToFit(); |
5291 |
|
5292 |
//if (angle == 90 || angle == 270) |
5293 |
//{ |
5294 |
double emptySize = zoomAndPanCanvas2.Width; |
5295 |
zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height; |
5296 |
zoomAndPanCanvas2.Height = emptySize; |
5297 |
//} |
5298 |
|
5299 |
if (angle == 90) |
5300 |
{ |
5301 |
translateX = zoomAndPanCanvas2.Width; |
5302 |
translateY = 0; |
5303 |
} |
5304 |
else if (angle == 180) |
5305 |
{ |
5306 |
translateX = zoomAndPanCanvas2.Width; |
5307 |
translateY = zoomAndPanCanvas2.Height; |
5308 |
} |
5309 |
else if (angle == 270) |
5310 |
{ |
5311 |
translateX = 0; |
5312 |
translateY = zoomAndPanCanvas2.Height; |
5313 |
} |
5314 |
zoomAndPanControl2.ContentViewportWidth = zoomAndPanCanvas2.Width; |
5315 |
zoomAndPanControl2.ContentViewportHeight = zoomAndPanCanvas2.Height; |
5316 |
translate2.X = translateX; |
5317 |
translate2.Y = translateY; |
5318 |
rotate2.Angle = angle; |
5319 |
//translate2CompareBorder.X = translateX; |
5320 |
//translate2CompareBorder.Y = translateY; |
5321 |
//rotate2CompareBorder.Angle = angle; |
5322 |
|
5323 |
} |
5324 |
|
5325 |
private void SyncChange_Click(object sender, RoutedEventArgs e) |
5326 |
{ |
5327 |
if (MarkupMode.IsChecked) |
5328 |
{ |
5329 |
IsSyncPDFMode = true; |
5330 |
|
5331 |
var uri = CurrentRev.TO_VENDOR; |
5332 |
|
5333 |
if (ViewerDataModel.Instance.SyncPageNumber == 0) |
5334 |
{ |
5335 |
ViewerDataModel.Instance.SyncPageNumber = 1; |
5336 |
} |
5337 |
|
5338 |
//PDF모드 잠시 대기(강인구) |
5339 |
Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
5340 |
var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber))); |
5341 |
|
5342 |
if (pdfpath.IsDownloading) |
5343 |
{ |
5344 |
pdfpath.DownloadCompleted += (ex, arg) => |
5345 |
{ |
5346 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
5347 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
5348 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
5349 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
5350 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
5351 |
}; |
5352 |
} |
5353 |
else |
5354 |
{ |
5355 |
ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
5356 |
ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
5357 |
ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
5358 |
|
5359 |
zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
5360 |
zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
5361 |
} |
5362 |
} |
5363 |
else |
5364 |
{ |
5365 |
IsSyncPDFMode = false; |
5366 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5367 |
|
5368 |
ComparePageLoad(uri,false); |
5369 |
|
5370 |
zoomAndPanControl2.ApplyTemplate(); |
5371 |
zoomAndPanControl2.UpdateLayout(); |
5372 |
zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
5373 |
zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
5374 |
} |
5375 |
} |
5376 |
|
5377 |
/// <summary> |
5378 |
/// Compare된 영역을 초기화 |
5379 |
/// </summary> |
5380 |
private void ClearCompareRect() |
5381 |
{ |
5382 |
da.From = 1; |
5383 |
da.To = 1; |
5384 |
da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
5385 |
da.AutoReverse = false; |
5386 |
canvas_compareBorder.Children.Clear(); |
5387 |
canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
5388 |
} |
5389 |
|
5390 |
/// <summary> |
5391 |
/// 문서 Comprare |
5392 |
/// </summary> |
5393 |
private void SetCompareRect() |
5394 |
{ |
5395 |
canvas_compareBorder.Children.Clear(); |
5396 |
|
5397 |
if (CompareMode.IsChecked) |
5398 |
{ |
5399 |
if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
5400 |
{ |
5401 |
ViewerDataModel.Instance.PageBalanceNumber = 1; |
5402 |
} |
5403 |
if (ViewerDataModel.Instance.SyncPageNumber == 0) |
5404 |
{ |
5405 |
ViewerDataModel.Instance.SyncPageNumber = 1; |
5406 |
} |
5407 |
|
5408 |
//Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID +"," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + userData.COMPANY != "EXT" ? "true" : "false", 1); |
5409 |
|
5410 |
/// 비교대상원본, 비교할 대상 |
5411 |
BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber.ToString(), pageNavigator.CurrentPage.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
5412 |
} |
5413 |
else |
5414 |
{ |
5415 |
canvas_compareBorder.Visibility = Visibility.Hidden; |
5416 |
ClearCompareRect(); |
5417 |
} |
5418 |
} |
5419 |
|
5420 |
private void btnSync_Click(object sender, RoutedEventArgs e) |
5421 |
{ |
5422 |
gridViewHistory_Busy.IsBusy = true; |
5423 |
|
5424 |
RadButton instance = sender as RadButton; |
5425 |
if (instance.CommandParameter != null) |
5426 |
{ |
5427 |
CurrentRev = instance.CommandParameter as VPRevision; |
5428 |
System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null; |
5429 |
|
5430 |
GetSyncMarkupInfoItemshandler = (sen, ea) => |
5431 |
{ |
5432 |
if (ea.Error == null && ea.Result != null) |
5433 |
{ |
5434 |
testPanel2.IsHidden = false; |
5435 |
|
5436 |
ViewerDataModel.Instance._markupInfoRevList.Clear(); |
5437 |
foreach (var info in ea.Result) |
5438 |
{ |
5439 |
if (info.UserID == App.ViewInfo.UserID) |
5440 |
{ |
5441 |
info.userDelete = true; |
5442 |
info.DisplayColor = "#FFFF0000"; |
5443 |
} |
5444 |
else |
5445 |
{ |
5446 |
info.userDelete = false; |
5447 |
} |
5448 |
ViewerDataModel.Instance._markupInfoRevList.Add(info); |
5449 |
} |
5450 |
gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
5451 |
|
5452 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5453 |
ComparePageLoad(uri,false); |
5454 |
|
5455 |
Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
5456 |
|
5457 |
zoomAndPanControl2.ApplyTemplate(); |
5458 |
zoomAndPanControl2.UpdateLayout(); |
5459 |
|
5460 |
if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
5461 |
{ |
5462 |
zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
5463 |
zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
5464 |
} |
5465 |
|
5466 |
ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X; |
5467 |
ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y; |
5468 |
ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
5469 |
|
5470 |
tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
5471 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
5472 |
|
5473 |
zoomAndPanControl.ScaleToFit(); |
5474 |
zoomAndPanControl2.ScaleToFit(); |
5475 |
|
5476 |
gridViewHistory_Busy.IsBusy = false; |
5477 |
} |
5478 |
|
5479 |
//Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
5480 |
|
5481 |
if (GetSyncMarkupInfoItemshandler != null) |
5482 |
{ |
5483 |
BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler; |
5484 |
} |
5485 |
|
5486 |
//ClearCompareRect(); |
5487 |
SetCompareRect(); |
5488 |
}; |
5489 |
|
5490 |
/// 중복 실행이 발생하여 수정함. |
5491 |
BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler; |
5492 |
BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
5493 |
|
5494 |
//Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
5495 |
} |
5496 |
} |
5497 |
|
5498 |
private void OriginalSizeMode_Click(object sender,RoutedEventArgs e) |
5499 |
{ |
5500 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.SyncPageNumber); |
5501 |
var isOriginalSize = !(ViewerDataModel.Instance.SyncPageNumber == pageNavigator.CurrentPage.PageNumber); |
5502 |
|
5503 |
ComparePageLoad(uri, OriginalSizeMode.IsChecked); |
5504 |
} |
5505 |
|
5506 |
private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e) |
5507 |
{ |
5508 |
try |
5509 |
{ |
5510 |
if (sender is RadButton) |
5511 |
{ |
5512 |
if ((sender as RadButton).Tag != null) |
5513 |
{ |
5514 |
var url = (sender as RadButton).Tag.ToString(); |
5515 |
System.Diagnostics.Process.Start(url); |
5516 |
} |
5517 |
else |
5518 |
{ |
5519 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내"); |
5520 |
} |
5521 |
} |
5522 |
} |
5523 |
catch (Exception ex) |
5524 |
{ |
5525 |
//Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0); |
5526 |
} |
5527 |
} |
5528 |
|
5529 |
public void Sync_Event(VPRevision Currnet_Rev) |
5530 |
{ |
5531 |
CurrentRev = Currnet_Rev; |
5532 |
|
5533 |
BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
5534 |
{ |
5535 |
if (ea.Error == null && ea.Result != null) |
5536 |
{ |
5537 |
testPanel2.IsHidden = false; |
5538 |
|
5539 |
ViewerDataModel.Instance._markupInfoRevList.Clear(); |
5540 |
foreach (var info in ea.Result) |
5541 |
{ |
5542 |
if (info.UserID == App.ViewInfo.UserID) |
5543 |
{ |
5544 |
info.userDelete = true; |
5545 |
info.DisplayColor = "#FFFF0000"; |
5546 |
} |
5547 |
else |
5548 |
{ |
5549 |
info.userDelete = false; |
5550 |
} |
5551 |
ViewerDataModel.Instance._markupInfoRevList.Add(info); |
5552 |
} |
5553 |
gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
5554 |
|
5555 |
string uri = this.GetImageURL(CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5556 |
|
5557 |
Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
5558 |
|
5559 |
ComparePageLoad(uri,false); |
5560 |
|
5561 |
zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
5562 |
zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
5563 |
zoomAndPanControl2.ApplyTemplate(); |
5564 |
zoomAndPanControl2.UpdateLayout(); |
5565 |
|
5566 |
if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
5567 |
{ |
5568 |
zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
5569 |
zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
5570 |
} |
5571 |
//} |
5572 |
|
5573 |
tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
5574 |
tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
5575 |
gridViewHistory_Busy.IsBusy = false; |
5576 |
} |
5577 |
//Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
5578 |
}; |
5579 |
//Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
5580 |
BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
5581 |
} |
5582 |
|
5583 |
private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e) |
5584 |
{ |
5585 |
if (sender is Image) |
5586 |
{ |
5587 |
if ((sender as Image).Tag != null) |
5588 |
{ |
5589 |
var pdfUrl = (sender as Image).Tag.ToString(); |
5590 |
System.Diagnostics.Process.Start(pdfUrl); |
5591 |
} |
5592 |
else |
5593 |
{ |
5594 |
this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내"); |
5595 |
} |
5596 |
} |
5597 |
} |
5598 |
|
5599 |
private void Create_Symbol(object sender, RoutedEventArgs e) |
5600 |
{ |
5601 |
MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
5602 |
|
5603 |
if (SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
5604 |
{ |
5605 |
DialogMessage_Alert("Please Select Controls", "Alert"); |
5606 |
} |
5607 |
else //선택된 것이 있으면 |
5608 |
{ |
5609 |
string MarkupData = ""; |
5610 |
adorner_ = new AdornerFinal(); |
5611 |
|
5612 |
foreach (var item in SelectLayer.Children) |
5613 |
{ |
5614 |
if (item.GetType().Name == "AdornerFinal") |
5615 |
{ |
5616 |
adorner_ = (item as Controls.AdornerFinal); |
5617 |
foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
5618 |
{ |
5619 |
if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
5620 |
{ |
5621 |
markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
5622 |
MarkupData += markupReturn.ConvertData; |
5623 |
} |
5624 |
} |
5625 |
} |
5626 |
} |
5627 |
DialogParameters parameters = new DialogParameters() |
5628 |
{ |
5629 |
Owner = Application.Current.MainWindow, |
5630 |
Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
5631 |
DefaultPromptResultValue = "Custom State", |
5632 |
Content = "Name :", |
5633 |
Header = "Insert Custom Symbol Name", |
5634 |
Theme = new VisualStudio2013Theme(), |
5635 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
5636 |
}; |
5637 |
RadWindow.Prompt(parameters); |
5638 |
} |
5639 |
} |
5640 |
|
5641 |
public int symbolselectindex = 0; |
5642 |
|
5643 |
private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args) |
5644 |
{ |
5645 |
//Save save = new Save(); |
5646 |
try |
5647 |
{ |
5648 |
string svgfilename = null; |
5649 |
if (symbolname != null) |
5650 |
{ |
5651 |
if (symbolpng == true || symbolsvg == true) |
5652 |
{ |
5653 |
kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader; |
5654 |
string guid = Commons.shortGuid(); |
5655 |
|
5656 |
fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte); |
5657 |
//Check_Uri.UriCheck(); |
5658 |
fileUploader.RunCompleted += (ex, arg) => |
5659 |
{ |
5660 |
filename = arg.Result; |
5661 |
if (symbolpng == true) |
5662 |
{ |
5663 |
if (filename != null) |
5664 |
{ |
5665 |
if (symbolselectindex == 0) |
5666 |
{ |
5667 |
SymbolSave(symbolname, filename, data); |
5668 |
} |
5669 |
else |
5670 |
{ |
5671 |
SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
5672 |
} |
5673 |
DataBind(); |
5674 |
} |
5675 |
} |
5676 |
|
5677 |
if (symbolsvg == true) |
5678 |
{ |
5679 |
try |
5680 |
{ |
5681 |
var defaultBitmapImage = new BitmapImage(); |
5682 |
defaultBitmapImage.BeginInit(); |
5683 |
defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
5684 |
defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
5685 |
Check_Uri.UriCheck(filename); |
5686 |
defaultBitmapImage.UriSource = new Uri(filename); |
5687 |
defaultBitmapImage.EndInit(); |
5688 |
|
5689 |
System.Drawing.Bitmap image; |
5690 |
|
5691 |
if (defaultBitmapImage.IsDownloading) |
5692 |
{ |
5693 |
defaultBitmapImage.DownloadCompleted += (ex2, arg2) => |
5694 |
{ |
5695 |
defaultBitmapImage.Freeze(); |
5696 |
image = GetBitmap(defaultBitmapImage); |
5697 |
image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp); |
5698 |
Process potrace = new Process |
5699 |
{ |
5700 |
StartInfo = new ProcessStartInfo |
5701 |
{ |
5702 |
FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
5703 |
Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
5704 |
RedirectStandardInput = true, |
5705 |
RedirectStandardOutput = true, |
5706 |
RedirectStandardError = true, |
5707 |
UseShellExecute = false, |
5708 |
CreateNoWindow = true, |
5709 |
WindowStyle = ProcessWindowStyle.Hidden |
5710 |
}, |
5711 |
}; |
5712 |
|
5713 |
StringBuilder svgBuilder = new StringBuilder(); |
5714 |
potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => |
5715 |
{ |
5716 |
svgBuilder.AppendLine(e2.Data); |
5717 |
}; |
5718 |
|
5719 |
potrace.EnableRaisingEvents = true; |
5720 |
potrace.Start(); |
5721 |
potrace.Exited += (sender, e) => |
5722 |
{ |
5723 |
byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg"); |
5724 |
svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
5725 |
Check_Uri.UriCheck(svgfilename); |
5726 |
if (symbolselectindex == 0) |
5727 |
{ |
5728 |
SymbolSave(symbolname, svgfilename, data); |
5729 |
} |
5730 |
else |
5731 |
{ |
5732 |
SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
5733 |
} |
5734 |
|
5735 |
DataBind(); |
5736 |
}; |
5737 |
potrace.WaitForExit(); |
5738 |
}; |
5739 |
} |
5740 |
else |
5741 |
{ |
5742 |
//GC.Collect(); |
5743 |
} |
5744 |
} |
5745 |
catch (Exception ee) |
5746 |
{ |
5747 |
DialogMessage_Alert("" + ee, "Alert"); |
5748 |
} |
5749 |
} |
5750 |
}; |
5751 |
} |
5752 |
} |
5753 |
} |
5754 |
catch (Exception e) |
5755 |
{ |
5756 |
//DialogMessage_Alert(e + "", "Alert"); |
5757 |
} |
5758 |
} |
5759 |
|
5760 |
public void SymbolSave(string Name, string Url, string Data) |
5761 |
{ |
5762 |
try |
5763 |
{ |
5764 |
SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
5765 |
{ |
5766 |
ID = Commons.shortGuid(), |
5767 |
MEMBER_USER_ID = App.ViewInfo.UserID, |
5768 |
NAME = Name, |
5769 |
IMAGE_URL = Url, |
5770 |
DATA = Data |
5771 |
}; |
5772 |
|
5773 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
5774 |
//Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
5775 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
5776 |
} |
5777 |
catch (Exception) |
5778 |
{ |
5779 |
throw; |
5780 |
} |
5781 |
} |
5782 |
|
5783 |
public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
5784 |
{ |
5785 |
try |
5786 |
{ |
5787 |
SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
5788 |
{ |
5789 |
ID = Commons.shortGuid(), |
5790 |
DEPARTMENT = Department, |
5791 |
NAME = Name, |
5792 |
IMAGE_URL = Url, |
5793 |
DATA = Data |
5794 |
}; |
5795 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
5796 |
//Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
5797 |
Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
5798 |
} |
5799 |
catch (Exception) |
5800 |
{ |
5801 |
throw; |
5802 |
} |
5803 |
} |
5804 |
|
5805 |
private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
5806 |
{ |
5807 |
//Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
5808 |
DataBind(); |
5809 |
} |
5810 |
|
5811 |
private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
5812 |
{ |
5813 |
//Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
5814 |
DataBind(); |
5815 |
} |
5816 |
|
5817 |
private void DataBind() |
5818 |
{ |
5819 |
try |
5820 |
{ |
5821 |
Symbol_Custom Custom = new Symbol_Custom(); |
5822 |
List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
5823 |
|
5824 |
var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID); |
5825 |
foreach (var item in symbol_Private) |
5826 |
{ |
5827 |
Custom.Name = item.NAME; |
5828 |
Custom.ImageUri = item.IMAGE_URL; |
5829 |
Custom.ID = item.ID; |
5830 |
Custom_List.Add(Custom); |
5831 |
Custom = new Symbol_Custom(); |
5832 |
} |
5833 |
symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List; |
5834 |
|
5835 |
Custom = new Symbol_Custom(); |
5836 |
Custom_List = new List<Symbol_Custom>(); |
5837 |
|
5838 |
symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList(); |
5839 |
|
5840 |
List<SYMBOL_PUBLIC> symbol_Public; |
5841 |
|
5842 |
if (symbolPanel_Instance.deptlist.SelectedValue != null) |
5843 |
{ |
5844 |
symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString()); |
5845 |
} |
5846 |
else |
5847 |
{ |
5848 |
symbol_Public = BaseClient.GetPublicSymbolList(null); |
5849 |
} |
5850 |
foreach (var item in symbol_Public) |
5851 |
{ |
5852 |
Custom.Name = item.NAME; |
5853 |
Custom.ImageUri = item.IMAGE_URL; |
5854 |
Custom.ID = item.ID; |
5855 |
Custom_List.Add(Custom); |
5856 |
Custom = new Symbol_Custom(); |
5857 |
} |
5858 |
symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List; |
5859 |
BaseClient.Close(); |
5860 |
} |
5861 |
catch (Exception e) |
5862 |
{ |
5863 |
//DialogMessage_Alert("DataBind", "Alert"); |
5864 |
} |
5865 |
} |
5866 |
|
5867 |
private async void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
5868 |
{ |
5869 |
try |
5870 |
{ |
5871 |
if (args.PromptResult != null) |
5872 |
{ |
5873 |
if (args.DialogResult.Value) |
5874 |
{ |
5875 |
PngBitmapEncoder _Encoder = await symImageAsync(data); |
5876 |
|
5877 |
System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
5878 |
_Encoder.Save(fs); |
5879 |
System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
5880 |
|
5881 |
byte[] Img_byte = fs.ToArray(); |
5882 |
|
5883 |
kr.co.devdoftech.cloud.FileUpload fileUploader = App.FileUploader; |
5884 |
filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte); |
5885 |
Check_Uri.UriCheck(filename); |
5886 |
if (symbolPanel_Instance.RadTab.SelectedIndex == 0) |
5887 |
{ |
5888 |
SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data); |
5889 |
} |
5890 |
else |
5891 |
{ |
5892 |
SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
5893 |
} |
5894 |
DataBind(); |
5895 |
} |
5896 |
} |
5897 |
} |
5898 |
catch (Exception ex) |
5899 |
{ |
5900 |
DialogMessage_Alert("" + ex, "Alert"); |
5901 |
} |
5902 |
} |
5903 |
|
5904 |
public async Task<PngBitmapEncoder> symImageAsync(string data) |
5905 |
{ |
5906 |
Canvas _canvas = new Canvas(); |
5907 |
_canvas.Background = Brushes.White; |
5908 |
_canvas.Width = adorner_.BorderSize.Width; |
5909 |
_canvas.Height = adorner_.BorderSize.Height; |
5910 |
await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken()); |
5911 |
|
5912 |
BitmapEncoder encoder = new PngBitmapEncoder(); |
5913 |
|
5914 |
RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
5915 |
|
5916 |
DrawingVisual dv = new DrawingVisual(); |
5917 |
|
5918 |
_canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50)); |
5919 |
_canvas.Arrange(new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 20, Y = -adorner_.BorderSize.Y - 20 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20))); |
5920 |
|
5921 |
using (DrawingContext ctx = dv.RenderOpen()) |
5922 |
{ |
5923 |
VisualBrush vb = new VisualBrush(_canvas); |
5924 |
ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X, Y = -adorner_.BorderSize.Y }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20))); |
5925 |
} |
5926 |
|
5927 |
try |
5928 |
{ |
5929 |
renderBitmap.Render(dv); |
5930 |
|
5931 |
GC.Collect(2); |
5932 |
GC.WaitForPendingFinalizers(); |
5933 |
//GC.Collect(); |
5934 |
// encode png data |
5935 |
PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
5936 |
// puch rendered bitmap into it |
5937 |
pngEncoder.Interlace = PngInterlaceOption.Off; |
5938 |
pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
5939 |
return pngEncoder; |
5940 |
} |
5941 |
catch //(Exception ex) |
5942 |
{ |
5943 |
return null; |
5944 |
} |
5945 |
} |
5946 |
|
5947 |
public void DialogMessage_Alert(string content, string header) |
5948 |
{ |
5949 |
App.splashScreen.Close(); |
5950 |
App.FileLogger.Error(content + " " + header); |
5951 |
|
5952 |
DialogParameters parameters = new DialogParameters() |
5953 |
{ |
5954 |
Owner = this.ParentOfType<MainWindow>(), |
5955 |
Content = new TextBlock() |
5956 |
{ |
5957 |
MinWidth = 400, |
5958 |
FontSize = 11, |
5959 |
Text = content, |
5960 |
TextWrapping = System.Windows.TextWrapping.Wrap |
5961 |
}, |
5962 |
DialogStartupLocation = WindowStartupLocation.CenterOwner, |
5963 |
Header = header, |
5964 |
Theme = new VisualStudio2013Theme(), |
5965 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
5966 |
}; |
5967 |
RadWindow.Alert(parameters); |
5968 |
} |
5969 |
|
5970 |
#region 캡쳐 기능 |
5971 |
|
5972 |
public BitmapSource CutAreaToImage(int x, int y, int width, int height) |
5973 |
{ |
5974 |
if (x < 0) |
5975 |
{ |
5976 |
width += x; |
5977 |
x = 0; |
5978 |
} |
5979 |
if (y < 0) |
5980 |
{ |
5981 |
height += y; |
5982 |
y = 0; |
5983 |
|
5984 |
width = (int)zoomAndPanCanvas.ActualWidth - x; |
5985 |
} |
5986 |
if (x + width > zoomAndPanCanvas.ActualWidth) |
5987 |
{ |
5988 |
width = (int)zoomAndPanCanvas.ActualWidth - x; |
5989 |
} |
5990 |
if (y + height > zoomAndPanCanvas.ActualHeight) |
5991 |
{ |
5992 |
height = (int)zoomAndPanCanvas.ActualHeight - y; |
5993 |
} |
5994 |
|
5995 |
byte[] pixels = CopyPixels(x, y, width, height); |
5996 |
|
5997 |
int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
5998 |
|
5999 |
return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride); |
6000 |
} |
6001 |
|
6002 |
public byte[] CopyPixels(int x, int y, int width, int height) |
6003 |
{ |
6004 |
byte[] pixels = new byte[width * height * 4]; |
6005 |
int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
6006 |
|
6007 |
// Canvas 이미지에서 객체 역역만큼 픽셀로 복사 |
6008 |
canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0); |
6009 |
|
6010 |
return pixels; |
6011 |
} |
6012 |
|
6013 |
public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element) |
6014 |
{ |
6015 |
DrawingVisual drawingVisual = new DrawingVisual(); |
6016 |
DrawingContext drawingContext = drawingVisual.RenderOpen(); |
6017 |
|
6018 |
// 해당 객체의 그래픽요소로 사각형의 그림을 그립니다. |
6019 |
drawingContext.DrawRectangle(new VisualBrush(element), null, |
6020 |
new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight))); |
6021 |
drawingContext.Close(); |
6022 |
|
6023 |
// 비트맵으로 변환합니다. |
6024 |
RenderTargetBitmap target = |
6025 |
new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, |
6026 |
96, 96, System.Windows.Media.PixelFormats.Pbgra32); |
6027 |
|
6028 |
target.Render(drawingVisual); |
6029 |
return target; |
6030 |
} |
6031 |
|
6032 |
private System.Drawing.Bitmap GetBitmap(BitmapSource source) |
6033 |
{ |
6034 |
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
6035 |
System.Drawing.Imaging.BitmapData data = bmp.LockBits(new System.Drawing.Rectangle(System.Drawing.Point.Empty, bmp.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
6036 |
source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride); |
6037 |
bmp.UnlockBits(data); |
6038 |
return bmp; |
6039 |
} |
6040 |
|
6041 |
public string symbolname = null; |
6042 |
public bool symbolsvg = true; |
6043 |
public bool symbolpng = true; |
6044 |
|
6045 |
public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height) |
6046 |
{ |
6047 |
System.Drawing.Bitmap image = GetBitmap(source); |
6048 |
//흰색 제거 |
6049 |
//image.MakeTransparent(System.Drawing.Color.White); |
6050 |
|
6051 |
var imageStream = new System.IO.MemoryStream(); |
6052 |
byte[] imageBytes = null; |
6053 |
using (imageStream) |
6054 |
{ |
6055 |
image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png); |
6056 |
// test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png); |
6057 |
imageStream.Position = 0; |
6058 |
imageBytes = imageStream.ToArray(); |
6059 |
} |
6060 |
|
6061 |
SymbolPrompt symbolPrompt = new SymbolPrompt(); |
6062 |
|
6063 |
RadWindow CheckPop = new RadWindow(); |
6064 |
//Alert check = new Alert(Msg); |
6065 |
|
6066 |
CheckPop = new RadWindow |
6067 |
{ |
6068 |
MinWidth = 400, |
6069 |
MinHeight = 100, |
6070 |
// Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
6071 |
Header = "Alert", |
6072 |
Content = symbolPrompt, |
6073 |
//DialogResult = |
6074 |
ResizeMode = System.Windows.ResizeMode.NoResize, |
6075 |
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, |
6076 |
IsTopmost = true, |
6077 |
}; |
6078 |
CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args); |
6079 |
StyleManager.SetTheme(CheckPop, new Office2013Theme()); |
6080 |
CheckPop.ShowDialog(); |
6081 |
|
6082 |
/* |
6083 |
DialogParameters parameters = new DialogParameters() |
6084 |
{ |
6085 |
Owner = Application.Current.MainWindow, |
6086 |
Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
6087 |
DefaultPromptResultValue = "Custom State", |
6088 |
Content = "Name :", |
6089 |
Header = "Insert Custom Symbol Name", |
6090 |
Theme = new VisualStudio2013Theme(), |
6091 |
ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
6092 |
}; |
6093 |
RadWindow.Prompt(parameters); |
6094 |
*/ |
6095 |
} |
6096 |
|
6097 |
public void Save_Capture(BitmapSource source, int x, int y, int width, int height) |
6098 |
{ |
6099 |
KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64(); |
6100 |
KCOMDataModel.DataModel.CHECK_LIST check_; |
6101 |
string Result = streamToBase64.ImageToBase64(source); |
6102 |
KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST(); |
6103 |
string projectno = App.ViewInfo.ProjectNO; |
6104 |
string checklist_id = ViewerDataModel.Instance.CheckList_ID; |
6105 |
|
6106 |
//Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1); |
6107 |
Item = this.BaseClient.GetCheckList(projectno, checklist_id); |
6108 |
if (Item != null) |
6109 |
{ |
6110 |
//Logger.sendResLog("GetCheckList", "TRUE", 1); |
6111 |
} |
6112 |
else |
6113 |
{ |
6114 |
//Logger.sendResLog("GetCheckList", "FALSE", 1); |
6115 |
} |
6116 |
|
6117 |
if (Item == null) |
6118 |
{ |
6119 |
check_ = new KCOMDataModel.DataModel.CHECK_LIST |
6120 |
{ |
6121 |
ID = Commons.shortGuid(), |
6122 |
USER_ID = App.ViewInfo.UserID, |
6123 |
IMAGE_URL = Result, |
6124 |
IMAGE_ANCHOR = x + "," + y + "," + width + "," + height, |
6125 |
PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber, |
6126 |
REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, |
6127 |
DOCUMENT_ID = App.ViewInfo.DocumentItemID, |
6128 |
PROJECT_NO = App.ViewInfo.ProjectNO, |
6129 |
STATUS = "False", |
6130 |
CREATE_TIME = DateTime.Now, |
6131 |
UPDATE_TIME = DateTime.Now, |
6132 |
DOCUMENT_NO = _DocItem.DOCUMENT_NO, |
6133 |
STATUS_DESC_OPEN = "Vendor 반영 필요", |
6134 |
}; |
6135 |
Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1); |
6136 |
//Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1); |
6137 |
this.BaseClient.AddCheckList(projectno, check_); |
6138 |
} |
6139 |
else |
6140 |
{ |
6141 |
Item.IMAGE_URL = Result; |
6142 |
Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height; |
6143 |
Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber; |
6144 |
Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1); |
6145 |
//Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1); |
6146 |
this.BaseClient.SaveCheckList(projectno, checklist_id, Item); |
6147 |
} |
6148 |
} |
6149 |
|
6150 |
public void Set_Capture() |
6151 |
{ |
6152 |
double x = CanvasDrawingMouseDownPoint.X; |
6153 |
double y = CanvasDrawingMouseDownPoint.Y; |
6154 |
double width = dragCaptureBorder.Width; |
6155 |
double height = dragCaptureBorder.Height; |
6156 |
|
6157 |
if (width > 5 || height > 5) |
6158 |
{ |
6159 |
canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
6160 |
BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height); |
6161 |
Save_Capture(source, (int)x, (int)y, (int)width, (int)height); |
6162 |
} |
6163 |
} |
6164 |
|
6165 |
#endregion 캡쳐 기능 |
6166 |
|
6167 |
public UndoData Control_Style(CommentUserInfo control) |
6168 |
{ |
6169 |
multi_UndoData = new UndoData(); |
6170 |
|
6171 |
multi_UndoData.Markup = control; |
6172 |
|
6173 |
if (control is IShapeControl) |
6174 |
{ |
6175 |
multi_UndoData.paint = (control as IShapeControl).Paint; |
6176 |
} |
6177 |
if (control is IDashControl) |
6178 |
{ |
6179 |
multi_UndoData.DashSize = (control as IDashControl).DashSize; |
6180 |
} |
6181 |
if (control is IPath) |
6182 |
{ |
6183 |
multi_UndoData.LineSize = (control as IPath).LineSize; |
6184 |
} |
6185 |
if ((control as UIElement) != null) |
6186 |
{ |
6187 |
multi_UndoData.Opacity = (control as UIElement).Opacity; |
6188 |
} |
6189 |
|
6190 |
return multi_UndoData; |
6191 |
} |
6192 |
|
6193 |
private async void Comment_Move(object sender, MouseButtonEventArgs e) |
6194 |
{ |
6195 |
string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).MarkupInfoID; |
6196 |
foreach (var items in ViewerDataModel.Instance._markupInfoRevList) |
6197 |
{ |
6198 |
if (items.MarkupInfoID == Select_ID) |
6199 |
{ |
6200 |
foreach (var item in items.MarkupList) |
6201 |
{ |
6202 |
if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
6203 |
{ |
6204 |
await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER,ViewerDataModel.Instance.PageAngle, "#FFFF0000", "", |
6205 |
items.MarkupInfoID, Commons.shortGuid()); |
6206 |
} |
6207 |
} |
6208 |
} |
6209 |
} |
6210 |
} |
6211 |
|
6212 |
/// <summary> |
6213 |
/// convert inkcontrol to polygoncontrol |
6214 |
/// </summary> |
6215 |
public void ConvertInkControlToPolygon() |
6216 |
{ |
6217 |
if (inkBoard.Strokes.Count > 0) |
6218 |
{ |
6219 |
inkBoard.Strokes.ToList().ForEach(stroke => |
6220 |
{ |
6221 |
InkToPath ip = new InkToPath(); |
6222 |
|
6223 |
List<Point> inkPointSet = new List<Point>(); |
6224 |
inkPointSet.AddRange(ip.GetPointsFrom(stroke)); |
6225 |
|
6226 |
PolygonControl pc = new PolygonControl() |
6227 |
{ |
6228 |
CommentAngle = 0, |
6229 |
PointSet = inkPointSet, |
6230 |
ControlType = ControlType.Ink |
6231 |
}; |
6232 |
pc.StartPoint = inkPointSet[0]; |
6233 |
pc.EndPoint = inkPointSet[inkPointSet.Count - 1]; |
6234 |
pc.LineSize = 3; |
6235 |
pc.CommentID = Commons.shortGuid(); |
6236 |
pc.StrokeColor = new SolidColorBrush(Colors.Red); |
6237 |
|
6238 |
if (pc.PointSet.Count > 0) |
6239 |
{ |
6240 |
CreateCommand.Instance.Execute(pc); |
6241 |
ViewerDataModel.Instance.MarkupControls_USER.Add(pc); |
6242 |
} |
6243 |
}); |
6244 |
inkBoard.Strokes.Clear(); |
6245 |
} |
6246 |
} |
6247 |
|
6248 |
/// <summary> |
6249 |
/// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌 |
6250 |
/// </summary> |
6251 |
/// <author>ingu</author> |
6252 |
/// <date>2018.06.05</date> |
6253 |
/// <param name="getPoint"></param> |
6254 |
/// <returns></returns> |
6255 |
private bool IsGetoutpoint(Point getPoint) |
6256 |
{ |
6257 |
if (getPoint == new Point()) |
6258 |
{ |
6259 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl); |
6260 |
currentControl = null; |
6261 |
return true; |
6262 |
} |
6263 |
|
6264 |
return false; |
6265 |
} |
6266 |
|
6267 |
private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
6268 |
{ |
6269 |
e.Effects = DragDropEffects.Copy; |
6270 |
} |
6271 |
|
6272 |
private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
6273 |
{ |
6274 |
e.Effects = DragDropEffects.Copy; |
6275 |
} |
6276 |
|
6277 |
private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
6278 |
{ |
6279 |
e.Effects = DragDropEffects.None; |
6280 |
} |
6281 |
|
6282 |
private void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e) |
6283 |
{ |
6284 |
var pageWidth = ViewerDataModel.Instance.ImageViewWidth; |
6285 |
var pageHeight = ViewerDataModel.Instance.ImageViewHeight; |
6286 |
|
6287 |
ScaleImage(pageWidth, pageHeight); |
6288 |
} |
6289 |
|
6290 |
/// <summary> |
6291 |
/// 페이지를 scale의 변화에 맞춰서 DecodePixel을 변경한다. |
6292 |
/// </summary> |
6293 |
/// <param name="pageWidth">원본 사이즈</param> |
6294 |
/// <param name="pageHeight">원본 사이즈</param> |
6295 |
/// <returns></returns> |
6296 |
private void ScaleImage(double pageWidth, double pageHeight) |
6297 |
{ |
6298 |
//mainPanel.Scale = zoomAndPanControl.ContentScale;// (zoomAndPanControl.ContentScale >= 0.1) ? 1 : zoomAndPanControl.ContentScale; |
6299 |
} |
6300 |
|
6301 |
private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e) |
6302 |
{ |
6303 |
CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString()); |
6304 |
} |
6305 |
|
6306 |
private void gridViewMarkupAllSelect_Click(object sender, RoutedEventArgs e) |
6307 |
{ |
6308 |
var checkbox = (sender as CheckBox); |
6309 |
|
6310 |
if (checkbox != null) |
6311 |
{ |
6312 |
if (checkbox.IsChecked.GetValueOrDefault()) |
6313 |
{ |
6314 |
if (!App.ViewInfo.CreateFinalPDFPermission && App.ViewInfo.NewCommentPermission) |
6315 |
{ |
6316 |
var currentItem = gridViewMarkup.Items.OfType<IKCOM.MarkupInfoItem>().Where(x => x.UserID == App.ViewInfo.UserID); |
6317 |
|
6318 |
if (currentItem.Count() > 0) |
6319 |
{ |
6320 |
foreach (var item in gridViewMarkup.Items.OfType<IKCOM.MarkupInfoItem>()) |
6321 |
{ |
6322 |
if (item.Consolidate == 0 && item.Depatment == currentItem.First().Depatment) |
6323 |
{ |
6324 |
gridViewMarkup.SelectedItems.Add(item); |
6325 |
} |
6326 |
} |
6327 |
} |
6328 |
} |
6329 |
else |
6330 |
{ |
6331 |
gridViewMarkup.SelectAll(); |
6332 |
} |
6333 |
} |
6334 |
else |
6335 |
{ |
6336 |
gridViewMarkup.UnselectAll(); |
6337 |
} |
6338 |
} |
6339 |
} |
6340 |
|
6341 |
private void gridViewMarkup_MouseRightButtonDown(object sender, MouseButtonEventArgs e) |
6342 |
{ |
6343 |
var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>(); |
6344 |
|
6345 |
if (dataSet?.Count() == 1) |
6346 |
{ |
6347 |
PopupWindow popup = new PopupWindow(); |
6348 |
|
6349 |
} |
6350 |
} |
6351 |
|
6352 |
private void gridViewMarkup_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e) |
6353 |
{ |
6354 |
foreach(var vCol in e.OwnerGridViewItemsControl.Columns) |
6355 |
{ |
6356 |
vCol.IsReadOnly = false; |
6357 |
} |
6358 |
} |
6359 |
|
6360 |
private void gridViewMarkup_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e) |
6361 |
{ |
6362 |
var vEditItem = e.EditedItem; |
6363 |
((MarkupInfoItem)vEditItem).UserID = App.ViewInfo.UserID; |
6364 |
((MarkupInfoItem)vEditItem).UpdateTime = DateTime.Now; |
6365 |
//((GridViewRow)e.Row).MarkupInfoItem).UserID == App.ViewInfo.UserID |
6366 |
|
6367 |
foreach (var vCol in ((RadGridView)e.OriginalSource).Columns) |
6368 |
{ |
6369 |
vCol.IsReadOnly = true; |
6370 |
} |
6371 |
} |
6372 |
|
6373 |
|
6374 |
|
6375 |
/* |
6376 |
private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
6377 |
{ |
6378 |
try |
6379 |
{ |
6380 |
if (e.Data.GetDataPresent(typeof(string))) |
6381 |
{ |
6382 |
this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
6383 |
string dragData = e.Data.GetData(typeof(string)) as string; |
6384 |
Move_Symbol(sender, dragData); |
6385 |
} |
6386 |
} |
6387 |
catch (Exception ex) |
6388 |
{ |
6389 |
//Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0); |
6390 |
} |
6391 |
} |
6392 |
*/ |
6393 |
} |
6394 |
|
6395 |
public class testItem |
6396 |
{ |
6397 |
public string Title { get; set; } |
6398 |
} |
6399 |
|
6400 |
|
6401 |
} |