コード例 #1
0
ファイル: FormEdit.cs プロジェクト: BuildingSMART/IfcDoc
        private void BuildConceptForPropertySets(DocConceptRoot docRoot, DocTemplateDefinition docTemplatePset, DocPropertySet[] psets)
        {
            DocTemplateUsage docConcept = null;

            // get any existing concept for psets
            foreach (DocTemplateUsage docExistConcept in docRoot.Concepts)
            {
                if (docExistConcept.Definition == docTemplatePset)
                {
                    docConcept = docExistConcept;
                    break;
                }
            }

            if (psets.Length > 0)
            {
                if (docConcept == null)
                {
                    docConcept = new DocTemplateUsage();
                    docConcept.Definition = docTemplatePset;
                    docRoot.Concepts.Add(docConcept);

                    LoadNode(this.treeView.SelectedNode, docConcept, docConcept.ToString(), false);
                }

                // remove old listings
                for (int iExist = docConcept.Items.Count - 1; iExist >= 0; iExist--)
                {
                    docConcept.Items[iExist].Delete();
                    docConcept.Items.RemoveAt(iExist);
                }

                foreach (DocPropertySet docPset in psets)
                {
                    //if (docPset.PropertySetType == "PSET_OCCURRENCEDRIVEN" ||
                    //    docPset.PropertySetType == "PSET_TYPEDRIVENOVERRIDE")
                    {
                        // add new, in order
                        DocTemplateItem docItemPset = new DocTemplateItem();
                        docItemPset.RuleParameters = "Name=" + docPset.Name + ";";
                        docConcept.Items.Add(docItemPset);

                        //... predefined type

                        //... properties...
                        int order = 0;
                        foreach (DocProperty docProp in docPset.Properties)
                        {
                            DocTemplateDefinition docInnerTemplate = null;
                            string suffix = String.Empty;
                            switch (docProp.PropertyType)
                            {
                                case DocPropertyTemplateTypeEnum.P_SINGLEVALUE:
                                    docInnerTemplate = this.m_project.GetTemplate(new Guid("6655f6d0-29a8-47b8-8f3d-c9fce9c9a620"));
                                    break;

                                case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
                                    docInnerTemplate = this.m_project.GetTemplate(new Guid("3d67a2d2-761d-44d9-a09e-b7fbb1fa5632"));
                                    break;

                                case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE:
                                    docInnerTemplate = this.m_project.GetTemplate(new Guid("c148a099-c351-43a8-9266-5f3de0b45a95"));
                                    suffix = "Reference=" + docProp.SecondaryDataType.Substring(0, docProp.SecondaryDataType.IndexOf(':'));
                                    break;

                                case DocPropertyTemplateTypeEnum.P_LISTVALUE:
                                    docInnerTemplate = this.m_project.GetTemplate(new Guid("8e10b688-9179-4e3a-8db2-6abcaafe952d"));
                                    break;

                                case DocPropertyTemplateTypeEnum.P_TABLEVALUE:
                                    docInnerTemplate = this.m_project.GetTemplate(new Guid("35c947b0-6abc-4b13-8ec7-696ef2041721"));
                                    suffix = "Reference=" + docProp.SecondaryDataType;
                                    break;

                                case DocPropertyTemplateTypeEnum.P_REFERENCEVALUE:
                                    docInnerTemplate = this.m_project.GetTemplate(new Guid("e20bc116-889b-46cc-b193-31b3e2376a8e"));
                                    suffix = "Reference=" + docProp.SecondaryDataType;
                                    break;
                            }

                            if (docInnerTemplate != null)
                            {
                                order++;
                                DocTemplateUsage docInnerConcept = docItemPset.RegisterParameterConcept("Properties", docInnerTemplate);
                                DocTemplateItem docInnerItem = new DocTemplateItem();
                                docInnerItem.RuleParameters = "Order=" + order + ";Name=" + docProp.Name + ";Value=" + docProp.PrimaryDataType + ";" + suffix;
                                docInnerConcept.Items.Add(docInnerItem);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: FormEdit.cs プロジェクト: BuildingSMART/IfcDoc
 private void LoadNodeConcept(TreeNode tnOuter, DocTemplateUsage docConcept)
 {
     TreeNode tn = LoadNode(tnOuter, docConcept, docConcept.ToString(), false);
     foreach (DocTemplateUsage docInner in docConcept.Concepts)
     {
         LoadNodeConcept(tn, docInner);
     }
 }