Esempio n. 1
0
        // Adapted from EmlRenderExtension.Group.Draw()
        public static void ToTex(this Group group, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, Graphics g, RenderInformation rendinfo, Group refgroup, RectangleF refbounds, double scale, Hashtable fontTexTable)
        {
            if (group.Children.Count == 0)
            {
                if (glyph is TextGlyph)
                {
                    group.TextTex((TextGlyph)glyph, writer, g, rendinfo, refgroup, scale, fontTexTable);
                }
                else if (glyph is ReactionGlyph)
                {
                    group.ReactionTex((ReactionGlyph)glyph, writer, g, rendinfo, refgroup, refbounds, scale, fontTexTable);
                }
                else if (glyph is SpeciesReference)
                {
                    SpeciesReference graphElement = (SpeciesReference)glyph;
                    Style styleForObjectID = rendinfo.GetStyleForObjectId(graphElement);

                    if (styleForObjectID == null)
                        styleForObjectID = rendinfo.GetStyleForObjectRole(graphElement);

                    if (styleForObjectID == null)
                        styleForObjectID = rendinfo.GetStyleForObjectType(graphElement);

                    if (styleForObjectID == null && string.IsNullOrEmpty(graphElement.ObjectRole))
                    {
                        graphElement.ObjectRole = graphElement.Role;
                        styleForObjectID = rendinfo.GetStyleForObjectRole(graphElement);
                    }
                    if (styleForObjectID == null)
                    {
                        group.SpeciesReferenceTex((SpeciesReference)glyph, writer, g, rendinfo, group, scale, fontTexTable);
                    }
                    else
                    {
                        group.SpeciesReferenceTex((SpeciesReference)glyph, writer, g, rendinfo, styleForObjectID.Group, scale, fontTexTable);
                    }
                }
                else
                {
                    Style styleForObjectRole = rendinfo.GetStyleForObjectId(glyph);
                    if (styleForObjectRole == null)
                        styleForObjectRole = rendinfo.GetStyleForObjectRole(glyph);
                    if (styleForObjectRole == null)
                        styleForObjectRole = rendinfo.GetStyleForObjectType(glyph);
                    if ((styleForObjectRole != null) && ((styleForObjectRole.Group != null) && (styleForObjectRole.Group.Children.Count != 0)))
                    {
                        styleForObjectRole.Group.ToTex(glyph, writer, g, rendinfo, styleForObjectRole.Group, refbounds, scale, fontTexTable);
                    }
                }
            }
            else{
                foreach (SBMLExtension.EmlRenderExtension.GraphicalObject childObj in group.Children)
                {
                    // Determine what type is the childObj and find the style accordingly
                    if (childObj is SBMLExtension.EmlRenderExtension.Image)
                    {
                        SBMLExtension.EmlRenderExtension.Image childImage = (SBMLExtension.EmlRenderExtension.Image)childObj;
                        childImage.ImageTex(glyph, writer, rendinfo, refgroup, scale);
                    }
                    else
                    {
                        // childObj is a GraphicalPrimitve1D
                        if (childObj is Text)
                        {
                            Text childText = (Text)childObj;
                            childText.TextTex(glyph, writer, g, rendinfo, refgroup, scale, fontTexTable);
                        }
                        else if (childObj is Group)
                        {
                            writer.WriteLine("{");
                            writer.Indent += 1;
                            CommentTex(glyph, childObj, writer);
                            Group childgrp = (Group)childObj;
                            childgrp.ToTex(glyph, writer, g, rendinfo, refgroup, refbounds, scale, fontTexTable);
                            writer.Indent -= 1;
                            writer.WriteLine("}");
                        }
                        else
                        {
                            // childObj is a GraphicalPrimitve2D
                            if (childObj is SBMLExtension.EmlRenderExtension.Rectangle)
                            {
                                SBMLExtension.EmlRenderExtension.Rectangle childRect = (SBMLExtension.EmlRenderExtension.Rectangle)childObj;
                                childRect.RectangleTex(glyph, writer, rendinfo, refgroup, refbounds, scale);
                            }
                            if (childObj is SBMLExtension.EmlRenderExtension.Polygon)
                            {
                                Polygon childPoly = (Polygon)childObj;
                                childPoly.PolygonTex(glyph, writer, rendinfo, refgroup, refbounds, scale);
                            }
                            if (childObj is SBMLExtension.EmlRenderExtension.LineEnding)
                            {
                                LineEnding childEnd = (LineEnding)childObj;
                                childEnd.LineEndingTex(glyph, writer, g, rendinfo, refgroup, scale, true, fontTexTable);
                            }
                            if (childObj is SBMLExtension.EmlRenderExtension.Ellipses)
                            {
                                Ellipses childEllipse = (Ellipses)childObj;
                                childEllipse.EllipseTex(glyph, rendinfo, writer, refgroup, refbounds, scale);
                            }
                            if (childObj is SBMLExtension.EmlRenderExtension.Curve)
                            {
                                SBMLExtension.EmlRenderExtension.Curve childCurve = (SBMLExtension.EmlRenderExtension.Curve)childObj;
                                childCurve.CurveTex(glyph, rendinfo, writer, refgroup, refbounds, scale);
                            }
                        }
                    }
                }
                //if (glyph is ReactionGlyph)
                //{
                //    //ReactionGlyph rGlyph = (ReactionGlyph)glyph;
                //    //foreach (SpeciesReference reference in rGlyph.SpeciesReferences)
                //    //{
                //    //    Style styleForObjectType = rendinfo.GetStyleForObjectId(reference);
                //    //    if (styleForObjectType == null)
                //    //        styleForObjectType = rendinfo.GetStyleForObjectRole(reference);
                //    //    if (styleForObjectType == null)
                //    //        styleForObjectType = rendinfo.GetStyleForObjectType(reference);
                //    //    if (styleForObjectType == null)
                //    //        group.SpeciesReferenceTex(reference, writer, g, rendinfo, group, scale, fontTexTable);
                //    //    else
                //    //        group.SpeciesReferenceTex(reference, writer, g, rendinfo, styleForObjectType.Group, scale, fontTexTable);
                //    //}
                //}
            }

            //if (!string.IsNullOrEmpty(group.EndHead))
            //{
            //    LineEnding endhead = rendinfo.GetLineEnding(group.EndHead);
            //    endhead.LineEndingTex(glyph, writer, g, rendinfo, group, scale, false, fontTexTable);
            //}
            //if (!string.IsNullOrEmpty(group.StartHead))
            //{
            //    LineEnding starthead = rendinfo.GetLineEnding(group.StartHead);
            //    starthead.LineEndingTex(glyph, writer, g, rendinfo, group, scale, false, fontTexTable);
            //}
        }
