Guest User

Untitled

a guest
Jul 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. procedure TstExifLE.ReadGPSTest;
  2.  
  3. var
  4. imgInfo: TImgInfo;
  5. lTag: TTag;
  6. begin
  7. imgInfo := TImgInfo.Create;
  8. try
  9. imgInfo.LoadFromFile(WorkFile_JpegWithExif);
  10.  
  11. lTag := imgInfo.ExifData.TagByName['GPSVersionID'];
  12. CheckTrue(lTag <> nil, 'Tag "GPSVersionID" not found');
  13. CheckTrue(lTag is TVersionTag, 'Tag "GPSVersionID" is not TVersionTag');
  14. TVersionTag(lTag).Separator := '.';
  15. CheckEquals('2.3.0.0', lTag.AsString, 'Value mismatch of tag "GPSVersionID"');
  16.  
  17. lTag := imgInfo.ExifData.TagByName['GPSLatitude'];
  18. CheckTrue(lTag <> nil, 'Tag "GPSLatitude" not found');
  19. CheckTrue(lTag is TGPSPositionTag, 'Tag "GPSLatitude" is not a TGpsPositionTag');
  20. TGpsPositionTag(lTag).FormatStr := '%0:.0f deg %1:.0f'' %2:.2f"';
  21. CheckEquals('51 deg 33'' 48.28"', lTag.AsString, 'Value mismatch of tag "GPSLatitude"');
  22.  
  23. lTag := imgInfo.ExifData.TagByName['GPSLatitudeRef'];
  24. CheckTrue(lTag <> nil, 'Tag "GPSLatitudeRef" not found');
  25. CheckEquals('South', lTag.AsString, 'Value mismatch of tag "GPSLatitudeRef"');
  26.  
  27. lTag := imgInfo.ExifData.TagByName['GPSLongitude'];
  28. CheckTrue(lTag <> nil, 'Tag "GPSLongitude" not found');
  29. CheckTrue(lTag is TGPSPositionTag, 'Tag "GPSLongitude" is not a TGpsPositionTag');
  30. TGpsPositionTag(lTag).FormatStr := '%0:.0f deg %1:.0f'' %2:.2f"';
  31. CheckEquals('59 deg 49'' 53.55"', lTag.AsString, 'Value mismatch of tag "GPSLongitude"');
  32.  
  33. lTag := imgInfo.ExifData.TagByName['GPSLongitudeRef'];
  34. CheckTrue(lTag <> nil, 'Tag "GPSLongitudeRef" not found');
  35. CheckEquals('West', lTag.AsString, 'Value mismatch of tag "GPSLongitudeRef"');
  36.  
  37. finally
  38. imgInfo.Free;
  39. end;
  40. end;
Add Comment
Please, Sign In to add comment