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