/// <summary>
        /// Creates visual tool action, which allows to enable/disable visual tool <see cref="ImageMeasureTool"/> in image viewer, and adds action to the toolstrip.
        /// </summary>
        /// <param name="toolStrip">The toolstrip, where actions must be added.</param>
        public static void CreateActions(VisualToolsToolStrip toolStrip)
        {
#if !REMOVE_ANNOTATION_PLUGIN
            // create action, which allows to measure objects on image in image viewer
            ImageMeasureToolAction imageMeasureToolAction = new ImageMeasureToolAction(
                new ImageMeasureTool(),
                "Image Measure Tool",
                "Image Measure Tool",
                GetIcon("ImageMeasureTool.png"));
            // add the action to the toolstrip
            toolStrip.AddAction(imageMeasureToolAction);
#endif
        }
Esempio n. 2
0
        /// <summary>
        /// Begins the measuremenet.
        /// </summary>
        private void measureTypeAction_Clicked(object sender, EventArgs e)
        {
            if (!_isInitialized)
            {
                return;
            }

            VisualToolAction action = (VisualToolAction)sender;

            MeasurementType measurementType = _measureTypeActionToMeasurementType[action];

            ImageMeasureToolAction measureToolAction = (ImageMeasureToolAction)action.Parent;

            if (!measureToolAction.IsActivated)
            {
                measureToolAction.Activate();
            }

            BeginMeasurement(measurementType);
        }