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