Example #1
0
    // Use this for initialization
    void Start()
    {
        FutileParams fparams = new FutileParams(true,true,false,false);
        fparams.AddResolutionLevel(480.0f, 1.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);

        Futile.instance.Init(fparams);

        Futile.atlasManager.LoadAtlas("Atlases/simple");
        //		Futile.atlasManager.LoadFont("Arial", "Arial.png", "Atlases/Arial");

        gcmap = new GCMap();
        gcmap.Init();

        player = new FSprite("green.png");
        enemy = new FSprite("dark_grey.png");

        Futile.stage.AddChild(gcmap);

        Futile.stage.AddChild(player);
        Futile.stage.AddChild (enemy);

        gcmap.x = -240;
        gcmap.y = 160;

        player.x = 0;
        player.y = 0;

        enemy.x = 6 * 32;
        enemy.y = -3 * 32;
    }
Example #2
0
 public Quadrant(GCMap map)
 {
     WS      = new MapPoint(map.LongitudeStart, map.LatitudeStart);
     WN      = new MapPoint(map.LongitudeStart, map.LatitudeEnd);
     ES      = new MapPoint(map.LongitudeEnd, map.LatitudeStart);
     EN      = new MapPoint(map.LongitudeEnd, map.LatitudeEnd);
     pixelsX = map.ImageSize.Width;
     pixelsY = map.ImageSize.Height;
 }
Example #3
0
        private void DrawLongitudeLine(Graphics g, double longitude, GCMap map, Rectangle mapArea)
        {
            int ax0 = map.LongitudeToX(longitude, ref mapArea);

            if (ax0 > mapArea.Left && ax < mapArea.Right)
            {
                g.DrawLine(Pens.Red, ax0, mapArea.Top, ax0, mapArea.Bottom);
            }
        }
Example #4
0
        private void DrawLatitudeLine(Graphics g, double latitude, GCMap map, Rectangle mapArea)
        {
            int ay0 = map.LatitudeToY(latitude, ref mapArea);

            if (ay0 > mapArea.Top && ay0 < mapArea.Bottom)
            {
                g.DrawLine(Pens.Red, mapArea.Left, ay0, mapArea.Right, ay0);
            }
        }
Example #5
0
        private void ekadasiMapToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int               step        = 0;
            VAISNAVADAY       dayEkadasi  = null;
            GregorianDateTime dateEkadasi = null;
            GCMap             selectedMap = null;

            while (step >= 0)
            {
                switch (step)
                {
                case 0:     // select ekadasi
                    DlgGetEkadasiName dlg = new DlgGetEkadasiName();
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        dayEkadasi  = dlg.SelectedDate;
                        dateEkadasi = dlg.SelectedDate.date;
                        step        = 1;
                    }
                    else
                    {
                        step = -1;
                    }
                    break;

                case 1:     // select location map
                    DlgSelectMap maps = new DlgSelectMap();
                    if (maps.ShowDialog() == DialogResult.OK)
                    {
                        step        = 2;
                        selectedMap = maps.SelectedMap;
                        if (selectedMap == null)
                        {
                            step = -1;
                        }
                    }
                    else
                    {
                        step = -1;
                    }
                    break;

                case 2:     // calculate Ekadasi map
                    DlgCalcEkadasiBoundaries d2 = new DlgCalcEkadasiBoundaries(dayEkadasi.date);
                    d2.SelectedDate        = dateEkadasi;
                    d2.SelectedVaisnavaDay = dayEkadasi;
                    d2.FindType            = 1;
                    d2.SelectedMap         = selectedMap;
                    d2.Show();
                    step = -1;
                    break;
                }
            }
        }
Example #6
0
        private void DrawQuandrantOverlay(Graphics g, GCMap map, Rectangle mapArea, QuadrantArray qa)
        {
            for (int x = 0; x < qa.Quadrants.GetLength(0); x++)
            {
                for (int y = 0; y < qa.Quadrants.GetLength(1); y++)
                {
                    double longitude  = qa.Longitudes[x];
                    double latitude   = qa.Latitudes[y];
                    double longitude2 = qa.Longitudes[x + 1];
                    double latitude2  = qa.Latitudes[y + 1];

                    int x0, y0, x1, y1;

                    x0 = map.LongitudeToX(longitude, ref mapArea);
                    y0 = map.LatitudeToY(latitude, ref mapArea);
                    x1 = map.LongitudeToX(longitude2, ref mapArea);
                    y1 = map.LatitudeToY(latitude2, ref mapArea);

                    Quadrant q = qa.Quadrants[x, y];

                    //g.DrawString(q.ResultState.ToString(), SystemFonts.MenuFont, Brushes.Black, (x0 + x1) / 2, (y0 + y1) / 2);
                    switch (q.ResultState)
                    {
                    case QuadrantResultState.Consistent:
                        Color c = q.WS.Result.color;
                        g.FillRectangle(getBrush(c), x0, y1, x1 - x0, y0 - y1);
                        break;

                    case QuadrantResultState.Inconsistent:
                        if (q.Details != null)
                        {
                            DrawQuandrantOverlay(g, map, mapArea, q.Details);
                        }
                        break;

                    case QuadrantResultState.Decomposable:
                        if (q.Details != null)
                        {
                            DrawQuandrantOverlay(g, map, mapArea, q.Details);
                        }
                        break;

                    case QuadrantResultState.NotAvailable:
                        break;
                    }
                }
            }
        }
