bhavanisankarnimmala

Find an angle of Line according to Text Orientation

Blog Post created by bhavanisankarnimmala on May 14, 2018

private static double GetAngleOnTextOrientationBasis(IPoint sw_Point, IPoint se_Point, IPoint ne_Point, IPoint nw_Point, string TextOrientation)

{

double angle = 0;

if (TextOrientation == "H")

{

try

{

ILine line = new Line();

line.FromPoint = sw_Point;

line.ToPoint = se_Point;

angle = line.Angle;

angle = (angle * 180) / Math.PI;

}

catch (Exception ex)

{

Globals.logging(ex.Message, false, "FATAL");

Globals.logging(ex.StackTrace, false, "FATAL");

Globals.logging("ERROR in " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Method.", false, "FATAL");

angle = 0;

}

finally

{

GC.Collect();

}

}

if (TextOrientation == "V")

{

try

{

ILine line = new Line();

line.FromPoint = sw_Point;

line.ToPoint = nw_Point;

angle = line.Angle;

angle = (angle * 180) / Math.PI;

}

catch (Exception ex)

{

Globals.logging(ex.Message, false, "FATAL");

Globals.logging(ex.StackTrace, false, "FATAL");

Globals.logging("ERROR in " + System.Reflection.MethodBase.GetCurrentMethod().Name + " Method.", false, "FATAL");

angle = 0;

}

finally

{

GC.Collect();

}

}

return angle;

}

Outcomes