다음을 통해 공유


ContextNode.CreatePartiallyPopulatedSubNode 메서드

업데이트: 2007년 11월

Type, IdLocation 정보만 들어 있는 자식 ContextNode 개체를 만듭니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink.Analysis(Microsoft.Ink.Analysis.dll)

구문

‘선언
Public Function CreatePartiallyPopulatedSubNode ( _
    type As Guid, _
    nodeId As Guid, _
    nodeLocation As AnalysisRegion _
) As ContextNode
‘사용 방법
Dim instance As ContextNode
Dim type As Guid
Dim nodeId As Guid
Dim nodeLocation As AnalysisRegion
Dim returnValue As ContextNode

returnValue = instance.CreatePartiallyPopulatedSubNode(type, _
    nodeId, nodeLocation)
public ContextNode CreatePartiallyPopulatedSubNode(
    Guid type,
    Guid nodeId,
    AnalysisRegion nodeLocation
)
public:
ContextNode^ CreatePartiallyPopulatedSubNode(
    Guid type, 
    Guid nodeId, 
    AnalysisRegion^ nodeLocation
)
public ContextNode CreatePartiallyPopulatedSubNode(
    Guid type,
    Guid nodeId,
    AnalysisRegion nodeLocation
)
public function CreatePartiallyPopulatedSubNode(
    type : Guid, 
    nodeId : Guid, 
    nodeLocation : AnalysisRegion
) : ContextNode

매개 변수

  • nodeId
    형식: System.Guid
    새 노드의 식별자입니다.

반환 값

형식: Microsoft.Ink.ContextNode
Type , IdLocation에 대한 정보만 들어 있는 새 ContextNode 개체입니다. 이 새 노드는 ContextNode의 자식입니다.

설명

이 메서드는 데이터 프록시에서 관련 정보가 모두 제공되기 전에 컨텍스트 노드 트리에 ContextNode 개체를 만들 때 사용됩니다. 이후에 관련 정보를 더 추가할 수 있습니다.

예제

다음 예제는 System.Windows.Forms.TreeView를 문서 모델로 사용하여 데이터 프록시에서 InkAnalyzer의 대한 컨텍스트 노드를 저장하고 로드하는 방법을 보여 주는 샘플 코드의 CreatePartiallyPopulatedNode라는 메서드입니다 DocumentNodeData 클래스는 각 TreeNode 개체의 Tag 속성을 DocumentNodeData 개체로 설정하여 문서 모델에 ContextNode 개체를 저장합니다. CreatePartiallyPopulatedNode 메서드는 TreeNode 개체 및 InkAnalyzer 개체를 사용하여 InkAnalyzer 컨텍스트 노드 트리에 문서 모델의 TreeNode에 해당하는 부분적으로 채워진 노드를 만듭니다. 이 예제에서 모든 노드는 부분적으로 채워져 생성됩니다. 그런 다음 노드 큐에 배치되어 이후에 모든 노드 데이터로 완전히 채워집니다.

이 메서드는 우선 전달된 TreeNode 개체의 Tag 속성에서 노드 데이터를 가져옵니다. 그런 다음 Id를 사용하여 노드가 현재 컨텍스트 노드 트리에 없는지 확인합니다. 그런 다음 트리 뷰 부모 노드를 사용하여 InkAnalyzer에서 해당 부모 노드를 찾습니다. 아직 컨텍스트 노드 트리에 없는 부모 노드는 재귀를 사용하여 추가됩니다. 부모 노드가 트리에 없는 경우에는 부분적으로 채워져야 합니다. 완전히 채워진 경우에는 이미 하위 노드가 모두 포함되어 있으므로 새 노드를 추가할 필요가 없게 됩니다. 따라서 PartiallyPopulated 속성은 부모 노드가 부분적으로 채워졌는지 확인하고, 부분적으로 채워진 경우 부모 노드를 큐에 추가하여 이후에 완전히 채웁니다. 부분적으로 채워지지 않은 경우에는 예외가 throw됩니다. 마지막으로 부모 노드에 대해 CreatePartiallyPopulatedSubNode를 호출하고 새로 만든 노드를 노드 큐에 추가하여 이후에 완전히 채웁니다. 그런 다음 ContextNode 개체를 반환합니다. 데이터 프록시에 대한 자세한 내용은 Data Proxy with Ink Analysis을를 참조하십시오.

