delphi4arab منتديات دلفي للعرب
حالة الطقس ب دلفي api & json - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : مصادر دلفي مفتوحة تعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=14)
+--- الموضوع : حالة الطقس ب دلفي api & json (/showthread.php?tid=6026)



حالة الطقس ب دلفي api & json - onexite - 17-03-2014

السلام عليكم
برنامج مفتوح المصدر يحتوي على حالة الطقس ووقت الغروب والشروق ...
يمكنكم استخدام الاحداثيات او اسم المدينة لايجاد المعلومات بالاضافة الى مفتاح وللحصول عليه اضغط هنا
مثلا
PHP كود :
q/37.336500,7.183000.json
او
q
/Batna.json 

[صورة: z5n9.png]

لعشرة ايام

[صورة: z55v.png]

الكود سورس

PHP كود :
uses
IdHTTP
,GIFImage,superobject, 
PHP كود :
procedure TForm1.loadgif(http: string;img:TImage);
var   
ms : TMemoryStream;
  
gif: TGIFImage;
begin
img
.Picture:=nil;
gif  := TGIFImage.Create;
ms := TMemoryStream.Create;
       try
       try
    
idhttp1.Get(http,ms);
   
///MS.Seek(0,soFromBeginning);
    
ms.Position:=0;
    
gif.LoadFromStream(ms);
    
img.Picture.Assign(gif);
    
except 
      end
;
      finally 
      
gif.Free;
      
ms.Free;
end;
end;

procedure TForm1.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  
AWorkCount: Int64);
begin
Application
.ProcessMessages;
sgauge1.Progress:=AWorkCount;
end;

procedure TForm1.IdHTTP1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
  
AWorkCountMax: Int64);
begin
sgauge1
.MaxValue:=AWorkCountMax;
end;

procedure TForm1.IdHTTP1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
begin
sgauge1
.Progress:=0;
end;

procedure TForm1.FormShow(Sender: TObject);
var 
conditions,astronomy:string;

begin
  
try
conditions:=idhttp1.Get('http://api.wunderground.com/api/a08dd34c67819ee0/conditions/q/Batna.json');//&ip='+edt1.Text);
astronomy:= idhttp1.Get('http://api.wunderground.com/api/a08dd34c67819ee0/astronomy/q/Batna.json');

except
sLabelFX1
.Caption:=('Temperature :  0 C');
sLabelFX3.Caption:=('Station : Not Connected');
  
end;
if 
Length(conditions)=0 then Exit;
sLabelFX1.Caption:=('Temperature : '+so(conditions)['current_observation']['temperature_string'].AsString) ;
sLabelFX2.Caption:=('Location : '+so(conditions)['current_observation']['display_location']['full'].AsString) ;
sLabelFX3.Caption:=('Station : '+so(conditions)['current_observation']['icon'].AsString) ;
sLabelFX7.Caption:=(so(conditions)['current_observation']['temp_c'].AsString+' C') ;
sLabelFX4.Caption:=('Weather : '+so(conditions)['current_observation']['weather'].AsString) ;
sLabelFX5.Caption:=('Relative Humidity : '+so(conditions)['current_observation']['relative_humidity'].AsString) ;
sLabelFX6.Caption:='Elevation : '+Format('%.6s',[(so(conditions)['current_observation']['display_location']['elevation'].AsString)]) ;
loadgif(so(conditions)['current_observation']['icon_url'].AsString,img1) ;
if 
Length(astronomy)=0 then Exit;
 
sLabelFX8.Caption:=(so(astronomy)['sun_phase']['sunrise']['hour'].AsString+':'+
 
so(astronomy)['sun_phase']['sunrise']['minute'].AsString) ;
 
sLabelFX9.Caption:=(so(astronomy)['sun_phase']['sunset']['hour'].AsString+':'+
 
so(astronomy)['sun_phase']['sunset']['minute'].AsString) ;

end;

procedure TForm1.sSpeedButton1Click(Sender: TObject);
var 
forecast10day:string;
i:Byte;
begin
  
try
  
forecast10day:=idhttp1.Get('http://api.wunderground.com/api/a08dd34c67819ee0/forecast10day/q/Batna.json');
 if 
Length(forecast10day)=0 then Exit;
 for 
i:=0 to 19 do
   
with form2.sListView1.Items.Add do begin
    Caption
:=so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].title'].AsString ;
        
SubItems.Add(so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].fcttext'].AsString) ;
        
SubItems.Add(so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].icon'].AsString) ;
        
SubItems.Add(so(forecast10day)['forecast']['txt_forecast']['forecastday['+inttostr(i)+'].fcttext_metric'].AsString) ;

                                
end;
                                
except
                                  end
;

form2.show;
end; 



حالة الطقس ب دلفي api & json - karika2 - 18-03-2014

شكراّ ..أخى الكريم على هذا الطرح العظيم...!!!


حالة الطقس ب دلفي api & json - TheGame - 11-08-2014

ها هو البرنامج ^_^ برمجته ليشبهه كثيراا
المرجو التوفر على مكونات AlphaControl (AlphaSkins)
ادا لم تكن تتوفر عليها حملها من alphaskins.com


حالة الطقس ب دلفي api & json - onexite - 26-10-2014

TheGame كتب :ها هو البرنامج ^_^ برمجته ليشبهه كثيراا
المرجو التوفر على مكونات AlphaControl (AlphaSkins)
ادا لم تكن تتوفر عليها حملها من alphaskins.com
لا اعلم كيف تفكر لاكن استخدمت الكود الذي برمجته ووضعت عليه اسمك ؟؟؟
'Ess-Soft © 2014 │ ess-soft.net';


حالة الطقس ب دلفي api & json - TheGame - 30-10-2014

أستسمح يا أخي لكنني فقط كتبت دلك لكنني لم أنشر البرنامج في مكان أخر غير هدا المنتدى و الكل يعرف أنك صاحب البرنامج الاصلي و أستسمح تانية كانت نيتي هي أن احاول صنع مثله لاجل الاعضاء الذين لم يتمكنو من عمل compile وليس أن أقول انني صاحب الكود الاصلي و شكرا لتفهمك ان نيتي كانت الـمسـاعدة و ليس سرقة السورس.