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


C# DocProject.GetSchemaOfDefinition方法代码示例

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


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

示例1: CreateConceptDiagram

        /// <summary>
        /// Creates a concept diagram for a particular entity, including all concepts at specified view and base view(s).
        /// </summary>
        /// <param name="docEntity"></param>
        /// <param name="docView"></param>
        /// <param name="map"></param>
        /// <param name="layout"></param>
        /// <param name="docProject"></param>
        /// <param name="instance"></param>
        /// <returns></returns>
        internal static Image CreateConceptDiagram(DocEntity docEntity, DocModelView docView, Dictionary<string, DocObject> map, Dictionary<Rectangle, DocModelRule> layout, DocProject docProject, SEntity instance)
        {
            DocSchema docSchema = docProject.GetSchemaOfDefinition(docEntity);

            layout.Clear();
            List<int> lanes = new List<int>(); // keep track of position offsets in each lane
            for (int i = 0; i < 16; i++)
            {
                lanes.Add(0);
            }

            // determine boundaries
            DrawEntity(null, 0, lanes, docEntity, docView, null, null, map, layout, docProject, docSchema, instance);
            Rectangle rcBounds = Rectangle.Empty;
            foreach (Rectangle rc in layout.Keys)
            {
                if (rc.Right > rcBounds.Width)
                {
                    rcBounds.Width = rc.Right;
                }

                if (rc.Bottom > rcBounds.Bottom)
                {
                    rcBounds.Height = rc.Bottom;
                }
            }
            rcBounds.Width += FormatPNG.Border;
            rcBounds.Height += FormatPNG.Border;

            Image image = new Bitmap(rcBounds.Width, rcBounds.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            using (Graphics g = Graphics.FromImage(image))
            {
                g.FillRectangle(Brushes.White, new Rectangle(0, 0, image.Width, image.Height));

                layout.Clear();
                lanes = new List<int>(); // keep track of position offsets in each lane
                for (int i = 0; i < 16; i++)
                {
                    lanes.Add(0);
                }

                DrawEntity(g, 0, lanes, docEntity, docView, null, null, map, layout, docProject, docSchema, instance);

                g.DrawRectangle(Pens.Black, 0, 0, rcBounds.Width - 1, rcBounds.Height - 1);
            }

            return image;
        }
开发者ID:BuildingSMART,项目名称:IfcDoc,代码行数:59,代码来源:FormatPNG.cs

示例2: CreateTemplateDiagram

        /// <summary>
        /// Creates an instance diagram for a template.
        /// </summary>
        /// <param name="docTemplate"></param>
        /// <returns></returns>
        internal static Image CreateTemplateDiagram(DocTemplateDefinition docTemplate, Dictionary<string, DocObject> map, Dictionary<Rectangle, DocModelRule> layout, DocProject docProject, SEntity instance)
        {
            DocObject docTarget = null;
            if (docTemplate.Type == null || !map.TryGetValue(docTemplate.Type, out docTarget) || !(docTarget is DocEntity))
                return null;

            DocEntity docEntity = (DocEntity)docTarget;
            DocSchema docSchema = docProject.GetSchemaOfDefinition(docEntity);

            // first, determine bounds of drawing
            List<int> lanes = new List<int>(); // keep track of position offsets in each lane
            for (int i = 0; i < 16; i++)
            {
                lanes.Add(0);
            }
            layout.Clear();
            DrawEntity(null, 0, lanes, docEntity, null, docTemplate, null, map, layout, docProject, docSchema, instance);

            Rectangle rcBounds = new Rectangle();
            foreach(Rectangle rc in layout.Keys)
            {
                if(rc.Right > rcBounds.Right)
                {
                    rcBounds.Width = rc.Right;
                }

                if(rc.Bottom > rcBounds.Bottom)
                {
                    rcBounds.Height = rc.Bottom;
                }
            }
            rcBounds.Width += FormatPNG.Border;
            rcBounds.Height += FormatPNG.Border;

            Image image = new Bitmap(rcBounds.Width, rcBounds.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            using (Graphics g = Graphics.FromImage(image))
            {
                g.FillRectangle(Brushes.White, new Rectangle(0, 0, image.Width, image.Height));

                lanes = new List<int>(); // keep track of position offsets in each lane
                for (int i = 0; i < 16; i++)
                {
                    lanes.Add(0);
                }
                layout.Clear();
                DrawEntity(g, 0, lanes, docEntity, null, docTemplate, null, map, layout, docProject, docSchema, instance);
                g.DrawRectangle(Pens.Black, 0, 0, rcBounds.Width - 1, rcBounds.Height - 1);
            }

            return image;
        }
开发者ID:BuildingSMART,项目名称:IfcDoc,代码行数:56,代码来源:FormatPNG.cs

示例3: GenerateDocumentation


//.........这里部分代码省略.........
            {
                DocAnnotation docAnnotation = docProject.Annotations[3];
                htmSection.WriteHeader(docAnnotation.Name, 0);
                htmSection.Write(
                    "\r\n" +
                    "<script type=\"text/javascript\">\r\n" +
                    "<!--\r\n" +
                    "    parent.index.location.replace(\"blank.htm\");\r\n" +
                    "//-->\r\n" +
                    "</script>\r\n");

                htmSection.WriteLine("      <h1 class=\"std\">" + docAnnotation.Name + "</h1>");
                htmSection.WriteLine(docAnnotation.Documentation);
                htmSection.WriteLinkTo("introduction", 0);
                htmSection.WriteFooter(Properties.Settings.Default.Footer);
            }

#if false
            Dictionary<Rectangle, DocEntity> mapRectangle = new Dictionary<Rectangle, DocEntity>();
            using (Image imgDiagram = FormatPNG.CreateInheritanceDiagram(docProject, included, docEntityRoot, new Font(FontFamily.GenericSansSerif, 8.0f), mapRectangle))
            {
                imgDiagram.Save(path + @"\img\cover.png");
                    
                using (FormatHTM htmCover = new FormatHTM(path + @"\cover.htm", mapEntity, mapSchema, included))
                {
                    htmCover.WriteHeader(String.Empty, 1);

                    htmCover.WriteLine("<img src=\"" + path + "/img/cover.png\" usemap=\"#f\"/>");
                    htmCover.WriteLine("<map name=\"f\">");

                    foreach (Rectangle rc in mapRectangle.Keys)
                    {
                        DocEntity docEntref = mapRectangle[rc];
                        DocSchema docEntsch = docProject.GetSchemaOfDefinition(docEntref);

                        string hyperlink = "./schema/" + docEntsch.Name.ToLower() + "/lexical/" + docEntref.Name.ToLower() + ".htm";
                        htmCover.WriteLine("<area shape=\"rect\" coords=\"" + rc.Left + "," + rc.Top + "," + rc.Right + "," + rc.Bottom + "\" href=\"" + hyperlink + "\" alt=\"" + docEntref.Name + "\" />");
                    }
                    htmCover.WriteLine("</map>");


                    htmCover.WriteFooter(String.Empty);
                }
            }
#endif

            // NEW: property set index -- build index
            SortedList<string, SortedList<string, DocPropertySet>> mapProperty = new SortedList<string, SortedList<string, DocPropertySet>>();
            foreach (DocSection docSection in docProject.Sections)
            {
                foreach (DocSchema docSchema in docSection.Schemas)
                {
                    foreach (DocPropertySet docPset in docSchema.PropertySets)
                    {
                        if (included == null || included.ContainsKey(docPset))
                        {
                            // include locales
                            foreach (DocLocalization doclocal in docPset.Localization)
                            {
                                // only deal with languages, not regions
                                if (doclocal.Locale != null && doclocal.Locale.Length >= 2)
                                {
                                    string language = doclocal.Locale.Substring(0, 2);

                                    if (!listLocale.ContainsKey(language))
                                    {
开发者ID:corneliuspreidel,项目名称:IfcDoc,代码行数:67,代码来源:DocumentationISO.cs

示例4: FormatField

        private static string FormatField(DocProject docProject, string content, string fieldname, string fieldtype, string fieldvalue)
        {
            DocDefinition docDef = docProject.GetDefinition(fieldtype);

            // hyperlink to enumerators
            if (docDef is DocEnumeration)
            {
                // hyperlink to enumeration definition

                // replace it with hyperlink
                DocSchema docSchema = docProject.GetSchemaOfDefinition(docDef);
                string relative = @"../../";
                string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docDef.Name.ToLower() + ".htm";
                string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";

                return content.Replace(fieldname, format);
            }
            else if (docDef is DocEntity)//fieldvalue != null && fieldvalue.StartsWith("Ifc") && docProject.GetDefinition(fieldvalue) != null)
            {
                // replace it with hyperlink
                DocSchema docSchema = docProject.GetSchemaOfDefinition(docDef);
                string relative = @"../../";
                string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docDef.Name.ToLower() + ".htm";
                string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";

                return content.Replace(fieldname, format);
            }
            else //if (docDef == null)
            {
                // hyperlink to property set definition
                DocSchema docSchema = null;
                DocObject docObj = docProject.FindPropertySet(fieldvalue, out docSchema);
                if (docObj is DocPropertySet)
                {
                    string relative = @"../../";
                    string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/pset/" + docObj.Name.ToLower() + ".htm"; // case-sensitive on linux -- need to make schema all lowercase
                    string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";
                    return content.Replace(fieldname, format);
                }
                else if (docObj is DocQuantitySet)
                {
                    string relative = @"../../";
                    string hyperlink = relative + docSchema.Name.ToLowerInvariant() + @"/qset/" + docObj.Name.ToLower() + ".htm"; // case-sentive on linux -- need to make schema all lowercase
                    string format = "<a href=\"" + hyperlink + "\">" + fieldvalue + "</a>";
                    return content.Replace(fieldname, format);
                }

                if (docObj == null)
                {
                    // simple replace -- hyperlink may markup value later
                    return content.Replace(fieldname, fieldvalue);
                }
            }
            /*
            else
            {
                // simple replace -- hyperlink may markup value later
                return content.Replace(fieldname, fieldvalue);
            }*/

            return content;
        }
开发者ID:corneliuspreidel,项目名称:IfcDoc,代码行数:62,代码来源:DocumentationISO.cs

示例5: FormatConceptTable


//.........这里部分代码省略.........
                                }

                                if (docTemplateInner == null && value != null && mapSchema.TryGetValue(value, out schema))
                                {
                                    if(value.StartsWith("Pset_"))
                                    {
                                        value.ToString();
                                    }

                                    sb.Append("<a href=\"../../");
                                    sb.Append(schema.ToLower());
                                    sb.Append("/lexical/");
                                    sb.Append(value.ToLower());
                                    sb.Append(".htm\">");
                                    sb.Append(value);
                                    sb.Append("</a>");
                                }
                                else if(docDef.Name.Equals("IfcReference"))
                                {
                                    // ...hyperlinks
                                    if(value != null)
                                    {
                                        string[] parts = value.Split('\\');
                                        foreach(string part in parts)
                                        {
                                            string[] tokens = part.Split('.');
                                            if (tokens.Length > 0)
                                            {
                                                sb.Append("\\");

                                                DocDefinition docToken = docProject.GetDefinition(tokens[0]);
                                                if (docToken != null)
                                                {
                                                    DocSchema docSchema = docProject.GetSchemaOfDefinition(docToken);
                                                    string relative = @"../../";
                                                    string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docToken.Name.ToLower() + ".htm";
                                                    string format = "<a href=\"" + hyperlink + "\">" + tokens[0] + "</a>";
                                                    sb.Append(format);
                                                }

                                                if (tokens.Length > 1)
                                                {
                                                    sb.Append(".");
                                                    sb.Append(tokens[1]);
                                                }

                                                sb.Append("<br>");
                                            }
                                        }
                                    }
                                    //sb.Append(value);                                    
                                }
                                else if(value != null)
                                {
                                    sb.Append(value);
                                }
                            }
                            else if (docDef != null && value != null)
                            {
                                value = FormatField(docProject, value, value, docDef.Name, value);
                                sb.Append(value);
                            }
                            else if (value != null)
                            {
                                sb.Append(value);
                            }
开发者ID:corneliuspreidel,项目名称:IfcDoc,代码行数:67,代码来源:DocumentationISO.cs

示例6: FormatFigure

        /// <summary>
        /// If matching figure exists, generates HTML including the figure and increments the figure count.
        /// </summary>
        /// <param name="docProject">The project</param>
        /// <param name="definition">Object for which to find figure.</param>
        /// <param name="dtd">Optional template for which to find figure.</param>
        /// <param name="caption">Caption of definition used in determining figure caption, e.g. 'Beam'</param>
        /// <param name="listFigures">List of figures for determining numbering; appended as applicable by function.</param>
        /// <returns></returns>
        private static string FormatFigure(DocProject docProject, DocObject definition, DocTemplateDefinition dtd, string caption, List<ContentRef> listFigures)
        {
            string title = null;
            string desc = null;
            if (!String.IsNullOrEmpty(caption))
            {
                title = caption;
                desc = caption.Substring(0, 1).ToUpper() + caption.Substring(1);
            }
            else
            {
                title = "<i>" + definition.Name + "</i>";
                desc = title;
            }

            StringBuilder sb = new StringBuilder();

            if (definition is DocDefinition) //TODO: property set figures
            {
                DocSchema docSchema = docProject.GetSchemaOfDefinition((DocDefinition)definition);

                string filename = MakeLinkName(definition);
                if (dtd != null)
                {
                    filename += "-" + MakeLinkName(dtd);
                }
                filename += ".png";

                string filepath = Properties.Settings.Default.OutputPath + @"\figures\" + filename;
                if (System.IO.File.Exists(filepath))
                {
                    listFigures.Add(new ContentRef(desc, definition));

                    // "Sensor", "Port Use Definition" ==> "Sensor Port Use"
                    string figuredef = "usage";
                    if (dtd != null)
                    {
                        figuredef = dtd.Name.ToLower();
                    }

                    // Per ISO guidelines, all figures must be referenced from text.
                    sb.Append("<p>Figure ");
                    sb.Append(listFigures.Count);
                    sb.Append(" illustrates ");
                    sb.Append(title.ToLower());
                    sb.Append(" ");
                    sb.Append(figuredef.ToLower());
                    sb.Append(".</p>\r\n");

                    // include the figure with formatting below per ISO
                    sb.Append("<table><tr><td><img src=\"../../../figures/");
                    sb.Append(filename);
                    sb.Append("\" alt=\"");
                    sb.Append(figuredef);
                    sb.Append("\"></td></tr><tr><td><p class=\"figure\">Figure ");
                    sb.Append(listFigures.Count);
                    sb.Append(" &mdash; ");
                    sb.Append(desc);
                    sb.Append(" ");
                    sb.Append(figuredef);
                    sb.Append("</p></td></tr></table>\r\n");
                    sb.AppendLine();
                }
            }

            return sb.ToString();
        }
开发者ID:corneliuspreidel,项目名称:IfcDoc,代码行数:76,代码来源:DocumentationISO.cs

示例7: FormatReference

        private static string FormatReference(DocProject docProject, string value)
        {
            if (value == null)
                return null;

            StringBuilder sb = new StringBuilder();
            string[] parts = value.Split('\\');
            foreach (string part in parts)
            {
                string[] tokens = part.Split('.');
                if (tokens.Length > 0)
                {
                    sb.Append("\\");

                    DocDefinition docToken = docProject.GetDefinition(tokens[0]);
                    if (docToken != null)
                    {
                        DocSchema docSchema = docProject.GetSchemaOfDefinition(docToken);
                        string relative = @"../../";
                        string hyperlink = relative + docSchema.Name.ToLower() + @"/lexical/" + docToken.Name.ToLower() + ".htm";
                        string format = "<a href=\"" + hyperlink + "\">" + tokens[0] + "</a>";
                        sb.Append(format);
                    }

                    if (tokens.Length > 1)
                    {
                        sb.Append(".");
                        sb.Append(tokens[1]);
                    }

                    sb.Append("<br>");
                }
            }

            return sb.ToString();
        }
开发者ID:pipauwel,项目名称:IfcDoc,代码行数:36,代码来源:DocumentationISO.cs


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