Private Function CreatePartiallyPopulatedNode(ByVal documentNode As TreeNode, _
    ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer) As Microsoft.Ink.ContextNode

    Dim nodeData As DocumentNodeData = documentNode.Tag '

    ' Check that the node does not already exist in the InkAnalyzer.
    If Nothing <> theInkAnalyzer.FindNode(nodeData.Id) Then
        Throw New ApplicationException("The node already exists in the InkAnalyzer.")
    End If

    ' Find the parent analyzer node.
    Dim parentNodeData As DocumentNodeData = documentNode.Parent.Tag

    Dim analyzerParentNode As Microsoft.Ink.ContextNode = _
        theInkAnalyzer.FindNode(parentNodeData.Id)

    If Nothing = analyzerParentNode Then
        ' The parent analyzer node does not exist yet. Create one.
        analyzerParentNode = Me.CreatePartiallyPopulatedNode(documentNode.Parent, theInkAnalyzer)
    ElseIf analyzerParentNode.PartiallyPopulated Then
        ' The parent analyzer node exists and is partially populated. Add it
        ' to the stack of nodes to fully populate.
        Me.QueueNodeToPopulate(analyzerParentNode)
    Else
        ' The parent analyzer node exists and is fully populated. This
        ' should not happen.
        Throw New ApplicationException("The parent analyzer node is fully populated.")
    End If

    ' Create the partially populated node under its parent analyzer node.
    Dim analyzerNode As Microsoft.Ink.ContextNode = _
        analyzerParentNode.CreatePartiallyPopulatedSubNode(nodeData.Type, _
        nodeData.Id, nodeData.Location)

    ' Add the new node to the stack of nodes to fully populate.
    Me.QueueNodeToPopulate(analyzerNode)

    Return analyzerNode

End Function 'CreatePartiallyPopulatedNode
        private Microsoft.Ink.ContextNode CreatePartiallyPopulatedNode(
            TreeNode documentNode, Microsoft.Ink.InkAnalyzer theInkAnalyzer)
        {
            DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;

            // Check that the node does not already exist in the InkAnalyzer.
            if (null != theInkAnalyzer.FindNode(nodeData.Id))
            {
                throw new ApplicationException(
                    "The node already exists in the InkAnalyzer.");
            }

            // Find the parent analyzer node.
            DocumentNodeData parentNodeData =
                documentNode.Parent.Tag as DocumentNodeData;
            Microsoft.Ink.ContextNode analyzerParentNode =
                theInkAnalyzer.FindNode(parentNodeData.Id);
            if (null == analyzerParentNode)
            {
                // The parent analyzer node does not exist yet. Create one.
                analyzerParentNode =
                    this.CreatePartiallyPopulatedNode(
                        documentNode.Parent, theInkAnalyzer);
            }
            else if (analyzerParentNode.PartiallyPopulated)
            {
                // The parent analyzer node exists and is partially populated. Add it
                // to the stack of nodes to fully populate.
                this.QueueNodeToPopulate(analyzerParentNode);
            }
            else
            {
                // The parent analyzer node exists and is fully populated. This
                // should not happen.
                throw new ApplicationException(
                    "The parent analyzer node is fully populated.");
            }

            // Create the partially populated node under its parent analyzer node.
            Microsoft.Ink.ContextNode analyzerNode =
                analyzerParentNode.CreatePartiallyPopulatedSubNode(
                    nodeData.Type, nodeData.Id, nodeData.Location);

            // Add the new node to the stack of nodes to fully populate.
            this.QueueNodeToPopulate(analyzerNode);

            return analyzerNode;
        }

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

ContextNode 클래스

ContextNode 멤버

Microsoft.Ink 네임스페이스

ContextNode.PartiallyPopulated

Microsoft.Ink.ContextNodeType