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