Ignore:
Timestamp:
Feb 23, 2013, 5:48:30 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Vylepšení zobrazení stavu meteostanice.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/temp/meteo/load_meteo.php

    r487 r488  
    2424        'AbsHumidity' => 4.6,
    2525        'DewPoint' => 0.4,
     26        'Time' => time(),
    2627    );
    2728    $this->Data = $Data;
     
    4344      'RelHumidity' => trim($XmlData->relhumidity),
    4445      'AbsHumidity' => trim($XmlData->abshumidity),
    45       'DewPoint' => trim($XmlData->dewpoint)
     46      'DewPoint' => trim($XmlData->dewpoint),
     47      'Time' => time(),
    4648    );
    4749    $this->Data = $Data;
     
    5052  function SaveDataToDb()
    5153  {
    52      $this->Database->insert('MeteoStationMeasure', array(
    53      'Time' => TimeToMysqlDateTime(time()), 'MeteoStation' => $this->Data['MeteoStation'],
    54         'WindSpeed' => $this->Data['WindSpeed'], 'WindDir' => $this->Data['WindDir'],
    55         'WindGust' => $this->Data['WindGust'], 'Pressure' => $this->Data['Pressure'],
    56         'SysTemp' => $this->Data['SysTemp'], 'Temperature' => $this->Data['Temperature'],
    57         'BarAltitude' => $this->Data['BarAltitude'], 'WindChill' => $this->Data['WindChill'],
    58         'RelHumidity' => $this->Data['RelHumidity'], 'AbsHumidity' => $this->Data['AbsHumidity'],
    59         'DewPoint' => $this->Data['DewPoint']));
     54    $this->Database->insert('MeteoStationMeasure', array(
     55      'Time' => TimeToMysqlDateTime(time()), 'MeteoStation' => $this->Data['MeteoStation'],
     56      'WindSpeed' => $this->Data['WindSpeed'], 'WindDir' => $this->Data['WindDir'],
     57      'WindGust' => $this->Data['WindGust'], 'Pressure' => $this->Data['Pressure'],
     58      'SysTemp' => $this->Data['SysTemp'], 'Temperature' => $this->Data['Temperature'],
     59      'BarAltitude' => $this->Data['BarAltitude'], 'WindChill' => $this->Data['WindChill'],
     60      'RelHumidity' => $this->Data['RelHumidity'], 'AbsHumidity' => $this->Data['AbsHumidity'],
     61      'DewPoint' => $this->Data['DewPoint']));
    6062  }
    6163 
     
    7375    $Image->Line(0, $Height - 1, $Width - 1, $Height - 1);
    7476    $Image->Line(0, 0, $Width - 1, 0);
     77    $Image->Line(0, 16, $Width - 1, 16);
    7578    $Image->Font->Color = COLOR_BLACK;
    76     $Text = 'Meteostanice';
    77     $Image->TextOut(10 + ($Width - $Image->TextWidth($Text)), 10, $Text);
    78     $Image->TextOut(10, 30, $this->Name);
    79     $Image->TextOut(10, 50, 'Teplota: '.$this->Data['Temperature'].' °C');
    80     $Image->TextOut(10, 50, 'Pocitová: '.$this->Data['Temperature'].' °C');
    81     $Image->TextOut(10, 70, 'Tlak: '.$this->Data['Pressure'].' hPa');
     79    $Image->TextOut(($Width - $Image->TextWidth($this->Name)) / 2, 13, $this->Name);
     80    $Image->Font->Size = 30;
     81    $Text = $this->Data['Temperature'].'°C';
     82    $Image->TextOut(($Width - $Image->TextWidth($Text)) / 2, 56, $Text);
     83    $Image->Font->Size = 10;
     84    $Text = 'Pocitová: '.$this->Data['Temperature'].' °C';
     85    $Image->TextOut(($Width - $Image->TextWidth($Text)) / 2, $Height - 70, $Text);
     86    $Text = 'Rel. vlhkost: '.$this->Data['RelHumidity'].' %';
     87    $Image->TextOut(($Width - $Image->TextWidth($Text)) / 2, $Height - 54, $Text);
     88    $Text = 'Tlak: '.$this->Data['Pressure'].' hPa';
     89    $Image->TextOut(($Width - $Image->TextWidth($Text)) / 2, $Height - 38, $Text);
     90    $Text = 'Vítr: '.$this->Data['WindSpeed'].' m/s';
     91    $Image->TextOut(($Width - $Image->TextWidth($Text)) / 2, $Height - 22, $Text);
     92    $Text = date("d.m.Y H:i:s", $this->Data['Time']);
     93    $Image->TextOut(($Width - $Image->TextWidth($Text)) / 2, $Height - 6, $Text);
    8294    $Image->SaveToFile($FileName);
    8395  }
     
    96108$Meteo->URL = 'http://meteo-koliba.zdechov.net/status.xml';
    97109$Meteo->Name = 'Koliba Zděchov';
    98 $Meteo->LoadTestData();
    99 //$Meteo->DownloadData();
     110//$Meteo->LoadTestData();
     111$Meteo->DownloadData();
    100112$Meteo->CreateImage('koliba.png');
    101113
Note: See TracChangeset for help on using the changeset viewer.