Esempio n. 2
0
        private static void CommentTex(SBMLExtension.LayoutExtension.GraphicalObject glyph, SBMLExtension.EmlRenderExtension.GraphicalObject graphItem, IndentedTextWriter writer)
        {
            string glyphtype;
            if (graphItem is Group)
            {
                glyphtype = "Group";
            }
            else if (graphItem is Text)
            {
                glyphtype = "Text";
            }
            else if (graphItem is Polygon)
            {
                glyphtype = "Polygon";
            }
            else if (graphItem is SBMLExtension.EmlRenderExtension.Rectangle)
            {
                glyphtype = "Rectangle";
            }
            else if (graphItem is Ellipses)
            {
                glyphtype = "Ellipses";
            }
            else if (graphItem is LineEnding)
            {
                glyphtype = "LineEnding";
            }
            else if (graphItem is SBMLExtension.EmlRenderExtension.Image)
            {
                glyphtype = "Image import";
            }
            else if (graphItem is SBMLExtension.EmlRenderExtension.Curve)
            {
                glyphtype = "Curve";
            }
            else
            {
                glyphtype = "Unknown";
            }

            string reference = glyph.Name;
            if (string.IsNullOrEmpty(reference))
            {
                reference = glyph.ID;
            }
            if (string.IsNullOrEmpty(reference))
            {
                reference = "unspecified";
            }

            string comment = "% " + glyphtype + " for " + reference;
            writer.WriteLine(comment);
        }
