Поделиться через


InkAnalyzerBase.AddStrokeToCustomRecognizer - метод

Обновлен: Ноябрь 2007

Adds stroke data for a single stroke to a custom recognizer node.

Пространство имен:  System.Windows.Ink.AnalysisCore
Сборка:  IACore (в IACore.dll)

Синтаксис

'Декларация
Public Function AddStrokeToCustomRecognizer ( _
    strokeId As Integer, _
    strokePacketData As Integer(), _
    strokePacketDescription As Guid(), _
    customRecognizer As ContextNodeBase _
) As ContextNodeBase
'Применение
Dim instance As InkAnalyzerBase
Dim strokeId As Integer
Dim strokePacketData As Integer()
Dim strokePacketDescription As Guid()
Dim customRecognizer As ContextNodeBase
Dim returnValue As ContextNodeBase

returnValue = instance.AddStrokeToCustomRecognizer(strokeId, _
    strokePacketData, strokePacketDescription, _
    customRecognizer)
public ContextNodeBase AddStrokeToCustomRecognizer(
    int strokeId,
    int[] strokePacketData,
    Guid[] strokePacketDescription,
    ContextNodeBase customRecognizer
)
public:
ContextNodeBase^ AddStrokeToCustomRecognizer(
    int strokeId, 
    array<int>^ strokePacketData, 
    array<Guid>^ strokePacketDescription, 
    ContextNodeBase^ customRecognizer
)
public ContextNodeBase AddStrokeToCustomRecognizer(
    int strokeId,
    int[] strokePacketData,
    Guid[] strokePacketDescription,
    ContextNodeBase customRecognizer
)
public function AddStrokeToCustomRecognizer(
    strokeId : int, 
    strokePacketData : int[], 
    strokePacketDescription : Guid[], 
    customRecognizer : ContextNodeBase
) : ContextNodeBase

Параметры

  • strokePacketData
    Тип: array<System.Int32[]
    An array containing the packet data for the stroke.
  • strokePacketDescription
    Тип: array<System.Guid[]
    An array containing the packet property identifiers.

Возвращаемое значение

Тип: System.Windows.Ink.AnalysisCore.ContextNodeBase
The context node to which the ink analyzer added the stroke.

Заметки

The InkAnalyzerBase adds the stroke to a ContextNodeBase that has a Type property value of UnclassifiedInk().

During analysis the ink analyzer assigns the culture identifier of the active input thread to the stroke and adds the stroke to the first unclassified ink node under the ink recognizer. If no unclassified node exists, it is created. If the custom recognizer does not support the culture identifier, the ink analyzer continues analyzing and generates an AnalysisWarningBase warning. This warning has its WarningCode property set to the AnalysisWarningCode value of LanguageIdNotRespected.

strokePacketData contains packet data for all of the points in the stroke. strokePacketDescription contains the globally unique identifiers (GUIDs) that describe the types of packet data included for each point in the stroke. For a complete list of available packet properties, see the PacketProperty class.

This method expands the DirtyRegion to the union of the region's current value and the bounding box of the added stroke.

The InkAnalyzerBase throws an exception under the following circumstances.

  • The InkAnalyzerBase already contains a stroke with the same identifier as the stroke to be added.

  • The customRecognizer parameter contains a ContextNodeBase that is associated with a different InkAnalyzerBase object.

  • The customRecognizer parameter contains a ContextNodeBase that does not have a Type property value of CustomRecognizer().

Примеры

This example defines a method that converts a Stroke to packet data and adds the stroke to a custom recognizer node. The method returns the ContextNodeBase to which the ink analyzer added the stroke.

