Exemplo n.º 1
0
        void UpdateHomeXY()
        {
            if (mapa == null)
            {
                mapa = lista.GetBest(new PuntoF((float)center.Longitude, (float)center.Latitude));
            }
            if (center != null && mapa != null)
            {
                PuntoF centroControl = new PuntoF(this.Width, this.Height) / 2;
                PuntoF centroGPS     = mapa.InterpolaLonLat((float)center.Longitude, (float)center.Latitude);
                PuntoF resta         = centroControl - centroGPS;
                if (resta.x > 0)
                {
                    resta.x = 0;
                }
                if (resta.y > 0)
                {
                    resta.y = 0;
                }
                if (resta.x < this.Width - mapa.img.Width)
                {
                    resta.x = this.Width - mapa.img.Width;
                }
                if (resta.y < this.Height - mapa.img.Height)
                {
                    resta.y = this.Height - mapa.img.Height;
                }

                homeXY = resta;
            }
            else
            {
                homeXY = new PuntoF(0, 0);
            }
        }
Exemplo n.º 2
0
        void UpdateHomeXY()
        {
            if (mapa == null)
            {
                mapa = lista.GetBest(new PuntoF((float)center.Longitude, (float)center.Latitude));
            }
            if (center != null && mapa != null)
            {
                PuntoF centroControl = new PuntoF(this.Width, this.Height) / 2;
                PuntoF centroGPS = mapa.InterpolaLonLat((float)center.Longitude, (float)center.Latitude);
                PuntoF resta = centroControl - centroGPS;
                if (resta.x > 0)
                    resta.x = 0;
                if (resta.y > 0)
                    resta.y = 0;
                if (resta.x < this.Width - mapa.img.Width)
                    resta.x = this.Width - mapa.img.Width;
                if (resta.y < this.Height - mapa.img.Height)
                    resta.y = this.Height - mapa.img.Height;

                homeXY = resta;
            }
            else
            {
                homeXY = new PuntoF(0, 0);
            }
        }
Exemplo n.º 3
0
        public MapaCalibrado GetBest(PuntoF pos)
        {
            MapaCalibrado best = lista[0];
            float         dist = (best.CentroLonLat() - pos).mod();

            foreach (MapaCalibrado mapa in lista)
            {
                float f = (mapa.CentroLonLat() - pos).mod();
                if (f < dist)
                {
                    dist = f;
                    best = mapa;
                }
            }
            return(best);
        }
Exemplo n.º 4
0
        void UpdateHomeXY(int Width, int Height)
        {
            mapa = lista.GetBest(new PuntoF((float)tmpCenter.Longitude, (float)tmpCenter.Latitude));

            if (tmpCenter != null && mapa != null)
            {
                PuntoF centroControl = new PuntoF(Width, Height) / 2;
                PuntoF centroGPS     = mapa.InterpolaLonLat((float)tmpCenter.Longitude, (float)tmpCenter.Latitude);
                PuntoF resta         = centroControl - centroGPS;
                /* */
                if (resta.x > 0)
                {
                    resta.x = 0;
                }
                if (resta.y > 0)
                {
                    resta.y = 0;
                }
                if (resta.x < Width - mapa.img.Width)
                {
                    resta.x = Width - mapa.img.Width;
                }
                if (resta.y < Height - mapa.img.Height)
                {
                    resta.y = Height - mapa.img.Height;
                }
                /* */
                centroGPS = centroControl - resta;
                PuntoF tmp = mapa.InterpolaXY(centroGPS.x, centroGPS.y);
                center = new WayPoint("", tmp.x, tmp.y);

                homeXY = resta;
            }
            else
            {
                homeXY = new PuntoF(0, 0);
            }
        }
Exemplo n.º 5
0
 public void SetMapaCalibrado(MapaCalibrado map)
 {
     mapa = map;
 }
Exemplo n.º 6
0
 public void LoadOziexplorer(string Filename)
 {
     mapa = new MapaCalibrado(Filename);
 }
Exemplo n.º 7
0
 public void SetMapaCalibrado(MapaCalibrado map)
 {
     mapa = map;
 }
Exemplo n.º 8
0
 public void LoadOziexplorer(string Filename)
 {
     mapa = new MapaCalibrado(Filename);
 }
Exemplo n.º 9
0
 public void SetCenter(WayPoint wpt)
 {
     this.tmpCenter = wpt;
     mapa = lista.GetBest(new PuntoF((float)tmpCenter.Longitude, (float)tmpCenter.Latitude));
 }
Exemplo n.º 10
0
 void UpdateHomeXY(int Width, int Height)
 {
     mapa = lista.GetBest(new PuntoF((float)tmpCenter.Longitude, (float)tmpCenter.Latitude));
 
     if (tmpCenter != null && mapa != null)
     {
         PuntoF centroControl = new PuntoF(Width, Height) / 2;
         PuntoF centroGPS = mapa.InterpolaLonLat((float)tmpCenter.Longitude, (float)tmpCenter.Latitude);
         PuntoF resta = centroControl - centroGPS;
         /* */
         if (resta.x > 0)
             resta.x = 0;
         if (resta.y > 0)
             resta.y = 0;
         if (resta.x < Width - mapa.img.Width)
             resta.x = Width - mapa.img.Width;
         if (resta.y < Height - mapa.img.Height)
             resta.y = Height - mapa.img.Height;
         /* */
         centroGPS = centroControl - resta;
         PuntoF tmp= mapa.InterpolaXY(centroGPS.x, centroGPS.y);
         center = new WayPoint("", tmp.x, tmp.y);
         
         homeXY = resta;
     }
     else
     {
         homeXY = new PuntoF(0, 0);
     }
 }
Exemplo n.º 11
0
 public void SetCenter(WayPoint wpt)
 {
     this.tmpCenter = wpt;
     mapa           = lista.GetBest(new PuntoF((float)tmpCenter.Longitude, (float)tmpCenter.Latitude));
 }