mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
use composite position
This commit is contained in:
@@ -81,6 +81,30 @@ class GpsPosition
|
||||
&& $this->latitude_ref !== null;
|
||||
}
|
||||
|
||||
public function isCompleteComposite()
|
||||
{
|
||||
return $this->longitude !== null
|
||||
&& $this->latitude !== null;
|
||||
}
|
||||
|
||||
public function getCompositeLongitude()
|
||||
{
|
||||
if ($this->longitude === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->longitude ;
|
||||
}
|
||||
|
||||
public function getCompositeLatitude()
|
||||
{
|
||||
if ($this->latitude === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->latitude;
|
||||
}
|
||||
|
||||
public function getSignedLongitude()
|
||||
{
|
||||
if ($this->longitude === null) {
|
||||
|
@@ -155,9 +155,9 @@ SQL;
|
||||
// Push this tag into object
|
||||
$position->set($tag_name, $value);
|
||||
// Try to output complete position
|
||||
if ($position->isComplete()) {
|
||||
$lon = $position->getSignedLongitude();
|
||||
$lat = $position->getSignedLatitude();
|
||||
if ($position->isCompleteComposite()) {
|
||||
$lon = $position->getCompositeLongitude();
|
||||
$lat = $position->getCompositeLatitude();
|
||||
|
||||
$records[$id]['metadata_tags']['Longitude'] = $lon;
|
||||
$records[$id]['metadata_tags']['Latitude'] = $lat;
|
||||
|
@@ -758,26 +758,24 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
public function getPositionFromTechnicalInfos()
|
||||
{
|
||||
$positionTechnicalField = [
|
||||
media_subdef::TC_DATA_LATITUDE_REF,
|
||||
media_subdef::TC_DATA_LATITUDE,
|
||||
media_subdef::TC_DATA_LONGITUDE_REF,
|
||||
media_subdef::TC_DATA_LONGITUDE
|
||||
];
|
||||
$position = new GpsPosition();
|
||||
$position = [];
|
||||
|
||||
foreach($positionTechnicalField as $field){
|
||||
$fieldData = $this->get_technical_infos($field);
|
||||
|
||||
if($fieldData){
|
||||
$position->set($field, $fieldData->getValue());
|
||||
$position[$field] = $fieldData->getValue();
|
||||
}
|
||||
}
|
||||
|
||||
if($position->isComplete()){
|
||||
if(count($position) == 2){
|
||||
return [
|
||||
'isCoordComplete' => 1,
|
||||
'latitude' => $position->getSignedLatitude(),
|
||||
'longitude' => $position->getSignedLongitude()
|
||||
'latitude' => $position[media_subdef::TC_DATA_LATITUDE],
|
||||
'longitude' => $position[media_subdef::TC_DATA_LONGITUDE]
|
||||
];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user