classdef (Sealed, Hidden) MapUtils
    %MapUtils	Reserved for MathWorks internal use only
    
    %   Copyright 2019-2023 The MathWorks, Inc.
    
    properties (Constant)
        %Spheroid Reference spheroid for World Geodetic System 1984
        Spheroid = map.geodesy.internal.wgs84Spheroid
        %DefaultGeoReference A default lat lon GeoReference
        DefaultGeoReference = [42.3021 -71.3747]
    end
    
    methods (Static)
        
        function [deltaX, deltaY, deltaZ] = ecefOffset(LAT1, LON1, H1, LAT2, LON2, H2)
            %ecefOffset Cartesian ECEF offset between geodetic positions
            [deltaX, deltaY, deltaZ] = ecefOffset( ...
                driving.internal.MapUtils.Spheroid, ...
                LAT1, LON1, H1, LAT2, LON2, H2);
        end
        
        function [xEast, yNorth, zUp] = geodetic2enu(LAT, LON, H, LAT0, LON0, H0) %#codegen
            if isempty(coder.target)
                % geodetic2enu Geodetic to local Cartesian ENU
                [xEast, yNorth, zUp] = geodetic2enu(LAT, LON, H, LAT0, LON0, H0, ...
                    driving.internal.MapUtils.Spheroid);
            else
                spheroid = map.geodesy.internal.wgs84Spheroid;
                [xEast, yNorth, zUp] = geodetic2enu(LAT, LON, H, LAT0, LON0, H0, ...
                    spheroid);
            end
        end
        
        function [LAT, LON, H] = enu2geodetic(xEast, yNorth, zUp, LAT0, LON0, H0) %#codegen
            if isempty(coder.target)
                %enu2geodetic Local Cartesian ENU to geodetic
                [LAT, LON, H] = enu2geodetic(xEast, yNorth, zUp, LAT0, LON0, H0, ...
                    driving.internal.MapUtils.Spheroid);
            else
                spheroid = map.geodesy.internal.wgs84Spheroid;
                [LAT, LON, H] = enu2geodetic(xEast, yNorth, zUp, LAT0, LON0, H0, ...
                    spheroid);
            end
        end
        
    end
end
