mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
position technical data to positive negative value
This commit is contained in:
@@ -31,6 +31,7 @@ use Alchemy\Phrasea\Model\Entities\User;
|
||||
use Alchemy\Phrasea\Model\RecordInterface;
|
||||
use Alchemy\Phrasea\Model\Serializer\CaptionSerializer;
|
||||
use Alchemy\Phrasea\Record\RecordReference;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator\GpsPosition;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||
use Doctrine\DBAL\Connection;
|
||||
@@ -749,6 +750,40 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
return $this->technical_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array containing GPSPosition
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
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();
|
||||
|
||||
foreach($positionTechnicalField as $field){
|
||||
$fieldData = $this->get_technical_infos($field);
|
||||
|
||||
if($fieldData){
|
||||
$position->set($field, $fieldData->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if($position->isComplete()){
|
||||
return [
|
||||
'isCoordComplete' => 1,
|
||||
'latitude' => $position->getSignedLatitude(),
|
||||
'longitude' => $position->getSignedLongitude()
|
||||
];
|
||||
}
|
||||
|
||||
return ['isCoordComplete' => 0, 'latitude' => 0, 'longitude' => 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TechnicalDataSet $dataSet
|
||||
* @internal
|
||||
|
@@ -435,6 +435,12 @@
|
||||
{
|
||||
id: {{ record.get_record_id }},
|
||||
type: "{{ record.get_type() }}",
|
||||
{% set position = record.getPositionFromTechnicalInfos %}
|
||||
technicalInfo: {
|
||||
isCoordComplete: {{ position.isCoordComplete }},
|
||||
latitude: {{ position.latitude }},
|
||||
longitude: {{ position.longitude }}
|
||||
},
|
||||
{% if record.get_type() == 'video' %}
|
||||
{% set outputFormats = record.getSubdfefByDeviceAndMime(null, ['image/jpeg', 'image/png']) %}
|
||||
{% set previewHtml5 = record.getSubdfefByDeviceAndMime(constant('\\databox_subdef::DEVICE_SCREEN'), ['video/ogg', 'video/mp4', 'video/webm']) %}
|
||||
|
Reference in New Issue
Block a user