Beispiel #1
0
        /// <summary>
        /// Handles the Finish button.
        /// </summary>
        /// <returns>The point created at the intersection (null if an error was reported).
        /// The caller is responsible for disposing of the dialog and telling the controller
        /// the command is done)</returns>
        internal override PointFeature Finish()
        {
            // The intersection SHOULD be defined (the Finish button should have
            // been disabled if it wasn't)
            IPosition x = intersectInfo.Intersection;

            if (x == null)
            {
                MessageBox.Show("No intersection. Nothing to save");
                return(null);
            }

            // If we're not doing an update, just save the edit
            UpdateUI up = (GetCommand() as UpdateUI);

            if (up == null)
            {
                return(SaveDirLine());
            }

            // Remember the changes as part of the UI object (the original edit remains
            // unchanged for now)
            IntersectDirectionAndLineOperation op = (IntersectDirectionAndLineOperation)up.GetOp();
            UpdateItemCollection changes          = op.GetUpdateItems(getDirection.Direction,
                                                                      getLine.Line,
                                                                      intersectInfo.ClosestPoint);

            if (!up.AddUpdate(op, changes))
            {
                return(null);
            }

            // Return the point previously created at the intersect
            return(op.IntersectionPoint);
        }