Share via


ContextNode.PartiallyPopulated Property

Gets or sets a value that indicates whether a ContextNode object is partially populated or fully populated.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public Property PartiallyPopulated As Boolean
'Usage
Dim instance As ContextNode 
Dim value As Boolean 

value = instance.PartiallyPopulated

instance.PartiallyPopulated = value
public bool PartiallyPopulated { get; set; }
public:
property bool PartiallyPopulated {
    bool get ();
    void set (bool value);
}
public function get PartiallyPopulated () : boolean 
public function set PartiallyPopulated (value : boolean)

Property Value

Type: System.Boolean
true if the ContextNode object does not contain complete data during the data proxy process; false if all of the data has been added.

Remarks

Use this property for data proxy when ContextNode objects are created in the context node tree before all the information about it is available. This property indicates whether the full population of data has occurred.

When setting this value to true, if the ContextNode is not a RootNode, CustomRecognizer, AnalysisHint or unknown ContextNode, then it must have a non-empty Location value.

If a stroke is deleted and the stroke is not found in the stroke cache and part of the tree is marked as PartiallyPopulated, then the application is not notified via events that it should remove that stroke from the InkAnalyzer. The application is responsible for removing the stroke.

When virtualizing your document tree, be sure to set the PropertyGuidsForContextNodes.RotatedBoundingBox value (using ContextNode.AddPropertyValue) on all ContextNode objects. The RotatedBoundingBox property is calculated by the InkAnalyzer and by default should be on all writing ContextNodes. However, if your application virtualizes the analysis results by setting the PartiallyPopulated property, when handling the PopulateContextNode event be sure to populate the RotatedBoundingBox property. Failure to set the RotatedBoundingBox property will result in potentially more document data being used in the current analysis operation

Examples

The following example is a method called PopulateNode, from sample code that uses a System.Windows.Forms.TreeView as a document model to show how data proxy can be used to store and load a context node tree for an InkAnalyzer. The DocumentNodeData class stores the ContextNode data in the document model when the Tag property of each TreeNode object is set to a DocumentNodeData object.

The PopulateNode method uses a ContextNode object and an InkAnalyzer object to fully populate the context node by adding strokes, property data, annotation type, child nodes, and links. The data comes from the DocumentNodeData object that is obtained from the corresponding TreeNode.

  • this[analyzerNode.Id] is an indexer on the document model class that maps a Guid to a TreeNode.

  • AddLinksToAnalyer is a method on the document model class that adds links to the ContextNode.

After the node is fully populated, the PartiallyPopulated property is set to false.

Sub PopulateNode(ByVal analyzerNode As Microsoft.Ink.ContextNode, _
                 ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer) _
                 Implements IDocumentModel.PopulateNode

    System.Diagnostics.Debug.WriteLine( _
        String.Format("IDocumentModel.PopulateNode: populate {0} {1}.", _
        TreeViewDocumentModel.GetContextNodeTypeName(analyzerNode.Type), analyzerNode.Id))

    System.Diagnostics.Debug.Indent()

    ' Get the document node associated with the analyzer node. 
    Dim documentNode As TreeNode = Me(analyzerNode.Id)
    If documentNode Is Nothing Then 
        Throw New ApplicationException("The requested node does not exist in the document model.")
    End If 

    ' Get the data associated with the node. 
    Dim nodeData As DocumentNodeData = documentNode.Tag '

    ' Copy any application specific data associated with the node to the 
    ' partially populated ContextNode. 
    Dim identifier As Guid
    For Each identifier In nodeData.GetPropertyDataIds()
        analyzerNode.AddPropertyData(identifier, nodeData.GetPropertyData(identifier))
    Next identifier

    ' Check if the partially populated ContextNode is an ink leaf node. 
    If nodeData.IsInkLeafNode Then 
        ' Add the strokes to the context node.
        analyzerNode.SetStrokes(nodeData.Strokes)
    Else 
        ' Add each child subnode as a partially populated ContextNode. 
        Dim documentSubNode As TreeNode
        For Each documentSubNode In documentNode.Nodes
            ' Get the DocumentNode data for the  
            Dim subNodeData As DocumentNodeData = documentSubNode.Tag

            If analyzerNode.SubNodes.IndexOf(nodeData.Id) <> -1 Then
                analyzerNode.CreatePartiallyPopulatedSubNode( _
                    subNodeData.Type, subNodeData.Id, subNodeData.Location)
            End If 

        Next documentSubNode
    End If 

    ' Add links to the ContextNode. 
    Me.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer)

    ' Update the partially populated flag.
    analyzerNode.PartiallyPopulated = False

    System.Diagnostics.Debug.Unindent()

End Sub 'IDocumentModel.PopulateNode
        void IDocumentModel.PopulateNode(
            Microsoft.Ink.ContextNode analyzerNode,
            Microsoft.Ink.InkAnalyzer theInkAnalyzer)
        {
            System.Diagnostics.Debug.WriteLine(string.Format(
                "IDocumentModel.PopulateNode: populate {0} {1}.",
                TreeViewDocumentModel.GetContextNodeTypeName(analyzerNode.Type),
                analyzerNode.Id));
            System.Diagnostics.Debug.Indent();

            // Get the document node associated with the analyzer node.
            TreeNode documentNode = this[analyzerNode.Id];
            if (null == documentNode)
            {
                throw new ApplicationException(
                    "The requested node does not exist in the document model.");
            }

            // Get the data associated with the node.
            DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;

            // Copy any application specific data associated with the node to the 
            // partially populated ContextNode. 
            foreach (Guid identifier in nodeData.GetPropertyDataIds())
            {
                analyzerNode.AddPropertyData(
                    identifier, nodeData.GetPropertyData(identifier));
            }

            // Check if the partially populated ContextNode is an ink leaf node. 
            if (nodeData.IsInkLeafNode)
            {
                // Add the strokes to the context node.
                analyzerNode.SetStrokes(nodeData.Strokes);
            }
            else
            {
                // Add each child subnode as a partially populated ContextNode. 
                foreach (TreeNode documentSubNode in documentNode.Nodes)
                {
                    // Get the DocumentNode data for the 
                    DocumentNodeData subNodeData = documentSubNode.Tag as DocumentNodeData;

                    if (analyzerNode.SubNodes.IndexOf(nodeData.Id) != -1)
                    {
                        analyzerNode.CreatePartiallyPopulatedSubNode(
                            subNodeData.Type, subNodeData.Id, subNodeData.Location);
                    }
                }
            }

            // Add links to the ContextNode. 
            this.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer);

            // Update the partially populated flag.
            analyzerNode.PartiallyPopulated = false;

            System.Diagnostics.Debug.Unindent();
        }

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextNode Class

ContextNode Members

Microsoft.Ink Namespace