Ejemplo n.º 1
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());
 }
    public virtual bool SameLine(ITextChunkLocation @as)
    {
        if (OrientationMagnitude() != @as.OrientationMagnitude())
        {
            return(false);
        }
        int distPerpendicularDiff = DistPerpendicular() - @as.DistPerpendicular();

        if (Math.Abs(distPerpendicularDiff) < 2)
        {
            return(true);
        }
        LineSegment mySegment    = new LineSegment(startLocation, endLocation);
        LineSegment otherSegment = new LineSegment(@as.GetStartLocation(), @as.GetEndLocation());

        return(Math.Abs(distPerpendicularDiff) <= DIACRITICAL_MARKS_ALLOWED_VERTICAL_DEVIATION && (mySegment.GetLength() == 0 || otherSegment.GetLength() == 0));
    }