Class MeasureUtils
Measure class with all PDF measure specs
Inheritance
System.Object
MeasureUtils
Assembly: pdftron.PDF.Tools.dll
public class MeasureUtils : object
Fields
Declaration
public static string DEFAULT_BASE_SCALE
Field Value
| Type |
Description |
| System.String |
|
Declaration
public static string DEFAULT_BASE_UNIT
Field Value
| Type |
Description |
| System.String |
|
Declaration
public static string DEFAULT_PRECISION
Field Value
| Type |
Description |
| System.String |
|
Declaration
public static string DEFAULT_TRANSLATE_SCALE
Field Value
| Type |
Description |
| System.String |
|
Declaration
public static string DEFAULT_TRANSLATE_UNIT
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string K_IT = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string K_LineDimension = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string K_Measure = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string K_PolygonDimension = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string K_PolyLineDimension = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_AREA = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_AXIS = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_DECIMAL_SYMBOL = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_DISPLAY = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_DISTANCE = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_FACTOR = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_PRECISION = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_SCALE = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_THOUSAND_SYMBOL = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_TYPE = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_UNIT = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_UNIT_POSITION = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_UNIT_PREFIX = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string KEY_UNIT_SUFFIX = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_CM = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_FT = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_IN = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_KM = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_M = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_MI = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_MM = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_PT = null
Field Value
| Type |
Description |
| System.String |
|
Declaration
public const string U_YD = null
Field Value
| Type |
Description |
| System.String |
|
Methods
Calculate and return the area
Declaration
public static double CalcArea(List<Point> points)
Parameters
| Type |
Name |
Description |
| List<Point> |
points |
Points to get the perimeter
|
Returns
| Type |
Description |
| System.Double |
The total perimeter
|
Calculate and return the total perimeter of all points
Declaration
public static double CalcPerimeter(List<Point> points)
Parameters
| Type |
Name |
Description |
| List<Point> |
points |
Points to get the perimeter
|
Returns
| Type |
Description |
| System.Double |
The total perimeter
|
Convert the page points to a final value and adds the unit
Declaration
public static string ConvertToFinalVal(double actual_pg_pts, string baseScale, string baseUnit, string translateScale, string translateUnit, string precision)
Parameters
| Type |
Name |
Description |
| System.Double |
actual_pg_pts |
Page pts value to be converted
|
| System.String |
baseScale |
The base scale
|
| System.String |
baseUnit |
The base unit (in, cm, mm, etc)
|
| System.String |
translateScale |
The translated scale
|
| System.String |
translateUnit |
The translated unit (in, cm, mm, etc)
|
| System.String |
precision |
Decimals to display
|
Returns
| Type |
Description |
| System.String |
|
Convert PDF spec precision to UI format
I.e.: 100 => 0.01
Declaration
public static string ConvPDFPrecisionToStr(double precision)
Parameters
| Type |
Name |
Description |
| System.Double |
precision |
|
Returns
| Type |
Description |
| System.String |
|
ConvScaleToPDFFactor(PageUnit, ToolType, String, String)
Convert scales to PDF spec Factor
Declaration
public static double ConvScaleToPDFFactor(PageUnit pgUnit, ToolType toolType, string bScale, string tScale)
Parameters
| Type |
Name |
Description |
| PageUnit |
pgUnit |
The measurement unit (in, cm, mm, etc)
|
| ToolType |
toolType |
Measure tool type
|
| System.String |
bScale |
The base scale
|
| System.String |
tScale |
The translated scale
|
Returns
| Type |
Description |
| System.Double |
|
Convert string precision from the UI to PDF specs precision
IE.: 0.01 => 100, 0.001 => 1000
Declaration
public static double ConvStrToPDFPrecision(string precision)
Parameters
| Type |
Name |
Description |
| System.String |
precision |
|
Returns
| Type |
Description |
| System.Double |
|
Utility method to format string decimal
Declaration
public static string FormatDecimals(double val, string format)
Parameters
| Type |
Name |
Description |
| System.Double |
val |
Value
|
| System.String |
format |
String format
|
Returns
| Type |
Description |
| System.String |
|
Declaration
public static MeasureInfoGroup GetAnnotMeasureInfo(IAnnot annot)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
|
Returns
Get the IT -> Measure Annotation Name
Declaration
public static string GetIT(IAnnot annot)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
Annotation
|
Returns
| Type |
Description |
| System.String |
Annotation name
|
GetPageUnitFromString(String)
Return PageUnit enum based on string unit value
Declaration
public static PageUnit GetPageUnitFromString(string val)
Parameters
| Type |
Name |
Description |
| System.String |
val |
Unit: pt, in, mm, cm, m, km, ft, yd, mi
|
Returns
| Type |
Description |
| PageUnit |
PageUnit value
|
Check if annotations is Area Measure type
Declaration
public static bool IsAreaMeasure(IAnnot annot)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
Annotation
|
Returns
| Type |
Description |
| System.Boolean |
True or False
|
Check if annotation has Measure key set
Only valid for Line, Polygon and Polyline annotations
Declaration
public static bool IsMeasureAnnot(IAnnot annot)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
Annotation
|
Returns
| Type |
Description |
| System.Boolean |
True if annot has Measure key set
|
Check if annotations is Perimeter Measure type
Declaration
public static bool IsPerimeterMeasure(IAnnot annot)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
Annotation
|
Returns
| Type |
Description |
| System.Boolean |
True or False
|
Check if annotations is Ruler Measure type
Declaration
public static bool IsRulerMeasure(IAnnot annot)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
Annotation
|
Returns
| Type |
Description |
| System.Boolean |
True or False
|
Add Measure information accordingly to the PDF specs
Declaration
public static void SetMeasurementInfo(IAnnot annot, IMeasure measureInfo)
Parameters
| Type |
Name |
Description |
| IAnnot |
annot |
The annotation to get measure data
|
| IMeasure |
measureInfo |
The measure data
|
It updates the area of the Polygon annotation if it has measurement data
Declaration
public static void UpdateAreaAnnot(Annots.Polygon polygon)
Parameters
| Type |
Name |
Description |
| Annots.Polygon |
polygon |
Polygon annot
|
Ut Updates the perimeter of the Polyline annotation if it has measurement data
Declaration
public static void UpdatePerimeterAnnot(Annots.PolyLine polyline)
Parameters
| Type |
Name |
Description |
| Annots.PolyLine |
polyline |
Annotation polyline
|