Closed GoogleCodeExporter closed 9 years ago
Actually I found that same problem happens with ApiObjectVisible and other
properties of nodes - you just do not refresh them. I suggest to add the
following public method to your KmlTreeViewNode class:
public void RefreshNode()
{
try
{
this.Name = this.ApiObject.getId();
this.ApiType = GEHelpers.GetApiType(this.ApiObject);
this.Text = this.ApiObject.getName();
this.ApiObjectVisible = Convert.ToBoolean(this.ApiObject.getVisibility());
this.StateImageIndex = this.ApiObjectVisible ? 1 : 0;
this.Checked = this.ApiObjectVisible;
}
catch (RuntimeBinderException)
{
}
}
In this case the constructor of this class will be turned into:
/// <summary>
/// Initializes a new instance of the KmlTreeViewNode class.
/// </summary>
/// <param name="kmlObject">A kml object to base the treenode on</param>
internal KmlTreeViewNode(dynamic kmlObject)
: base()
{
this.ApiObject = kmlObject;
RefreshNode();
this.SetStyle();
}
... , and the KmlTreeView->Refresh method will have to call the
KmlTreeViewNode->RefreshNode method - something like this:
public override void Refresh()
{
[...]
Stack<KmlTreeViewNode> stack =
new Stack<KmlTreeViewNode>(this.Nodes.Count);
foreach (KmlTreeViewNode node in this.Nodes)
{
node.RefreshNode(); // Refreshing internal properties of each node
stack.Push(node);
}
[...]
}
Alexander ;o)
Original comment by alex.nes...@3dcondox.com
on 30 Dec 2011 at 6:24
Many thanks for this Alexander, I have actually just been updating the
KmlTreeView, KmlTreeViewNode and GEServer classes to introduce richer support
for NetworkLinks and I have included this functionality. Not sure how I missed
that, great catch!
Thanks,
Fraser
Original comment by fraser.c...@gmail.com
on 7 Feb 2012 at 8:29
Original comment by fraser.c...@gmail.com
on 8 Feb 2012 at 6:22
Original issue reported on code.google.com by
alex.nes...@3dcondox.com
on 29 Dec 2011 at 11:34