Exemple #1
0
        /// <summary>
        /// Adds the measurement annotation actions to the specified action list.
        /// </summary>
        /// <param name="actions">The actions list.</param>
        private void AddMeasurementAnnotationActions(List <VisualToolAction> actions)
        {
            _measureTypeActionToMeasurementType = new Dictionary <VisualToolAction, MeasurementType>();

            VisualToolAction lineMeasureAction = new VisualToolAction(
                "Line Measure", "Starts the measurement using line", null, true);

            _measureTypeActionToMeasurementType.Add(lineMeasureAction, MeasurementType.Line);

            VisualToolAction linesMeasureAction = new VisualToolAction(
                "Lines Measure", "Starts the measurement using lines", null, true);

            _measureTypeActionToMeasurementType.Add(linesMeasureAction, MeasurementType.Lines);

            VisualToolAction ellipseMeasureAction = new VisualToolAction(
                "Ellipse Measure", "Starts the measurement using ellipse", null, true);

            _measureTypeActionToMeasurementType.Add(ellipseMeasureAction, MeasurementType.Ellipse);

            VisualToolAction angleMeasureAction = new VisualToolAction(
                "Angle Measure", "Starts the measurement using angle", null, true);

            _measureTypeActionToMeasurementType.Add(angleMeasureAction, MeasurementType.Angle);

            foreach (VisualToolAction action in _measureTypeActionToMeasurementType.Keys)
            {
                action.Activated += new EventHandler(measureTypeAction_Activated);
                action.Clicked   += new EventHandler(measureTypeAction_Clicked);
                actions.Add(action);
            }

            lineMeasureAction.Activate();
        }
Exemple #2
0
        /// <summary>
        /// Activates the action of drop-down menu.
        /// </summary>
        private void Button_DropDownOpened(object sender, EventArgs e)
        {
            // get current action
            VisualToolAction action = GetAction((ToolStripItem)sender);

            // if current action is not activated
            if (action != null && !action.IsActivated)
            {
                action.Activate();
            }
        }
Exemple #3
0
        /// <summary>
        /// Sets the previous action of visual tool.
        /// </summary>
        /// <returns>
        /// <b>True</b> the action is changed; otherwise, <b>false</b>.
        /// </returns>
        public bool SetPreviousAction()
        {
            // if previous action of visual tool is not defined
            if (_previousActionOfVisualTool == null)
            {
                return(false);
            }

            // activate previous action of visual tool
            _previousActionOfVisualTool.Activate();

            return(true);
        }
Exemple #4
0
        /// <summary>
        /// Activates the action.
        /// </summary>
        private void ActionItem_Click(object sender, EventArgs e)
        {
            VisualToolAction action = GetAction((ToolStripItem)sender);

            // if action is activated
            if (action.IsActivated)
            {
                // show visual tool settings
                action.ShowVisualToolSettings();
            }
            else
            {
                // activate action
                action.Activate();
            }

            // click on action
            action.Click();
        }
Exemple #5
0
        /// <summary>
        /// Updates the selected visual tool item.
        /// </summary>
        private void UpdateSelectedItem()
        {
            // if image viewer is not specified
            if (ImageViewer == null)
            {
                return;
            }

            // if current visual tool action is specified
            if (_currentActionOfVisualTool != null)
            {
                // if visual tool action is selected
                if (ImageViewer.VisualTool == GetVisualTool(_currentActionOfVisualTool))
                {
                    return;
                }
            }

            // get current visual tool action
            VisualToolAction currentVisualToolAction = _noneVisualToolAction;

            // for each visual tool actions
            foreach (VisualToolAction action in _visualToolActions)
            {
                // if action must be selected
                if (ImageViewer.VisualTool == GetVisualTool(action))
                {
                    currentVisualToolAction = action;
                    break;
                }
            }

            // if action is not activated
            if (!currentVisualToolAction.IsActivated)
            {
                _canChangeVisualTool = false;
                currentVisualToolAction.Activate();
                _canChangeVisualTool = true;
            }
        }