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