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