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