InkAnalyzerBase.AddStrokeToCustomRecognizer 方法
将单个笔画的笔画数据添加到自定义识别器节点。
命名空间: 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
参数
- strokeId
类型:System.Int32
笔画标识符。
- strokePacketData
类型:array<System.Int32[]
包含笔画数据包数据的数组。
- strokePacketDescription
类型:array<System.Guid[]
包含数据包属性标识符的数组。
- customRecognizer
类型:System.Windows.Ink.AnalysisCore.ContextNodeBase
要向其中添加笔画的自定义识别器节点。
返回值
类型:System.Windows.Ink.AnalysisCore.ContextNodeBase
墨迹分析器向其添加了笔画的上下文节点。
备注
InkAnalyzerBase 将笔画添加到 Type 属性值为 UnclassifiedInk() 的 ContextNodeBase。
在分析过程中,墨迹分析器将活动输入线程的区域性标识符分配给笔画,并将笔画添加到墨迹识别器之下的第一个未分类墨迹节点。如果不存在任何未分类节点,则创建一个未分类节点。如果自定义识别器不支持该区域性标识符,则墨迹分析器继续分析并生成一个 AnalysisWarningBase 警告。此警告的 WarningCode 属性设置为 LanguageIdNotRespected 的 AnalysisWarningCode 值。
strokePacketData 包含笔画中所有点的数据包数据。strokePacketDescription 包含用于描述笔画中每个点所包含的数据包数据类型的全局唯一标识符 (GUID)。有关可用数据包属性的完整列表,请参见 PacketProperty 类。
此方法将 DirtyRegion 扩展为区域的当前值与所添加笔画的边界框的并集。
在以下情况下,InkAnalyzerBase 将引发异常。
InkAnalyzerBase 包含的一个笔画与要添加的笔画具有相同的标识符。
customRecognizer 参数包含与另一个 InkAnalyzerBase 对象相关联的 ContextNodeBase。
customRecognizer 参数包含的一个 ContextNodeBase 的 Type 属性值不是 CustomRecognizer()。
示例
此示例定义一个方法,该方法将 Stroke 转换为数据包数据,然后将笔画添加到自定义识别器节点。该方法返回墨迹分析器向其添加笔画的 ContextNodeBase。
''' <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 SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0