Esempio n. 1
0
 /**
  * Get varga data.
  * 
  * @return array
  */
 public function getVargaData()
 {
     $this->checkData();
     if ($this->vargaKey == Varga::KEY_D1) {
         return $this->getData(\Jyotish\Base\Data::listBlock('main'));
     }
     $bhava1Varga = $this->getVargaRashi($this->getData()['bhava'][1]);
     foreach ($this->getData()['bhava'] as $k => $v) {
         $rashi = $k == 1 ? $bhava1Varga['rashi'] : Math::numberNext($rashi);
         $vargaData['bhava'][$k] = ['rashi' => $rashi, 'degree' => $bhava1Varga['degree'], 'longitude' => 30 * ($rashi - 1) + $bhava1Varga['degree']];
     }
     foreach ($this->getData()['graha'] as $k => $v) {
         $result = $this->getVargaRashi($v);
         $vargaData['graha'][$k] = ['rashi' => $result['rashi'], 'degree' => $result['degree'], 'speed' => $this->getData()['graha'][$k]['speed'], 'longitude' => 30 * ($result['rashi'] - 1) + $result['degree'], 'latitude' => $v['latitude']];
     }
     foreach ($this->getData()['lagna'] as $k => $v) {
         $result = $this->getVargaRashi($v);
         $vargaData['lagna'][$k] = ['rashi' => $result['rashi'], 'degree' => $result['degree'], 'longitude' => 30 * ($result['rashi'] - 1) + $result['degree']];
     }
     return $vargaData;
 }
Esempio n. 2
0
 /**
  * Get environment.
  * 
  * @return array
  */
 public function getEnvironment()
 {
     return $this->Data->getData();
 }
Esempio n. 3
0
 /**
  * Returns new Data object from import data.
  * 
  * @param ImportInterface $Source
  * @return Data
  */
 public static function createFromImport(ImportInterface $Source)
 {
     $importData = $Source->getImportData();
     $Data = new Data();
     foreach ($importData as $block => $importElements) {
         $Data->setDataBlock($block, $importData[$block]);
         if ($block == self::BLOCK_USER) {
             if (isset($importData[$block]['datetime'])) {
                 $TimeZone = isset($importData[$block]['timezone']) ? new DateTimeZone($importData[$block]['timezone']) : null;
                 $DateTime = new DateTime($importData[$block]['datetime'], $TimeZone);
                 $Data->setDateTime($DateTime);
             }
             if (isset($importData[$block]['longitude']) && isset($importData[$block]['latitude'])) {
                 $Locality = new Locality(['longitude' => $importData[$block]['longitude'], 'latitude' => $importData[$block]['latitude'], 'altitude' => isset($importData[$block]['altitude']) ? $importData[$block]['altitude'] : 0]);
                 $Data->setLocality($Locality);
             }
         }
     }
     return $Data;
 }
Esempio n. 4
0
 /**
  * Check data.
  * 
  * @param null|string $function Function name
  * @return void
  */
 private function checkData($function = null)
 {
     if (!isset($this->getData()['graha'])) {
         $this->Data->calcParams();
     }
 }