IContextNode interface

Represents a node in a tree of objects that are created as part of ink analysis.

Members

The IContextNode interface inherits from the IUnknown interface. IContextNode also has these types of members:

Methods

The IContextNode interface has these methods.

Method Description
AddContextLink Adds a new IContextLink to the IContextNode object's context link collection.
AddPropertyData Adds a piece of application-specific data.
Confirm Modifies the confirmation type, which controls what the IInkAnalyzer object can change about the IContextNode.
ContainsPropertyData Determines whether the IContextNode object contains data stored under the specified identifier.
CreatePartiallyPopulatedSubNode Creates a child IContextNode object that contains only information on type, identifier, and location.
CreateSubNode Creates a new child IContextNode object.
DeleteContextLink Deletes an IContextLink object from the IContextNode object's link collection.
DeleteSubNode Removes a child IContextNode.
GetContextLinks Retrieves a collection of IContextLink objects that represents relationships with other IContextNode objects.
GetId Retrieves the identifier for the IContextNode object.
GetLocation Retrieves the position and size of the IContextNode object.
GetParentNode Retrieves the parent node of this IContextNode in the context node tree.
GetPartiallyPopulated Retrieves the value that indicates whether an IContextNode object is partially populated or fully populated.
GetPropertyData Retrieves application-specific data or other property data given the specified identifier.
GetPropertyDataIds Retrieves the identifiers for which there is property data.
GetStrokeCount Retrieves the number of strokes associated with the IContextNode object.
GetStrokeId Retrieves the stroke identifier for the stroke referenced by an index value within the IContextNode object.
GetStrokeIds Retrieves an array of identifiers for the strokes within the IContextNode object.
GetStrokePacketDataById Retrieves an array containing the packet property data for the specified stroke.
GetStrokePacketDescriptionById Retrieves an array containing the packet property identifiers for the specified stroke.
GetSubNodes Retrieves the direct child nodes of the IContextNode object.
GetType Retrieves the type of the IContextNode object.
GetTypeName Retrieves a human-readable type name of this IContextNode.
IsConfirmed Retrieves a value that indicates whether the IContextNode object is confirmed. IInkAnalyzer cannot change the node type and associated strokes for confirmed IContextNode objects.
LoadPropertiesData Recreates the application-specific and internal property data for an array of bytes that was previously created with IContextNode::SavePropertiesData.
MoveSubNodeToPosition Reorders a specified child IContextNode object to the specified index.
RemovePropertyData Removes a piece of application-specific data.
Reparent Moves this IContextNode object from its parent context node's subnodes collection to the specified context node's subnodes collection.
ReparentStrokeByIdToNode Moves stroke data from this IContextNode to the specified IContextNode.
SavePropertiesData Retrieves an array of bytes that contains the application-specific and internal property data for this IContextNode.
SetLocation Updates the position and size of this IContextNode.
SetPartiallyPopulated Modifies the value that indicates whether this IContextNode is partially or fully populated.
SetStrokes Associates the specified strokes with this IContextNode.

Remarks

The types of nodes are described in the Context Node Types constants.

Examples

The following example shows a method that examines an IContextNode; the method does the following:

  • Gets the context node's type. If the context node is an unclassified ink, analysis hint, or custom recognizer node, it calls a helper method to examine specific properties of the node type.
  • If the node has subnodes, it examines each subnode by calling itself.
  • If the node is an ink leaf node, it examines the stroke data for the node by calling a helper method.

Ihe InkAnalysis API allows you to create a line node that contains ink words and text words. However, the parser will ignore these mixed nodes and will treat them like foreign nodes. This will have impact the parsing accuracy of detecting ink annotations when the end user writes on or around this mixed node.

HRESULT CMyClass::ExploreContextNode(
    IContextNode *pContextNode)
{
    // Check for certain types of context nodes.
    GUID ContextNodeType;
    HRESULT hr = pContextNode->GetType(&ContextNodeType);

    if (SUCCEEDED(hr))
    {
        if (IsEqualGUID(GUID_CNT_UNCLASSIFIEDINK, ContextNodeType))
        {
            // Call a helper method that explores unclassified ink nodes.
            hr = this->ExploreUnclassifiedInkNode(pContextNode);
        }
        else if (IsEqualGUID(GUID_CNT_ANALYSISHINT, ContextNodeType))
        {
            // Call a helper method that explores analysis hint nodes.
            hr = this->ExploreAnalysisHintNode(pContextNode);
        }
        else if (IsEqualGUID(GUID_CNT_CUSTOMRECOGNIZER, ContextNodeType))
        {
            // Call a helper method that explores custom recognizer nodes.
            hr = this->ExploreCustomRecognizerNode(pContextNode);
        }

        if (SUCCEEDED(hr))
        {
            // Check if this node is a branch or a leaf node.
            IContextNodes *pSubNodes = NULL;
            hr = pContextNode->GetSubNodes(&pSubNodes);

            if (SUCCEEDED(hr))
            {
                ULONG ulSubNodeCount;
                hr = pSubNodes->GetCount(&ulSubNodeCount);

                if (SUCCEEDED(hr))
                {
                    if (ulSubNodeCount > 0)
                    {
                        // This node has child nodes; explore each child node.
                        IContextNode *pSubNode = NULL;
                        for (ULONG index=0; index<ulSubNodeCount; index++)
                        {
                            hr = pSubNodes->GetContextNode(index, &pSubNode);

                            if (SUCCEEDED(hr))
                            {
                                // Recursive call to explore the child node of this
                                // context node.
                                hr = this->ExploreContextNode(pSubNode);
                            }

                            // Release this reference to the child context node.
                            if (pSubNode != NULL)
                            {
                                pSubNode->Release();
                                pSubNode = NULL;
                            }

                            if (FAILED(hr))
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        // This is a leaf node. Check if it contains stroke data.
                        ULONG ulStrokeCount;
                        hr = pContextNode->GetStrokeCount(&ulStrokeCount);

                        if (SUCCEEDED(hr))
                        {
                            if (ulStrokeCount > 0)
                            {
                                // This node is an ink leaf node; call helper
                                // method that explores available stroke data.
                                hr = this->ExploreNodeStrokeData(pContextNode);
                            }
                        }
                    }
                }
            }

            // Release this reference to the subnodes collection.
            if (pSubNodes != NULL)
            {
                pSubNodes->Release();
                pSubNodes = NULL;
            }
        }
    }

    return hr;
}

Requirements

Requirement Value
Minimum supported client
Windows XP Tablet PC Edition [desktop apps only]
Minimum supported server
None supported
Header
IACom.h (also requires IACom_i.c)
DLL
IACom.dll

See also

IContextNodes

Context Node Types

IInkAnalyzer

Ink Analysis Reference