Example #1
0
 internal EpsgCrsGeocentric(int code, string name, EpsgArea area, bool deprecated, EpsgCoordinateSystem cs, EpsgDatumGeodetic geodeticDatum, EpsgCrsGeodetic baseCrs, int baseOperationCode)
     : base(code, name, area, deprecated, cs, geodeticDatum, baseCrs, baseOperationCode)
 {
     Contract.Requires(code >= 0);
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(area != null);
     Contract.Requires(cs != null);
     Contract.Requires(geodeticDatum != null);
 }
Example #2
0
 internal EpsgCrsProjected(int code, string name, EpsgArea area, bool deprecated, EpsgCoordinateSystem cs, EpsgDatumGeodetic datum, EpsgCrsGeodetic baseCrs, int projectionCode)
     : base(code, name, area, deprecated, cs, datum, baseCrs, projectionCode)
 {
     Contract.Requires(code >= 0);
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(area != null);
     Contract.Requires(baseCrs != null);
     Contract.Requires(cs != null);
     Contract.Requires(datum != null);
 }
Example #3
0
 internal EpsgCrsGeodetic(int code, string name, EpsgArea area, bool deprecated, EpsgCoordinateSystem cs, EpsgDatumGeodetic geodeticDatum, EpsgCrsGeodetic baseCrs, int baseOperationCode)
     : base(code, name, area, deprecated, cs)
 {
     Contract.Requires(code >= 0);
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(area != null);
     Contract.Requires(cs != null);
     Contract.Requires(geodeticDatum != null);
     GeodeticDatum     = geodeticDatum;
     BaseCrs           = baseCrs;
     BaseOperationCode = baseOperationCode;
 }
Example #4
0
 internal EpsgCrsGeographic(int code, string name, EpsgArea area, bool deprecated, EpsgCoordinateSystem cs, EpsgDatumGeodetic geodeticDatum, EpsgCrsGeodetic baseCrs, int baseOperationCode, EpsgCrsKind kind)
     : base(code, name, area, deprecated, cs, geodeticDatum, baseCrs, baseOperationCode)
 {
     Contract.Requires(code >= 0);
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(area != null);
     Contract.Requires(cs != null);
     Contract.Requires(geodeticDatum != null);
     _kind = kind;
 }
Example #5
0
 internal EpsgCrsProjected(int code, string name, EpsgArea area, bool deprecated, EpsgCoordinateSystem cs, EpsgDatumGeodetic datum, EpsgCrsGeodetic baseCrs, int projectionCode)
     : base(code, name, area, deprecated, cs, datum, baseCrs, projectionCode)
 {
     Contract.Requires(code >= 0);
     Contract.Requires(!String.IsNullOrEmpty(name));
     Contract.Requires(area != null);
     Contract.Requires(baseCrs != null);
     Contract.Requires(cs != null);
     Contract.Requires(datum != null);
 }
Example #6
0
        private IEnumerable <EpsgCrsPathSearchNode> FindAllCorePaths(EpsgCrsPathSearchNode fromNode, EpsgCrsGeodetic toCrs, SearchOptions searchOptions)
        {
            Contract.Requires(fromNode != null);
            Contract.Requires(fromNode.Crs is EpsgCrsGeodetic);
            Contract.Requires(toCrs != null);

            var earlyResults = new List <EpsgCrsPathSearchNode>();
            var fromCrs      = (EpsgCrsGeodetic)fromNode.Crs;

            // construct the hierarchy based on the from CRS
            var fromStack = new List <EpsgCrsPathSearchNode>();
            var fromStackConstructionNode = fromNode;

            do
            {
                fromStack.Add(fromStackConstructionNode);
                var currentCrs = (EpsgCrsGeodetic)fromStackConstructionNode.Crs;
                if (!currentCrs.HasBaseOperation)
                {
                    break;
                }

                var baseCrs      = currentCrs.BaseCrs;
                var fromBaseEdge = currentCrs.GetBaseOperation();
                Contract.Assume(baseCrs != null);
                Contract.Assume(fromBaseEdge != null);

                if (!fromBaseEdge.HasInverse)
                {
                    break; // we have to invert the edge to traverse up the stack
                }
                var toBaseEdge = fromBaseEdge.GetInverse();
                fromStackConstructionNode = new EpsgCrsPathSearchNode(baseCrs, toBaseEdge, fromStackConstructionNode);
            } while (true /*fromStackSearchNode != null*/);

            // construct the hierarchy based on the to CRS
            var toStack = new List <GeodeticCrsStackItem>();
            var toStackConstructionCrs = toCrs;

            do
            {
                toStack.Add(new GeodeticCrsStackItem {
                    Crs = toStackConstructionCrs
                });
                toStackConstructionCrs = toStackConstructionCrs.BaseCrs;
            } while (toStackConstructionCrs != null);

            var lowestStackIntersection = FindLowestStackIntersection(fromStack, toStack);

            if (lowestStackIntersection != null)
            {
                earlyResults.Add(lowestStackIntersection);
            }

            var directResults   = FindDirectTransformations(fromStack, toStack, searchOptions);
            var indirectResults = FindIndirectTransformations(fromStack, toStack, searchOptions);

            return(earlyResults.Concat(directResults).Concat(indirectResults));
        }