Esempio n. 3
0
        // works like group.DrawSegment for TeX
        public static void SingleSegmentTex(this Group group, CurveSegment segment, SBMLExtension.LayoutExtension.GraphicalObject glyph, Boolean endOfLine, IndentedTextWriter writer, Graphics g, RenderInformation rendinfo, Group refgroup, double scale, Hashtable fontTexTable)
        {
            string strokewidth = group.GetStrokeWidth(rendinfo, refgroup, scale);
            Color linecolor = group.GetStrokeColor(rendinfo, refgroup);

            string strokeRef = FillColor.getStrokeRef(group, rendinfo, refgroup);
            if (String.IsNullOrEmpty(strokeRef) || !FillColor.isColorID(strokeRef, rendinfo.ColorDefinitions))
            {
                strokeRef = "curLineColor";
                FillColor.AssignColorRGBTex(linecolor, "curLineColor", writer);
            }

            string dashed = ", " + group.DashTex(group.GetDashType(refgroup));
            string segmentHead = "[line width = " + strokewidth + "pt, color = " + strokeRef + FillColor.AlphaValTex(linecolor) + dashed + "]";

                if (segment.Type == "CubicBezier")
                {
                    writer.WriteLine("\\draw{8} ({0}pt, {1}pt) .. controls ({2}pt, {3}pt) and ({4}pt, {5}pt) .. ({6}pt, {7}pt);",
                    segment.Start.X, segment.Start.Y,
                    segment.BasePoint1.X, segment.BasePoint1.Y,
                    segment.BasePoint2.X, segment.BasePoint2.Y,
                    segment.End.X, segment.End.Y,
                    segmentHead);
                }
                else if (segment.Type == "LineSegment")
                {
                    writer.WriteLine("\\draw{4} ({0}pt, {1}pt) -- ({2}pt, {3}pt);",
                    segment.Start.X, segment.Start.Y,
                    segment.End.X, segment.End.Y,
                    segmentHead);
                }

                if (endOfLine)
                {
                    group.ReactionLineEndingTex(segment, glyph, writer, g, rendinfo, refgroup, scale, fontTexTable);
                }
        }
Esempio n. 4
0
        public static void TextTex(this Text text, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, Graphics g, RenderInformation rendinfo, Group refgroup, double scale, Hashtable fontTexTable)
        {
            writer.WriteLine("{");
            writer.Indent += 1;
            CommentTex(glyph, text, writer);
            RectangleF bound_rectangle = glyph.Bounds.toRect();

            Text.TextAnchors horizontalAnchor = text.GetHorizontalAnchor(refgroup);
            Text.VerticalTextAnchors verticalAnchor = text.GetVerticalAnchor(refgroup);
            Font font = text.GetScaledFont(scale, refgroup);

            SizeF string_size = g.MeasureString(text.TheText, font);
            PointF text_coord = text.GetPoint(bound_rectangle);

            Color text_color = text.GetStrokeColor(rendinfo, refgroup);
            if (!text_color.Equals(Color.Empty))
            {
                // refer stroke information to a ColorDefinition ID or assign a new colordefinition to "curLineColor"
                string strokeRef = FillColor.getStrokeRef(text, rendinfo, refgroup);
                if (String.IsNullOrEmpty(strokeRef) || !FillColor.isColorID(strokeRef, rendinfo.ColorDefinitions))
                {
                    strokeRef = "curLineColor";
                    FillColor.AssignColorRGBTex(text_color, "curLineColor", writer);
                }

                switch (horizontalAnchor)
                {
                    case Text.TextAnchors.start:
                        text_coord.X += string_size.Width / 2f;
                        break;

                    case Text.TextAnchors.middle:
                        text_coord.X += bound_rectangle.Width / 2f;
                        break;

                    case Text.TextAnchors.end:
                        text_coord.X += bound_rectangle.Width - string_size.Width / 2f;
                        break;
                }
                switch (verticalAnchor)
                {
                    case Text.VerticalTextAnchors.top:
                        text_coord.Y += string_size.Height / 2f;
                        break;

                    case Text.VerticalTextAnchors.middle:
                        text_coord.Y += (bound_rectangle.Height / 2f);
                        break;

                    case Text.VerticalTextAnchors.bottom:
                        text_coord.Y += bound_rectangle.Height - string_size.Height / 2f;
                        break;
                }

                writer.WriteLine("\\draw ({0}pt, {1}pt) node[text = {7}{2}, font = \\fontsize{{ {3} }} {{ {4} }}\\fontfamily{6}\\selectfont] {{ {5} }};",
                   (text_coord.X).ToString(),
                   (text_coord.Y).ToString(),
                   FillColor.AlphaValTex(text_color),
                   font.SizeInPoints,
                   font.SizeInPoints,
                   correctText(text.TheText),
                   FontTex(font, fontTexTable),
                   strokeRef);
            }
            writer.Indent -= 1;
            writer.WriteLine("}");
        }
