Proprietà AnalysisAlternate.AlternateNodes
Aggiornamento: novembre 2007
Ottiene gli oggetti ContextNode associati all'oggetto AnalysisAlternate corrente.
Spazio dei nomi: System.Windows.Ink
Assembly: IAWinFX (in IAWinFX.dll)
Sintassi
'Dichiarazione
Public ReadOnly Property AlternateNodes As ContextNodeCollection
'Utilizzo
Dim instance As AnalysisAlternate
Dim value As ContextNodeCollection
value = instance.AlternateNodes
public ContextNodeCollection AlternateNodes { get; }
public:
property ContextNodeCollection^ AlternateNodes {
ContextNodeCollection^ get ();
}
/** @property */
public ContextNodeCollection get_AlternateNodes()
public function get AlternateNodes () : ContextNodeCollection
Valore proprietà
Tipo: System.Windows.Ink.ContextNodeCollection
Oggetti ContextNode associati a questa alternativa.
Note
Poiché corrispondono alle alternative, questi oggetti ContextNode non sono discendenti di RootNode dell'oggetto InkAnalyzer a meno che non costituiscano la prima alternativa, cioè il primo elemento in un oggetto AnalysisAlternateCollection.
AlternateNodes restituisce sempre un insieme di nodi foglia. Ad esempio, se l'oggetto AnalysisAlternate() è un oggetto LineNode, AlternateNodes restituisce un insieme di oggetti InkWordNode e non oggetti LineNode.
Esempi
Nell'esempio viene determinato se un oggetto AnalysisAlternate, selectedAlternate, ha la stessa segmentazione della prima alternativa in un oggetto AnalysisAlternateCollection, currentAlternates. Per segmentazione si intende il modo in cui i tratti vengono separati in oggetti ContextNode.
Dim hasSameSegmentationAsTop As Boolean = True
If currentAlternates.Count > 0 Then
Dim topAlternate As AnalysisAlternate = currentAlternates(0)
' First check if selected alternate is the top alternate
If selectedAlternate = 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
Dim i As Integer
For i = 0 To topAlternate.AlternateNodes.Count - 1
If topAlternate.AlternateNodes(i).Strokes.Count <> _
selectedAlternate.AlternateNodes(i).Strokes.Count Then
hasSameSegmentationAsTop = False
Exit For
End If
Dim stroke As Stroke
For Each stroke In topAlternate.AlternateNodes(i).Strokes
If Not selectedAlternate.AlternateNodes(i).Strokes.Contains(stroke) Then
hasSameSegmentationAsTop = False
Exit For
End If
Next stroke
Next i
End If
End If
End If
bool hasSameSegmentationAsTop = true;
if (currentAlternates.Count > 0)
{
AnalysisAlternate 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) && hasSameSegmentationAsTop; i++)
{
if (topAlternate.AlternateNodes[i].Strokes.Count !=
selectedAlternate.AlternateNodes[i].Strokes.Count)
{
hasSameSegmentationAsTop = false;
break;
}
foreach (Stroke stroke in topAlternate.AlternateNodes[i].Strokes)
{
if (!selectedAlternate.AlternateNodes[i].Strokes.Contains(stroke))
{
hasSameSegmentationAsTop = false;
break;
}
}
}
}
}
}
Piattaforme
Windows Vista
.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Informazioni sulla versione
.NET Framework
Supportato in: 3.0