Share via


Metodo InkAnalyzerBase.AddStrokeToCustomRecognizer

Aggiornamento: novembre 2007

Aggiunge i dati relativi a un singolo tratto a un nodo di riconoscimento personalizzato.

Spazio dei nomi:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Sintassi

'Dichiarazione
Public Function AddStrokeToCustomRecognizer ( _
    strokeId As Integer, _
    strokePacketData As Integer(), _
    strokePacketDescription As Guid(), _
    customRecognizer As ContextNodeBase _
) As ContextNodeBase
'Utilizzo
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

Parametri

  • strokePacketData
    Tipo: array<System.Int32[]
    Matrice che contiene i dati del pacchetto per il tratto.
  • strokePacketDescription
    Tipo: array<System.Guid[]
    Matrice che contiene gli identificatori di proprietà del pacchetto.

Valore restituito

Tipo: System.Windows.Ink.AnalysisCore.ContextNodeBase
Nodo di contesto al quale l'analizzatore dell'input penna ha aggiunto il tratto.

Note

L'oggetto InkAnalyzerBase aggiunge il tratto a un oggetto ContextNodeBase con un valore della proprietà Type di UnclassifiedInk().

Durante l'analisi, l'analizzatore dell'input penna assegna l'identificatore delle impostazioni cultura del thread di input attivo al tratto e aggiunge il tratto al primo nodo dell'input penna non classificato nel sistema di riconoscimento dell'input penna. Se non esiste alcun nodo non classificato, ne viene creato uno. Se il sistema di riconoscimento personalizzato non supporta l'identificatore delle impostazioni cultura, l'analizzatore dell'input penna continua l'analisi e genera un avviso AnalysisWarningBase. Questo avviso dispone della proprietà WarningCode impostata sul valore di AnalysisWarningCode pari a LanguageIdNotRespected.

strokePacketData contiene dati di pacchetto per tutti i punti nel tratto. strokePacketDescription contiene GUID che descrivono i tipi di dati di pacchetto inclusi per ogni punto nel tratto. Per un elenco completo delle proprietà del pacchetto disponibili, vedere la classe PacketProperty.

Questo metodo espande l'oggetto DirtyRegion all'unione del valore corrente dell'area e del riquadro del tratto aggiunto.

L'oggetto InkAnalyzerBase genera un'eccezione nelle circostanze indicate di seguito.

  • L'oggetto InkAnalyzerBase contiene già un tratto con lo stesso identificatore del tratto da aggiungere.

  • Il parametro customRecognizer contiene un oggetto ContextNodeBase associato a un oggetto InkAnalyzerBase diverso.

  • Il parametro customRecognizer contiene un oggetto ContextNodeBase che non ha un valore della proprietà Type di CustomRecognizer().

Esempi

In questo esempio viene definito un metodo che converte un oggetto Stroke nei dati di pacchetto e aggiunge il tratto a un nodo di riconoscimento personalizzato. Il metodo restituisce l'oggetto ContextNodeBase al quale l'analizzatore dell'input penna ha aggiunto il tratto.

''' <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;
}

Piattaforme

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

InkAnalyzerBase Classe

Membri InkAnalyzerBase

Spazio dei nomi System.Windows.Ink.AnalysisCore