Esempio n. 5
0
        public static void ReactionLineStartTex(this Group group, CurveSegment segment, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, Graphics g, RenderInformation rendinfo, Group refgroup, double scale, Hashtable fontTexTable)
        {
            if (!string.IsNullOrEmpty(refgroup.StartHead))
            {
                PointF p1 = segment.Start.ToPointF();
                PointF p2 = segment.End.ToPointF();
                if (segment.Type != "LineSegment")
                {
                    p2 = segment.BasePoint2.ToPointF();
                }
                LineEnding ending = rendinfo.GetLineEnding(refgroup.StartHead);
                writer.WriteLine("{");
                writer.Indent += 1;

                writer.WriteLine("\\pgftransformshift{{\\pgfpoint{{ {0}pt }}{{ {1}pt }} }}",
                       p1.X.ToString(),
                       (p1.Y).ToString());

                RotationalMappingLineEndTex(ending, p1, p2, writer, refgroup);

                ending.LineEndingTex(glyph, writer, g, rendinfo, refgroup, scale, false, fontTexTable); // pass false as we have already done rotation
                writer.Indent -= 1;
                writer.WriteLine("}");
            }
        }
Esempio n. 6
0
        // adapted from EmlRenderExtension.Rectangle.draw
        public static void RectangleTex(this SBMLExtension.EmlRenderExtension.Rectangle rectangle, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, RenderInformation rendinfo, Group refgroup, RectangleF refbounds, double scale)
        {
            writer.WriteLine("{");
            writer.Indent += 1;
            CommentTex(glyph, rectangle, writer);
            // Check what kind of filling
            RectangleF bound_rectangle = glyph.Bounds.toRect();
            if (!refbounds.IsEmpty)
                bound_rectangle = refbounds;
            FillColor fill = rectangle.GetFillColor(rendinfo, bound_rectangle, refgroup);

            RotateAndShift(rectangle, bound_rectangle, writer);

            if (fill == null)
            {
                fill = new FillColor(Color.Empty);
            }
            if (fill.gradient && !fill.radial && fill.colorList.Count > 1)
            {
                rectangle.LinearGradTex(bound_rectangle, fill, writer, rendinfo, refgroup, scale);
            }
            else if (fill.gradient && fill.colorList.Count > 1)
            {
                rectangle.RadialGradTex(bound_rectangle, fill, writer, rendinfo, refgroup, scale);
            }
            else
            {
                rectangle.SolidColorTex(bound_rectangle, fill, writer, rendinfo, refgroup, scale);
            }

            writer.Indent -= 1;
            writer.WriteLine("}");
        }
Esempio n. 7
0
 public static void LineEndingTex(this LineEnding ending, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, Graphics g, RenderInformation rendinfo, Group refgroup, double scale, Boolean notInReactionGlyph, Hashtable fontTexTable)
 {
     writer.WriteLine("{");
     writer.Indent += 1;
     CommentTex(glyph, ending, writer);
     RectangleF bound_rectangle = ending.BoundingBox.toRect();
     if (notInReactionGlyph)
     {
         bound_rectangle = glyph.Bounds.toRect();
         RotateAndShift(ending, bound_rectangle, writer);
     }
     ending.Group.ToTex(glyph, writer, g, rendinfo, refgroup, bound_rectangle, scale, fontTexTable);
     writer.Indent -= 1;
     writer.WriteLine("}");
 }
