Skip to content

Commit

Permalink
Component update
Browse files Browse the repository at this point in the history
  • Loading branch information
h-elsner authored Mar 11, 2021
1 parent 7c75d90 commit a656a8d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 34 deletions.
13 changes: 10 additions & 3 deletions source/exifstuff.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface
exHeadingRef='GPSImgDirectionRef'; {'M' = Magnetic North; 'T' = True North}
exHeading='GPSImgDirectionRef';

myVersion='0220'; {EXIF version if EXIF was newly created}
myVersion='0222'; {EXIF version if EXIF was newly created}

{Public functions and procedures}
function ReadTime(var RdData: TImgInfo; {TimeFormat defines time sting}
Expand Down Expand Up @@ -133,8 +133,15 @@ function ReadFloatAsString(var RdData: TImgInfo;
function ReadCoordinates(var RdData: TImgInfo; var nlat, nlon: double): boolean;
begin
result:=false;
nlat:=rdData.ExifData.GPSLatitude;
nlon:=rdData.ExifData.GPSLongitude;
try
nlat:=rdData.ExifData.GPSLatitude;
nlon:=rdData.ExifData.GPSLongitude;
except
on e: Exception do begin
nlat:=0;
nlon:=0;
end;
end;
result:=(nlat<>0) or (nLon<>0); {Valid coordinates}
end;

Expand Down
1 change: 1 addition & 0 deletions source/exifupd_bg.inc
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ resourcestring
capClip='Copy result to clipboard';
capResFile='Save result as file...';
capCancel='Cancel';
capUsage='Usage: alt.MSL = alt.WSG84 - GeoidEval.Result';


1 change: 1 addition & 0 deletions source/exifupd_en.inc
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,6 @@ resourcestring
capClip='Copy result to clipboard';
capResFile='Save result as file...';
capCancel='Cancel';
capUsage='Usage: alt.MSL = alt.WSG84 - GeoidEval.Result';


8 changes: 4 additions & 4 deletions source/exifupdate_main.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object Form1: TForm1
Position = poDefaultPosOnly
SessionProperties = 'cbAddText.Checked;cbBackup.Checked;cbEXIFwrite.Checked;cbJSON.Checked;cbKeepComment.Checked;cbLog.Checked;cbUpdateAlt.Checked;cbxLogs.ItemIndex;cbxLogs.Items;cbxLogs.Text;cbxPics.ItemIndex;cbxPics.Items;cbxPics.Text;edController.Text;Height;lbeGeoid.Text;Memo1.Height;Memo1.Lines;OpenDialog.FilterIndex;rgController.ItemIndex;tbDelta.Position;Width;WindowState;cbAutoGeoid.Checked;rgGravity.ItemIndex'
ShowHint = True
LCLVersion = '2.0.10.0'
LCLVersion = '2.0.12.0'
object Panel1: TPanel
Left = 0
Height = 88
Expand Down Expand Up @@ -133,10 +133,10 @@ object Form1: TForm1
Height = 466
Top = 88
Width = 884
ActivePage = tabSettings
ActivePage = tabMain
Align = alClient
Images = ImageList
TabIndex = 1
TabIndex = 0
TabOrder = 2
object tabMain: TTabSheet
Caption = 'tabMain'
Expand All @@ -145,7 +145,7 @@ object Form1: TForm1
ImageIndex = 8
object gridPictures: TStringGrid
Left = 0
Height = 394
Height = 374
Top = 64
Width = 876
Align = alClient
Expand Down
31 changes: 13 additions & 18 deletions source/exifupdate_main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ function GetNumFlight(s: string): string; {Filter flight number fro
begin
result:='';
gef:=false;
for i:=length(s) downto 1 do begin
for i:=s.length downto 1 do begin
if s[i] in ziff then begin
gef:=true;
result:=s[i]+result;
Expand Down Expand Up @@ -698,7 +698,7 @@ function GetXMPvalue(id, s: string): string; {Read data between > and
n:=pos('<xmp:'+id, s); {It must be a XMP tag}
if n>0 then begin
gef:=false;
for i:=n+length(id)+4 to length(s) do begin
for i:=n+id.length+4 to s.length do begin
if s[i]='<' then break;
if gef then
result:=result+s[i];
Expand All @@ -716,7 +716,7 @@ function GetDRYvalue(id, s: string): string; {Read data between > and
n:=pos('drone-yuneec:'+id, s); {It must be a yuneec tag}
if n>0 then begin
gef:=false;
for i:=n+length(id)+12 to length(s) do begin
for i:=n+id.length+12 to s.length do begin
if s[i]='<' then break;
if gef then
result:=result+s[i];
Expand Down Expand Up @@ -885,7 +885,7 @@ procedure TForm1.GetInetList(const url: string; var list: TStringList);
begin
list.Clear;
ct:='';
if length(url)>8 then begin
if url.length>8 then begin
try
if iproHTTPin.CheckURL(url, ct) then {Test the URL if connection is possible}
strm:=iproHTTPin.DoGetStream(url); {Download file to stream}
Expand Down Expand Up @@ -973,7 +973,7 @@ procedure TForm1.ScanPics; {Scan picture directory}
addtxt:=StringReplace(addtxt, '"', '''', [rfReplaceAll]);
jsonstr:=jsonstr+'"AdditionalText"'+dpID+ {JSON: Additional info from memo}
strID+addtxt+strID+sep+le;
if length(addtxt)>txtpart then
if addtxt.length>txtpart then
addtxt:=copy(addtxt, 1, txtpart)+'...'; {Shorten AddText for protocol table}
// addtxt:=addtxt.Split([' '])[0]+'...'; {Optional only the first word}
end;
Expand Down Expand Up @@ -1165,7 +1165,7 @@ procedure TForm1.ScanPics; {Scan picture directory}
end;
end;
p:=0;
for k:=1 to length(fn) do {Fill with empty columns}
for k:=1 to fn.length do {Fill with empty columns}
if fn[k]=sep then inc(p);
if p<11 then
for k:=p to 10 do
Expand Down Expand Up @@ -1426,38 +1426,33 @@ procedure TForm1.ScanPics; {Scan picture directory}
{List all picture files in info table}
gridPictures.Cells[1, i+1]:=FormatDateTime(timeformat, picdat.zeit);
gridPictures.Cells[2, i+1]:=ReadString(aImgInfo, exVersn, '0000');
try
if ReadCoordinates(aImgInfo, picdat.lat, picdat.lon) then
gridPictures.Cells[3, i+1]:='EXIF'; {Valid coordinates in EXIF}
except
picdat.lat:=0;
picdat.lon:=0;
end;
if ReadCoordinates(aImgInfo, picdat.lat, picdat.lon) then
gridPictures.Cells[3, i+1]:='EXIF'; {Valid coordinates in EXIF}
{Handle only Yuneec picture files}
if lowercase(ReadString(aImgInfo, exMake, ''))=makefilter then begin
picdat.telem:=FindDataLine(tlmlist, picdat.zeit, zl1);
if picdat.telem<>'' then begin {Found time match}
if picdat.telem<>'' then begin {Found time match}

{Read lat/lon from EXIF and from telemetry to compare}
splitlist.DelimitedText:=picdat.telem;
if not TryStrToFloat(splitlist[4], picdat.alt) or
(picdat.alt>maxalt) then {Read altitude from telemetry}
(picdat.alt>maxalt) then {Read altitude from telemetry}
picdat.alt:=defalt;
picdat.alt:=picdat.alt+geoalt;
if not TryStrToFloat(splitlist[5], lat) then
lat:=0;
if not TryStrToFloat(splitlist[6], lon) then
lon:=0;

TakePosFromTelemetry; {Missing coordinates in EXIF}
TakePosFromTelemetry; {Missing coordinates in EXIF}

{Handle matching pictures, edit and save it}
vari:=DeltaCoord(lat, lon, picdat.lat, picdat.lon);
if vari<=tbDelta.Max then {Show variance only if in allowed area}
if vari<=tbDelta.Max then {Show variance only if in allowed area}
gridPictures.Cells[4, i+1]:=FormatFloat(altfrm, vari*100);
if vari<=tbDelta.Position/100 then begin
gridPictures.Cells[6, i+1]:=AusgZeile(zl1);
inc(zhl); {Count matches}
inc(zhl); {Count matches}

outstr:=outstr+sep+le+'"CameraShoot"'+dpID+startID; {JSON: Picture start}
outstr:=outstr+le+'"SequenceNo"'+dpID+IntToStr(zhl); {JSON: Number of the file}
Expand Down
18 changes: 13 additions & 5 deletions source/geoideval1.lfm
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
object frmGeoidEval: TfrmGeoidEval
Left = 1224
Height = 195
Height = 214
Top = 735
Width = 440
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'GeoidEval'
ClientHeight = 195
ClientHeight = 214
ClientWidth = 440
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '2.0.10.0'
LCLVersion = '2.0.12.0'
object lblURL: TLabel
Left = 24
Left = 16
Height = 15
Top = 160
Top = 184
Width = 34
Caption = 'lblURL'
Font.Color = clNavy
Expand Down Expand Up @@ -200,6 +200,14 @@ object frmGeoidEval: TfrmGeoidEval
OnClick = btnObtainClick
TabOrder = 2
end
object lblUsage: TLabel
Left = 16
Height = 15
Top = 160
Width = 45
Caption = 'lblUsage'
ParentColor = False
end
object iproHTMLine: TIpHttpDataProvider
Left = 208
Top = 152
Expand Down
10 changes: 6 additions & 4 deletions source/geoideval1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TfrmGeoidEval = class(TForm)
btnCopy: TBitBtn;
btnClose: TBitBtn;
iproHTMLine: TIpHttpDataProvider;
lblUsage: TLabel;
leLat: TLabeledEdit;
leLon: TLabeledEdit;
lblURL: TLabel;
Expand Down Expand Up @@ -107,6 +108,7 @@ procedure TfrmGeoidEval.FormCreate(Sender: TObject); {Initialization at first
begin
Caption:=capCorrAlt;
lblURL.Caption:=urlGeoid;
lblUsage.Caption:=capUsage;
btnClose.Caption:=capCancel;
btnCopy.Caption:=capCopy;
btnObtain.Caption:=capObtain;
Expand Down Expand Up @@ -135,8 +137,8 @@ function FilterValue(s: string; p: integer=1): string; {Copy the first float str
begin
result:='';
dot:=true;
if length(s)>p then begin
for i:=p to length(s) do begin
if s.length>p then begin
for i:=p to s.length do begin
if (s[i] in ziff) or (s[i]='-') then {Collect digits}
result:=result+s[i];
if dot and {Take only first dot}
Expand All @@ -156,7 +158,7 @@ function FilterValue(s: string; p: integer=1): string; {Copy the first float str
function ExtractHeight(s: string): string; {Extract delta heigth from geoid}
begin
result:='';
if length(s)>100 then {Correction value is somewhere at the end of the line}
if s.length>100 then {Correction value is somewhere at the end of the line}
result:=FilterValue(s, 100);
end;

Expand All @@ -180,7 +182,7 @@ procedure TfrmGeoidEval.GetHTML(const url: string; var list: TStringList);
begin
list.Clear;
ct:='';
if length(url)>8 then begin
if url.length>8 then begin
try
if iproHTMLine.CheckURL(url, ct) then {Test the URL if connection is possible}
strm:=iproHTMLine.DoGetStream(url); {Download file to stream}
Expand Down

0 comments on commit a656a8d

Please sign in to comment.