Example #7
0
        public Bitmap ExportBitmap()
        {
            if (DataSource == null)
            {
                return(null);
            }
            GCMap map = DataSource.EMOV_GetMap();

            Size     clientArea = new Size(map.ImageSize.Width + 20, map.ImageSize.Height + 60);
            Bitmap   bmp        = new Bitmap(clientArea.Width, clientArea.Height, PixelFormat.Format32bppArgb);
            Graphics g          = Graphics.FromImage(bmp);

            g.FillRectangle(Brushes.White, 0, 0, map.ImageSize.Width + 20, map.ImageSize.Height + 60);
            DrawmapWithOverlay(clientArea, g);

            return(bmp);
        }
Example #8
0
        private void EventMapOverlayView_MouseClick(object sender, MouseEventArgs e)
        {
            EventmapOverlayEventArgs args = new EventmapOverlayEventArgs();

            args.ClientX = e.X;
            args.ClientY = e.Y;

            if (DataSource == null)
            {
                return;
            }
            GCMap map = DataSource.EMOV_GetMap();

            args.Longitude = map.XtoLongitude(e.X, globalMapArea);
            args.Latitude  = map.YtoLatitude(e.Y, globalMapArea);

            if (OnClick != null)
            {
                OnClick(this, args);
            }
        }
Example #9
0
        private void DrawmapWithOverlay(Size clientArea, Graphics g)
        {
            GCMap map = DataSource.EMOV_GetMap();

            map.Preparefactors();

            // insufficient dimensions
            if (clientArea.Width < 50 || clientArea.Height < 50 || map.ImageSize.Width < 50 || map.ImageSize.Height < 50)
            {
                return;
            }

            Size   clientAreaWithoutLegend = new Size(clientArea.Width - 10, clientArea.Height - 50);
            double ratioImageToScreen      = Math.Min((double)clientAreaWithoutLegend.Width / map.ImageSize.Width,
                                                      (double)clientAreaWithoutLegend.Height / map.ImageSize.Height);

            clientAreaWithoutLegend = new Size(Convert.ToInt32(ratioImageToScreen * map.ImageSize.Width),
                                               Convert.ToInt32(ratioImageToScreen * map.ImageSize.Height));

            Rectangle mapArea = new Rectangle(clientArea.Width / 2 - clientAreaWithoutLegend.Width / 2, 10,
                                              clientAreaWithoutLegend.Width, clientAreaWithoutLegend.Height);
            Rectangle mapAreaBitmap = new Rectangle(0, 0,
                                                    clientAreaWithoutLegend.Width, clientAreaWithoutLegend.Height);

            globalMapArea = mapArea;

            g.DrawImage(map.Image, mapArea);

            QuadrantArray qa = DataSource.EMOV_GetOverlay();

            if (qa != null)
            {
                if (CalculationFinished)
                {
                    overlayBitmap = null;
                    if (overlayBitmap == null)
                    {
                        overlayBitmap   = new Bitmap(mapArea.Width + 1, mapArea.Height + 1, PixelFormat.Format32bppArgb);
                        overlayGraphics = Graphics.FromImage(overlayBitmap);
                    }
                    // e.Graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
                    // e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.GammaCorrected;
                    //overlayGraphics.FillRectangle(getBrush(Color.Transparent), 0, 0, mapArea.Width, mapArea.Height);
                    DrawQuandrantOverlay(overlayGraphics, map, mapAreaBitmap, qa);
                    g.DrawImage(overlayBitmap, mapArea);
                }
                else
                {
                    DrawQuandrantOverlay(g, map, mapArea, qa);
                }
                //g.DrawRectangle(Pens.Red, mapArea);
            }

            DrawLongitudeLine(g, 0, map, mapArea);
            DrawLatitudeLine(g, 0, map, mapArea);
            DrawLatitudeLine(g, -66, map, mapArea);
            DrawLatitudeLine(g, 66, map, mapArea);

            List <QuandrantResult> results = DataSource.EMOV_GetResults();

            for (int i = 0; i < results.Count; i++)
            {
                int   y = clientArea.Height - results.Count * 20 - 4 + i * 20;
                Color c = results[i].color;
                g.FillRectangle(getBrush(Color.FromArgb(255, c)), mapArea.Left, y, 20, 15);
                g.FillRectangle(getBrush(results[i].color), mapArea.Left, y, 20, 15);
                g.DrawRectangle(Pens.Black, mapArea.Left, y, 20, 15);
                g.DrawString(results[i].ToString(), legendFont, Brushes.Black, mapArea.Left + 40, y);
            }
        }