Поделиться через


AnalysisAlternateBase.AlternateNodes - свойство

Обновлен: Ноябрь 2007

Gets the ContextNodeBase objects that are associated with this alternate.

Пространство имен:  System.Windows.Ink.AnalysisCore
Сборка:  IACore (в IACore.dll)

Синтаксис

'Декларация
Public ReadOnly Property AlternateNodes As ContextNodeBaseCollection
'Применение
Dim instance As AnalysisAlternateBase
Dim value As ContextNodeBaseCollection

value = instance.AlternateNodes
public ContextNodeBaseCollection AlternateNodes { get; }
public:
property ContextNodeBaseCollection^ AlternateNodes {
    ContextNodeBaseCollection^ get ();
}
/** @property */
public ContextNodeBaseCollection get_AlternateNodes()
public function get AlternateNodes () : ContextNodeBaseCollection

Значение свойства

Тип: System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
The ContextNodeBase objects that are associated with this alternate.

Заметки

Because they correspond to alternates, these ContextNodeBase objects are not descendants of the RootNode of the InkAnalyzerBase unless they are the top alternate, which is the first element in an AnalysisAlternateBaseCollection.

Примеры

This example determines whether an AnalysisAlternateBase, selectedAlternate, has the same segmentation as the top alternate in an AnalysisAlternateBaseCollection, currentAlternates. Segmentation refers to how the strokes are separated into ContextNodeBase objects.

Dim hasSameSegmentationAsTop As Boolean = True
If currentAlternates.Count > 0 Then
    Dim topAlternate As AnalysisAlternateBase = currentAlternates(0)
    ' First check if selected alternate is the top alternate
    If selectedAlternate.Equals(topAlternate) Then
        hasSameSegmentationAsTop = True
    Else
        ' Check to see if they have the same strokes
        If topAlternate.AlternateNodes.Count <> selectedAlternate.AlternateNodes.Count Then
            hasSameSegmentationAsTop = False
        Else
            ' Check that each node matches the alternates
            For index As Integer = 0 To topAlternate.AlternateNodes.Count - 1

                Dim selectedAlternateNodesStrokes As Strokes = _
                    theInk.CreateStrokes(selectedAlternate.AlternateNodes(index).GetStrokeIds())

                Dim topAlternateNodesStrokes As Strokes = _
                        theInk.CreateStrokes(topAlternate.AlternateNodes(index).GetStrokeIds())

                For Each topStroke As Stroke In topAlternateNodesStrokes
                    If (Not selectedAlternateNodesStrokes.Contains(topStroke)) Then
                        hasSameSegmentationAsTop = False
                        Exit For
                    End If
                Next topStroke

            Next index

        End If

    End If

End If
bool hasSameSegmentationAsTop = true;
if (currentAlternates.Count > 0)
{
    AnalysisAlternateBase topAlternate = currentAlternates[0];
    // First check if selected alternate is the top alternate
    if (selectedAlternate == topAlternate)
    {
        hasSameSegmentationAsTop = true;
    }
    else
    {
        // Check to see if they have the same strokes
        if (topAlternate.AlternateNodes.Count != selectedAlternate.AlternateNodes.Count)
        {
            hasSameSegmentationAsTop = false;
        }
        else
        {
            // Check that each node matches the alternates
            for (int i = 0; i < topAlternate.AlternateNodes.Count; i++)
            {
                Strokes selectedAlternateNodesStrokes =
                    theInk.CreateStrokes(selectedAlternate.AlternateNodes[i].GetStrokeIds());
                Strokes topAlternateNodesStrokes =
                    theInk.CreateStrokes(topAlternate.AlternateNodes[i].GetStrokeIds());

                foreach (Stroke stroke in topAlternateNodesStrokes)
                {
                    if (!selectedAlternateNodesStrokes.Contains(stroke))
                    {
                        hasSameSegmentationAsTop = false;
                        break;
                    }
                }
            }
        }
    }
}

Платформы

Windows Vista, Windows XP с пакетом обновления 2 (SP2), Windows Server 2003

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

AnalysisAlternateBase Класс

AnalysisAlternateBase - члены

System.Windows.Ink.AnalysisCore - пространство имен