コード例 #1
0
        /// <summary>
        /// Creates transformation from source coordinate system to specified target system which is the fitted one
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        private static ICoordinateTransformation Any2Fitt(ICoordinateSystem source, IFittedCoordinateSystem target)
        {
            //Transform form base system of fitted to target coordinate system - use invered math transform
            IMathTransform invMt = CreateFittedTransform(target).Inverse();

            //case when source system is equal to base system of the fitted
            if (target.BaseCoordinateSystem.EqualParams(source))
            {
                //Transform form base system of fitted to target coordinate system
                return(CreateTransform(source, target, TransformType.Transformation, invMt));
            }

            ConcatenatedTransform ct = new ConcatenatedTransform();
            //First transform from source to base system of fitted
            CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

            ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source, target.BaseCoordinateSystem));

            //Transform form base system of fitted to target coordinate system - use invered math transform
            ct.CoordinateTransformationList.Add(CreateTransform(target.BaseCoordinateSystem, target, TransformType.Transformation, invMt));

            return(CreateTransform(source, target, TransformType.Transformation, ct));
        }
コード例 #2
0
        /// <summary>
        /// Creates transformation from fitted coordinate system to the target one
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        private static ICoordinateTransformation Fitt2Any(IFittedCoordinateSystem source, ICoordinateSystem target)
        {
            //transform from fitted to base system of fitted (which is equal to target)
            IMathTransform mt = CreateFittedTransform(source);

            //case when target system is equal to base system of the fitted
            if (source.BaseCoordinateSystem.EqualParams(target))
            {
                //Transform form base system of fitted to target coordinate system
                return(CreateTransform(source, target, TransformType.Transformation, mt));
            }

            //Transform form base system of fitted to target coordinate system
            ConcatenatedTransform ct = new ConcatenatedTransform();

            ct.CoordinateTransformationList.Add(CreateTransform(source, source.BaseCoordinateSystem, TransformType.Transformation, mt));

            //Transform form base system of fitted to target coordinate system
            CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();

            ct.CoordinateTransformationList.Add(ctFac.CreateFromCoordinateSystems(source.BaseCoordinateSystem, target));

            return(CreateTransform(source, target, TransformType.Transformation, ct));
        }