次の方法で共有


InkAnalyzerBase.AddStrokes メソッド (array<Int32[], array<Int32[], array<Int32[], array<Guid[])

複数のストロークのストローク データをインク アナライザに追加し、アクティブな入力スレッドのカルチャ識別子をストロークに割り当てます。

名前空間 :  System.Windows.Ink.AnalysisCore
アセンブリ :  IACore (IACore.dll 内)

構文

'宣言
Public Function AddStrokes ( _
    strokeIdsToAdd As Integer(), _
    strokePacketCount As Integer(), _
    strokePacketData As Integer(), _
    strokePacketDescription As Guid() _
) As ContextNodeBase
'使用
Dim instance As InkAnalyzerBase
Dim strokeIdsToAdd As Integer()
Dim strokePacketCount As Integer()
Dim strokePacketData As Integer()
Dim strokePacketDescription As Guid()
Dim returnValue As ContextNodeBase

returnValue = instance.AddStrokes(strokeIdsToAdd, _
    strokePacketCount, strokePacketData, _
    strokePacketDescription)
public ContextNodeBase AddStrokes(
    int[] strokeIdsToAdd,
    int[] strokePacketCount,
    int[] strokePacketData,
    Guid[] strokePacketDescription
)
public:
ContextNodeBase^ AddStrokes(
    array<int>^ strokeIdsToAdd, 
    array<int>^ strokePacketCount, 
    array<int>^ strokePacketData, 
    array<Guid>^ strokePacketDescription
)
public ContextNodeBase AddStrokes(
    int[] strokeIdsToAdd,
    int[] strokePacketCount,
    int[] strokePacketData,
    Guid[] strokePacketDescription
)
public function AddStrokes(
    strokeIdsToAdd : int[], 
    strokePacketCount : int[], 
    strokePacketData : int[], 
    strokePacketDescription : Guid[]
) : ContextNodeBase

パラメータ

  • strokeIdsToAdd
    型 : array<System.Int32[]
    ストローク識別子が含まれる配列。
  • strokePacketCount
    型 : array<System.Int32[]
    各ストローク内のパケットの数が含まれる配列。
  • strokePacketData
    型 : array<System.Int32[]
    ストロークのパケット データが含まれる配列。
  • strokePacketDescription
    型 : array<System.Guid[]
    パケット プロパティ識別子が含まれる配列。

戻り値

型 : System.Windows.Ink.AnalysisCore.ContextNodeBase
インク アナライザがストロークを追加したコンテキスト ノード。

解説

InkAnalyzerBase は、Type プロパティ値が UnclassifiedInk() の ContextNodeBase にストロークを追加します。

インク アナライザは、アクティブな入力スレッドのカルチャ識別子をストロークに割り当てます。次に、同じカルチャ識別子を持つストロークが含まれるインク アナライザのルート ノードの下にある、最初の未分類インク ノードにストロークを追加します。インク アナライザが、同じカルチャ識別子を持つノードを検出できない場合、そのルート ノードの下に新しい ContextNodeBase を作成し、新しい未分類インク ノードにストロークを追加します。

strokePacketData には、ストロークのすべてのパケット データが含まれています。strokePacketDescription には、各ストローク内の各ポイントに含まれているパケット データの型を示すグローバル一意識別子 (GUID) が含まれています。使用可能なパケット プロパティの全一覧については、PacketProperty クラスのトピックを参照してください。

同じパケット説明を持つストロークだけを、AddStrokes の 1 回の呼び出しに追加できます。

このメソッドは、DirtyRegion を、領域の現在の値と追加されたストロークの境界ボックスの結合に拡張します。

InkAnalyzerBase に、追加するストロークの 1 つとして同じ識別子を持つストロークが既に含まれている場合、InkAnalyzerBase は例外をスローします。

この例では、Strokes コレクションをパケット データに変換し、ストロークを InkAnalyzerBase に追加するメソッドを定義します。このメソッドは、インク アナライザがストロークを追加した ContextNodeBase を返します。

