markus / KCOM / Views / MainMenu.xaml.cs @ 7a5210f1
이력 | 보기 | 이력해설 | 다운로드 (249 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 | cbaa3c91 | ljiyeon | var control = currentControl as SymControlN; |
1446 | if(control.STAMP != null) |
||
1447 | 787a4489 | KangIngu | { |
1448 | cbaa3c91 | ljiyeon | if (control != null) |
1449 | { |
||
1450 | control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
||
1451 | } |
||
1452 | } |
||
1453 | else |
||
1454 | { |
||
1455 | currentControl = null; |
||
1456 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
1457 | MessageBox.Show("Approved Stamp 가 등록되어 있지 않습니다. \n관리자에게 문의하세요.", "MARKUS"); |
||
1458 | //DialogMessage_Alert("aa", "Error"); |
||
1459 | 787a4489 | KangIngu | } |
1460 | } |
||
1461 | break; |
||
1462 | a6272c57 | humkyung | case ControlType.Rectangle: |
1463 | 787a4489 | KangIngu | case ControlType.Mark: |
1464 | { |
||
1465 | var control = currentControl as RectangleControl; |
||
1466 | if (control != null) |
||
1467 | { |
||
1468 | a6272c57 | humkyung | control.OnCreatingMouseMove(currentCanvasDrawingMouseMovePoint, ViewerDataModel.Instance.checkAxis, ViewerDataModel.Instance.IsPressShift); |
1469 | if(control.ControlType == ControlType.Mark) control.Paint = PaintSet.Fill; |
||
1470 | 7a5210f1 | humkyung | control.DashSize = ViewerDataModel.Instance.DashSize; |
1471 | 787a4489 | KangIngu | } |
1472 | } |
||
1473 | break; |
||
1474 | case ControlType.PenControl: |
||
1475 | { |
||
1476 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
1477 | //inkBoard.Strokes.Add(stroke); |
||
1478 | } |
||
1479 | break; |
||
1480 | default: |
||
1481 | break; |
||
1482 | } |
||
1483 | } |
||
1484 | } |
||
1485 | 29cf2c0c | humkyung | else if(mouseHandlingMode == MouseHandlingMode.Drawing && e.LeftButton == MouseButtonState.Pressed) |
1486 | { |
||
1487 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1488 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1489 | SetCursor(); |
||
1490 | if (currentControl == null) |
||
1491 | { |
||
1492 | switch (controlType) |
||
1493 | { |
||
1494 | case ControlType.PenControl: |
||
1495 | { |
||
1496 | if (inkBoard.Tag.ToString() == "Ink") |
||
1497 | { |
||
1498 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
1499 | } |
||
1500 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
1501 | { |
||
1502 | RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
||
1503 | } |
||
1504 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
1505 | { |
||
1506 | RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
||
1507 | } |
||
1508 | |||
1509 | //inkBoard.Strokes.Add(stroke); |
||
1510 | } |
||
1511 | break; |
||
1512 | } |
||
1513 | return; |
||
1514 | } |
||
1515 | } |
||
1516 | e6a9ddaf | humkyung | else if (((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Selecting) || |
1517 | ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.Capture) || |
||
1518 | ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragZoom)) |
||
1519 | 787a4489 | KangIngu | { |
1520 | Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
||
1521 | |||
1522 | if (isDraggingSelectionRect) |
||
1523 | { |
||
1524 | UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint); |
||
1525 | e.Handled = true; |
||
1526 | } |
||
1527 | else if (isLeftMouseButtonDownOnWindow) |
||
1528 | { |
||
1529 | var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint; |
||
1530 | double dragDistance = Math.Abs(dragDelta.Length); |
||
1531 | |||
1532 | if (dragDistance > DragThreshold) |
||
1533 | { |
||
1534 | isDraggingSelectionRect = true; |
||
1535 | InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint); |
||
1536 | } |
||
1537 | |||
1538 | e.Handled = true; |
||
1539 | } |
||
1540 | |||
1541 | if (canvasDrawingMouseDownPoint == curMouseDownPoint) |
||
1542 | { |
||
1543 | } |
||
1544 | else |
||
1545 | { |
||
1546 | e.Handled = true; |
||
1547 | } |
||
1548 | } |
||
1549 | 7211e0c2 | ljiyeon | /* |
1550 | e6a9ddaf | humkyung | else if ((e.LeftButton == MouseButtonState.Pressed) && mouseHandlingMode == MouseHandlingMode.DragSymbol) |
1551 | 53880c83 | ljiyeon | { //symbol |
1552 | if(_dragdropWindow != null) |
||
1553 | { |
||
1554 | Win32Point w32Mouse = new Win32Point(); |
||
1555 | GetCursorPos(ref w32Mouse); |
||
1556 | |||
1557 | this._dragdropWindow.Left = w32Mouse.X - (symbol_img.Width / 2); |
||
1558 | this._dragdropWindow.Top = w32Mouse.Y - (symbol_img.Height / 2); |
||
1559 | } |
||
1560 | } |
||
1561 | 7211e0c2 | ljiyeon | */ |
1562 | e6a9ddaf | humkyung | else if ((e.LeftButton == MouseButtonState.Released) && (e.MiddleButton == MouseButtonState.Released) && |
1563 | (e.RightButton == MouseButtonState.Released) && ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
1564 | 787a4489 | KangIngu | { |
1565 | 05009a0e | ljiyeon | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
1566 | e6a9ddaf | humkyung | if(control != null) |
1567 | 787a4489 | KangIngu | { |
1568 | this.cursor = Cursors.Hand; |
||
1569 | SetCursor(); |
||
1570 | } |
||
1571 | else |
||
1572 | { |
||
1573 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1574 | 787a4489 | KangIngu | SetCursor(); |
1575 | } |
||
1576 | } |
||
1577 | else |
||
1578 | { |
||
1579 | } |
||
1580 | } |
||
1581 | |||
1582 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e) |
1583 | { |
||
1584 | e6a9ddaf | humkyung | if ((e.MiddleButton == MouseButtonState.Pressed) || (e.RightButton == MouseButtonState.Pressed)) |
1585 | a1716fa5 | KangIngu | { |
1586 | SetCursor(); |
||
1587 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2); |
||
1588 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1589 | |||
1590 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
1591 | |||
1592 | ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X; |
||
1593 | ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y; |
||
1594 | |||
1595 | if (Sync.IsChecked) |
||
1596 | { |
||
1597 | zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX; |
||
1598 | zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY; |
||
1599 | } |
||
1600 | } |
||
1601 | } |
||
1602 | |||
1603 | 787a4489 | KangIngu | private List<CommentUserInfo> hitList = new List<CommentUserInfo>(); |
1604 | |||
1605 | private EllipseGeometry hitArea = new EllipseGeometry(); |
||
1606 | |||
1607 | private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e) |
||
1608 | { |
||
1609 | IsDrawing = false; |
||
1610 | |||
1611 | if (mouseHandlingMode != MouseHandlingMode.None) |
||
1612 | { |
||
1613 | if (mouseHandlingMode == MouseHandlingMode.Drawing) |
||
1614 | { |
||
1615 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1616 | 787a4489 | KangIngu | |
1617 | SetCursor(); |
||
1618 | |||
1619 | switch (controlType) |
||
1620 | { |
||
1621 | case ControlType.None: |
||
1622 | break; |
||
1623 | case ControlType.Rectangle: |
||
1624 | { |
||
1625 | |||
1626 | } |
||
1627 | break; |
||
1628 | case ControlType.PenControl: |
||
1629 | { |
||
1630 | |||
1631 | } |
||
1632 | break; |
||
1633 | default: |
||
1634 | break; |
||
1635 | 4eb052e4 | ljiyeon | } |
1636 | 787a4489 | KangIngu | } |
1637 | 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) |
1638 | 787a4489 | KangIngu | { |
1639 | if (isLeftMouseButtonDownOnWindow) |
||
1640 | { |
||
1641 | bool wasDragSelectionApplied = false; |
||
1642 | |||
1643 | if (isDraggingSelectionRect) |
||
1644 | { |
||
1645 | 53880c83 | ljiyeon | if (mouseHandlingMode == MouseHandlingMode.Capture && controlType == ControlType.ImgControl) |
1646 | { |
||
1647 | dragCaptureBorder.Visibility = Visibility.Collapsed; |
||
1648 | mouseHandlingMode = MouseHandlingMode.None; |
||
1649 | Point endPoint = e.GetPosition(zoomAndPanCanvas); |
||
1650 | symbolselectindex = symbolPanel_Instance.RadTab.SelectedIndex; |
||
1651 | Set_Symbol_Capture(endPoint); |
||
1652 | ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
||
1653 | ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
||
1654 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
1655 | } |
||
1656 | else if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
1657 | 787a4489 | KangIngu | { |
1658 | dragCaptureBorder.Visibility = Visibility.Collapsed; |
||
1659 | mouseHandlingMode = MouseHandlingMode.None; |
||
1660 | Set_Capture(); |
||
1661 | |||
1662 | ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
||
1663 | ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
||
1664 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
1665 | } |
||
1666 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
1667 | 787a4489 | KangIngu | { |
1668 | ApplyDragSelectionRect(); |
||
1669 | } |
||
1670 | 9f473fb7 | KangIngu | else |
1671 | { |
||
1672 | double x = Canvas.GetLeft(dragZoomBorder); |
||
1673 | double y = Canvas.GetTop(dragZoomBorder); |
||
1674 | double width = dragZoomBorder.Width; |
||
1675 | double height = dragZoomBorder.Height; |
||
1676 | Rect dragRect = new Rect(x, y, width, height); |
||
1677 | |||
1678 | ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect); |
||
1679 | |||
1680 | dragZoomBorder.Visibility = Visibility.Collapsed; |
||
1681 | } |
||
1682 | 787a4489 | KangIngu | |
1683 | 9f473fb7 | KangIngu | isDraggingSelectionRect = false; |
1684 | 787a4489 | KangIngu | e.Handled = true; |
1685 | wasDragSelectionApplied = true; |
||
1686 | } |
||
1687 | |||
1688 | if (isLeftMouseButtonDownOnWindow) |
||
1689 | { |
||
1690 | isLeftMouseButtonDownOnWindow = false; |
||
1691 | this.ReleaseMouseCapture(); |
||
1692 | e.Handled = true; |
||
1693 | } |
||
1694 | |||
1695 | if (!wasDragSelectionApplied) |
||
1696 | { |
||
1697 | init(); |
||
1698 | } |
||
1699 | } |
||
1700 | } |
||
1701 | e6a9ddaf | humkyung | else if (e.RightButton == MouseButtonState.Pressed) |
1702 | 787a4489 | KangIngu | { |
1703 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1704 | 787a4489 | KangIngu | SetCursor(); |
1705 | } |
||
1706 | |||
1707 | zoomAndPanControl.ReleaseMouseCapture(); |
||
1708 | |||
1709 | |||
1710 | e.Handled = true; |
||
1711 | } |
||
1712 | else |
||
1713 | { |
||
1714 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1715 | 787a4489 | KangIngu | SetCursor(); |
1716 | } |
||
1717 | |||
1718 | e6a9ddaf | humkyung | ///mouseButtonDown = MouseButton.Left; |
1719 | 787a4489 | KangIngu | //controlType = ControlType.SingleLine; |
1720 | } |
||
1721 | |||
1722 | 53880c83 | ljiyeon | public void Set_Symbol_Capture(Point endPoint) |
1723 | { |
||
1724 | double x = canvasDrawingMouseDownPoint.X; |
||
1725 | double y = canvasDrawingMouseDownPoint.Y; |
||
1726 | if(x > endPoint.X) |
||
1727 | { |
||
1728 | x = endPoint.X; |
||
1729 | y = endPoint.Y; |
||
1730 | } |
||
1731 | |||
1732 | double width = dragCaptureBorder.Width; |
||
1733 | double height = dragCaptureBorder.Height; |
||
1734 | |||
1735 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
1736 | |||
1737 | if (x < 0) |
||
1738 | { |
||
1739 | width += x; |
||
1740 | x = 0; |
||
1741 | } |
||
1742 | if (y < 0) |
||
1743 | { |
||
1744 | height += y; |
||
1745 | y = 0; |
||
1746 | |||
1747 | width = (int)canvasImage.PixelWidth - x; |
||
1748 | } |
||
1749 | if (x + width > canvasImage.PixelWidth) |
||
1750 | { |
||
1751 | width = (int)canvasImage.PixelWidth - x; |
||
1752 | } |
||
1753 | if (y + height > canvasImage.PixelHeight) |
||
1754 | { |
||
1755 | height = (int)canvasImage.PixelHeight - y; |
||
1756 | } |
||
1757 | var rect = new Int32Rect((int)x, (int)y, (int)width, (int)height); |
||
1758 | |||
1759 | string uri = ""; |
||
1760 | if (userData.COMPANY != "EXT") |
||
1761 | { |
||
1762 | 84c48033 | djkim | uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, |
1763 | 53880c83 | ljiyeon | (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber); |
1764 | } |
||
1765 | else |
||
1766 | { |
||
1767 | 84c48033 | djkim | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, |
1768 | 53880c83 | ljiyeon | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber); |
1769 | } |
||
1770 | |||
1771 | var defaultBitmapImage = new BitmapImage(); |
||
1772 | defaultBitmapImage.BeginInit(); |
||
1773 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
1774 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
1775 | defaultBitmapImage.UriSource = new Uri(uri); |
||
1776 | defaultBitmapImage.EndInit(); |
||
1777 | |||
1778 | 90e7968d | ljiyeon | //GC.Collect(); |
1779 | 53880c83 | ljiyeon | |
1780 | if (defaultBitmapImage.IsDownloading) |
||
1781 | { |
||
1782 | defaultBitmapImage.DownloadCompleted += (ex, arg) => |
||
1783 | { |
||
1784 | defaultBitmapImage.Freeze(); |
||
1785 | 90e7968d | ljiyeon | //GC.Collect(); |
1786 | 53880c83 | ljiyeon | BitmapSource bs = new CroppedBitmap(defaultBitmapImage, rect); |
1787 | Save_Symbol_Capture(bs, (int)x, (int)y, (int)width, (int)height); |
||
1788 | }; |
||
1789 | } |
||
1790 | } |
||
1791 | |||
1792 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e) |
1793 | { |
||
1794 | e6a9ddaf | humkyung | ///mouseButtonDown = MouseButton.Left; |
1795 | a1716fa5 | KangIngu | } |
1796 | |||
1797 | 787a4489 | KangIngu | private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e) |
1798 | { |
||
1799 | e6a9ddaf | humkyung | ///mouseButtonDown = MouseButton.Left; |
1800 | 53880c83 | ljiyeon | //this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
1801 | 787a4489 | KangIngu | } |
1802 | |||
1803 | private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
1804 | { |
||
1805 | |||
1806 | } |
||
1807 | |||
1808 | 4804a4fb | humkyung | /// <summary> |
1809 | /// select items by dragging |
||
1810 | /// </summary> |
||
1811 | 787a4489 | KangIngu | private void ApplyDragSelectionRect() |
1812 | { |
||
1813 | dragSelectionBorder.Visibility = Visibility.Collapsed; |
||
1814 | |||
1815 | double x = Canvas.GetLeft(dragSelectionBorder); |
||
1816 | double y = Canvas.GetTop(dragSelectionBorder); |
||
1817 | double width = dragSelectionBorder.Width; |
||
1818 | double height = dragSelectionBorder.Height; |
||
1819 | Boolean Flag = false; |
||
1820 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
1821 | f87a00b1 | ljiyeon | var Items = ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.Visibility != Visibility.Hidden).ToList(); |
1822 | 787a4489 | KangIngu | |
1823 | e6a9ddaf | humkyung | Rect dragRect = new Rect(x, y, width, height); |
1824 | ///dragRect.Inflate(width / 10, height / 10); |
||
1825 | 787a4489 | KangIngu | |
1826 | foreach (var item in Items) |
||
1827 | { |
||
1828 | 91efe37a | humkyung | Flag = SelectionSet.Instance.SelectControl(item, dragRect); |
1829 | 787a4489 | KangIngu | |
1830 | if (Flag) |
||
1831 | { |
||
1832 | adornerSet.Add(item); |
||
1833 | 05009a0e | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
1834 | 787a4489 | KangIngu | Control_Style(item); |
1835 | } |
||
1836 | } |
||
1837 | if (adornerSet.Count > 0) |
||
1838 | { |
||
1839 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
1840 | SelectLayer.Children.Add(final); |
||
1841 | } |
||
1842 | } |
||
1843 | |||
1844 | private void InitDragSelectionRect(Point pt1, Point pt2) |
||
1845 | { |
||
1846 | 9f473fb7 | KangIngu | //캡쳐 중 |
1847 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
1848 | { |
||
1849 | dragCaptureBorder.Visibility = Visibility.Visible; |
||
1850 | } |
||
1851 | 787a4489 | KangIngu | //선택 중 |
1852 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
1853 | 787a4489 | KangIngu | { |
1854 | e54660e8 | KangIngu | |
1855 | 787a4489 | KangIngu | dragSelectionBorder.Visibility = Visibility.Visible; |
1856 | } |
||
1857 | else |
||
1858 | { |
||
1859 | 9f473fb7 | KangIngu | dragZoomBorder.Visibility = Visibility.Visible; |
1860 | 787a4489 | KangIngu | } |
1861 | UpdateDragSelectionRect(pt1, pt2); |
||
1862 | } |
||
1863 | |||
1864 | /// <summary> |
||
1865 | /// Update the position and size of the rectangle used for drag selection. |
||
1866 | /// </summary> |
||
1867 | private void UpdateDragSelectionRect(Point pt1, Point pt2) |
||
1868 | { |
||
1869 | double x, y, width, height; |
||
1870 | |||
1871 | // |
||
1872 | // Determine x,y,width and height of the rect inverting the points if necessary. |
||
1873 | // |
||
1874 | |||
1875 | if (pt2.X < pt1.X) |
||
1876 | { |
||
1877 | x = pt2.X; |
||
1878 | width = pt1.X - pt2.X; |
||
1879 | } |
||
1880 | else |
||
1881 | { |
||
1882 | x = pt1.X; |
||
1883 | width = pt2.X - pt1.X; |
||
1884 | } |
||
1885 | |||
1886 | if (pt2.Y < pt1.Y) |
||
1887 | { |
||
1888 | y = pt2.Y; |
||
1889 | height = pt1.Y - pt2.Y; |
||
1890 | } |
||
1891 | else |
||
1892 | { |
||
1893 | y = pt1.Y; |
||
1894 | height = pt2.Y - pt1.Y; |
||
1895 | } |
||
1896 | |||
1897 | // |
||
1898 | // Update the coordinates of the rectangle used for drag selection. |
||
1899 | // |
||
1900 | 9f473fb7 | KangIngu | //캡쳐 중 |
1901 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
1902 | { |
||
1903 | Canvas.SetLeft(dragCaptureBorder, x); |
||
1904 | Canvas.SetTop(dragCaptureBorder, y); |
||
1905 | dragCaptureBorder.Width = width; |
||
1906 | dragCaptureBorder.Height = height; |
||
1907 | } |
||
1908 | 787a4489 | KangIngu | //선택 중 |
1909 | a1716fa5 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
1910 | 787a4489 | KangIngu | { |
1911 | Canvas.SetLeft(dragSelectionBorder, x); |
||
1912 | Canvas.SetTop(dragSelectionBorder, y); |
||
1913 | dragSelectionBorder.Width = width; |
||
1914 | dragSelectionBorder.Height = height; |
||
1915 | } |
||
1916 | else |
||
1917 | { |
||
1918 | 9f473fb7 | KangIngu | Canvas.SetLeft(dragZoomBorder, x); |
1919 | Canvas.SetTop(dragZoomBorder, y); |
||
1920 | dragZoomBorder.Width = width; |
||
1921 | dragZoomBorder.Height = height; |
||
1922 | 787a4489 | KangIngu | } |
1923 | } |
||
1924 | |||
1925 | private void drawingPannelRotate(double angle) |
||
1926 | { |
||
1927 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
1928 | 787a4489 | KangIngu | rotate.Angle = angle; |
1929 | var rotationNum = Math.Abs((rotate.Angle / 90)); |
||
1930 | |||
1931 | if (angle == 90 || angle == 270) |
||
1932 | { |
||
1933 | double emptySize = zoomAndPanCanvas.Width; |
||
1934 | zoomAndPanCanvas.Width = zoomAndPanCanvas.Height; |
||
1935 | zoomAndPanCanvas.Height = emptySize; |
||
1936 | } |
||
1937 | if (angle == 0) |
||
1938 | { |
||
1939 | translate.X = 0; |
||
1940 | translate.Y = 0; |
||
1941 | } |
||
1942 | else if (angle == 90) |
||
1943 | { |
||
1944 | translate.X = zoomAndPanCanvas.Width; |
||
1945 | translate.Y = 0; |
||
1946 | } |
||
1947 | else if (angle == 180) |
||
1948 | { |
||
1949 | translate.X = zoomAndPanCanvas.Width; |
||
1950 | translate.Y = zoomAndPanCanvas.Height; |
||
1951 | } |
||
1952 | else |
||
1953 | { |
||
1954 | translate.X = 0; |
||
1955 | translate.Y = zoomAndPanCanvas.Height; |
||
1956 | } |
||
1957 | |||
1958 | zoomAndPanControl.RotationAngle = rotate.Angle; |
||
1959 | |||
1960 | |||
1961 | if (!testPanel2.IsHidden) |
||
1962 | { |
||
1963 | zoomAndPanControl2.RotationAngle = rotate.Angle; |
||
1964 | zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width; |
||
1965 | zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height; |
||
1966 | } |
||
1967 | |||
1968 | ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
||
1969 | ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
||
1970 | ViewerDataModel.Instance.AngleOffsetX = translate.X; |
||
1971 | ViewerDataModel.Instance.AngleOffsetY = translate.Y; |
||
1972 | ViewerDataModel.Instance.Angle = rotate.Angle; |
||
1973 | } |
||
1974 | |||
1975 | 497bbe52 | ljiyeon | private void syncPannelRotate(double angle) |
1976 | { |
||
1977 | //Logger.sendCheckLog("pageNavigator_PageChanging_drawingPannelRotate Setting", 1); |
||
1978 | rotate.Angle = angle; |
||
1979 | var rotationNum = Math.Abs((rotate.Angle / 90)); |
||
1980 | |||
1981 | if (angle == 90 || angle == 270) |
||
1982 | { |
||
1983 | double emptySize = zoomAndPanCanvas2.Width; |
||
1984 | zoomAndPanCanvas2.Width = zoomAndPanCanvas2.Height; |
||
1985 | zoomAndPanCanvas2.Height = emptySize; |
||
1986 | } |
||
1987 | if (angle == 0) |
||
1988 | { |
||
1989 | translate2.X = 0; |
||
1990 | translate2.Y = 0; |
||
1991 | } |
||
1992 | else if (angle == 90) |
||
1993 | { |
||
1994 | translate2.X = zoomAndPanCanvas2.Width; |
||
1995 | translate2.Y = 0; |
||
1996 | } |
||
1997 | else if (angle == 180) |
||
1998 | { |
||
1999 | translate2.X = zoomAndPanCanvas2.Width; |
||
2000 | translate2.Y = zoomAndPanCanvas2.Height; |
||
2001 | } |
||
2002 | else |
||
2003 | { |
||
2004 | translate2.X = 0; |
||
2005 | translate2.Y = zoomAndPanCanvas2.Height; |
||
2006 | } |
||
2007 | |||
2008 | zoomAndPanControl2.RotationAngle = rotate.Angle; |
||
2009 | } |
||
2010 | |||
2011 | 53880c83 | ljiyeon | public void PlaceImageSymbol(string id, long group_id, int SelectedIndex, Point canvasZoomPanningMouseDownPoint) |
2012 | 787a4489 | KangIngu | { |
2013 | 53880c83 | ljiyeon | string Data_ = ""; |
2014 | |||
2015 | try |
||
2016 | { |
||
2017 | Logger.sendReqLog("GetSymbolImageURL: ", id + "," + SelectedIndex, 1); |
||
2018 | Data_ = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.GetSymbolImageURL(id, SelectedIndex); |
||
2019 | if (Data_ != null || Data_ != "") |
||
2020 | { |
||
2021 | Logger.sendResLog("GetSymbolImageURL", "TRUE", 1); |
||
2022 | } |
||
2023 | else |
||
2024 | { |
||
2025 | Logger.sendResLog("GetSymbolImageURL", "FALSE", 1); |
||
2026 | } |
||
2027 | |||
2028 | c0977e97 | djkim | //MARKUP_DATA_GROUP mARKUP_DATA_GROUP = new MARKUP_DATA_GROUP |
2029 | //{ |
||
2030 | // SYMBOL_ID = id,//InnerItem.Symbol_ID |
||
2031 | // STATE = 0, |
||
2032 | //}; |
||
2033 | 53880c83 | ljiyeon | if (Data_ != null) |
2034 | { |
||
2035 | Image img = new Image(); |
||
2036 | //img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Data_)); |
||
2037 | if (Data_.Contains(".svg")) |
||
2038 | { |
||
2039 | byte[] imageData = null; |
||
2040 | DrawingImage image = null; |
||
2041 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
2042 | { |
||
2043 | imageData = web.DownloadData(new Uri(Data_)); |
||
2044 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
2045 | image = SvgReader.Load(stream); |
||
2046 | } |
||
2047 | img.Source = image; |
||
2048 | } |
||
2049 | else |
||
2050 | { |
||
2051 | img.Source = new BitmapImage(new Uri(Data_)); |
||
2052 | } |
||
2053 | |||
2054 | var currentControl = new MarkupToPDF.Controls.Etc.ImgControl |
||
2055 | { |
||
2056 | PointSet = new List<Point>(), |
||
2057 | FilePath = Data_, |
||
2058 | ImageData = img.Source, |
||
2059 | StartPoint = canvasZoomPanningMouseDownPoint, |
||
2060 | EndPoint = new Point(canvasZoomPanningMouseDownPoint.X + img.Source.Width, |
||
2061 | canvasZoomPanningMouseDownPoint.Y + img.Source.Height), |
||
2062 | TopRightPoint = new Point(canvasZoomPanningMouseDownPoint.X+img.Source.Width, |
||
2063 | canvasZoomPanningMouseDownPoint.Y), |
||
2064 | LeftBottomPoint = new Point(canvasZoomPanningMouseDownPoint.X, |
||
2065 | canvasZoomPanningMouseDownPoint.Y + img.Source.Height) |
||
2066 | }; |
||
2067 | |||
2068 | currentControl.PointSet = new List<Point> |
||
2069 | { |
||
2070 | currentControl.StartPoint, |
||
2071 | currentControl.LeftBottomPoint, |
||
2072 | currentControl.EndPoint, |
||
2073 | currentControl.TopRightPoint, |
||
2074 | }; |
||
2075 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
2076 | UndoData = new Undo_data() |
||
2077 | { |
||
2078 | IsUndo = false, |
||
2079 | Event = Event_Type.Create, |
||
2080 | EventTime = DateTime.Now, |
||
2081 | Markup_List = new List<Multi_Undo_data>() |
||
2082 | }; |
||
2083 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
2084 | { |
||
2085 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
2086 | }); |
||
2087 | |||
2088 | //multi_Undo_Data = dzMainMenu.Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2089 | multi_Undo_Data = Control_Style(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2090 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
2091 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
2092 | |||
2093 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2094 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2095 | 53880c83 | ljiyeon | currentControl.SymbolID = id; |
2096 | currentControl.GroupID = group_id; |
||
2097 | currentControl.ApplyTemplate(); |
||
2098 | currentControl.SetImage(); |
||
2099 | |||
2100 | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2101 | Controls.AdornerFinal final = new Controls.AdornerFinal(currentControl as MarkupToPDF.Common.CommentUserInfo); |
||
2102 | SelectLayer.Children.Add(final); |
||
2103 | } |
||
2104 | } |
||
2105 | catch (Exception ex) |
||
2106 | { |
||
2107 | this.ParentOfType<MainWindow>().dzMainMenu.DialogMessage_Alert(ex.Message, "Error"); |
||
2108 | } |
||
2109 | } |
||
2110 | |||
2111 | private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e) |
||
2112 | { |
||
2113 | 992a98b4 | KangIngu | var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault(); |
2114 | be04d12c | djkim | if (set_option != null && !string.IsNullOrEmpty(set_option.ContentText)) |
2115 | 992a98b4 | KangIngu | { |
2116 | set_option.Value = double.Parse(set_option.ContentText); |
||
2117 | } |
||
2118 | |||
2119 | f959ea6f | humkyung | ConvertInkControlToPolygon(); |
2120 | 787a4489 | KangIngu | |
2121 | d62c0439 | humkyung | ///TODO: |
2122 | 787a4489 | KangIngu | var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data => |
2123 | (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault(); |
||
2124 | |||
2125 | a1716fa5 | KangIngu | if (text_item != null && (currentControl as ArrowTextControl) == null) |
2126 | 787a4489 | KangIngu | { |
2127 | ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item); |
||
2128 | } |
||
2129 | d62c0439 | humkyung | /// up to here |
2130 | 787a4489 | KangIngu | |
2131 | foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER) |
||
2132 | { |
||
2133 | if (arrow_text as ArrowTextControl != null) |
||
2134 | { |
||
2135 | (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
2136 | } |
||
2137 | } |
||
2138 | |||
2139 | 49b217ad | humkyung | //if (currentControl != null) |
2140 | 787a4489 | KangIngu | { |
2141 | var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault(); |
||
2142 | if (text_item_ != null) |
||
2143 | { |
||
2144 | (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible; |
||
2145 | (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed; |
||
2146 | (text_item_ as TextControl).EnableEditing = false; |
||
2147 | 49b217ad | humkyung | currentControl = null; |
2148 | 787a4489 | KangIngu | } |
2149 | |||
2150 | var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault(); |
||
2151 | 49b217ad | humkyung | if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false)) |
2152 | 787a4489 | KangIngu | { |
2153 | (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false; |
||
2154 | (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false; |
||
2155 | 49b217ad | humkyung | currentControl = null; |
2156 | 787a4489 | KangIngu | } |
2157 | } |
||
2158 | |||
2159 | ca40e004 | ljiyeon | double Ang = 0; |
2160 | 787a4489 | KangIngu | if (rotate.Angle != 0) |
2161 | { |
||
2162 | Ang = 360 - rotate.Angle; |
||
2163 | } |
||
2164 | |||
2165 | if (e.OriginalSource is System.Windows.Controls.Image) |
||
2166 | { |
||
2167 | (e.OriginalSource as System.Windows.Controls.Image).Focus(); |
||
2168 | } |
||
2169 | 7211e0c2 | ljiyeon | /* |
2170 | e6a9ddaf | humkyung | if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.LeftButton == MouseButtonState.Pressed) |
2171 | 53880c83 | ljiyeon | { |
2172 | canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2173 | if(symbol_id != null) |
||
2174 | { |
||
2175 | PlaceImageSymbol(symbol_id, symbol_group_id, symbol_SelectedIndex, canvasZoomPanningMouseDownPoint); |
||
2176 | } |
||
2177 | } |
||
2178 | |||
2179 | e6a9ddaf | humkyung | if (mouseHandlingMode == MouseHandlingMode.DragSymbol && e.RightButton == MouseButtonState.Pressed) |
2180 | 53880c83 | ljiyeon | { |
2181 | if (this._dragdropWindow != null) |
||
2182 | { |
||
2183 | this._dragdropWindow.Close(); |
||
2184 | this._dragdropWindow = null; |
||
2185 | symbol_id = null; |
||
2186 | } |
||
2187 | } |
||
2188 | 7211e0c2 | ljiyeon | */ |
2189 | 53880c83 | ljiyeon | |
2190 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2191 | 787a4489 | KangIngu | { |
2192 | canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
||
2193 | canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2194 | |||
2195 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2196 | 787a4489 | KangIngu | SetCursor(); |
2197 | |||
2198 | f513c215 | humkyung | if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this); |
2199 | 787a4489 | KangIngu | } |
2200 | f513c215 | humkyung | |
2201 | e6a9ddaf | humkyung | if (e.MiddleButton == MouseButtonState.Pressed) |
2202 | 787a4489 | KangIngu | { |
2203 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2204 | cursor = Cursors.SizeAll; |
||
2205 | SetCursor(); |
||
2206 | } |
||
2207 | e6a9ddaf | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
2208 | 787a4489 | KangIngu | { |
2209 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
2210 | cursor = Cursors.SizeAll; |
||
2211 | SetCursor(); |
||
2212 | } |
||
2213 | e6a9ddaf | humkyung | else if (e.XButton1 == MouseButtonState.Pressed) |
2214 | 787a4489 | KangIngu | { |
2215 | if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount) |
||
2216 | { |
||
2217 | 3908a575 | humkyung | this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber + 1); |
2218 | 787a4489 | KangIngu | } |
2219 | |||
2220 | 3908a575 | humkyung | //this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber); |
2221 | 787a4489 | KangIngu | |
2222 | } |
||
2223 | e6a9ddaf | humkyung | else if (e.XButton2 == MouseButtonState.Pressed) |
2224 | 787a4489 | KangIngu | { |
2225 | if (this.pageNavigator.CurrentPage.PageNumber > 1) |
||
2226 | { |
||
2227 | this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1); |
||
2228 | } |
||
2229 | } |
||
2230 | |||
2231 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null) |
2232 | 787a4489 | KangIngu | { |
2233 | if (mouseHandlingMode == MouseHandlingMode.Selecting) |
||
2234 | { |
||
2235 | if (SelectLayer.Children.Count == 0) |
||
2236 | { |
||
2237 | isLeftMouseButtonDownOnWindow = true; |
||
2238 | mouseHandlingMode = MouseHandlingMode.Selecting; |
||
2239 | } |
||
2240 | |||
2241 | if (controlType == ControlType.None) |
||
2242 | { |
||
2243 | isLeftMouseButtonDownOnWindow = true; |
||
2244 | } |
||
2245 | } |
||
2246 | |||
2247 | f513c215 | humkyung | /// 캡쳐 모드 설정 |
2248 | 9f473fb7 | KangIngu | if (mouseHandlingMode == MouseHandlingMode.Capture) |
2249 | { |
||
2250 | dragCaptureBorder.Visibility = Visibility.Visible; |
||
2251 | isLeftMouseButtonDownOnWindow = true; |
||
2252 | } |
||
2253 | |||
2254 | f513c215 | humkyung | /// 줌 모드 설정 |
2255 | 9f473fb7 | KangIngu | if (mouseHandlingMode == MouseHandlingMode.DragZoom) |
2256 | { |
||
2257 | isLeftMouseButtonDownOnWindow = true; |
||
2258 | 1066bae3 | ljiyeon | } |
2259 | 787a4489 | KangIngu | |
2260 | 05009a0e | ljiyeon | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
2261 | 787a4489 | KangIngu | if (control != null) |
2262 | { |
||
2263 | d62c0439 | humkyung | AdornerFinal final = null; |
2264 | 787a4489 | KangIngu | |
2265 | if (!ViewerDataModel.Instance.IsPressCtrl) |
||
2266 | { |
||
2267 | d62c0439 | humkyung | /// 기존 selection 해제 |
2268 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
2269 | d62c0439 | humkyung | |
2270 | 787a4489 | KangIngu | final = new AdornerFinal(control); |
2271 | |||
2272 | f513c215 | humkyung | this.Control_Style(control); |
2273 | 787a4489 | KangIngu | |
2274 | if ((control as IPath) != null) |
||
2275 | { |
||
2276 | if ((control as IPath).LineSize != 0) |
||
2277 | { |
||
2278 | ViewerDataModel.Instance.LineSize = (control as IPath).LineSize; |
||
2279 | } |
||
2280 | } |
||
2281 | if ((control as IShapeControl) != null) |
||
2282 | { |
||
2283 | if ((control as IShapeControl).Paint == PaintSet.Hatch) |
||
2284 | { |
||
2285 | ViewerDataModel.Instance.checkHatchShape = true; |
||
2286 | } |
||
2287 | else if ((control as IShapeControl).Paint == PaintSet.Fill) |
||
2288 | { |
||
2289 | ViewerDataModel.Instance.checkFillShape = true; |
||
2290 | } |
||
2291 | else |
||
2292 | { |
||
2293 | ViewerDataModel.Instance.checkHatchShape = false; |
||
2294 | ViewerDataModel.Instance.checkFillShape = false; |
||
2295 | } |
||
2296 | ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint; |
||
2297 | } |
||
2298 | 9f473fb7 | KangIngu | |
2299 | 787a4489 | KangIngu | ViewerDataModel.Instance.ControlOpacity = control.Opacity; |
2300 | d4b0c723 | KangIngu | |
2301 | if ((control as TextControl) != null) |
||
2302 | { |
||
2303 | 71d7e0bf | 송근호 | if(!((control as TextControl).EnableEditing)) { |
2304 | (control as TextControl).EnableEditing = true; |
||
2305 | } |
||
2306 | |||
2307 | d4b0c723 | KangIngu | if ((control as TextControl).TextStyle == FontStyles.Italic) |
2308 | { |
||
2309 | ViewerDataModel.Instance.checkTextStyle = true; |
||
2310 | } |
||
2311 | else |
||
2312 | { |
||
2313 | ViewerDataModel.Instance.checkTextStyle = false; |
||
2314 | } |
||
2315 | |||
2316 | if ((control as TextControl).TextStyle == FontStyles.Italic) |
||
2317 | { |
||
2318 | ViewerDataModel.Instance.checkTextStyle = true; |
||
2319 | } |
||
2320 | else |
||
2321 | { |
||
2322 | ViewerDataModel.Instance.checkTextStyle = false; |
||
2323 | } |
||
2324 | if ((control as TextControl).TextWeight == FontWeights.Bold) |
||
2325 | { |
||
2326 | ViewerDataModel.Instance.checkTextWeight = true; |
||
2327 | } |
||
2328 | else |
||
2329 | { |
||
2330 | ViewerDataModel.Instance.checkTextWeight = false; |
||
2331 | } |
||
2332 | if ((control as TextControl).UnderLine == TextDecorations.Underline) |
||
2333 | { |
||
2334 | ViewerDataModel.Instance.checkUnderLine = true; |
||
2335 | } |
||
2336 | else |
||
2337 | { |
||
2338 | ViewerDataModel.Instance.checkUnderLine = false; |
||
2339 | } |
||
2340 | ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize; |
||
2341 | ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight; |
||
2342 | e54660e8 | KangIngu | |
2343 | d4b0c723 | KangIngu | } |
2344 | else if ((control as ArrowTextControl) != null) |
||
2345 | { |
||
2346 | 120b8b00 | 송근호 | if (!((control as ArrowTextControl).EnableEditing)) |
2347 | { |
||
2348 | 71d7e0bf | 송근호 | (control as ArrowTextControl).EnableEditing = true; |
2349 | } |
||
2350 | e17af42b | KangIngu | if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
2351 | d4b0c723 | KangIngu | { |
2352 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextStyle = true; |
2353 | } |
||
2354 | else |
||
2355 | { |
||
2356 | ViewerDataModel.Instance.checkTextStyle = false; |
||
2357 | } |
||
2358 | |||
2359 | if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
||
2360 | { |
||
2361 | ViewerDataModel.Instance.checkTextStyle = true; |
||
2362 | d4b0c723 | KangIngu | } |
2363 | e17af42b | KangIngu | else |
2364 | d4b0c723 | KangIngu | { |
2365 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextStyle = false; |
2366 | d4b0c723 | KangIngu | } |
2367 | e17af42b | KangIngu | if ((control as ArrowTextControl).TextWeight == FontWeights.Bold) |
2368 | d4b0c723 | KangIngu | { |
2369 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextWeight = true; |
2370 | } |
||
2371 | else |
||
2372 | { |
||
2373 | ViewerDataModel.Instance.checkTextWeight = false; |
||
2374 | } |
||
2375 | if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline) |
||
2376 | { |
||
2377 | ViewerDataModel.Instance.checkUnderLine = true; |
||
2378 | } |
||
2379 | else |
||
2380 | { |
||
2381 | ViewerDataModel.Instance.checkUnderLine = false; |
||
2382 | d4b0c723 | KangIngu | } |
2383 | ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight; |
||
2384 | ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize; |
||
2385 | } |
||
2386 | 9f473fb7 | KangIngu | else if ((control as RectCloudControl) != null) |
2387 | { |
||
2388 | ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength; |
||
2389 | } |
||
2390 | else if ((control as CloudControl) != null) |
||
2391 | { |
||
2392 | ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength; |
||
2393 | } |
||
2394 | 787a4489 | KangIngu | } |
2395 | else |
||
2396 | { |
||
2397 | d62c0439 | humkyung | List<CommentUserInfo> comment = SelectionSet.Instance.SelectedItems; |
2398 | SelectionSet.Instance.UnSelect(this); |
||
2399 | 787a4489 | KangIngu | comment.Add(control); |
2400 | |||
2401 | Control_Style(control); |
||
2402 | |||
2403 | final = new AdornerFinal(comment); |
||
2404 | } |
||
2405 | |||
2406 | f513c215 | humkyung | if (final != null) |
2407 | { |
||
2408 | this.SelectLayer.Children.Add(final); |
||
2409 | } |
||
2410 | 6707a5c7 | ljiyeon | } |
2411 | 787a4489 | KangIngu | } |
2412 | else if (mouseHandlingMode == MouseHandlingMode.Drawing) |
||
2413 | 6707a5c7 | ljiyeon | { |
2414 | 787a4489 | KangIngu | init(); |
2415 | //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음) |
||
2416 | if (cursor != Cursors.SizeAll) |
||
2417 | { |
||
2418 | cursor = Cursors.Cross; |
||
2419 | SetCursor(); |
||
2420 | } |
||
2421 | bool init_user = false; |
||
2422 | foreach (var user in gridViewMarkup.Items) |
||
2423 | { |
||
2424 | if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID) |
||
2425 | { |
||
2426 | init_user = true; |
||
2427 | } |
||
2428 | } |
||
2429 | if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed) |
||
2430 | { |
||
2431 | RadWindow.Alert(new DialogParameters |
||
2432 | { |
||
2433 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
2434 | 787a4489 | KangIngu | Theme = new VisualStudio2013Theme(), |
2435 | Header = "안내", |
||
2436 | Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요", |
||
2437 | }); |
||
2438 | return; |
||
2439 | } |
||
2440 | else |
||
2441 | { |
||
2442 | var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem; |
||
2443 | if (item != null) |
||
2444 | { |
||
2445 | App.Custom_ViewInfoId = item.MarkupInfoID; |
||
2446 | } |
||
2447 | } |
||
2448 | |||
2449 | 75448f5e | ljiyeon | switch (controlType) |
2450 | 787a4489 | KangIngu | { |
2451 | 684ef11c | ljiyeon | case ControlType.Coordinate: |
2452 | { |
||
2453 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2454 | 684ef11c | ljiyeon | { |
2455 | if (currentControl is CoordinateControl) |
||
2456 | { |
||
2457 | if (IsGetoutpoint((currentControl as CoordinateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2458 | { |
||
2459 | return; |
||
2460 | } |
||
2461 | |||
2462 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2463 | 684ef11c | ljiyeon | |
2464 | currentControl = null; |
||
2465 | this.cursor = Cursors.Arrow; |
||
2466 | } |
||
2467 | else |
||
2468 | { |
||
2469 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
2470 | d62c0439 | humkyung | if (ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber |
2471 | 684ef11c | ljiyeon | && d.Data_Type == Convert.ToInt32(MarkupToPDF.Controls.Common.ControlType.Coordinate)).Count() > 0) |
2472 | { |
||
2473 | currentControl = null; |
||
2474 | this.cursor = Cursors.Arrow; |
||
2475 | Common.ViewerDataModel.Instance.SystemMain.DialogMessage_Alert("이미 해당 페이지의 도면 영역을 설정하셨습니다.", "Notice"); |
||
2476 | return; |
||
2477 | } |
||
2478 | else |
||
2479 | { |
||
2480 | currentControl = new CoordinateControl |
||
2481 | { |
||
2482 | Background = new SolidColorBrush(Colors.Black), |
||
2483 | f67f164e | humkyung | StartPoint = this.canvasDrawingMouseDownPoint, |
2484 | 684ef11c | ljiyeon | ControlType = ControlType.Coordinate |
2485 | }; |
||
2486 | |||
2487 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2488 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2489 | currentControl.IsNew = true; |
||
2490 | |||
2491 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2492 | |||
2493 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
2494 | } |
||
2495 | } |
||
2496 | } |
||
2497 | } |
||
2498 | break; |
||
2499 | case ControlType.InsideWhite: |
||
2500 | { |
||
2501 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2502 | 684ef11c | ljiyeon | { |
2503 | if (currentControl is InsideWhiteControl) |
||
2504 | { |
||
2505 | if (IsGetoutpoint((currentControl as InsideWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2506 | { |
||
2507 | return; |
||
2508 | } |
||
2509 | |||
2510 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2511 | 684ef11c | ljiyeon | |
2512 | currentControl = null; |
||
2513 | this.cursor = Cursors.Arrow; |
||
2514 | } |
||
2515 | else |
||
2516 | { |
||
2517 | currentControl = new InsideWhiteControl |
||
2518 | { |
||
2519 | Background = new SolidColorBrush(Colors.Black), |
||
2520 | f67f164e | humkyung | StartPoint = this.canvasDrawingMouseDownPoint, |
2521 | 684ef11c | ljiyeon | ControlType = ControlType.InsideWhite |
2522 | }; |
||
2523 | |||
2524 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2525 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2526 | currentControl.IsNew = true; |
||
2527 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2528 | |||
2529 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
2530 | } |
||
2531 | } |
||
2532 | } |
||
2533 | break; |
||
2534 | case ControlType.OverlapWhite: |
||
2535 | { |
||
2536 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2537 | 684ef11c | ljiyeon | { |
2538 | if (currentControl is OverlapWhiteControl) |
||
2539 | { |
||
2540 | if (IsGetoutpoint((currentControl as OverlapWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2541 | { |
||
2542 | return; |
||
2543 | } |
||
2544 | |||
2545 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2546 | 684ef11c | ljiyeon | |
2547 | currentControl = null; |
||
2548 | this.cursor = Cursors.Arrow; |
||
2549 | } |
||
2550 | else |
||
2551 | { |
||
2552 | currentControl = new OverlapWhiteControl |
||
2553 | { |
||
2554 | Background = new SolidColorBrush(Colors.Black), |
||
2555 | f67f164e | humkyung | StartPoint = this.canvasDrawingMouseDownPoint, |
2556 | 684ef11c | ljiyeon | ControlType = ControlType.OverlapWhite |
2557 | }; |
||
2558 | |||
2559 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2560 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2561 | currentControl.IsNew = true; |
||
2562 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2563 | |||
2564 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
2565 | } |
||
2566 | } |
||
2567 | } |
||
2568 | break; |
||
2569 | case ControlType.ClipWhite: |
||
2570 | { |
||
2571 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2572 | 684ef11c | ljiyeon | { |
2573 | if (currentControl is ClipWhiteControl) |
||
2574 | { |
||
2575 | if (IsGetoutpoint((currentControl as ClipWhiteControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2576 | { |
||
2577 | return; |
||
2578 | } |
||
2579 | |||
2580 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2581 | 684ef11c | ljiyeon | |
2582 | currentControl = null; |
||
2583 | this.cursor = Cursors.Arrow; |
||
2584 | } |
||
2585 | else |
||
2586 | { |
||
2587 | currentControl = new ClipWhiteControl |
||
2588 | { |
||
2589 | Background = new SolidColorBrush(Colors.Black), |
||
2590 | a6272c57 | humkyung | StartPoint = this.canvasDrawingMouseDownPoint, |
2591 | 684ef11c | ljiyeon | ControlType = ControlType.ClipWhite |
2592 | }; |
||
2593 | |||
2594 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2595 | 684ef11c | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2596 | currentControl.IsNew = true; |
||
2597 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2598 | |||
2599 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
2600 | } |
||
2601 | } |
||
2602 | } |
||
2603 | break; |
||
2604 | 787a4489 | KangIngu | case ControlType.Rectangle: |
2605 | { |
||
2606 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2607 | 787a4489 | KangIngu | { |
2608 | f67f164e | humkyung | if (currentControl is RectangleControl) |
2609 | { |
||
2610 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2611 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2612 | 787a4489 | KangIngu | { |
2613 | f67f164e | humkyung | return; |
2614 | } |
||
2615 | 787a4489 | KangIngu | |
2616 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
2617 | currentControl = null; |
||
2618 | 510cbd2a | ljiyeon | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2619 | f67f164e | humkyung | } |
2620 | else |
||
2621 | { |
||
2622 | currentControl = new RectangleControl |
||
2623 | 787a4489 | KangIngu | { |
2624 | f67f164e | humkyung | Background = new SolidColorBrush(Colors.Black), |
2625 | StartPoint = this.canvasDrawingMouseDownPoint, |
||
2626 | ControlType = ControlType.Rectangle |
||
2627 | }; |
||
2628 | 787a4489 | KangIngu | |
2629 | f67f164e | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2630 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
2631 | currentControl.IsNew = true; |
||
2632 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2633 | 787a4489 | KangIngu | |
2634 | f67f164e | humkyung | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
2635 | } |
||
2636 | 787a4489 | KangIngu | } |
2637 | } |
||
2638 | break; |
||
2639 | case ControlType.RectCloud: |
||
2640 | { |
||
2641 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2642 | 787a4489 | KangIngu | { |
2643 | f67f164e | humkyung | if (currentControl is RectCloudControl) |
2644 | { |
||
2645 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2646 | if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2647 | 787a4489 | KangIngu | { |
2648 | f67f164e | humkyung | return; |
2649 | } |
||
2650 | e66f22eb | KangIngu | |
2651 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
2652 | 787a4489 | KangIngu | |
2653 | f67f164e | humkyung | currentControl = null; |
2654 | |||
2655 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
2656 | } |
||
2657 | else |
||
2658 | { |
||
2659 | currentControl = new RectCloudControl |
||
2660 | 787a4489 | KangIngu | { |
2661 | f67f164e | humkyung | StartPoint = this.canvasDrawingMouseDownPoint, |
2662 | ControlType = ControlType.RectCloud, |
||
2663 | Background = new SolidColorBrush(Colors.Black) |
||
2664 | }; |
||
2665 | 787a4489 | KangIngu | |
2666 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2667 | currentControl.CommentID = Commons.shortGuid(); |
||
2668 | currentControl.IsNew = true; |
||
2669 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2670 | } |
||
2671 | 787a4489 | KangIngu | } |
2672 | } |
||
2673 | break; |
||
2674 | case ControlType.Circle: |
||
2675 | { |
||
2676 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2677 | 787a4489 | KangIngu | { |
2678 | f67f164e | humkyung | if (currentControl is CircleControl) |
2679 | { |
||
2680 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2681 | if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2682 | 787a4489 | KangIngu | { |
2683 | f67f164e | humkyung | return; |
2684 | } |
||
2685 | e66f22eb | KangIngu | |
2686 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
2687 | 787a4489 | KangIngu | |
2688 | f67f164e | humkyung | currentControl = null; |
2689 | } |
||
2690 | else |
||
2691 | { |
||
2692 | currentControl = new CircleControl |
||
2693 | 787a4489 | KangIngu | { |
2694 | f67f164e | humkyung | StartPoint = this.canvasDrawingMouseDownPoint, |
2695 | LeftBottomPoint = this.canvasDrawingMouseDownPoint, |
||
2696 | Background = new SolidColorBrush(Colors.Black) |
||
2697 | }; |
||
2698 | 787a4489 | KangIngu | |
2699 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2700 | currentControl.CommentID = Commons.shortGuid(); |
||
2701 | currentControl.IsNew = true; |
||
2702 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2703 | } |
||
2704 | 787a4489 | KangIngu | } |
2705 | } |
||
2706 | break; |
||
2707 | case ControlType.Triangle: |
||
2708 | { |
||
2709 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2710 | 787a4489 | KangIngu | { |
2711 | f67f164e | humkyung | if (currentControl is TriControl) |
2712 | { |
||
2713 | var content = currentControl as TriControl; |
||
2714 | if (content.MidPoint == new Point(0, 0)) |
||
2715 | 787a4489 | KangIngu | { |
2716 | f67f164e | humkyung | content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
2717 | 787a4489 | KangIngu | } |
2718 | else |
||
2719 | { |
||
2720 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
2721 | f67f164e | humkyung | if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
2722 | e66f22eb | KangIngu | { |
2723 | return; |
||
2724 | } |
||
2725 | |||
2726 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2727 | 787a4489 | KangIngu | |
2728 | currentControl = null; |
||
2729 | } |
||
2730 | f67f164e | humkyung | } |
2731 | else |
||
2732 | { |
||
2733 | currentControl = new TriControl |
||
2734 | 787a4489 | KangIngu | { |
2735 | f67f164e | humkyung | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
2736 | Background = new SolidColorBrush(Colors.Black), |
||
2737 | }; |
||
2738 | 787a4489 | KangIngu | |
2739 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2740 | currentControl.CommentID = Commons.shortGuid(); |
||
2741 | currentControl.IsNew = true; |
||
2742 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2743 | } |
||
2744 | 787a4489 | KangIngu | } |
2745 | } |
||
2746 | break; |
||
2747 | case ControlType.CancelLine: |
||
2748 | f67f164e | humkyung | case ControlType.SingleLine: |
2749 | case ControlType.ArrowLine: |
||
2750 | case ControlType.TwinLine: |
||
2751 | case ControlType.DimLine: |
||
2752 | 787a4489 | KangIngu | { |
2753 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2754 | 787a4489 | KangIngu | { |
2755 | f67f164e | humkyung | if (currentControl is LineControl) |
2756 | { |
||
2757 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2758 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2759 | 787a4489 | KangIngu | { |
2760 | f67f164e | humkyung | return; |
2761 | 787a4489 | KangIngu | } |
2762 | f67f164e | humkyung | |
2763 | CreateCommand.Instance.Execute(currentControl); |
||
2764 | currentControl = null; |
||
2765 | this.MainAngle.Visibility = Visibility.Collapsed; |
||
2766 | } |
||
2767 | else |
||
2768 | { |
||
2769 | currentControl = new LineControl |
||
2770 | 787a4489 | KangIngu | { |
2771 | f67f164e | humkyung | ControlType = this.controlType, |
2772 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
2773 | Background = new SolidColorBrush(Colors.Black) |
||
2774 | }; |
||
2775 | 787a4489 | KangIngu | |
2776 | f67f164e | humkyung | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2777 | currentControl.CommentID = Commons.shortGuid(); |
||
2778 | currentControl.IsNew = true; |
||
2779 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2780 | this.MainAngle.Visibility = Visibility.Visible; |
||
2781 | } |
||
2782 | 787a4489 | KangIngu | } |
2783 | } |
||
2784 | break; |
||
2785 | f67f164e | humkyung | case ControlType.PolygonControl: |
2786 | 787a4489 | KangIngu | { |
2787 | f67f164e | humkyung | if (currentControl is PolygonControl) |
2788 | 787a4489 | KangIngu | { |
2789 | f67f164e | humkyung | var control = currentControl as PolygonControl; |
2790 | e66f22eb | KangIngu | |
2791 | f67f164e | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
2792 | { |
||
2793 | control.IsCompleted = true; |
||
2794 | } |
||
2795 | 787a4489 | KangIngu | |
2796 | f67f164e | humkyung | if (!control.IsCompleted) |
2797 | { |
||
2798 | control.PointSet.Add(control.EndPoint); |
||
2799 | } |
||
2800 | else |
||
2801 | { |
||
2802 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2803 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2804 | 787a4489 | KangIngu | { |
2805 | f67f164e | humkyung | return; |
2806 | 787a4489 | KangIngu | } |
2807 | e66f22eb | KangIngu | |
2808 | f67f164e | humkyung | var firstPoint = control.PointSet.First(); |
2809 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2810 | control.LineSize = ViewerDataModel.Instance.LineSize; |
||
2811 | control.PointSet.Add(firstPoint); |
||
2812 | 787a4489 | KangIngu | |
2813 | f67f164e | humkyung | control.ApplyOverViewData(); |
2814 | |||
2815 | CreateCommand.Instance.Execute(currentControl); |
||
2816 | 0d00f9c8 | humkyung | control.UpdateControl(); |
2817 | f67f164e | humkyung | currentControl = null; |
2818 | } |
||
2819 | 787a4489 | KangIngu | } |
2820 | f67f164e | humkyung | else |
2821 | 787a4489 | KangIngu | { |
2822 | f67f164e | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2823 | { |
||
2824 | currentControl = new PolygonControl |
||
2825 | 787a4489 | KangIngu | { |
2826 | f67f164e | humkyung | PointSet = new List<Point>(), |
2827 | }; |
||
2828 | 787a4489 | KangIngu | |
2829 | f67f164e | humkyung | var polygonControl = (currentControl as PolygonControl); |
2830 | currentControl.CommentID = Commons.shortGuid(); |
||
2831 | currentControl.IsNew = true; |
||
2832 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
2833 | polygonControl.StartPoint = canvasDrawingMouseDownPoint; |
||
2834 | polygonControl.EndPoint = canvasDrawingMouseDownPoint; |
||
2835 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
2836 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
2837 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2838 | polygonControl.ApplyTemplate(); |
||
2839 | polygonControl.Visibility = Visibility.Visible; |
||
2840 | } |
||
2841 | 787a4489 | KangIngu | } |
2842 | } |
||
2843 | break; |
||
2844 | case ControlType.ChainLine: |
||
2845 | { |
||
2846 | if (currentControl is PolygonControl) |
||
2847 | { |
||
2848 | var control = currentControl as PolygonControl; |
||
2849 | |||
2850 | e6a9ddaf | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
2851 | 787a4489 | KangIngu | { |
2852 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
2853 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2854 | e66f22eb | KangIngu | { |
2855 | return; |
||
2856 | } |
||
2857 | |||
2858 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2859 | 787a4489 | KangIngu | |
2860 | currentControl = null; |
||
2861 | 2eac4f76 | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
2862 | 787a4489 | KangIngu | return; |
2863 | } |
||
2864 | |||
2865 | if (!control.IsCompleted) |
||
2866 | { |
||
2867 | control.PointSet.Add(control.EndPoint); |
||
2868 | 2eac4f76 | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
2869 | 787a4489 | KangIngu | } |
2870 | } |
||
2871 | else |
||
2872 | { |
||
2873 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2874 | 787a4489 | KangIngu | { |
2875 | 2eac4f76 | KangIngu | MainAngle.Visibility = Visibility.Visible; |
2876 | 787a4489 | KangIngu | currentControl = new PolygonControl |
2877 | { |
||
2878 | PointSet = new List<Point>(), |
||
2879 | //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정) |
||
2880 | ControlType = ControlType.ChainLine, |
||
2881 | DashSize = ViewerDataModel.Instance.DashSize, |
||
2882 | LineSize = ViewerDataModel.Instance.LineSize, |
||
2883 | //PointC = new StylusPointSet() |
||
2884 | }; |
||
2885 | |||
2886 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
2887 | //{ |
||
2888 | 787a4489 | KangIngu | var polygonControl = (currentControl as PolygonControl); |
2889 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2890 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2891 | currentControl.IsNew = true; |
||
2892 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2893 | //currentControl.OnApplyTemplate(); |
||
2894 | //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
||
2895 | //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
||
2896 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
2897 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
2898 | e66f22eb | KangIngu | //} |
2899 | 787a4489 | KangIngu | } |
2900 | } |
||
2901 | } |
||
2902 | break; |
||
2903 | case ControlType.ArcLine: |
||
2904 | { |
||
2905 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2906 | 787a4489 | KangIngu | { |
2907 | f67f164e | humkyung | if (currentControl is ArcControl) |
2908 | { |
||
2909 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2910 | if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2911 | 787a4489 | KangIngu | { |
2912 | f67f164e | humkyung | return; |
2913 | } |
||
2914 | e66f22eb | KangIngu | |
2915 | f67f164e | humkyung | CreateCommand.Instance.Execute(currentControl); |
2916 | 787a4489 | KangIngu | |
2917 | f67f164e | humkyung | currentControl = null; |
2918 | this.MainAngle.Visibility = Visibility.Collapsed; |
||
2919 | } |
||
2920 | else |
||
2921 | { |
||
2922 | currentControl = new ArcControl |
||
2923 | 787a4489 | KangIngu | { |
2924 | f67f164e | humkyung | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
2925 | Background = new SolidColorBrush(Colors.Black) |
||
2926 | }; |
||
2927 | currentControl.CommentID = Commons.shortGuid(); |
||
2928 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
2929 | currentControl.IsNew = true; |
||
2930 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2931 | this.MainAngle.Visibility = Visibility.Visible; |
||
2932 | } |
||
2933 | 787a4489 | KangIngu | } |
2934 | e6a9ddaf | humkyung | else if (e.RightButton == MouseButtonState.Pressed) |
2935 | 787a4489 | KangIngu | { |
2936 | if (currentControl != null) |
||
2937 | { |
||
2938 | (currentControl as ArcControl).setClock(); |
||
2939 | 05f4d127 | KangIngu | (currentControl as ArcControl).MidPoint = new Point(0, 0); |
2940 | 787a4489 | KangIngu | } |
2941 | } |
||
2942 | } |
||
2943 | break; |
||
2944 | case ControlType.ArcArrow: |
||
2945 | { |
||
2946 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2947 | 787a4489 | KangIngu | { |
2948 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
2949 | //{ |
||
2950 | 40b3ce25 | ljiyeon | if (currentControl is ArrowArcControl) |
2951 | { |
||
2952 | //20180906 LJY TEST IsRotationDrawingEnable |
||
2953 | if (IsGetoutpoint((currentControl as ArrowArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
2954 | 787a4489 | KangIngu | { |
2955 | 40b3ce25 | ljiyeon | return; |
2956 | } |
||
2957 | e66f22eb | KangIngu | |
2958 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
2959 | 787a4489 | KangIngu | |
2960 | 40b3ce25 | ljiyeon | currentControl = null; |
2961 | this.MainAngle.Visibility = Visibility.Collapsed; |
||
2962 | } |
||
2963 | else |
||
2964 | { |
||
2965 | currentControl = new ArrowArcControl |
||
2966 | 787a4489 | KangIngu | { |
2967 | a6272c57 | humkyung | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
2968 | 40b3ce25 | ljiyeon | Background = new SolidColorBrush(Colors.Black) |
2969 | }; |
||
2970 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
2971 | 40b3ce25 | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
2972 | currentControl.IsNew = true; |
||
2973 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
2974 | this.MainAngle.Visibility = Visibility.Visible; |
||
2975 | } |
||
2976 | e66f22eb | KangIngu | //} |
2977 | 787a4489 | KangIngu | } |
2978 | e6a9ddaf | humkyung | else if (e.RightButton == MouseButtonState.Pressed) |
2979 | 787a4489 | KangIngu | { |
2980 | 40b3ce25 | ljiyeon | if (currentControl != null) |
2981 | { |
||
2982 | (currentControl as ArrowArcControl).setClock(); |
||
2983 | (currentControl as ArrowArcControl).MidPoint = new Point(0, 0); |
||
2984 | //(currentControl as ArcControl).ApplyTemplate(); |
||
2985 | } |
||
2986 | 787a4489 | KangIngu | } |
2987 | } |
||
2988 | break; |
||
2989 | case ControlType.ArrowMultiLine: |
||
2990 | { |
||
2991 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
2992 | 787a4489 | KangIngu | { |
2993 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
2994 | //{ |
||
2995 | 787a4489 | KangIngu | |
2996 | if (currentControl is ArrowControl_Multi) |
||
2997 | { |
||
2998 | var content = currentControl as ArrowControl_Multi; |
||
2999 | if (content.MiddlePoint == new Point(0, 0)) |
||
3000 | { |
||
3001 | 2eac4f76 | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
3002 | { |
||
3003 | content.MiddlePoint = content.EndPoint; |
||
3004 | } |
||
3005 | else |
||
3006 | { |
||
3007 | content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
3008 | } |
||
3009 | 787a4489 | KangIngu | } |
3010 | else |
||
3011 | { |
||
3012 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3013 | if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3014 | e66f22eb | KangIngu | { |
3015 | return; |
||
3016 | } |
||
3017 | |||
3018 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3019 | 787a4489 | KangIngu | |
3020 | currentControl = null; |
||
3021 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3022 | 787a4489 | KangIngu | } |
3023 | } |
||
3024 | else |
||
3025 | { |
||
3026 | currentControl = new ArrowControl_Multi |
||
3027 | { |
||
3028 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
3029 | Background = new SolidColorBrush(Colors.Black) |
||
3030 | }; |
||
3031 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3032 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3033 | currentControl.IsNew = true; |
||
3034 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3035 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3036 | 787a4489 | KangIngu | } |
3037 | e66f22eb | KangIngu | //} |
3038 | 787a4489 | KangIngu | } |
3039 | } |
||
3040 | break; |
||
3041 | case ControlType.PolygonCloud: |
||
3042 | { |
||
3043 | if (currentControl is CloudControl) |
||
3044 | { |
||
3045 | var control = currentControl as CloudControl; |
||
3046 | e6a9ddaf | humkyung | if (e.RightButton == MouseButtonState.Pressed) |
3047 | 787a4489 | KangIngu | { |
3048 | control.IsCompleted = true; |
||
3049 | } |
||
3050 | |||
3051 | if (!control.IsCompleted) |
||
3052 | { |
||
3053 | control.PointSet.Add(control.EndPoint); |
||
3054 | } |
||
3055 | else |
||
3056 | { |
||
3057 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3058 | if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3059 | e66f22eb | KangIngu | { |
3060 | return; |
||
3061 | } |
||
3062 | |||
3063 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3064 | 787a4489 | KangIngu | |
3065 | control.isTransOn = true; |
||
3066 | var firstPoint = control.PointSet.First(); |
||
3067 | |||
3068 | control.PointSet.Add(firstPoint); |
||
3069 | control.DrawingCloud(); |
||
3070 | control.ApplyOverViewData(); |
||
3071 | |||
3072 | currentControl = null; |
||
3073 | } |
||
3074 | } |
||
3075 | else |
||
3076 | { |
||
3077 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3078 | 787a4489 | KangIngu | { |
3079 | currentControl = new CloudControl |
||
3080 | { |
||
3081 | PointSet = new List<Point>(), |
||
3082 | PointC = new StylusPointSet() |
||
3083 | }; |
||
3084 | |||
3085 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3086 | //{ |
||
3087 | 787a4489 | KangIngu | var polygonControl = (currentControl as CloudControl); |
3088 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3089 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3090 | currentControl.IsNew = true; |
||
3091 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3092 | |||
3093 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
3094 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
3095 | b9ce7aee | ljiyeon | |
3096 | e66f22eb | KangIngu | //} |
3097 | 787a4489 | KangIngu | } |
3098 | } |
||
3099 | } |
||
3100 | break; |
||
3101 | case ControlType.ImgControl: |
||
3102 | { |
||
3103 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3104 | 787a4489 | KangIngu | { |
3105 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3106 | //{ |
||
3107 | 787a4489 | KangIngu | if (currentControl is ImgControl) |
3108 | { |
||
3109 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3110 | if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3111 | e66f22eb | KangIngu | { |
3112 | return; |
||
3113 | } |
||
3114 | |||
3115 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3116 | 53880c83 | ljiyeon | controlType = ControlType.ImgControl; |
3117 | 787a4489 | KangIngu | currentControl = null; |
3118 | } |
||
3119 | else |
||
3120 | { |
||
3121 | c73426a9 | ljiyeon | |
3122 | 787a4489 | KangIngu | string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
3123 | 53880c83 | ljiyeon | if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG") |
3124 | 787a4489 | KangIngu | { |
3125 | Image img = new Image(); |
||
3126 | 53880c83 | ljiyeon | if (filename.Contains(".svg")) |
3127 | { |
||
3128 | byte[] imageData = null; |
||
3129 | DrawingImage image = null; |
||
3130 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
3131 | { |
||
3132 | imageData = web.DownloadData(new Uri(filename)); |
||
3133 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
3134 | image = SvgReader.Load(stream); |
||
3135 | } |
||
3136 | img.Source = image; |
||
3137 | } |
||
3138 | else |
||
3139 | { |
||
3140 | img.Source = new BitmapImage(new Uri(filename)); |
||
3141 | } |
||
3142 | 787a4489 | KangIngu | |
3143 | currentControl = new ImgControl |
||
3144 | { |
||
3145 | 53880c83 | ljiyeon | Background = new SolidColorBrush(Colors.Black), |
3146 | PointSet = new List<Point>(), |
||
3147 | FilePath = filename, |
||
3148 | ImageData = img.Source, |
||
3149 | StartPoint = canvasDrawingMouseDownPoint, |
||
3150 | EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100), |
||
3151 | TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100), |
||
3152 | LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y), |
||
3153 | ControlType = ControlType.ImgControl |
||
3154 | }; |
||
3155 | |||
3156 | |||
3157 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3158 | 53880c83 | ljiyeon | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3159 | currentControl.IsNew = true; |
||
3160 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3161 | |||
3162 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
3163 | (currentControl as ImgControl).Angle -= rotate.Angle; |
||
3164 | } |
||
3165 | 787a4489 | KangIngu | } |
3166 | e66f22eb | KangIngu | //} |
3167 | 787a4489 | KangIngu | } |
3168 | } |
||
3169 | break; |
||
3170 | case ControlType.Date: |
||
3171 | { |
||
3172 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3173 | 787a4489 | KangIngu | { |
3174 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3175 | //{ |
||
3176 | 787a4489 | KangIngu | if (currentControl is DateControl) |
3177 | { |
||
3178 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3179 | if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3180 | e66f22eb | KangIngu | { |
3181 | return; |
||
3182 | } |
||
3183 | |||
3184 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3185 | 787a4489 | KangIngu | currentControl = null; |
3186 | |||
3187 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
3188 | { |
||
3189 | controlType = ControlType.None; |
||
3190 | IsSwingMode = false; |
||
3191 | Common.ViewerDataModel.Instance.SelectedControl = ""; |
||
3192 | Common.ViewerDataModel.Instance.ControlTag = null; |
||
3193 | mouseHandlingMode = MouseHandlingMode.None; |
||
3194 | this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
||
3195 | txtBatch.Visibility = Visibility.Collapsed; |
||
3196 | |||
3197 | } |
||
3198 | } |
||
3199 | else |
||
3200 | { |
||
3201 | currentControl = new DateControl |
||
3202 | { |
||
3203 | a6272c57 | humkyung | StartPoint = canvasDrawingMouseDownPoint, |
3204 | 787a4489 | KangIngu | Background = new SolidColorBrush(Colors.Black) |
3205 | }; |
||
3206 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3207 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3208 | currentControl.IsNew = true; |
||
3209 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3210 | ca40e004 | ljiyeon | |
3211 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
3212 | (currentControl as DateControl).Angle -= rotate.Angle; |
||
3213 | } |
||
3214 | e66f22eb | KangIngu | //} |
3215 | 787a4489 | KangIngu | } |
3216 | } |
||
3217 | break; |
||
3218 | case ControlType.TextControl: |
||
3219 | { |
||
3220 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3221 | 787a4489 | KangIngu | { |
3222 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
3223 | { |
||
3224 | currentControl = new TextControl |
||
3225 | { |
||
3226 | ControlType = controlType |
||
3227 | }; |
||
3228 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3229 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3230 | 8742caa5 | humkyung | currentControl.IsNew = true; |
3231 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3232 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3233 | 1066bae3 | ljiyeon | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
3234 | |||
3235 | 8742caa5 | humkyung | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
3236 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
3237 | 6b5d33c6 | djkim | |
3238 | 8742caa5 | humkyung | (currentControl as TextControl).ControlType_No = 0; |
3239 | (currentControl as TextControl).Angle -= rotate.Angle; |
||
3240 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3241 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
3242 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
3243 | 787a4489 | KangIngu | |
3244 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3245 | 787a4489 | KangIngu | } |
3246 | } |
||
3247 | } |
||
3248 | break; |
||
3249 | case ControlType.TextBorder: |
||
3250 | { |
||
3251 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3252 | 787a4489 | KangIngu | { |
3253 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
3254 | { |
||
3255 | currentControl = new TextControl |
||
3256 | { |
||
3257 | ControlType = controlType |
||
3258 | }; |
||
3259 | |||
3260 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3261 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3262 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3263 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3264 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3265 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3266 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
3267 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
3268 | 6b5d33c6 | djkim | |
3269 | 787a4489 | KangIngu | (currentControl as TextControl).ControlType_No = 1; |
3270 | (currentControl as TextControl).Angle = Ang; |
||
3271 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3272 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
3273 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
3274 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3275 | 787a4489 | KangIngu | } |
3276 | } |
||
3277 | } |
||
3278 | break; |
||
3279 | case ControlType.TextCloud: |
||
3280 | { |
||
3281 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3282 | 787a4489 | KangIngu | { |
3283 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
3284 | { |
||
3285 | currentControl = new TextControl |
||
3286 | { |
||
3287 | ControlType = controlType |
||
3288 | }; |
||
3289 | 610a4b86 | KangIngu | |
3290 | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
||
3291 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3292 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3293 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3294 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3295 | |||
3296 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3297 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
3298 | 6b5d33c6 | djkim | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
3299 | 787a4489 | KangIngu | |
3300 | (currentControl as TextControl).Angle = Ang; |
||
3301 | (currentControl as TextControl).ControlType_No = 2; |
||
3302 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3303 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
3304 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
3305 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3306 | 49b217ad | humkyung | //currentControl = null; |
3307 | 787a4489 | KangIngu | } |
3308 | } |
||
3309 | } |
||
3310 | break; |
||
3311 | case ControlType.ArrowTextControl: |
||
3312 | ca40e004 | ljiyeon | { |
3313 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3314 | 787a4489 | KangIngu | { |
3315 | if (currentControl is ArrowTextControl) |
||
3316 | { |
||
3317 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3318 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3319 | e66f22eb | KangIngu | { |
3320 | return; |
||
3321 | f513c215 | humkyung | } |
3322 | e66f22eb | KangIngu | |
3323 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3324 | 787a4489 | KangIngu | |
3325 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
3326 | (currentControl as ArrowTextControl).EnableEditing = false; |
||
3327 | 49b217ad | humkyung | (currentControl as ArrowTextControl).IsNew = false; |
3328 | 787a4489 | KangIngu | currentControl = null; |
3329 | } |
||
3330 | else |
||
3331 | { |
||
3332 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3333 | //{ |
||
3334 | 787a4489 | KangIngu | currentControl = new ArrowTextControl(); |
3335 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3336 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3337 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3338 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3339 | |||
3340 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3341 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
3342 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
3343 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3344 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
3345 | |||
3346 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3347 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
3348 | 787a4489 | KangIngu | |
3349 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
3350 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3351 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3352 | ca40e004 | ljiyeon | |
3353 | |||
3354 | e66f22eb | KangIngu | //} |
3355 | 787a4489 | KangIngu | } |
3356 | } |
||
3357 | } |
||
3358 | break; |
||
3359 | case ControlType.ArrowTransTextControl: |
||
3360 | { |
||
3361 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3362 | 787a4489 | KangIngu | { |
3363 | if (currentControl is ArrowTextControl) |
||
3364 | { |
||
3365 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3366 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3367 | e66f22eb | KangIngu | { |
3368 | return; |
||
3369 | f513c215 | humkyung | } |
3370 | e66f22eb | KangIngu | |
3371 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3372 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3373 | 49b217ad | humkyung | currentControl.IsNew = false; |
3374 | 787a4489 | KangIngu | currentControl = null; |
3375 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3376 | 787a4489 | KangIngu | } |
3377 | else |
||
3378 | { |
||
3379 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3380 | //{ |
||
3381 | 120b8b00 | 송근호 | currentControl = new ArrowTextControl() |
3382 | { |
||
3383 | ControlType = ControlType.ArrowTransTextControl |
||
3384 | }; |
||
3385 | currentControl.CommentID = Commons.shortGuid(); |
||
3386 | currentControl.IsNew = true; |
||
3387 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3388 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3389 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3390 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
3391 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
3392 | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
||
3393 | (currentControl as ArrowTextControl).isFixed = true; |
||
3394 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3395 | 787a4489 | KangIngu | |
3396 | 120b8b00 | 송근호 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3397 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
3398 | ca40e004 | ljiyeon | |
3399 | 120b8b00 | 송근호 | (currentControl as ArrowTextControl).ApplyTemplate(); |
3400 | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
||
3401 | (currentControl as ArrowTextControl).isTrans = true; |
||
3402 | 787a4489 | KangIngu | } |
3403 | } |
||
3404 | } |
||
3405 | break; |
||
3406 | case ControlType.ArrowTextBorderControl: |
||
3407 | ca40e004 | ljiyeon | { |
3408 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3409 | 787a4489 | KangIngu | { |
3410 | if (currentControl is ArrowTextControl) |
||
3411 | { |
||
3412 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3413 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3414 | e66f22eb | KangIngu | { |
3415 | return; |
||
3416 | } |
||
3417 | |||
3418 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3419 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3420 | 49b217ad | humkyung | currentControl.IsNew = false; |
3421 | 787a4489 | KangIngu | currentControl = null; |
3422 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3423 | 787a4489 | KangIngu | } |
3424 | else |
||
3425 | { |
||
3426 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3427 | //{ |
||
3428 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
3429 | { |
||
3430 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
3431 | }; |
||
3432 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3433 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3434 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3435 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3436 | |||
3437 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3438 | |||
3439 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
3440 | |||
3441 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
3442 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3443 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3444 | 787a4489 | KangIngu | |
3445 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3446 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
3447 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
3448 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3449 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
3450 | e66f22eb | KangIngu | //} |
3451 | 787a4489 | KangIngu | } |
3452 | } |
||
3453 | } |
||
3454 | break; |
||
3455 | case ControlType.ArrowTransTextBorderControl: |
||
3456 | { |
||
3457 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3458 | 787a4489 | KangIngu | { |
3459 | if (currentControl is ArrowTextControl) |
||
3460 | { |
||
3461 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3462 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3463 | e66f22eb | KangIngu | { |
3464 | return; |
||
3465 | } |
||
3466 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3467 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3468 | 49b217ad | humkyung | currentControl.IsNew = false; |
3469 | 787a4489 | KangIngu | currentControl = null; |
3470 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3471 | 787a4489 | KangIngu | } |
3472 | else |
||
3473 | { |
||
3474 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3475 | //{ |
||
3476 | ca40e004 | ljiyeon | |
3477 | |||
3478 | currentControl = new ArrowTextControl() |
||
3479 | 120b8b00 | 송근호 | { |
3480 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect, |
||
3481 | ControlType = ControlType.ArrowTransTextBorderControl |
||
3482 | |||
3483 | }; |
||
3484 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3485 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3486 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3487 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3488 | |||
3489 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3490 | |||
3491 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
3492 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
3493 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3494 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
3495 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3496 | ca40e004 | ljiyeon | |
3497 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
3498 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
3499 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).ApplyTemplate(); |
3500 | |||
3501 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3502 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3503 | ca40e004 | ljiyeon | |
3504 | //20180911 LJY |
||
3505 | (currentControl as ArrowTextControl).isTrans = true; |
||
3506 | |||
3507 | |||
3508 | e66f22eb | KangIngu | //} |
3509 | 787a4489 | KangIngu | } |
3510 | } |
||
3511 | } |
||
3512 | break; |
||
3513 | case ControlType.ArrowTextCloudControl: |
||
3514 | { |
||
3515 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3516 | 787a4489 | KangIngu | { |
3517 | if (currentControl is ArrowTextControl) |
||
3518 | { |
||
3519 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3520 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3521 | e66f22eb | KangIngu | { |
3522 | return; |
||
3523 | } |
||
3524 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3525 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3526 | 49b217ad | humkyung | currentControl.IsNew = false; |
3527 | 787a4489 | KangIngu | currentControl = null; |
3528 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3529 | 787a4489 | KangIngu | } |
3530 | else |
||
3531 | { |
||
3532 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3533 | //{ |
||
3534 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
3535 | { |
||
3536 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
3537 | }; |
||
3538 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3539 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3540 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3541 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3542 | |||
3543 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3544 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
3545 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
3546 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3547 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
3548 | |||
3549 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3550 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
3551 | |||
3552 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
3553 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3554 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
3555 | e66f22eb | KangIngu | //} |
3556 | 787a4489 | KangIngu | } |
3557 | } |
||
3558 | } |
||
3559 | break; |
||
3560 | case ControlType.ArrowTransTextCloudControl: |
||
3561 | { |
||
3562 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3563 | 787a4489 | KangIngu | { |
3564 | if (currentControl is ArrowTextControl) |
||
3565 | { |
||
3566 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3567 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3568 | e66f22eb | KangIngu | { |
3569 | return; |
||
3570 | } |
||
3571 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3572 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
3573 | 49b217ad | humkyung | currentControl.IsNew = false; |
3574 | 787a4489 | KangIngu | currentControl = null; |
3575 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3576 | 787a4489 | KangIngu | } |
3577 | else |
||
3578 | { |
||
3579 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3580 | //{ |
||
3581 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
3582 | { |
||
3583 | 120b8b00 | 송근호 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud, |
3584 | ControlType = ControlType.ArrowTransTextCloudControl |
||
3585 | |||
3586 | 787a4489 | KangIngu | }; |
3587 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3588 | ca40e004 | ljiyeon | currentControl.IsNew = true; |
3589 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
3590 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3591 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3592 | |||
3593 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
3594 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
3595 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
3596 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
3597 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
3598 | |||
3599 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3600 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
3601 | 787a4489 | KangIngu | |
3602 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
3603 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
3604 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
3605 | |||
3606 | //20180911 LJY |
||
3607 | (currentControl as ArrowTextControl).isTrans = true; |
||
3608 | e66f22eb | KangIngu | //} |
3609 | 787a4489 | KangIngu | } |
3610 | } |
||
3611 | } |
||
3612 | break; |
||
3613 | //강인구 추가 |
||
3614 | case ControlType.Sign: |
||
3615 | { |
||
3616 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3617 | 787a4489 | KangIngu | { |
3618 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3619 | //{ |
||
3620 | 661b7416 | humkyung | var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO); |
3621 | 992a98b4 | KangIngu | |
3622 | if (_sign == null) |
||
3623 | { |
||
3624 | txtBatch.Visibility = Visibility.Collapsed; |
||
3625 | mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
3626 | controlType = ControlType.None; |
||
3627 | |||
3628 | this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
||
3629 | this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
||
3630 | return; |
||
3631 | } |
||
3632 | |||
3633 | 787a4489 | KangIngu | if (currentControl is SignControl) |
3634 | { |
||
3635 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3636 | if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3637 | e66f22eb | KangIngu | { |
3638 | return; |
||
3639 | } |
||
3640 | |||
3641 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3642 | 787a4489 | KangIngu | currentControl = null; |
3643 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
3644 | { |
||
3645 | 999c9e40 | humkyung | txtBatch.Text = "Place Date"; |
3646 | 787a4489 | KangIngu | controlType = ControlType.Date; |
3647 | } |
||
3648 | } |
||
3649 | else |
||
3650 | { |
||
3651 | currentControl = new SignControl |
||
3652 | { |
||
3653 | Background = new SolidColorBrush(Colors.Black), |
||
3654 | UserNumber = App.ViewInfo.UserID, |
||
3655 | a6272c57 | humkyung | ProjectNO = App.ViewInfo.ProjectNO, |
3656 | 787a4489 | KangIngu | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
3657 | EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
3658 | ControlType = ControlType.Sign |
||
3659 | }; |
||
3660 | |||
3661 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3662 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3663 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3664 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3665 | ca40e004 | ljiyeon | |
3666 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
3667 | (currentControl as SignControl).Angle -= rotate.Angle; |
||
3668 | } |
||
3669 | e66f22eb | KangIngu | //} |
3670 | 787a4489 | KangIngu | } |
3671 | } |
||
3672 | break; |
||
3673 | case ControlType.Mark: |
||
3674 | { |
||
3675 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3676 | 787a4489 | KangIngu | { |
3677 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3678 | //{ |
||
3679 | 787a4489 | KangIngu | if (currentControl is RectangleControl) |
3680 | { |
||
3681 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3682 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3683 | e66f22eb | KangIngu | { |
3684 | return; |
||
3685 | } |
||
3686 | |||
3687 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3688 | 787a4489 | KangIngu | (currentControl as RectangleControl).ApplyOverViewData(); |
3689 | currentControl = null; |
||
3690 | 510cbd2a | ljiyeon | |
3691 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
3692 | 787a4489 | KangIngu | |
3693 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
3694 | { |
||
3695 | 999c9e40 | humkyung | txtBatch.Text = "Place Signature"; |
3696 | 787a4489 | KangIngu | controlType = ControlType.Sign; |
3697 | } |
||
3698 | } |
||
3699 | else |
||
3700 | { |
||
3701 | currentControl = new RectangleControl |
||
3702 | { |
||
3703 | a6272c57 | humkyung | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
3704 | 787a4489 | KangIngu | Background = new SolidColorBrush(Colors.Black), |
3705 | a6272c57 | humkyung | ControlType = ControlType.Mark , |
3706 | 787a4489 | KangIngu | Paint = PaintSet.Fill |
3707 | }; |
||
3708 | |||
3709 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3710 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3711 | 787a4489 | KangIngu | currentControl.IsNew = true; |
3712 | (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
||
3713 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3714 | } |
||
3715 | e66f22eb | KangIngu | //} |
3716 | 787a4489 | KangIngu | } |
3717 | } |
||
3718 | break; |
||
3719 | case ControlType.Symbol: |
||
3720 | { |
||
3721 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3722 | 787a4489 | KangIngu | { |
3723 | a6272c57 | humkyung | if (currentControl is SymControl) |
3724 | { |
||
3725 | //20180906 LJY TEST IsRotationDrawingEnable |
||
3726 | if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3727 | 787a4489 | KangIngu | { |
3728 | a6272c57 | humkyung | return; |
3729 | 787a4489 | KangIngu | } |
3730 | a6272c57 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3731 | currentControl = null; |
||
3732 | |||
3733 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
3734 | } |
||
3735 | else |
||
3736 | { |
||
3737 | currentControl = new SymControl |
||
3738 | 787a4489 | KangIngu | { |
3739 | a6272c57 | humkyung | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
3740 | Background = new SolidColorBrush(Colors.Black), |
||
3741 | LineSize = ViewerDataModel.Instance.LineSize + 3, |
||
3742 | ControlType = ControlType.Symbol |
||
3743 | }; |
||
3744 | 787a4489 | KangIngu | |
3745 | a6272c57 | humkyung | currentControl.IsNew = true; |
3746 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3747 | currentControl.CommentID = Commons.shortGuid(); |
||
3748 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3749 | ca40e004 | ljiyeon | |
3750 | a6272c57 | humkyung | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3751 | (currentControl as SymControl).Angle -= rotate.Angle; |
||
3752 | ca40e004 | ljiyeon | } |
3753 | e66f22eb | KangIngu | //} |
3754 | 787a4489 | KangIngu | } |
3755 | } |
||
3756 | break; |
||
3757 | case ControlType.Stamp: |
||
3758 | { |
||
3759 | e6a9ddaf | humkyung | if (e.LeftButton == MouseButtonState.Pressed) |
3760 | 787a4489 | KangIngu | { |
3761 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3762 | //{ |
||
3763 | 787a4489 | KangIngu | if (currentControl is SymControlN) |
3764 | { |
||
3765 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3766 | if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3767 | e66f22eb | KangIngu | { |
3768 | return; |
||
3769 | } |
||
3770 | |||
3771 | f513c215 | humkyung | CreateCommand.Instance.Execute(currentControl); |
3772 | 787a4489 | KangIngu | currentControl = null; |
3773 | 510cbd2a | ljiyeon | |
3774 | |||
3775 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
3776 | 787a4489 | KangIngu | } |
3777 | else |
||
3778 | { |
||
3779 | currentControl = new SymControlN |
||
3780 | { |
||
3781 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
3782 | Background = new SolidColorBrush(Colors.Black), |
||
3783 | a6272c57 | humkyung | STAMP = App.SystemInfo.STAMP, |
3784 | 787a4489 | KangIngu | ControlType = ControlType.Stamp |
3785 | }; |
||
3786 | |||
3787 | currentControl.IsNew = true; |
||
3788 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3789 | 24678e06 | humkyung | currentControl.CommentID = Commons.shortGuid(); |
3790 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
3791 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
3792 | (currentControl as SymControlN).Angle -= rotate.Angle; |
||
3793 | } |
||
3794 | e66f22eb | KangIngu | //} |
3795 | 787a4489 | KangIngu | } |
3796 | } |
||
3797 | break; |
||
3798 | case ControlType.PenControl: |
||
3799 | { |
||
3800 | if (inkBoard.Tag.ToString() == "Ink") |
||
3801 | { |
||
3802 | inkBoard.IsEnabled = true; |
||
3803 | StartNewStroke(canvasDrawingMouseDownPoint); |
||
3804 | } |
||
3805 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
3806 | { |
||
3807 | RemovePointStroke(canvasDrawingMouseDownPoint); |
||
3808 | } |
||
3809 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
3810 | { |
||
3811 | RemoveLineStroke(canvasDrawingMouseDownPoint); |
||
3812 | } |
||
3813 | IsDrawing = true; |
||
3814 | return; |
||
3815 | } |
||
3816 | default: |
||
3817 | if (currentControl != null) |
||
3818 | { |
||
3819 | currentControl.CommentID = null; |
||
3820 | currentControl.IsNew = false; |
||
3821 | } |
||
3822 | break; |
||
3823 | } |
||
3824 | } |
||
3825 | e6a9ddaf | humkyung | if (mouseHandlingMode != MouseHandlingMode.None && e.LeftButton == MouseButtonState.Pressed) |
3826 | 787a4489 | KangIngu | { |
3827 | if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
||
3828 | { |
||
3829 | bool mouseOff = false; |
||
3830 | foreach (var item in SelectLayer.Children) |
||
3831 | { |
||
3832 | if (item is AdornerFinal) |
||
3833 | { |
||
3834 | |||
3835 | 4913851c | humkyung | var over = (item as AdornerFinal).Members.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
3836 | 787a4489 | KangIngu | if (over != null) |
3837 | { |
||
3838 | mouseOff = true; |
||
3839 | } |
||
3840 | } |
||
3841 | } |
||
3842 | |||
3843 | if (!mouseOff) |
||
3844 | { |
||
3845 | 077896be | humkyung | SelectionSet.Instance.UnSelect(this); |
3846 | 787a4489 | KangIngu | } |
3847 | } |
||
3848 | zoomAndPanControl.CaptureMouse(); |
||
3849 | e.Handled = true; |
||
3850 | } |
||
3851 | } |
||
3852 | e54660e8 | KangIngu | |
3853 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
3854 | { |
||
3855 | e6a9ddaf | humkyung | ///mouseButtonDown = e.ChangedButton; |
3856 | a1716fa5 | KangIngu | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
3857 | } |
||
3858 | |||
3859 | 787a4489 | KangIngu | private void RemoveLineStroke(Point P) |
3860 | { |
||
3861 | 05009a0e | ljiyeon | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
3862 | 787a4489 | KangIngu | if (control != null) |
3863 | { |
||
3864 | f729ef4e | humkyung | DeleteCommand.Instance.Execute(new List<CommentUserInfo>() { control }); |
3865 | 787a4489 | KangIngu | } |
3866 | } |
||
3867 | |||
3868 | private void RemovePointStroke(Point P) |
||
3869 | { |
||
3870 | foreach (Stroke hits in inkBoard.Strokes) |
||
3871 | { |
||
3872 | foreach (StylusPoint sty in hits.StylusPoints) |
||
3873 | { |
||
3874 | |||
3875 | } |
||
3876 | if (hits.HitTest(P)) |
||
3877 | { |
||
3878 | inkBoard.Strokes.Remove(hits); |
||
3879 | return; |
||
3880 | } |
||
3881 | } |
||
3882 | } |
||
3883 | |||
3884 | private void StartNewStroke(Point P) |
||
3885 | { |
||
3886 | strokePoints = new StylusPointCollection(); |
||
3887 | StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
||
3888 | strokePoints.Add(segment1Start); |
||
3889 | stroke = new Stroke(strokePoints); |
||
3890 | |||
3891 | stroke.DrawingAttributes.Color = Colors.Red; |
||
3892 | stroke.DrawingAttributes.Width = 4; |
||
3893 | stroke.DrawingAttributes.Height = 4; |
||
3894 | |||
3895 | inkBoard.Strokes.Add(stroke); |
||
3896 | } |
||
3897 | |||
3898 | private void btnConsolidate_Click(object sender, RoutedEventArgs e) |
||
3899 | { |
||
3900 | ConsolidationMethod(); |
||
3901 | } |
||
3902 | |||
3903 | 102476f6 | humkyung | /// <summary> |
3904 | /// execute TeamConsolidationCommand |
||
3905 | /// </summary> |
||
3906 | 04a7385a | djkim | public void TeamConsolidationMethod() |
3907 | { |
||
3908 | 102476f6 | humkyung | this.UpdateMyMarkupList(); |
3909 | 04a7385a | djkim | if (this.gridViewMarkup.SelectedItems.Count == 0) |
3910 | { |
||
3911 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
3912 | } |
||
3913 | else |
||
3914 | { |
||
3915 | 8129f2a5 | ljiyeon | |
3916 | ViewerDataModel.Instance.IsConsolidate = true; |
||
3917 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
3918 | |||
3919 | 04a7385a | djkim | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
3920 | { |
||
3921 | if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
||
3922 | { |
||
3923 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
||
3924 | return; |
||
3925 | } |
||
3926 | } |
||
3927 | 102476f6 | humkyung | List<MarkupInfoItem> MarkupInfoList = new List<MarkupInfoItem>(); |
3928 | 04a7385a | djkim | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
3929 | 90e7968d | ljiyeon | { |
3930 | 102476f6 | humkyung | MarkupInfoList.Add(item); |
3931 | 04a7385a | djkim | } |
3932 | 102476f6 | humkyung | TeamConsolidateCommand.Instance.Execute(MarkupInfoList); |
3933 | 04a7385a | djkim | } |
3934 | } |
||
3935 | 102476f6 | humkyung | |
3936 | 787a4489 | KangIngu | public void ConsolidationMethod() |
3937 | { |
||
3938 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
3939 | { |
||
3940 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
3941 | } |
||
3942 | else |
||
3943 | 90e7968d | ljiyeon | { |
3944 | 35a96e24 | humkyung | List<IKCOM.MarkupInfoItem> MySelectItem = new List<IKCOM.MarkupInfoItem>(); |
3945 | foreach (var item in this.gridViewMarkup.SelectedItems) |
||
3946 | { |
||
3947 | MySelectItem.Add(item as IKCOM.MarkupInfoItem); |
||
3948 | } |
||
3949 | int iPageNo = Convert.ToInt32(this.ParentOfType<MainWindow>().dzTopMenu.tlcurrentPage.Text); |
||
3950 | 8129f2a5 | ljiyeon | |
3951 | 35a96e24 | humkyung | ConsolidateCommand.Instance.Execute(MySelectItem, iPageNo); |
3952 | 787a4489 | KangIngu | } |
3953 | } |
||
3954 | |||
3955 | private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
3956 | { |
||
3957 | if (App.ViewInfo != null) |
||
3958 | { |
||
3959 | btnConsolidate = (sender as RadRibbonButton); |
||
3960 | if (!App.ViewInfo.NewCommentPermission) |
||
3961 | { |
||
3962 | (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
||
3963 | } |
||
3964 | } |
||
3965 | } |
||
3966 | |||
3967 | private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
||
3968 | { |
||
3969 | 04a7385a | djkim | TeamConsolidationMethod(); |
3970 | 787a4489 | KangIngu | } |
3971 | |||
3972 | private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
3973 | { |
||
3974 | btnTeamConsolidate = sender as RadRibbonButton; |
||
3975 | if (App.ViewInfo != null) |
||
3976 | { |
||
3977 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
3978 | { |
||
3979 | if (btnConsolidate != null) |
||
3980 | { |
||
3981 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
3982 | } |
||
3983 | |||
3984 | if (!App.ViewInfo.NewCommentPermission) |
||
3985 | { |
||
3986 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
3987 | } |
||
3988 | } |
||
3989 | else |
||
3990 | { |
||
3991 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
3992 | } |
||
3993 | } |
||
3994 | } |
||
3995 | |||
3996 | private void FinalPDFEvent(object sender, RoutedEventArgs e) |
||
3997 | { |
||
3998 | var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
3999 | if (item != null) |
||
4000 | { |
||
4001 | 90e7968d | ljiyeon | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
4002 | 0f065e57 | ljiyeon | |
4003 | 787a4489 | KangIngu | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
4004 | } |
||
4005 | else |
||
4006 | { |
||
4007 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
4008 | } |
||
4009 | } |
||
4010 | |||
4011 | private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
4012 | { |
||
4013 | btnFinalPDF = sender as RadRibbonButton; |
||
4014 | if (App.ViewInfo != null) |
||
4015 | { |
||
4016 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
4017 | { |
||
4018 | btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
||
4019 | if (btnConsolidate != null) |
||
4020 | { |
||
4021 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
4022 | } |
||
4023 | } |
||
4024 | } |
||
4025 | } |
||
4026 | |||
4027 | 80458c15 | ljiyeon | private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e) |
4028 | { |
||
4029 | d62c0439 | humkyung | UpdateMyMarkupList(); |
4030 | 80458c15 | ljiyeon | |
4031 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
4032 | { |
||
4033 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
4034 | } |
||
4035 | else |
||
4036 | { |
||
4037 | ViewerDataModel.Instance.IsConsolidate = true; |
||
4038 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
4039 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
4040 | |||
4041 | string project_no = App.ViewInfo.ProjectNO; |
||
4042 | string doc_id = _DocInfo.ID; |
||
4043 | string user_id = App.ViewInfo.UserID; |
||
4044 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
4045 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
4046 | { |
||
4047 | markupInfoItems.Add(item); |
||
4048 | } |
||
4049 | Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
||
4050 | Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
4051 | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
4052 | 1126281e | djkim | var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID); |
4053 | 80458c15 | ljiyeon | |
4054 | 1126281e | djkim | var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
4055 | 80458c15 | ljiyeon | if (item2 != null) |
4056 | { |
||
4057 | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
||
4058 | |||
4059 | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID); |
||
4060 | 1126281e | djkim | BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
4061 | 80458c15 | ljiyeon | } |
4062 | else |
||
4063 | { |
||
4064 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
4065 | } |
||
4066 | 90e7968d | ljiyeon | } |
4067 | 80458c15 | ljiyeon | } |
4068 | |||
4069 | private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
4070 | 90e7968d | ljiyeon | { |
4071 | 80458c15 | ljiyeon | btnConsolidateFinalPDF = (sender as RadRibbonButton); |
4072 | |||
4073 | if (App.ViewInfo != null) |
||
4074 | { |
||
4075 | if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission) |
||
4076 | { |
||
4077 | 90e7968d | ljiyeon | btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
4078 | 80458c15 | ljiyeon | } |
4079 | 90e7968d | ljiyeon | } |
4080 | 80458c15 | ljiyeon | } |
4081 | |||
4082 | 787a4489 | KangIngu | private void SyncCompare_Click(object sender, RoutedEventArgs e) |
4083 | { |
||
4084 | if (CompareMode.IsChecked) |
||
4085 | { |
||
4086 | if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
4087 | { |
||
4088 | ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
4089 | } |
||
4090 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
4091 | { |
||
4092 | ViewerDataModel.Instance.PageNumber = 1; |
||
4093 | } |
||
4094 | |||
4095 | 90e7968d | ljiyeon | Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + |
4096 | 0f065e57 | ljiyeon | "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + |
4097 | 90e7968d | ljiyeon | userData.COMPANY != "EXT" ? "true" : "false", 1); |
4098 | 0f065e57 | ljiyeon | |
4099 | d9cf7d6e | djkim | BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
4100 | 787a4489 | KangIngu | } |
4101 | else |
||
4102 | { |
||
4103 | da.From = 1; |
||
4104 | da.To = 1; |
||
4105 | da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
||
4106 | da.AutoReverse = false; |
||
4107 | canvas_compareBorder.Children.Clear(); |
||
4108 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
4109 | } |
||
4110 | } |
||
4111 | |||
4112 | 9cd2865b | KangIngu | private void Sync_Click(object sender, RoutedEventArgs e) |
4113 | { |
||
4114 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
4115 | 9cd2865b | KangIngu | { |
4116 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
4117 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
4118 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
4119 | } |
||
4120 | } |
||
4121 | |||
4122 | 787a4489 | KangIngu | private void SyncUserListExpender_Click(object sender, RoutedEventArgs e) |
4123 | { |
||
4124 | if (UserList.IsChecked) |
||
4125 | { |
||
4126 | this.gridViewRevMarkup.Visibility = Visibility.Visible; |
||
4127 | } |
||
4128 | else |
||
4129 | { |
||
4130 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
4131 | } |
||
4132 | } |
||
4133 | |||
4134 | private void SyncPageBalance_Click(object sender, RoutedEventArgs e) |
||
4135 | { |
||
4136 | |||
4137 | if (BalanceMode.IsChecked) |
||
4138 | { |
||
4139 | ViewerDataModel.Instance.PageBalanceMode = true; |
||
4140 | } |
||
4141 | else |
||
4142 | { |
||
4143 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
4144 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
4145 | } |
||
4146 | } |
||
4147 | |||
4148 | private void SyncExit_Click(object sender, RoutedEventArgs e) |
||
4149 | { |
||
4150 | //초기화 |
||
4151 | testPanel2.IsHidden = true; |
||
4152 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
4153 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
4154 | ViewerDataModel.Instance.PageNumber = 0; |
||
4155 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
4156 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
4157 | UserList.IsChecked = false; |
||
4158 | BalanceMode.IsChecked = false; |
||
4159 | } |
||
4160 | |||
4161 | private void SyncPageChange_Click(object sender, RoutedEventArgs e) |
||
4162 | { |
||
4163 | if ((sender as System.Windows.Controls.Control).Tag != null) |
||
4164 | { |
||
4165 | //Compare 초기화 |
||
4166 | CompareMode.IsChecked = false; |
||
4167 | var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag); |
||
4168 | |||
4169 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
4170 | { |
||
4171 | ViewerDataModel.Instance.PageNumber = 1; |
||
4172 | } |
||
4173 | |||
4174 | if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount) |
||
4175 | { |
||
4176 | } |
||
4177 | else |
||
4178 | { |
||
4179 | ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
||
4180 | } |
||
4181 | |||
4182 | if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0) |
||
4183 | { |
||
4184 | |||
4185 | } |
||
4186 | else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1) |
||
4187 | { |
||
4188 | ViewerDataModel.Instance.PageNumber += balancePoint; |
||
4189 | } |
||
4190 | |||
4191 | if (!testPanel2.IsHidden) |
||
4192 | { |
||
4193 | if (IsSyncPDFMode) |
||
4194 | { |
||
4195 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
4196 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
4197 | |||
4198 | if (pdfpath.IsDownloading) |
||
4199 | { |
||
4200 | pdfpath.DownloadCompleted += (ex, arg) => |
||
4201 | { |
||
4202 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4203 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4204 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4205 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4206 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4207 | }; |
||
4208 | } |
||
4209 | else |
||
4210 | { |
||
4211 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4212 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4213 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4214 | |||
4215 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4216 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4217 | } |
||
4218 | |||
4219 | } |
||
4220 | else |
||
4221 | { |
||
4222 | a874198d | humkyung | string uri = ""; |
4223 | |||
4224 | if (userData.COMPANY != "EXT") |
||
4225 | { |
||
4226 | 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); |
4227 | a874198d | humkyung | } |
4228 | else |
||
4229 | { |
||
4230 | 84c48033 | djkim | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
4231 | a874198d | humkyung | } |
4232 | 787a4489 | KangIngu | |
4233 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
4234 | |||
4235 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4236 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4237 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4238 | |||
4239 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
4240 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
4241 | |||
4242 | if (defaultBitmapImage_Compare.IsDownloading) |
||
4243 | { |
||
4244 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
4245 | { |
||
4246 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4247 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4248 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4249 | |||
4250 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
4251 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
4252 | }; |
||
4253 | } |
||
4254 | } |
||
4255 | |||
4256 | //강인구 추가(페이지 이동시 코멘트 재 호출) |
||
4257 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
4258 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
4259 | |||
4260 | foreach (var item in gridSelectionRevItem) |
||
4261 | { |
||
4262 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
4263 | { |
||
4264 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
4265 | 787a4489 | KangIngu | }); |
4266 | } |
||
4267 | e54660e8 | KangIngu | |
4268 | 787a4489 | KangIngu | //강인구 추가 |
4269 | zoomAndPanControl2.ZoomTo(new Rect |
||
4270 | { |
||
4271 | X = 0, |
||
4272 | Y = 0, |
||
4273 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
4274 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
4275 | }); |
||
4276 | ae56d52d | KangIngu | |
4277 | 787a4489 | KangIngu | tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber); |
4278 | |||
4279 | } |
||
4280 | } |
||
4281 | } |
||
4282 | |||
4283 | private void SyncChange_Click(object sender, RoutedEventArgs e) |
||
4284 | { |
||
4285 | if (MarkupMode.IsChecked) |
||
4286 | { |
||
4287 | IsSyncPDFMode = true; |
||
4288 | |||
4289 | var uri = CurrentRev.TO_VENDOR; |
||
4290 | ae56d52d | KangIngu | |
4291 | 787a4489 | KangIngu | if (ViewerDataModel.Instance.PageNumber == 0) |
4292 | { |
||
4293 | ViewerDataModel.Instance.PageNumber = 1; |
||
4294 | } |
||
4295 | |||
4296 | //PDF모드 잠시 대기(강인구) |
||
4297 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
4298 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
4299 | |||
4300 | if (pdfpath.IsDownloading) |
||
4301 | { |
||
4302 | pdfpath.DownloadCompleted += (ex, arg) => |
||
4303 | { |
||
4304 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4305 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4306 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4307 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4308 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4309 | }; |
||
4310 | } |
||
4311 | else |
||
4312 | { |
||
4313 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
4314 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
4315 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
4316 | |||
4317 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
4318 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
4319 | } |
||
4320 | } |
||
4321 | else |
||
4322 | { |
||
4323 | IsSyncPDFMode = false; |
||
4324 | a874198d | humkyung | string uri = ""; |
4325 | if (userData.COMPANY != "EXT") |
||
4326 | { |
||
4327 | 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); |
4328 | a874198d | humkyung | } |
4329 | else |
||
4330 | { |
||
4331 | 84c48033 | djkim | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
4332 | a874198d | humkyung | } |
4333 | 787a4489 | KangIngu | |
4334 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
4335 | |||
4336 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4337 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4338 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4339 | |||
4340 | if (defaultBitmapImage_Compare.IsDownloading) |
||
4341 | { |
||
4342 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
4343 | { |
||
4344 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4345 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4346 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4347 | }; |
||
4348 | } |
||
4349 | zoomAndPanControl2.ApplyTemplate(); |
||
4350 | zoomAndPanControl2.UpdateLayout(); |
||
4351 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
4352 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
4353 | } |
||
4354 | } |
||
4355 | |||
4356 | private void RadButton_Click(object sender, RoutedEventArgs e) |
||
4357 | { |
||
4358 | gridViewHistory_Busy.IsBusy = true; |
||
4359 | |||
4360 | RadButton instance = sender as RadButton; |
||
4361 | if (instance.CommandParameter != null) |
||
4362 | { |
||
4363 | CurrentRev = instance.CommandParameter as VPRevision; |
||
4364 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
4365 | { |
||
4366 | if (ea.Error == null && ea.Result != null) |
||
4367 | { |
||
4368 | testPanel2.IsHidden = false; |
||
4369 | |||
4370 | d128ceb2 | humkyung | ViewerDataModel.Instance._markupInfoRevList.Clear(); |
4371 | foreach(var info in ea.Result) |
||
4372 | { |
||
4373 | if(info.UserID == App.ViewInfo.UserID) |
||
4374 | { |
||
4375 | info.userDelete = true; |
||
4376 | info.DisplayColor = "FFFF0000"; |
||
4377 | } |
||
4378 | else |
||
4379 | { |
||
4380 | info.userDelete = false; |
||
4381 | } |
||
4382 | ViewerDataModel.Instance._markupInfoRevList.Add(info); |
||
4383 | } |
||
4384 | 787a4489 | KangIngu | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
4385 | |||
4386 | a874198d | humkyung | string uri = ""; |
4387 | if (userData.COMPANY != "EXT") |
||
4388 | { |
||
4389 | 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); |
4390 | a874198d | humkyung | } |
4391 | else |
||
4392 | { |
||
4393 | 84c48033 | djkim | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
4394 | a874198d | humkyung | } |
4395 | 787a4489 | KangIngu | |
4396 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
4397 | |||
4398 | 497bbe52 | ljiyeon | var defaultBitmapImage_Compare = new BitmapImage(); |
4399 | defaultBitmapImage_Compare.BeginInit(); |
||
4400 | defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad; |
||
4401 | defaultBitmapImage_Compare.UriSource = new Uri(uri); |
||
4402 | defaultBitmapImage_Compare.EndInit(); |
||
4403 | 787a4489 | KangIngu | |
4404 | if (defaultBitmapImage_Compare.IsDownloading) |
||
4405 | { |
||
4406 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
4407 | { |
||
4408 | 497bbe52 | ljiyeon | defaultBitmapImage_Compare.Freeze(); |
4409 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
4410 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4411 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4412 | 497bbe52 | ljiyeon | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
4413 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
4414 | 787a4489 | KangIngu | }; |
4415 | 497bbe52 | ljiyeon | } |
4416 | 787a4489 | KangIngu | zoomAndPanControl2.ApplyTemplate(); |
4417 | zoomAndPanControl2.UpdateLayout(); |
||
4418 | 497bbe52 | ljiyeon | //syncPannelRotate(zoomAndPanControl.RotationAngle); |
4419 | 787a4489 | KangIngu | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
4420 | { |
||
4421 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
4422 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
4423 | } |
||
4424 | |||
4425 | 9cd2865b | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X; |
4426 | ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y; |
||
4427 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
4428 | |||
4429 | 787a4489 | KangIngu | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
4430 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
4431 | gridViewHistory_Busy.IsBusy = false; |
||
4432 | } |
||
4433 | 0f065e57 | ljiyeon | |
4434 | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
||
4435 | 90e7968d | ljiyeon | }; |
4436 | 787a4489 | KangIngu | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
4437 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
4438 | 787a4489 | KangIngu | } |
4439 | } |
||
4440 | 4eb052e4 | ljiyeon | |
4441 | 94b7c12c | djkim | private void EnsembleLink_Button_Click(object sender, RoutedEventArgs e) |
4442 | { |
||
4443 | try |
||
4444 | { |
||
4445 | if (sender is RadButton) |
||
4446 | { |
||
4447 | if ((sender as RadButton).Tag != null) |
||
4448 | { |
||
4449 | var url = (sender as RadButton).Tag.ToString(); |
||
4450 | System.Diagnostics.Process.Start(url); |
||
4451 | } |
||
4452 | else |
||
4453 | { |
||
4454 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Link 정보가 잘못 되었습니다", "안내"); |
||
4455 | } |
||
4456 | } |
||
4457 | } |
||
4458 | catch (Exception ex) |
||
4459 | { |
||
4460 | Logger.sendResLog("EnsembleLink_Button_Click", ex.Message, 0); |
||
4461 | } |
||
4462 | } |
||
4463 | 787a4489 | KangIngu | |
4464 | public void Sync_Event(VPRevision Currnet_Rev) |
||
4465 | { |
||
4466 | CurrentRev = Currnet_Rev; |
||
4467 | |||
4468 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
4469 | { |
||
4470 | if (ea.Error == null && ea.Result != null) |
||
4471 | { |
||
4472 | testPanel2.IsHidden = false; |
||
4473 | |||
4474 | d128ceb2 | humkyung | ViewerDataModel.Instance._markupInfoRevList.Clear(); |
4475 | foreach(var info in ea.Result) |
||
4476 | { |
||
4477 | if(info.UserID == App.ViewInfo.UserID) |
||
4478 | { |
||
4479 | info.userDelete = true; |
||
4480 | info.DisplayColor = "FFFF0000"; |
||
4481 | } |
||
4482 | else |
||
4483 | { |
||
4484 | info.userDelete = false; |
||
4485 | } |
||
4486 | ViewerDataModel.Instance._markupInfoRevList.Add(info); |
||
4487 | } |
||
4488 | 787a4489 | KangIngu | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
4489 | |||
4490 | a874198d | humkyung | string uri = ""; |
4491 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
4492 | a874198d | humkyung | { |
4493 | 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); |
4494 | a874198d | humkyung | } |
4495 | else |
||
4496 | { |
||
4497 | 84c48033 | djkim | uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
4498 | a874198d | humkyung | } |
4499 | 787a4489 | KangIngu | |
4500 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
4501 | |||
4502 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
4503 | |||
4504 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4505 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4506 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4507 | |||
4508 | if (defaultBitmapImage_Compare.IsDownloading) |
||
4509 | { |
||
4510 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
4511 | { |
||
4512 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
4513 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
4514 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
4515 | }; |
||
4516 | } |
||
4517 | 90e7968d | ljiyeon | |
4518 | |||
4519 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
4520 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
4521 | zoomAndPanControl2.ApplyTemplate(); |
||
4522 | zoomAndPanControl2.UpdateLayout(); |
||
4523 | |||
4524 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
4525 | { |
||
4526 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
4527 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
4528 | } |
||
4529 | //} |
||
4530 | |||
4531 | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
||
4532 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
4533 | 90e7968d | ljiyeon | gridViewHistory_Busy.IsBusy = false; |
4534 | 787a4489 | KangIngu | } |
4535 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
4536 | 90e7968d | ljiyeon | |
4537 | 787a4489 | KangIngu | }; |
4538 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
4539 | 90e7968d | ljiyeon | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
4540 | 787a4489 | KangIngu | } |
4541 | |||
4542 | private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e) |
||
4543 | { |
||
4544 | if (sender is Image) |
||
4545 | { |
||
4546 | if ((sender as Image).Tag != null) |
||
4547 | { |
||
4548 | var pdfUrl = (sender as Image).Tag.ToString(); |
||
4549 | System.Diagnostics.Process.Start(pdfUrl); |
||
4550 | } |
||
4551 | else |
||
4552 | { |
||
4553 | this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내"); |
||
4554 | } |
||
4555 | } |
||
4556 | } |
||
4557 | |||
4558 | private void Create_Symbol(object sender, RoutedEventArgs e) |
||
4559 | { |
||
4560 | 5529d2a2 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
4561 | 787a4489 | KangIngu | |
4562 | if (SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
4563 | { |
||
4564 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
4565 | } |
||
4566 | else //선택된 것이 있으면 |
||
4567 | { |
||
4568 | string MarkupData = ""; |
||
4569 | adorner_ = new AdornerFinal(); |
||
4570 | |||
4571 | foreach (var item in SelectLayer.Children) |
||
4572 | { |
||
4573 | if (item.GetType().Name == "AdornerFinal") |
||
4574 | { |
||
4575 | adorner_ = (item as Controls.AdornerFinal); |
||
4576 | 4913851c | humkyung | foreach (var InnerItem in (item as Controls.AdornerFinal).Members.Cast<Controls.AdornerMember>()) |
4577 | 787a4489 | KangIngu | { |
4578 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
4579 | { |
||
4580 | 5529d2a2 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
4581 | 787a4489 | KangIngu | MarkupData += markupReturn.ConvertData; |
4582 | } |
||
4583 | } |
||
4584 | } |
||
4585 | } |
||
4586 | DialogParameters parameters = new DialogParameters() |
||
4587 | { |
||
4588 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
4589 | 787a4489 | KangIngu | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
4590 | DefaultPromptResultValue = "Custom State", |
||
4591 | Content = "Name :", |
||
4592 | Header = "Insert Custom Symbol Name", |
||
4593 | Theme = new VisualStudio2013Theme(), |
||
4594 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
4595 | }; |
||
4596 | RadWindow.Prompt(parameters); |
||
4597 | } |
||
4598 | |||
4599 | } |
||
4600 | 53880c83 | ljiyeon | public int symbolselectindex = 0; |
4601 | private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args) |
||
4602 | { |
||
4603 | //Save save = new Save(); |
||
4604 | try |
||
4605 | { |
||
4606 | string svgfilename = null; |
||
4607 | if (symbolname != null) |
||
4608 | { |
||
4609 | if (symbolpng == true || symbolsvg == true) |
||
4610 | { |
||
4611 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
4612 | 24678e06 | humkyung | string guid = Commons.shortGuid(); |
4613 | 53880c83 | ljiyeon | |
4614 | fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte); |
||
4615 | c73426a9 | ljiyeon | //Check_Uri.UriCheck(); |
4616 | 53880c83 | ljiyeon | fileUploader.RunCompleted += (ex, arg) => |
4617 | { |
||
4618 | filename = arg.Result; |
||
4619 | if (symbolpng == true) |
||
4620 | { |
||
4621 | if (filename != null) |
||
4622 | { |
||
4623 | if (symbolselectindex == 0) |
||
4624 | { |
||
4625 | SymbolSave(symbolname, filename, data); |
||
4626 | } |
||
4627 | else |
||
4628 | { |
||
4629 | SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
4630 | } |
||
4631 | DataBind(); |
||
4632 | } |
||
4633 | } |
||
4634 | |||
4635 | if (symbolsvg == true) |
||
4636 | { |
||
4637 | c73426a9 | ljiyeon | try |
4638 | 53880c83 | ljiyeon | { |
4639 | c73426a9 | ljiyeon | var defaultBitmapImage = new BitmapImage(); |
4640 | defaultBitmapImage.BeginInit(); |
||
4641 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
4642 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
4643 | Check_Uri.UriCheck(filename); |
||
4644 | defaultBitmapImage.UriSource = new Uri(filename); |
||
4645 | defaultBitmapImage.EndInit(); |
||
4646 | 53880c83 | ljiyeon | |
4647 | c73426a9 | ljiyeon | System.Drawing.Bitmap image; |
4648 | 53880c83 | ljiyeon | |
4649 | c73426a9 | ljiyeon | if (defaultBitmapImage.IsDownloading) |
4650 | { |
||
4651 | defaultBitmapImage.DownloadCompleted += (ex2, arg2) => |
||
4652 | 53880c83 | ljiyeon | { |
4653 | c73426a9 | ljiyeon | defaultBitmapImage.Freeze(); |
4654 | image = GetBitmap(defaultBitmapImage); |
||
4655 | image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp); |
||
4656 | Process potrace = new Process |
||
4657 | 53880c83 | ljiyeon | { |
4658 | c73426a9 | ljiyeon | StartInfo = new ProcessStartInfo |
4659 | { |
||
4660 | FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
||
4661 | Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
||
4662 | RedirectStandardInput = true, |
||
4663 | RedirectStandardOutput = true, |
||
4664 | RedirectStandardError = true, |
||
4665 | UseShellExecute = false, |
||
4666 | CreateNoWindow = true, |
||
4667 | WindowStyle = ProcessWindowStyle.Hidden |
||
4668 | }, |
||
4669 | }; |
||
4670 | 53880c83 | ljiyeon | |
4671 | c73426a9 | ljiyeon | StringBuilder svgBuilder = new StringBuilder(); |
4672 | potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => |
||
4673 | 53880c83 | ljiyeon | { |
4674 | c73426a9 | ljiyeon | svgBuilder.AppendLine(e2.Data); |
4675 | }; |
||
4676 | |||
4677 | potrace.EnableRaisingEvents = true; |
||
4678 | potrace.Start(); |
||
4679 | potrace.Exited += (sender, e) => |
||
4680 | 53880c83 | ljiyeon | { |
4681 | c73426a9 | ljiyeon | byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg"); |
4682 | svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
||
4683 | Check_Uri.UriCheck(svgfilename); |
||
4684 | if (symbolselectindex == 0) |
||
4685 | { |
||
4686 | SymbolSave(symbolname, svgfilename, data); |
||
4687 | } |
||
4688 | else |
||
4689 | { |
||
4690 | SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
4691 | } |
||
4692 | 53880c83 | ljiyeon | |
4693 | c73426a9 | ljiyeon | DataBind(); |
4694 | }; |
||
4695 | potrace.WaitForExit(); |
||
4696 | 53880c83 | ljiyeon | }; |
4697 | c73426a9 | ljiyeon | } |
4698 | else |
||
4699 | { |
||
4700 | //GC.Collect(); |
||
4701 | } |
||
4702 | 53880c83 | ljiyeon | } |
4703 | c73426a9 | ljiyeon | catch(Exception ee) |
4704 | 90e7968d | ljiyeon | { |
4705 | c73426a9 | ljiyeon | DialogMessage_Alert("" + ee, "Alert"); |
4706 | 90e7968d | ljiyeon | } |
4707 | 53880c83 | ljiyeon | } |
4708 | }; |
||
4709 | } |
||
4710 | } |
||
4711 | } |
||
4712 | catch (Exception e) |
||
4713 | { |
||
4714 | //DialogMessage_Alert(e + "", "Alert"); |
||
4715 | } |
||
4716 | } |
||
4717 | |||
4718 | public void SymbolSave(string Name, string Url, string Data) |
||
4719 | { |
||
4720 | try |
||
4721 | { |
||
4722 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
4723 | { |
||
4724 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
4725 | 53880c83 | ljiyeon | MEMBER_USER_ID = App.ViewInfo.UserID, |
4726 | NAME = Name, |
||
4727 | IMAGE_URL = Url, |
||
4728 | DATA = Data |
||
4729 | }; |
||
4730 | |||
4731 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
||
4732 | Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
||
4733 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
||
4734 | } |
||
4735 | catch (Exception) |
||
4736 | { |
||
4737 | throw; |
||
4738 | } |
||
4739 | } |
||
4740 | |||
4741 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
4742 | { |
||
4743 | try |
||
4744 | { |
||
4745 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
4746 | { |
||
4747 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
4748 | 53880c83 | ljiyeon | DEPARTMENT = Department, |
4749 | NAME = Name, |
||
4750 | IMAGE_URL = Url, |
||
4751 | DATA = Data |
||
4752 | }; |
||
4753 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
4754 | Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
||
4755 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
||
4756 | } |
||
4757 | catch (Exception) |
||
4758 | { |
||
4759 | throw; |
||
4760 | } |
||
4761 | } |
||
4762 | |||
4763 | private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
||
4764 | { |
||
4765 | Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
4766 | DataBind(); |
||
4767 | } |
||
4768 | |||
4769 | private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
||
4770 | { |
||
4771 | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
4772 | DataBind(); |
||
4773 | } |
||
4774 | private void DataBind() |
||
4775 | { |
||
4776 | try |
||
4777 | { |
||
4778 | Symbol_Custom Custom = new Symbol_Custom(); |
||
4779 | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
||
4780 | 5928384e | djkim | |
4781 | bb3a236d | ljiyeon | var symbol_Private = BaseClient.GetSymbolList(App.ViewInfo.UserID); |
4782 | 53880c83 | ljiyeon | foreach (var item in symbol_Private) |
4783 | { |
||
4784 | Custom.Name = item.NAME; |
||
4785 | Custom.ImageUri = item.IMAGE_URL; |
||
4786 | Custom.ID = item.ID; |
||
4787 | Custom_List.Add(Custom); |
||
4788 | Custom = new Symbol_Custom(); |
||
4789 | } |
||
4790 | symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List; |
||
4791 | |||
4792 | Custom = new Symbol_Custom(); |
||
4793 | Custom_List = new List<Symbol_Custom>(); |
||
4794 | |||
4795 | bb3a236d | ljiyeon | symbolPanel_Instance.deptlist.ItemsSource = BaseClient.GetPublicSymbolDeptList(); |
4796 | 53880c83 | ljiyeon | |
4797 | List<SYMBOL_PUBLIC> symbol_Public; |
||
4798 | 787a4489 | KangIngu | |
4799 | 53880c83 | ljiyeon | if (symbolPanel_Instance.deptlist.SelectedValue != null) |
4800 | { |
||
4801 | bb3a236d | ljiyeon | symbol_Public = BaseClient.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString()); |
4802 | 53880c83 | ljiyeon | } |
4803 | else |
||
4804 | { |
||
4805 | bb3a236d | ljiyeon | symbol_Public = BaseClient.GetPublicSymbolList(null); |
4806 | 53880c83 | ljiyeon | } |
4807 | foreach (var item in symbol_Public) |
||
4808 | { |
||
4809 | Custom.Name = item.NAME; |
||
4810 | Custom.ImageUri = item.IMAGE_URL; |
||
4811 | Custom.ID = item.ID; |
||
4812 | Custom_List.Add(Custom); |
||
4813 | Custom = new Symbol_Custom(); |
||
4814 | } |
||
4815 | symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List; |
||
4816 | bb3a236d | ljiyeon | BaseClient.Close(); |
4817 | 53880c83 | ljiyeon | } |
4818 | catch(Exception e) |
||
4819 | { |
||
4820 | //DialogMessage_Alert("DataBind", "Alert"); |
||
4821 | } |
||
4822 | |||
4823 | } |
||
4824 | 787a4489 | KangIngu | private void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
4825 | { |
||
4826 | c73426a9 | ljiyeon | try |
4827 | 787a4489 | KangIngu | { |
4828 | c73426a9 | ljiyeon | if (args.PromptResult != null) |
4829 | 53880c83 | ljiyeon | { |
4830 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
4831 | { |
||
4832 | PngBitmapEncoder _Encoder = symImage(data); |
||
4833 | 787a4489 | KangIngu | |
4834 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
4835 | _Encoder.Save(fs); |
||
4836 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
4837 | 787a4489 | KangIngu | |
4838 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
4839 | 787a4489 | KangIngu | |
4840 | c73426a9 | ljiyeon | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
4841 | 24678e06 | humkyung | filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Commons.shortGuid() + ".png", Img_byte); |
4842 | c73426a9 | ljiyeon | Check_Uri.UriCheck(filename); |
4843 | if (symbolPanel_Instance.RadTab.SelectedIndex == 0) |
||
4844 | { |
||
4845 | de6499db | humkyung | SaveCommand.Instance.SymbolSave(args.PromptResult, filename, data); |
4846 | c73426a9 | ljiyeon | } |
4847 | else |
||
4848 | { |
||
4849 | de6499db | humkyung | SaveCommand.Instance.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
4850 | c73426a9 | ljiyeon | } |
4851 | DataBind(); |
||
4852 | 53880c83 | ljiyeon | } |
4853 | } |
||
4854 | 787a4489 | KangIngu | } |
4855 | c73426a9 | ljiyeon | catch(Exception ex) |
4856 | { |
||
4857 | DialogMessage_Alert("" + ex, "Alert"); |
||
4858 | } |
||
4859 | 787a4489 | KangIngu | } |
4860 | |||
4861 | public PngBitmapEncoder symImage(string data) |
||
4862 | { |
||
4863 | |||
4864 | Canvas _canvas = new Canvas(); |
||
4865 | _canvas.Background = Brushes.White; |
||
4866 | _canvas.Width = adorner_.BorderSize.Width; |
||
4867 | _canvas.Height = adorner_.BorderSize.Height; |
||
4868 | 5529d2a2 | humkyung | MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", ""); |
4869 | 787a4489 | KangIngu | |
4870 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
4871 | |||
4872 | |||
4873 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
4874 | |||
4875 | DrawingVisual dv = new DrawingVisual(); |
||
4876 | |||
4877 | _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50)); |
||
4878 | _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))); |
||
4879 | |||
4880 | using (DrawingContext ctx = dv.RenderOpen()) |
||
4881 | { |
||
4882 | VisualBrush vb = new VisualBrush(_canvas); |
||
4883 | 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))); |
||
4884 | } |
||
4885 | |||
4886 | try |
||
4887 | { |
||
4888 | renderBitmap.Render(dv); |
||
4889 | |||
4890 | 90e7968d | ljiyeon | //GC.Collect(); |
4891 | 787a4489 | KangIngu | GC.WaitForPendingFinalizers(); |
4892 | 90e7968d | ljiyeon | //GC.Collect(); |
4893 | 787a4489 | KangIngu | // encode png data |
4894 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
4895 | // puch rendered bitmap into it |
||
4896 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
4897 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
4898 | return pngEncoder; |
||
4899 | |||
4900 | } |
||
4901 | 53880c83 | ljiyeon | catch //(Exception ex) |
4902 | 787a4489 | KangIngu | { |
4903 | return null; |
||
4904 | } |
||
4905 | |||
4906 | } |
||
4907 | |||
4908 | public void DialogMessage_Alert(string content, string header) |
||
4909 | { |
||
4910 | var box = new TextBlock(); |
||
4911 | box.MinWidth = 400; |
||
4912 | box.FontSize = 11; |
||
4913 | //box.FontSize = 12; |
||
4914 | box.Text = content; |
||
4915 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
4916 | |||
4917 | DialogParameters parameters = new DialogParameters() |
||
4918 | { |
||
4919 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
4920 | 787a4489 | KangIngu | Content = box, |
4921 | Header = header, |
||
4922 | Theme = new VisualStudio2013Theme(), |
||
4923 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
4924 | 90e7968d | ljiyeon | }; |
4925 | 787a4489 | KangIngu | RadWindow.Alert(parameters); |
4926 | } |
||
4927 | |||
4928 | #region 캡쳐 기능 |
||
4929 | |||
4930 | public BitmapSource CutAreaToImage(int x, int y, int width, int height) |
||
4931 | { |
||
4932 | if (x < 0) |
||
4933 | { |
||
4934 | width += x; |
||
4935 | x = 0; |
||
4936 | } |
||
4937 | if (y < 0) |
||
4938 | { |
||
4939 | height += y; |
||
4940 | y = 0; |
||
4941 | |||
4942 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
4943 | } |
||
4944 | if (x + width > zoomAndPanCanvas.ActualWidth) |
||
4945 | { |
||
4946 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
4947 | } |
||
4948 | if (y + height > zoomAndPanCanvas.ActualHeight) |
||
4949 | { |
||
4950 | height = (int)zoomAndPanCanvas.ActualHeight - y; |
||
4951 | } |
||
4952 | |||
4953 | byte[] pixels = CopyPixels(x, y, width, height); |
||
4954 | |||
4955 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
4956 | |||
4957 | return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride); |
||
4958 | } |
||
4959 | |||
4960 | public byte[] CopyPixels(int x, int y, int width, int height) |
||
4961 | { |
||
4962 | byte[] pixels = new byte[width * height * 4]; |
||
4963 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
4964 | |||
4965 | // Canvas 이미지에서 객체 역역만큼 픽셀로 복사 |
||
4966 | canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0); |
||
4967 | |||
4968 | return pixels; |
||
4969 | } |
||
4970 | |||
4971 | public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element) |
||
4972 | { |
||
4973 | DrawingVisual drawingVisual = new DrawingVisual(); |
||
4974 | DrawingContext drawingContext = drawingVisual.RenderOpen(); |
||
4975 | |||
4976 | // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다. |
||
4977 | drawingContext.DrawRectangle(new VisualBrush(element), null, |
||
4978 | new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight))); |
||
4979 | drawingContext.Close(); |
||
4980 | |||
4981 | // 비트맵으로 변환합니다. |
||
4982 | RenderTargetBitmap target = |
||
4983 | new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, |
||
4984 | 96, 96, System.Windows.Media.PixelFormats.Pbgra32); |
||
4985 | |||
4986 | target.Render(drawingVisual); |
||
4987 | return target; |
||
4988 | } |
||
4989 | |||
4990 | 53880c83 | ljiyeon | System.Drawing.Bitmap GetBitmap(BitmapSource source) |
4991 | { |
||
4992 | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
||
4993 | 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); |
||
4994 | source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride); |
||
4995 | bmp.UnlockBits(data); |
||
4996 | return bmp; |
||
4997 | } |
||
4998 | public string symbolname = null; |
||
4999 | public bool symbolsvg = true; |
||
5000 | public bool symbolpng = true; |
||
5001 | |||
5002 | public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height) |
||
5003 | { |
||
5004 | System.Drawing.Bitmap image = GetBitmap(source); |
||
5005 | //흰색 제거 |
||
5006 | //image.MakeTransparent(System.Drawing.Color.White); |
||
5007 | |||
5008 | var imageStream = new System.IO.MemoryStream(); |
||
5009 | byte[] imageBytes = null; |
||
5010 | using (imageStream) |
||
5011 | { |
||
5012 | image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png); |
||
5013 | // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png); |
||
5014 | imageStream.Position = 0; |
||
5015 | imageBytes = imageStream.ToArray(); |
||
5016 | } |
||
5017 | |||
5018 | SymbolPrompt symbolPrompt = new SymbolPrompt(); |
||
5019 | |||
5020 | RadWindow CheckPop = new RadWindow(); |
||
5021 | //Alert check = new Alert(Msg); |
||
5022 | |||
5023 | CheckPop = new RadWindow |
||
5024 | { |
||
5025 | MinWidth = 400, |
||
5026 | MinHeight = 100, |
||
5027 | // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
5028 | Header = "Alert", |
||
5029 | Content = symbolPrompt, |
||
5030 | //DialogResult = |
||
5031 | ResizeMode = System.Windows.ResizeMode.NoResize, |
||
5032 | WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, |
||
5033 | IsTopmost = true, |
||
5034 | }; |
||
5035 | CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args); |
||
5036 | StyleManager.SetTheme(CheckPop, new Office2013Theme()); |
||
5037 | CheckPop.ShowDialog(); |
||
5038 | |||
5039 | /* |
||
5040 | DialogParameters parameters = new DialogParameters() |
||
5041 | { |
||
5042 | Owner = Application.Current.MainWindow, |
||
5043 | Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
5044 | DefaultPromptResultValue = "Custom State", |
||
5045 | Content = "Name :", |
||
5046 | Header = "Insert Custom Symbol Name", |
||
5047 | Theme = new VisualStudio2013Theme(), |
||
5048 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5049 | }; |
||
5050 | RadWindow.Prompt(parameters); |
||
5051 | */ |
||
5052 | } |
||
5053 | |||
5054 | 787a4489 | KangIngu | public void Save_Capture(BitmapSource source, int x, int y, int width, int height) |
5055 | { |
||
5056 | KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64(); |
||
5057 | KCOMDataModel.DataModel.CHECK_LIST check_; |
||
5058 | string Result = streamToBase64.ImageToBase64(source); |
||
5059 | KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST(); |
||
5060 | 6c781c0c | djkim | string projectno = App.ViewInfo.ProjectNO; |
5061 | string checklist_id = ViewerDataModel.Instance.CheckList_ID; |
||
5062 | 0f065e57 | ljiyeon | |
5063 | Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1); |
||
5064 | 6c781c0c | djkim | Item = this.BaseClient.GetCheckList(projectno, checklist_id); |
5065 | 90e7968d | ljiyeon | if (Item != null) |
5066 | 0f065e57 | ljiyeon | { |
5067 | Logger.sendResLog("GetCheckList", "TRUE", 1); |
||
5068 | } |
||
5069 | else |
||
5070 | { |
||
5071 | Logger.sendResLog("GetCheckList", "FALSE", 1); |
||
5072 | } |
||
5073 | 90e7968d | ljiyeon | |
5074 | 6c781c0c | djkim | if (Item == null) |
5075 | 787a4489 | KangIngu | { |
5076 | 6c781c0c | djkim | check_ = new KCOMDataModel.DataModel.CHECK_LIST |
5077 | 787a4489 | KangIngu | { |
5078 | 24678e06 | humkyung | ID = Commons.shortGuid(), |
5079 | 6c781c0c | djkim | USER_ID = App.ViewInfo.UserID, |
5080 | IMAGE_URL = Result, |
||
5081 | IMAGE_ANCHOR = x + "," + y + "," + width + "," + height, |
||
5082 | PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber, |
||
5083 | REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, |
||
5084 | DOCUMENT_ID = App.ViewInfo.DocumentItemID, |
||
5085 | PROJECT_NO = App.ViewInfo.ProjectNO, |
||
5086 | STATUS = "False", |
||
5087 | CREATE_TIME = DateTime.Now, |
||
5088 | UPDATE_TIME = DateTime.Now, |
||
5089 | DOCUMENT_NO = _DocItem.DOCUMENT_NO, |
||
5090 | STATUS_DESC_OPEN = "Vendor 반영 필요", |
||
5091 | }; |
||
5092 | 0f065e57 | ljiyeon | Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1); |
5093 | Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1); |
||
5094 | //this.BaseClient.AddCheckList(projectno, check_); |
||
5095 | 787a4489 | KangIngu | } |
5096 | 6c781c0c | djkim | else |
5097 | { |
||
5098 | Item.IMAGE_URL = Result; |
||
5099 | Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height; |
||
5100 | 90e7968d | ljiyeon | Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber; |
5101 | 0f065e57 | ljiyeon | Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1); |
5102 | Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1); |
||
5103 | //this.BaseClient.SaveCheckList(projectno, checklist_id, Item); |
||
5104 | 6c781c0c | djkim | } |
5105 | 90e7968d | ljiyeon | |
5106 | 787a4489 | KangIngu | } |
5107 | |||
5108 | public void Set_Capture() |
||
5109 | 90e7968d | ljiyeon | { |
5110 | 787a4489 | KangIngu | double x = canvasDrawingMouseDownPoint.X; |
5111 | double y = canvasDrawingMouseDownPoint.Y; |
||
5112 | double width = dragCaptureBorder.Width; |
||
5113 | double height = dragCaptureBorder.Height; |
||
5114 | |||
5115 | if (width > 5 || height > 5) |
||
5116 | { |
||
5117 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
5118 | BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height); |
||
5119 | Save_Capture(source, (int)x, (int)y, (int)width, (int)height); |
||
5120 | } |
||
5121 | } |
||
5122 | #endregion |
||
5123 | |||
5124 | public Multi_Undo_data Control_Style(CommentUserInfo control) |
||
5125 | { |
||
5126 | multi_Undo_Data = new Multi_Undo_data(); |
||
5127 | |||
5128 | multi_Undo_Data.Markup = control; |
||
5129 | |||
5130 | if ((control as IShapeControl) != null) |
||
5131 | { |
||
5132 | multi_Undo_Data.paint = (control as IShapeControl).Paint; |
||
5133 | } |
||
5134 | if ((control as IDashControl) != null) |
||
5135 | { |
||
5136 | multi_Undo_Data.DashSize = (control as IDashControl).DashSize; |
||
5137 | } |
||
5138 | if ((control as IPath) != null) |
||
5139 | { |
||
5140 | multi_Undo_Data.LineSize = (control as IPath).LineSize; |
||
5141 | } |
||
5142 | if ((control as UIElement) != null) |
||
5143 | { |
||
5144 | multi_Undo_Data.Opacity = (control as UIElement).Opacity; |
||
5145 | } |
||
5146 | |||
5147 | return multi_Undo_Data; |
||
5148 | } |
||
5149 | |||
5150 | private void Comment_Move(object sender, MouseButtonEventArgs e) |
||
5151 | { |
||
5152 | string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID; |
||
5153 | foreach (var items in ViewerDataModel.Instance._markupInfoRevList) |
||
5154 | { |
||
5155 | if (items.UserID == Select_ID) |
||
5156 | { |
||
5157 | foreach (var item in items.MarkupList) |
||
5158 | { |
||
5159 | if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
||
5160 | { |
||
5161 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", |
5162 | 24678e06 | humkyung | items.MarkupInfoID, Commons.shortGuid()); |
5163 | 787a4489 | KangIngu | } |
5164 | } |
||
5165 | } |
||
5166 | } |
||
5167 | } |
||
5168 | d62c0439 | humkyung | |
5169 | f959ea6f | humkyung | /// <summary> |
5170 | /// convert inkcontrol to polygoncontrol |
||
5171 | /// </summary> |
||
5172 | public void ConvertInkControlToPolygon() |
||
5173 | 787a4489 | KangIngu | { |
5174 | if (inkBoard.Strokes.Count > 0) |
||
5175 | { |
||
5176 | inkBoard.Strokes.ToList().ForEach(stroke => |
||
5177 | { |
||
5178 | InkToPath ip = new InkToPath(); |
||
5179 | f959ea6f | humkyung | |
5180 | 787a4489 | KangIngu | List<Point> inkPointSet = new List<Point>(); |
5181 | f959ea6f | humkyung | inkPointSet.AddRange(ip.GetPointsFrom(stroke)); |
5182 | |||
5183 | PolygonControl pc = new PolygonControl() |
||
5184 | 787a4489 | KangIngu | { |
5185 | Angle = 0, |
||
5186 | f959ea6f | humkyung | PointSet = inkPointSet, |
5187 | 787a4489 | KangIngu | ControlType = ControlType.Ink |
5188 | }; |
||
5189 | f959ea6f | humkyung | pc.StartPoint = inkPointSet[0]; |
5190 | pc.EndPoint = inkPointSet[inkPointSet.Count - 1]; |
||
5191 | pc.LineSize = 3; |
||
5192 | pc.CommentID = Commons.shortGuid(); |
||
5193 | pc.StrokeColor = new SolidColorBrush(Colors.Red); |
||
5194 | 787a4489 | KangIngu | |
5195 | f959ea6f | humkyung | if (pc.PointSet.Count > 0) |
5196 | { |
||
5197 | CreateCommand.Instance.Execute(pc); |
||
5198 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Add(pc); |
5199 | } |
||
5200 | }); |
||
5201 | f959ea6f | humkyung | inkBoard.Strokes.Clear(); |
5202 | 787a4489 | KangIngu | } |
5203 | } |
||
5204 | 17a22987 | KangIngu | |
5205 | 4318fdeb | KangIngu | /// <summary> |
5206 | e66f22eb | KangIngu | /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌 |
5207 | /// </summary> |
||
5208 | /// <author>ingu</author> |
||
5209 | /// <date>2018.06.05</date> |
||
5210 | /// <param name="getPoint"></param> |
||
5211 | /// <returns></returns> |
||
5212 | private bool IsGetoutpoint(Point getPoint) |
||
5213 | 670a4be2 | humkyung | { |
5214 | e66f22eb | KangIngu | if (getPoint == new Point()) |
5215 | 670a4be2 | humkyung | { |
5216 | e66f22eb | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl); |
5217 | currentControl = null; |
||
5218 | return true; |
||
5219 | 670a4be2 | humkyung | } |
5220 | |||
5221 | e66f22eb | KangIngu | return false; |
5222 | 670a4be2 | humkyung | } |
5223 | e66f22eb | KangIngu | |
5224 | 5b46312f | djkim | private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
5225 | { |
||
5226 | e.Effects = DragDropEffects.Copy; |
||
5227 | } |
||
5228 | |||
5229 | private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
||
5230 | { |
||
5231 | e.Effects = DragDropEffects.Copy; |
||
5232 | } |
||
5233 | |||
5234 | private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
||
5235 | { |
||
5236 | e.Effects = DragDropEffects.None; |
||
5237 | } |
||
5238 | |||
5239 | d0eda156 | ljiyeon | private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e) |
5240 | { |
||
5241 | CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString()); |
||
5242 | } |
||
5243 | |||
5244 | e6a9ddaf | humkyung | /* |
5245 | 5b46312f | djkim | private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
5246 | { |
||
5247 | 90e7968d | ljiyeon | try |
5248 | 5b46312f | djkim | { |
5249 | 90e7968d | ljiyeon | if (e.Data.GetDataPresent(typeof(string))) |
5250 | { |
||
5251 | this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
5252 | string dragData = e.Data.GetData(typeof(string)) as string; |
||
5253 | Move_Symbol(sender, dragData); |
||
5254 | } |
||
5255 | 5b46312f | djkim | } |
5256 | 90e7968d | ljiyeon | catch (Exception ex) |
5257 | { |
||
5258 | Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0); |
||
5259 | } |
||
5260 | 5b46312f | djkim | } |
5261 | e6a9ddaf | humkyung | */ |
5262 | 787a4489 | KangIngu | } |
5263 | 5a6a5dd1 | humkyung | } |