public myListNode(string n, TreeNodeType t, IRObject o) { name = n; type = t; obj = o; this.Text = n; }
void treeView1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { TreeViewHitTestInfo info = treeView1.HitTest(e.Location); if (info.Node != null && info.Location == TreeViewHitTestLocations.StateImage) { TreeNode node = info.Node; Guid id = (Guid)node.Tag; switch (node.StateImageIndex) { case TriStateTreeView.STATE_UNCHECKED: case TriStateTreeView.STATE_MIXED: { this.axRenderControl1.ProjectTree.SetVisibility(id, 1); } break; case TriStateTreeView.STATE_CHECKED: { this.axRenderControl1.ProjectTree.SetVisibility(id, 0); } break; } } } else if (e.Button == MouseButtons.Right) { TreeViewHitTestInfo info = treeView1.HitTest(e.Location); if (info.Node != null && info.Location != TreeViewHitTestLocations.StateImage) { selectedNode = info.Node; selectedId = (Guid)selectedNode.Tag; IRObject obj = this.axRenderControl1.ObjectManager.GetObjectById(selectedId); if (this.axRenderControl1.ProjectTree.IsGroup(selectedId)) { this.contextMenuStrip1.Show(e.Location.X, e.Location.Y + 50); } else if (obj.Type == gviObjectType.gviObjectPresentation) { this.contextMenuStrip1.Show(e.Location.X, e.Location.Y + 50); } } } }
private void é£å ¥ToolStripMenuItem_Click(object sender, System.EventArgs e) { myListNode selectNode = this.listView1.SelectedItems[0] as myListNode; if (selectNode != null) { if (selectNode.type == TreeNodeType.NT_TERRAINLAYER) { ITerrain terrain = selectNode.obj as ITerrain; this.axRenderControl1.Terrain.FlyTo(gviTerrainActionCode.gviFlyToTerrain); } else { IRObject rgeo = selectNode.obj as IRObject; this.axRenderControl1.Camera.FlyToObject(rgeo.Guid, gviActionCode.gviActionFlyTo); } } }