''' <summary>
''' Adds a collection of strokes to an InkAnalyzerBase.
''' </summary>
''' <param name="baseInkAnalyzer">
''' The analyzer that receives the strokes.</param>
''' <param name="theStrokes">The strokes to add.</param>
''' <returns>The node to which the analyzer added the strokes.</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 MyAddStrokes( _
ByVal baseInkAnalyzer As System.Windows.Ink.AnalysisCore.InkAnalyzerBase, _
ByVal theStrokes As Microsoft.Ink.Strokes) _
As System.Windows.Ink.AnalysisCore.ContextNodeBase
    ' Check that the parameters are valid
    If baseInkAnalyzer Is Nothing Then
        Throw New ArgumentNullException("baseInkAnalyzer")
    End If

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

    If 0 = theStrokes.Count Then
        Throw New ArgumentException("Empty strokes collection.")
    End If

    ' Only strokes that have the same packet description GUIDs
    ' can be added in one call to InkAnalyzerBase.AddStrokes.
    Dim thePacketDescription As Guid() = theStrokes(0).PacketDescription

    ' Accumulate the stroke data in collections.
    Dim theStrokeIdentifiers As New ArrayList()
    Dim thePacketCounts As New ArrayList()
    Dim thePacketData As New ArrayList()
    Dim aStroke As Microsoft.Ink.Stroke
    For Each aStroke In theStrokes
        If Not InkAnalyzerHelper.AreElementwiseEquivalent( _
            aStroke.PacketDescription, thePacketDescription) Then

            Throw New ApplicationException( _
                "The strokes collection contains strokes with different" & _
                " packet descriptions.")
        End If

        ' Add the stroke data to the collections.
        theStrokeIdentifiers.Add(aStroke.Id)
        thePacketCounts.Add(aStroke.PacketCount)
        thePacketData.AddRange(aStroke.GetPacketData())
    Next aStroke

    ' Add the stroke data to the base layer ink analyzer.
    Dim result As System.Windows.Ink.AnalysisCore.ContextNodeBase = baseInkAnalyzer.AddStrokes( _
            DirectCast(theStrokeIdentifiers.ToArray(GetType(Integer)), Integer()), _
            DirectCast(thePacketCounts.ToArray(GetType(Integer)), Integer()), _
            DirectCast(thePacketData.ToArray(GetType(Integer)), Integer()), _
            thePacketDescription)

    Return result

End Function 'AddStrokes
/// <summary>
/// Adds a collection of strokes to an InkAnalyzerBase.
/// </summary>
/// <param name="baseInkAnalyzer">
/// The analyzer that receives the strokes.</param>
/// <param name="theStrokes">The strokes to add.</param>
/// <returns>The node to which the analyzer added the strokes.</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 MyAddStrokes(
System.Windows.Ink.AnalysisCore.InkAnalyzerBase baseInkAnalyzer,
Microsoft.Ink.Strokes theStrokes)
{
    // Check that the parameters are valid
    if (null == baseInkAnalyzer)
    {
        throw new ArgumentNullException("baseInkAnalyzer");
    }

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

    if (0 == theStrokes.Count)
    {
        throw new ArgumentException("Empty strokes collection.");
    }

    // Only strokes that have the same packet description GUIDs
    // can be added in one call to InkAnalyzerBase.AddStrokes.
    Guid[] thePacketDescription = theStrokes[0].PacketDescription;

    // Accumulate the stroke data in collections.
    ArrayList theStrokeIdentifiers = new ArrayList();
    ArrayList thePacketCounts = new ArrayList();
    ArrayList thePacketData = new ArrayList();
    foreach (Microsoft.Ink.Stroke aStroke in theStrokes)
    {
        if (!InkAnalyzerHelper.AreElementwiseEquivalent(
            aStroke.PacketDescription, thePacketDescription))
        {
            throw new ApplicationException(
                "The strokes collection contains strokes with different packet descriptions.");
        }

        // Add the stroke data to the collections.
        theStrokeIdentifiers.Add(aStroke.Id);
        thePacketCounts.Add(aStroke.PacketCount);
        thePacketData.AddRange(aStroke.GetPacketData());
    }

    // Add the stroke data to the base layer ink analyzer.
    System.Windows.Ink.AnalysisCore.ContextNodeBase result = baseInkAnalyzer.AddStrokes(
        theStrokeIdentifiers.ToArray(typeof(int)) as int[],
        thePacketCounts.ToArray(typeof(int)) as int[],
        thePacketData.ToArray(typeof(int)) as int[],
        thePacketDescription);

    return result;
}

プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkAnalyzerBase クラス

InkAnalyzerBase メンバ

AddStrokes オーバーロード

System.Windows.Ink.AnalysisCore 名前空間

InkAnalyzerBase.AddStroke

InkAnalyzerBase.RemoveStroke

InkAnalyzerBase.RemoveStrokes