Difference between revisions of "Truxton location set label"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This sets the label of the location. =Syntax= <source lang="C"> void truxton_location_set_label( uint64_t location_handle, char const * lablel ); </source> =Parameters= ==<c...")
 
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
=Syntax=
 
=Syntax=
 
<source lang="C">
 
<source lang="C">
void truxton_location_set_label( uint64_t location_handle, char const * lablel );
+
void truxton_location_set_label( uint64_t location_handle, char const * label );
 
</source>
 
</source>
  
Line 16: Line 16:
 
=Sample=
 
=Sample=
 
<source lang="C" highlight="18">
 
<source lang="C" highlight="18">
void new_location(uint64_t truxton, uint64_t file, double latitude, double longitude, double altitude, uint64_t when)
+
void new_location( uint64_t truxton, uint64_t file, double latitude, double longitude, double altitude, uint64_t when )
 
{
 
{
 
   char guid_string[ 40 ];
 
   char guid_string[ 40 ];
  
   uint64_t location = truxton_location_create(truxton);
+
   uint64_t location = truxton_location_create( truxton );
  
 
   truxton_file_get_id( file, guid_string, sizeof( guid_string ) );
 
   truxton_file_get_id( file, guid_string, sizeof( guid_string ) );
Line 45: Line 45:
 
   }
 
   }
  
   truxton_location_destroy(location);
+
   truxton_location_destroy( location );
 
}
 
}
 
</source>
 
</source>

Latest revision as of 17:20, 16 February 2021

This sets the label of the location.

Syntax

void truxton_location_set_label( uint64_t location_handle, char const * label );

Parameters

location_handle

This handle comes from calling truxton_location_create() or truxton_child_file_create_location().

label

A short string to identify the location to a human. It corresponds to the [Label] column of the [Location] table.

Sample

void new_location( uint64_t truxton, uint64_t file, double latitude, double longitude, double altitude, uint64_t when )
{
   char guid_string[ 40 ];

   uint64_t location = truxton_location_create( truxton );

   truxton_file_get_id( file, guid_string, sizeof( guid_string ) );
   truxton_location_set_file_id( location, guid_string );

   truxton_file_get_media_id( file, guid_string, sizeof( guid_string ) );
   truxton_location_set_media_id( location, guid_string );

   truxton_location_set_latitude( location, latitude );
   truxton_location_set_longitude( location, longitude );
   truxton_location_set_altitude( location, altitude );
   truxton_location_set_when( location, when );
   truxton_location_set_type( location, LOCATION_TYPE_EXIF );
   truxton_location_set_label( location, "Crash site" );

   if ( truxton_location_save() == 0 )
   {
      printf( "Failed to create new location\n" );
   }
   else
   {
      truxton_location_get_id( location, guid_string, sizeof( guid_string ) );
      printf( "Created new location as id %s\n", guid_string );
   }

   truxton_location_destroy( location );
}