DivisionResult.ResultByType Method

DivisionResult.ResultByType Method

Gets the requested structural units of the analysis results for a DivisionUnits collection.

Definition

Visual Basic .NET Public Function ResultByType( _
ByVal divisionType As InkDivisionType _
) As DivisionUnits
C# public DivisionUnits ResultByType(
InkDivisionType divisionType
);
Managed C++ public: DivisionUnits* ResultByType(
InkDivisionType *divisionType
);

Parameters

> > >
divisionType Microsoft.Ink.InkDivisionType. One of the values of the InkDivisionType enumeration, which indicates the structural units to return.

Segment0 A recognition segment.
Line1 A line of handwriting that contains one or more recognition segments.
Paragraph2 A block of strokes that contains one or more lines of handwriting.
Drawing3 Ink that is not text.

Return Value

Microsoft.Ink.DivisionUnits. Returns the DivisionUnits collection containing the requested structural units of the analysis results.

Remarks

This method returns a new DivisionUnits collection each time the method is called.

If no structural units of the requested type exist in the DivisionResult object, then this method returns an empty DivisionUnits collection.

Examples

[C#]

This C# example creates a Divider object, theDivider, which contains a Strokes collection, theStrokes, and uses a RecognizerContext object, theRecognizerContext. The Divide method is called to get a snapshot of the analysis results, theResult. The ResultByType method is called with the divisionType parameter set to Line to retrieve all of the line units within theResult. For each line, theLine, in the Strokes collection, the DivisionUnit.DivisionType, DivisionUnit.Strokes, DivisionUnit.RecognitionString, and DivisionUnit.Transform properties are retrieved.

// Create the Divider and assign a Strokes collection to it.
Divider theDivider = new Divider(theStrokes, theRecognizerContext);

// Retrieve the analysis result, and divide the result by line.
DivisionResult theResult = theDivider.Divide();
DivisionUnits theDivisionUnits =
    theResult.ResultByType(InkDivisionType.Line);
foreach (DivisionUnit theLine in theDivisionUnits)
{
    // For each line element in the collection
    // retrieve the division type, the strokes,
    // the recognition string, and the rotation transform.
    InkDivisionType theDivisionType = theLine.DivisionType;
    Strokes elementStrokes = theLine.Strokes;
    string theRecognitionString = theLine.RecognitionString;
    System.Drawing.Drawing2D.Matrix theInkTransform =
        theLine.Transform;
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a Divider object, theDivider, which contains a Strokes collection, theStrokes, and uses a RecognizerContext object, theRecognizerContext. The Divide method is called to get a snapshot of the analysis results, theResult. The ResultByType method is called with the divisionType parameter set to Line to retrieve all of the line units within theResult. For each line, theLine, in the Strokes collection, the DivisionUnit.DivisionType, DivisionUnit.Strokes, DivisionUnit.RecognitionString, and DivisionUnit.Transform properties are retrieved.

' Create the Divider and assign a Strokes collection to it.
Dim theDivider As Divider = New Divider(theStrokes, theRecognizerContext)

' Retrieve the analysis result, and divide the result by line.
Dim theResult As DivisionResult = theDivider.Divide()
Dim theDivisionUnits As DivisionUnits = _
    theResult.ResultByType(InkDivisionType.Line)
Dim theLine As DivisionUnit
For Each theLine In theDivisionUnits
    ' For each line element in the collection
    ' retrieve the division type, the strokes,
    ' the recognition string, and the rotation transform.
    Dim theDivisionType As InkDivisionType = theLine.DivisionType
    Dim elementStrokes As Strokes = theLine.Strokes
    Dim theRecognitionString As String = theLine.RecognitionString
    Dim theInkTransform As System.Drawing.Drawing2D.Matrix = _
        theLine.Transform
Next

See Also