示例#1
0
        public Metafile DrawPlot(Surfaces[] ElementSurfaces)
        {
            Metafile Plot = ImageMethods.MakeMetafile(PageWidth, PageHeight);
            Graphics g    = Graphics.FromImage(Plot);

            SetPlotTypeToDisplay();
            TheGraph.DrawGraph(g, Xo, ElementSurfaces);

            if (ColorPlotOn)
            {
                Plot_ColorScale.Initialize_Calculate_WidthAndHeight(ref g, TheGraph.Min, TheGraph.Max);
                Plot_ColorScale.x_c            = new Vector(X_TR);
                Plot_ColorScale.x_c.Values[0] += ColorScalePad + Plot_ColorScale.Width / 2.0D;
                Plot_ColorScale.AddColorScale(ref g);
            }

            Vector Title_c = X_TC;

            Plot_Title.GetWidthAndHeight(g);
            Title_c.Values[1] += -TitlePad - Plot_Title.Height;
            Plot_Title.DrawTitle(g, Title_c);

            Vector OPPS_Graphics_c = new Vector(2);

            OOPS_Graphics_Title.GetWidthAndHeight(g);
            OPPS_Graphics_c.Values[0] = PageWidth - ColorScalePad - OOPS_Graphics_Title.Width / 2.0D;
            OPPS_Graphics_c.Values[1] = PageHeight - ColorScalePad - OOPS_Graphics_Title.Height;
            OOPS_Graphics_Title.DrawTitle(g, OPPS_Graphics_c);

            g.Dispose();
            return(Plot);
        }
示例#2
0
        public Metafile DrawPlot(Vector[] Xs, Vector[] Ys)
        {
            Metafile Plot = ImageMethods.MakeMetafile(PageWidth, PageHeight);
            Graphics g    = Graphics.FromImage(Plot);

            TheGraph    = new XYGraph(Xs.Length, GraphWidth, GraphHeight);
            TheGraph.Xs = Xs;
            TheGraph.Ys = Ys;
            TheGraph.DrawGraph(Xo, g);

            X_Axis.DrawAxis(g, TheGraph.Xmin, TheGraph.Xmax, NumberOfTicks);
            Y_Axis.DrawAxis(g, TheGraph.Ymin, TheGraph.Ymax, NumberOfTicks);

            Vector X_Axis_Title_c = (Xo + X_BR) / 2.0;

            X_Axis_Title_c.Values[1] += X_Axis.Height + HorizontalAxisTitlePad;
            X_Axis_Title.DrawTitle(g, X_Axis_Title_c);

            Vector Y_Axis_Title_c = (Xo + X_TL) / 2.0D;

            Y_Axis_Title_c.Values[0] -= Y_Axis.Width + VerticalAxisTitlePad;

            Y_Axis_Title.DrawTitle(g, Y_Axis_Title_c);

            Vector Title_c = X_TL + (X_BR - Xo) / 2.0D;

            Plot_Title.GetWidthAndHeight(g);
            Title_c.Values[1] += -TitlePad - Plot_Title.Height;
            Plot_Title.DrawTitle(g, Title_c);

            Vector OPPS_Graphics_c = new Vector(2);

            OOPS_Graphics_Title.GetWidthAndHeight(g);
            OPPS_Graphics_c.Values[0] = PageWidth - HorizontalAxisTitlePad - OOPS_Graphics_Title.Width / 2.0D;
            OPPS_Graphics_c.Values[1] = PageHeight - VerticalAxisTitlePad - OOPS_Graphics_Title.Height;
            OOPS_Graphics_Title.DrawTitle(g, OPPS_Graphics_c);

            g.Dispose();
            return(Plot);
        }
示例#3
0
        public Metafile[] DrawPlot(Element_ND[] Elements, Node_ND[] Nodes, Vector[] GlobalUnknowns, out Vector MinV, out Vector MaxV)
        {
            int NP = GlobalUnknowns.Length;

            Metafile[] Plots = new Metafile[NP];
            Graphics[] gs    = new Graphics[NP];
            for (int i = 0; i < NP; i++)
            {
                Plots[i] = ImageMethods.MakeMetafile(PageWidth, PageHeight);
                gs[i]    = Graphics.FromImage(Plots[i]);
            }

            SetPlotTypeToDisplay();
            MinV = new Vector(NP);
            MaxV = new Vector(NP);
            Node_ND.Set_UnknownForNode(Nodes, GlobalUnknowns[0]);
            Surfaces[] TheSurfaces = Element_ND.Make_GraphicSurfaces(Elements, Plot_ObjectResolution);
            Surfaces.CalculateMinMax_Values(TheSurfaces, out MinV.Values[0], out MaxV.Values[0]);
            for (int i = 1; i < NP; i++)
            {
                Node_ND.Set_UnknownForNode(Nodes, GlobalUnknowns[i]);
                Element_ND.Change_GraphicSurfaces_Values(Elements, ref TheSurfaces, Plot_ObjectResolution);
                Surfaces.CalculateMinMax_Values(TheSurfaces, out MinV.Values[i], out MaxV.Values[i]);
            }
            double Min = MinV.Min();
            double Max = MaxV.Max();

            for (int i = 0; i < NP; i++)
            {
                Node_ND.Set_UnknownForNode(Nodes, GlobalUnknowns[i]);
                Element_ND.Change_GraphicSurfaces_Values(Elements, ref TheSurfaces, Plot_ObjectResolution);
                if (FixedScale)
                {
                    TheGraph.DrawGraph(gs[i], Xo, TheSurfaces, Min, Max);
                }
                else
                {
                    TheGraph.DrawGraph(gs[i], Xo, TheSurfaces, MinV.Values[i], MaxV.Values[i]);
                }
                if (ColorPlotOn)
                {
                    if (FixedScale)
                    {
                        Plot_ColorScale.Initialize_Calculate_WidthAndHeight(ref gs[i], Min, Max);
                    }
                    else
                    {
                        Plot_ColorScale.Initialize_Calculate_WidthAndHeight(ref gs[i], MinV.Values[i], MaxV.Values[i]);
                    }
                    Plot_ColorScale.x_c            = new Vector(X_TR);
                    Plot_ColorScale.x_c.Values[0] += ColorScalePad + Plot_ColorScale.Width / 2.0D;
                    Plot_ColorScale.AddColorScale(ref gs[i]);
                }
                Vector Title_c = new Vector(X_TC);
                Plot_Title.GetWidthAndHeight(gs[i]);
                Title_c.Values[1] += -TitlePad - Plot_Title.Height;
                Plot_Title.DrawTitle(gs[i], Title_c);

                Vector OPPS_Graphics_c = new Vector(2);
                OOPS_Graphics_Title.GetWidthAndHeight(gs[i]);
                OPPS_Graphics_c.Values[0] = PageWidth - ColorScalePad - OOPS_Graphics_Title.Width / 2.0D;
                OPPS_Graphics_c.Values[1] = PageHeight - ColorScalePad - OOPS_Graphics_Title.Height;
                OOPS_Graphics_Title.DrawTitle(gs[i], OPPS_Graphics_c);

                gs[i].Dispose();
            }
            return(Plots);
        }