ImageGear .NET
AspectDenominatorX Property (ImGearARTPolyRuler)
Example 




Gets or sets the mark's X aspect denominator value.
Syntax
'Declaration
 
Public Property AspectDenominatorX As Integer
'Usage
 
Dim instance As ImGearARTPolyRuler
Dim value As Integer
 
instance.AspectDenominatorX = value
 
value = instance.AspectDenominatorX
public int AspectDenominatorX {get; set;}
public: __property int get_AspectDenominatorX();
public: __property void set_AspectDenominatorX( 
   int value
);
public:
property int AspectDenominatorX {
   int get();
   void set (    int value);
}

Property Value

Integer value.
Remarks
ART Poly Ruler object is designed to display the distance between points on the image. Point's coordinates are specified in image pixel units, and the Polyline Ruler displays the distance measured in these units.

AspectDenominator/AspectNumerator properties help to change measurement units from image pixels to more convenient measurment units like meters or inches.

The default value is 1.
Example
// Setup points for the ruler.
ImGearPoint[] igPoints = new ImGearPoint[4];
igPoints[0] = new ImGearPoint(10, 10);
igPoints[1] = new ImGearPoint(10, 20);
igPoints[2] = new ImGearPoint(20, 15);
igPoints[3] = new ImGearPoint(30, 10);

// Setup color for the ruler.
ImGearRGBQuad color = new ImGearRGBQuad(0, 255, 0);

// Get and initialize image resolution for the ruler.
ImGearResolution imageResolution = new ImGearResolution(
        igPage.DIB.ImageResolution.XNumerator,
        igPage.DIB.ImageResolution.XDenominator,
        igPage.DIB.ImageResolution.YNumerator,
        igPage.DIB.ImageResolution.YDenominator,
        igPage.DIB.ImageResolution.Units);

// Create ruler, note that the ruler is always created with measurement units set to mm
// and it doesn't depend on ImGearResolution measurement units.
ImGearARTPolyRuler polyRuler = new ImGearARTPolyRuler(igPoints, color, imageResolution);

// Let's change measurement units to inches.
imageResolution.ConvertUnits(ImGearResolutionUnits.INCHES);

// Set number of pixels per 1 inch.
polyRuler.AspectDenominatorX = 1 * (int)Math.Round((double)imageResolution.XNumerator / (double)imageResolution.XDenominator);
polyRuler.AspectDenominatorY = 1 * (int)Math.Round((double)imageResolution.YNumerator / (double)imageResolution.YDenominator);

// Set 1 inch scale.
polyRuler.AspectNumeratorX = 1;
polyRuler.AspectNumeratorY = 1;

polyRuler.Label = "%d in";

// Now change the measurement units back to the mm.
imageResolution.ConvertUnits(ImGearResolutionUnits.METERS);

// Set number of pixels per 1 meter.
polyRuler.AspectDenominatorX = 1 * (int)Math.Round((double)imageResolution.XNumerator / (double)imageResolution.XDenominator);
polyRuler.AspectDenominatorY = 1 * (int)Math.Round((double)imageResolution.YNumerator / (double)imageResolution.YDenominator);

// Set 1 mm scale.
polyRuler.AspectNumeratorX = 1000;
polyRuler.AspectNumeratorY = 1000;

polyRuler.Label = "%d mm";

igARTPage.AddMark(polyRuler, ImGearARTCoordinatesType.IMAGE_COORD);
' Setup points for the ruler.
Dim igPoints As ImGearPoint() = New ImGearPoint(3) {}
igPoints(0) = New ImGearPoint(10, 10)
igPoints(1) = New ImGearPoint(10, 20)
igPoints(2) = New ImGearPoint(20, 15)
igPoints(3) = New ImGearPoint(30, 10)

' Setup color for the ruler.
Dim color As New ImGearRGBQuad(0, 255, 0)

' Get and initialize image resolution for the ruler.
Dim imageResolution As New ImGearResolution(igPage.DIB.ImageResolution.XNumerator, igPage.DIB.ImageResolution.XDenominator, igPage.DIB.ImageResolution.YNumerator, igPage.DIB.ImageResolution.YDenominator, igPage.DIB.ImageResolution.Units)

' Create ruler, note that the ruler is always created with measurement units set to mm
' and it doesn't depend on ImGearResolution measurement units.
Dim polyRuler As New ImGearARTPolyRuler(igPoints, color, imageResolution)

' Let's change measurement units to inches.
imageResolution.ConvertUnits(ImGearResolutionUnits.INCHES)

' Set number of pixels per 1 inch.
polyRuler.AspectDenominatorX = 1 * CInt(Math.Round(CDbl(imageResolution.XNumerator) / CDbl(imageResolution.XDenominator)))
polyRuler.AspectDenominatorY = 1 * CInt(Math.Round(CDbl(imageResolution.YNumerator) / CDbl(imageResolution.YDenominator)))

' Set 1 inch scale.
polyRuler.AspectNumeratorX = 1
polyRuler.AspectNumeratorY = 1

polyRuler.Label = "%d in"

' Now change the measurement units back to the mm.
imageResolution.ConvertUnits(ImGearResolutionUnits.METERS)

' Set number of pixels per 1 meter.
polyRuler.AspectDenominatorX = 1 * CInt(Math.Round(CDbl(imageResolution.XNumerator) / CDbl(imageResolution.XDenominator)))
polyRuler.AspectDenominatorY = 1 * CInt(Math.Round(CDbl(imageResolution.YNumerator) / CDbl(imageResolution.YDenominator)))

' Set 1 mm scale.
polyRuler.AspectNumeratorX = 1000
polyRuler.AspectNumeratorY = 1000

polyRuler.Label = "%d mm"

igARTPage.AddMark(polyRuler, ImGearARTCoordinatesType.IMAGE_COORD)
See Also

Reference

ImGearARTPolyRuler Class
ImGearARTPolyRuler Members

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback