mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-18 18:27:55 +08:00
fix typo in kd-tree
replace Count() by Count or Length
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
|
||||
ParallelOptions parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||
|
||||
Parallel.For(0, pages.Count(), parallelOptions, p =>
|
||||
Parallel.For(0, pages.Count, parallelOptions, p =>
|
||||
{
|
||||
var words = pages[p].GetWords(wordExtractor);
|
||||
var blocks = pageSegmenter.GetBlocks(words);
|
||||
|
@@ -200,23 +200,23 @@
|
||||
|
||||
public IEnumerable<KdTreeLeaf<Q>> GetLeaves()
|
||||
{
|
||||
var leafs = new List<KdTreeLeaf<Q>>();
|
||||
RecursiveGetLeaves(LeftChild, ref leafs);
|
||||
RecursiveGetLeaves(RightChild, ref leafs);
|
||||
return leafs;
|
||||
var leaves = new List<KdTreeLeaf<Q>>();
|
||||
RecursiveGetLeaves(LeftChild, ref leaves);
|
||||
RecursiveGetLeaves(RightChild, ref leaves);
|
||||
return leaves;
|
||||
}
|
||||
|
||||
private void RecursiveGetLeaves(KdTreeNode<Q> leaf, ref List<KdTreeLeaf<Q>> leafs)
|
||||
private void RecursiveGetLeaves(KdTreeNode<Q> leaf, ref List<KdTreeLeaf<Q>> leaves)
|
||||
{
|
||||
if (leaf == null) return;
|
||||
if (leaf is KdTreeLeaf<Q> lLeaf)
|
||||
{
|
||||
leafs.Add(lLeaf);
|
||||
leaves.Add(lLeaf);
|
||||
}
|
||||
else
|
||||
{
|
||||
RecursiveGetLeaves(leaf.LeftChild, ref leafs);
|
||||
RecursiveGetLeaves(leaf.RightChild, ref leafs);
|
||||
RecursiveGetLeaves(leaf.LeftChild, ref leaves);
|
||||
RecursiveGetLeaves(leaf.RightChild, ref leaves);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -307,7 +307,7 @@
|
||||
pivot => true, (pivot, candidate) => true,
|
||||
maxDegreeOfParallelism).ToList();
|
||||
|
||||
for (int a = 0; a < groupedIndexes.Count(); a++)
|
||||
for (int a = 0; a < groupedIndexes.Count; a++)
|
||||
{
|
||||
yield return new TextBlock(groupedIndexes[a].Select(i => lines[i]).ToList());
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@
|
||||
|
||||
var firstWordBound = words[0].BoundingBox.Normalise();
|
||||
Projection currentProjection = new Projection(firstWordBound.Left, firstWordBound.Right);
|
||||
int wordsCount = words.Count();
|
||||
int wordsCount = words.Length;
|
||||
|
||||
for (int i = 1; i < wordsCount; i++)
|
||||
{
|
||||
|
@@ -98,8 +98,8 @@
|
||||
Func<Letter, Letter, double> maxDistanceFunction, Func<PdfPoint, PdfPoint, double> distMeasure,
|
||||
int maxDegreeOfParallelism)
|
||||
{
|
||||
if (pageLetters == null || pageLetters.Count() == 0) return new List<Word>();
|
||||
TextDirection textDirection = pageLetters.ElementAt(0).TextDirection;
|
||||
if (pageLetters == null || pageLetters.Count == 0) return new List<Word>();
|
||||
TextDirection textDirection = pageLetters[0].TextDirection;
|
||||
|
||||
if (pageLetters.Any(x => textDirection != x.TextDirection))
|
||||
{
|
||||
|
@@ -705,7 +705,7 @@
|
||||
private static PdfPoint[] Intersect(PdfPath.BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2)
|
||||
{
|
||||
var ts = IntersectT(bezierCurve, p1, p2);
|
||||
if (ts == null || ts.Count() == 0) return EmptyArray<PdfPoint>.Instance;
|
||||
if (ts == null || ts.Length == 0) return EmptyArray<PdfPoint>.Instance;
|
||||
|
||||
List<PdfPoint> points = new List<PdfPoint>();
|
||||
foreach (var t in ts)
|
||||
|
Reference in New Issue
Block a user