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