当前位置: 首页>>代码示例>>C#>>正文


C# DocProject.GetView方法代码示例

本文整理汇总了C#中DocProject.GetView方法的典型用法代码示例。如果您正苦于以下问题:C# DocProject.GetView方法的具体用法?C# DocProject.GetView怎么用?C# DocProject.GetView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocProject的用法示例。


在下文中一共展示了DocProject.GetView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormatView

        /// <summary>
        /// Formats table for all exchanges within a view
        /// </summary>
        /// <param name="mvd"></param>
        /// <returns></returns>
        private static string FormatView(DocProject docProject, DocModelView docView, Dictionary<string, DocObject> mapEntity, Dictionary<string, string> mapSchema)
        {
            // format content
            StringBuilder sb = new StringBuilder();

            // 1. manual content
            sb.Append(docView.Documentation);

#if false // don't show anymore
            // 2. map of entities and templates -- Identity | Template | Import | Export
            sb.AppendLine("<p></p>");

            SortedList<string, DocConceptRoot> sortlist = new SortedList<string, DocConceptRoot>();

            // base view
            DocModelView docBase = docView;
            while (docBase != null)
            {
                foreach (DocConceptRoot docRoot in docBase.ConceptRoots)
                {
                    if (!sortlist.ContainsKey(docRoot.ApplicableEntity.Name))
                    {
                        sortlist.Add(docRoot.ApplicableEntity.Name, docRoot);
                    }
                }

                if (!String.IsNullOrEmpty(docBase.BaseView))
                {
                    docBase = docProject.GetView(Guid.Parse(docBase.BaseView));
                }
                else
                {
                    docBase = null;
                }
            }

            int cols = 3 + docView.Exchanges.Count;

            // new style - table
            sb.AppendLine("<table class=\"exchange\">");
            sb.AppendLine("<tr><th colspan=\"" + cols.ToString() + "\">" + docView.Name + "</th></tr>");
            sb.Append("<tr><th>Entity/Concept</th><th>Attributes</th><th>Constraints</th>");
            //<th>I</th><th>E</th></tr>");
            foreach (DocExchangeDefinition docExchange in docView.Exchanges)
            {
                sb.Append("<th>");
                sb.Append("<img src=\"../../../img/mvd-");
                sb.Append(docExchange.Name.ToLower().Replace(' ', '-'));
                sb.Append(".png\" title=\"");
                sb.Append(docExchange.Name);
                sb.Append("\" />");
                sb.Append("</th>");
            }
            sb.AppendLine("</tr>");

            foreach (string ent in sortlist.Keys)
            {
                DocConceptRoot docRoot = sortlist[ent];

                sb.Append("<tr><td colspan=\"" + cols.ToString() + "\"><b><i>");
                sb.Append(docRoot.ApplicableEntity.Name);
                sb.AppendLine("</i></b></td></tr>");

                // determine schema
                string schema = mapSchema[ent];

                foreach (DocTemplateUsage docConcept in docRoot.Concepts)
                {
                    if (docConcept.Definition != null)
                    {

                        sb.Append("<tr><td>&nbsp;&nbsp;<a href=\"../../");
                        sb.Append(schema.ToLower());
                        sb.Append("/lexical/");
                        sb.Append(ent.ToLower());
                        sb.Append(".htm#");
                        sb.Append(docConcept.Definition.Name.ToLower().Replace(' ', '-'));
                        sb.Append("\">");
                        sb.Append(docConcept.Definition.Name);
                        sb.Append("</a></td><td>");

                        bool first = true;
                        if (docConcept.Definition.Rules != null)
                        {
                            foreach (DocModelRule docRule in docConcept.Definition.Rules)
                            {
                                if (!first)
                                {
                                    sb.Append("<br/>");
                                }
                                sb.Append(docRule.Name);
                                first = false;
                            }
                        }

//.........这里部分代码省略.........
开发者ID:corneliuspreidel,项目名称:IfcDoc,代码行数:101,代码来源:DocumentationISO.cs

示例2: DrawEntity


//.........这里部分代码省略.........
                        for (int i = 0; i < listAttr.Count; i++)
                        {
                            if (listAttr[i].Name != null && listAttr[i].Name.Equals(ruleAttribute.Name))
                            {
                                // found it
                                //iAttr = i;
                                if (!mapAttribute.ContainsKey(i))
                                {
                                    mapAttribute.Add(i, new List<DocModelRuleAttribute>());
                                }
                                mapAttribute[i].Add(ruleAttribute);
                                break;
                            }
                        }
                    }
                }
            }
            else
            {
                // map each use definition at top-level

                // build list of inherited views
                List<DocModelView> listViews = new List<DocModelView>();
                DocModelView docBaseView = docView;
                while (docBaseView != null)
                {
                    listViews.Add(docBaseView);

                    if (!String.IsNullOrEmpty(docBaseView.BaseView))
                    {
                        Guid guidBase = Guid.Parse(docBaseView.BaseView);
                        if (guidBase != docBaseView.Uuid)
                        {
                            docBaseView = docProject.GetView(guidBase);
                        }
                        else
                        {
                            docBaseView = null;
                        }
                    }
                    else
                    {
                        docBaseView = null;
                    }
                }

                // build from inherited entities too

                List<DocTemplateDefinition> listTemplates = new List<DocTemplateDefinition>(); // keep track of templates so we don't repeat at supertypes
                List<DocTemplateDefinition> listSuppress = new List<DocTemplateDefinition>(); // list of templates that are suppressed

                DocEntity docEntitySuper = docEntity;
                while(docEntitySuper != null)
                {

                    foreach (DocModelView docEachView in docProject.ModelViews)
                    {
                        if (docView == null || listViews.Contains(docEachView))
                        {
                            foreach (DocConceptRoot docRoot in docEachView.ConceptRoots)
                            {
                                if (docRoot.ApplicableEntity == docEntitySuper)
                                {
                                    foreach (DocTemplateUsage docUsage in docRoot.Concepts)
                                    {
                                        if (docUsage.Definition != null && docUsage.Definition.Rules != null && !listTemplates.Contains(docUsage.Definition) && !listSuppress.Contains(docUsage.Definition))
开发者ID:BuildingSMART,项目名称:IfcDoc,代码行数:67,代码来源:FormatPNG.cs

示例3: ImportMvd

        internal static void ImportMvd(mvdXML mvd, DocProject docProject, string filepath)
        {
            if (mvd.Templates != null)
            {
                Dictionary<EntityRule, DocModelRuleEntity> fixups = new Dictionary<EntityRule, DocModelRuleEntity>();
                foreach (ConceptTemplate mvdTemplate in mvd.Templates)
                {
                    DocTemplateDefinition docDef = docProject.GetTemplate(mvdTemplate.Uuid);
                    if (docDef == null)
                    {
                        docDef = new DocTemplateDefinition();
                        docProject.Templates.Add(docDef);
                    }

                    ImportMvdTemplate(mvdTemplate, docDef, fixups);
                }

                foreach(EntityRule er in fixups.Keys)
                {
                    DocModelRuleEntity docEntityRule = fixups[er];
                    if(er.References != null)
                    {
                        foreach(TemplateRef tr in er.References)
                        {
                            DocTemplateDefinition dtd = docProject.GetTemplate(tr.Ref);
                            if(dtd != null)
                            {
                                docEntityRule.References.Add(dtd);
                            }
                        }
                    }
                }
            }

            if (mvd.Views != null)
            {
                foreach (ModelView mvdView in mvd.Views)
                {
                    DocModelView docView = docProject.GetView(mvdView.Uuid);
                    if (docView == null)
                    {
                        docView = new DocModelView();
                        docProject.ModelViews.Add(docView);
                    }

                    ImportMvdObject(mvdView, docView);

                    docView.BaseView = mvdView.BaseView;
                    docView.Exchanges.Clear();
                    Dictionary<Guid, ExchangeRequirement> mapExchange = new Dictionary<Guid, ExchangeRequirement>();
                    foreach (ExchangeRequirement mvdExchange in mvdView.ExchangeRequirements)
                    {
                        mapExchange.Add(mvdExchange.Uuid, mvdExchange);

                        DocExchangeDefinition docExchange = new DocExchangeDefinition();
                        ImportMvdObject(mvdExchange, docExchange);
                        docView.Exchanges.Add(docExchange);

                        docExchange.Applicability = (DocExchangeApplicabilityEnum)mvdExchange.Applicability;

                        // attempt to find icons if exists -- remove extention
                        try
                        {
                            string iconpath = filepath.Substring(0, filepath.Length - 7) + @"\mvd-" + docExchange.Name.ToLower().Replace(' ', '-') + ".png";
                            if (System.IO.File.Exists(iconpath))
                            {
                                docExchange.Icon = System.IO.File.ReadAllBytes(iconpath);
                            }
                        }
                        catch
                        {

                        }
                    }

                    foreach (ConceptRoot mvdRoot in mvdView.Roots)
                    {
                        // find the entity
                        DocEntity docEntity = LookupEntity(docProject, mvdRoot.ApplicableRootEntity);
                        if (docEntity != null)
                        {
                            DocConceptRoot docConceptRoot = docView.GetConceptRoot(mvdRoot.Uuid);
                            if (docConceptRoot == null)
                            {
                                docConceptRoot = new DocConceptRoot();
                                if (docView.ConceptRoots == null)
                                {
                                    docView.ConceptRoots = new List<DocConceptRoot>();
                                }
                                docView.ConceptRoots.Add(docConceptRoot);
                            }

                            ImportMvdObject(mvdRoot, docConceptRoot);
                            docConceptRoot.ApplicableEntity = docEntity;

                            if (mvdRoot.Applicability != null)
                            {
                                docConceptRoot.ApplicableTemplate = docProject.GetTemplate(mvdRoot.Applicability.Template.Ref);
                                if(mvdRoot.Applicability.TemplateRules != null)
                                {
//.........这里部分代码省略.........
开发者ID:BuildingSMART,项目名称:IfcDoc,代码行数:101,代码来源:Program.cs


注:本文中的DocProject.GetView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。