Exemplo n.º 1
0
        /// <summary>
        /// Starts some sort of update. If the selected item is a polygon that has associated
        /// database attributes, a dialog will be displayed to let the user change the attributes.
        /// For any other spatial feature, the dialog for updating an editing operation will be
        /// displayed.
        /// </summary>
        /// <param name="so">The item selected for update</param>
        internal void RunUpdate(IUserAction action, ISpatialObject so)
        {
            if (so == null)
            {
                return;
            }

            // There can't be any command currently running.
            if (m_Command != null)
            {
                return;
            }

            // If we're currently auto-highlighting, get rid of it.
            AutoSelect = false;

            // If a polygon has been selected, invoke the attribute update dialog. Otherwise
            // start an update command.
            if (so.SpatialType == SpatialType.Polygon)
            {
                m_Main.UpdatePolygon((Polygon)so);
            }
            else
            {
                ClearSelection();
                UpdateUI upui = new UpdateUI(action);
                m_Command = upui;

                // We will have a DividerObject if the user selected a line
                // that has been intersected against other lines. In that case,
                // run the update using the underlying line.
                if (so is DividerObject)
                {
                    upui.Run((so as DividerObject).Divider.Line);
                }
                else
                {
                    upui.Run((Feature)so);
                }
            }
        }