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