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