Ejemplo n.º 1
0
        private void ApplyPressed(object sender, EventArgs e)  //chiudo la personalizzazione e applico le modifiche
        {
            if (normalGPSRadio.IsChecked)
            {
                usingGPS        = true;
                customLatitude  = latitude;
                customLongitude = longitude;
                GPSMode1.FadeTo(1, 200);
                GPSMode2.FadeTo(0, 200);
            }
            else
            {
                usingGPS        = false;
                customLatitude  = float.Parse(latitudeText.Text.Replace('.', ','));
                customLongitude = float.Parse(longitudeText.Text.Replace('.', ','));
                if (customLatitude > 90)
                {
                    customLatitude = 90;
                }
                else if (customLatitude < -90)
                {
                    customLatitude = -90;
                }
                if (customLongitude > 360)
                {
                    customLongitude = 360;
                }
                else if (customLongitude < 0)
                {
                    customLongitude = 0;
                }
                GPSMode1.FadeTo(0, 200);
                GPSMode2.FadeTo(1, 200);
            }

            for (int i = 0; i < planets.Count; i++)
            {
                syncPlanets[i] = (Planet)planets[i].Clone();
            }
            for (int i = 0; i < stars.Count; i++)
            {
                syncStars[i] = (Planet)stars[i].Clone();
            }
            for (int i = 0; i < points.Count; i++)
            {
                syncPoints[i] = (Planet)points[i].Clone();
            }

            syncPlanets        = synchronizePlanets(syncPlanets, customLongitude, customLatitude);
            syncStars          = synchronizePlanets(syncStars, customLongitude, customLatitude);
            syncPoints         = synchronizePlanets(syncPoints, customLongitude, customLatitude);
            syncConstellations = new Constellations(this, syncStars);
            FixNorthSouthPole();

            CloseCustomGPS();
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------------------------------------------------\\
        #region COSE PRINCIPALI

        //COSTRUTTORE
        public Camera3D(MainPage main, List <Planet> planets, String observer, float RA, float DEC, float longitude, Boolean isLocationLoaded, int height, int width, String theme)    //quel dec è dove guardiamo se guardiamo in alto
        {
            InitializeComponent();
            this.main    = main;
            this.planets = new List <Planet>(planets);
            stars        = StarDB.getAll();
            points       = new List <Planet>(planets);
            points.Add(new Planet("SOUTHPOLE", 0, -90, 60, new SKColor(255, 255, 255)));
            points.Add(new Planet("NORTHPOLE", 0, 90, 60, new SKColor(255, 255, 255)));
            for (float i = 0; i <= 360; i = i + 0.2f)
            {
                points.Add(new Planet("EQUATOR", i, 0, 4, new SKColor(255, 255, 255)));
            }

            this.observer  = observer;
            this.RA        = tempRA = RA;
            this.DEC       = tempDEC = latitude = customLatitude = DEC;
            this.longitude = customLongitude = longitude;
            positionLoaded = usingGPS = isLocationLoaded;
            this.width     = width;
            this.height    = height;
            ampWidth       = baseAmp / 2;
            ampHeight      = ampWidth * height / width;
            this.theme     = theme;

            //sync
            this.syncPlanets = new List <Planet>();
            for (int i = 0; i < planets.Count; i++)
            {
                syncPlanets.Add((Planet)planets[i].Clone());
            }
            syncPlanets = synchronizePlanets(syncPlanets, customLongitude, customLatitude);

            this.syncStars = new List <Planet>();
            for (int i = 0; i < stars.Count; i++)
            {
                syncStars.Add((Planet)stars[i].Clone());
            }
            syncStars = synchronizePlanets(syncStars, customLongitude, customLatitude);

            this.syncPoints = new List <Planet>();
            for (int i = 0; i < points.Count; i++)
            {
                syncPoints.Add((Planet)points[i].Clone());
            }
            syncPoints = synchronizePlanets(syncPoints, customLongitude, customLatitude);

            //costellazioni
            this.constellations               = new Constellations(this, stars);
            this.constellations.printText     = true;
            this.syncConstellations           = new Constellations(this, syncStars);
            this.syncConstellations.printText = true;

            //fix polo nord e sud
            FixNorthSouthPole();

            //inizializzazioni
            setTexture();
            setTextureHD();
            loadBottomBarTexture();
        }
Ejemplo n.º 3
0
        //STAMPA
        private void canvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e)
        {
            if (startup)
            {
                translateBottonBarDown();                                         //la barra non c'è
                rocketLabel.TranslateTo(0, -rocketLabelImage.Height * 2, 0);      //il dita del razzo non ci sono
                rocketLabelImage.TranslateTo(0, -rocketLabelImage.Height * 2, 0); //il razzo non c'è
                startup = false;
            }

            SKSurface surface = e.Surface;
            SKCanvas  canvas  = surface.Canvas;

            canvas.Clear();

            //seleziono le liste sincronizzate (terra) o non sincronizzate (tutto il resto)
            if (observer.Equals("earth"))
            {
                tempPlanets        = syncPlanets;
                tempConstellations = syncConstellations;
                tempStars          = syncStars;
                tempPoints         = syncPoints;
            }
            else
            {
                tempPlanets        = planets;
                tempConstellations = constellations;
                tempStars          = stars;
                tempPoints         = points;
            }

            //stampo le stelle
            for (int i = 0; i < tempStars.Count; i++)
            {
                canvas.DrawCircle(toScreen(tempStars[i]), 1, tempStars[i].paint);
            }

            //stampo le costellazioni
            //SI BUGGA SE METTEREMO LO ZOOM, CHIEDI AL PIETRO
            tempConstellations.drawAll(canvas);

            //stampo i punti di riferimento (sud, nord, equatore)
            for (int i = 0; i < tempPoints.Count; i++)
            {
                if (tempPoints[i].name.Equals("NORTHPOLE"))
                {
                    canvas.DrawCircle(toScreen(tempPoints[i]), 60, uselessPaint);
                }
                else if (tempPoints[i].name.Equals("SOUTHPOLE"))
                {
                    canvas.DrawCircle(toScreen(tempPoints[i]), 60, uselessPaint);
                }
                else
                {
                    canvas.DrawCircle(toScreen(tempPoints[i]), 4, uselessPaint);
                }
            }

            /*canvas.DrawCircle(toScreen(new Planet("SOUTHPOLE", 0, -90, 10, new SKColor(255, 255, 255))), 60, uselessPaint);
             * canvas.DrawCircle(toScreen(new Planet("NORTHPOLE", 0, 90, 10, new SKColor(127, 127, 127))), 60, uselessPaint);
             * for (float i = 0; i <= 360; i = i + 0.2f)
             *  canvas.DrawCircle(toScreen(new Planet("EQUATOR", i, 0, 3, new SKColor(0, 127, 127))), 5, uselessPaint);*/

            //stampo i pianeti
            for (int i = 0; i < tempPlanets.Count; i++)
            {
                if (tempPlanets[i].name == observer)  //non stampo la terra o il sole in base dal punto di vista
                {
                    continue;
                }

                SKPoint tempPoint = toScreen(tempPlanets[i]);
                //sposto le coordinate di stampa del pianeta in base alla dimensione con cui viene stampato (drawbitmap non disegna partendo dal centro)
                tempPoint.X -= (200 + tempPlanets[i].printSize * 15) / 2;
                tempPoint.Y -= (200 + tempPlanets[i].printSize * 15) / 2;

                if (theme.Equals("image"))              //disegno i pianeti come immagini stilizzate
                {
                    canvas.DrawBitmap(tempPlanets[i].texture, SKRect.Create(tempPoint, new SKSize(200 + tempPlanets[i].printSize * 15, 200 + tempPlanets[i].printSize * 15)), null);
                }
                else if (theme.Equals("imageHD"))            //disegno i pianeti come immagini reali
                {
                    canvas.DrawBitmap(tempPlanets[i].textureHD, SKRect.Create(tempPoint, new SKSize(200 + tempPlanets[i].printSize * 15, 200 + tempPlanets[i].printSize * 15)), null);
                }
            }
        }