/** * Method for load tree * Status: OK * Note: if you add a new treeLoader, update the switch... */ public void LoadTree(string path, TreeType treeType = TreeType.StockTechTree) { ResetTree(); if (_treeData == null) { return; } var parser = new Parser(); _config = parser.ParseConfig(path); switch (treeType) { case TreeType.StockTechTree: _treeLoader = new StockTechTreeLoader(); break; case TreeType.YongeTech: _treeLoader = new YongeTechTreeLoader(); break; default: throw new Exception("The techtree's file format is not reconized !"); } _treeLoader.LoadTree(_config, _treeData); _treeData.LinkNodes(); _treeData.WorkspaceViewModel.StatusBarText = "Tree Loaded"; }
private void RoleForm_Load(object sender, EventArgs e) { this.tvRole.Nodes.Clear(); TreeNode node = new TreeNode("角色"); this.tvRole.Nodes.Add(node); this.tvRolePerm.Nodes.Clear(); this.InitRoleTree(); if (node.Nodes.Count > 0) { TreeLoader.Load(this.tvRolePerm, this, "/Aisino/Menu", true); if (UserInfo.IsAdmin) { this.hasNewPermit = true; this.hasUpdPermit = true; this.hasDelPermint = true; } else { if (UserInfo.Gnqx != null) { this.funcIdList = UserInfo.Gnqx; } foreach (TreeNode node2 in this.tvRolePerm.Nodes) { this.RemoveUnPermNodes(node2); } this.ChangeRoleBtnState(); } this.tvRole.SelectedNode = node.Nodes[0]; } }
private void NewRoleForm_Load(object sender, EventArgs e) { this.tvFunc.Nodes.Clear(); TreeLoader.Load(this.tvFunc, this, "/Aisino/Menu", true); foreach (TreeNode node in this.tvFunc.Nodes) { if (node.Text == "系统维护") { foreach (TreeNode node2 in node.Nodes) { if (node2.Text == "用户权限设置") { this.tvFunc.Nodes.Remove(node2); break; } } } } if (!UserInfo.IsAdmin) { if (UserInfo.Gnqx != null) { this.funcIdList = UserInfo.Gnqx; } foreach (TreeNode node3 in this.tvFunc.Nodes) { this.RemoveUnPermNodes(node3); } } this.tvFunc.ExpandAll(); }
/** * Parse file and render buildings when scene starts */ private void Start() { Caching.ClearCache(); //hide and lock cursor into center UiUtils.HideCursor(); TutorialUtils.InitTutorial(TutorialCanvas, Settings); BuildingPickerCanvas.SetActive(false); ExitCanvasDialog.SetActive(false); //load XML file tags var xmlFile = new XmlDocument(); //load file xmlFile.Load(FileUtils.GetFullMapPath(Map.MapName)); //get node and way tags var nodeTags = xmlFile.SelectNodes(".//node"); var wayTags = xmlFile.SelectNodes(".//way"); //cache IDs in node tag for coordinate pairing var nodeTagIds = CacheNodeTagIds(nodeTags); //parse building and roads var buildings = BuildingLoader.Get().LoadFile(nodeTags, nodeTagIds, wayTags); var roads = RoadLoader.Get().LoadFile(nodeTags, nodeTagIds, wayTags); var trees = TreeLoader.Get().LoadFile(); var mapMiddlePoint = GetMiddlePoint(buildings, roads); //download elevation data AltitudeLoader.Get().SetAltitude(TerrainUtils.GetLatLngGrid(mapMiddlePoint)); //render terrain, buildings, roads etc. StartCoroutine(RenderObjects(mapMiddlePoint, buildings, roads, trees)); }
private void method_8() { FormSplashHelper.MsgWait("正在准备系统主界面..."); base.WindowState = FormWindowState.Maximized; Rectangle rectangle = PropertyUtil.GetRectangle("Site", new Rectangle(10, 10, base.Width, base.Height)); rectangle.X = (rectangle.X < 100) ? 0 : rectangle.X; rectangle.Y = (rectangle.Y < 100) ? 0 : rectangle.Y; base.StartPosition = FormStartPosition.Manual; base.Bounds = rectangle; base.FormClosing += new FormClosingEventHandler(this.NormalMainForm_FormClosing); this.navigatePage_0 = new NavigatePage(); this.navigatePage_0.Dock = DockStyle.Left; base.Controls.Add(this.navigatePage_0); TreeLoader.Load(this.navigatePage_0, this.dockPanel1, "/Aisino/Tree", false); this.navigateToolScrip_0 = new NavigateToolScrip(); this.navigateToolScrip_0.Dock = DockStyle.Top; base.Controls.Add(this.navigateToolScrip_0); this.navigateToolScrip_0.Load(this.method_9("1"), this.navigatePage_0.Nodes); this.navigateToolScrip_0.ItemAdd += new EventHandler(this.navigateToolScrip_0_ItemAdd); this.contextMenuStrip_0 = new ContextMenuStrip(); MenuLoader.Load(this.contextMenuStrip_0.Items, this.dockPanel1, "/Aisino/Menu"); if (this.contextMenuStrip_0.Items.Count > 0) { base._menu = this.contextMenuStrip_0; } base.Controls.Add(base.statusStrip1); FormSplashHelper.MsgWait(); }
public DockOutLookBar(object object_0) { this.InitializeComponent_1(); this.BackColor = Color.FromArgb(0xf3, 0xf3, 0xf3); TreeLoader.Load(this.outlookBar1, object_0, "/Aisino/Tree", false); this.bool_0 = this.outlookBar1.Nodes.Count > 0; }
public JsonResult GetChildrenCount(string typeName, int?id, bool plus) { if (typeName == "root") { return(Json((plus ? 1 : -1) * TreeLoader.CalculateDescendants(BSUIR), JsonRequestBehavior.AllowGet)); } return(Json((plus ? 1 : -1) * TreeLoader.GetNumberOfDescendants(typeName, (int)id, rep), JsonRequestBehavior.AllowGet)); }
public void TreeLoad() { this.lastTree1.Nodes.Clear(); TreeLoader.Load(this.lastTree1, this, "/Aisino/Tree", false); for (int i = this.lastTree1.Nodes.Count; i > 0; i--) { this.NodeEx(this.lastTree1.Nodes[i - 1]); } }
public JsonResult GetChildren(string typeName, int?id) { if (typeName == "root") { return(Json(TreeLoader.GetNodeInfo(BSUIR), JsonRequestBehavior.AllowGet)); } object wanted = TreeLoader.GetNodeInfo(typeName, (int)id, rep); return(Json(wanted, JsonRequestBehavior.AllowGet)); }
public static MvcHtmlString DisciplinesTreeFor <TModel>( this HtmlHelper <TModel> html, string collectionName, IEnumerable <DisciplineViewModel> all, IEnumerable <DisciplineViewModel> selected = null) { var treeLoader = new TreeLoader <int, DisciplineViewModel>( x => x.Id, x => x.ParentId); var treeBuilder = new DisciplinesCheckboxesTreeBuilder( collectionName, selected); return(treeBuilder.BuildHtmlTree(treeLoader.Load(all))); }
public void LoadTree(int index) { DisableWorldError(); TreeLoader.LoadTree(index); if (TreeLoader.CurrentTree != null) { TreeBuilder.Instance.BuildTree(TreeLoader.CurrentTree); } else //it's all gone horribly wrong - the newick parser has failed to parse the tree { GameManager.DebugLog("Tree loading failed"); TreeBuilder.Instance.ResetTreeContainer(); ShowWorldError(NewickParser.ErrorMessage); } }
void Start() { worldErrorText = worldErrorPanel.GetComponentInChildren <Text>(); DisableWorldError(); TreeLoader._init(); if (TreeLoader.CurrentTree != null) { TreeBuilder.Instance.BuildTree(TreeLoader.CurrentTree); } else //it's all gone horribly wrong - the newick parser has failed to parse the tree { GameManager.DebugLog("Tree loading failed"); ShowWorldError(NewickParser.ErrorMessage); } }
private void tvRole_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode selectedNode = this.tvRole.SelectedNode; if (selectedNode.Tag is Role) { Role tag = (Role)selectedNode.Tag; if (tag.Name != "管理员") { this.tsbtnUpdRole.Enabled = true; this.tsbtnDelRole.Enabled = true; foreach (TreeNode node2 in this.tvRolePerm.Nodes) { if (node2.Text == "系统维护") { foreach (TreeNode node3 in node2.Nodes) { if (node3.Text == "用户权限设置") { this.tvRolePerm.Nodes.Remove(node3); break; } } } } } else { this.tsbtnUpdRole.Enabled = false; this.tsbtnDelRole.Enabled = false; this.tvRolePerm.Nodes.Clear(); TreeLoader.Load(this.tvRolePerm, this, "/Aisino/Menu", true); } this.FillRoleInfo((Role)selectedNode.Tag); this.CollapseUncheckedNodes(); } }
public static void RunTests() { Dictionary <string, Sequence> loadedGenomes = new Dictionary <string, Sequence>(); System.IO.StreamWriter sw = new System.IO.StreamWriter("FailedTests.txt"); sw.WriteLine("Haplogroup\tAccession\tReasonFailed\tInGenbankNotHaplogrep\tInHaplogrepNotGenbank"); //First to load up the accession numbers string fileName = "PhyloTreeSequences.fasta.gz"; FastAZippedParser fap = new FastAZippedParser(fileName); foreach (var seq in fap.Parse()) { var accession = seq.ID.Split('|')[3]; loadedGenomes[accession] = seq as Sequence; if (accession.Contains('.')) { loadedGenomes[accession.Split('.')[0]] = seq as Sequence; } } //now to grab all the trees //var tree = TreeLoader.LoadTree(CONSTANTS.TREE_XML_FILE); var tree = TreeLoader.LoadTree(); int FailedTests = 0; int PassedTests = 0; int AmbiguousFail = 0; int SharedPolys = 0; int UnSharedPolys = 0; HashSet <int> BadPositions = new HashSet <int>(); foreach (var node in tree.GetAllChildren()) { //if (node.haplogroup.id != "J1c3g") //{ continue; } try { //ignore empty and thousand genomes if (!String.IsNullOrEmpty(node.haplogroup.AccessionId) && !node.haplogroup.AccessionId.StartsWith("NA") && !node.haplogroup.AccessionId.StartsWith("HG")) { var id = node.haplogroup.AccessionId; if (id == "NC_012920") { continue; } var seq = loadedGenomes[id]; if (seq.Alphabet.HasAmbiguity) { //sw.WriteLine(node.haplogroup.id + "\t" + node.haplogroup.AccessionId + "\tAmbiguousSequence"); AmbiguousFail++; continue; } //now check for differences var origfoundPolys = NewSearchMethods.GenomeToHaploGrepConverter.FindPolymorphisms(seq).Where(x => !CONSTANTS.EXCLUDED_POSITIONS.Contains(x.position)).ToList(); var currentPolys = node.Mutations.ToList();//copy List <Polymorphism> removeLater = new List <Polymorphism>(); var foundPolys = origfoundPolys.ToList(); foreach (var poly in origfoundPolys) { if (currentPolys.Contains(poly)) { SharedPolys++; currentPolys.Remove(poly); foundPolys.Remove(poly); } } currentPolys.Sort((x, y) => x.position.CompareTo(y.position)); currentPolys = CONSTANTS.CommonPolymorphismFilter(currentPolys).ToList(); foundPolys = CONSTANTS.CommonPolymorphismFilter(foundPolys).ToList(); if (currentPolys.Count > 0)// || foundPolys.Count > 0) { UnSharedPolys += currentPolys.Count + foundPolys.Count; sw.WriteLine(node.haplogroup.id + "\t" + node.haplogroup.AccessionId + "\tMismatchedPolymorphisms" + "\t" + String.Join("-", foundPolys.Select(x => (object)x).ToArray()) + "\t" + String.Join("-", currentPolys.Select(x => (object)x).ToArray()) ); FailedTests++; foreach (var v in foundPolys) { BadPositions.Add(v.position); } foreach (var v in currentPolys) { BadPositions.Add(v.position); } } else { PassedTests++; } } } catch (Exception thrown) { sw.WriteLine(node.haplogroup.id + "\t" + node.haplogroup.AccessionId + "\t" + thrown.Message); } } sw.Close(); sw = new System.IO.StreamWriter("TestReport.txt"); sw.WriteLine("Failed Tests\t" + FailedTests.ToString()); sw.WriteLine("Passed Tests\t" + PassedTests.ToString()); sw.WriteLine("Ambiguous Sequences\t" + AmbiguousFail.ToString()); sw.WriteLine("Polymorphisms overlapping between genbank and haplogrep\t" + SharedPolys.ToString()); sw.WriteLine("Not Overlapping\t" + UnSharedPolys.ToString()); sw.WriteLine("Total Discordant Positions\t" + BadPositions.Count.ToString()); sw.WriteLine("Bad Position Listing"); var bps = BadPositions.ToList(); bps.Sort(); foreach (var bp in bps) { sw.WriteLine(bp.ToString()); } sw.Close(); }
public void TreeLoad() { this.lastTree1.Nodes.Clear(); TreeLoader.Load(this.lastTree1, this, "/Aisino/Tree", false); }
public DockToolForm(object object_0) { this.InitializeComponent_1(); TreeLoader.Load(this.TreeView1, object_0, "/Aisino/Tree", false); this.bool_0 = this.TreeView1.Nodes.Count > 0; }
public HaplotypeSearcher() { treeRoot = TreeLoader.LoadTree(); //CONSTANTS.TREE_XML_FILE); var skipped = HaploSearchManager.SetPhylogeneticWeights(); //CONSTANTS.WEIGHT_FILE); }
internal void method_3(object object_0) { this.TreeView1.Nodes.Clear(); TreeLoader.Load(this.TreeView1, object_0, "/Aisino/Tree", false); this.bool_0 = this.TreeView1.Nodes.Count > 0; }