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