private void otherButton_Click(object sender, EventArgs e)
        {
            bool oldDefault = m_IsDefault;

            try
            {
                IntersectForm parent = GetIntersectForm();
                m_IsDefault = !m_IsDefault;
                IPosition other = parent.CalculateIntersect();
                if (other == null || other.IsAt(m_Intersect, Constants.TINY))
                {
                    throw new Exception("There isn't another intersection");
                }

                m_Intersect = other;
                ShowIntersection();
                EditingController.Current.ActiveDisplay.RestoreLastDraw();
            }

            catch (Exception ex)
            {
                m_IsDefault = oldDefault;
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        internal void InitializeControl(IntersectForm parent, int lineNum)
        {
            SetWantSplit(false);

            //	If we are updating a feature that was previously created,
            //	load the original info. For line-line intersections,
            //	we need to know which page this is, to determine whether we
            //	should display info for the 1st or 2nd line.

            IntersectOperation op = parent.GetUpdateOp();

            ShowUpdate(op, lineNum);

            /*
             * // Check the appropriate check boxes for the split stuff.
             * if (m_Line!=null)
             * {
             *  if (m_WantSplit==1)
             *      yesCheckBox.Checked = true;
             *  else
             *      noCheckBox.Checked = true;
             *
             * }
             *
             * // Make sure everything is drawn on top.
             * OnDraw();
             */
        }
示例#3
0
        IntersectOperation GetUpdateOp()
        {
            IntersectForm parent = (this.ParentForm as IntersectForm);

            Debug.Assert(parent != null);
            return(parent.GetUpdateOp());
        }
示例#4
0
        void MoveNext()
        {
            IntersectForm dial = (this.ParentForm as IntersectForm);

            if (dial != null)
            {
                dial.AdvanceToNextPage();
            }
        }
        void SetDefaultClosestPoint()
        {
            IntersectForm parent = GetIntersectForm();

            if (parent != null)
            {
                m_CloseTo = parent.GetDefaultClosestPoint();
                ShowCloseTo();
            }
        }
        void RecalculateIntersection()
        {
            IntersectForm parent = GetIntersectForm();

            if (parent != null)
            {
                m_Intersect = parent.CalculateIntersect();
                ShowIntersection();
            }
        }
        internal void InitializeControl(IntersectForm parent)
        {
            // Ask the enclosing property sheet whether we are updating
            // an existing feature or not.

            // If we are updating a previously existing point, select
            // the previously defined entity type.
            IntersectOperation op = parent.GetUpdateOp();

            if (op == null)
            {
                // Load the entity combo box with a list for point features.
                IEntity ent = pointTypeComboBox.Load(SpatialType.Point);

                // Load the ID combo (reserving the first available ID).
                IdHelper.LoadIdCombo(pointIdComboBox, ent, m_PointId);

                // If we are auto-numbering, disable the ID combo.
                EditingController controller = EditingController.Current;
                if (controller.IsAutoNumber)
                {
                    pointIdComboBox.Enabled = false;
                }
            }
            else
            {
                pointTypeComboBox.SelectedValueChanged -= pointTypeComboBox_SelectedValueChanged;
                pointIdComboBox.SelectedValueChanged   -= pointIdComboBox_SelectedValueChanged;

                pointTypeComboBox.Enabled = false;
                pointIdComboBox.Enabled   = false;

                // Load the entity combo box with a list for point features and disable it.
                ILayer layer = EditingController.Current.ActiveLayer;
                pointTypeComboBox.Load(SpatialType.Point, layer);

                // Scroll the entity combo to the previously defined
                // entity type for the intersection point.
                PointFeature feat   = op.IntersectionPoint;
                IEntity      curEnt = feat.EntityType;
                if (curEnt != null)
                {
                    pointTypeComboBox.SelectEntity(curEnt);
                }

                // Display the point key (if any)
                pointIdComboBox.DropDownStyle = ComboBoxStyle.DropDown;
                pointIdComboBox.Text          = feat.FormattedKey;

                // Intersects involving line features...
                m_CloseTo = op.ClosePoint;
                ShowCloseTo();
            }
        }
示例#8
0
        private void lineTypeComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            // Get the new selection (if any)
            m_LineType = lineTypeComboBox.SelectedEntityType;

            // If we have everything we need, move directly to the
            // next page. Otherwise move to the first field we need.
            if (m_From == null)
            {
                fromPointTextBox.Focus();
            }
            else if (m_Distance == null)
            {
                distanceTextBox.Focus();
            }
            else
            {
                IntersectForm dial = (this.ParentForm as IntersectForm);
                dial.AdvanceToNextPage();
            }
        }
示例#9
0
        internal void InitializeControl(IntersectForm parent, int distNum)
        {
            // Initialize combo box with a list of all line entity types
            // for the currently active editing layer.
            lineTypeComboBox.Load(SpatialType.Line);

            // If we are updating a feature that was previously created,
            // load the original info. For distance-distance intersections,
            // we need to know which page this is, to determine whether we
            // should display info for the 1st or 2nd distance.
            IntersectOperation op = parent.GetUpdateOp();

            if (op == null)
            {
                op = parent.GetRecall();
            }

            ShowUpdate(op, distNum);

            // Go to the first text box
            fromPointTextBox.Focus();
        }
        internal void InitializeControl(IntersectForm parent, int dirNum)
        {
            // Default settings for direction radio buttons.
            TurnRadioOff(clockwiseRadioButton);
            TurnRadioOff(counterClockwiseRadioButton);

            // Default settings for offset radio buttons (not checked, not enabled)
            TurnRadioOff(leftRadioButton);
            TurnRadioOff(rightRadioButton);

            // Clear the button that lets the displayed offset value be set as default
            setDefaultOffsetButton.Enabled = false;

            // If we've got a default offset, display it (and set the
            // appropriate radio button)
            string value = GlobalUserSetting.Read(DEFAULT_OFFSET_KEY);
            if (value.Length > 0)
            {
                m_DefaultOffset = new Distance(value);
                if (m_DefaultOffset.IsDefined)
                    m_DefaultOffset.SetFixed();
                else
                    m_DefaultOffset = null;
            }

            // Initialize combo box with a list of all line entity types
            // for the currently active theme.
            m_LineType = lineTypeComboBox.Load(SpatialType.Line);

            if (m_DefaultOffset!=null)
            {
                lineTypeComboBox.SelectEntity(null);
                lineTypeGroupBox.Enabled = false;
                m_LineType = null;
            }

            if (parent is IntersectDirectionAndLineForm)
            {
                // For direction-line intersections, the default is NOT
                // to add a line, so if we're not doing an update, make
                // sure the line type is undefined.

                if (parent.GetUpdateOp()==null)
                {
                    lineTypeComboBox.SelectEntity(null);
                    //lineTypeGroupBox.Enabled = false;
                    m_LineType = null;
                }
            }

            // If we are updating a feature that was previously created (or recalling
            // a previous edit), load the original info. For direction-direction intersections,
            // we need to know which page this is, to determine whether we
            // should display info for the 1st or 2nd direction.

            IntersectOperation op = parent.GetUpdateOp();
            if (op == null)
                op = parent.GetRecall();

            if (!ShowUpdate(op, (byte)dirNum))
            {
                // Display default offset (if there is one). Setting the text will cause
                // a call to OnChangeOffset, which will define m_Offset & m_IsRight
                if (m_DefaultOffset!=null)
                    offsetTextBox.Text = m_DefaultOffset.Format();
            }

            // Go to the first text box
            fromPointTextBox.Focus();
        }
示例#11
0
        /// <summary>
        /// Reacts to selection of the OK button in the dialog.
        /// </summary>
        /// <param name="wnd">The dialog window (ignored).</param>
        /// <returns></returns>
        internal override bool DialFinish(Control wnd)
        {
            if (m_Dialog==null)
            {
                MessageBox.Show("IntersectUI.DialFinish - No dialog!");
                return false;
            }

            PointFeature p = m_Dialog.Finish();
            if (p==null)
                return false;

            // Get the controller to select the intersection point
            ISpatialSelection ss = new SpatialSelection((ISpatialObject)p);
            Controller.SetSelection(ss);

            m_Dialog.Dispose();
            m_Dialog = null;
            return FinishCommand();
        }
示例#12
0
 public override void Dispose()
 {
     if (m_Dialog!=null)
     {
         m_Dialog.Dispose();
         m_Dialog = null;
     }
 }
示例#13
0
 /// <summary>
 /// Initializes this UI (for use by constructors)
 /// </summary>
 void Initialize()
 {
     Debug.Assert(this.EditId != EditingActionId.Null);
     m_Dialog = null;
 }
示例#14
0
        /// <summary>
        /// Starts the user interface (if any) for this command.
        /// </summary>
        /// <returns>True if command started ok.</returns>
        internal override bool Run()
        {
            // Don't run more than once.
            if (m_Dialog!=null)
                throw new InvalidOperationException("IntersectUI.Run - Command is already running.");

            // Are we doing an update?
            UpdateUI pup = this.Update;

            // Create the appropriate sort of dialog.
            EditingActionId edid = this.EditId;

            if (edid == EditingActionId.DirIntersect)
            {
                if (pup==null)
                    m_Dialog = new IntersectTwoDirectionsForm(this, "Intersect two directions");
                else
                    m_Dialog = new IntersectTwoDirectionsForm(pup, "Update (intersect two directions)");
            }
            else if (edid == EditingActionId.DirDistIntersect)
            {
                if (pup==null)
                    m_Dialog = new IntersectDirectionAndDistanceForm(this, "Intersect direction and distance");
                else
                    m_Dialog = new IntersectDirectionAndDistanceForm(pup, "Update (intersect direction and distance)");
            }
            else if (edid == EditingActionId.LineIntersect)
            {
                if (pup==null)
                    m_Dialog = new IntersectTwoLinesForm(this, "Intersect two lines");
                else
                    m_Dialog = new IntersectTwoLinesForm(pup, "Update (intersect two lines)");
            }
            else if (edid == EditingActionId.DistIntersect)
            {
                if (pup==null)
                    m_Dialog = new IntersectTwoDistancesForm(this, "Intersect two distances");
                else
                    m_Dialog = new IntersectTwoDistancesForm(pup, "Update (intersect two distances)");
            }
            else if (edid == EditingActionId.DirLineIntersect)
            {
                if (pup==null)
                    m_Dialog = new IntersectDirectionAndLineForm(this, "Intersect direction and line");
                else
                    m_Dialog = new IntersectDirectionAndLineForm(pup, "Update (intersect direction and line)");
            }
            else
            {
                throw new Exception("IntersectUI.Run - Unexpected command id.");
            }

            m_Dialog.Show();
            return true;
        }
示例#15
0
        internal void InitializeControl(IntersectForm parent, int lineNum)
        {
            SetWantSplit(false);

            //	If we are updating a feature that was previously created,
            //	load the original info. For line-line intersections,
            //	we need to know which page this is, to determine whether we
            //	should display info for the 1st or 2nd line.

            IntersectOperation op = parent.GetUpdateOp();
            ShowUpdate(op, lineNum);

            /*
            // Check the appropriate check boxes for the split stuff.
            if (m_Line!=null)
            {
                if (m_WantSplit==1)
                    yesCheckBox.Checked = true;
                else
                    noCheckBox.Checked = true;

            }

            // Make sure everything is drawn on top.
            OnDraw();
             */
        }
        internal void InitializeControl(IntersectForm parent, int distNum)
        {
            // Initialize combo box with a list of all line entity types
            // for the currently active editing layer.
            lineTypeComboBox.Load(SpatialType.Line);

            // If we are updating a feature that was previously created,
            // load the original info. For distance-distance intersections,
            // we need to know which page this is, to determine whether we
            // should display info for the 1st or 2nd distance.
            IntersectOperation op = parent.GetUpdateOp();
            if (op == null)
                op = parent.GetRecall();

            ShowUpdate(op, distNum);

            // Go to the first text box
            fromPointTextBox.Focus();
        }