AnnBoundingRect... Example for Visual Basic
Dim RasterVarX As New LEADRasterVariant
Dim RasterVarY As New LEADRasterVariant
Dim RasterIO As New LEADRasterIO
Dim hObj As Long
Dim hObj2 As Long
LEADRasterView1.Raster.UnlockSupport L_SUPPORT_DOCUMENT, ""
RasterAnn.AnnParentRasterView = LEADRasterView1
RasterIO.Load LEADRasterView1.Raster, "c:\image1.jpg", 0, 0, 1
RasterAnn.AnnUserMode = ANN_USERMODE_DESIGN
hObj = RasterAnn.AnnCreateItem(RasterAnn.AnnContainer, ANN_OBJECT_PROTRACTOR, True)
hObj2 = RasterAnn.AnnCreateItem(RasterAnn.AnnContainer, ANN_OBJECT_POLYGON, True)
' Assign values for x and y from 1 through 3
RasterVarX.Type = VALUE_ARRAY_FLOAT
RasterVarY.Type = VALUE_ARRAY_FLOAT
RasterVarX.ItemCount = 4
RasterVarY.ItemCount = 4
RasterVarX.FloatItemValue (1) = 10
RasterVarX.FloatItemValue(2) = 100
RasterVarX.FloatItemValue(3) = 200
RasterVarY.FloatItemValue(1) = 20
RasterVarY.FloatItemValue(2) = 200
RasterVarY.FloatItemValue(3) = 100
RasterAnn.AnnSetPoints hObj, RasterVarX, RasterVarY, 3
RasterVarX.FloatItemValue(0) = 50 ' SetPoints starts at 0 because No. of points set to 4
RasterVarY.FloatItemValue(0) = 220
RasterAnn.AnnSetPoints hObj2, RasterVarX, RasterVarY, 4
RasterAnn.AnnSetFillMode hObj2, ANN_FILLMODE_OPAQUE, False
Form1.Caption = "Protractor Bounding Rectangle, Left:" & RasterAnn.AnnBoundingRectLeft(hObj) & ", Top:" & _
RasterAnn.AnnBoundingRectTop(hObj) & ", Width:" & RasterAnn.AnnBoundingRectWidth(hObj) & ", Height:" & RasterAnn.AnnBoundingRectHeight(hObj)
RasterAnn.AnnBringToFront hObj2
MsgBox "Brought Polygon to front"
Form1.Caption = "Polygon Area:" & RasterAnn.AnnGetArea(hObj2)
RasterAnn.AnnSendToBack hObj2
MsgBox "Sent Polygon to back"
RasterAnn.AnnCut hObj2, ANN_FMT_WMF, False, True
Form1.Caption = "Angle:" & RasterAnn.AnnGetAngle(hObj)