ArcMapAddinVisibility.ViewModels.LOSBaseViewModel.GetOffsetInZUnits C# (CSharp) Метод

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

Method to get a z offset distance in the correct units for the map
private GetOffsetInZUnits ( IMap map, double offset, double zFactor, DistanceTypes distanceType ) : double
map IMap IMap
offset double the input offset
zFactor double ISurface z factor
distanceType DistanceTypes the "from" distance unit type
Результат double
        internal double GetOffsetInZUnits(IMap map, double offset, double zFactor, DistanceTypes distanceType)
        {
            if (map.SpatialReference == null)
                return offset;

            double offsetInMapUnits = 0.0;
            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
                // then apply the zFactor
                distanceTo = GetDistanceType(pcs.CoordinateUnit.FactoryCode);
            }

            offsetInMapUnits = GetDistanceFromTo(distanceType, distanceTo, offset);

            var result = offsetInMapUnits / zFactor;

            return result;
        }