private void treeViewProperty_AfterSelect(object sender, TreeViewEventArgs e) { DocObject docObj = this.treeViewProperty.SelectedNode.Tag as DocObject; if (docObj != null) { if (docObj is DocQuantitySet) { this.textBoxType.Text = "QSET_OCCURRENCEDRIVEN"; } else if (docObj is DocQuantity) { DocQuantity docProp = (DocQuantity)docObj; this.textBoxType.Text = docProp.QuantityType.ToString(); } this.textBoxDescription.Text = docObj.Documentation; } this.buttonOK.Enabled = (this.treeViewProperty.CheckBoxes || (this.treeViewProperty.SelectedNode != null && this.treeViewProperty.SelectedNode.Tag is DocQuantity)); }
/// <summary> /// Extracts description of referenced data, using properties, quantities, and attributes. /// </summary> /// <param name="mapEntity"></param> /// <param name="docView">Optional model view, for retrieving more specific descriptions such as for ports</param> /// <returns></returns> public string GetDescription(Dictionary<string, DocObject> mapEntity, DocModelView docView) { string desc = null; CvtValuePath valpath = this; if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("IsDefinedBy") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcRelDefinesByProperties")) { DocObject docPset = null; mapEntity.TryGetValue(valpath.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? } } else if (docPset is DocQuantitySet) { DocQuantity docProp = ((DocQuantitySet)docPset).GetQuantity(valpath.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? } } } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("HasPropertySets") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcPropertySet")) { DocObject docPset = null; mapEntity.TryGetValue(valpath.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? } } } else if(valpath != null && valpath.Property != null && valpath.Property.Name.Equals("Material") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcMaterial") && valpath.InnerPath.InnerPath != null && valpath.InnerPath.InnerPath.Type.Name.Equals("IfcMaterialProperties")) { DocObject docPset = null; mapEntity.TryGetValue(valpath.InnerPath.Identifier, out docPset); if(docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.InnerPath.Identifier); if(docProp != null) { desc = docProp.Documentation; } } } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("IsNestedBy") && valpath.InnerPath != null && valpath.InnerPath.InnerPath != null && valpath.InnerPath.InnerPath != null) { CvtValuePath pathInner = valpath.InnerPath.InnerPath; if (pathInner.Type != null && pathInner.Type.Name.Equals("IfcDistributionPort")) { string portname = valpath.InnerPath.Identifier; if (pathInner.Property != null && pathInner.Property.Name.Equals("IsDefinedBy")) { // lookup description of property at port DocObject docPset = null; mapEntity.TryGetValue(pathInner.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(pathInner.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = portname + ": " + docProp.Documentation; } } } else { desc = portname; // lookup description of port Guid guidPortNesting = new Guid("bafc93b7-d0e2-42d8-84cf-5da20ee1480a"); foreach (DocConceptRoot docRoot in docView.ConceptRoots) { if (docRoot.ApplicableEntity == valpath.Type) { foreach(DocTemplateUsage docConcept in docRoot.Concepts) { if(docConcept.Definition != null && docConcept.Definition.Uuid == guidPortNesting) { foreach (DocTemplateItem docItem in docConcept.Items) { if(docItem.Name.Equals(portname)) { desc = docItem.Documentation; break; } } } } } } } } } if (desc == null) { while (valpath != null && valpath.InnerPath != null && valpath.InnerPath.Property != null) { valpath = valpath.InnerPath; } if (valpath != null && valpath.Property != null) { desc = valpath.Property.Documentation; } else if (valpath != null) { desc = "The IFC class identifier indicating the subtype of object."; } } return desc; }
/// <summary> /// Extracts description of referenced data, using properties, quantities, and attributes. /// </summary> /// <param name="mapEntity"></param> /// <param name="docView">Optional model view, for retrieving more specific descriptions such as for ports</param> /// <returns></returns> public string GetDescription(Dictionary <string, DocObject> mapEntity, DocModelView docView) { string desc = null; CvtValuePath valpath = this; if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("IsDefinedBy") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcRelDefinesByProperties") && valpath.Identifier != null) { DocObject docPset = null; mapEntity.TryGetValue(valpath.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? if (String.IsNullOrEmpty(docProp.Documentation)) { this.ToString(); } } } else if (docPset is DocQuantitySet) { DocQuantity docProp = ((DocQuantitySet)docPset).GetQuantity(valpath.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? if (String.IsNullOrEmpty(docProp.Documentation)) { this.ToString(); } } } } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("HasAssignments") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcRelAssignsToControl") && valpath.InnerPath.InnerPath != null && valpath.InnerPath.InnerPath.Type.Name.Equals("IfcPerformanceHistory")) { DocObject docPset = null; if (mapEntity.TryGetValue(valpath.InnerPath.InnerPath.Identifier, out docPset)) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.InnerPath.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? if (docProp.Documentation == null) { DocLocalization docLoc = docProp.GetLocalization(null); if (docLoc != null) { desc = docLoc.Documentation; } } } } this.ToString(); } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("HasPropertySets") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcPropertySet")) { DocObject docPset = null; mapEntity.TryGetValue(valpath.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation;// localize?? if (String.IsNullOrEmpty(docProp.Documentation)) { this.ToString(); } } } } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("Material") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcMaterial") && valpath.InnerPath.InnerPath != null && valpath.InnerPath.InnerPath.Type.Name.Equals("IfcMaterialProperties")) { DocObject docPset = null; mapEntity.TryGetValue(valpath.InnerPath.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation; } } } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("HasProperties") && valpath.InnerPath != null && valpath.InnerPath.Type.Name.Equals("IfcMaterialProperties")) { DocObject docPset = null; mapEntity.TryGetValue(valpath.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(valpath.InnerPath.Identifier); if (docProp != null) { desc = docProp.Documentation; } } } else if (valpath != null && valpath.Property != null && valpath.Property.Name.Equals("IsNestedBy") && valpath.InnerPath != null && valpath.InnerPath.InnerPath != null && valpath.InnerPath.InnerPath != null) { CvtValuePath pathInner = valpath.InnerPath.InnerPath; if (pathInner.Type != null && pathInner.Type.Name.Equals("IfcDistributionPort")) { string portname = valpath.InnerPath.Identifier; if (pathInner.Property != null && pathInner.Property.Name.Equals("IsDefinedBy")) { // lookup description of property at port DocObject docPset = null; mapEntity.TryGetValue(pathInner.Identifier, out docPset); if (docPset is DocPropertySet) { DocProperty docProp = ((DocPropertySet)docPset).GetProperty(pathInner.InnerPath.InnerPath.Identifier); if (docProp != null) { desc = portname + ": " + docProp.Documentation; } } } else { desc = portname; // lookup description of port Guid guidPortNesting = new Guid("bafc93b7-d0e2-42d8-84cf-5da20ee1480a"); if (docView != null) { foreach (DocConceptRoot docRoot in docView.ConceptRoots) { if (docRoot.ApplicableEntity == valpath.Type) { foreach (DocTemplateUsage docConcept in docRoot.Concepts) { if (docConcept.Definition != null && docConcept.Definition.Uuid == guidPortNesting) { foreach (DocTemplateItem docItem in docConcept.Items) { if (docItem.Name != null && docItem.Name.Equals(portname)) { desc = docItem.Documentation; break; } } } } } } } } } } if (desc == null) { while (valpath != null && valpath.InnerPath != null && valpath.InnerPath.Property != null) { valpath = valpath.InnerPath; } if (valpath != null && valpath.Property != null) { desc = valpath.Property.Documentation; } else if (valpath != null) { desc = "The IFC class identifier indicating the subtype of object."; } } // clear out any notes int block = desc.IndexOf("<blockquote"); if (block != -1) { desc = desc.Substring(0, block); } return(desc); }
private void toolStripMenuItemInsertQuantity_Click(object sender, EventArgs e) { DocQuantitySet docPset = (DocQuantitySet)this.treeView.SelectedNode.Tag; DocQuantity docProp = new DocQuantity(); docPset.Quantities.Add(docProp); docProp.QuantityType = DocQuantityTemplateTypeEnum.Q_COUNT; this.treeView.SelectedNode = this.LoadNode(this.treeView.SelectedNode, docProp, docProp.Name, false); this.toolStripMenuItemEditRename_Click(sender, e); }