1 つのストロークのストローク データをカスタム認識エンジン ノードに追加します。
名前空間 : 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 プロパティの AnalysisWarningCode 値は、LanguageIdNotRespected に設定されています。
strokePacketData には、ストローク内のすべてのポイントのパケット データが含まれています。strokePacketDescription には、ストローク内の各ポイントに含まれているパケット データの型を示すグローバル一意識別子 (GUID) が含まれています。使用可能なパケット プロパティの全一覧については、PacketProperty クラスのトピックを参照してください。
このメソッドは、DirtyRegion を、領域の現在の値と追加されたストロークの境界ボックスの結合に拡張します。
InkAnalyzerBase は、次の状況で例外をスローします。
InkAnalyzerBase に、追加するストロークとして同じ識別子を持つストロークが既に含まれている場合。
customRecognizer パラメータに、別の InkAnalyzerBase オブジェクトと関連付けられた ContextNodeBase が含まれている場合。
customRecognizer パラメータに、Type プロパティ値が CustomRecognizer() の ContextNodeBase が含まれている場合。
例
この例では、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