public static CoordinateOperationCrsPathInfo Join(CoordinateOperationCrsPathInfo primary, CoordinateOperationCrsPathInfo other)
 {
     if (primary == null) throw new ArgumentNullException("primary");
     if (other == null) throw new ArgumentNullException("other");
     Contract.Ensures(Contract.Result<CoordinateOperationCrsPathInfo>() != null);
     // TODO: make sure that the last node of the first list and the first node of the last list are a match
     var nodes = new ICrs[primary.CrsNodesArray.Length + other.CrsNodesArray.Length - 1];
     primary.CrsNodesArray.CopyTo(nodes, 0);
     other.CrsNodesArray.CopyTo(nodes, primary.CrsNodesArray.Length - 1);
     var edges = new ICoordinateOperationInfo[primary.OperationEdgesArray.Length + other.OperationEdgesArray.Length];
     primary.OperationEdgesArray.CopyTo(edges, 0);
     other.OperationEdgesArray.CopyTo(edges, primary.OperationEdgesArray.Length);
     return new CoordinateOperationCrsPathInfo(nodes, edges);
 }
        public static CoordinateOperationCrsPathInfo Join(CoordinateOperationCrsPathInfo primary, CoordinateOperationCrsPathInfo other)
        {
            if (primary == null)
            {
                throw new ArgumentNullException("primary");
            }
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }
            Contract.Ensures(Contract.Result <CoordinateOperationCrsPathInfo>() != null);
            // TODO: make sure that the last node of the first list and the first node of the last list are a match
            var nodes = new ICrs[primary.CrsNodesArray.Length + other.CrsNodesArray.Length - 1];

            primary.CrsNodesArray.CopyTo(nodes, 0);
            other.CrsNodesArray.CopyTo(nodes, primary.CrsNodesArray.Length - 1);
            var edges = new ICoordinateOperationInfo[primary.OperationEdgesArray.Length + other.OperationEdgesArray.Length];

            primary.OperationEdgesArray.CopyTo(edges, 0);
            other.OperationEdgesArray.CopyTo(edges, primary.OperationEdgesArray.Length);
            return(new CoordinateOperationCrsPathInfo(nodes, edges));
        }
 public CoordinateOperationCrsPathInfo Append(CoordinateOperationCrsPathInfo other)
 {
     Contract.Requires(other != null);
     Contract.Ensures(Contract.Result <CoordinateOperationCrsPathInfo>() != null);
     return(Join(this, other));
 }
 public CoordinateOperationCrsPathInfo Append(CoordinateOperationCrsPathInfo other)
 {
     Contract.Requires(other != null);
     Contract.Ensures(Contract.Result<CoordinateOperationCrsPathInfo>() != null);
     return Join(this, other);
 }
Ejemplo n.º 5
0
        private Helmert7Transformation ExtractHelmert7Transformation(EpsgCoordinateTransformInfo transform)
        {
            var method = transform.Method;
            Contract.Assume(method != null);

            var compiler = new StaticCoordinateOperationCompiler();
            var compileRequest = new CoordinateOperationCrsPathInfo(
                new[] { transform.SourceCrs, transform.TargetCrs },
                new[] { transform });
            var compileResult = compiler.Compile(compileRequest);
            if (compileResult == null)
                return null;
            var transformSteps = (compileResult as IEnumerable<ITransformation>) ?? ArrayUtil.CreateSingleElementArray(compileResult);
            var exposedSteps = transformSteps.Select(step => {
                if (step is GeocentricTransformationGeographicWrapper) {
                    return ((GeocentricTransformationGeographicWrapper)step).GeocentricCore;
                }
                return step;
            });

            foreach (var step in exposedSteps) {
                if (step is Helmert7Transformation) {
                    return step as Helmert7Transformation;
                }
                if (step is GeocentricTranslation) {
                    return new Helmert7Transformation(((GeocentricTranslation)step).Delta);
                }
                if (step is GeographicGeocentricTranslation) {
                    return new Helmert7Transformation(((GeographicGeocentricTranslation)step).Delta);
                }
            }

            return null;
        }