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