本文整理汇总了C#中Letter.SetExlusivePoints方法的典型用法代码示例。如果您正苦于以下问题:C# Letter.SetExlusivePoints方法的具体用法?C# Letter.SetExlusivePoints怎么用?C# Letter.SetExlusivePoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Letter
的用法示例。
在下文中一共展示了Letter.SetExlusivePoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessDigits
private static void ProcessDigits(string path, bool debug, Color textColor)
{
//read images
string[] images = AnalyserHelper.GetFiles(path);
if (images == null) return;
//convert images in 2 colors bitmap (letter and background)
Dictionary<LetterInfo, int[,]> data = new Dictionary<LetterInfo, int[,]>();
for (int i = 0; i < images.Length; i++)
{
char character = images[i][images[i].Length - 5];
Bitmap bmp = AnalyserHelper.GetBitMap(images[i]);
int[,] colors = AnalyserHelper.GetColor(bmp, textColor);
data.Add(new LetterInfo(character), colors);
}
List<Letter> dsl = new List<Letter>(data.Count);
foreach (LetterInfo cInfo in data.Keys)
{
cInfo.SameLengthLetters = AnalyserHelper.GetLettersWithTheSameDimension(data, cInfo);
}
foreach (LetterInfo cInfo in data.Keys)
{
if (cInfo.SameLengthLetters == null)
{
Letter l = new Letter(cInfo.Letter, AnalyserHelper.GetClearPoints(data[cInfo]));
l.SetExlusivePoints(0);
dsl.Add(l);
}
}
foreach (LetterInfo cInfo in data.Keys)
{
if (cInfo.SameLengthLetters == null) continue;
Dictionary<LetterInfo, int[,]> tData = new Dictionary<LetterInfo, int[,]>();
foreach (LetterInfo cInfoT in data.Keys)
{
if (cInfo == cInfoT)
{
tData.Add(cInfoT, data[cInfoT]);
continue;
}
if (cInfoT.SameLengthLetters == null) continue;
if (cInfoT.SameLengthLetters.Any(character => cInfo.Letter == character))
{
if (!tData.ContainsKey(cInfoT)) tData.Add(cInfoT, data[cInfoT]);
}
}
LetterPoint[,] pt = AnalyserHelper.Xor(tData, cInfo);
Letter l = new Letter(cInfo.Letter, pt);
l.SetExlusivePoints(1);
dsl.Add(l);
}
List<Letter> dsP = new List<Letter>(data.Count);
foreach (Letter l in dsl)
{
if (l.Order != Int32.MaxValue) continue;
dsP.AddRange(dsl.Where(p => p.Order != Int32.MaxValue && AnalyserHelper.AreSameDimesionLetters(p.Points, l.Points)));
l.SetExlusivePoints(dsP, 2);
}
dsl.Sort((ds1, ds2) => ds1.CompareTo(ds2));
File.Delete(path + "\\letters");
File.Delete(path + "\\l");
StringBuilder sl = new StringBuilder();
foreach (Letter ds in dsl)
{
sl.AppendLine(ds.PrintShort());
if (!debug) continue;
StringBuilder sb = IOHelper<Letter>.WritePrintable(null, "\t\t{0}\n", ds);
sb = IOHelper<LetterPoint>.WriteArray(sb, ds.Points);
IOHelper<LetterPoint>.WriteLine(path + "\\letters", sb.ToString());
}
IOHelper.WriteLine(path + "\\l", sl.ToString());
}