Esempio n. 8
0
        public static void PolygonTex(this Polygon polygon, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, RenderInformation rendinfo, Group refgroup, RectangleF refbounds, double scale)
        {
            writer.WriteLine("{");
            writer.Indent += 1;
            CommentTex(glyph, polygon, writer);
            RectangleF bound_rectangle = glyph.Bounds.toRect();
            if (!refbounds.IsEmpty)
                bound_rectangle = refbounds;
            FillColor fill = polygon.GetFillColor(rendinfo, bound_rectangle, refgroup);

            RotateAndShift(polygon, bound_rectangle, writer);

            if (fill == null)
            {
                fill = new FillColor(Color.Empty);
            }

            if (fill.gradient && !fill.radial && fill.colorList.Count > 1)
            {
                polygon.LinearGradientPolygon(bound_rectangle, fill, writer, rendinfo, refgroup, scale);
            }
            else if (fill.gradient && fill.colorList.Count > 1)
            {
                polygon.PathGradientPolygon(bound_rectangle, fill, writer, rendinfo, refgroup, scale);
            }
            else
            {
                polygon.SolidColorPolygon(bound_rectangle, fill, writer, rendinfo, refgroup, scale);
            }

            writer.Indent -= 1;
            writer.WriteLine("}");
        }
Esempio n. 9
0
        public static void ImageTex(this SBMLExtension.EmlRenderExtension.Image image, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, RenderInformation rendinfo, Group refgroup, double scale)
        {
            if (string.IsNullOrEmpty(image.FullPath))
            {
                image.FullPath = image.HRef;
                if (!File.Exists(image.FullPath))
                {
                    string dir = (string) SBMLExtension.Util.CurrentDirectory;
                    image.FullPath = dir + "\\" + image.FullPath;
                }
            }
            if (!string.IsNullOrEmpty(image.FullPath) && File.Exists(image.FullPath))
            {
                writer.WriteLine("{");
                writer.Indent += 1;
                CommentTex(glyph, image, writer);
                RectangleF bound_rectangle = glyph.Bounds.toRect();
                PointF location = new PointF(image.X.Contains("%") ? (bound_rectangle.X + ((bound_rectangle.Width * SBMLExtension.Util.readSingle(image.X)) / 100f)) : (bound_rectangle.X + SBMLExtension.Util.readSingle(image.X)),
                                             image.Y.Contains("%") ? (bound_rectangle.Y + ((bound_rectangle.Height * SBMLExtension.Util.readSingle(image.Y)) / 100f)) : (bound_rectangle.Y + SBMLExtension.Util.readSingle(image.Y)));

                SizeF size = new SizeF(image.Width.Contains("%") ? ((bound_rectangle.Width * SBMLExtension.Util.readSingle(image.Width)) / 100f) : SBMLExtension.Util.readSingle(image.Width),
                                       image.Height.Contains("%") ? ((bound_rectangle.Height * SBMLExtension.Util.readSingle(image.Height)) / 100f) : SBMLExtension.Util.readSingle(image.Height));
                size.Height = size.Height * (float)scale;
                size.Width = size.Width * (float)scale;
                //note that pgftransformcm does not rotate imported images
                double rotate = 0;
                if (!string.IsNullOrEmpty(image.Transform))
                {
                    Matrix matrix = image.GetMatrix(bound_rectangle.X, bound_rectangle.Y);
                    if (Math.Abs(matrix.Elements[0]) <= 1)
                    {
                        rotate = Math.Asin(matrix.Elements[0]);
                    }
                }

                writer.WriteLine("\\draw ({1}pt, {2}pt) node []{{ \\includegraphics[height = {3}pt, width = {4}pt, angle = {5}]{{{0}}} }};",
                    Path.GetFileName(image.FullPath),
                    location.X,
                    location.Y,
                    size.Height,
                    size.Width,
                    rotate
                    );
                writer.Indent -= 1;
                writer.WriteLine("}");
            }
        }
