当前位置: 首页>>代码示例>>C#>>正文


C# Operation.GetRecenter方法代码示例

本文整理汇总了C#中System.Operation.GetRecenter方法的典型用法代码示例。如果您正苦于以下问题:C# Operation.GetRecenter方法的具体用法?C# Operation.GetRecenter怎么用?C# Operation.GetRecenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Operation的用法示例。


在下文中一共展示了Operation.GetRecenter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyRevision

        /// <summary>
        /// Applies a revised edit (as noted on a prior call to <see cref="AddUpdate"/>).
        /// </summary>
        void ApplyRevision()
        {
            UpdateOperation uop;

            // If we already have an update context, it means we're applying a revision in an attempt
            // to fix a rollforward problem.

            if (m_CurrentUpdate == null)
            {
                uop = new UpdateOperation(m_Revisions);
                m_CurrentUpdate = new UpdateEditingContext(uop);
            }
            else
            {
                // Undo the previous recalculation
                m_CurrentUpdate.RevertChanges();

                // Include the latest revision
                uop = m_CurrentUpdate.UpdateSource;
                foreach (RevisedEdit rev in m_Revisions)
                    uop.AddRevisedEdit(rev);
            }

            m_Revisions = null;

            try
            {
                // Serialize the edit to a string BEFORE we apply the changes (otherwise we'll end
                // up serializing the modified values)
                string editString = uop.GetEditString();

                // Apply changes, then rework the map model to account for the update
                uop.ApplyChanges();
                m_CurrentUpdate.Recalculate();

                // Update topology
                uop.MapModel.CleanEdit();

                // Save the update as part of the working session
                uop.Session.SaveEditString(uop, editString);
                m_CurrentUpdate = null;
                m_NumUpdate++;
            }

            catch (RollforwardException rex)
            {
                // Remember the problem edit
                m_Problem = rex.Problem;

                // The spatial index may be missing stuff (since the recalc exited early)
                CadastralMapModel model = uop.MapModel;
                model.EnsureFeaturesAreIndexed();

                // Update topology and cleanup any junk
                model.CleanEdit();

                // Re-center on the problem edit if it's off-screen
                ISpatialDisplay display = base.ActiveDisplay;
                IPosition newCenter = m_Problem.GetRecenter(display.Extent);
                if (newCenter != null)
                    display.Center = newCenter;

                MessageBox.Show("Cannot re-work geometry due to edit " + m_Problem.EditSequence, "Problem",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace, ex.Message);
                m_CurrentUpdate.RevertChanges();
                m_CurrentUpdate = null;
            }
        }
开发者ID:steve-stanton,项目名称:backsight,代码行数:76,代码来源:UpdateUI.cs


注:本文中的System.Operation.GetRecenter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。