ArcMapAddinVisibility.ViewModels.RLOSViewModel.GetLinearDistance C# (CSharp) Метод

GetLinearDistance() приватный Метод

private GetLinearDistance ( IMap map, double inputDistance, DistanceTypes distanceType ) : double
map IMap IMap
inputDistance double the input distance
distanceType DistanceTypes the "from" distance unit type
Результат double
        private double GetLinearDistance(IMap map, double inputDistance, DistanceTypes distanceType)
        {
            if (map.SpatialReference == null)
                return inputDistance;

            DistanceTypes distanceTo = DistanceTypes.Meters; // default to meters

            var pcs = map.SpatialReference as IProjectedCoordinateSystem;

            if (pcs != null)
            {
                // need to convert the offset from the input distance type to the spatial reference linear type
                distanceTo = GetDistanceType(pcs.CoordinateUnit.FactoryCode);
            }
            else
            {
                var gcs = map.SpatialReference as IGeographicCoordinateSystem;
                if (gcs != null)
                {
                    distanceTo = GetDistanceType(gcs.CoordinateUnit.FactoryCode);

                }
            }

            var result = GetDistanceFromTo(distanceType, distanceTo, inputDistance);

            return result;
        }