Esempio n. 10
0
        public static void CurveTex(this SBMLExtension.EmlRenderExtension.Curve curve, SBMLExtension.LayoutExtension.GraphicalObject glyph, RenderInformation rendinfo, IndentedTextWriter writer, Group refgroup, RectangleF refbounds, double scale)
        {
            writer.WriteLine("{");
            writer.Indent += 1;
            CommentTex(glyph, curve, writer);
            RectangleF bound_rectangle = glyph.Bounds.toRect();
            if (!refbounds.IsEmpty)
                bound_rectangle = refbounds;
            RotateAndShift(curve, bound_rectangle, writer);

            // obtain fill and stroke information
            Color linecolor = curve.GetStrokeColor(rendinfo, refgroup);
            string strokewidth = curve.GetStrokeWidth(rendinfo, refgroup, scale);
            FillColor fill = curve.GetFillColor(rendinfo, bound_rectangle, refgroup);
            string dashed = "";
            if (!string.IsNullOrEmpty(curve.GetDashType(refgroup)))
            {
                dashed = ", " + curve.DashTex(curve.GetDashType(refgroup));
            }

            // refer stroke information to a ColorDefinition or assign a new colordefinition to "curLineColor"
            string strokeRef = FillColor.getStrokeRef(curve, rendinfo, refgroup);
            if (String.IsNullOrEmpty(strokeRef) || !FillColor.isColorID(strokeRef, rendinfo.ColorDefinitions))
            {
                strokeRef = "curLineColor";
                FillColor.AssignColorRGBTex(linecolor, "curLineColor", writer);
            }

            // now either draw the outline if fill is null, or draw and fill otherwise
            if (fill == null || fill.colorList[0].Equals(Color.Empty))
            {
                if (curve.CurveSegments.Count != 0)
                {
                    // draw all curveSegments
                    writer.WriteLine("\\draw [line width = {0}pt, color = {3}{1} {2}] ",
                        strokewidth,
                        FillColor.AlphaValTex(linecolor),
                        dashed,
                        strokeRef);
                    SegmentsTex(curve.CurveSegments, bound_rectangle, writer, false);
                }

                if (curve.ListOfElements.Count != 0)
                {
                    // draw all listOfElements
                    writer.Write("\\draw [line width = {0}pt, color = {3}{1} {2}] ",
                        strokewidth,
                        FillColor.AlphaValTex(linecolor),
                        dashed,
                        strokeRef);
                    ElementsTex(curve.ListOfElements, writer, bound_rectangle, false, false);
                }
            }
            else if (fill.gradient)
            {
                if (!FillColor.isGradientID(fill.ID, rendinfo.GradientDefinitions))
                {
                    FillColor.AssignGradientTex(fill, fill.ID, writer);
                }
                if (curve.CurveSegments.Count != 0)
                {
                    // draw all curveSegments
                    writer.WriteLine("\\draw [line width = {0}pt, color = {5}{1},shading = {4}, shading angle = {2} {3}] ",
                        strokewidth,
                        FillColor.AlphaValTex(linecolor),
                        fill.gradient_rotation,
                        dashed,
                        fill.ID,
                        strokeRef);
                    PolygonSegmentsTex(curve.CurveSegments, bound_rectangle, writer, false);
                }

                if (curve.ListOfElements.Count != 0)
                {
                    // draw all listOfElements
                    writer.WriteLine("\\draw [line width = {0}pt, color = {5}{1}, shading = {4}, shading angle = {2} {3}] ",
                        strokewidth,
                        FillColor.AlphaValTex(linecolor),
                        fill.gradient_rotation,
                        dashed,
                        fill.ID,
                        strokeRef);
                    ElementsTex(curve.ListOfElements, writer, bound_rectangle, false, true);
                }
            }

            else //solid fill
            {
                Color curSolidColor = fill.colorList[0];
                string solidRef = FillColor.getColorRef(curve, rendinfo, refgroup);
                if (String.IsNullOrEmpty(solidRef) || !FillColor.isColorID(solidRef, rendinfo.ColorDefinitions))
                {
                    solidRef = "curSolidColor";
                    FillColor.AssignColorRGBTex(curSolidColor, "curSolidColor", writer);
                }
                if (curve.CurveSegments.Count != 0)
                {
                    // draw all curveSegments
                    writer.WriteLine("\\draw [line width = {0}pt, {4}{1}, fill = {5}{2} {3}] ",
                        strokewidth,
                        FillColor.AlphaValTex(linecolor),
                        FillColor.AlphaValTex(curSolidColor),
                        dashed,
                        strokeRef,
                        solidRef);
                    PolygonSegmentsTex(curve.CurveSegments, bound_rectangle, writer, false);
                }

                if (curve.ListOfElements.Count != 0)
                {
                    // draw all listOfElements
                    writer.WriteLine("\\draw [line width = {0}pt, color = {4}{1}, fill = {5}{2} {3}] ",
                        strokewidth,
                        FillColor.AlphaValTex(linecolor),
                        FillColor.AlphaValTex(curSolidColor),
                        dashed,
                        strokeRef,
                        solidRef);
                    ElementsTex(curve.ListOfElements, writer, bound_rectangle, false, true);
                }
            }
            writer.Indent -= 1;
            writer.WriteLine("}");
        }
