InkAnalyzerBase.AddStrokeToCustomRecognizer (Método)
Actualización: noviembre 2007
Agrega datos de trazo para un solo trazo a un nodo de reconocedor personalizado.
Espacio de nombres: System.Windows.Ink.AnalysisCore
Ensamblado: IACore (en IACore.dll)
Sintaxis
'Declaración
Public Function AddStrokeToCustomRecognizer ( _
strokeId As Integer, _
strokePacketData As Integer(), _
strokePacketDescription As Guid(), _
customRecognizer As ContextNodeBase _
) As ContextNodeBase
'Uso
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
Parámetros
- strokeId
Tipo: System.Int32
Identificador del trazo.
- strokePacketData
Tipo: array<System.Int32[]
Matriz que contiene los datos del paquete del trazo.
- strokePacketDescription
Tipo: array<System.Guid[]
Matriz que contiene los identificadores de las propiedades del paquete.
- customRecognizer
Tipo: System.Windows.Ink.AnalysisCore.ContextNodeBase
Nodo de reconocedor personalizado al que se agrega el trazo.
Valor devuelto
Tipo: System.Windows.Ink.AnalysisCore.ContextNodeBase
Nodo de contexto al que el analizador de entrada manuscrita agregó el trazo.
Comentarios
InkAnalyzerBase agrega el trazo a un objeto ContextNodeBase cuya propiedad Type tiene el valor UnclassifiedInk().
Durante el análisis, el analizador de entrada manuscrita asigna el identificador de referencia cultural del subproceso de entrada activo al trazo y agrega el trazo al primer nodo de entrada manuscrita no clasificado bajo el reconocedor de entrada manuscrita. Si no existe ningún nodo no clasificado, se crea. Si el reconocedor personalizado no admite el identificador de referencia cultural, el analizador de entrada manuscrita continúa el análisis y genera una advertencia AnalysisWarningBase. Esta advertencia tiene su propiedad WarningCode establecida en el valor AnalysisWarningCode de LanguageIdNotRespected.
strokePacketData contiene datos del paquete de todos los puntos del trazo. strokePacketDescription contiene los identificadores únicos globales (GUID) que describen los tipos de datos del paquete incluidos para cada punto del trazo. Para obtener una lista completa de las propiedades del paquete disponibles, vea la clase PacketProperty.
Este método expande la propiedad DirtyRegion a la unión del valor actual de la región y el cuadro de límite del trazo agregado.
El objeto InkAnalyzerBase produce una excepción bajo las siguientes circunstancias.
El objeto InkAnalyzerBase ya contiene un trazo con el mismo identificador que el trazo que se va a agregar.
El parámetro customRecognizer contiene un objeto ContextNodeBase que está asociado a un objeto InkAnalyzerBase diferente.
El parámetro customRecognizer contiene un objeto ContextNodeBase que no tiene ninguna propiedad Type con un valor de CustomRecognizer().
Ejemplos
En este ejemplo, se define un método que convierte un objeto Stroke en datos de paquete y agrega el trazo a un nodo de reconocedor personalizado. El método devuelve el objeto ContextNodeBase al que el analizador de entrada manuscrita agregó el trazo.
''' <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;
}
Plataformas
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión
.NET Framework
Compatible con: 3.0