/** * Checks after location cache creation */ public function _on_created() { if (!$this->log && $this->relation == ORG_ROUTAMC_POSITIONING_RELATION_IN) { // This location entry is defined as being made in a location, // but is stored to object directly without corresponding log, // create one. // This situation can happen for example when importing images // that have EXIF geo tags set $object = $this->get_parent(); $log = new org_routamc_positioning_log(); $log->date = $this->date; // TODO: Use 1.8 metadata authors instead? $log->person = $object->metadata->creator; $log->latitude = $this->latitude; $log->longitude = $this->longitude; $log->altitude = $this->altitude; $log->importer = 'objectlocation'; // Usually the positions based on objects are manual, except in // case of GPS-equipped cameras etc. We still need to figure // out how to handle those. $log->accuracy = ORG_ROUTAMC_POSITIONING_ACCURACY_MANUAL; $log->create(); } }