markus / KCOM / Views / MainMenu.xaml.cs @ bb3a236d
이력 | 보기 | 이력해설 | 다운로드 (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 | bb3a236d | ljiyeon | |
329 | 787a4489 | KangIngu | if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null) |
330 | { |
||
331 | if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0) |
||
332 | { |
||
333 | 24678e06 | humkyung | var infoId = Commons.shortGuid(); |
334 | 787a4489 | KangIngu | PreviewUserMarkupInfoItem = new MarkupInfoItem |
335 | { |
||
336 | CreateTime = DateTime.Now, |
||
337 | Depatment = userData.DEPARTMENT, |
||
338 | 992a98b4 | KangIngu | UpdateTime = DateTime.Now, |
339 | 787a4489 | KangIngu | DisplayColor = "#FFFF0000", |
340 | UserID = userData.ID, |
||
341 | UserName = userData.NAME, |
||
342 | PageCount = 1, |
||
343 | Description = "", |
||
344 | MarkupInfoID = infoId, |
||
345 | MarkupList = null, |
||
346 | 24678e06 | humkyung | MarkupVersionID = Commons.shortGuid(), |
347 | 787a4489 | KangIngu | Consolidate = 0, |
348 | PartConsolidate = 0, |
||
349 | userDelete = true, |
||
350 | AvoidConsolidate = 0, |
||
351 | IsPreviewUser = true |
||
352 | }; |
||
353 | App.Custom_ViewInfoId = infoId; |
||
354 | } |
||
355 | } |
||
356 | 0f065e57 | ljiyeon | Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1); |
357 | 787a4489 | KangIngu | BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID); |
358 | } |
||
359 | |||
360 | 959b3ef2 | humkyung | /// <summary> |
361 | /// delete selected comments |
||
362 | /// </summary> |
||
363 | /// <param name="sender"></param> |
||
364 | /// <param name="e"></param> |
||
365 | 787a4489 | KangIngu | public void DeleteCommentEvent(object sender, RoutedEventArgs e) |
366 | { |
||
367 | //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가) |
||
368 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
369 | 787a4489 | KangIngu | |
370 | Button content = (sender as Button); |
||
371 | MarkupInfoItem item = content.CommandParameter as MarkupInfoItem; |
||
372 | |||
373 | DeleteItem(item); |
||
374 | } |
||
375 | |||
376 | System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation(); |
||
377 | |||
378 | 6707a5c7 | ljiyeon | private static Timer timer; |
379 | private int InitInterval = KCOM.Properties.Settings.Default.InitInterval; |
||
380 | 787a4489 | KangIngu | private void MainMenu_Loaded(object sender, RoutedEventArgs e) |
381 | 90e7968d | ljiyeon | { |
382 | 510cbd2a | ljiyeon | InitializeComponent(); |
383 | 0c997b99 | ljiyeon | |
384 | 90e7968d | ljiyeon | //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms"); |
385 | |||
386 | 787a4489 | KangIngu | if (App.ParameterMode) |
387 | 6707a5c7 | ljiyeon | { |
388 | this.pageNavigator.PageChanging += pageNavigator_PageChanging; |
||
389 | imageViewer_Compare = new Image(); |
||
390 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
391 | da.From = 0.8; |
||
392 | da.To = 0; |
||
393 | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
||
394 | da.AutoReverse = true; |
||
395 | e0204db0 | djkim | da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever; |
396 | |||
397 | if (!App.ViewInfo.CreateFinalPDFPermission && !App.ViewInfo.NewCommentPermission) |
||
398 | 90e7968d | ljiyeon | { |
399 | e0204db0 | djkim | this.SymbolPane.Visibility = Visibility.Collapsed; |
400 | this.FavoritePane.Visibility = Visibility.Collapsed; |
||
401 | this.drawingRotateCanvas.IsHitTestVisible = false; |
||
402 | 90e7968d | ljiyeon | } |
403 | 6707a5c7 | ljiyeon | } |
404 | 90e7968d | ljiyeon | timer = new Timer(timercallback, null, 0, InitInterval * 60000); |
405 | ccf944bb | ljiyeon | } |
406 | |||
407 | 6707a5c7 | ljiyeon | private void timercallback(Object o) |
408 | ccf944bb | ljiyeon | { |
409 | 6707a5c7 | ljiyeon | Stopwatch sw = new Stopwatch(); |
410 | sw.Start(); |
||
411 | 3b484ebb | ljiyeon | TempFile.TempFileAdd(); |
412 | 6707a5c7 | ljiyeon | sw.Stop(); |
413 | ccf944bb | ljiyeon | |
414 | 90e7968d | ljiyeon | Dispatcher.InvokeAsync(new Action(delegate |
415 | ccf944bb | ljiyeon | { |
416 | 6707a5c7 | ljiyeon | if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked? |
417 | { |
||
418 | timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting |
||
419 | } |
||
420 | })); |
||
421 | ccf944bb | ljiyeon | |
422 | 90e7968d | ljiyeon | ////GC.Collect(); |
423 | 6707a5c7 | ljiyeon | } |
424 | 077896be | humkyung | |
425 | 787a4489 | KangIngu | public List<CommentUserInfo> AddAdorner() |
426 | { |
||
427 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
428 | |||
429 | if (SelectLayer.Children.Count > 0) |
||
430 | { |
||
431 | foreach (var item in SelectLayer.Children) |
||
432 | { |
||
433 | if (item.GetType().Name == "AdornerFinal") |
||
434 | { |
||
435 | (item as AdornerFinal).unRegister(); |
||
436 | |||
437 | foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>()) |
||
438 | { |
||
439 | if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
||
440 | { |
||
441 | adornerSet.Add(InnerItem.DrawingData as CommentUserInfo); |
||
442 | } |
||
443 | |||
444 | Control_Style(InnerItem.DrawingData as CommentUserInfo); |
||
445 | |||
446 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
447 | multi_Undo_Data = new Multi_Undo_data(); |
||
448 | } |
||
449 | } |
||
450 | } |
||
451 | SelectLayer.Children.Clear(); |
||
452 | } |
||
453 | return adornerSet; |
||
454 | } |
||
455 | |||
456 | public void ChangeCommentReact() |
||
457 | { |
||
458 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1); |
459 | 787a4489 | KangIngu | bool isComingNewBie = false; |
460 | |||
461 | if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
462 | { |
||
463 | foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
||
464 | { |
||
465 | 036650a0 | humkyung | var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID); |
466 | 90e7968d | ljiyeon | |
467 | 6707a5c7 | ljiyeon | var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault(); |
468 | if (existItem != null) //신규 추가 된 코멘트 |
||
469 | { |
||
470 | if (existItem.Data != root.ConvertData) //코멘트가 같은지 |
||
471 | 787a4489 | KangIngu | { |
472 | 6707a5c7 | ljiyeon | existItem.Data = root.ConvertData; |
473 | existItem.IsUpdate = true; |
||
474 | 69db7b26 | ljiyeon | ComingNewBieEnd = false; |
475 | d7548b21 | ljiyeon | } |
476 | 6707a5c7 | ljiyeon | } |
477 | else |
||
478 | { |
||
479 | if (root.CommentID != null) |
||
480 | d7548b21 | ljiyeon | { |
481 | 6707a5c7 | ljiyeon | isComingNewBie = true; |
482 | var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault(); |
||
483 | if (currentCommentCheck != null) |
||
484 | 787a4489 | KangIngu | { |
485 | 6707a5c7 | ljiyeon | currentCommentCheck.Data = root.ConvertData; |
486 | } |
||
487 | else |
||
488 | { |
||
489 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
490 | 787a4489 | KangIngu | { |
491 | 6707a5c7 | ljiyeon | ID = control.CommentID, |
492 | Data = root.ConvertData, |
||
493 | Data_Type = root.DATA_TYPE, |
||
494 | MarkupInfoID = App.Custom_ViewInfoId, |
||
495 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
496 | c8e9b3e4 | ljiyeon | Symbol_ID = control.SymbolID, |
497 | 53880c83 | ljiyeon | Group_ID = control.GroupID, |
498 | 6707a5c7 | ljiyeon | }); |
499 | 69db7b26 | ljiyeon | ComingNewBieEnd = false; |
500 | 787a4489 | KangIngu | } |
501 | } |
||
502 | 90e7968d | ljiyeon | } |
503 | 787a4489 | KangIngu | } |
504 | } |
||
505 | |||
506 | 6707a5c7 | ljiyeon | |
507 | 787a4489 | KangIngu | if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd) |
508 | { |
||
509 | if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null) |
||
510 | { |
||
511 | ComingNewBieEnd = true; |
||
512 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
513 | PreviewUserMarkupInfoItem.IsPreviewUser = false; |
||
514 | gridViewMarkup.ItemsSource = null; |
||
515 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
516 | gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
517 | } |
||
518 | } |
||
519 | } |
||
520 | |||
521 | bool ComingNewBieEnd = false; |
||
522 | |||
523 | private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
||
524 | 548c696e | ljiyeon | { |
525 | Logger.sendCheckLog("pageNavigator_PageChanging_Start", 1); |
||
526 | 316d0f5c | KangIngu | if (ViewerDataModel.Instance.UndoDataList.Count > 0) |
527 | 548c696e | ljiyeon | { |
528 | Logger.sendCheckLog("pageNavigator_PageChanging_이전페이지Save", 1); |
||
529 | 316d0f5c | KangIngu | this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null); |
530 | } |
||
531 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_UndoDataListClear", 1); |
532 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Clear(); |
533 | 90e7968d | ljiyeon | |
534 | 787a4489 | KangIngu | InkControl_Convert(); |
535 | |||
536 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
537 | 787a4489 | KangIngu | ChangeCommentReact(); |
538 | 548c696e | ljiyeon | |
539 | Logger.sendCheckLog("pageNavigator_PageChanging_변수생성 및 값 설정", 1); |
||
540 | 787a4489 | KangIngu | CompareMode.IsChecked = false; |
541 | var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber; |
||
542 | |||
543 | |||
544 | #region 페이지가 벗어난 경우 |
||
545 | |||
546 | if (BalancePoint < 1) |
||
547 | { |
||
548 | BalancePoint = 1; |
||
549 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
550 | } |
||
551 | |||
552 | if (pageNavigator.PageCount < BalancePoint) |
||
553 | { |
||
554 | BalancePoint = pageNavigator.PageCount; |
||
555 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
556 | } |
||
557 | |||
558 | #endregion |
||
559 | |||
560 | ViewerDataModel.Instance.PageNumber = BalancePoint; |
||
561 | |||
562 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_페이지 Image url 설정", 1); |
563 | a874198d | humkyung | string uri = ""; |
564 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
565 | a874198d | humkyung | { |
566 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber); |
||
567 | } |
||
568 | else |
||
569 | { |
||
570 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber); |
||
571 | } |
||
572 | 548c696e | ljiyeon | |
573 | 8a9f6742 | djkim | var defaultBitmapImage = new BitmapImage(); |
574 | defaultBitmapImage.BeginInit(); |
||
575 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
576 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
577 | defaultBitmapImage.UriSource = new Uri(uri); |
||
578 | defaultBitmapImage.EndInit(); |
||
579 | |||
580 | ViewerDataModel.Instance.ImageViewPath = null; |
||
581 | 548c696e | ljiyeon | GC.Collect(); |
582 | 787a4489 | KangIngu | |
583 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage Downloading", 1); |
584 | 787a4489 | KangIngu | if (defaultBitmapImage.IsDownloading) |
585 | { |
||
586 | 122914ba | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage IsDownloading", 1); |
587 | 787a4489 | KangIngu | defaultBitmapImage.DownloadCompleted += (ex, arg) => |
588 | { |
||
589 | 8a9f6742 | djkim | defaultBitmapImage.Freeze(); |
590 | mainPanel.UpdateLayout(); |
||
591 | 90e7968d | ljiyeon | GC.Collect(); |
592 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage; |
593 | ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth; |
||
594 | ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight; |
||
595 | }; |
||
596 | } |
||
597 | |||
598 | zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH); |
||
599 | zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT); |
||
600 | |||
601 | |||
602 | Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
||
603 | Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
||
604 | inkBoard.Width = zoomAndPanCanvas.Width; |
||
605 | inkBoard.Height = zoomAndPanCanvas.Height; |
||
606 | |||
607 | 90e7968d | ljiyeon | |
608 | 787a4489 | KangIngu | |
609 | if (!testPanel2.IsHidden) |
||
610 | { |
||
611 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1); |
612 | 787a4489 | KangIngu | //PDF모드일때 잠시 대기(강인구) |
613 | if (IsSyncPDFMode) |
||
614 | { |
||
615 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
616 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
617 | |||
618 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1); |
619 | 787a4489 | KangIngu | if (pdfpath.IsDownloading) |
620 | { |
||
621 | pdfpath.DownloadCompleted += (ex, arg) => |
||
622 | { |
||
623 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1); |
624 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
625 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
626 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
627 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
628 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
629 | }; |
||
630 | } |
||
631 | else |
||
632 | { |
||
633 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1); |
634 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
635 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
636 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
637 | |||
638 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
639 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
640 | } |
||
641 | } |
||
642 | else |
||
643 | { |
||
644 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1); |
645 | a874198d | humkyung | string uri2 = ""; |
646 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
647 | a874198d | humkyung | { |
648 | uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint); |
||
649 | } |
||
650 | else |
||
651 | { |
||
652 | uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint); |
||
653 | } |
||
654 | a1716fa5 | KangIngu | |
655 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1); |
656 | 787a4489 | KangIngu | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2)); |
657 | |||
658 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanCanvas2 Page Setting", 1); |
659 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
660 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
661 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
662 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
663 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
664 | |||
665 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1); |
666 | 787a4489 | KangIngu | zoomAndPanControl.ZoomTo(new Rect |
667 | { |
||
668 | X = 0, |
||
669 | Y = 0, |
||
670 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
671 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
672 | }); |
||
673 | |||
674 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1); |
675 | 787a4489 | KangIngu | if (defaultBitmapImage_Compare.IsDownloading) |
676 | { |
||
677 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
678 | { |
||
679 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare DownloadCompleted", 1); |
680 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
681 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
682 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
683 | 90e7968d | ljiyeon | |
684 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
685 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
686 | |||
687 | zoomAndPanControl.ZoomTo(new Rect |
||
688 | { |
||
689 | X = 0, |
||
690 | Y = 0, |
||
691 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
692 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
693 | }); |
||
694 | }; |
||
695 | } |
||
696 | } |
||
697 | tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
||
698 | } |
||
699 | |||
700 | this.pageNavigator.SetNextPage(); |
||
701 | |||
702 | if (zoomAndPanCanvas2.Width.IsNaN()) |
||
703 | { |
||
704 | zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }); |
||
705 | } |
||
706 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_ControlData Setting", 1); |
707 | 787a4489 | KangIngu | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
708 | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
||
709 | |||
710 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
711 | 90e7968d | ljiyeon | |
712 | 787a4489 | KangIngu | foreach (var item in gridSelectionItem) |
713 | { |
||
714 | if (item.UserID == App.ViewInfo.UserID) |
||
715 | { |
||
716 | 6707a5c7 | ljiyeon | ViewerDataModel.Instance.current_page_commentcnt = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count; |
717 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
718 | { |
||
719 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
720 | item.MarkupInfoID, markupitem.ID); |
||
721 | 787a4489 | KangIngu | }); |
722 | 90e7968d | ljiyeon | |
723 | 787a4489 | KangIngu | } |
724 | else |
||
725 | { |
||
726 | ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
727 | { |
||
728 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
729 | 787a4489 | KangIngu | }); |
730 | } |
||
731 | } |
||
732 | 90e7968d | ljiyeon | |
733 | 787a4489 | KangIngu | if (!testPanel2.IsHidden) |
734 | { |
||
735 | dd0ffcfb | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
736 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
737 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
738 | |||
739 | 787a4489 | KangIngu | Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
740 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
741 | |||
742 | |||
743 | foreach (var item in gridSelectionRevItem) |
||
744 | { |
||
745 | item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem) |
||
746 | { |
||
747 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
748 | 787a4489 | KangIngu | }); |
749 | } |
||
750 | } |
||
751 | |||
752 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
753 | instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
||
754 | 992a98b4 | KangIngu | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
755 | 787a4489 | KangIngu | |
756 | instanceMain.dzTopMenu.rotateOffSet = 0; |
||
757 | var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault(); |
||
758 | drawingPannelRotate(pageinfo.PAGE_ANGLE); |
||
759 | |||
760 | //} |
||
761 | SetCommentPages(true); |
||
762 | } |
||
763 | 90e7968d | ljiyeon | |
764 | 6707a5c7 | ljiyeon | |
765 | 3b484ebb | ljiyeon | |
766 | 787a4489 | KangIngu | |
767 | private void SetCommentPages(bool onlyMe = false) |
||
768 | { |
||
769 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1); |
770 | 787a4489 | KangIngu | List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>(); |
771 | foreach (var item in ViewerDataModel.Instance._markupInfoList) |
||
772 | { |
||
773 | UsersCommentPagesMember instance = new UsersCommentPagesMember(); |
||
774 | instance.UserName = item.UserName; |
||
775 | instance.Depart = item.Depatment; |
||
776 | instance.MarkupInfoID = item.MarkupInfoID; |
||
777 | instance.IsSelected = true; |
||
778 | instance.isConSolidation = item.Consolidate; |
||
779 | instance.SetColor = item.DisplayColor; |
||
780 | if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID) |
||
781 | { |
||
782 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList(); |
||
783 | } |
||
784 | else |
||
785 | { |
||
786 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList(); |
||
787 | } |
||
788 | _pages.Add(instance); |
||
789 | } |
||
790 | this.pageNavigator.SetCommentList(_pages.ToList()); |
||
791 | } |
||
792 | |||
793 | private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
||
794 | { |
||
795 | if (e.MiddleButton == MouseButtonState.Pressed) |
||
796 | { |
||
797 | |||
798 | } |
||
799 | e.Handled = true; |
||
800 | if (e.Delta > 0) |
||
801 | { |
||
802 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
803 | ZoomIn(currentContentMousePoint); |
||
804 | } |
||
805 | else |
||
806 | { |
||
807 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
808 | ZoomOut(currentContentMousePoint); |
||
809 | } |
||
810 | } |
||
811 | |||
812 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e) |
813 | { |
||
814 | e.Handled = true; |
||
815 | if (e.Delta > 0) |
||
816 | { |
||
817 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
818 | ZoomIn_Sync(currentContentMousePoint); |
||
819 | } |
||
820 | else |
||
821 | { |
||
822 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
823 | ZoomOut_Sync(currentContentMousePoint); |
||
824 | } |
||
825 | } |
||
826 | |||
827 | 787a4489 | KangIngu | #region ZoomIn & ZoomOut |
828 | |||
829 | private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e) |
||
830 | { |
||
831 | ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
832 | zoomAndPanControl.ContentZoomFocusY)); |
||
833 | } |
||
834 | |||
835 | private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e) |
||
836 | { |
||
837 | ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
838 | zoomAndPanControl.ContentZoomFocusY)); |
||
839 | } |
||
840 | |||
841 | |||
842 | //강인구 추가 (줌 인아웃 수치 변경) |
||
843 | //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼 |
||
844 | private void ZoomOut(Point contentZoomCenter) |
||
845 | { |
||
846 | if (zoomAndPanControl.ContentScale > 0.39) |
||
847 | { |
||
848 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter); |
||
849 | } |
||
850 | else |
||
851 | { |
||
852 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter); |
||
853 | } |
||
854 | |||
855 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
856 | 787a4489 | KangIngu | { |
857 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
858 | 787a4489 | KangIngu | } |
859 | } |
||
860 | |||
861 | private void ZoomIn(Point contentZoomCenter) |
||
862 | { |
||
863 | if (zoomAndPanControl.ContentScale > 0.19) |
||
864 | { |
||
865 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter); |
||
866 | } |
||
867 | else |
||
868 | { |
||
869 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter); |
||
870 | } |
||
871 | |||
872 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
873 | 787a4489 | KangIngu | { |
874 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
875 | 787a4489 | KangIngu | } |
876 | a1716fa5 | KangIngu | |
877 | } |
||
878 | |||
879 | private void ZoomOut_Sync(Point contentZoomCenter) |
||
880 | { |
||
881 | if (zoomAndPanControl2.ContentScale > 0.39) |
||
882 | { |
||
883 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter); |
||
884 | } |
||
885 | else |
||
886 | { |
||
887 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter); |
||
888 | } |
||
889 | |||
890 | if (Sync.IsChecked) |
||
891 | { |
||
892 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
893 | } |
||
894 | } |
||
895 | |||
896 | private void ZoomIn_Sync(Point contentZoomCenter) |
||
897 | { |
||
898 | if (zoomAndPanControl2.ContentScale > 0.19) |
||
899 | { |
||
900 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter); |
||
901 | } |
||
902 | else |
||
903 | { |
||
904 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter); |
||
905 | } |
||
906 | |||
907 | if (Sync.IsChecked) |
||
908 | { |
||
909 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
910 | } |
||
911 | 787a4489 | KangIngu | } |
912 | |||
913 | private void ZoomOut() |
||
914 | { |
||
915 | zoomAndPanControl.ContentScale -= 0.1; |
||
916 | //if (zoomAndPanControl2 != null) |
||
917 | //{ |
||
918 | // zoomAndPanControl2.ContentScale -= 0.1; |
||
919 | //} |
||
920 | } |
||
921 | |||
922 | private void ZoomIn() |
||
923 | { |
||
924 | zoomAndPanControl.ContentScale += 0.1; |
||
925 | //if (zoomAndPanControl2 != null) |
||
926 | //{ |
||
927 | // zoomAndPanControl2.ContentScale += 0.1; |
||
928 | //} |
||
929 | } |
||
930 | |||
931 | #endregion |
||
932 | |||
933 | private void init() |
||
934 | { |
||
935 | foreach (var item in ViewerDataModel.Instance.MarkupControls) |
||
936 | { |
||
937 | |||
938 | ControlList.Clear(); |
||
939 | listBox.Items.Clear(); |
||
940 | selected_item.Clear(); |
||
941 | |||
942 | (item as IMarkupCommonData).IsSelected = false; |
||
943 | } |
||
944 | |||
945 | } |
||
946 | |||
947 | private HitTestResultBehavior MyCallback(HitTestResult result) |
||
948 | { |
||
949 | //this.cursor = Cursors.UpArrow; |
||
950 | var element = result.VisualHit; |
||
951 | while (element != null && !(element is CommentUserInfo)) |
||
952 | element = VisualTreeHelper.GetParent(element); |
||
953 | |||
954 | if (element == null) |
||
955 | { |
||
956 | return HitTestResultBehavior.Stop; |
||
957 | } |
||
958 | else |
||
959 | { |
||
960 | if (element is CommentUserInfo) |
||
961 | { |
||
962 | if (!hitList.Contains(element)) |
||
963 | { |
||
964 | hitList.Add((CommentUserInfo)element); |
||
965 | } |
||
966 | else |
||
967 | { |
||
968 | return HitTestResultBehavior.Stop; |
||
969 | } |
||
970 | //IntersectionDetail intersectionDetail = |
||
971 | //((GeometryHitTestResult)result).IntersectionDetail; |
||
972 | //switch (intersectionDetail) |
||
973 | //{ |
||
974 | // case IntersectionDetail.FullyContains: |
||
975 | // // Add the hit test result to the list: |
||
976 | // hitList.Add((CommentUserInfo)result.VisualHit); |
||
977 | // return HitTestResultBehavior.Continue; |
||
978 | // case IntersectionDetail.Intersects: |
||
979 | // // Set the behavior to return visuals at all z-order levels: |
||
980 | // return HitTestResultBehavior.Continue; |
||
981 | // case IntersectionDetail.FullyInside: |
||
982 | // // Set the behavior to return visuals at all z-order levels: |
||
983 | // return HitTestResultBehavior.Continue; |
||
984 | // default: |
||
985 | // return HitTestResultBehavior.Stop; |
||
986 | //} |
||
987 | } |
||
988 | } |
||
989 | return HitTestResultBehavior.Continue; |
||
990 | } |
||
991 | |||
992 | public void ReleaseSelectPath() |
||
993 | { |
||
994 | if (SelectionPath == null) |
||
995 | { |
||
996 | SelectionPath = new Path(); |
||
997 | SelectionPath.Name = ""; |
||
998 | } |
||
999 | if (SelectionPath.Name != "") |
||
1000 | { |
||
1001 | SelectionPath.Name = "None"; |
||
1002 | } |
||
1003 | SelectionPath.Opacity = 0.01; |
||
1004 | SelectionPath.RenderTransform = null; |
||
1005 | SelectionPath.RenderTransformOrigin = new Point(0, 0); |
||
1006 | } |
||
1007 | |||
1008 | #region 컨트롤 초기화 |
||
1009 | public void Control_Init(object control) |
||
1010 | { |
||
1011 | if (L_Size != 0 && (control as IPath) != null) |
||
1012 | { |
||
1013 | (control as IPath).LineSize = L_Size; |
||
1014 | L_Size = 0; |
||
1015 | } |
||
1016 | |||
1017 | switch (control.GetType().Name) |
||
1018 | { |
||
1019 | case "RectangleControl": |
||
1020 | { |
||
1021 | (control as RectangleControl).StrokeColor = Brushes.Red; |
||
1022 | } |
||
1023 | break; |
||
1024 | case "CircleControl": |
||
1025 | { |
||
1026 | (control as CircleControl).StrokeColor = Brushes.Red; |
||
1027 | } |
||
1028 | break; |
||
1029 | case "TriControl": |
||
1030 | { |
||
1031 | (control as TriControl).StrokeColor = Brushes.Red; |
||
1032 | } |
||
1033 | break; |
||
1034 | case "RectCloudControl": |
||
1035 | { |
||
1036 | (control as RectCloudControl).StrokeColor = Brushes.Red; |
||
1037 | } |
||
1038 | break; |
||
1039 | case "CloudControl": |
||
1040 | { |
||
1041 | (control as CloudControl).StrokeColor = Brushes.Red; |
||
1042 | } |
||
1043 | break; |
||
1044 | case "PolygonControl": |
||
1045 | { |
||
1046 | (control as PolygonControl).StrokeColor = Brushes.Red; |
||
1047 | } |
||
1048 | break; |
||
1049 | case "ArcControl": |
||
1050 | { |
||
1051 | (control as ArcControl).StrokeColor = Brushes.Red; |
||
1052 | } |
||
1053 | break; |
||
1054 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
1055 | { |
||
1056 | (control as ArrowArcControl).StrokeColor = Brushes.Red; |
||
1057 | } |
||
1058 | break; |
||
1059 | 787a4489 | KangIngu | case "LineControl": |
1060 | { |
||
1061 | (control as LineControl).StrokeColor = Brushes.Red; |
||
1062 | } |
||
1063 | break; |
||
1064 | case "ArrowControl_Multi": |
||
1065 | { |
||
1066 | (control as ArrowControl_Multi).StrokeColor = Brushes.Red; |
||
1067 | } |
||
1068 | break; |
||
1069 | case "TextControl": |
||
1070 | { |
||
1071 | (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1072 | } |
||
1073 | break; |
||
1074 | case "ArrowTextControl": |
||
1075 | { |
||
1076 | (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1077 | } |
||
1078 | break; |
||
1079 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
1080 | { |
||
1081 | (control as InsideWhiteControl).StrokeColor = Brushes.White; |
||
1082 | } |
||
1083 | break; |
||
1084 | case "OverlapWhiteControl": |
||
1085 | { |
||
1086 | (control as OverlapWhiteControl).StrokeColor = Brushes.White; |
||
1087 | } |
||
1088 | break; |
||
1089 | case "ClipWhiteControl": |
||
1090 | { |
||
1091 | (control as ClipWhiteControl).StrokeColor = Brushes.White; |
||
1092 | } |
||
1093 | break; |
||
1094 | case "CoordinateControl": |
||
1095 | { |
||
1096 | (control as CoordinateControl).StrokeColor = Brushes.Black; |
||
1097 | } |
||
1098 | break; |
||
1099 | 787a4489 | KangIngu | } |
1100 | } |
||
1101 | #endregion |
||
1102 | |||
1103 | public void firstCondition_MouseLeave(object sender, MouseEventArgs e) |
||
1104 | { |
||
1105 | //Control_Init(e.Source); |
||
1106 | } |
||
1107 | 53880c83 | ljiyeon | private Window _dragdropWindow = null; |
1108 | |||
1109 | [DllImport("user32.dll")] |
||
1110 | [return: MarshalAs(UnmanagedType.Bool)] |
||
1111 | internal static extern bool GetCursorPos(ref Win32Point pt); |
||
1112 | |||
1113 | [StructLayout(LayoutKind.Sequential)] |
||
1114 | internal struct Win32Point |
||
1115 | { |
||
1116 | public Int32 X; |
||
1117 | public Int32 Y; |
||
1118 | }; |
||
1119 | public string symbol_id = null; |
||
1120 | public long symbol_group_id; |
||
1121 | public int symbol_SelectedIndex; |
||
1122 | public ImageSource symbol_img; |
||
1123 | public string symbol_Data = null; |
||
1124 | public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img) |
||
1125 | { |
||
1126 | if (this._dragdropWindow != null) |
||
1127 | { |
||
1128 | this._dragdropWindow.Close(); |
||
1129 | this._dragdropWindow = null; |
||
1130 | } |
||
1131 | |||
1132 | symbol_id = id; |
||
1133 | symbol_group_id = group_id; |
||
1134 | symbol_SelectedIndex = SelectedIndex; |
||
1135 | symbol_Data = Data_; |
||
1136 | symbol_img = img; |
||
1137 | |||
1138 | |||
1139 | CreateDragDropWindow2(img); |
||
1140 | } |
||
1141 | |||
1142 | private void CreateDragDropWindow2(ImageSource image) |
||
1143 | { |
||
1144 | this._dragdropWindow = new Window(); |
||
1145 | _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
1146 | _dragdropWindow.WindowStyle = WindowStyle.None; |
||
1147 | _dragdropWindow.AllowsTransparency = true; |
||
1148 | _dragdropWindow.AllowDrop = false; |
||
1149 | _dragdropWindow.Background = null; |
||
1150 | _dragdropWindow.IsHitTestVisible = false; |
||
1151 | _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight; |
||
1152 | _dragdropWindow.Topmost = true; |
||
1153 | _dragdropWindow.ShowInTaskbar = false; |
||
1154 | |||
1155 | Rectangle r = new Rectangle(); |
||
1156 | r.Width = image.Width; |
||
1157 | r.Height = image.Height; |
||
1158 | r.Opacity = 0.5; |
||
1159 | r.Fill = new ImageBrush(image); |
||
1160 | this._dragdropWindow.Content = r; |
||
1161 | |||
1162 | Win32Point w32Mouse = new Win32Point(); |
||
1163 | GetCursorPos(ref w32Mouse); |
||
1164 | |||
1165 | //w32Mouse.X = getCurrentPoint.X; |
||
1166 | this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2); |
||
1167 | this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); |
||
1168 | this._dragdropWindow.Show(); |
||
1169 | } |
||
1170 | 787a4489 | KangIngu | |
1171 | private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
||
1172 | { |
||
1173 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
1174 | { |
||
1175 | if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; } |
||
1176 | |||
1177 | Point currentPos = e.GetPosition(rect); |
||
1178 | d71ee575 | djkim | |
1179 | 787a4489 | KangIngu | floatingTip.HorizontalOffset = currentPos.X + 20; |
1180 | floatingTip.VerticalOffset = currentPos.Y; |
||
1181 | |||
1182 | |||
1183 | //ToolTip tool = new System.Windows.Controls.ToolTip(); |
||
1184 | //tool.Content = "ToolTip"; |
||
1185 | //panel.ToolTip = tool; |
||
1186 | } |
||
1187 | |||
1188 | if (mouseHandlingMode != MouseHandlingMode.Drawing) |
||
1189 | { |
||
1190 | #region 마우스 오버 시 색상 변경 |
||
1191 | //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
1192 | //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF"); |
||
1193 | |||
1194 | //if (firstCondition != null) |
||
1195 | //{ |
||
1196 | // firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave); |
||
1197 | |||
1198 | // if (firstCondition.GetType().Name == "TextControl") |
||
1199 | // { |
||
1200 | // (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor); |
||
1201 | // return; |
||
1202 | // } |
||
1203 | // else if (firstCondition.GetType().Name == "ArrowTextControl") |
||
1204 | // { |
||
1205 | // (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor); |
||
1206 | // return; |
||
1207 | // } |
||
1208 | |||
1209 | // if (L_Size == 0) |
||
1210 | // { |
||
1211 | // L_Size = (firstCondition as IPath).LineSize; |
||
1212 | // (firstCondition as IPath).LineSize *= 4; |
||
1213 | // } |
||
1214 | // switch (firstCondition.GetType().Name) |
||
1215 | // { |
||
1216 | // case "RectangleControl": |
||
1217 | // { |
||
1218 | // (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1219 | // } |
||
1220 | // break; |
||
1221 | // case "CircleControl": |
||
1222 | // { |
||
1223 | // (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1224 | // } |
||
1225 | // break; |
||
1226 | // case "TriControl": |
||
1227 | // { |
||
1228 | // (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1229 | // } |
||
1230 | // break; |
||
1231 | // case "RectCloudControl": |
||
1232 | // { |
||
1233 | // (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1234 | // } |
||
1235 | // break; |
||
1236 | // case "CloudControl": |
||
1237 | // { |
||
1238 | // (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1239 | // } |
||
1240 | // break; |
||
1241 | // case "PolygonControl": |
||
1242 | // { |
||
1243 | // (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1244 | // } |
||
1245 | // break; |
||
1246 | // case "ArcControl": |
||
1247 | // { |
||
1248 | // (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1249 | // } |
||
1250 | // break; |
||
1251 | // case "LineControl": |
||
1252 | // { |
||
1253 | // (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1254 | // } |
||
1255 | // break; |
||
1256 | // case "ArrowControl_Multi": |
||
1257 | // { |
||
1258 | // (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor); |
||
1259 | // } |
||
1260 | // break; |
||
1261 | |||
1262 | // default: |
||
1263 | // { |
||
1264 | |||
1265 | // } |
||
1266 | // break; |
||
1267 | // } |
||
1268 | //} |
||
1269 | #endregion |
||
1270 | } |
||
1271 | |||
1272 | getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
1273 | 53880c83 | ljiyeon | #region 주석 |
1274 | 992a98b4 | KangIngu | //if (mouseButtonDown == MouseButton.Middle) |
1275 | //{ |
||
1276 | // SetCursor(); |
||
1277 | // Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1278 | // Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1279 | 9f473fb7 | KangIngu | |
1280 | 992a98b4 | KangIngu | // Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1281 | // zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1282 | // zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1283 | 9f473fb7 | KangIngu | |
1284 | 992a98b4 | KangIngu | // //SetCursor(); |
1285 | // //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1286 | // //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1287 | 787a4489 | KangIngu | |
1288 | 992a98b4 | KangIngu | // //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1289 | 787a4489 | KangIngu | |
1290 | 992a98b4 | KangIngu | // //zoomAndPanControl.ContentOffsetX += 1; |
1291 | // //zoomAndPanControl.ContentOffsetY += 1; |
||
1292 | 787a4489 | KangIngu | |
1293 | 992a98b4 | KangIngu | // //zoomAndPanControl.ContentOffsetX += dragOffset.X; |
1294 | // //zoomAndPanControl.ContentOffsetY += dragOffset.Y; |
||
1295 | //} |
||
1296 | 53880c83 | ljiyeon | #endregion |
1297 | |||
1298 | 992a98b4 | KangIngu | if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right)) |
1299 | 787a4489 | KangIngu | { |
1300 | e54660e8 | KangIngu | SetCursor(); |
1301 | 787a4489 | KangIngu | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1302 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1303 | |||
1304 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
1305 | zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1306 | zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1307 | 9cd2865b | KangIngu | |
1308 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
1309 | 9cd2865b | KangIngu | { |
1310 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
1311 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
1312 | } |
||
1313 | 787a4489 | KangIngu | } |
1314 | 992a98b4 | KangIngu | |
1315 | if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left) |
||
1316 | 787a4489 | KangIngu | { |
1317 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1318 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1319 | SetCursor(); |
||
1320 | |||
1321 | if (IsDrawing) |
||
1322 | { |
||
1323 | if (currentControl == null) |
||
1324 | { |
||
1325 | switch (controlType) |
||
1326 | { |
||
1327 | case ControlType.PenControl: |
||
1328 | { |
||
1329 | if (inkBoard.Tag.ToString() == "Ink") |
||
1330 | { |
||
1331 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
1332 | } |
||
1333 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
1334 | { |
||
1335 | RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
||
1336 | } |
||
1337 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
1338 | { |
||
1339 | RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
||
1340 | } |
||
1341 | |||
1342 | //inkBoard.Strokes.Add(stroke); |
||
1343 | } |
||
1344 | break; |
||
1345 | } |
||
1346 | return; |
||
1347 | } |
||
1348 | } |
||
1349 | |||
1350 | if (currentControl != null) |
||
1351 | { |
||
1352 | double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X; |
||
1353 | double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y; |
||
1354 | //강인구 추가 |
||
1355 | currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity; |
||
1356 | |||
1357 | if ((currentControl as IPath) != null) |
||
1358 | { |
||
1359 | (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize; |
||
1360 | } |
||
1361 | 5ce56a3a | KangIngu | if ((currentControl as LineControl) != null) |
1362 | { |
||
1363 | (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval; |
||
1364 | } |
||
1365 | |||
1366 | 787a4489 | KangIngu | if ((currentControl as IShapeControl) != null) |
1367 | { |
||
1368 | (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet; |
||
1369 | } |
||
1370 | if ((currentControl as TextControl) != null) |
||
1371 | { |
||
1372 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1373 | { |
||
1374 | (currentControl as TextControl).TextStyle = FontStyles.Italic; |
||
1375 | } |
||
1376 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1377 | { |
||
1378 | d4b0c723 | KangIngu | (currentControl as TextControl).TextWeight = FontWeights.Bold; |
1379 | 787a4489 | KangIngu | } |
1380 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1381 | { |
||
1382 | (currentControl as TextControl).UnderLine = TextDecorations.Underline; |
||
1383 | } |
||
1384 | } |
||
1385 | else if ((currentControl as ArrowTextControl) != null) |
||
1386 | { |
||
1387 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1388 | { |
||
1389 | (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic; |
||
1390 | } |
||
1391 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1392 | { |
||
1393 | d4b0c723 | KangIngu | (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold; |
1394 | 787a4489 | KangIngu | } |
1395 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1396 | { |
||
1397 | (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline; |
||
1398 | } |
||
1399 | } |
||
1400 | 9f473fb7 | KangIngu | else if ((currentControl as RectCloudControl) != null) |
1401 | { |
||
1402 | (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1403 | } |
||
1404 | else if ((currentControl as CloudControl) != null) |
||
1405 | { |
||
1406 | (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1407 | } |
||
1408 | 787a4489 | KangIngu | |
1409 | switch (controlType) |
||
1410 | { |
||
1411 | 684ef11c | ljiyeon | case (ControlType.Coordinate): |
1412 | { |
||
1413 | var control = currentControl as CoordinateControl; |
||
1414 | |||
1415 | if (control != null) |
||
1416 | { |
||
1417 | if (move.mousemode == MouseMode.Drawing) |
||
1418 | { |
||
1419 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1420 | } |
||
1421 | else |
||
1422 | { |
||
1423 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1424 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1425 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1426 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1427 | |||
1428 | |||
1429 | if (ViewerDataModel.Instance.IsPressShift) |
||
1430 | { |
||
1431 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1432 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1433 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1434 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1435 | } |
||
1436 | |||
1437 | control.PointSet = new List<Point> |
||
1438 | { |
||
1439 | control.StartPoint, |
||
1440 | control.LeftBottomPoint, |
||
1441 | control.EndPoint, |
||
1442 | control.TopRightPoint, |
||
1443 | }; |
||
1444 | control.updateControl(); |
||
1445 | } |
||
1446 | |||
1447 | //강인구 추가 |
||
1448 | control.ControlType = controlType; |
||
1449 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1450 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1451 | // control.Paint = PaintSet.Fill; |
||
1452 | } |
||
1453 | } |
||
1454 | break; |
||
1455 | case (ControlType.InsideWhite): |
||
1456 | { |
||
1457 | var control = currentControl as InsideWhiteControl; |
||
1458 | |||
1459 | if (control != null) |
||
1460 | { |
||
1461 | if (move.mousemode == MouseMode.Drawing) |
||
1462 | { |
||
1463 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1464 | } |
||
1465 | else |
||
1466 | { |
||
1467 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1468 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1469 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1470 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1471 | |||
1472 | |||
1473 | if (ViewerDataModel.Instance.IsPressShift) |
||
1474 | { |
||
1475 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1476 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1477 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1478 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1479 | } |
||
1480 | |||
1481 | control.PointSet = new List<Point> |
||
1482 | { |
||
1483 | control.StartPoint, |
||
1484 | control.LeftBottomPoint, |
||
1485 | control.EndPoint, |
||
1486 | control.TopRightPoint, |
||
1487 | }; |
||
1488 | control.updateControl(); |
||
1489 | } |
||
1490 | |||
1491 | //강인구 추가 |
||
1492 | control.ControlType = controlType; |
||
1493 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1494 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1495 | control.Paint = PaintSet.Fill; |
||
1496 | } |
||
1497 | } |
||
1498 | break; |
||
1499 | case (ControlType.OverlapWhite): |
||
1500 | { |
||
1501 | var control = currentControl as OverlapWhiteControl; |
||
1502 | |||
1503 | if (control != null) |
||
1504 | { |
||
1505 | if (move.mousemode == MouseMode.Drawing) |
||
1506 | { |
||
1507 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1508 | } |
||
1509 | else |
||
1510 | { |
||
1511 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1512 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1513 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1514 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1515 | |||
1516 | |||
1517 | if (ViewerDataModel.Instance.IsPressShift) |
||
1518 | { |
||
1519 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1520 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1521 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1522 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1523 | } |
||
1524 | |||
1525 | control.PointSet = new List<Point> |
||
1526 | { |
||
1527 | control.StartPoint, |
||
1528 | control.LeftBottomPoint, |
||
1529 | control.EndPoint, |
||
1530 | control.TopRightPoint, |
||
1531 | }; |
||
1532 | control.updateControl(); |
||
1533 | } |
||
1534 | |||
1535 | //강인구 추가 |
||
1536 | control.ControlType = controlType; |
||
1537 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1538 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1539 | control.Paint = PaintSet.Fill; |
||
1540 | } |
||
1541 | } |
||
1542 | break; |
||
1543 | case (ControlType.ClipWhite): |
||
1544 | { |
||
1545 | var control = currentControl as ClipWhiteControl; |
||
1546 | |||
1547 | if (control != null) |
||
1548 | { |
||
1549 | if (move.mousemode == MouseMode.Drawing) |
||
1550 | { |
||
1551 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1552 | } |
||
1553 | else |
||
1554 | { |
||
1555 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1556 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1557 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1558 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1559 | |||
1560 | |||
1561 | if (ViewerDataModel.Instance.IsPressShift) |
||
1562 | { |
||
1563 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1564 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1565 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1566 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1567 | } |
||
1568 | |||
1569 | control.PointSet = new List<Point> |
||
1570 | { |
||
1571 | control.StartPoint, |
||
1572 | control.LeftBottomPoint, |
||
1573 | control.EndPoint, |
||
1574 | control.TopRightPoint, |
||
1575 | }; |
||
1576 | control.updateControl(); |
||
1577 | } |
||
1578 | |||
1579 | //강인구 추가 |
||
1580 | control.ControlType = controlType; |
||
1581 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1582 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1583 | control.Paint = PaintSet.Fill; |
||
1584 | } |
||
1585 | } |
||
1586 | break; |
||
1587 | 787a4489 | KangIngu | case ControlType.Rectangle: |
1588 | { |
||
1589 | var control = currentControl as RectangleControl; |
||
1590 | |||
1591 | if (control != null) |
||
1592 | { |
||
1593 | if (move.mousemode == MouseMode.Drawing) |
||
1594 | { |
||
1595 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1596 | } |
||
1597 | else |
||
1598 | { |
||
1599 | 17a22987 | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1600 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1601 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1602 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1603 | 787a4489 | KangIngu | |
1604 | |||
1605 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1606 | { |
||
1607 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1608 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1609 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1610 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1611 | } |
||
1612 | e54660e8 | KangIngu | |
1613 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
1614 | { |
||
1615 | 17a22987 | KangIngu | control.StartPoint, |
1616 | control.LeftBottomPoint, |
||
1617 | control.EndPoint, |
||
1618 | control.TopRightPoint, |
||
1619 | 787a4489 | KangIngu | }; |
1620 | control.updateControl(); |
||
1621 | } |
||
1622 | |||
1623 | //강인구 추가 |
||
1624 | control.ControlType = controlType; |
||
1625 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1626 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1627 | } |
||
1628 | } |
||
1629 | break; |
||
1630 | |||
1631 | case ControlType.RectCloud: |
||
1632 | { |
||
1633 | var control = currentControl as RectCloudControl; |
||
1634 | |||
1635 | if (control != null) |
||
1636 | { |
||
1637 | if (move.mousemode == MouseMode.Drawing) |
||
1638 | { |
||
1639 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1640 | } |
||
1641 | else |
||
1642 | { |
||
1643 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1644 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1645 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1646 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1647 | |||
1648 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1649 | { |
||
1650 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1651 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1652 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1653 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1654 | } |
||
1655 | |||
1656 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
1657 | { |
||
1658 | control.StartPoint, |
||
1659 | control.LeftBottomPoint, |
||
1660 | control.EndPoint, |
||
1661 | control.TopRightPoint, |
||
1662 | }; |
||
1663 | } |
||
1664 | d71ee575 | djkim | |
1665 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1666 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1667 | } |
||
1668 | } |
||
1669 | break; |
||
1670 | |||
1671 | case ControlType.SingleLine: |
||
1672 | { |
||
1673 | d71ee575 | djkim | var control = currentControl as LineControl; |
1674 | if (control != null) |
||
1675 | 787a4489 | KangIngu | { |
1676 | control.LineStyleSet = LineStyleSet.SingleLine; |
||
1677 | control.ControlType = controlType; |
||
1678 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1679 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1680 | Point tempPoint = control.EndPoint; |
||
1681 | 5ce56a3a | KangIngu | |
1682 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1683 | { |
||
1684 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1685 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1686 | control.EndPoint = tempPoint; |
||
1687 | } |
||
1688 | else |
||
1689 | { |
||
1690 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1691 | } |
||
1692 | 5ce56a3a | KangIngu | |
1693 | d71ee575 | djkim | control.PointSet = new List<Point> |
1694 | 5ce56a3a | KangIngu | { |
1695 | control.StartPoint, |
||
1696 | control.EndPoint, |
||
1697 | }; |
||
1698 | d71ee575 | djkim | |
1699 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1700 | 787a4489 | KangIngu | } |
1701 | |||
1702 | } |
||
1703 | break; |
||
1704 | |||
1705 | case ControlType.CancelLine: |
||
1706 | { |
||
1707 | d71ee575 | djkim | var control = currentControl as LineControl; |
1708 | if (control != null) |
||
1709 | 787a4489 | KangIngu | { |
1710 | control.LineStyleSet = LineStyleSet.CancelLine; |
||
1711 | //control.LineStyle = LineControl.LineStyleSet.MultiLine; |
||
1712 | control.ControlType = controlType; |
||
1713 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1714 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1715 | Point tempPoint = control.EndPoint; |
||
1716 | 787a4489 | KangIngu | |
1717 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1718 | { |
||
1719 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1720 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1721 | control.EndPoint = tempPoint; |
||
1722 | } |
||
1723 | else |
||
1724 | { |
||
1725 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1726 | } |
||
1727 | 787a4489 | KangIngu | |
1728 | |||
1729 | d71ee575 | djkim | control.PointSet = new List<Point> |
1730 | 787a4489 | KangIngu | { |
1731 | control.StartPoint, |
||
1732 | control.EndPoint, |
||
1733 | }; |
||
1734 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1735 | } |
||
1736 | d71ee575 | djkim | |
1737 | |||
1738 | 787a4489 | KangIngu | } |
1739 | break; |
||
1740 | |||
1741 | case ControlType.ArrowLine: |
||
1742 | { |
||
1743 | d71ee575 | djkim | var control = currentControl as LineControl; |
1744 | if (control != null) |
||
1745 | 787a4489 | KangIngu | { |
1746 | control.LineStyleSet = LineStyleSet.ArrowLine; |
||
1747 | control.ControlType = controlType; |
||
1748 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1749 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1750 | Point tempPoint = control.EndPoint; |
||
1751 | 787a4489 | KangIngu | |
1752 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1753 | { |
||
1754 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1755 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1756 | control.EndPoint = tempPoint; |
||
1757 | } |
||
1758 | else |
||
1759 | { |
||
1760 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1761 | } |
||
1762 | 787a4489 | KangIngu | |
1763 | |||
1764 | d71ee575 | djkim | control.PointSet = new List<Point> |
1765 | 787a4489 | KangIngu | { |
1766 | control.StartPoint, |
||
1767 | control.EndPoint, |
||
1768 | }; |
||
1769 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1770 | } |
||
1771 | } |
||
1772 | break; |
||
1773 | |||
1774 | case ControlType.TwinLine: |
||
1775 | { |
||
1776 | d71ee575 | djkim | var control = currentControl as LineControl; |
1777 | if (control != null) |
||
1778 | 787a4489 | KangIngu | { |
1779 | control.LineStyleSet = LineStyleSet.TwinLine; |
||
1780 | control.ControlType = controlType; |
||
1781 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1782 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1783 | Point tempPoint = control.EndPoint; |
||
1784 | 787a4489 | KangIngu | |
1785 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1786 | { |
||
1787 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1788 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1789 | control.EndPoint = tempPoint; |
||
1790 | } |
||
1791 | else |
||
1792 | { |
||
1793 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1794 | } |
||
1795 | 787a4489 | KangIngu | |
1796 | |||
1797 | d71ee575 | djkim | control.PointSet = new List<Point> |
1798 | 787a4489 | KangIngu | { |
1799 | control.StartPoint, |
||
1800 | control.EndPoint, |
||
1801 | }; |
||
1802 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1803 | } |
||
1804 | } |
||
1805 | break; |
||
1806 | |||
1807 | case ControlType.DimLine: |
||
1808 | { |
||
1809 | d71ee575 | djkim | var control = currentControl as LineControl; |
1810 | if (control != null) |
||
1811 | 787a4489 | KangIngu | { |
1812 | control.LineStyleSet = LineStyleSet.DimLine; |
||
1813 | control.ControlType = controlType; |
||
1814 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1815 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1816 | Point tempPoint = control.EndPoint; |
||
1817 | 787a4489 | KangIngu | |
1818 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1819 | { |
||
1820 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1821 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1822 | control.EndPoint = tempPoint; |
||
1823 | } |
||
1824 | else |
||
1825 | { |
||
1826 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1827 | } |
||
1828 | 787a4489 | KangIngu | |
1829 | d71ee575 | djkim | control.PointSet = new List<Point> |
1830 | 787a4489 | KangIngu | { |
1831 | control.StartPoint, |
||
1832 | control.EndPoint, |
||
1833 | }; |
||
1834 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1835 | } |
||
1836 | } |
||
1837 | break; |
||
1838 | |||
1839 | case ControlType.ChainLine: |
||
1840 | { |
||
1841 | var control = currentControl as PolygonControl; |
||
1842 | |||
1843 | if (control != null) |
||
1844 | { |
||
1845 | 2eac4f76 | KangIngu | |
1846 | 787a4489 | KangIngu | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
1847 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
1848 | 2eac4f76 | KangIngu | |
1849 | Point tempPoint = control.PointSet[control.PointSet.Count - 1]; |
||
1850 | |||
1851 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1852 | { |
||
1853 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1854 | e54660e8 | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 2], ref tempPoint, true); |
1855 | 2eac4f76 | KangIngu | control.PointSet[control.PointSet.Count - 1] = tempPoint; |
1856 | //control.EndPoint = tempPoint; |
||
1857 | } |
||
1858 | else |
||
1859 | { |
||
1860 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1861 | } |
||
1862 | |||
1863 | 661b7416 | humkyung | ///control.SetPolyPath(); |
1864 | 787a4489 | KangIngu | |
1865 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1866 | } |
||
1867 | } |
||
1868 | break; |
||
1869 | |||
1870 | case ControlType.ArcLine: |
||
1871 | { |
||
1872 | d71ee575 | djkim | var control = currentControl as ArcControl; |
1873 | if (control != null) |
||
1874 | 787a4489 | KangIngu | { |
1875 | control.isTransOn = false; |
||
1876 | control.ControlType = controlType; |
||
1877 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1878 | control.MidPoint = new Point(0, 0); |
||
1879 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1880 | Point tempPoint = control.EndPoint; |
||
1881 | 787a4489 | KangIngu | |
1882 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1883 | 787a4489 | KangIngu | { |
1884 | d71ee575 | djkim | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1885 | control.EndPoint = tempPoint; |
||
1886 | } |
||
1887 | else |
||
1888 | { |
||
1889 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1890 | } |
||
1891 | 787a4489 | KangIngu | |
1892 | |||
1893 | d71ee575 | djkim | control.PointSet = new List<Point> |
1894 | 787a4489 | KangIngu | { |
1895 | control.StartPoint, |
||
1896 | control.MidPoint, |
||
1897 | control.EndPoint, |
||
1898 | }; |
||
1899 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1900 | } |
||
1901 | } |
||
1902 | break; |
||
1903 | |||
1904 | case ControlType.ArcArrow: |
||
1905 | { |
||
1906 | 40b3ce25 | ljiyeon | var control = currentControl as ArrowArcControl; |
1907 | d71ee575 | djkim | if (control != null) |
1908 | 787a4489 | KangIngu | { |
1909 | 40b3ce25 | ljiyeon | control.isTransOn = false; |
1910 | 787a4489 | KangIngu | control.ControlType = controlType; |
1911 | 40b3ce25 | ljiyeon | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1912 | control.MidPoint = new Point(0, 0); |
||
1913 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1914 | Point tempPoint = control.EndPoint; |
||
1915 | |||
1916 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1917 | 787a4489 | KangIngu | { |
1918 | 40b3ce25 | ljiyeon | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1919 | control.EndPoint = tempPoint; |
||
1920 | d71ee575 | djkim | } |
1921 | else |
||
1922 | { |
||
1923 | 40b3ce25 | ljiyeon | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1924 | d71ee575 | djkim | } |
1925 | 787a4489 | KangIngu | |
1926 | 40b3ce25 | ljiyeon | |
1927 | d71ee575 | djkim | control.PointSet = new List<Point> |
1928 | 787a4489 | KangIngu | { |
1929 | control.StartPoint, |
||
1930 | control.MidPoint, |
||
1931 | control.EndPoint, |
||
1932 | }; |
||
1933 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1934 | } |
||
1935 | } |
||
1936 | break; |
||
1937 | |||
1938 | case ControlType.ArrowMultiLine: |
||
1939 | { |
||
1940 | d71ee575 | djkim | var control = currentControl as ArrowControl_Multi; |
1941 | if (control != null) |
||
1942 | 787a4489 | KangIngu | { |
1943 | d71ee575 | djkim | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
1944 | Point tempPoint = control.EndPoint; |
||
1945 | if (control.MiddlePoint == new Point(0, 0)) |
||
1946 | 787a4489 | KangIngu | { |
1947 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1948 | 787a4489 | KangIngu | { |
1949 | d71ee575 | djkim | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1950 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1951 | control.EndPoint = tempPoint; |
||
1952 | 787a4489 | KangIngu | } |
1953 | else |
||
1954 | { |
||
1955 | d71ee575 | djkim | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1956 | } |
||
1957 | } |
||
1958 | else |
||
1959 | { |
||
1960 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1961 | { |
||
1962 | //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true); |
||
1963 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true); |
||
1964 | control.EndPoint = tempPoint; |
||
1965 | } |
||
1966 | else |
||
1967 | { |
||
1968 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false); |
||
1969 | 787a4489 | KangIngu | } |
1970 | |||
1971 | d71ee575 | djkim | } |
1972 | |||
1973 | control.PointSet = new List<Point> |
||
1974 | 787a4489 | KangIngu | { |
1975 | control.StartPoint, |
||
1976 | control.MiddlePoint, |
||
1977 | control.EndPoint, |
||
1978 | }; |
||
1979 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1980 | } |
||
1981 | } |
||
1982 | break; |
||
1983 | |||
1984 | case ControlType.Circle: |
||
1985 | { |
||
1986 | var control = currentControl as CircleControl; |
||
1987 | |||
1988 | if (control != null) |
||
1989 | { |
||
1990 | if (move.mousemode == MouseMode.Drawing) |
||
1991 | { |
||
1992 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1993 | } |
||
1994 | else |
||
1995 | { |
||
1996 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1997 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1998 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1999 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2000 | |||
2001 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
2002 | { |
||
2003 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
2004 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
2005 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
2006 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
2007 | } |
||
2008 | |||
2009 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2010 | { |
||
2011 | control.StartPoint, |
||
2012 | control.LeftBottomPoint, |
||
2013 | control.EndPoint, |
||
2014 | control.TopRightPoint, |
||
2015 | }; |
||
2016 | } |
||
2017 | d71ee575 | djkim | |
2018 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
2019 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2020 | |||
2021 | } |
||
2022 | } |
||
2023 | break; |
||
2024 | |||
2025 | case ControlType.PolygonCloud: |
||
2026 | { |
||
2027 | var control = currentControl as CloudControl; |
||
2028 | |||
2029 | if (control != null) |
||
2030 | { |
||
2031 | control.isTransOn = true; |
||
2032 | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
||
2033 | |||
2034 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2035 | |||
2036 | control.SetCloud(); |
||
2037 | //강인구 추가 |
||
2038 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2039 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2040 | } |
||
2041 | } |
||
2042 | break; |
||
2043 | |||
2044 | case ControlType.Triangle: |
||
2045 | { |
||
2046 | var control = currentControl as TriControl; |
||
2047 | |||
2048 | if (control != null) |
||
2049 | { |
||
2050 | if (move.mousemode == MouseMode.Drawing) |
||
2051 | { |
||
2052 | //move.control_Move(ControlList, true, moveX, moveY); |
||
2053 | } |
||
2054 | else |
||
2055 | { |
||
2056 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2057 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2058 | |||
2059 | 992a98b4 | KangIngu | if (ViewerDataModel.Instance.checkAxis) |
2060 | { |
||
2061 | Point tempPoint = control.EndPoint; |
||
2062 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2063 | control.EndPoint = tempPoint; |
||
2064 | } |
||
2065 | |||
2066 | 4318fdeb | KangIngu | |
2067 | if (ViewerDataModel.Instance.IsPressShift) |
||
2068 | { |
||
2069 | e753423e | humkyung | List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint); |
2070 | if (2 == Points.Count()) |
||
2071 | { |
||
2072 | control.MidPoint = Points[0]; |
||
2073 | control.EndPoint = Points[1]; |
||
2074 | } |
||
2075 | 4318fdeb | KangIngu | } |
2076 | |||
2077 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2078 | { |
||
2079 | control.StartPoint, |
||
2080 | control.MidPoint, |
||
2081 | control.EndPoint, |
||
2082 | }; |
||
2083 | } |
||
2084 | d71ee575 | djkim | |
2085 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
2086 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2087 | } |
||
2088 | } |
||
2089 | break; |
||
2090 | |||
2091 | case ControlType.ImgControl: |
||
2092 | { |
||
2093 | var control = currentControl as ImgControl; |
||
2094 | |||
2095 | if (control != null) |
||
2096 | { |
||
2097 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2098 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2099 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2100 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2101 | |||
2102 | control.PointSet = new List<Point> |
||
2103 | { |
||
2104 | control.StartPoint, |
||
2105 | control.LeftBottomPoint, |
||
2106 | control.EndPoint, |
||
2107 | control.TopRightPoint, |
||
2108 | }; |
||
2109 | } |
||
2110 | } |
||
2111 | break; |
||
2112 | |||
2113 | case ControlType.Date: |
||
2114 | { |
||
2115 | var control = currentControl as DateControl; |
||
2116 | |||
2117 | if (control != null) |
||
2118 | { |
||
2119 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2120 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2121 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2122 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2123 | //control.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
||
2124 | |||
2125 | control.PointSet = new List<Point> |
||
2126 | { |
||
2127 | control.StartPoint, |
||
2128 | control.LeftBottomPoint, |
||
2129 | control.EndPoint, |
||
2130 | control.TopRightPoint, |
||
2131 | }; |
||
2132 | } |
||
2133 | } |
||
2134 | break; |
||
2135 | |||
2136 | case ControlType.ArrowTextControl: |
||
2137 | { |
||
2138 | var control = currentControl as ArrowTextControl; |
||
2139 | |||
2140 | if (control != null) |
||
2141 | { |
||
2142 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2143 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2144 | 9f473fb7 | KangIngu | |
2145 | control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100); |
||
2146 | |||
2147 | 5ce56a3a | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2148 | { |
||
2149 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2150 | control.EndPoint = tempPoint; |
||
2151 | } |
||
2152 | else |
||
2153 | { |
||
2154 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2155 | } |
||
2156 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2157 | 787a4489 | KangIngu | |
2158 | control.PointSet = new List<Point> |
||
2159 | { |
||
2160 | control.StartPoint, |
||
2161 | control.MidPoint, |
||
2162 | control.EndPoint, |
||
2163 | }; |
||
2164 | } |
||
2165 | } |
||
2166 | break; |
||
2167 | |||
2168 | case ControlType.ArrowTransTextControl: |
||
2169 | { |
||
2170 | var control = currentControl as ArrowTextControl; |
||
2171 | |||
2172 | if (control != null) |
||
2173 | { |
||
2174 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2175 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2176 | 01cbc243 | KangIngu | //control.MidPoint = currentCanvasDrawingMouseMovePoint; |
2177 | 9f473fb7 | KangIngu | |
2178 | 5ce56a3a | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2179 | { |
||
2180 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2181 | control.EndPoint = tempPoint; |
||
2182 | } |
||
2183 | else |
||
2184 | { |
||
2185 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2186 | } |
||
2187 | 01cbc243 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2188 | 787a4489 | KangIngu | control.isFixed = true; |
2189 | |||
2190 | control.PointSet = new List<Point> |
||
2191 | { |
||
2192 | control.StartPoint, |
||
2193 | control.MidPoint, |
||
2194 | control.EndPoint, |
||
2195 | }; |
||
2196 | } |
||
2197 | } |
||
2198 | break; |
||
2199 | |||
2200 | case ControlType.ArrowTextBorderControl: |
||
2201 | { |
||
2202 | var control = currentControl as ArrowTextControl; |
||
2203 | |||
2204 | if (control != null) |
||
2205 | { |
||
2206 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2207 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2208 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2209 | { |
||
2210 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2211 | control.EndPoint = tempPoint; |
||
2212 | } |
||
2213 | else |
||
2214 | { |
||
2215 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2216 | } |
||
2217 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2218 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2219 | { |
||
2220 | control.StartPoint, |
||
2221 | control.MidPoint, |
||
2222 | control.EndPoint, |
||
2223 | }; |
||
2224 | } |
||
2225 | |||
2226 | } |
||
2227 | break; |
||
2228 | case ControlType.ArrowTransTextBorderControl: |
||
2229 | { |
||
2230 | var control = currentControl as ArrowTextControl; |
||
2231 | |||
2232 | if (control != null) |
||
2233 | { |
||
2234 | control.isFixed = true; |
||
2235 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2236 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2237 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2238 | { |
||
2239 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2240 | control.EndPoint = tempPoint; |
||
2241 | } |
||
2242 | else |
||
2243 | { |
||
2244 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2245 | } |
||
2246 | 01cbc243 | KangIngu | |
2247 | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
||
2248 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2249 | { |
||
2250 | control.StartPoint, |
||
2251 | control.MidPoint, |
||
2252 | control.EndPoint, |
||
2253 | }; |
||
2254 | } |
||
2255 | |||
2256 | } |
||
2257 | break; |
||
2258 | case ControlType.ArrowTextCloudControl: |
||
2259 | { |
||
2260 | var control = currentControl as ArrowTextControl; |
||
2261 | |||
2262 | if (control != null) |
||
2263 | { |
||
2264 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2265 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2266 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2267 | { |
||
2268 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2269 | control.EndPoint = tempPoint; |
||
2270 | } |
||
2271 | else |
||
2272 | { |
||
2273 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2274 | } |
||
2275 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2276 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2277 | { |
||
2278 | control.StartPoint, |
||
2279 | control.MidPoint, |
||
2280 | control.EndPoint, |
||
2281 | }; |
||
2282 | } |
||
2283 | |||
2284 | } |
||
2285 | break; |
||
2286 | case ControlType.ArrowTransTextCloudControl: |
||
2287 | { |
||
2288 | var control = currentControl as ArrowTextControl; |
||
2289 | |||
2290 | if (control != null) |
||
2291 | { |
||
2292 | control.isFixed = true; |
||
2293 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2294 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2295 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2296 | { |
||
2297 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2298 | control.EndPoint = tempPoint; |
||
2299 | } |
||
2300 | else |
||
2301 | { |
||
2302 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2303 | } |
||
2304 | 01cbc243 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2305 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2306 | { |
||
2307 | control.StartPoint, |
||
2308 | control.MidPoint, |
||
2309 | control.EndPoint, |
||
2310 | }; |
||
2311 | } |
||
2312 | |||
2313 | } |
||
2314 | break; |
||
2315 | case ControlType.PolygonControl: |
||
2316 | { |
||
2317 | e54660e8 | KangIngu | |
2318 | 787a4489 | KangIngu | var control = currentControl as PolygonControl; |
2319 | |||
2320 | if (control != null) |
||
2321 | { |
||
2322 | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
||
2323 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2324 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2325 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2326 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2327 | b9ce7aee | ljiyeon | control.updateControl(); |
2328 | 787a4489 | KangIngu | } |
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 | b9ce7aee | ljiyeon | |
4302 | e66f22eb | KangIngu | //} |
4303 | 787a4489 | KangIngu | } |
4304 | } |
||
4305 | } |
||
4306 | break; |
||
4307 | case ControlType.ImgControl: |
||
4308 | { |
||
4309 | if (mouseButtonDown == MouseButton.Left) |
||
4310 | { |
||
4311 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4312 | //{ |
||
4313 | 787a4489 | KangIngu | if (currentControl is ImgControl) |
4314 | { |
||
4315 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4316 | if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4317 | e66f22eb | KangIngu | { |
4318 | return; |
||
4319 | } |
||
4320 | |||
4321 | 787a4489 | KangIngu | CreateControl(); |
4322 | (currentControl as ImgControl).ApplyOverViewData(); |
||
4323 | 53880c83 | ljiyeon | controlType = ControlType.ImgControl; |
4324 | 787a4489 | KangIngu | currentControl = null; |
4325 | } |
||
4326 | else |
||
4327 | { |
||
4328 | c73426a9 | ljiyeon | |
4329 | 787a4489 | KangIngu | string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
4330 | 53880c83 | ljiyeon | if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG") |
4331 | 787a4489 | KangIngu | { |
4332 | Image img = new Image(); |
||
4333 | 53880c83 | ljiyeon | //img.Source = new BitmapImage(new Uri(filename)); |
4334 | if (filename.Contains(".svg")) |
||
4335 | { |
||
4336 | byte[] imageData = null; |
||
4337 | DrawingImage image = null; |
||
4338 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
4339 | { |
||
4340 | imageData = web.DownloadData(new Uri(filename)); |
||
4341 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
4342 | image = SvgReader.Load(stream); |
||
4343 | } |
||
4344 | img.Source = image; |
||
4345 | } |
||
4346 | else |
||
4347 | { |
||
4348 | img.Source = new BitmapImage(new Uri(filename)); |
||
4349 | } |
||
4350 | 787a4489 | KangIngu | |
4351 | currentControl = new ImgControl |
||
4352 | { |
||
4353 | 53880c83 | ljiyeon | Background = new SolidColorBrush(Colors.Black), |
4354 | PointSet = new List<Point>(), |
||
4355 | FilePath = filename, |
||
4356 | ImageData = img.Source, |
||
4357 | StartPoint = canvasDrawingMouseDownPoint, |
||
4358 | EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100), |
||
4359 | TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100), |
||
4360 | LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y), |
||
4361 | ControlType = ControlType.ImgControl |
||
4362 | }; |
||
4363 | |||
4364 | |||
4365 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4366 | 53880c83 | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4367 | currentControl.IsNew = true; |
||
4368 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4369 | |||
4370 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4371 | (currentControl as ImgControl).Angle -= rotate.Angle; |
||
4372 | } |
||
4373 | 787a4489 | KangIngu | } |
4374 | e66f22eb | KangIngu | //} |
4375 | 787a4489 | KangIngu | } |
4376 | } |
||
4377 | break; |
||
4378 | case ControlType.Date: |
||
4379 | { |
||
4380 | if (mouseButtonDown == MouseButton.Left) |
||
4381 | { |
||
4382 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4383 | //{ |
||
4384 | 787a4489 | KangIngu | if (currentControl is DateControl) |
4385 | { |
||
4386 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4387 | if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4388 | e66f22eb | KangIngu | { |
4389 | return; |
||
4390 | } |
||
4391 | |||
4392 | 787a4489 | KangIngu | CreateControl(); |
4393 | (currentControl as DateControl).ApplyOverViewData(); |
||
4394 | currentControl = null; |
||
4395 | |||
4396 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4397 | { |
||
4398 | controlType = ControlType.None; |
||
4399 | IsSwingMode = false; |
||
4400 | Common.ViewerDataModel.Instance.SelectedControl = ""; |
||
4401 | Common.ViewerDataModel.Instance.ControlTag = null; |
||
4402 | mouseHandlingMode = MouseHandlingMode.None; |
||
4403 | this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
||
4404 | txtBatch.Visibility = Visibility.Collapsed; |
||
4405 | |||
4406 | } |
||
4407 | } |
||
4408 | else |
||
4409 | { |
||
4410 | currentControl = new DateControl |
||
4411 | { |
||
4412 | Background = new SolidColorBrush(Colors.Black) |
||
4413 | }; |
||
4414 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4415 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4416 | currentControl.IsNew = true; |
||
4417 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4418 | ca40e004 | ljiyeon | |
4419 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4420 | (currentControl as DateControl).Angle -= rotate.Angle; |
||
4421 | } |
||
4422 | e66f22eb | KangIngu | //} |
4423 | 787a4489 | KangIngu | } |
4424 | } |
||
4425 | break; |
||
4426 | case ControlType.TextControl: |
||
4427 | { |
||
4428 | if (mouseButtonDown == MouseButton.Left) |
||
4429 | { |
||
4430 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4431 | { |
||
4432 | currentControl = new TextControl |
||
4433 | { |
||
4434 | ControlType = controlType |
||
4435 | }; |
||
4436 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4437 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4438 | 8742caa5 | humkyung | currentControl.IsNew = true; |
4439 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4440 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4441 | currentControl.SetValue(Canvas.ZIndexProperty, 2); |
||
4442 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4443 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4444 | 6b5d33c6 | djkim | |
4445 | 8742caa5 | humkyung | (currentControl as TextControl).ControlType_No = 0; |
4446 | (currentControl as TextControl).Angle -= rotate.Angle; |
||
4447 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4448 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
4449 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
4450 | 787a4489 | KangIngu | |
4451 | 8742caa5 | humkyung | CreateControl(); |
4452 | 787a4489 | KangIngu | |
4453 | } |
||
4454 | } |
||
4455 | } |
||
4456 | break; |
||
4457 | case ControlType.TextBorder: |
||
4458 | { |
||
4459 | if (mouseButtonDown == MouseButton.Left) |
||
4460 | { |
||
4461 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4462 | { |
||
4463 | currentControl = new TextControl |
||
4464 | { |
||
4465 | ControlType = controlType |
||
4466 | }; |
||
4467 | |||
4468 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4469 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4470 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4471 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4472 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4473 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4474 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4475 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4476 | 6b5d33c6 | djkim | |
4477 | 787a4489 | KangIngu | (currentControl as TextControl).ControlType_No = 1; |
4478 | (currentControl as TextControl).Angle = Ang; |
||
4479 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4480 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
4481 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
4482 | 787a4489 | KangIngu | CreateControl(); |
4483 | |||
4484 | 49b217ad | humkyung | //currentControl = null; |
4485 | 787a4489 | KangIngu | } |
4486 | } |
||
4487 | } |
||
4488 | break; |
||
4489 | case ControlType.TextCloud: |
||
4490 | { |
||
4491 | if (mouseButtonDown == MouseButton.Left) |
||
4492 | { |
||
4493 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4494 | { |
||
4495 | currentControl = new TextControl |
||
4496 | { |
||
4497 | ControlType = controlType |
||
4498 | }; |
||
4499 | 610a4b86 | KangIngu | |
4500 | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
||
4501 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4502 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4503 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4504 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4505 | |||
4506 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4507 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4508 | 6b5d33c6 | djkim | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
4509 | 787a4489 | KangIngu | |
4510 | (currentControl as TextControl).Angle = Ang; |
||
4511 | (currentControl as TextControl).ControlType_No = 2; |
||
4512 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4513 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
4514 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
4515 | 787a4489 | KangIngu | CreateControl(); |
4516 | 49b217ad | humkyung | //currentControl = null; |
4517 | 787a4489 | KangIngu | } |
4518 | } |
||
4519 | } |
||
4520 | break; |
||
4521 | case ControlType.ArrowTextControl: |
||
4522 | ca40e004 | ljiyeon | { |
4523 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
4524 | { |
||
4525 | if (currentControl is ArrowTextControl) |
||
4526 | { |
||
4527 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4528 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4529 | e66f22eb | KangIngu | { |
4530 | return; |
||
4531 | ca40e004 | ljiyeon | } |
4532 | e66f22eb | KangIngu | |
4533 | 787a4489 | KangIngu | CreateControl(); |
4534 | |||
4535 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4536 | (currentControl as ArrowTextControl).IsEditing = false; |
||
4537 | (currentControl as ArrowTextControl).EnableEditing = false; |
||
4538 | 49b217ad | humkyung | (currentControl as ArrowTextControl).IsNew = false; |
4539 | 787a4489 | KangIngu | currentControl = null; |
4540 | } |
||
4541 | else |
||
4542 | { |
||
4543 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4544 | //{ |
||
4545 | 787a4489 | KangIngu | currentControl = new ArrowTextControl(); |
4546 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4547 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4548 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4549 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4550 | |||
4551 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4552 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4553 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
4554 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4555 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4556 | |||
4557 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4558 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4559 | 787a4489 | KangIngu | |
4560 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
4561 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4562 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
4563 | ca40e004 | ljiyeon | |
4564 | |||
4565 | e66f22eb | KangIngu | //} |
4566 | 787a4489 | KangIngu | } |
4567 | } |
||
4568 | } |
||
4569 | break; |
||
4570 | case ControlType.ArrowTransTextControl: |
||
4571 | { |
||
4572 | if (mouseButtonDown == MouseButton.Left) |
||
4573 | { |
||
4574 | if (currentControl is ArrowTextControl) |
||
4575 | { |
||
4576 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4577 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4578 | e66f22eb | KangIngu | { |
4579 | return; |
||
4580 | ca40e004 | ljiyeon | } |
4581 | e66f22eb | KangIngu | |
4582 | 787a4489 | KangIngu | CreateControl(); |
4583 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4584 | 49b217ad | humkyung | currentControl.IsNew = false; |
4585 | 787a4489 | KangIngu | currentControl = null; |
4586 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4587 | 787a4489 | KangIngu | } |
4588 | else |
||
4589 | { |
||
4590 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4591 | //{ |
||
4592 | ca40e004 | ljiyeon | currentControl = new ArrowTextControl(); |
4593 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4594 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4595 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4596 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4597 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4598 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4599 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4600 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4601 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4602 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4603 | |||
4604 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4605 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4606 | |||
4607 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4608 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4609 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).isTrans = true; |
4610 | 787a4489 | KangIngu | } |
4611 | } |
||
4612 | } |
||
4613 | break; |
||
4614 | case ControlType.ArrowTextBorderControl: |
||
4615 | ca40e004 | ljiyeon | { |
4616 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
4617 | { |
||
4618 | if (currentControl is ArrowTextControl) |
||
4619 | { |
||
4620 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4621 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4622 | e66f22eb | KangIngu | { |
4623 | return; |
||
4624 | } |
||
4625 | |||
4626 | 787a4489 | KangIngu | CreateControl(); |
4627 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4628 | 49b217ad | humkyung | currentControl.IsNew = false; |
4629 | 787a4489 | KangIngu | currentControl = null; |
4630 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4631 | 787a4489 | KangIngu | } |
4632 | else |
||
4633 | { |
||
4634 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4635 | //{ |
||
4636 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4637 | { |
||
4638 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
4639 | }; |
||
4640 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4641 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4642 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4643 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4644 | |||
4645 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4646 | |||
4647 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4648 | |||
4649 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
4650 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4651 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4652 | 787a4489 | KangIngu | |
4653 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4654 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4655 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4656 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4657 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4658 | e66f22eb | KangIngu | //} |
4659 | 787a4489 | KangIngu | } |
4660 | } |
||
4661 | } |
||
4662 | break; |
||
4663 | case ControlType.ArrowTransTextBorderControl: |
||
4664 | { |
||
4665 | if (mouseButtonDown == MouseButton.Left) |
||
4666 | { |
||
4667 | if (currentControl is ArrowTextControl) |
||
4668 | { |
||
4669 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4670 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4671 | e66f22eb | KangIngu | { |
4672 | return; |
||
4673 | } |
||
4674 | 787a4489 | KangIngu | CreateControl(); |
4675 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4676 | 49b217ad | humkyung | currentControl.IsNew = false; |
4677 | 787a4489 | KangIngu | currentControl = null; |
4678 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4679 | 787a4489 | KangIngu | } |
4680 | else |
||
4681 | { |
||
4682 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4683 | //{ |
||
4684 | ca40e004 | ljiyeon | |
4685 | |||
4686 | currentControl = new ArrowTextControl() |
||
4687 | 787a4489 | KangIngu | { |
4688 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
4689 | }; |
||
4690 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4691 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4692 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4693 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4694 | |||
4695 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4696 | |||
4697 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4698 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4699 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4700 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4701 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4702 | ca40e004 | ljiyeon | |
4703 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4704 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4705 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).ApplyTemplate(); |
4706 | |||
4707 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4708 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
4709 | ca40e004 | ljiyeon | |
4710 | //20180911 LJY |
||
4711 | (currentControl as ArrowTextControl).isTrans = true; |
||
4712 | |||
4713 | |||
4714 | e66f22eb | KangIngu | //} |
4715 | 787a4489 | KangIngu | } |
4716 | } |
||
4717 | } |
||
4718 | break; |
||
4719 | case ControlType.ArrowTextCloudControl: |
||
4720 | { |
||
4721 | if (mouseButtonDown == MouseButton.Left) |
||
4722 | { |
||
4723 | if (currentControl is ArrowTextControl) |
||
4724 | { |
||
4725 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4726 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4727 | e66f22eb | KangIngu | { |
4728 | return; |
||
4729 | } |
||
4730 | 787a4489 | KangIngu | CreateControl(); |
4731 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4732 | 49b217ad | humkyung | currentControl.IsNew = false; |
4733 | 787a4489 | KangIngu | currentControl = null; |
4734 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4735 | 787a4489 | KangIngu | } |
4736 | else |
||
4737 | { |
||
4738 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4739 | //{ |
||
4740 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4741 | { |
||
4742 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
4743 | }; |
||
4744 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4745 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4746 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4747 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4748 | |||
4749 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4750 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4751 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4752 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4753 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4754 | |||
4755 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4756 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4757 | |||
4758 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4759 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4760 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4761 | e66f22eb | KangIngu | //} |
4762 | 787a4489 | KangIngu | } |
4763 | } |
||
4764 | } |
||
4765 | break; |
||
4766 | case ControlType.ArrowTransTextCloudControl: |
||
4767 | { |
||
4768 | if (mouseButtonDown == MouseButton.Left) |
||
4769 | { |
||
4770 | if (currentControl is ArrowTextControl) |
||
4771 | { |
||
4772 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4773 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4774 | e66f22eb | KangIngu | { |
4775 | return; |
||
4776 | } |
||
4777 | 787a4489 | KangIngu | CreateControl(); |
4778 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4779 | 49b217ad | humkyung | currentControl.IsNew = false; |
4780 | 787a4489 | KangIngu | currentControl = null; |
4781 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4782 | 787a4489 | KangIngu | } |
4783 | else |
||
4784 | { |
||
4785 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4786 | //{ |
||
4787 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4788 | { |
||
4789 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
4790 | }; |
||
4791 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4792 | ca40e004 | ljiyeon | currentControl.IsNew = true; |
4793 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4794 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4795 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4796 | |||
4797 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4798 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4799 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4800 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4801 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4802 | |||
4803 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4804 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4805 | 787a4489 | KangIngu | |
4806 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
4807 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4808 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4809 | |||
4810 | //20180911 LJY |
||
4811 | (currentControl as ArrowTextControl).isTrans = true; |
||
4812 | e66f22eb | KangIngu | //} |
4813 | 787a4489 | KangIngu | } |
4814 | } |
||
4815 | } |
||
4816 | break; |
||
4817 | case ControlType.PolygonControl: |
||
4818 | { |
||
4819 | if (currentControl is PolygonControl) |
||
4820 | { |
||
4821 | var control = currentControl as PolygonControl; |
||
4822 | |||
4823 | if (mouseButtonDown == MouseButton.Right) |
||
4824 | { |
||
4825 | control.IsCompleted = true; |
||
4826 | } |
||
4827 | |||
4828 | if (!control.IsCompleted) |
||
4829 | { |
||
4830 | control.PointSet.Add(control.EndPoint); |
||
4831 | } |
||
4832 | else |
||
4833 | { |
||
4834 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4835 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4836 | e66f22eb | KangIngu | { |
4837 | return; |
||
4838 | } |
||
4839 | |||
4840 | 787a4489 | KangIngu | var firstPoint = control.PointSet.First(); |
4841 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
4842 | control.LineSize = ViewerDataModel.Instance.LineSize; |
||
4843 | control.PointSet.Add(firstPoint); |
||
4844 | |||
4845 | 661b7416 | humkyung | ///control.SetPolyPath(); |
4846 | 787a4489 | KangIngu | |
4847 | control.ApplyOverViewData(); |
||
4848 | |||
4849 | CreateControl(); |
||
4850 | b9ce7aee | ljiyeon | control.updateControl(); |
4851 | 787a4489 | KangIngu | currentControl = null; |
4852 | } |
||
4853 | } |
||
4854 | else |
||
4855 | { |
||
4856 | if (mouseButtonDown == MouseButton.Left) |
||
4857 | { |
||
4858 | currentControl = new PolygonControl |
||
4859 | { |
||
4860 | PointSet = new List<Point>(), |
||
4861 | }; |
||
4862 | |||
4863 | 16a422d1 | humkyung | var polygonControl = (currentControl as PolygonControl); |
4864 | currentControl.CommentID = Commons.shortGuid(); |
||
4865 | currentControl.IsNew = true; |
||
4866 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4867 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4868 | //currentControl.OnApplyTemplate(); |
||
4869 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
4870 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
4871 | polygonControl.ApplyTemplate(); |
||
4872 | polygonControl.Visibility = Visibility.Visible; |
||
4873 | 787a4489 | KangIngu | } |
4874 | } |
||
4875 | } |
||
4876 | break; |
||
4877 | //강인구 추가 |
||
4878 | case ControlType.Sign: |
||
4879 | { |
||
4880 | if (mouseButtonDown == MouseButton.Left) |
||
4881 | { |
||
4882 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4883 | //{ |
||
4884 | 661b7416 | humkyung | var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO); |
4885 | 992a98b4 | KangIngu | |
4886 | if (_sign == null) |
||
4887 | { |
||
4888 | txtBatch.Visibility = Visibility.Collapsed; |
||
4889 | mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
4890 | controlType = ControlType.None; |
||
4891 | |||
4892 | this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
||
4893 | this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
||
4894 | return; |
||
4895 | } |
||
4896 | |||
4897 | 787a4489 | KangIngu | if (currentControl is SignControl) |
4898 | { |
||
4899 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4900 | if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4901 | e66f22eb | KangIngu | { |
4902 | return; |
||
4903 | } |
||
4904 | |||
4905 | 787a4489 | KangIngu | CreateControl(); |
4906 | currentControl = null; |
||
4907 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4908 | { |
||
4909 | 999c9e40 | humkyung | txtBatch.Text = "Place Date"; |
4910 | 787a4489 | KangIngu | controlType = ControlType.Date; |
4911 | } |
||
4912 | } |
||
4913 | else |
||
4914 | { |
||
4915 | currentControl = new SignControl |
||
4916 | { |
||
4917 | Background = new SolidColorBrush(Colors.Black), |
||
4918 | UserNumber = App.ViewInfo.UserID, |
||
4919 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
4920 | EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
4921 | ControlType = ControlType.Sign |
||
4922 | }; |
||
4923 | |||
4924 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4925 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4926 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4927 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4928 | ca40e004 | ljiyeon | |
4929 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4930 | (currentControl as SignControl).Angle -= rotate.Angle; |
||
4931 | } |
||
4932 | e66f22eb | KangIngu | //} |
4933 | 787a4489 | KangIngu | } |
4934 | } |
||
4935 | break; |
||
4936 | case ControlType.Mark: |
||
4937 | { |
||
4938 | if (mouseButtonDown == MouseButton.Left) |
||
4939 | { |
||
4940 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4941 | //{ |
||
4942 | 787a4489 | KangIngu | if (currentControl is RectangleControl) |
4943 | { |
||
4944 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4945 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4946 | e66f22eb | KangIngu | { |
4947 | return; |
||
4948 | } |
||
4949 | |||
4950 | 787a4489 | KangIngu | CreateControl(); |
4951 | (currentControl as RectangleControl).ApplyOverViewData(); |
||
4952 | currentControl = null; |
||
4953 | 510cbd2a | ljiyeon | |
4954 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
4955 | 787a4489 | KangIngu | |
4956 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4957 | { |
||
4958 | 999c9e40 | humkyung | txtBatch.Text = "Place Signature"; |
4959 | 787a4489 | KangIngu | controlType = ControlType.Sign; |
4960 | } |
||
4961 | } |
||
4962 | else |
||
4963 | { |
||
4964 | currentControl = new RectangleControl |
||
4965 | { |
||
4966 | Background = new SolidColorBrush(Colors.Black), |
||
4967 | Paint = PaintSet.Fill |
||
4968 | }; |
||
4969 | |||
4970 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4971 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
4972 | 787a4489 | KangIngu | currentControl.IsNew = true; |
4973 | (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
||
4974 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4975 | } |
||
4976 | e66f22eb | KangIngu | //} |
4977 | 787a4489 | KangIngu | } |
4978 | } |
||
4979 | break; |
||
4980 | case ControlType.Symbol: |
||
4981 | { |
||
4982 | if (mouseButtonDown == MouseButton.Left) |
||
4983 | { |
||
4984 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4985 | //{ |
||
4986 | 787a4489 | KangIngu | if (currentControl is SymControl) |
4987 | { |
||
4988 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4989 | if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4990 | e66f22eb | KangIngu | { |
4991 | return; |
||
4992 | } |
||
4993 | 787a4489 | KangIngu | CreateControl(); |
4994 | currentControl = null; |
||
4995 | 510cbd2a | ljiyeon | |
4996 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
4997 | 787a4489 | KangIngu | } |
4998 | else |
||
4999 | { |
||
5000 | currentControl = new SymControl |
||
5001 | { |
||
5002 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
5003 | Background = new SolidColorBrush(Colors.Black), |
||
5004 | ControlType = ControlType.Symbol |
||
5005 | }; |
||
5006 | |||
5007 | currentControl.IsNew = true; |
||
5008 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5009 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
5010 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
5011 | ca40e004 | ljiyeon | |
5012 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
5013 | (currentControl as SymControl).Angle -= rotate.Angle; |
||
5014 | } |
||
5015 | e66f22eb | KangIngu | //} |
5016 | 787a4489 | KangIngu | } |
5017 | } |
||
5018 | break; |
||
5019 | case ControlType.Stamp: |
||
5020 | { |
||
5021 | if (mouseButtonDown == MouseButton.Left) |
||
5022 | { |
||
5023 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5024 | //{ |
||
5025 | 787a4489 | KangIngu | if (currentControl is SymControlN) |
5026 | { |
||
5027 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5028 | if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5029 | e66f22eb | KangIngu | { |
5030 | return; |
||
5031 | } |
||
5032 | |||
5033 | 787a4489 | KangIngu | CreateControl(); |
5034 | currentControl = null; |
||
5035 | 510cbd2a | ljiyeon | |
5036 | |||
5037 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
5038 | 787a4489 | KangIngu | } |
5039 | else |
||
5040 | { |
||
5041 | currentControl = new SymControlN |
||
5042 | { |
||
5043 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
5044 | Background = new SolidColorBrush(Colors.Black), |
||
5045 | ControlType = ControlType.Stamp |
||
5046 | }; |
||
5047 | |||
5048 | currentControl.IsNew = true; |
||
5049 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5050 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
5051 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
5052 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
5053 | (currentControl as SymControlN).Angle -= rotate.Angle; |
||
5054 | } |
||
5055 | e66f22eb | KangIngu | //} |
5056 | 787a4489 | KangIngu | } |
5057 | } |
||
5058 | break; |
||
5059 | case ControlType.PenControl: |
||
5060 | { |
||
5061 | if (inkBoard.Tag.ToString() == "Ink") |
||
5062 | { |
||
5063 | inkBoard.IsEnabled = true; |
||
5064 | StartNewStroke(canvasDrawingMouseDownPoint); |
||
5065 | } |
||
5066 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
5067 | { |
||
5068 | RemovePointStroke(canvasDrawingMouseDownPoint); |
||
5069 | } |
||
5070 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
5071 | { |
||
5072 | RemoveLineStroke(canvasDrawingMouseDownPoint); |
||
5073 | } |
||
5074 | IsDrawing = true; |
||
5075 | return; |
||
5076 | } |
||
5077 | default: |
||
5078 | if (currentControl != null) |
||
5079 | { |
||
5080 | currentControl.CommentID = null; |
||
5081 | currentControl.IsNew = false; |
||
5082 | } |
||
5083 | break; |
||
5084 | } |
||
5085 | } |
||
5086 | if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left) |
||
5087 | { |
||
5088 | if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
||
5089 | { |
||
5090 | bool mouseOff = false; |
||
5091 | foreach (var item in SelectLayer.Children) |
||
5092 | { |
||
5093 | if (item is AdornerFinal) |
||
5094 | { |
||
5095 | |||
5096 | var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
||
5097 | if (over != null) |
||
5098 | { |
||
5099 | mouseOff = true; |
||
5100 | } |
||
5101 | } |
||
5102 | } |
||
5103 | |||
5104 | if (!mouseOff) |
||
5105 | { |
||
5106 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
5107 | 787a4489 | KangIngu | } |
5108 | } |
||
5109 | zoomAndPanControl.CaptureMouse(); |
||
5110 | e.Handled = true; |
||
5111 | } |
||
5112 | } |
||
5113 | e54660e8 | KangIngu | |
5114 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
5115 | { |
||
5116 | mouseButtonDown = e.ChangedButton; |
||
5117 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
||
5118 | } |
||
5119 | |||
5120 | 787a4489 | KangIngu | private void RemoveLineStroke(Point P) |
5121 | { |
||
5122 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
5123 | if (control != null) |
||
5124 | { |
||
5125 | UndoData = new Undo_data() |
||
5126 | { |
||
5127 | IsUndo = false, |
||
5128 | Event = Event_Type.Delete, |
||
5129 | EventTime = DateTime.Now, |
||
5130 | Markup_List = new List<Multi_Undo_data>() |
||
5131 | }; |
||
5132 | |||
5133 | |||
5134 | multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo; |
||
5135 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
5136 | multi_Undo_Data = new Multi_Undo_data(); |
||
5137 | |||
5138 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
5139 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
5140 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
5141 | 6707a5c7 | ljiyeon | |
5142 | //임시파일에서도 삭제한다. |
||
5143 | a20d338f | ljiyeon | TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
5144 | 6707a5c7 | ljiyeon | |
5145 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
5146 | { |
||
5147 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
5148 | }); |
||
5149 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
5150 | e54660e8 | KangIngu | |
5151 | 787a4489 | KangIngu | } |
5152 | } |
||
5153 | |||
5154 | private void RemovePointStroke(Point P) |
||
5155 | { |
||
5156 | foreach (Stroke hits in inkBoard.Strokes) |
||
5157 | { |
||
5158 | foreach (StylusPoint sty in hits.StylusPoints) |
||
5159 | { |
||
5160 | |||
5161 | } |
||
5162 | if (hits.HitTest(P)) |
||
5163 | { |
||
5164 | inkBoard.Strokes.Remove(hits); |
||
5165 | return; |
||
5166 | } |
||
5167 | } |
||
5168 | } |
||
5169 | |||
5170 | private void StartNewStroke(Point P) |
||
5171 | { |
||
5172 | strokePoints = new StylusPointCollection(); |
||
5173 | StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
||
5174 | strokePoints.Add(segment1Start); |
||
5175 | stroke = new Stroke(strokePoints); |
||
5176 | |||
5177 | stroke.DrawingAttributes.Color = Colors.Red; |
||
5178 | stroke.DrawingAttributes.Width = 4; |
||
5179 | stroke.DrawingAttributes.Height = 4; |
||
5180 | |||
5181 | inkBoard.Strokes.Add(stroke); |
||
5182 | |||
5183 | } |
||
5184 | |||
5185 | private void btnConsolidate_Click(object sender, RoutedEventArgs e) |
||
5186 | { |
||
5187 | ConsolidationMethod(); |
||
5188 | } |
||
5189 | |||
5190 | 04a7385a | djkim | public void TeamConsolidationMethod() |
5191 | { |
||
5192 | ChangeCommentReact(); |
||
5193 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
5194 | { |
||
5195 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
5196 | } |
||
5197 | else |
||
5198 | { |
||
5199 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5200 | { |
||
5201 | if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
||
5202 | { |
||
5203 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
||
5204 | return; |
||
5205 | } |
||
5206 | } |
||
5207 | ViewerDataModel.Instance.IsConsolidate = true; |
||
5208 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
5209 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
5210 | |||
5211 | string project_no = App.ViewInfo.ProjectNO; |
||
5212 | string doc_id = _DocInfo.ID; |
||
5213 | string user_id = App.ViewInfo.UserID; |
||
5214 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
5215 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5216 | 90e7968d | ljiyeon | { |
5217 | 04a7385a | djkim | markupInfoItems.Add(item); |
5218 | } |
||
5219 | 0f065e57 | ljiyeon | Logger.sendReqLog("TeamConsolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
5220 | Logger.sendResLog("TeamConsolidate", this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
5221 | //this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems); |
||
5222 | 04a7385a | djkim | |
5223 | 90e7968d | ljiyeon | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
5224 | 04a7385a | djkim | this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5225 | } |
||
5226 | } |
||
5227 | 787a4489 | KangIngu | public void ConsolidationMethod() |
5228 | { |
||
5229 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
5230 | { |
||
5231 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
5232 | } |
||
5233 | else |
||
5234 | 90e7968d | ljiyeon | { |
5235 | 35a96e24 | humkyung | /* |
5236 | 787a4489 | KangIngu | ViewerDataModel.Instance.IsConsolidate = true; |
5237 | 7b312426 | KangIngu | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
5238 | 787a4489 | KangIngu | |
5239 | 6c781c0c | djkim | string project_no = App.ViewInfo.ProjectNO; |
5240 | string doc_id = _DocInfo.ID; |
||
5241 | string user_id = App.ViewInfo.UserID; |
||
5242 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
5243 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5244 | { |
||
5245 | markupInfoItems.Add(item); |
||
5246 | 787a4489 | KangIngu | } |
5247 | 0f065e57 | ljiyeon | Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
5248 | Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
5249 | |||
5250 | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
5251 | 6c781c0c | djkim | this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5252 | 35a96e24 | humkyung | */ |
5253 | |||
5254 | List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
||
5255 | foreach (var item in this.gridViewMarkup.SelectedItems) |
||
5256 | { |
||
5257 | MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
||
5258 | } |
||
5259 | int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text); |
||
5260 | 90e7968d | ljiyeon | |
5261 | 35a96e24 | humkyung | ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo); |
5262 | 787a4489 | KangIngu | } |
5263 | } |
||
5264 | |||
5265 | private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
5266 | { |
||
5267 | if (App.ViewInfo != null) |
||
5268 | { |
||
5269 | btnConsolidate = (sender as RadRibbonButton); |
||
5270 | if (!App.ViewInfo.NewCommentPermission) |
||
5271 | { |
||
5272 | (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
||
5273 | } |
||
5274 | } |
||
5275 | } |
||
5276 | |||
5277 | private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
||
5278 | { |
||
5279 | 04a7385a | djkim | TeamConsolidationMethod(); |
5280 | 787a4489 | KangIngu | } |
5281 | |||
5282 | private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
5283 | { |
||
5284 | btnTeamConsolidate = sender as RadRibbonButton; |
||
5285 | if (App.ViewInfo != null) |
||
5286 | { |
||
5287 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
5288 | { |
||
5289 | if (btnConsolidate != null) |
||
5290 | { |
||
5291 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
5292 | } |
||
5293 | |||
5294 | if (!App.ViewInfo.NewCommentPermission) |
||
5295 | { |
||
5296 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
5297 | } |
||
5298 | } |
||
5299 | else |
||
5300 | { |
||
5301 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
5302 | } |
||
5303 | } |
||
5304 | } |
||
5305 | |||
5306 | private void FinalPDFEvent(object sender, RoutedEventArgs e) |
||
5307 | { |
||
5308 | var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
5309 | if (item != null) |
||
5310 | { |
||
5311 | 90e7968d | ljiyeon | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
5312 | 0f065e57 | ljiyeon | |
5313 | 787a4489 | KangIngu | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
5314 | } |
||
5315 | else |
||
5316 | { |
||
5317 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
5318 | } |
||
5319 | } |
||
5320 | |||
5321 | private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
5322 | { |
||
5323 | btnFinalPDF = sender as RadRibbonButton; |
||
5324 | if (App.ViewInfo != null) |
||
5325 | { |
||
5326 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
5327 | { |
||
5328 | btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
||
5329 | if (btnConsolidate != null) |
||
5330 | { |
||
5331 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
5332 | } |
||
5333 | } |
||
5334 | } |
||
5335 | } |
||
5336 | |||
5337 | 80458c15 | ljiyeon | private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e) |
5338 | { |
||
5339 | ChangeCommentReact(); |
||
5340 | |||
5341 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
5342 | { |
||
5343 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
5344 | } |
||
5345 | else |
||
5346 | { |
||
5347 | ViewerDataModel.Instance.IsConsolidate = true; |
||
5348 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
5349 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
5350 | |||
5351 | string project_no = App.ViewInfo.ProjectNO; |
||
5352 | string doc_id = _DocInfo.ID; |
||
5353 | string user_id = App.ViewInfo.UserID; |
||
5354 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
5355 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5356 | { |
||
5357 | markupInfoItems.Add(item); |
||
5358 | } |
||
5359 | Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
||
5360 | Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
5361 | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
5362 | 1126281e | djkim | var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5363 | 80458c15 | ljiyeon | |
5364 | 1126281e | djkim | var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
5365 | 80458c15 | ljiyeon | if (item2 != null) |
5366 | { |
||
5367 | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
||
5368 | |||
5369 | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID); |
||
5370 | 1126281e | djkim | BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5371 | 80458c15 | ljiyeon | } |
5372 | else |
||
5373 | { |
||
5374 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
5375 | } |
||
5376 | 90e7968d | ljiyeon | } |
5377 | 80458c15 | ljiyeon | } |
5378 | |||
5379 | private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
5380 | 90e7968d | ljiyeon | { |
5381 | 80458c15 | ljiyeon | btnConsolidateFinalPDF = (sender as RadRibbonButton); |
5382 | |||
5383 | if (App.ViewInfo != null) |
||
5384 | { |
||
5385 | if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission) |
||
5386 | { |
||
5387 | 90e7968d | ljiyeon | btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
5388 | 80458c15 | ljiyeon | } |
5389 | 90e7968d | ljiyeon | } |
5390 | 80458c15 | ljiyeon | } |
5391 | |||
5392 | 787a4489 | KangIngu | private void SyncCompare_Click(object sender, RoutedEventArgs e) |
5393 | { |
||
5394 | if (CompareMode.IsChecked) |
||
5395 | { |
||
5396 | if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
5397 | { |
||
5398 | ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
5399 | } |
||
5400 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
5401 | { |
||
5402 | ViewerDataModel.Instance.PageNumber = 1; |
||
5403 | } |
||
5404 | |||
5405 | 90e7968d | ljiyeon | Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + |
5406 | 0f065e57 | ljiyeon | "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + |
5407 | 90e7968d | ljiyeon | userData.COMPANY != "EXT" ? "true" : "false", 1); |
5408 | 0f065e57 | ljiyeon | |
5409 | d9cf7d6e | djkim | BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
5410 | 787a4489 | KangIngu | } |
5411 | else |
||
5412 | { |
||
5413 | da.From = 1; |
||
5414 | da.To = 1; |
||
5415 | da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
||
5416 | da.AutoReverse = false; |
||
5417 | canvas_compareBorder.Children.Clear(); |
||
5418 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
5419 | } |
||
5420 | } |
||
5421 | |||
5422 | 9cd2865b | KangIngu | private void Sync_Click(object sender, RoutedEventArgs e) |
5423 | { |
||
5424 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
5425 | 9cd2865b | KangIngu | { |
5426 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
5427 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
5428 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
5429 | } |
||
5430 | } |
||
5431 | |||
5432 | 787a4489 | KangIngu | private void SyncUserListExpender_Click(object sender, RoutedEventArgs e) |
5433 | { |
||
5434 | if (UserList.IsChecked) |
||
5435 | { |
||
5436 | this.gridViewRevMarkup.Visibility = Visibility.Visible; |
||
5437 | } |
||
5438 | else |
||
5439 | { |
||
5440 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
5441 | } |
||
5442 | } |
||
5443 | |||
5444 | private void SyncPageBalance_Click(object sender, RoutedEventArgs e) |
||
5445 | { |
||
5446 | |||
5447 | if (BalanceMode.IsChecked) |
||
5448 | { |
||
5449 | ViewerDataModel.Instance.PageBalanceMode = true; |
||
5450 | } |
||
5451 | else |
||
5452 | { |
||
5453 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
5454 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
5455 | } |
||
5456 | } |
||
5457 | |||
5458 | private void SyncExit_Click(object sender, RoutedEventArgs e) |
||
5459 | { |
||
5460 | //초기화 |
||
5461 | testPanel2.IsHidden = true; |
||
5462 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
5463 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
5464 | ViewerDataModel.Instance.PageNumber = 0; |
||
5465 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
5466 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
5467 | UserList.IsChecked = false; |
||
5468 | BalanceMode.IsChecked = false; |
||
5469 | } |
||
5470 | |||
5471 | private void SyncPageChange_Click(object sender, RoutedEventArgs e) |
||
5472 | { |
||
5473 | if ((sender as System.Windows.Controls.Control).Tag != null) |
||
5474 | { |
||
5475 | //Compare 초기화 |
||
5476 | CompareMode.IsChecked = false; |
||
5477 | var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag); |
||
5478 | |||
5479 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
5480 | { |
||
5481 | ViewerDataModel.Instance.PageNumber = 1; |
||
5482 | } |
||
5483 | |||
5484 | if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount) |
||
5485 | { |
||
5486 | } |
||
5487 | else |
||
5488 | { |
||
5489 | ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
||
5490 | } |
||
5491 | |||
5492 | if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0) |
||
5493 | { |
||
5494 | |||
5495 | } |
||
5496 | else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1) |
||
5497 | { |
||
5498 | ViewerDataModel.Instance.PageNumber += balancePoint; |
||
5499 | } |
||
5500 | |||
5501 | if (!testPanel2.IsHidden) |
||
5502 | { |
||
5503 | if (IsSyncPDFMode) |
||
5504 | { |
||
5505 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
5506 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
5507 | |||
5508 | if (pdfpath.IsDownloading) |
||
5509 | { |
||
5510 | pdfpath.DownloadCompleted += (ex, arg) => |
||
5511 | { |
||
5512 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5513 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5514 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5515 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5516 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5517 | }; |
||
5518 | } |
||
5519 | else |
||
5520 | { |
||
5521 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5522 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5523 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5524 | |||
5525 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5526 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5527 | } |
||
5528 | |||
5529 | } |
||
5530 | else |
||
5531 | { |
||
5532 | a874198d | humkyung | string uri = ""; |
5533 | |||
5534 | if (userData.COMPANY != "EXT") |
||
5535 | { |
||
5536 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
5537 | a874198d | humkyung | } |
5538 | else |
||
5539 | { |
||
5540 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
||
5541 | } |
||
5542 | 787a4489 | KangIngu | |
5543 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5544 | |||
5545 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5546 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5547 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5548 | |||
5549 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
5550 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
5551 | |||
5552 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5553 | { |
||
5554 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5555 | { |
||
5556 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5557 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5558 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5559 | |||
5560 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
5561 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
5562 | }; |
||
5563 | } |
||
5564 | } |
||
5565 | |||
5566 | //강인구 추가(페이지 이동시 코멘트 재 호출) |
||
5567 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
5568 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
5569 | |||
5570 | foreach (var item in gridSelectionRevItem) |
||
5571 | { |
||
5572 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
5573 | { |
||
5574 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
5575 | 787a4489 | KangIngu | }); |
5576 | } |
||
5577 | e54660e8 | KangIngu | |
5578 | 787a4489 | KangIngu | //강인구 추가 |
5579 | zoomAndPanControl2.ZoomTo(new Rect |
||
5580 | { |
||
5581 | X = 0, |
||
5582 | Y = 0, |
||
5583 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
5584 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
5585 | }); |
||
5586 | ae56d52d | KangIngu | |
5587 | 787a4489 | KangIngu | tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber); |
5588 | |||
5589 | } |
||
5590 | } |
||
5591 | } |
||
5592 | |||
5593 | private void SyncChange_Click(object sender, RoutedEventArgs e) |
||
5594 | { |
||
5595 | if (MarkupMode.IsChecked) |
||
5596 | { |
||
5597 | IsSyncPDFMode = true; |
||
5598 | |||
5599 | var uri = CurrentRev.TO_VENDOR; |
||
5600 | ae56d52d | KangIngu | |
5601 | 787a4489 | KangIngu | if (ViewerDataModel.Instance.PageNumber == 0) |
5602 | { |
||
5603 | ViewerDataModel.Instance.PageNumber = 1; |
||
5604 | } |
||
5605 | |||
5606 | //PDF모드 잠시 대기(강인구) |
||
5607 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
5608 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
5609 | |||
5610 | if (pdfpath.IsDownloading) |
||
5611 | { |
||
5612 | pdfpath.DownloadCompleted += (ex, arg) => |
||
5613 | { |
||
5614 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5615 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5616 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5617 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5618 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5619 | }; |
||
5620 | } |
||
5621 | else |
||
5622 | { |
||
5623 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5624 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5625 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5626 | |||
5627 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5628 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5629 | } |
||
5630 | } |
||
5631 | else |
||
5632 | { |
||
5633 | IsSyncPDFMode = false; |
||
5634 | a874198d | humkyung | string uri = ""; |
5635 | if (userData.COMPANY != "EXT") |
||
5636 | { |
||
5637 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5638 | a874198d | humkyung | } |
5639 | else |
||
5640 | { |
||
5641 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5642 | } |
||
5643 | 787a4489 | KangIngu | |
5644 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5645 | |||
5646 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5647 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5648 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5649 | |||
5650 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5651 | { |
||
5652 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5653 | { |
||
5654 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5655 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5656 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5657 | }; |
||
5658 | } |
||
5659 | zoomAndPanControl2.ApplyTemplate(); |
||
5660 | zoomAndPanControl2.UpdateLayout(); |
||
5661 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
5662 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5663 | } |
||
5664 | } |
||
5665 | |||
5666 | private void RadButton_Click(object sender, RoutedEventArgs e) |
||
5667 | { |
||
5668 | gridViewHistory_Busy.IsBusy = true; |
||
5669 | |||
5670 | RadButton instance = sender as RadButton; |
||
5671 | if (instance.CommandParameter != null) |
||
5672 | { |
||
5673 | CurrentRev = instance.CommandParameter as VPRevision; |
||
5674 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
5675 | { |
||
5676 | if (ea.Error == null && ea.Result != null) |
||
5677 | { |
||
5678 | testPanel2.IsHidden = false; |
||
5679 | |||
5680 | ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID); |
||
5681 | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
||
5682 | |||
5683 | a874198d | humkyung | string uri = ""; |
5684 | if (userData.COMPANY != "EXT") |
||
5685 | { |
||
5686 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5687 | a874198d | humkyung | } |
5688 | else |
||
5689 | { |
||
5690 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5691 | } |
||
5692 | 787a4489 | KangIngu | |
5693 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
5694 | |||
5695 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5696 | |||
5697 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5698 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5699 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5700 | |||
5701 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5702 | { |
||
5703 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5704 | { |
||
5705 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5706 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5707 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5708 | }; |
||
5709 | } |
||
5710 | |||
5711 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
5712 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5713 | zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle; |
||
5714 | zoomAndPanControl2.ApplyTemplate(); |
||
5715 | zoomAndPanControl2.UpdateLayout(); |
||
5716 | |||
5717 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
5718 | { |
||
5719 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
5720 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
5721 | } |
||
5722 | |||
5723 | 9cd2865b | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X; |
5724 | ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y; |
||
5725 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
5726 | |||
5727 | 787a4489 | KangIngu | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
5728 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
5729 | gridViewHistory_Busy.IsBusy = false; |
||
5730 | } |
||
5731 | 0f065e57 | ljiyeon | |
5732 | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
||
5733 | 90e7968d | ljiyeon | }; |
5734 | 787a4489 | KangIngu | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
5735 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
5736 | 787a4489 | KangIngu | } |
5737 | } |
||
5738 | |||
5739 | public void Sync_Event(VPRevision Currnet_Rev) |
||
5740 | { |
||
5741 | CurrentRev = Currnet_Rev; |
||
5742 | |||
5743 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
5744 | { |
||
5745 | if (ea.Error == null && ea.Result != null) |
||
5746 | { |
||
5747 | testPanel2.IsHidden = false; |
||
5748 | |||
5749 | ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID); |
||
5750 | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
||
5751 | |||
5752 | a874198d | humkyung | string uri = ""; |
5753 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
5754 | a874198d | humkyung | { |
5755 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5756 | a874198d | humkyung | } |
5757 | else |
||
5758 | { |
||
5759 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5760 | } |
||
5761 | 787a4489 | KangIngu | |
5762 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
5763 | |||
5764 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5765 | |||
5766 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5767 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5768 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5769 | |||
5770 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5771 | { |
||
5772 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5773 | { |
||
5774 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5775 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5776 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5777 | }; |
||
5778 | } |
||
5779 | 90e7968d | ljiyeon | |
5780 | |||
5781 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
5782 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5783 | zoomAndPanControl2.ApplyTemplate(); |
||
5784 | zoomAndPanControl2.UpdateLayout(); |
||
5785 | |||
5786 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
5787 | { |
||
5788 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
5789 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
5790 | } |
||
5791 | //} |
||
5792 | |||
5793 | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
||
5794 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
5795 | 90e7968d | ljiyeon | gridViewHistory_Busy.IsBusy = false; |
5796 | 787a4489 | KangIngu | } |
5797 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
5798 | 90e7968d | ljiyeon | |
5799 | 787a4489 | KangIngu | }; |
5800 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
5801 | 90e7968d | ljiyeon | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
5802 | 787a4489 | KangIngu | } |
5803 | |||
5804 | private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e) |
||
5805 | { |
||
5806 | if (sender is Image) |
||
5807 | { |
||
5808 | if ((sender as Image).Tag != null) |
||
5809 | { |
||
5810 | var pdfUrl = (sender as Image).Tag.ToString(); |
||
5811 | System.Diagnostics.Process.Start(pdfUrl); |
||
5812 | } |
||
5813 | else |
||
5814 | { |
||
5815 | this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내"); |
||
5816 | } |
||
5817 | } |
||
5818 | } |
||
5819 | |||
5820 | private void Create_Symbol(object sender, RoutedEventArgs e) |
||
5821 | { |
||
5822 | 5529d2a2 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
5823 | 787a4489 | KangIngu | |
5824 | if (SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
5825 | { |
||
5826 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
5827 | } |
||
5828 | else //선택된 것이 있으면 |
||
5829 | { |
||
5830 | string MarkupData = ""; |
||
5831 | adorner_ = new AdornerFinal(); |
||
5832 | |||
5833 | foreach (var item in SelectLayer.Children) |
||
5834 | { |
||
5835 | if (item.GetType().Name == "AdornerFinal") |
||
5836 | { |
||
5837 | adorner_ = (item as Controls.AdornerFinal); |
||
5838 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
5839 | { |
||
5840 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
5841 | { |
||
5842 | 5529d2a2 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
5843 | 787a4489 | KangIngu | MarkupData += markupReturn.ConvertData; |
5844 | } |
||
5845 | } |
||
5846 | } |
||
5847 | } |
||
5848 | DialogParameters parameters = new DialogParameters() |
||
5849 | { |
||
5850 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
5851 | 787a4489 | KangIngu | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
5852 | DefaultPromptResultValue = "Custom State", |
||
5853 | Content = "Name :", |
||
5854 | Header = "Insert Custom Symbol Name", |
||
5855 | Theme = new VisualStudio2013Theme(), |
||
5856 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5857 | }; |
||
5858 | RadWindow.Prompt(parameters); |
||
5859 | } |
||
5860 | |||
5861 | } |
||
5862 | 53880c83 | ljiyeon | public int symbolselectindex = 0; |
5863 | private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args) |
||
5864 | { |
||
5865 | //Save save = new Save(); |
||
5866 | try |
||
5867 | { |
||
5868 | string svgfilename = null; |
||
5869 | if (symbolname != null) |
||
5870 | { |
||
5871 | if (symbolpng == true || symbolsvg == true) |
||
5872 | { |
||
5873 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
5874 | 24678e06 | humkyung | string guid = Commons.shortGuid(); |
5875 | 53880c83 | ljiyeon | |
5876 | fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte); |
||
5877 | c73426a9 | ljiyeon | //Check_Uri.UriCheck(); |
5878 | 53880c83 | ljiyeon | fileUploader.RunCompleted += (ex, arg) => |
5879 | { |
||
5880 | filename = arg.Result; |
||
5881 | if (symbolpng == true) |
||
5882 | { |
||
5883 | if (filename != null) |
||
5884 | { |
||
5885 | if (symbolselectindex == 0) |
||
5886 | { |
||
5887 | SymbolSave(symbolname, filename, data); |
||
5888 | } |
||
5889 | else |
||
5890 | { |
||
5891 | SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
5892 | } |
||
5893 | DataBind(); |
||
5894 | } |
||
5895 | } |
||
5896 | |||
5897 | if (symbolsvg == true) |
||
5898 | { |
||
5899 | c73426a9 | ljiyeon | try |
5900 | 53880c83 | ljiyeon | { |
5901 | c73426a9 | ljiyeon | var defaultBitmapImage = new BitmapImage(); |
5902 | defaultBitmapImage.BeginInit(); |
||
5903 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
5904 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
5905 | Check_Uri.UriCheck(filename); |
||
5906 | defaultBitmapImage.UriSource = new Uri(filename); |
||
5907 | defaultBitmapImage.EndInit(); |
||
5908 | 53880c83 | ljiyeon | |
5909 | c73426a9 | ljiyeon | System.Drawing.Bitmap image; |
5910 | 53880c83 | ljiyeon | |
5911 | c73426a9 | ljiyeon | if (defaultBitmapImage.IsDownloading) |
5912 | { |
||
5913 | defaultBitmapImage.DownloadCompleted += (ex2, arg2) => |
||
5914 | 53880c83 | ljiyeon | { |
5915 | c73426a9 | ljiyeon | defaultBitmapImage.Freeze(); |
5916 | image = GetBitmap(defaultBitmapImage); |
||
5917 | image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp); |
||
5918 | Process potrace = new Process |
||
5919 | 53880c83 | ljiyeon | { |
5920 | c73426a9 | ljiyeon | StartInfo = new ProcessStartInfo |
5921 | { |
||
5922 | FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
||
5923 | Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
||
5924 | RedirectStandardInput = true, |
||
5925 | RedirectStandardOutput = true, |
||
5926 | RedirectStandardError = true, |
||
5927 | UseShellExecute = false, |
||
5928 | CreateNoWindow = true, |
||
5929 | WindowStyle = ProcessWindowStyle.Hidden |
||
5930 | }, |
||
5931 | }; |
||
5932 | 53880c83 | ljiyeon | |
5933 | c73426a9 | ljiyeon | StringBuilder svgBuilder = new StringBuilder(); |
5934 | potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => |
||
5935 | 53880c83 | ljiyeon | { |
5936 | c73426a9 | ljiyeon | svgBuilder.AppendLine(e2.Data); |
5937 | }; |
||
5938 | |||
5939 | potrace.EnableRaisingEvents = true; |
||
5940 | potrace.Start(); |
||
5941 | potrace.Exited += (sender, e) => |
||
5942 | 53880c83 | ljiyeon | { |
5943 | c73426a9 | ljiyeon | byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg"); |
5944 | svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
||
5945 | Check_Uri.UriCheck(svgfilename); |
||
5946 | if (symbolselectindex == 0) |
||
5947 | { |
||
5948 | SymbolSave(symbolname, svgfilename, data); |
||
5949 | } |
||
5950 | else |
||
5951 | { |
||
5952 | SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
5953 | } |
||
5954 | 53880c83 | ljiyeon | |
5955 | c73426a9 | ljiyeon | DataBind(); |
5956 | }; |
||
5957 | potrace.WaitForExit(); |
||
5958 | 53880c83 | ljiyeon | }; |
5959 | c73426a9 | ljiyeon | } |
5960 | else |
||
5961 | { |
||
5962 | //GC.Collect(); |
||
5963 | } |
||
5964 | 53880c83 | ljiyeon | } |
5965 | c73426a9 | ljiyeon | catch(Exception ee) |
5966 | 90e7968d | ljiyeon | { |
5967 | c73426a9 | ljiyeon | DialogMessage_Alert("" + ee, "Alert"); |
5968 | 90e7968d | ljiyeon | } |
5969 | 53880c83 | ljiyeon | } |
5970 | }; |
||
5971 | } |
||
5972 | } |
||
5973 | } |
||
5974 | catch (Exception e) |
||
5975 | { |
||
5976 | //DialogMessage_Alert(e + "", "Alert"); |
||
5977 | } |
||
5978 | } |
||
5979 | |||
5980 | public void SymbolSave(string Name, string Url, string Data) |
||
5981 | { |
||
5982 | try |
||
5983 | { |
||
5984 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
5985 | { |
||
5986 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
5987 | 53880c83 | ljiyeon | MEMBER_USER_ID = App.ViewInfo.UserID, |
5988 | NAME = Name, |
||
5989 | IMAGE_URL = Url, |
||
5990 | DATA = Data |
||
5991 | }; |
||
5992 | |||
5993 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
||
5994 | Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
||
5995 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
||
5996 | } |
||
5997 | catch (Exception) |
||
5998 | { |
||
5999 | throw; |
||
6000 | } |
||
6001 | } |
||
6002 | |||
6003 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
6004 | { |
||
6005 | try |
||
6006 | { |
||
6007 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
6008 | { |
||
6009 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
6010 | 53880c83 | ljiyeon | DEPARTMENT = Department, |
6011 | NAME = Name, |
||
6012 | IMAGE_URL = Url, |
||
6013 | DATA = Data |
||
6014 | }; |
||
6015 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
6016 | Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
||
6017 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
||
6018 | } |
||
6019 | catch (Exception) |
||
6020 | { |
||
6021 | throw; |
||
6022 | } |
||
6023 | } |
||
6024 | |||
6025 | private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
||
6026 | { |
||
6027 | Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
6028 | DataBind(); |
||
6029 | } |
||
6030 | |||
6031 | private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
||
6032 | { |
||
6033 | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
6034 | DataBind(); |
||
6035 | } |
||
6036 | private void DataBind() |
||
6037 | { |
||
6038 | try |
||
6039 | { |
||
6040 | Symbol_Custom Custom = new Symbol_Custom(); |
||
6041 | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
||
6042 | bb3a236d | ljiyeon | //ServiceDeepView.ServiceDeepViewClient client = new ServiceDeepView.ServiceDeepViewClient(App._binding, App._EndPoint); |
6043 | var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID); |
||
6044 | 53880c83 | ljiyeon | foreach (var item in symbol_Private) |
6045 | { |
||
6046 | Custom.Name = item.NAME; |
||
6047 | Custom.ImageUri = item.IMAGE_URL; |
||
6048 | Custom.ID = item.ID; |
||
6049 | Custom_List.Add(Custom); |
||
6050 | Custom = new Symbol_Custom(); |
||
6051 | } |
||
6052 | symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List; |
||
6053 | |||
6054 | Custom = new Symbol_Custom(); |
||
6055 | Custom_List = new List<Symbol_Custom>(); |
||
6056 | |||
6057 | bb3a236d | ljiyeon | symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList(); |
6058 | 53880c83 | ljiyeon | |
6059 | List<SYMBOL_PUBLIC> symbol_Public; |
||
6060 | 787a4489 | KangIngu | |
6061 | 53880c83 | ljiyeon | if (symbolPanel_Instance.deptlist.SelectedValue != null) |
6062 | { |
||
6063 | bb3a236d | ljiyeon | symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString()); |
6064 | 53880c83 | ljiyeon | } |
6065 | else |
||
6066 | { |
||
6067 | bb3a236d | ljiyeon | symbol_Public = BaseClient.GetPublicSymbolList(null); |
6068 | 53880c83 | ljiyeon | } |
6069 | foreach (var item in symbol_Public) |
||
6070 | { |
||
6071 | Custom.Name = item.NAME; |
||
6072 | Custom.ImageUri = item.IMAGE_URL; |
||
6073 | Custom.ID = item.ID; |
||
6074 | Custom_List.Add(Custom); |
||
6075 | Custom = new Symbol_Custom(); |
||
6076 | } |
||
6077 | symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List; |
||
6078 | bb3a236d | ljiyeon | BaseClient.Close(); |
6079 | 53880c83 | ljiyeon | } |
6080 | catch(Exception e) |
||
6081 | { |
||
6082 | //DialogMessage_Alert("DataBind", "Alert"); |
||
6083 | } |
||
6084 | |||
6085 | } |
||
6086 | 787a4489 | KangIngu | private void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
6087 | { |
||
6088 | c73426a9 | ljiyeon | try |
6089 | 787a4489 | KangIngu | { |
6090 | c73426a9 | ljiyeon | if (args.PromptResult != null) |
6091 | 53880c83 | ljiyeon | { |
6092 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
6093 | { |
||
6094 | PngBitmapEncoder _Encoder = symImage(data); |
||
6095 | 787a4489 | KangIngu | |
6096 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
6097 | _Encoder.Save(fs); |
||
6098 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
6099 | 787a4489 | KangIngu | |
6100 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
6101 | 787a4489 | KangIngu | |
6102 | c73426a9 | ljiyeon | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
6103 | 24678e06 | humkyung | filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte); |
6104 | c73426a9 | ljiyeon | Check_Uri.UriCheck(filename); |
6105 | if (symbolPanel_Instance.RadTab.SelectedIndex == 0) |
||
6106 | { |
||
6107 | de6499db | humkyung | SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data); |
6108 | c73426a9 | ljiyeon | } |
6109 | else |
||
6110 | { |
||
6111 | de6499db | humkyung | SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
6112 | c73426a9 | ljiyeon | } |
6113 | DataBind(); |
||
6114 | 53880c83 | ljiyeon | } |
6115 | } |
||
6116 | 787a4489 | KangIngu | } |
6117 | c73426a9 | ljiyeon | catch(Exception ex) |
6118 | { |
||
6119 | DialogMessage_Alert("" + ex, "Alert"); |
||
6120 | } |
||
6121 | 787a4489 | KangIngu | } |
6122 | |||
6123 | public PngBitmapEncoder symImage(string data) |
||
6124 | { |
||
6125 | |||
6126 | Canvas _canvas = new Canvas(); |
||
6127 | _canvas.Background = Brushes.White; |
||
6128 | _canvas.Width = adorner_.BorderSize.Width; |
||
6129 | _canvas.Height = adorner_.BorderSize.Height; |
||
6130 | 5529d2a2 | humkyung | MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", ""); |
6131 | 787a4489 | KangIngu | |
6132 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
6133 | |||
6134 | |||
6135 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
6136 | |||
6137 | DrawingVisual dv = new DrawingVisual(); |
||
6138 | |||
6139 | _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50)); |
||
6140 | _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))); |
||
6141 | |||
6142 | using (DrawingContext ctx = dv.RenderOpen()) |
||
6143 | { |
||
6144 | VisualBrush vb = new VisualBrush(_canvas); |
||
6145 | 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))); |
||
6146 | } |
||
6147 | |||
6148 | try |
||
6149 | { |
||
6150 | renderBitmap.Render(dv); |
||
6151 | |||
6152 | 90e7968d | ljiyeon | //GC.Collect(); |
6153 | 787a4489 | KangIngu | GC.WaitForPendingFinalizers(); |
6154 | 90e7968d | ljiyeon | //GC.Collect(); |
6155 | 787a4489 | KangIngu | // encode png data |
6156 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
6157 | // puch rendered bitmap into it |
||
6158 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
6159 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
6160 | return pngEncoder; |
||
6161 | |||
6162 | } |
||
6163 | 53880c83 | ljiyeon | catch //(Exception ex) |
6164 | 787a4489 | KangIngu | { |
6165 | return null; |
||
6166 | } |
||
6167 | |||
6168 | } |
||
6169 | |||
6170 | public void DialogMessage_Alert(string content, string header) |
||
6171 | { |
||
6172 | var box = new TextBlock(); |
||
6173 | box.MinWidth = 400; |
||
6174 | box.FontSize = 11; |
||
6175 | //box.FontSize = 12; |
||
6176 | box.Text = content; |
||
6177 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
6178 | |||
6179 | DialogParameters parameters = new DialogParameters() |
||
6180 | { |
||
6181 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
6182 | 787a4489 | KangIngu | Content = box, |
6183 | Header = header, |
||
6184 | Theme = new VisualStudio2013Theme(), |
||
6185 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
6186 | 90e7968d | ljiyeon | }; |
6187 | 787a4489 | KangIngu | RadWindow.Alert(parameters); |
6188 | } |
||
6189 | |||
6190 | #region 캡쳐 기능 |
||
6191 | |||
6192 | public BitmapSource CutAreaToImage(int x, int y, int width, int height) |
||
6193 | { |
||
6194 | if (x < 0) |
||
6195 | { |
||
6196 | width += x; |
||
6197 | x = 0; |
||
6198 | } |
||
6199 | if (y < 0) |
||
6200 | { |
||
6201 | height += y; |
||
6202 | y = 0; |
||
6203 | |||
6204 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
6205 | } |
||
6206 | if (x + width > zoomAndPanCanvas.ActualWidth) |
||
6207 | { |
||
6208 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
6209 | } |
||
6210 | if (y + height > zoomAndPanCanvas.ActualHeight) |
||
6211 | { |
||
6212 | height = (int)zoomAndPanCanvas.ActualHeight - y; |
||
6213 | } |
||
6214 | |||
6215 | byte[] pixels = CopyPixels(x, y, width, height); |
||
6216 | |||
6217 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
6218 | |||
6219 | return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride); |
||
6220 | } |
||
6221 | |||
6222 | public byte[] CopyPixels(int x, int y, int width, int height) |
||
6223 | { |
||
6224 | byte[] pixels = new byte[width * height * 4]; |
||
6225 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
6226 | |||
6227 | // Canvas 이미지에서 객체 역역만큼 픽셀로 복사 |
||
6228 | canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0); |
||
6229 | |||
6230 | return pixels; |
||
6231 | } |
||
6232 | |||
6233 | public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element) |
||
6234 | { |
||
6235 | DrawingVisual drawingVisual = new DrawingVisual(); |
||
6236 | DrawingContext drawingContext = drawingVisual.RenderOpen(); |
||
6237 | |||
6238 | // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다. |
||
6239 | drawingContext.DrawRectangle(new VisualBrush(element), null, |
||
6240 | new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight))); |
||
6241 | drawingContext.Close(); |
||
6242 | |||
6243 | // 비트맵으로 변환합니다. |
||
6244 | RenderTargetBitmap target = |
||
6245 | new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, |
||
6246 | 96, 96, System.Windows.Media.PixelFormats.Pbgra32); |
||
6247 | |||
6248 | target.Render(drawingVisual); |
||
6249 | return target; |
||
6250 | } |
||
6251 | |||
6252 | 53880c83 | ljiyeon | System.Drawing.Bitmap GetBitmap(BitmapSource source) |
6253 | { |
||
6254 | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
||
6255 | 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); |
||
6256 | source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride); |
||
6257 | bmp.UnlockBits(data); |
||
6258 | return bmp; |
||
6259 | } |
||
6260 | public string symbolname = null; |
||
6261 | public bool symbolsvg = true; |
||
6262 | public bool symbolpng = true; |
||
6263 | |||
6264 | public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height) |
||
6265 | { |
||
6266 | System.Drawing.Bitmap image = GetBitmap(source); |
||
6267 | //흰색 제거 |
||
6268 | //image.MakeTransparent(System.Drawing.Color.White); |
||
6269 | |||
6270 | var imageStream = new System.IO.MemoryStream(); |
||
6271 | byte[] imageBytes = null; |
||
6272 | using (imageStream) |
||
6273 | { |
||
6274 | image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png); |
||
6275 | // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png); |
||
6276 | imageStream.Position = 0; |
||
6277 | imageBytes = imageStream.ToArray(); |
||
6278 | } |
||
6279 | |||
6280 | SymbolPrompt symbolPrompt = new SymbolPrompt(); |
||
6281 | |||
6282 | RadWindow CheckPop = new RadWindow(); |
||
6283 | //Alert check = new Alert(Msg); |
||
6284 | |||
6285 | CheckPop = new RadWindow |
||
6286 | { |
||
6287 | MinWidth = 400, |
||
6288 | MinHeight = 100, |
||
6289 | // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
6290 | Header = "Alert", |
||
6291 | Content = symbolPrompt, |
||
6292 | //DialogResult = |
||
6293 | ResizeMode = System.Windows.ResizeMode.NoResize, |
||
6294 | WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, |
||
6295 | IsTopmost = true, |
||
6296 | }; |
||
6297 | CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args); |
||
6298 | StyleManager.SetTheme(CheckPop, new Office2013Theme()); |
||
6299 | CheckPop.ShowDialog(); |
||
6300 | |||
6301 | /* |
||
6302 | DialogParameters parameters = new DialogParameters() |
||
6303 | { |
||
6304 | Owner = Application.Current.MainWindow, |
||
6305 | Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
6306 | DefaultPromptResultValue = "Custom State", |
||
6307 | Content = "Name :", |
||
6308 | Header = "Insert Custom Symbol Name", |
||
6309 | Theme = new VisualStudio2013Theme(), |
||
6310 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
6311 | }; |
||
6312 | RadWindow.Prompt(parameters); |
||
6313 | */ |
||
6314 | } |
||
6315 | |||
6316 | 787a4489 | KangIngu | public void Save_Capture(BitmapSource source, int x, int y, int width, int height) |
6317 | { |
||
6318 | KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64(); |
||
6319 | KCOMDataModel.DataModel.CHECK_LIST check_; |
||
6320 | string Result = streamToBase64.ImageToBase64(source); |
||
6321 | KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST(); |
||
6322 | 6c781c0c | djkim | string projectno = App.ViewInfo.ProjectNO; |
6323 | string checklist_id = ViewerDataModel.Instance.CheckList_ID; |
||
6324 | 0f065e57 | ljiyeon | |
6325 | Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1); |
||
6326 | 6c781c0c | djkim | Item = this.BaseClient.GetCheckList(projectno, checklist_id); |
6327 | 90e7968d | ljiyeon | if (Item != null) |
6328 | 0f065e57 | ljiyeon | { |
6329 | Logger.sendResLog("GetCheckList", "TRUE", 1); |
||
6330 | } |
||
6331 | else |
||
6332 | { |
||
6333 | Logger.sendResLog("GetCheckList", "FALSE", 1); |
||
6334 | } |
||
6335 | 90e7968d | ljiyeon | |
6336 | 6c781c0c | djkim | if (Item == null) |
6337 | 787a4489 | KangIngu | { |
6338 | 6c781c0c | djkim | check_ = new KCOMDataModel.DataModel.CHECK_LIST |
6339 | 787a4489 | KangIngu | { |
6340 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
6341 | 6c781c0c | djkim | USER_ID = App.ViewInfo.UserID, |
6342 | IMAGE_URL = Result, |
||
6343 | IMAGE_ANCHOR = x + "," + y + "," + width + "," + height, |
||
6344 | PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber, |
||
6345 | REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, |
||
6346 | DOCUMENT_ID = App.ViewInfo.DocumentItemID, |
||
6347 | PROJECT_NO = App.ViewInfo.ProjectNO, |
||
6348 | STATUS = "False", |
||
6349 | CREATE_TIME = DateTime.Now, |
||
6350 | UPDATE_TIME = DateTime.Now, |
||
6351 | DOCUMENT_NO = _DocItem.DOCUMENT_NO, |
||
6352 | STATUS_DESC_OPEN = "Vendor 반영 필요", |
||
6353 | }; |
||
6354 | 0f065e57 | ljiyeon | Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1); |
6355 | Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1); |
||
6356 | //this.BaseClient.AddCheckList(projectno, check_); |
||
6357 | 787a4489 | KangIngu | } |
6358 | 6c781c0c | djkim | else |
6359 | { |
||
6360 | Item.IMAGE_URL = Result; |
||
6361 | Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height; |
||
6362 | 90e7968d | ljiyeon | Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber; |
6363 | 0f065e57 | ljiyeon | Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1); |
6364 | Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1); |
||
6365 | //this.BaseClient.SaveCheckList(projectno, checklist_id, Item); |
||
6366 | 6c781c0c | djkim | } |
6367 | 90e7968d | ljiyeon | |
6368 | 787a4489 | KangIngu | } |
6369 | |||
6370 | public void Set_Capture() |
||
6371 | 90e7968d | ljiyeon | { |
6372 | 787a4489 | KangIngu | double x = canvasDrawingMouseDownPoint.X; |
6373 | double y = canvasDrawingMouseDownPoint.Y; |
||
6374 | double width = dragCaptureBorder.Width; |
||
6375 | double height = dragCaptureBorder.Height; |
||
6376 | |||
6377 | if (width > 5 || height > 5) |
||
6378 | { |
||
6379 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
6380 | BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height); |
||
6381 | Save_Capture(source, (int)x, (int)y, (int)width, (int)height); |
||
6382 | } |
||
6383 | } |
||
6384 | #endregion |
||
6385 | |||
6386 | d7548b21 | ljiyeon | //MarkupInfoItem |
6387 | 787a4489 | KangIngu | public void CreateControl() |
6388 | 90e7968d | ljiyeon | { |
6389 | |||
6390 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
6391 | { |
||
6392 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
6393 | }); |
||
6394 | multi_Undo_Data.Markup = currentControl; |
||
6395 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
6396 | 90e7968d | ljiyeon | |
6397 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
6398 | d7548b21 | ljiyeon | |
6399 | //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
6400 | 787a4489 | KangIngu | } |
6401 | 90e7968d | ljiyeon | |
6402 | 787a4489 | KangIngu | public Multi_Undo_data Control_Style(CommentUserInfo control) |
6403 | { |
||
6404 | multi_Undo_Data = new Multi_Undo_data(); |
||
6405 | |||
6406 | multi_Undo_Data.Markup = control; |
||
6407 | |||
6408 | if ((control as IShapeControl) != null) |
||
6409 | { |
||
6410 | multi_Undo_Data.paint = (control as IShapeControl).Paint; |
||
6411 | } |
||
6412 | if ((control as IDashControl) != null) |
||
6413 | { |
||
6414 | multi_Undo_Data.DashSize = (control as IDashControl).DashSize; |
||
6415 | } |
||
6416 | if ((control as IPath) != null) |
||
6417 | { |
||
6418 | multi_Undo_Data.LineSize = (control as IPath).LineSize; |
||
6419 | } |
||
6420 | if ((control as UIElement) != null) |
||
6421 | { |
||
6422 | multi_Undo_Data.Opacity = (control as UIElement).Opacity; |
||
6423 | } |
||
6424 | |||
6425 | return multi_Undo_Data; |
||
6426 | } |
||
6427 | |||
6428 | public void Undo() |
||
6429 | { |
||
6430 | 90e7968d | ljiyeon | // if (ViewerDataModel.Instance.IsPressCtrl) |
6431 | // { |
||
6432 | // ViewerDataModel.Instance.IsPressCtrl = false; |
||
6433 | // } |
||
6434 | 787a4489 | KangIngu | Undo_data undo = new Undo_data(); |
6435 | AdornerFinal final; |
||
6436 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
6437 | 787a4489 | KangIngu | |
6438 | undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault(); |
||
6439 | if (undo == null) |
||
6440 | return; |
||
6441 | |||
6442 | 90e7968d | ljiyeon | |
6443 | d7548b21 | ljiyeon | |
6444 | 787a4489 | KangIngu | switch (undo.Event) |
6445 | { |
||
6446 | case (Event_Type.Create): |
||
6447 | { |
||
6448 | foreach (var item in undo.Markup_List) |
||
6449 | { |
||
6450 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
6451 | } |
||
6452 | } |
||
6453 | break; |
||
6454 | case (Event_Type.Delete): |
||
6455 | { |
||
6456 | foreach (var item in undo.Markup_List) |
||
6457 | { |
||
6458 | ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
||
6459 | } |
||
6460 | } |
||
6461 | break; |
||
6462 | case (Event_Type.Thumb): |
||
6463 | { |
||
6464 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6465 | |||
6466 | foreach (var item in undo.Markup_List) |
||
6467 | { |
||
6468 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
6469 | |||
6470 | if ((item.Markup as IViewBox) != null) |
||
6471 | { |
||
6472 | (item.Markup as IViewBox).Angle = item.Angle; |
||
6473 | } |
||
6474 | if ((item.Markup as TextControl) != null) |
||
6475 | { |
||
6476 | (item.Markup as TextControl).Angle = item.Angle; |
||
6477 | Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
||
6478 | Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
||
6479 | } |
||
6480 | else |
||
6481 | { |
||
6482 | (item.Markup as IPath).PointSet = item.PointSet; |
||
6483 | (item.Markup as IPath).updateControl(); |
||
6484 | } |
||
6485 | |||
6486 | comment.Add(item.Markup); |
||
6487 | } |
||
6488 | final = new AdornerFinal(comment); |
||
6489 | SelectLayer.Children.Add(final); |
||
6490 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
6491 | 787a4489 | KangIngu | } |
6492 | break; |
||
6493 | case (Event_Type.Select): |
||
6494 | { |
||
6495 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
6496 | 787a4489 | KangIngu | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
6497 | |||
6498 | foreach (var item in undo.Markup_List) |
||
6499 | { |
||
6500 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
6501 | |||
6502 | if ((item.Markup as IPath) != null) |
||
6503 | { |
||
6504 | (item.Markup as IPath).LineSize = item.LineSize; |
||
6505 | } |
||
6506 | if ((item.Markup as UIElement) != null) |
||
6507 | { |
||
6508 | (item.Markup as UIElement).Opacity = item.Opacity; |
||
6509 | } |
||
6510 | if ((item.Markup as IDashControl) != null) |
||
6511 | { |
||
6512 | (item.Markup as IDashControl).DashSize = item.DashSize; |
||
6513 | } |
||
6514 | if ((item.Markup as IShapeControl) != null) |
||
6515 | { |
||
6516 | (item.Markup as IShapeControl).Paint = item.paint; |
||
6517 | } |
||
6518 | |||
6519 | comment.Add(item.Markup); |
||
6520 | } |
||
6521 | |||
6522 | final = new AdornerFinal(comment); |
||
6523 | SelectLayer.Children.Add(final); |
||
6524 | } |
||
6525 | break; |
||
6526 | case (Event_Type.Option): |
||
6527 | { |
||
6528 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6529 | |||
6530 | foreach (var item in undo.Markup_List) |
||
6531 | { |
||
6532 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6533 | |||
6534 | if (undo.LineSize != 0 && item.Markup as IPath != null) |
||
6535 | { |
||
6536 | (item.Markup as IPath).LineSize = undo.LineSize; |
||
6537 | } |
||
6538 | else if (undo.Opacity != 0 && item.Markup as UIElement != null) |
||
6539 | { |
||
6540 | (item.Markup as UIElement).Opacity = undo.Opacity; |
||
6541 | } |
||
6542 | else if (undo.DashSize != null && item.Markup as IDashControl != null) |
||
6543 | { |
||
6544 | (item.Markup as IDashControl).DashSize = undo.DashSize; |
||
6545 | } |
||
6546 | 5ce56a3a | KangIngu | else if (undo.Interval != 0 && item.Markup as LineControl != null) |
6547 | { |
||
6548 | (item.Markup as LineControl).Interval = undo.Interval; |
||
6549 | } |
||
6550 | 787a4489 | KangIngu | else if (item.Markup as IShapeControl != null) |
6551 | { |
||
6552 | (item.Markup as IShapeControl).Paint = undo.paint; |
||
6553 | } |
||
6554 | comment.Add(item.Markup); |
||
6555 | } |
||
6556 | final = new AdornerFinal(comment); |
||
6557 | SelectLayer.Children.Add(final); |
||
6558 | } |
||
6559 | break; |
||
6560 | } |
||
6561 | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
6562 | 90e7968d | ljiyeon | { |
6563 | i.IsUndo = true; |
||
6564 | }); |
||
6565 | 787a4489 | KangIngu | } |
6566 | |||
6567 | 6707a5c7 | ljiyeon | |
6568 | 90e7968d | ljiyeon | |
6569 | 787a4489 | KangIngu | public void Redo() |
6570 | { |
||
6571 | 75448f5e | ljiyeon | //if (ViewerDataModel.Instance.IsPressCtrl) |
6572 | //{ |
||
6573 | // ViewerDataModel.Instance.IsPressCtrl = false; |
||
6574 | //} |
||
6575 | 787a4489 | KangIngu | AdornerFinal final; |
6576 | Undo_data redo = new Undo_data(); |
||
6577 | redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault(); |
||
6578 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
6579 | 787a4489 | KangIngu | if (redo == null) |
6580 | return; |
||
6581 | |||
6582 | switch (redo.Event) |
||
6583 | { |
||
6584 | case (Event_Type.Create): |
||
6585 | { |
||
6586 | foreach (var item in redo.Markup_List) |
||
6587 | { |
||
6588 | ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
||
6589 | 6707a5c7 | ljiyeon | //temp.AddTemp(redo, pageNavigator.CurrentPage.PageNumber, 0, 0); |
6590 | 787a4489 | KangIngu | } |
6591 | } |
||
6592 | break; |
||
6593 | case (Event_Type.Delete): |
||
6594 | { |
||
6595 | foreach (var item in redo.Markup_List) |
||
6596 | { |
||
6597 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6598 | } |
||
6599 | } |
||
6600 | break; |
||
6601 | case (Event_Type.Thumb): |
||
6602 | { |
||
6603 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6604 | |||
6605 | foreach (var item in redo.Markup_List) |
||
6606 | { |
||
6607 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo)); |
||
6608 | |||
6609 | if ((item.Markup as IViewBox) != null) |
||
6610 | { |
||
6611 | (item.Markup as IViewBox).Angle = item.Angle; |
||
6612 | } |
||
6613 | if ((item.Markup as TextControl) != null) |
||
6614 | { |
||
6615 | (item.Markup as TextControl).Angle = item.Angle; |
||
6616 | |||
6617 | Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
||
6618 | Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
||
6619 | } |
||
6620 | else |
||
6621 | { |
||
6622 | (item.Markup as IPath).PointSet = item.PointSet; |
||
6623 | (item.Markup as IPath).updateControl(); |
||
6624 | } |
||
6625 | comment.Add(item.Markup); |
||
6626 | } |
||
6627 | final = new AdornerFinal(comment); |
||
6628 | SelectLayer.Children.Add(final); |
||
6629 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
6630 | 787a4489 | KangIngu | } |
6631 | break; |
||
6632 | case (Event_Type.Select): |
||
6633 | { |
||
6634 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6635 | |||
6636 | foreach (var item in redo.Markup_List) |
||
6637 | { |
||
6638 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6639 | |||
6640 | if ((item.Markup as IPath) != null) |
||
6641 | { |
||
6642 | (item.Markup as IPath).LineSize = item.LineSize; |
||
6643 | } |
||
6644 | if ((item.Markup as UIElement) != null) |
||
6645 | { |
||
6646 | (item.Markup as UIElement).Opacity = item.Opacity; |
||
6647 | } |
||
6648 | if ((item.Markup as IDashControl) != null) |
||
6649 | { |
||
6650 | (item.Markup as IDashControl).DashSize = item.DashSize; |
||
6651 | } |
||
6652 | if ((item.Markup as IShapeControl) != null) |
||
6653 | { |
||
6654 | (item.Markup as IShapeControl).Paint = item.paint; |
||
6655 | } |
||
6656 | |||
6657 | comment.Add(item.Markup); |
||
6658 | } |
||
6659 | final = new AdornerFinal(comment); |
||
6660 | SelectLayer.Children.Add(final); |
||
6661 | } |
||
6662 | break; |
||
6663 | case (Event_Type.Option): |
||
6664 | { |
||
6665 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6666 | |||
6667 | foreach (var item in redo.Markup_List) |
||
6668 | { |
||
6669 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6670 | if (redo.LineSize != 0 && item.Markup as IPath != null) |
||
6671 | { |
||
6672 | (item.Markup as IPath).LineSize = redo.LineSize; |
||
6673 | } |
||
6674 | else if (redo.Opacity != 0 && item.Markup as UIElement != null) |
||
6675 | { |
||
6676 | (item.Markup as UIElement).Opacity = redo.Opacity; |
||
6677 | } |
||
6678 | else if (redo.DashSize != null && item.Markup as IDashControl != null) |
||
6679 | { |
||
6680 | (item.Markup as IDashControl).DashSize = redo.DashSize; |
||
6681 | } |
||
6682 | a1716fa5 | KangIngu | else if (redo.Interval != 0 && item.Markup as LineControl != null) |
6683 | 5ce56a3a | KangIngu | { |
6684 | (item.Markup as LineControl).Interval = redo.Interval; |
||
6685 | } |
||
6686 | 787a4489 | KangIngu | else if (item.Markup as IShapeControl != null) |
6687 | { |
||
6688 | (item.Markup as IShapeControl).Paint = redo.paint; |
||
6689 | } |
||
6690 | comment.Add(item.Markup); |
||
6691 | } |
||
6692 | final = new AdornerFinal(comment); |
||
6693 | SelectLayer.Children.Add(final); |
||
6694 | } |
||
6695 | break; |
||
6696 | } |
||
6697 | |||
6698 | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
6699 | { |
||
6700 | i.IsUndo = false; |
||
6701 | }); |
||
6702 | } |
||
6703 | |||
6704 | private void Comment_Move(object sender, MouseButtonEventArgs e) |
||
6705 | { |
||
6706 | string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID; |
||
6707 | foreach (var items in ViewerDataModel.Instance._markupInfoRevList) |
||
6708 | { |
||
6709 | if (items.UserID == Select_ID) |
||
6710 | { |
||
6711 | foreach (var item in items.MarkupList) |
||
6712 | { |
||
6713 | if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
||
6714 | { |
||
6715 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", |
6716 | 24678e06 | humkyung | items.MarkupInfoID, Commons.shortGuid()); |
6717 | 787a4489 | KangIngu | } |
6718 | } |
||
6719 | } |
||
6720 | } |
||
6721 | } |
||
6722 | 23a96932 | djkim | public void EmptyControlCheck() |
6723 | { |
||
6724 | for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++) |
||
6725 | { |
||
6726 | if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl") |
||
6727 | { |
||
6728 | if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null |
||
6729 | || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "") |
||
6730 | { |
||
6731 | Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j); |
||
6732 | } |
||
6733 | } |
||
6734 | else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl") |
||
6735 | { |
||
6736 | if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null |
||
6737 | || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "") |
||
6738 | { |
||
6739 | Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j); |
||
6740 | } |
||
6741 | } |
||
6742 | } |
||
6743 | } |
||
6744 | 787a4489 | KangIngu | public void InkControl_Convert() |
6745 | { |
||
6746 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1); |
6747 | 787a4489 | KangIngu | if (inkBoard.Strokes.Count > 0) |
6748 | { |
||
6749 | inkBoard.Strokes.ToList().ForEach(stroke => |
||
6750 | { |
||
6751 | List<Stroke> removingStroke = new List<Stroke>(); |
||
6752 | StrokeCollection stC = new StrokeCollection(); |
||
6753 | |||
6754 | removingStroke.Add(stroke); |
||
6755 | |||
6756 | InkToPath ip = new InkToPath(); |
||
6757 | List<Point> inkPointSet = new List<Point>(); |
||
6758 | PolygonControl pc = null; |
||
6759 | pc = new PolygonControl() |
||
6760 | { |
||
6761 | Angle = 0, |
||
6762 | PointSet = new List<Point>(), |
||
6763 | ControlType = ControlType.Ink |
||
6764 | }; |
||
6765 | foreach (var item in removingStroke) |
||
6766 | { |
||
6767 | inkPointSet.AddRange(ip.StrokeGetPointsPlus(item)); |
||
6768 | inkBoard.Strokes.Remove(item); |
||
6769 | } |
||
6770 | if (inkPointSet.Count != 0) |
||
6771 | { |
||
6772 | //강인구 추가(PenControl Undo Redo 추가) |
||
6773 | UndoData = new Undo_data() |
||
6774 | { |
||
6775 | IsUndo = false, |
||
6776 | Event = Event_Type.Create, |
||
6777 | EventTime = DateTime.Now, |
||
6778 | Markup_List = new List<Multi_Undo_data>() |
||
6779 | }; |
||
6780 | |||
6781 | pc.StartPoint = inkPointSet[0]; |
||
6782 | pc.EndPoint = inkPointSet[inkPointSet.Count - 1]; |
||
6783 | pc.PointSet = inkPointSet; |
||
6784 | pc.LineSize = 3; |
||
6785 | 24678e06 | humkyung | pc.CommentID = Commons.shortGuid(); |
6786 | 787a4489 | KangIngu | pc.StrokeColor = new SolidColorBrush(Colors.Red); |
6787 | ViewerDataModel.Instance.MarkupControls_USER.Add(pc); |
||
6788 | 661b7416 | humkyung | ///pc.SetPolyPath(); |
6789 | 787a4489 | KangIngu | |
6790 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
6791 | { |
||
6792 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
6793 | }); |
||
6794 | multi_Undo_Data.Markup = pc as CommentUserInfo; |
||
6795 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
6796 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
6797 | } |
||
6798 | }); |
||
6799 | } |
||
6800 | } |
||
6801 | 17a22987 | KangIngu | |
6802 | 4318fdeb | KangIngu | /// <summary> |
6803 | /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산 |
||
6804 | /// </summary> |
||
6805 | /// <param name="StartP">StartPoint</param> |
||
6806 | /// <param name="EndP">EndPoint</param> |
||
6807 | /// <returns>Return_EndPoint</returns> |
||
6808 | private Point GetSquareEndPoint(Point StartP, Point EndP) |
||
6809 | 17a22987 | KangIngu | { |
6810 | ae56d52d | KangIngu | Point Return_Point = new Point(); |
6811 | 17a22987 | KangIngu | |
6812 | 4318fdeb | KangIngu | double dx = EndP.X - StartP.X; |
6813 | double dy = EndP.Y - StartP.Y; |
||
6814 | double length; |
||
6815 | 17a22987 | KangIngu | |
6816 | 4318fdeb | KangIngu | switch (controlType) |
6817 | { |
||
6818 | case ControlType.Triangle: |
||
6819 | { |
||
6820 | //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요 |
||
6821 | length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy)); |
||
6822 | Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length); |
||
6823 | } |
||
6824 | break; |
||
6825 | default: |
||
6826 | { |
||
6827 | length = Math.Max(Math.Abs(dx), Math.Abs(dy)); |
||
6828 | Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length; |
||
6829 | Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length; |
||
6830 | } |
||
6831 | break; |
||
6832 | } |
||
6833 | 17a22987 | KangIngu | |
6834 | return Return_Point; |
||
6835 | } |
||
6836 | e753423e | humkyung | |
6837 | /// <summary> |
||
6838 | /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌 |
||
6839 | /// </summary> |
||
6840 | /// <author>humkyung</author> |
||
6841 | /// <date>2018.04.26</date> |
||
6842 | /// <param name="StartP"></param> |
||
6843 | /// <param name="EndP"></param> |
||
6844 | /// <returns></returns> |
||
6845 | 32e95118 | KangIngu | /// <history>humkyung 2018.05.11 apply axis lock</history> |
6846 | e54660e8 | KangIngu | private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false) |
6847 | e753423e | humkyung | { |
6848 | List<Point> res = new List<Point>(); |
||
6849 | |||
6850 | double dx = EndP.X - StartP.X; |
||
6851 | double dy = EndP.Y - StartP.Y; |
||
6852 | double length = Math.Sqrt(dx * dx + dy * dy); |
||
6853 | e54660e8 | KangIngu | double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0); |
6854 | e753423e | humkyung | dx /= length; |
6855 | dy /= length; |
||
6856 | double tmp = dx; |
||
6857 | dx = -dy; dy = tmp; /// rotate by 90 degree |
||
6858 | |||
6859 | res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength)); |
||
6860 | res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength)); |
||
6861 | |||
6862 | return res; |
||
6863 | } |
||
6864 | a1716fa5 | KangIngu | |
6865 | e66f22eb | KangIngu | /// <summary> |
6866 | /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌 |
||
6867 | /// </summary> |
||
6868 | /// <author>ingu</author> |
||
6869 | /// <date>2018.06.05</date> |
||
6870 | /// <param name="getPoint"></param> |
||
6871 | /// <returns></returns> |
||
6872 | private bool IsGetoutpoint(Point getPoint) |
||
6873 | 670a4be2 | humkyung | { |
6874 | e66f22eb | KangIngu | if (getPoint == new Point()) |
6875 | 670a4be2 | humkyung | { |
6876 | e66f22eb | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl); |
6877 | currentControl = null; |
||
6878 | return true; |
||
6879 | 670a4be2 | humkyung | } |
6880 | |||
6881 | e66f22eb | KangIngu | return false; |
6882 | 670a4be2 | humkyung | } |
6883 | e66f22eb | KangIngu | |
6884 | 5b46312f | djkim | private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
6885 | { |
||
6886 | e.Effects = DragDropEffects.Copy; |
||
6887 | } |
||
6888 | |||
6889 | private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
||
6890 | { |
||
6891 | e.Effects = DragDropEffects.Copy; |
||
6892 | } |
||
6893 | |||
6894 | private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
||
6895 | { |
||
6896 | e.Effects = DragDropEffects.None; |
||
6897 | } |
||
6898 | |||
6899 | private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
||
6900 | { |
||
6901 | 90e7968d | ljiyeon | try |
6902 | 5b46312f | djkim | { |
6903 | 90e7968d | ljiyeon | if (e.Data.GetDataPresent(typeof(string))) |
6904 | { |
||
6905 | this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
6906 | string dragData = e.Data.GetData(typeof(string)) as string; |
||
6907 | Move_Symbol(sender, dragData); |
||
6908 | } |
||
6909 | 5b46312f | djkim | } |
6910 | 90e7968d | ljiyeon | catch (Exception ex) |
6911 | { |
||
6912 | Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0); |
||
6913 | } |
||
6914 | 5b46312f | djkim | } |
6915 | |||
6916 | private void Move_Symbol(object sender, string dragData) |
||
6917 | { |
||
6918 | 90e7968d | ljiyeon | try |
6919 | 5b46312f | djkim | { |
6920 | 90e7968d | ljiyeon | if (dragData.Contains("|DZ|")) |
6921 | { |
||
6922 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
6923 | 5b46312f | djkim | |
6924 | 90e7968d | ljiyeon | string[] delimiterChars = { "|DZ|" }; |
6925 | string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
6926 | 5b46312f | djkim | |
6927 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu); |
6928 | 5b46312f | djkim | |
6929 | 90e7968d | ljiyeon | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
6930 | 5b46312f | djkim | |
6931 | 90e7968d | ljiyeon | //강인구 Undo/Redo 보류 |
6932 | UndoData = new Undo_data() |
||
6933 | { |
||
6934 | IsUndo = false, |
||
6935 | Event = Event_Type.Create, |
||
6936 | EventTime = DateTime.Now, |
||
6937 | Markup_List = new List<Multi_Undo_data>() |
||
6938 | }; |
||
6939 | 5b46312f | djkim | |
6940 | 90e7968d | ljiyeon | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
6941 | { |
||
6942 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
6943 | }); |
||
6944 | 5b46312f | djkim | |
6945 | 90e7968d | ljiyeon | foreach (string parse in data) |
6946 | 5b46312f | djkim | { |
6947 | 90e7968d | ljiyeon | if (parse != "") |
6948 | { |
||
6949 | 5529d2a2 | humkyung | System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty); |
6950 | 24678e06 | humkyung | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Commons.shortGuid(); |
6951 | 5b46312f | djkim | |
6952 | 90e7968d | ljiyeon | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
6953 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
6954 | 5b46312f | djkim | |
6955 | 90e7968d | ljiyeon | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
6956 | 5b46312f | djkim | |
6957 | 90e7968d | ljiyeon | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
6958 | 5b46312f | djkim | |
6959 | 90e7968d | ljiyeon | UndoData.Markup_List.Add(multi_Undo_Data); |
6960 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
6961 | } |
||
6962 | 5b46312f | djkim | } |
6963 | 90e7968d | ljiyeon | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
6964 | 5b46312f | djkim | |
6965 | 90e7968d | ljiyeon | /// move symbol to current mouse point |
6966 | double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
6967 | double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
6968 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
6969 | 5b46312f | djkim | |
6970 | 90e7968d | ljiyeon | if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
6971 | { |
||
6972 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
6973 | } |
||
6974 | /// up to here |
||
6975 | 6707a5c7 | ljiyeon | |
6976 | 90e7968d | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
6977 | } |
||
6978 | 5b46312f | djkim | } |
6979 | 90e7968d | ljiyeon | catch (Exception ex) |
6980 | { |
||
6981 | Logger.sendResLog("Move_Symbol", ex.ToString(), 0); |
||
6982 | } |
||
6983 | } |
||
6984 | 787a4489 | KangIngu | } |
6985 | 5a6a5dd1 | humkyung | } |