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