コード例 #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()));
            }
コード例 #2
0
 internal virtual void PrintDiagnostics()
 {
     System.Console.Out.WriteLine("Text (@" + location.GetStartLocation() + " -> " + location.GetEndLocation()
                                  + "): " + text);
     System.Console.Out.WriteLine("orientationMagnitude: " + location.OrientationMagnitude());
     System.Console.Out.WriteLine("distPerpendicular: " + location.DistPerpendicular());
     System.Console.Out.WriteLine("distParallel: " + location.DistParallelStart());
 }
コード例 #3
0
 /// <param name="as">the location to compare to</param>
 /// <returns>true is this location is on the the same line as the other</returns>
 public virtual bool SameLine(LocationTextExtractionStrategy.ITextChunkLocation @as)
 {
     return(OrientationMagnitude() == @as.OrientationMagnitude() && DistPerpendicular() == @as.DistPerpendicular
                ());
 }