ContextNode.PartiallyPopulated 属性
获取或设置一个值,该值指示 ContextNode 对象是部分填充还是完全填充。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)
语法
声明
Public Property PartiallyPopulated As Boolean
用法
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);
}
/** @property */
public boolean get_PartiallyPopulated()
/** @property */
public void set_PartiallyPopulated(boolean value)
public function get PartiallyPopulated () : boolean
public function set PartiallyPopulated (value : boolean)
属性值
类型:System.Boolean
如果 ContextNode 对象在数据代理过程中未包含完整的数据,则为 true;如果已添加所有数据,则为 false。
备注
如果在上下文节点树中创建 ContextNode 对象时没有获得关于该对象的全部信息,则可将此属性用于数据代理。此属性指示是否已经发生完全数据填充。
将此值设置为 true 时,如果 ContextNode 不是 RootNode、CustomRecognizer、AnalysisHint 或未知的 ContextNode,那么它必须具有非空的 Location 值。
如果删除了某个笔画,在笔画缓存中找不到该笔画,并且部分树被标记为 PartiallyPopulated,那么应用程序不会通过事件得到应从 InkAnalyzer 移除该笔画的通知。应用程序负责移除该笔画。
在虚拟化文档树时,请确保对所有 ContextNode 对象设置 PropertyGuidsForContextNodes.RotatedBoundingBox 值(使用 ContextNode.AddPropertyValue)。RotatedBoundingBox 属性由 InkAnalyzer 计算,并且默认情况下应作用于所有书写 ContextNode 上。但是,如果应用程序通过设置 PartiallyPopulated 属性来虚拟化分析结果,请确保在处理 PopulateContextNode 事件时填充 RotatedBoundingBox 属性。设置 RotatedBoundingBox 属性失败有可能导致在当前分析操作中使用更多的文档数据。
示例
下面的示例是一段示例代码中一个名为 PopulateNode 的方法,该示例代码使用 System.Windows.Forms.TreeView 作为一个文档模型来演示如何使用数据代理来存储和加载 InkAnalyzer 的上下文节点树。当每个 TreeNode 对象的 Tag 属性都设置为一个 DocumentNodeData 对象时,DocumentNodeData 类在该文档模型中存储 ContextNode 数据。
PopulateNode 方法使用 ContextNode 对象和 InkAnalyzer 对象,通过添加笔画、属性数据、批注类型、子节点和链接来完全填充上下文节点。数据来自从对应的 TreeNode 获取的 DocumentNodeData 对象。
AddLinksToAnalyer 是文档模型类用于将链接添加到 ContextNode 的方法。
在节点完全填充之后,PartiallyPopulated 属性设置为 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();
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0