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