개정판 315ae55e
UniqueColorGenerator.cs 추가
색상 자동 설정 수정
Change-Id: I7de4657758710c88f9d4b8bb30e53429cf1f76d1
KCOM/Controls/Symbol.xaml.cs | ||
---|---|---|
495 | 495 |
|
496 | 496 |
// 마우스 클릭된 페이지 위치 |
497 | 497 |
|
498 |
var pageWidth = mainMenu.pageNavigator.CurrentPage.Width;
|
|
499 |
var pageHeight = mainMenu.pageNavigator.CurrentPage.Height;
|
|
498 |
var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
|
|
499 |
var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
|
|
500 | 500 |
var angle = Common.ViewerDataModel.Instance.Angle; |
501 | 501 |
|
502 | 502 |
Point pagePoint = new Point(pageWidth/2, pageHeight/2); |
KCOM/Services/BaseServices.cs | ||
---|---|---|
408 | 408 |
if (currentUser == null) |
409 | 409 |
{ |
410 | 410 |
/// create a new markupinfo to do comments |
411 |
var infoId = Commons.shortGuid(); |
|
412 |
PreviewUserMarkupInfoItem = new MarkupInfoItem |
|
413 |
{ |
|
414 |
CreateTime = DateTime.Now, |
|
415 |
UpdateTime = DateTime.Now, |
|
416 |
Depatment = userData.DEPARTMENT, |
|
417 |
DisplayColor = "#FFFF0000", |
|
418 |
UserID = userData.ID, |
|
419 |
UserName = userData.NAME, |
|
420 |
PageCount = 1, |
|
421 |
Description = "", |
|
422 |
MarkupInfoID = infoId, |
|
423 |
MarkupList = null, |
|
424 |
MarkupVersionID = Commons.shortGuid(), |
|
425 |
Consolidate = 0, |
|
426 |
PartConsolidate = 0, |
|
427 |
userDelete = true, |
|
428 |
AvoidConsolidate = 0, |
|
429 |
IsPreviewUser = false |
|
430 |
}; |
|
431 |
|
|
432 |
App.Custom_ViewInfoId = infoId; |
|
433 |
|
|
434 |
ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
|
411 |
//var infoId = Commons.shortGuid();
|
|
412 |
//PreviewUserMarkupInfoItem = new MarkupInfoItem
|
|
413 |
//{
|
|
414 |
// CreateTime = DateTime.Now,
|
|
415 |
// UpdateTime = DateTime.Now,
|
|
416 |
// Depatment = userData.DEPARTMENT,
|
|
417 |
// DisplayColor = "#FFFF0000",
|
|
418 |
// UserID = userData.ID,
|
|
419 |
// UserName = userData.NAME,
|
|
420 |
// PageCount = 1,
|
|
421 |
// Description = "",
|
|
422 |
// MarkupInfoID = infoId,
|
|
423 |
// MarkupList = null,
|
|
424 |
// MarkupVersionID = Commons.shortGuid(),
|
|
425 |
// Consolidate = 0,
|
|
426 |
// PartConsolidate = 0,
|
|
427 |
// userDelete = true,
|
|
428 |
// AvoidConsolidate = 0,
|
|
429 |
// IsPreviewUser = false
|
|
430 |
//};
|
|
431 |
|
|
432 |
//App.Custom_ViewInfoId = infoId;
|
|
433 |
|
|
434 |
//ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
|
|
435 | 435 |
} |
436 | 436 |
else |
437 | 437 |
{ |
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
804 | 804 |
zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }) |
805 | 805 |
); |
806 | 806 |
//} |
807 |
|
|
808 |
|
|
807 |
|
|
809 | 808 |
var instanceMain = ViewerDataModel.Instance.SystemMain; |
810 | 809 |
|
810 |
instanceMain.dzMainMenu.CanvasDrawingMouseDownPoint = new Point(ViewerDataModel.Instance.ImageViewWidth / 2, ViewerDataModel.Instance.ImageViewHeight / 2); |
|
811 |
|
|
811 | 812 |
instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
812 | 813 |
instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
813 | 814 |
|
... | ... | |
2459 | 2460 |
this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
2460 | 2461 |
SetCursor(); |
2461 | 2462 |
|
2462 |
if (!ViewerDataModel.Instance.IsPressCtrl) SelectionSet.Instance.UnSelect(this); |
|
2463 |
if (!ViewerDataModel.Instance.IsPressCtrl) |
|
2464 |
{ |
|
2465 |
SelectionSet.Instance.UnSelect(this); |
|
2466 |
} |
|
2463 | 2467 |
} |
2464 | 2468 |
|
2465 | 2469 |
if (e.MiddleButton == MouseButtonState.Pressed) |
KCOM_API/KCOM_API.csproj | ||
---|---|---|
118 | 118 |
<DependentUpon>ServiceDeepView.svc</DependentUpon> |
119 | 119 |
<SubType>Component</SubType> |
120 | 120 |
</Compile> |
121 |
<Compile Include="UniqueColorGenerator.cs" /> |
|
121 | 122 |
</ItemGroup> |
122 | 123 |
<ItemGroup> |
123 | 124 |
<None Include="packages.config" /> |
KCOM_API/ServiceDeepView.svc.cs | ||
---|---|---|
16 | 16 |
using System.Web.Services; |
17 | 17 |
using System.Windows; |
18 | 18 |
using System.Xml; |
19 |
using ColorSelector; |
|
19 | 20 |
|
20 | 21 |
namespace KCOM_API |
21 | 22 |
{ |
... | ... | |
719 | 720 |
_ColorsProperties = (from property in kcomEntity.PROPERTIES |
720 | 721 |
where property.TYPE == "DisplayColor" |
721 | 722 |
select property).ToList(); |
723 |
|
|
724 |
} |
|
725 |
|
|
726 |
if (_ColorsProperties.Count() == 0) |
|
727 |
{ |
|
728 |
ColorGenerator uniqueColorGenerator = new ColorGenerator(System.Drawing.Color.Red); // 2303 = (int)Color.Red |
|
729 |
|
|
730 |
uniqueColorGenerator.GetEnumerator(_result.Count()); |
|
731 |
|
|
732 |
for (int i = 0; i < _result.Count(); i++) |
|
733 |
{ |
|
734 |
var c = uniqueColorGenerator.GetNext(); |
|
735 |
_ColorsProperties.Add(new PROPERTIES { VALUE = String.Format("{0:X2}{1:X2}{2:X2}",c.R, c.G,c.B) }); |
|
736 |
} |
|
722 | 737 |
} |
723 | 738 |
|
724 | 739 |
bool IsProjectNoPass = Properties.Settings.Default.IsProjectNoPass; |
KCOM_API/UniqueColorGenerator.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Drawing; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Threading.Tasks; |
|
8 |
using System.Windows.Media; |
|
9 |
|
|
10 |
namespace ColorSelector |
|
11 |
{ |
|
12 |
public class ColorGenerator : IEnumerable<Color> |
|
13 |
{ |
|
14 |
const int RandomSeed = 2; |
|
15 |
private List<Color> _generatorColors; |
|
16 |
|
|
17 |
private readonly Random _random; |
|
18 |
|
|
19 |
private Color _FirstColor; |
|
20 |
|
|
21 |
public ColorGenerator(Color FirstColor) |
|
22 |
{ |
|
23 |
_generatorColors = new List<Color>(); |
|
24 |
|
|
25 |
_FirstColor = FirstColor; |
|
26 |
_random = new Random(RandomSeed); |
|
27 |
} |
|
28 |
|
|
29 |
bool flag = false; |
|
30 |
|
|
31 |
private int MaxValue(int value,int max) |
|
32 |
{ |
|
33 |
if(value > max) |
|
34 |
{ |
|
35 |
return MaxValue(Math.Abs(value - max),max); |
|
36 |
} |
|
37 |
else |
|
38 |
{ |
|
39 |
return value; |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
|
|
44 |
public Color GetNext() |
|
45 |
{ |
|
46 |
int colorRed = MaxValue(_random.Next(255) + (flag ? _FirstColor.R : 0),255); |
|
47 |
int colorBlue = MaxValue(_random.Next(255) + _FirstColor.B,255); |
|
48 |
int colorGreen = MaxValue(_random.Next(255) + _FirstColor.G, 255); |
|
49 |
|
|
50 |
flag = flag ? false : true; |
|
51 |
|
|
52 |
Color color = Color.FromArgb(255, colorRed, colorBlue, colorGreen); |
|
53 |
|
|
54 |
//// make the color fully opaque |
|
55 |
//color.A = 255; |
|
56 |
//color.R = colorRed; |
|
57 |
//color.B = colorBlue; |
|
58 |
//color.G = colorGreen; |
|
59 |
|
|
60 |
var marthCount = this.Count(c => Math.Abs(c.R - colorRed) < 6 && Math.Abs(c.G - colorGreen) < 6 && Math.Abs(c.B - colorBlue) < 6); |
|
61 |
|
|
62 |
if (marthCount > 0 || colorRed < 80 || colorBlue < 80 || colorGreen < 80) |
|
63 |
{ |
|
64 |
color = GetNext(); |
|
65 |
} |
|
66 |
else |
|
67 |
{ |
|
68 |
_generatorColors.Add(color); |
|
69 |
} |
|
70 |
|
|
71 |
_FirstColor = color; |
|
72 |
|
|
73 |
|
|
74 |
return color; |
|
75 |
} |
|
76 |
|
|
77 |
public IEnumerator<Color> GetEnumerator( int Count) |
|
78 |
{ |
|
79 |
foreach (var item in Enumerable.Range(0, Count)) |
|
80 |
{ |
|
81 |
yield return GetNext(); |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
IEnumerator IEnumerable.GetEnumerator() |
|
86 |
{ |
|
87 |
return _generatorColors.GetEnumerator(); |
|
88 |
} |
|
89 |
|
|
90 |
public IEnumerator<Color> GetEnumerator() |
|
91 |
{ |
|
92 |
return _generatorColors.GetEnumerator(); |
|
93 |
} |
|
94 |
} |
|
95 |
} |
내보내기 Unified diff