Add Conversion from DDM to DD
Alire installation and checkup / build (ubuntu-20.04) (push) Failing after 10m30s
Alire installation and checkup / build (ubuntu-20.04) (push) Failing after 10m30s
This commit is contained in:
+23
-7
@@ -5,17 +5,33 @@ package body Grl.Coordinates is
|
|||||||
begin
|
begin
|
||||||
|
|
||||||
case DM_Base.Form is
|
case DM_Base.Form is
|
||||||
when Relative => null;
|
when Relative =>
|
||||||
when DD_Fine => null;
|
null;
|
||||||
when DD => DD_Target := DM_Base;
|
when DD_Fine =>
|
||||||
|
null;
|
||||||
|
when DD =>
|
||||||
|
DD_Target := DM_Base;
|
||||||
when DDM =>
|
when DDM =>
|
||||||
if DM_Base.DDM.Cardinal_Lat = North then
|
if DM_Base.DDM.Cardinal_Lat = North then
|
||||||
DD_Target.DD.Latitude :=
|
DD_Target.DD.Latitude :=
|
||||||
DD_Meter_Scale_Lat (DM_Base.DDM.Degree_Lat)
|
DD_Meter_Scale_Lat (DM_Base.DDM.Degree_Lat) +
|
||||||
+
|
DD_Meter_Scale_Lat (DM_Base.DDM.Minutes_Lat / 60.0);
|
||||||
DD_Meter_Scale_Lat (DM_Base.DDM.Minutes_Lat / 60.0);
|
else
|
||||||
|
DD_Target.DD.Latitude :=
|
||||||
|
-1.0 * DD_Meter_Scale_Lat (DM_Base.DDM.Degree_Lat) +
|
||||||
|
DD_Meter_Scale_Lat (DM_Base.DDM.Minutes_Lat / 60.0);
|
||||||
end if;
|
end if;
|
||||||
when DMS => null;
|
if DM_Base.DDM.Cardinal_Lon = East then
|
||||||
|
DD_Target.DD.Longitude :=
|
||||||
|
DD_Meter_Scale_Lon (DM_Base.DDM.Degree_Lon) +
|
||||||
|
DD_Meter_Scale_Lon (DM_Base.DDM.Minutes_Lon / 60.0);
|
||||||
|
else
|
||||||
|
DD_Target.DD.Longitude :=
|
||||||
|
-1.00 * DD_Meter_Scale_Lon (DM_Base.DDM.Degree_Lon) +
|
||||||
|
DD_Meter_Scale_Lon (DM_Base.DDM.Minutes_Lon / 60.0);
|
||||||
|
end if;
|
||||||
|
when DMS =>
|
||||||
|
null;
|
||||||
end case;
|
end case;
|
||||||
|
|
||||||
return DD_Target;
|
return DD_Target;
|
||||||
|
|||||||
+37
-40
@@ -1,5 +1,5 @@
|
|||||||
package Grl.Coordinates
|
package Grl.Coordinates with
|
||||||
with SPARK_Mode => On
|
SPARK_Mode => On
|
||||||
is
|
is
|
||||||
|
|
||||||
-- ------------ --
|
-- ------------ --
|
||||||
@@ -34,53 +34,51 @@ is
|
|||||||
|
|
||||||
-- Meter precision DD coordinates
|
-- Meter precision DD coordinates
|
||||||
type Format_DD is record
|
type Format_DD is record
|
||||||
Latitude : DD_Meter_Scale_Lat;
|
Latitude : DD_Meter_Scale_Lat;
|
||||||
Longitude : DD_Meter_Scale_Lon;
|
Longitude : DD_Meter_Scale_Lon;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
-- Centimeter precision DD coordinates
|
-- Centimeter precision DD coordinates
|
||||||
type Format_DD_Fine is record
|
type Format_DD_Fine is record
|
||||||
Latitude : DD_Centimeter_Scale_Lat;
|
Latitude : DD_Centimeter_Scale_Lat;
|
||||||
Longitude : DD_Centimeter_Scale_Lon;
|
Longitude : DD_Centimeter_Scale_Lon;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
-- DMS
|
-- DMS
|
||||||
type Format_DMS is record
|
type Format_DMS is record
|
||||||
Degree_Lat : DM_Degree_Lat;
|
Degree_Lat : DM_Degree_Lat;
|
||||||
Degree_Lon : DM_Degree_Lon;
|
Degree_Lon : DM_Degree_Lon;
|
||||||
Minutes_Lat : DM_Minutes;
|
Minutes_Lat : DM_Minutes;
|
||||||
Minutes_Lon : DM_Minutes;
|
Minutes_Lon : DM_Minutes;
|
||||||
Seconds_Lat : DM_Seconds;
|
Seconds_Lat : DM_Seconds;
|
||||||
Seconds_Lon : DM_Seconds;
|
Seconds_Lon : DM_Seconds;
|
||||||
Cardinal_Lat : Cardinal;
|
Cardinal_Lat : Cardinal;
|
||||||
Cardinal_Lon : Cardinal;
|
Cardinal_Lon : Cardinal;
|
||||||
end record
|
end record with
|
||||||
with Dynamic_Predicate =>
|
Dynamic_Predicate =>
|
||||||
Format_DMS.Cardinal_Lat in North | South
|
Format_DMS.Cardinal_Lat in North | South
|
||||||
and then
|
and then Format_DMS.Cardinal_Lon in East | West;
|
||||||
Format_DMS.Cardinal_Lon in East | West;
|
|
||||||
|
|
||||||
-- DDM
|
-- DDM
|
||||||
type Format_DDM is record
|
type Format_DDM is record
|
||||||
Degree_Lat : DM_Degree_Lat;
|
Degree_Lat : DM_Degree_Lat;
|
||||||
Degree_Lon : DM_Degree_Lon;
|
Degree_Lon : DM_Degree_Lon;
|
||||||
Minutes_Lat : DDM_Minutes;
|
Minutes_Lat : DDM_Minutes;
|
||||||
Minutes_Lon : DDM_Minutes;
|
Minutes_Lon : DDM_Minutes;
|
||||||
Cardinal_Lat : Cardinal;
|
Cardinal_Lat : Cardinal;
|
||||||
Cardinal_Lon : Cardinal;
|
Cardinal_Lon : Cardinal;
|
||||||
end record
|
end record with
|
||||||
with Dynamic_Predicate =>
|
Dynamic_Predicate =>
|
||||||
Format_DDM.Cardinal_Lat in North | South
|
Format_DDM.Cardinal_Lat in North | South
|
||||||
and then
|
and then Format_DDM.Cardinal_Lon in East | West;
|
||||||
Format_DDM.Cardinal_Lon in East | West;
|
|
||||||
|
|
||||||
-- -------------------------- --
|
-- -------------------------- --
|
||||||
-- Coordinate Type Definition --
|
-- Coordinate Type Definition --
|
||||||
-- -------------------------- --
|
-- -------------------------- --
|
||||||
|
|
||||||
type Format is (Relative, DD, DD_Fine, DMS, DDM);
|
type Format is (Relative, DD, DD_Fine, DMS, DDM);
|
||||||
type Coordinate (Form : Format := Relative) is record
|
type Coordinate (Form : Format := Relative) is record
|
||||||
case Form is
|
case Form is
|
||||||
when Relative =>
|
when Relative =>
|
||||||
null;
|
null;
|
||||||
when DD =>
|
when DD =>
|
||||||
@@ -92,7 +90,7 @@ is
|
|||||||
when DDM =>
|
when DDM =>
|
||||||
DDM : Format_DDM;
|
DDM : Format_DDM;
|
||||||
end case;
|
end case;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
-- ---------------------------- --
|
-- ---------------------------- --
|
||||||
-- Converter / helper functions --
|
-- Converter / helper functions --
|
||||||
@@ -101,12 +99,11 @@ is
|
|||||||
-- Converter with DD target
|
-- Converter with DD target
|
||||||
-- @name To_DD
|
-- @name To_DD
|
||||||
-- @return Coordinate
|
-- @return Coordinate
|
||||||
-- @parameter DM_Base : Coordinate
|
-- @parameter DM_Base : Coordinate
|
||||||
-- @description Take any coordinate and return a DD formatted coordinate.
|
-- @description Take any coordinate and return a DD formatted coordinate.
|
||||||
function To_DD (DM_Base : Coordinate) return Coordinate
|
function To_DD (DM_Base : Coordinate) return Coordinate with
|
||||||
with Pre =>
|
Pre =>
|
||||||
(DM_Base.Form = DD) or else
|
(DM_Base.Form = DD) or else (DM_Base.Form = DMS)
|
||||||
(DM_Base.Form = DMS) or else
|
or else (DM_Base.Form = DDM);
|
||||||
(DM_Base.Form = DDM);
|
|
||||||
|
|
||||||
end Grl.Coordinates;
|
end Grl.Coordinates;
|
||||||
|
|||||||
Reference in New Issue
Block a user