コード例 #1
0
ファイル: AshtakavargaControl.cs プロジェクト: rahulyhg/mhora
        private void DrawChanchaInner(Graphics g)
        {
            IDrawChart dc = null;

            switch (this.userOptions.ChartStyle)
            {
            default:
            case EChartStyle.EastIndian:
                dc = new EastIndianChart();
                break;

            case EChartStyle.SouthIndian:
                dc = new SouthIndianChart();
                break;
            }
            int   innerSize  = (int)((float)Math.Min(this.bmpBuffer.Width, this.bmpBuffer.Height) / 3.15);
            float scaleInner = (float)innerSize / (float)dc.GetLength();

            g.ResetTransform();
            g.TranslateTransform(this.bmpBuffer.Width / 2, this.bmpBuffer.Height / 2);
            g.TranslateTransform(-1 * innerSize / 2, -1 * innerSize / 2);
            g.ScaleTransform(scaleInner, scaleInner);

            dc.DrawOutline(g);

            int[] inner_bindus;

            if (this.outerBodies.Length > 1)
            {
                if (this.userOptions.SavType == ESavType.Rao)
                {
                    inner_bindus = av.getSavRao();
                }
                else
                {
                    inner_bindus = av.getSav();
                }
            }
            else
            {
                inner_bindus = av.getPav(this.outerBodies[0]);
            }

            for (int i = 0; i < 12; i++)
            {
                ZodiacHouse zh = new ZodiacHouse((ZodiacHouse.Name)i + 1);
                Point       p  = dc.GetSingleItemOffset(zh);
                g.DrawString(inner_bindus[i].ToString(), fBig, b_black, p);
            }

            string av_desc = "SAV";

            if (outerBodies.Length == 1)
            {
                av_desc = "PAV";
            }
            SizeF sz = g.MeasureString(av_desc, fBig);

            g.DrawString(av_desc, fBig, b_black, 100 - (sz.Width / 2), 80 - (sz.Height / 2));

            if (outerBodies.Length == 1)
            {
                string desc = Body.toString(outerBodies[0]);
                sz = g.MeasureString(desc, fBig);
                g.DrawString(desc, fBig, b_black, 100 - (sz.Width / 2), 120 - (sz.Height / 2));
            }

            if (this.userOptions.SavType == ESavType.Rao)
            {
                string desc = "Rao";
                sz = g.MeasureString(desc, fBig);
                g.DrawString(desc, fBig, b_black, 100 - (sz.Width / 2), 120 - (sz.Height / 2));
            }

            {
                string desc = Basics.numPartsInDivisionString(this.userOptions.VargaType);;
                sz = g.MeasureString(desc, fBig);
                g.DrawString(desc, fBig, b_black, 100 - (sz.Width / 2), 100 - (sz.Height / 2));
            }
        }
コード例 #2
0
ファイル: AshtakavargaControl.cs プロジェクト: rahulyhg/mhora
        private void DrawJhoraChakra(Graphics g)
        {
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            if (false == this.PrintMode)
            {
                g.Clear(this.BackColor);
            }
            int        offset = 5;
            int        size   = (Math.Min(this.bmpBuffer.Width, this.bmpBuffer.Height) / 3) - 10;
            IDrawChart dc     = null;

            switch (this.userOptions.ChartStyle)
            {
            default:
            case EChartStyle.EastIndian:
                dc = new EastIndianChart();
                break;

            case EChartStyle.SouthIndian:
                dc = new SouthIndianChart();
                break;
            }

            Body.Name[] bin_body = new Body.Name[] {
                Body.Name.Lagna,
                Body.Name.Lagna, Body.Name.Sun, Body.Name.Moon,
                Body.Name.Mars, Body.Name.Mercury, Body.Name.Jupiter,
                Body.Name.Venus, Body.Name.Saturn
            };
            int[][] bins = new int[9][];

            if (userOptions.SavType == ESavType.Normal)
            {
                bins[0] = av.getSav();
            }
            else
            {
                bins[0] = av.getSavRao();
            }

            bins[1] = av.getPav(Body.Name.Lagna);
            bins[2] = av.getPav(Body.Name.Sun);
            bins[3] = av.getPav(Body.Name.Moon);
            bins[4] = av.getPav(Body.Name.Mars);
            bins[5] = av.getPav(Body.Name.Mercury);
            bins[6] = av.getPav(Body.Name.Jupiter);
            bins[7] = av.getPav(Body.Name.Venus);
            bins[8] = av.getPav(Body.Name.Saturn);

            string[] strs = new string[9];
            strs[0] = "SAV";
            strs[1] = Body.toString(Body.Name.Lagna);
            strs[2] = Body.toString(Body.Name.Sun);
            strs[3] = Body.toString(Body.Name.Moon);
            strs[4] = Body.toString(Body.Name.Mars);
            strs[5] = Body.toString(Body.Name.Mercury);
            strs[6] = Body.toString(Body.Name.Jupiter);
            strs[7] = Body.toString(Body.Name.Venus);
            strs[8] = Body.toString(Body.Name.Saturn);

            Brush b_background = new SolidBrush(MhoraGlobalOptions.Instance.ChakraBackgroundColor);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    g.ResetTransform();
                    g.TranslateTransform(i * size + ((i + 1) * offset), j * size + ((j + 1) * offset));
                    float scale = (float)size / (float)dc.GetLength();
                    g.ScaleTransform(scale, scale);
                    if (false == this.PrintMode)
                    {
                        g.FillRectangle(b_background, 0, 0, dc.GetLength(), dc.GetLength());
                    }
                    dc.DrawOutline(g);
                    int   off = j * 3 + i;
                    int[] bin = bins[off];
                    Debug.Assert(bin.Length == 12, "PAV/SAV: unknown size");
                    for (int z = 0; z < 12; z++)
                    {
                        Font f  = fBig;
                        int  zh = (int)h.getPosition(bin_body[off]).toDivisionPosition(userOptions.VargaType).zodiac_house.value;
                        if (z == zh - 1)
                        {
                            f = fBigBold;
                        }
                        Point p = dc.GetSingleItemOffset(new ZodiacHouse((ZodiacHouse.Name)z + 1));
                        g.DrawString(bin[z].ToString(), f, b_black, p);
                    }
                    SizeF sz = g.MeasureString(strs[off], fBig);
                    g.DrawString(strs[off], fBig, b_red, 100 - sz.Width / 2, 100 - sz.Height / 2);

                    if (off == 0 && userOptions.SavType == ESavType.Rao)
                    {
                        sz = g.MeasureString("Rao", fBig);
                        g.DrawString("Rao", fBig, b_red, 100 - sz.Width / 2, 120 - sz.Height / 2);
                    }
                }
            }
        }