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