''' <summary>
''' Adds a stroke to a custom recognizer node.
''' </summary>
''' <param name="baseInkAnalyzer">The ink analyzer that contains the
''' custom recognizer node.</param>
''' <param name="theStroke">The stroke to add.</param>
''' <param name="theCustomRecognizer">The custom recognizer node
''' to which to add the stroke.</param>
''' <returns>The node to which the analyzer added the stroke.</returns>
''' <remarks>
''' This method converts stroke data to packet data for example only.
''' The InkAnalyzerBase is used when your application is handling packet
''' data. If your application uses stroke data from an Ink object, then
''' you would use InkAnalyzer.
''' </remarks>
Public Overloads Shared Function MyAddStrokeToCustomRecognizer( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStroke As Microsoft.Ink.Stroke, _
ByVal theCustomRecognizer As System.Windows.Ink.AnalysisCore.ContextNodeBase) _
As System.Windows.Ink.AnalysisCore.ContextNodeBase
    If baseInkAnalyzer Is Nothing Then
        Throw New ArgumentNullException("baseInkAnalyzer")
    End If

    If theStroke Is Nothing Then
        Throw New ArgumentNullException("theStroke")
    End If

    If theCustomRecognizer Is Nothing Then
        Throw New ArgumentNullException("theCustomRecognizer")
    End If

    If System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer <> _
        theCustomRecognizer.Type Then

        Throw New ArgumentException( _
            "The context node is not a custom recognizer node.", _
            "theCustomRecognizer")
    End If

    If baseInkAnalyzer.FindNode(theCustomRecognizer.Id) Is Nothing Then
        Throw New ArgumentException( _
            "The custom recognizer node is not attached to the ink analyzer.")
    End If

    Dim result As System.Windows.Ink.AnalysisCore.ContextNodeBase = _
        baseInkAnalyzer.AddStrokeToCustomRecognizer(theStroke.Id, _
            theStroke.GetPacketData(), theStroke.PacketDescription, _
            theCustomRecognizer)

    Return result
End Function 'AddStrokeToCustomRecognizer
/// <summary>
/// Adds a stroke to a custom recognizer node.
/// </summary>
/// <param name="baseInkAnalyzer">The ink analyzer that contains the
/// custom recognizer node.</param>
/// <param name="theStroke">The stroke to add.</param>
/// <param name="theCustomRecognizerNode">The custom recognizer node
/// to which to add the stroke.</param>
/// <returns>The node to which the analyzer added the stroke.</returns>
/// <remarks>
/// This method converts stroke data to packet data for example only.
/// The InkAnalyzerBase is used when your application is handling packet
/// data. If your application uses stroke data from an Ink object, then
/// you would use InkAnalyzer.
/// </remarks>
public static System.Windows.Ink.AnalysisCore.ContextNodeBase MyAddStrokeToCustomRecognizer(
    System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
    Microsoft.Ink.Stroke theStroke,
    System.Windows.Ink.AnalysisCore.ContextNodeBase theCustomRecognizer)
{
    if (null == baseInkAnalyzer)
    {
        throw new ArgumentNullException("baseInkAnalyzer");
    }

    if (null == theStroke)
    {
        throw new ArgumentNullException("theStroke");
    }

    if (null == theCustomRecognizer)
    {
        throw new ArgumentNullException("theCustomRecognizer");
    }

    if (System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.CustomRecognizer
        != theCustomRecognizer.Type)
    {
        throw new ArgumentException(
            "The context node is not a custom recognizer node.",
            "theCustomRecognizer");
    }

    if (null == baseInkAnalyzer.FindNode(theCustomRecognizer.Id))
    {
        throw new ArgumentException(
            "The custom recognizer node is not attached to the ink analyzer.");
    }

    System.Windows.Ink.AnalysisCore.ContextNodeBase result =
        baseInkAnalyzer.AddStrokeToCustomRecognizer(
            theStroke.Id, theStroke.GetPacketData(),
            theStroke.PacketDescription, theCustomRecognizer);

    return result;
}

Платформы

Windows Vista, Windows XP с пакетом обновления 2 (SP2), Windows Server 2003

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

InkAnalyzerBase Класс

InkAnalyzerBase - члены

System.Windows.Ink.AnalysisCore - пространство имен