/// <summary>
        /// Reprojects all layers in the map frame so that they use the new
        /// projection Esri string
        /// </summary>
        /// <param name="mapFrame">The map frame that contains all layers that should be reprojected</param>
        /// <param name="newProjEsriString">The Esri WKT string of the new projection</param>
        public static void ReprojectMapFrame(this IMapFrame mapFrame, string newProjEsriString)
        {
            if (mapFrame == null)
            {
                throw new ArgumentNullException("mapFrame");
            }
            if (newProjEsriString == null)
            {
                throw new ArgumentNullException("newProjEsriString");
            }

            // parse the projection
            var newProjection = ProjectionInfo.FromEsriString(newProjEsriString);

            mapFrame.ReprojectMapFrame(newProjection);
        }
示例#2
0
        private void ApplyChanges()
        {
            if (ChangesApplied)
            {
                return;
            }
            var ignoredLayers = new StringBuilder();

            _mapFrame.ReprojectMapFrame(_projection, layer => ignoredLayers.AppendLine(layer.LegendText));
            if (ignoredLayers.Length > 0)
            {
                MessageBox.Show(this, string.Format(MessageStrings.MapFrameProjectionDialog_LayersWereSkipped, ignoredLayers), MessageStrings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            _mapFrame.ResetExtents();
            ChangesApplied = true;
        }
        private void ApplyChanges()
        {
            if (ChangesApplied)
            {
                return;
            }
            var ignoredLayers = new StringBuilder();

            _mapFrame.ReprojectMapFrame(_projection, layer => ignoredLayers.AppendLine(layer.LegendText));
            if (ignoredLayers.Length > 0)
            {
                MessageBox.Show(this, "These layers was skipped:" + Environment.NewLine + ignoredLayers,
                                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            _mapFrame.ResetExtents();
            ChangesApplied = true;
        }