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


C# Layout.hasLayout方法代码示例

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


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

示例1: WriteTo

        private void WriteTo(IndentedTextWriter writer, Layout selectedLayout)
        {
            if (selectedLayout == null || !selectedLayout.hasLayout())
                return;

            var xscale = specs.desiredWidth/selectedLayout.Dimensions.Width;
            var yscale = specs.desiredHeight/selectedLayout.Dimensions.Height;
            var scale = Math.Min(xscale, yscale);
            var papersize = Enum.GetName(typeof (papersize), specs.size);
            var orientation = specs.desiredWidth > specs.desiredHeight ? "landscape" : "portrait";
            writer.WriteLine("% This TeX file was generated by SBML2TikZ Version: {0}",
                             Assembly.GetExecutingAssembly().GetName().Version);
            writer.WriteLine("\\documentclass{article}");
            writer.WriteLine("\\usepackage{tikz}");
            writer.WriteLine("\\usepackage{pgf}");
            writer.WriteLine("\\usepackage[total={{{0}pt,{1}pt}}, centering, {2}, {3}]{{geometry}}", specs.desiredWidth,
                             specs.desiredHeight, papersize, orientation);
            writer.WriteLine("\\pagestyle{empty}");
            writer.WriteLine("\\begin{document}");
            writer.WriteLine("\\begin{center}");
            writer.WriteLine("\\begin{{tikzpicture}}[xscale = {0}, yscale = -{1}]", xscale, yscale);
            writer.WriteLine("{");

            // _layout._EmlRenderInformation is a list of LocalRenderInformation
            // Each LocalRenderInformation has lists of GradientDefinitions, ColorDefinitions & LineEndings
            // It also contains a list of Styles
            // Each Style can be applied to items that share a role with its rolelist or a type with its typelist
            // Presently we do not need to worry about GlobalRenderInformation as it is dealt with by the
            // RenderInformation.GetStyleForObject, although this may be revised

            // if there are more than one renderinformation objects, we need to ask the user to pick one

            // in order to use some of the classes in the EmlRenderExtension we need a Graphics object
            var dummyControl = new Control();
            try
            {
                var g = dummyControl.CreateGraphics();

                DefineColorsAndGradients(selectedLayout._EmlRenderInformation[0].ColorDefinitions,
                                         selectedLayout._EmlRenderInformation[0].GradientDefinitions,
                                         selectedLayout._EmlRenderInformation[0], writer);

                foreach (var glyph in selectedLayout.CompartmentGlyphs)
                {
                    glyphToTex(glyph, selectedLayout, writer, g, scale);
                }

                foreach (var glyph in selectedLayout.ReactionGlyphs)
                {
                    glyphToTex(glyph, selectedLayout, writer, g, scale);
                }

                foreach (var glyph in selectedLayout.SpeciesGlyphs)
                {
                    glyphToTex(glyph, selectedLayout, writer, g, scale);
                }

                foreach (var glyph in selectedLayout.TextGlyphs)
                {
                    glyphToTex(glyph, selectedLayout, writer, g, scale);
                }

                foreach (var glyph in selectedLayout.AdditionalGraphicalObjects)
                {
                    glyphToTex(glyph, selectedLayout, writer, g, scale);
                }

                writer.WriteLine("}");
                writer.WriteLine("\\end{tikzpicture}");
                writer.WriteLine("\\end{center}");
                writer.WriteLine("\\end{document}");
            }
            finally
            {
                //TODO: you are creating a control, to obtain a graphics handle, but then dispose the control,
                //      so this handle is invalid!
                dummyControl.Dispose();
            }
        }
开发者ID:yarden,项目名称:sbml2tikz,代码行数:79,代码来源:Converter.cs


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