private ICoordinateOperationCrsPathInfo GenerateCoreDatumShiftGeocentric(ICrsGeocentric from, ICrsGeocentric 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(); /* * var operations = new List<ICoordinateOperationInfo>(); * * var fromDatum = from.Datum; * var toDatum = to.Datum; * if (fromDatum == null || toDatum == null) * return null; * * var fromTransform = fromDatum.IsTransformableToWgs84 ? fromDatum.BasicWgs84Transformation : null; * var toTransform = toDatum.IsTransformableToWgs84 ? toDatum.BasicWgs84Transformation : null; * var performWgs84Transform = null != fromTransform * && null != toTransform * && !fromTransform.Equals(toTransform); * * if (performWgs84Transform && null != fromTransform) { * operations.Add(fromTransform); * } * * var fromUnit = fromDatum.Spheroid.AxisUnit; * var toUnit = toDatum.Spheroid.AxisUnit; * if (null != fromUnit && null != toUnit && fromUnit != toUnit) { * var conversion = SimpleUnitConversionGenerator.FindConversion(fromUnit, toUnit); * if (null != conversion) { * if (conversion is UnitUnityConversion) { * ; // do nothing * } * else if (conversion is IUnitScalarConversion<double>) { * throw new NotImplementedException("scalar unit conversion"); * } * else { * throw new NotImplementedException("dunno what to do about this"); * } * } * } * * if (performWgs84Transform && ((ICoordinateOperationInfo)toTransform).HasInverse) * operations.Add(((ICoordinateOperationInfo)toTransform).GetInverse()); * * //return operations; * throw new NotImplementedException();*/ }
private ICoordinateOperationCrsPathInfo GenerateCoreDatumShift(ICrsGeocentric from, ICrsGeographic to) { Contract.Requires(from != null); Contract.Requires(to != null); Contract.Ensures(Contract.Result <ICoordinateOperationCrsPathInfo>() != null); throw new NotImplementedException(); /* * var operations = GenerateCoreDatumShiftGeocentric(from.Datum, to.Datum); * operations.Add(new GeocentricGeographicTransformation(to.Datum.Spheroid)); * return operations;*/ }
private bool ComputationallyEqual(ICrsGeocentric a, ICrsGeocentric 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)); }