Exemple #1
0
        /// <summary>
        /// Checks if layer projection is the same as map projection, including search for dialects and substitutes.
        /// </summary>
        private bool CheckIsSame(
            ILayerSource layer,
            ISpatialReference mapProj,
            ISpatialReference layerProj,
            out ILayerSource newLayer)
        {
            newLayer = null;

            bool isSame = mapProj.IsSameExt(layerProj, layer.Envelope, 10);

            if (!isSame)
            {
                isSame = _context.Projections.IsDialectOf(mapProj, layerProj);
            }

            if (!isSame)
            {
                if (layer.SeekSubstituteFile(mapProj, out newLayer))
                {
                    _report.AddFile(layer.Filename, layer.Projection.Name, ProjectionOperation.Substituted,
                                    newLayer.Filename);
                    return(true);
                }
            }

            return(isSame);
        }