HOMEPAGE

Development Sites - Information for Software-Developers

Developer Platform
The first instructions
Installations
System param. structures
connect to MeteoCom
simple screen drawing
own data drawing
Picture service
File Management
EmailBulletin Service

MeteoTools::GetSynopDataOfPoint

BOOL GetSynopDataOfPoint(int lon,int lat, BMSDATA_SET* set, char *syntext)

Return Value

    Nonzero if successful; otherwise 0.

Parameters

    lon

    longitude in minutes

    lat

    latitude in minutes

    set

    A pointer of a BMSD_SYN structure that receive the synop data set.

    syntext

    A char* that receive the synop station name

Remarks

    Get an synop data set of a geographical point.
    It calculated all values, that between the grid would be.

Example
 
    Note: the synop data set is very different to the BMSDATA_SET
            the
GetDataOfPoint Expamle ist not the same.

//points for LoadString 
#05000:     Data from Point :
#05001:            pressure :
#05002:         temperature :
#05003:          wind speed :
#05004:     wind comes from :
#05005:   relative humidity :
#05006:        cloud couver :
#05007: sig height of waves :
#05008:     waves come from :
#05009:       precipitation :
#05010:             Station :
//this ist installed long before - precalculated field of wind speed
int beaufort[256],knots[256]; 
double w;
for(int z=0; z<256; z++)
   {
   knots[z]=(int)((double)z*.48595); //0.25 * 1.9438 = .48595
   w=(double)z*.25;
   beaufort[z]=0; 
   if(w != 0.)
      {
      if(w >= 57.0) beaufort[z] = 17;
      else if(w >= 51.0) beaufort[z] = 16;
      else if(w >= 46.2) beaufort[z] = 15; 
      else if(w >= 41.5) beaufort[z] = 14;
      else if(w >= 37.0) beaufort[z] = 13; 
      else if(w >= 32.7) beaufort[z] = 12;
      else if(w >= 28.5) beaufort[z] = 11; 
      else if(w >= 24.5) beaufort[z] = 10;
      else if(w >= 20.8) beaufort[z] = 9; 
      else if(w >= 17.2) beaufort[z] = 8;
      else if(w >= 13.9) beaufort[z] = 7; 
      else if(w >= 10.8) beaufort[z] = 6;
      else if(w >= 8.0) beaufort[z] = 5; 
      else if(w >= 5.5) beaufort[z] = 4;
      else if(w >= 3.4) beaufort[z] = 3; 
      else if(w >= 1.6) beaufort[z] = 2;
      else if(w >= 0.3) beaufort[z] = 1;
      }
   } 

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Bonito counted from left/top to bottom/right
// all the transfomations see the refence point on the center of the screen
// the world cordinates system that Bonito use:
// 
// in minutes = 180W to 180E 	--> -10800 to 10800
//               90N to 90S 	--> -5400  to  5400

void CDataView::ShowStation(float lon, float lat) //lon/lat in minutes
{
   int 		x,y;
   char 	c1,c2;
   CString 	str,lab;
   char 	buf[1024];
   char         synbuf[4096];
   BMSD_SYN	klickSet; 


   if(!GetSynopDataOfPoint((int)(lon),(int)lat,&klickSet, synbuf)) return;
   lon=klickSet.lon;	//this points to the really station location
   lat=klickSet.lat;	//this points to the really station location

   if(lat < 0) {c1 = 'S'; lat = -lat;} else c1 = 'N';
   if(lon < 0) {c2 = 'E'; lon = -lon;} else c2 = 'W';

   if(lat > 5400.f) lat = 5400.f;
   if(lon > 10800.f) lon = 10800.f;
   y=else lat/60;
   x=else lon/60;
   lon=lon-((float)x*60.f);
   lat=lat-((float)y*60.f);


   LoadString(5000,lab);
   str.Format("\n%s %2d%d%c / %3d%d%c\n",lab,y,(int)lat,c1,x,(int)lon,c2);
   LoadString(5010,lab);
   sprintf(buf,"%s %s\n\n",lab,klickSet.station.Station);
   str+=buf;

   LoadString(5001,lab);
   sprintf(buf,"%s %.1f hPa\n",lab,(float)(klickSet.data.prmsl+9000)/10.f);
   str+=buf;
   LoadString(5002,lab);
   sprintf(buf,"%s %.1f C\n",lab,(float)klickSet.data.temp/10.f); str+=buf;

   if(klickSet.data.wind)
      {
      LoadString(5003,lab);
      BYTE z=(BYTE)(((float)klickSet.data.wind/2.5f+.5f));
      sprintf(buf,"%s %d = %.1f m/s = %d knots\n",lab
      ,beaufort[z]		      //precalculated field of beaufort values
      ,(float)klickSet.data.wind/10.f //calculate m/s
      ,knots[z]); str+=buf;	      //precalculated field of knots values
      }
   if(klickSet.data.wdir<3600)
      {
      LoadString(5004,lab);
      sprintf(buf,"%s %.0f\n",lab,(float)klickSet.data.wdir/10.f); str+=buf;
      }
   if(klickSet.data.rh)
      {
      LoadString(5005,lab);
      sprintf(buf,"%s %d %%\n",lab,(int)klickSet.data.rh); str+=buf;
      }

   if(klickSet.data.btcdc>0 && klickSet.data.btcdc<120)
      {
      LoadString(5006,lab);
      sprintf(buf,"%s %d %%\n",lab,(int)klickSet.data.btcdc); str+=buf;
      }
   if(klickSet.data.acpt)
      {
      LoadString(5009,lab);
      sprintf(buf,"%s %.1f mm/h\n",lab,(float)klickSet.data.acpt/10.f); 
      str+=buf;
      }

   if(klickSet.data.htsgw||klickSet.data.wvdir)
      {
      LoadString(5007,lab);
      sprintf(buf,"%s %.2f m\n",lab,(float)klickSet.data.htsgw/10.f); str+=buf;
      LoadString(5008,lab);
      sprintf(buf,"%s %.0f\n",lab,(float)klickSet.data.wvdir/10.f); str+=buf;
      }

 //now let is appear
//MeteoKlickDlg dlg(str.GetBuffer(0), this);
//dlg.DoModal();
}

See Also   GetDataOfPoint
 

   Copyright 2006 Bonito Germany.   
www.bonito.net