Exemplo n.º 1
0
        private ICoordinateOperationCrsPathInfo GenerateCoreDatumShiftGeographic(ICrsGeographic from, ICrsGeographic to)
        {
            Contract.Requires(from != null);
            Contract.Requires(to != null);

            if (ComputationallyEqual(from, to))
            {
                return(new CoordinateOperationCrsPathInfo(from));
            }

            ;// if same unit, datum, and axes then treat as the same

            throw new NotImplementedException();

            // ReSharper disable CompareOfFloatsByEqualityOperator

            /*
             * var shiftPathInfo = GenerateCoreDatumShiftGeocentric(from, to);
             * var operations = shiftPathInfo.CoordinateOperations;
             * var fromSpheroid = from.Datum.Spheroid;
             * var toSpheroid = to.Datum.Spheroid;
             *
             * if (null != fromSpheroid && null != toSpheroid && (operations.Count != 0 || fromSpheroid.A != toSpheroid.A || fromSpheroid.B != toSpheroid.B)) {
             *  operations.Insert(0, new GeographicGeocentricTransformation(fromSpheroid));
             *  operations.Add(new GeocentricGeographicTransformation(toSpheroid));
             * }
             * return operations;*/
            // ReSharper restore CompareOfFloatsByEqualityOperator
        }
Exemplo n.º 2
0
        private ICoordinateOperationCrsPathInfo GenerateCoreDatumShift(ICrsGeographic from, ICrsGeocentric to)
        {
            Contract.Requires(from != null);
            Contract.Requires(to != null);
            Contract.Ensures(Contract.Result <ICoordinateOperationCrsPathInfo>() != null);
            throw new NotImplementedException();

            /*var operations = new List<ICoordinateOperationInfo>{
             *  new GeographicGeocentricTransformation(from.Datum.Spheroid)
             * };
             * operations.AddRange(GenerateCoreDatumShiftGeocentric(from.Datum, to.Datum));
             * return operations;*/
        }
Exemplo n.º 3
0
        private bool ComputationallyEqual(ICrsGeographic a, ICrsGeographic b)
        {
            Contract.Requires(a != null);
            Contract.Requires(b != null);
            if (a == b)
            {
                return(true);
            }

            return(ComputationallyEqual(a.Datum, b.Datum) &&
                   ComputationallyEqual(a.Axes, b.Axes) &&
                   ComputationallyEqual(a.Unit, b.Unit));
        }
Exemplo n.º 4
0
        public static ProjectionInfo CreateProjection(ICrsGeographic crsGeographic)
        {
            if (crsGeographic == null)
            {
                throw new ArgumentNullException("crsGeographic");
            }
            Contract.Ensures(Contract.Result <ProjectionInfo>() != null);

            var geographic = CreateGeographic(crsGeographic);

            var result = new ProjectionInfo {
                GeographicInfo = geographic,
                IsLatLon       = true,
                Transform      = new DotSpatial.Projections.Transforms.LongLat()
            };

            var finalResult = ProjectionInfo.FromProj4String(result.ToProj4String()); // TODO: fix this hack

            return(finalResult);
        }
Exemplo n.º 5
0
        public static ProjectionInfo CreateProjection(ICrsGeographic crsGeographic)
        {
            if (crsGeographic == null) throw new ArgumentNullException("crsGeographic");
            Contract.Ensures(Contract.Result<ProjectionInfo>() != null);

            var geographic = CreateGeographic(crsGeographic);

            var result = new ProjectionInfo {
                GeographicInfo = geographic,
                IsLatLon = true,
                Transform = new DotSpatial.Projections.Transforms.LongLat()
            };

            var finalResult = ProjectionInfo.FromProj4String(result.ToProj4String()); // TODO: fix this hack
            return finalResult;
        }