Difference between revisions of "Truxton file create location"

From truxwiki.com
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
This creates a geographic location object sourced from this file that you can use in the [[Truxton C API#Geographic Location | Location API.]]
 
This creates a geographic location object sourced from this file that you can use in the [[Truxton C API#Geographic Location | Location API.]]
A location object is how you add records to the <code>[[Location Table | Location]]</code> table.
+
A location object is how you add records to the <code><nowiki>[</nowiki>[[Location Table|Location]]<nowiki>]</nowiki></code> table.
 
The resulting object will automatically be associated with the file it was created from and with the media the file belongs to.
 
The resulting object will automatically be associated with the file it was created from and with the media the file belongs to.
  
 
=Syntax=
 
=Syntax=
<syntaxhighlight lang="C">
+
<source lang="C">
 
uint64_t truxton_file_create_location( uint64_t file_handle );
 
uint64_t truxton_file_create_location( uint64_t file_handle );
</syntaxhighlight>
+
</source>
  
 
=Parameters=
 
=Parameters=
Line 16: Line 16:
  
 
=Sample=
 
=Sample=
 
+
<source lang="C" highlight="5">
<syntaxhighlight lang="C" highlight="5">
+
void process_file( uint64_t truxton )
void process_file(uint64_t truxton)
 
 
{
 
{
   uint64_t file = truxton_file_open_md5(truxton, "9ec8fb6095c35eff2b236863b7caaf10");
+
   uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" );
  
   uint64_t location = truxton_child_file_create_location(file);
+
   uint64_t location = truxton_child_file_create_location( file );
  
   truxton_location_set_latitude(location, 18.30305549975252);
+
   truxton_location_set_latitude( location, 18.30305549975252 );
   truxton_location_set_longitude(location, -64.824006192214);
+
   truxton_location_set_longitude( location, -64.824006192214 );
   truxton_location_set_altitude(location, 1.1);
+
   truxton_location_set_altitude( location, 1.1 );
   truxton_location_set_type(location, LOCATION_TYPE_GOPRO_VIDEO);
+
   truxton_location_set_type( location, LOCATION_TYPE_GOPRO_VIDEO );
   truxton_location_save(location);
+
   truxton_location_save( location );
   truxton_location_destroy(location);
+
   truxton_location_destroy( location );
  
   truxton_file_free(file);
+
   truxton_file_free( file );
 
}
 
}
</syntaxhighlight>
+
</source>

Latest revision as of 04:57, 13 February 2021

This creates a geographic location object sourced from this file that you can use in the Location API. A location object is how you add records to the [Location] table. The resulting object will automatically be associated with the file it was created from and with the media the file belongs to.

Syntax

uint64_t truxton_file_create_location( uint64_t file_handle );

Parameters

file_handle

The handle created by the truxton_file_open_id or truxton_file_open_md5 call.

Return value

A handle to an location object.

Sample

void process_file( uint64_t truxton )
{
   uint64_t file = truxton_file_open_md5( truxton, "9ec8fb6095c35eff2b236863b7caaf10" );

   uint64_t location = truxton_child_file_create_location( file );

   truxton_location_set_latitude( location, 18.30305549975252 );
   truxton_location_set_longitude( location, -64.824006192214 );
   truxton_location_set_altitude( location, 1.1 );
   truxton_location_set_type( location, LOCATION_TYPE_GOPRO_VIDEO );
   truxton_location_save( location );
   truxton_location_destroy( location );

   truxton_file_free( file );
}