다음을 통해 공유


InkAnalyzerBase.AddStrokes 메서드 (array<Int32[], array<Int32[], array<Int32[], array<Guid[])

업데이트: 2007년 11월

여러 스트로크에 대한 스트로크 데이터를 잉크 분석기에 추가하고 활성 입력 스레드의 문화권 식별자를 스트로크에 할당합니다.

네임스페이스:  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
잉크 분석기에서 스트로크를 추가한 컨텍스트 노드입니다.

설명

InkAnalyzerBaseType 속성 값이 UnclassifiedInk()인 ContextNodeBase에 스트로크를 추가합니다.

잉크 분석기는 활성 입력 스레드의 문화권 식별자를 스트로크에 할당합니다. 그런 다음 잉크 분석기의 루트 노드 아래에서 같은 문화권 식별자를 갖는 스트로크를 포함하는 첫 번째 분류되지 않은 잉크 노드에 스트로크를 추가합니다. 잉크 분석기는 같은 문화권 식별자를 갖는 노드를 찾지 못하는 경우 루트 노드 아래에 새 ContextNodeBase를 만들고 스트로크를 이 분류되지 않은 새 잉크 노드에 추가합니다.

strokePacketData에는 모든 스트로크에 대한 패킷 데이터가 들어 있습니다. strokePacketDescription에는 각 스트로크의 각 점에 대해 포함된 패킷 데이터의 형식을 설명하는 GUID(Globally Unique Identifier)가 들어 있습니다. 사용 가능한 패킷 속성의 전체 목록은 PacketProperty 클래스를 참조하십시오.

AddStrokes를 한 번 호출하여 패킷 설명이 동일한 스트로크만 추가할 수 있습니다.

이 메서드는 DirtyRegion을 영역의 현재 값과 추가된 스트로크의 경계 상자를 합친 영역으로 확장합니다.

InkAnalyzerBase에 이미 동일한 식별자를 갖는 스트로크가 추가될 스트로크 중 하나로 포함된 경우 InkAnalyzerBase에서 예외가 throw됩니다.

예제

이 예제에서는 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