Exemple #1
0
            public virtual int CompareTo(LocationTextExtractionStrategy.ITextChunkLocation other)
            {
                if (this == other)
                {
                    return(0);
                }
                // not really needed, but just in case
                LineSegment mySegment    = new LineSegment(startLocation, endLocation);
                LineSegment otherSegment = new LineSegment(other.GetStartLocation(), other.GetEndLocation());

                if (other.GetStartLocation().Equals(other.GetEndLocation()) && mySegment.ContainsSegment(otherSegment) ||
                    startLocation.Equals(endLocation) && otherSegment.ContainsSegment(mySegment))
                {
                    // Return 0 to save order due to stable sort. This handles situation of mark glyphs that have zero width
                    return(0);
                }
                int result;

                result = iText.IO.Util.JavaUtil.IntegerCompare(OrientationMagnitude(), other.OrientationMagnitude());
                if (result != 0)
                {
                    return(result);
                }
                result = iText.IO.Util.JavaUtil.IntegerCompare(DistPerpendicular(), other.DistPerpendicular());
                if (result != 0)
                {
                    return(result);
                }
                return(iText.IO.Util.JavaUtil.FloatCompare(DistParallelStart(), other.DistParallelStart()));
            }