Esempio n. 11
0
        // adapted from RenderSpeciesReference
        private static void SpeciesReferenceTex(this Group group, SBMLExtension.LayoutExtension.GraphicalObject glyph, IndentedTextWriter writer, Graphics g, RenderInformation rendinfo, Group refgroup, double scale, Hashtable fontTexTable)
        {
            SpeciesReference reference = (SpeciesReference) glyph;
            RectangleF bound_rectangle = glyph.Bounds.toRect();

            SolidBrush brush = (SolidBrush)group.GetBrush(rendinfo, bound_rectangle, refgroup);
            Color fillcolor = brush.Color;

            if (reference.Curve.CurveSegments.Count != 0)
            {
                group.ReactionLineStartTex(reference.Curve.CurveSegments[0], glyph, writer, g, rendinfo, refgroup, scale, fontTexTable);
                //group.ReactionLineEndingTex(reference.Curve.CurveSegments[0], glyph, writer, g, rendinfo, refgroup, scale, fontTexTable);
            }

            for (int i = 0; i < reference.Curve.CurveSegments.Count; i++)
            {
                bool endOfLine = i == (reference.Curve.CurveSegments.Count - 1);
                group.SingleSegmentTex(reference.Curve.CurveSegments[i], glyph, endOfLine, writer, g, rendinfo, refgroup, scale, fontTexTable);
            }
        }
Esempio n. 12
0
        private static PointF[] RectPositionInBounds(SBMLExtension.EmlRenderExtension.Rectangle rectangle, RectangleF bound_rectangle)
        {
            PointF topCorner = new PointF(rectangle.X.Contains("%") ? (((bound_rectangle.Width * SBMLExtension.Util.readSingle(rectangle.X)) / 100f)) : (SBMLExtension.Util.readSingle(rectangle.X)),
                 rectangle.Y.Contains("%") ? (((bound_rectangle.Height * SBMLExtension.Util.readSingle(rectangle.Y)) / 100f)) : (SBMLExtension.Util.readSingle(rectangle.Y)));
            if (string.IsNullOrEmpty(rectangle.RY))
                rectangle.RY = rectangle.RX;
            if (string.IsNullOrEmpty(rectangle.RX))
                rectangle.RX = rectangle.RY;
            SizeF size = new SizeF(rectangle.Width.Contains("%") ? ((bound_rectangle.Width * SBMLExtension.Util.readSingle(rectangle.Width)) / 100f) : SBMLExtension.Util.readSingle(rectangle.Width),
                                   rectangle.Height.Contains("%") ? ((bound_rectangle.Height * SBMLExtension.Util.readSingle(rectangle.Height)) / 100f) : SBMLExtension.Util.readSingle(rectangle.Height));

            PointF botCorner = new PointF(topCorner.X + size.Width, topCorner.Y + size.Height);
            PointF[] coords = new PointF[2] { topCorner, botCorner };
            return coords;
        }
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the TempLabel class.
 /// </summary>
 /// <param name="textGlyph"></param>
 /// <param name="textStyle"></param>
 /// <param name="localStyle"></param>
 public TempLabel(SBMLExtension.LayoutExtension.TextGlyph textGlyph, SBMLExtension.EmlRenderExtension.Text textStyle, SBMLExtension.EmlRenderExtension.LocalStyle localStyle)
 {
     _TextGlyph = textGlyph;
     _TextStyle = textStyle;
     _LocalStyle = localStyle;
 }