private void PopulateSpatialStructure(Document document) { CustomTreeNode sitesNode = new CustomTreeNode("Liegenschaften", document.Project.Sites); tv.Nodes.Add(sitesNode); string name = ""; string longName = ""; foreach (IfcSite site in document.Project.Sites) { CustomTreeNode siteNode = new CustomTreeNode("Liegenschaft", site); name = String.IsNullOrEmpty(site.Name) ? "<Name>" : site.Name; longName = String.IsNullOrEmpty(site.LongName) ? "" : site.LongName; siteNode.Text = String.Format("{0} {1}", name, longName); sitesNode.Nodes.Add(siteNode); siteNode.Expand(); foreach (IfcBuilding building in site.Buildings) { CustomTreeNode buildingNode = new CustomTreeNode("Gebäude", building); name = String.IsNullOrEmpty(building.Name) ? "<Name>" : building.Name; longName = String.IsNullOrEmpty(building.LongName) ? "" : building.LongName; buildingNode.Text = String.Format("{0} {1}", name, longName); siteNode.Nodes.Add(buildingNode); buildingNode.Expand(); foreach (IfcBuildingStorey buildingStorey in building.BuildingStoreys) { CustomTreeNode buildingStoreyNode = new CustomTreeNode("Etage", buildingStorey); name = String.IsNullOrEmpty(buildingStorey.Name) ? "<Name>" : buildingStorey.Name; longName = String.IsNullOrEmpty(buildingStorey.LongName) ? "" : buildingStorey.LongName; buildingStoreyNode.Text = String.Format("{0} {1}", name, longName); buildingNode.Nodes.Add(buildingStoreyNode); foreach (IfcSpace space in buildingStorey.Spaces) { CustomTreeNode spaceNode = new CustomTreeNode("Raum", space); name = String.IsNullOrEmpty(space.Name) ? "<Name>" : space.Name; longName = String.IsNullOrEmpty(space.LongName) ? "" : space.LongName; spaceNode.Text = String.Format("{0} {1}", name, longName); buildingStoreyNode.Nodes.Add(spaceNode); } } } } }
private void PopulateSystems(Document document) { CustomTreeNode systemsNode = new CustomTreeNode("Systeme" /*RESX.DW_STRUCTURE_NODERESOURCES*/, document.Project.Facilities); tv.Nodes.Add(systemsNode); foreach (CcFacility faci in document.Project.Facilities) { Ifc4.IfcSystem sys = faci.IfcSystem; CustomTreeNode system = new CustomTreeNode(sys.Name + "-" + sys.Description, faci); systemsNode.Nodes.Add(system); var relassignGroups = document.IfcXmlDocument.Items.OfType <IfcRelAssignsToGroup>() .Where(root => root.RelatingGroup.Ref == sys.Id); //.RelatedObjects.Items.Exists(item => item.Ref == document.Project.Id)) //.Select(item => item.RelatingClassification.Item.Ref); List <IfcRelAssignsToGroup> grp = relassignGroups.ToList(); if (grp != null) { foreach (IfcRelAssignsToGroup relgrp in grp) { foreach (var item in relgrp.RelatedObjects.Items) { if (item is IfcSpaceHeater) { IfcSpaceHeater heat = item as IfcSpaceHeater; var relDefProp = document.IfcXmlDocument.Items.OfType <IfcRelDefinesByProperties>() .Where(root => root.RelatedObjects.Ref == heat.Ref); //.RelatedObjects.Items.Exists(item => item.Ref == document.Project.Id)) } } } } } systemsNode.Expand(); // //foreach (IfcClassification classification in classifications) //{ // CustomTreeNode classificationNode = new CustomTreeNode(classification.Name, classification); // // TODO: set node images, colors, ... // systemsNode.Nodes.Add(classificationNode); // string sid = classification.Id; // PopulateCatalogue(classificationNode, document, sid); //} }
private void PopulateCatalogues(Document document) { CustomTreeNode cataloguesNode = new CustomTreeNode("Kataloge" /*RESX.DW_STRUCTURE_NODERESOURCES*/, null); cataloguesNode.Expand(); tv.Nodes.Add(cataloguesNode); var relatingClassificationRefs = document.IfcXmlDocument.Items.OfType <IfcRelAssociatesClassification>() .Where(root => root.RelatedObjects.Items.Exists(item => item.Ref == document.Project.Id)) .Select(item => item.RelatingClassification.Item.Ref); var classifications = document.Classifications.Where(item => relatingClassificationRefs.Contains(item.Id)); foreach (IfcClassification classification in classifications) { CustomTreeNode classificationNode = new CustomTreeNode(classification.Name, classification); // TODO: set node images, colors, ... cataloguesNode.Nodes.Add(classificationNode); string sid = classification.Id; PopulateCatalogue(classificationNode, document, sid); } }