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())); }
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()); }