示例#1
0
        internal IntersectOperation GetUpdateOp()
        {
            UpdateUI up = (m_Cmd as UpdateUI);

            if (up == null)
            {
                return(null);
            }
            else
            {
                return(up.GetOp() as IntersectOperation);
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdatePathForm"/> class.
        /// </summary>
        /// <param name="update">The update command that's driving things (not null).</param>
        /// <exception cref="ArgumentNullException">If the supplied update command is null.</exception>
        internal UpdatePathForm(UpdateUI update)
        {
            InitializeComponent();
            Owner = EditingController.Current.MainForm;

            if (update == null)
            {
                throw new ArgumentNullException();
            }

            m_UpdCmd       = update;
            m_CurFaceIndex = -1;
            m_pop          = null;

            // Get the object that was selected for update.
            m_pop = (m_UpdCmd.GetOp() as PathOperation);
            if (m_pop == null)
            {
                throw new ArgumentException("Cannot obtain original connection path for update");
            }

            // Get a working copy of the connection path legs
            // TODO - This will not be suitable in a situation where staggered legs have been created
            Leg[] legs = PathParser.CreateLegs(m_pop.EntryString, m_pop.EntryUnit);

            m_Faces = new List <LegFace>();
            foreach (Leg leg in legs)
            {
                m_Faces.Add(leg.PrimaryFace);

                if (leg.AlternateFace != null)
                {
                    m_Faces.Add(leg.AlternateFace);
                }
            }

            m_Edits = new PathEditor(legs);
        }
示例#3
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(SaveDistDist());
            }

            // Remember the changes as part of the UI object (the original edit remains
            // unchanged for now)
            IntersectTwoDistancesOperation op      = (IntersectTwoDistancesOperation)up.GetOp();
            UpdateItemCollection           changes = op.GetUpdateItems(getDistance1.ObservedDistance,
                                                                       getDistance1.From,
                                                                       getDistance2.ObservedDistance,
                                                                       getDistance2.From,
                                                                       intersectInfo.IsDefault);

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

            // Return the point previously created at the intersect
            return(op.IntersectionPoint);
        }
示例#4
0
        NewCircleOperation GetUpdateOp()
        {
            UpdateUI up = (m_Cmd as UpdateUI);

            return(up == null ? null : (NewCircleOperation)up.GetOp());
        }