Esempio n. 1
0
		public override bool Start(IMouseInformation mouseInformation)
		{
			base.Start(mouseInformation);

			if (_graphicBuilder != null)
				return _graphicBuilder.Start(mouseInformation);

            if (!CanStart(mouseInformation.Tile.PresentationImage))
                return false;

			RoiGraphic roiGraphic = CreateRoiGraphic();

			_graphicBuilder = CreateGraphicBuilder(roiGraphic.Subject);
			_graphicBuilder.GraphicComplete += OnGraphicBuilderComplete;
			_graphicBuilder.GraphicCancelled += OnGraphicBuilderCancelled;

		    AddRoiGraphic(  mouseInformation.Tile.PresentationImage, 
                            roiGraphic, 
                            (IOverlayGraphicsProvider)mouseInformation.Tile.PresentationImage);

			roiGraphic.Suspend();
			try
			{
				if (_graphicBuilder.Start(mouseInformation))
					return true;
			}
			finally
			{
				roiGraphic.Resume(true);
			}

			this.Cancel();
			return false;
		}
        public InsertRoadJunctionFourBlocksCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator )
        {
            this._factories = factories;
            this._mouseInformation = mouseInformation.NotNull();

            this._mouseInformation.LeftButtonPressed.Subscribe( this.AddJunction );
        }
		/// <summary>
		/// Passes user input to the builder when <see cref="IMouseButtonHandler.Start"/> is called on the owning tool.
		/// </summary>
		/// <param name="mouseInformation">The user input data.</param>
		/// <returns>True if the builder did something as a result of the call, and hence would like to receive capture; False otherwise.</returns>
		public override bool Start(IMouseInformation mouseInformation)
		{
			// We just started creating
			if (_numberOfPointsAnchored == 0)
			{
				this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
				this.Graphic.TopLeft = mouseInformation.Location;
				this.Graphic.BottomRight = mouseInformation.Location;
				this.Graphic.ResetCoordinateSystem();

				_numberOfPointsAnchored++;
			}
			// We're done creating
			else
			{
				_numberOfPointsAnchored++;

                // When user moves the mouse very quickly and events are filtered for performance purpose (eg web viewer case), 
                // the final point may not be the same as the last tracked point. Must update the final point based on the latest mouse position.
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                this.Graphic.BottomRight = mouseInformation.Location;
                this.Graphic.ResetCoordinateSystem();

				this.NotifyGraphicComplete();
			}

			return true;
		}
Esempio n. 4
0
		public override bool Track(IMouseInformation mouseInformation)
		{
			if (_graphicBuilder != null)
				return _graphicBuilder.Track(mouseInformation);

			return false;
		}
		public override bool Start(IMouseInformation mouseInformation)
		{
			this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
			this.Graphic.Location = mouseInformation.Location;
			this.Graphic.ResetCoordinateSystem();
			this.NotifyGraphicComplete();
			return true;
		}
Esempio n. 6
0
		/// <summary>
		/// Called by the framework as the mouse moves while the assigned mouse button
		/// is pressed.
		/// </summary>
		/// <param name="e">Mouse event args</param>
		/// <returns>True if the event was handled, false otherwise</returns>
		public override bool Track(IMouseInformation mouseInformation)
		{
			if (_selectedTile == null || _selectedImageGraphic == null)
				return false;

			Probe(mouseInformation.Location);

			return true;
		}
 public NotifiyAboutClickedControls( IMouseInformation mouseInformation, IEventAggregator eventAggregator, VisitAllChildren allControls )
 {
     Contract.Requires( mouseInformation != null );
     Contract.Requires( eventAggregator != null );
     this._mouseInformation = mouseInformation;
     this._eventAggreagor = eventAggregator;
     this._allControls = allControls;
     this._mouseInformation.LeftButtonClicked.Subscribe( this.OnLeftButtonClicked );
 }
Esempio n. 8
0
        protected override bool Start(IMouseInformation mouseInformation)
        {
            bool result = base.Start(mouseInformation);

            if (result)
            {
                EventsHelper.Fire(this.UndoableOperationStart, this, EventArgs.Empty);
            }
            return(result);
        }
 public SelectToEditCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator, VisitAllChildren allControls )
 {
     Contract.Requires( mouseInformation != null );
     Contract.Requires( factories != null );
     Contract.Requires( eventAggregator != null );
     this._eventAggregator = eventAggregator;
     this._mouseInformation = mouseInformation;
     this._mouseInformation.LeftButtonClicked.Subscribe( this.OnLeftButtonClick );
     this._allControl = allControls;
 }
Esempio n. 10
0
        /// <summary>
        /// Handles a "track mouse" message from the Framework.
        /// </summary>
        /// <param name="mouseInformation"></param>
        /// <returns>A value indicating whether the track message was handled.</returns>
        /// <remarks>
        /// <para>
        /// In most cases, <see cref="Track"/> corresponds to "mouse move".
        /// </para>
        /// <para>
        /// As a developer, you need to override this method in your
        /// <see cref="MouseImageViewerTool"/> subclass to add your custom functionality,
        /// but you should never have to call it; it should only ever have to be
        /// called by the Framework.
        /// </para>
        /// </remarks>
        public virtual bool Track(IMouseInformation mouseInformation)
        {
            _deltaX = mouseInformation.Location.X - _lastX;
            _deltaY = mouseInformation.Location.Y - _lastY;

            _lastX = mouseInformation.Location.X;
            _lastY = mouseInformation.Location.Y;

            return(false);
        }
Esempio n. 11
0
		/// <summary>
		/// Called by the framework when the mouse is moving and results in a transition 
		/// to the <see cref="FocussedGraphicState"/> when
		/// the mouse hovers over the associated 
		/// <see cref="IStandardStatefulGraphic"/>.
		/// </summary>
		/// <param name="mouseInformation"></param>
		/// <returns></returns>
		public override bool Track(IMouseInformation mouseInformation)
		{
			if (this.StatefulGraphic.HitTest(mouseInformation.Location))
			{
				this.StatefulGraphic.State = this.StatefulGraphic.CreateFocussedSelectedState();
				return true;
			}

			return false;
		}
Esempio n. 12
0
        /// <summary>
        /// Gets the context menu <see cref="ActionModelNode"/> based on the current state of the mouse.
        /// </summary>
        public virtual ActionModelNode GetContextMenuModel(IMouseInformation mouseInformation)
        {
            IActionSet actions = this.GetExportedActions("basicgraphic-menu", mouseInformation);

            if (actions == null || actions.Count == 0)
            {
                return(null);
            }
            return(ActionModelRoot.CreateModel(this.ContextMenuNamespace, "basicgraphic-menu", actions));
        }
 public DebugMouseInformationModel( IMouseInformation mouseInformation )
 {
     this._mouseInformation = mouseInformation;
     this._mouseInformation.MousePositionChanged.Where( t => this.ShouldShowMousePositoion).Subscribe(t =>
                                                                {
                                                                    this.MouseXPosition = this._mouseInformation.XnaXMousePosition.ToString();
                                                                    this.MouseYPosition = this._mouseInformation.XnaYMousePosition.ToString();
                                                                });
     this._mouseInformation.StartRecord();
 }
Esempio n. 14
0
        public override bool Track(IMouseInformation mouseInformation)
        {
            if (_view != null)
            {
                _view.UpdateMouseLocation(ConstrainPointToTile(mouseInformation));
                return(true);
            }

            return(false);
        }
Esempio n. 15
0
		/// <summary>
		/// Called by the framework when the user clicks away from the 
		/// associated <see cref="IStandardStatefulGraphic"/>
		/// and results in a transition to the <see cref="InactiveGraphicState"/>.
		/// </summary>
		/// <param name="mouseInformation"></param>
		/// <returns></returns>
		public override bool Start(IMouseInformation mouseInformation)
		{
			if (!this.StatefulGraphic.HitTest(mouseInformation.Location))
			{
				this.StatefulGraphic.State = this.StatefulGraphic.CreateInactiveState();
				return false;
			}

			return true;
		}
        /// <summary>
        /// Called by the framework when the mouse is moving and results in a transition
        /// to the <see cref="SelectedGraphicState"/> when
        /// the mouse is no longer hovering over the associated
        /// <see cref="IStandardStatefulGraphic"/>.
        /// </summary>
        public override bool Track(IMouseInformation mouseInformation)
        {
            if (!this.StatefulGraphic.HitTest(mouseInformation.Location))
            {
                this.StatefulGraphic.State = this.StatefulGraphic.CreateSelectedState();
                return(false);
            }

            return(true);
        }
        public InsertRoadLaneCommand( IMouseInformation mouseInformation, RoadLayer ownr, RoadLaneBuilder roadLaneBuilder )
        {
            this._mouseInformation = mouseInformation;
            this._mouseInformation.LeftButtonPressed.Subscribe( this.MousePressed );
            this._owner = ownr;
            this._roadLaneBuilder = roadLaneBuilder;
            this._roadLaneBuilder.SetOwner( ownr );

            this._visitator = new VisitAllChildren( this._owner );
        }
        /// <summary>
        /// Passes user input to the builder when <see cref="IMouseButtonHandler.Track"/> is called on the owning tool.
        /// </summary>
        /// <param name="mouseInformation">The user input data.</param>
        /// <returns>True if the builder handled the message; False otherwise.</returns>
        public override bool Track(IMouseInformation mouseInformation)
        {
            this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
            //this.Graphic.Points[_numberOfPointsAnchored] = mouseInformation.Location;
            this.Graphic.Points[_numberOfPointsAnchored] = new Point(mouseInformation.Location.X, point.Y);
            this.Graphic.ResetCoordinateSystem();
            this.Graphic.Draw();

            return(true);
        }
Esempio n. 19
0
        /// <summary>
        /// Called by the framework when the user clicks away from the
        /// associated <see cref="IStandardStatefulGraphic"/>
        /// and results in a transition to the <see cref="InactiveGraphicState"/>.
        /// </summary>
        /// <param name="mouseInformation"></param>
        /// <returns></returns>
        public override bool Start(IMouseInformation mouseInformation)
        {
            if (!this.StatefulGraphic.HitTest(mouseInformation.Location))
            {
                this.StatefulGraphic.State = this.StatefulGraphic.CreateInactiveState();
                return(false);
            }

            return(true);
        }
Esempio n. 20
0
        /// <summary>
        /// Passes user input to the builder when <see cref="IMouseButtonHandler.Start"/> is called on the owning tool.
        /// </summary>
        /// <param name="mouseInformation">The user input data.</param>
        /// <returns>True if the builder did something as a result of the call, and hence would like to receive capture; False otherwise.</returns>
        public override bool Start(IMouseInformation mouseInformation)
        {
            _numberOfPointsAnchored++;

            // We just started creating
            if (_numberOfPointsAnchored == 1)
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                this.Graphic.Points.Add(mouseInformation.Location);
                this.Graphic.Points.Add(mouseInformation.Location);
                this.Graphic.ResetCoordinateSystem();
            }
            // We're done creating
            else if (_numberOfPointsAnchored >= 5 && mouseInformation.ClickCount >= 2)
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                try
                {
                    this.Graphic.Points.RemoveAt(--_numberOfPointsAnchored);
                    this.Graphic.Points[--_numberOfPointsAnchored] = this.Graphic.Points[0];
                }
                finally
                {
                    this.Graphic.ResetCoordinateSystem();
                }

                this.NotifyGraphicComplete();
            }
            // We're done creating
            else if (_numberOfPointsAnchored >= 4 && AtOrigin(mouseInformation.Location) && mouseInformation.ClickCount == 1)
            {
                this.NotifyGraphicComplete();
            }
            // We're done creating
            else if (_numberOfPointsAnchored >= 3 && _numberOfPointsAnchored >= _maximumVertices && mouseInformation.ClickCount == 1)
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                this.Graphic.Points.Add(this.Graphic.Points[0]);
                this.Graphic.ResetCoordinateSystem();
                this.NotifyGraphicComplete();
            }
            // We're in the middle of creating
            else if (_numberOfPointsAnchored >= 2 && mouseInformation.ClickCount == 1)
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                this.Graphic.Points.Add(mouseInformation.Location);
                this.Graphic.ResetCoordinateSystem();
            }
            else if (mouseInformation.ClickCount > 1)
            {
                // removes the extra click if the user multi-clicks and it doesn't otherwise have any meaning
                _numberOfPointsAnchored--;
            }
            return(true);
        }
		/// <summary>
		/// Called by the framework when the mouse is moving and results in a transition 
		/// to the <see cref="FocussedGraphicState"/> when
		/// the mouse hovers over the associated <see cref="IStandardStatefulGraphic"/>.
		/// </summary>
		/// <param name="mouseInformation"></param>
		/// <returns></returns>
		public override bool Track(IMouseInformation mouseInformation)
		{
			// If mouse is over object, transition to focused state
			if (this.StatefulGraphic.HitTest(mouseInformation.Location))
			{
				this.StatefulGraphic.State = this.StatefulGraphic.CreateFocussedState();
				return true;
			}

			return false;
		}
Esempio n. 22
0
        public virtual ActionModelNode GetContextMenuModel(IMouseInformation mouseInformation)
        {
            const string actionSite = "dicomgraphic-menu";
            var          actions    = GetExportedActions(actionSite, mouseInformation);

            if (actions == null || actions.Count == 0)
            {
                return(null);
            }
            return(ActionModelRoot.CreateModel(ContextMenuNamespace, actionSite, actions));
        }
Esempio n. 23
0
        /// <summary>
        /// Called by the framework each time a mouse button is pressed.
        /// </summary>
        /// <remarks>
        /// <para>
        /// As a general rule, if the <see cref="IMouseButtonHandler"/> object did anything as a result of this call, it must
        /// return true.  If false is returned, <see cref="IMouseButtonHandler.Start"/> is called on other <see cref="IMouseButtonHandler"/>s
        /// until one returns true.
        /// </para>
        /// <para>
        /// The <see cref="ControlGraphic"/> implementation finds a handler by trying <see cref="Start"/>,
        /// and any child graphics implementing <see cref="IMouseButtonHandler"/>, in decreasing order of priority.
        /// </para>
        /// </remarks>
        /// <param name="mouseInformation">The mouse input information.</param>
        /// <returns>True if the <see cref="ControlGraphic"/> did something as a result of the call and hence would like to receive capture; False otherwise.</returns>
        bool IMouseButtonHandler.Start(IMouseInformation mouseInformation)
        {
            bool result;

            if (_capturedHandler != null)
            {
                result = _capturedHandler.Start(mouseInformation);
                if (result)
                {
                    return(result);
                }
            }

            this.CoordinateSystem = CoordinateSystem.Destination;
            try
            {
                if (this.HitTest(mouseInformation.Location))
                {
                    _lastTrackedPosition = mouseInformation.Location;
                    _isTracking          = true;
                }
                result      = this.Start(mouseInformation);
                _isTracking = _isTracking && result;
            }
            finally
            {
                this.ResetCoordinateSystem();
            }

            _capturedHandler = null;
            if (!result)
            {
                foreach (IGraphic graphic in this.EnumerateChildGraphics(true))
                {
                    if (!graphic.Visible)
                    {
                        continue;
                    }

                    IMouseButtonHandler handler = graphic as IMouseButtonHandler;
                    if (handler != null)
                    {
                        result = handler.Start(mouseInformation);
                        if (result)
                        {
                            _capturedHandler = handler;
                            break;
                        }
                    }
                }
            }

            return(result);
        }
Esempio n. 24
0
        /// <summary>
        /// Called by the framework when the mouse is moving and results in a transition
        /// to the <see cref="FocussedGraphicState"/> when
        /// the mouse hovers over the associated <see cref="IStandardStatefulGraphic"/>.
        /// </summary>
        /// <param name="mouseInformation"></param>
        /// <returns></returns>
        public override bool Track(IMouseInformation mouseInformation)
        {
            // If mouse is over object, transition to focused state
            if (this.StatefulGraphic.HitTest(mouseInformation.Location))
            {
                this.StatefulGraphic.State = this.StatefulGraphic.CreateFocussedState();
                return(true);
            }

            return(false);
        }
Esempio n. 25
0
        /// <summary>
        /// Called by the framework as the mouse moves while the assigned mouse button
        /// is pressed.
        /// </summary>
        /// <param name="e">Mouse event args</param>
        /// <returns>True if the event was handled, false otherwise</returns>
        public override bool Track(IMouseInformation mouseInformation)
        {
            if (_selectedTile == null || _selectedImageGraphic == null)
            {
                return(false);
            }

            Probe(mouseInformation.Location);

            return(true);
        }
Esempio n. 26
0
        /// <summary>
        /// Called by <see cref="ControlGraphic"/> in response a mouse button release via <see cref="ControlGraphic.Stop"/>.
        /// </summary>
        /// <param name="mouseInformation">The mouse input information.</param>
        /// <returns>True if the framework should <b>not</b> release capture; False otherwise.</returns>
        protected override bool Stop(IMouseInformation mouseInformation)
        {
            if (_memorableState != null)
            {
                AddToCommandHistory(this, _memorableState, this.CreateMemento());
                _memorableState = null;
            }

            _trackedControlPoint = -1;
            return(base.Stop(mouseInformation));
        }
Esempio n. 27
0
        public override bool Track(IMouseInformation mouseInformation)
        {
            base.Track(mouseInformation);

            float increment = -base.DeltaY * 0.025f;

            increment *= ToolSettings.DefaultInstance.InvertedZoomToolOperation ? -1f : 1f;
            IncrementScale(increment);

            return(true);
        }
        public ConnectObjectCommand(
                            IMouseInformation mouseInformation,
                            CompositeConnectionCommand compositeConnectionCommand,
                            RoadLayer owner )
        {
            this._mouseInformation = mouseInformation;
            this._compositeConnectionCommand = compositeConnectionCommand;
            this._visitator = new VisitAllChildren( owner );

            this._mouseInformation.LeftButtonClicked.Subscribe( this.LeftButtonClicked );
        }
Esempio n. 29
0
        /// <summary>
        /// Called then the graphic <see cref="StatefulCompositeGraphic.State"/> enters the selected state.
        /// </summary>
        /// <param name="mouseInformation">Information about the current mouse input.</param>
        protected virtual void OnEnterSelectedState(IMouseInformation mouseInformation)
        {
            this.Selected = true;

            if (this.ParentPresentationImage != null && this.ParentPresentationImage.FocussedGraphic == this)
            {
                this.ParentPresentationImage.FocussedGraphic = null;
            }

            UpdateGraphicStyle(this, this.SelectedColor, false);
            Draw();
        }
		public override bool Track(IMouseInformation mouseInformation)
		{
			if (clickIndex == 1)
			{
				this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
				this.Graphic.TextLocation = mouseInformation.Location;
				this.Graphic.ResetCoordinateSystem();
				this.Graphic.Draw();
			}

			return true;
		}
 public CarsRemoverCommand( IMouseInformation mouseInformation, Factories.Factories factories, IEventAggregator eventAggregator )
 {
     Contract.Requires( mouseInformation != null );
     Contract.Requires( factories != null );
     Contract.Requires( eventAggregator != null );
     this._mouseInformation = mouseInformation;
     this._mouseInformation.LeftButtonPressed.Subscribe( s =>
                         {
                             var carInserter = new CarsRemover( factories, s.Location );
                             eventAggregator.Publish( new AddControlToRoadLayer( carInserter ) );
                         } );
 }
Esempio n. 32
0
 /// <summary>
 /// Gets a set of exported <see cref="IAction"/>s.
 /// </summary>
 /// <param name="site">The action model site at which the actions should reside.</param>
 /// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
 /// <returns>A set of exported <see cref="IAction"/>s.</returns>
 public virtual IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
 {
     if (_textControlGraphic.HitTest(mouseInformation.Location))
     {
         return(_textControlGraphic.GetExportedActions(site, mouseInformation));
     }
     if (_pointControlGraphic.HitTest(mouseInformation.Location))
     {
         return(_pointControlGraphic.GetExportedActions(site, mouseInformation));
     }
     return(new ActionSet());
 }
Esempio n. 33
0
        public override bool Track(IMouseInformation mouseInformation)
        {
            if (_clickIndex == 1)
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                this.Graphic.TextLocation     = mouseInformation.Location;
                this.Graphic.ResetCoordinateSystem();
                this.Graphic.Draw();
            }

            return(true);
        }
        public override bool Start(IMouseInformation mouseInformation)
        {
            if (this.SelectedLayerOpacityProvider == null)
            {
                return(false);
            }

            base.Start(mouseInformation);

            CaptureBeginState();

            return(true);
        }
Esempio n. 35
0
        public override bool Stop(IMouseInformation mouseInformation)
        {
            if (this.SelectedPresentationImage == null)
            {
                return(false);
            }

            base.Stop(mouseInformation);

            CaptureEndState();

            return(false);
        }
        public override bool Stop(IMouseInformation mouseInformation)
        {
            if (this.SelectedLayerOpacityProvider == null)
            {
                return(false);
            }

            base.Stop(mouseInformation);

            this.CaptureEndState();

            return(false);
        }
        public override bool Start(IMouseInformation mouseInformation)
        {
            _rotatingGraphic = false;

            if (_currentPinwheelGraphic != null)
            {
                _currentPinwheelGraphic.CoordinateSystem = CoordinateSystem.Destination;
                _rotatingGraphic = _currentPinwheelGraphic.HitTest(mouseInformation.Location);
                _currentPinwheelGraphic.ResetCoordinateSystem();
            }

            return(_rotatingGraphic);
        }
Esempio n. 38
0
		public override bool Start(IMouseInformation mouseInformation)
		{
			_rotatingGraphic = false;

			if (_currentPinwheelGraphic != null)
			{
				_currentPinwheelGraphic.CoordinateSystem = CoordinateSystem.Destination;
				_rotatingGraphic = _currentPinwheelGraphic.HitTest(mouseInformation.Location);
				_currentPinwheelGraphic.ResetCoordinateSystem();
			}

			return _rotatingGraphic;
		}
Esempio n. 39
0
        public override bool Stop(IMouseInformation mouseInformation)
        {
            if (Context.Viewer.SelectedTile == null)
            {
                return(false);
            }

            base.Stop(mouseInformation);

            CaptureEndState();

            return(false);
        }
Esempio n. 40
0
        public override bool Start(IMouseInformation mouseInformation)
        {
            if (!CanRotate())
            {
                _flashOverlayController.Flash(SelectedPresentationImage, SR.Message3DOnly);
            }

            base.Start(mouseInformation);

            CaptureBeginState();

            return(true);
        }
Esempio n. 41
0
        /// <summary>
        /// Called by the framework when the associated <see cref="IStandardStatefulGraphic"/>
        /// is clicked on and results in a transition to the <see cref="FocussedSelectedGraphicState"/>.
        /// </summary>
        /// <param name="mouseInformation"></param>
        /// <returns></returns>
        public override bool Start(IMouseInformation mouseInformation)
        {
            if (this.StatefulGraphic.HitTest(mouseInformation.Location))
            {
                this.StatefulGraphic.State = this.StatefulGraphic.CreateFocussedSelectedState();
                this.StatefulGraphic.State.Start(mouseInformation);

                return(true);
            }

            //We should never actually get to here, but if we did, this should happen.
            base.StatefulGraphic.State = this.StatefulGraphic.CreateInactiveState();
            return(false);
        }
Esempio n. 42
0
		public override bool Start(IMouseInformation mouseInformation)
		{
			if (this.SelectedImageGraphicProvider == null)
				return false;

			_selectedTile = mouseInformation.Tile as Tile;
			_selectedTile.InformationBox = new InformationBox();
			_selectedImageGraphic = this.SelectedImageGraphicProvider.ImageGraphic;
			_selectedImageSop = (this.SelectedPresentationImage as IImageSopProvider).ImageSop;

			Probe(mouseInformation.Location);

			return true;
		}
Esempio n. 43
0
            public override bool Stop(IMouseInformation mouseInformation)
            {
                if (_lineGraphicBuilder == null)
                {
                    return(false);
                }

                if (_lineGraphicBuilder.Stop(mouseInformation))
                {
                    return(true);
                }

                return(false);
            }
        /// <summary>
        /// Gets a set of exported <see cref="IAction"/>s.
        /// </summary>
        /// <param name="site">The action model site at which the actions should reside.</param>
        /// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
        /// <returns>A set of exported <see cref="IAction"/>s.</returns>
        public override IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
        {
            if (!HitTest(mouseInformation.Location))
            {
                return(new ActionSet());
            }

            if (_toolSet == null)
            {
                _toolSet = new ToolSet(new GraphicToolExtensionPoint(), new GraphicToolContext(this));
            }

            return(base.GetExportedActions(site, mouseInformation).Union(_toolSet.Actions));
        }
Esempio n. 45
0
		/// <summary>
		/// Called by the framework when the associated <see cref="IStandardStatefulGraphic"/>
		/// is clicked on and results in a transition to the <see cref="FocussedSelectedGraphicState"/>.
		/// </summary>
		/// <param name="mouseInformation"></param>
		/// <returns></returns>
		public override bool Start(IMouseInformation mouseInformation)
		{
			if (this.StatefulGraphic.HitTest(mouseInformation.Location))
			{
				this.StatefulGraphic.State = this.StatefulGraphic.CreateFocussedSelectedState();
				this.StatefulGraphic.State.Start(mouseInformation);

				return true;
			}

			//We should never actually get to here, but if we did, this should happen.
			base.StatefulGraphic.State = this.StatefulGraphic.CreateInactiveState();
			return false;
		}
Esempio n. 46
0
        /// <summary>
        /// Gets a set of exported <see cref="IAction"/>s.
        /// </summary>
        /// <param name="site">The action model site at which the actions should reside.</param>
        /// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
        /// <returns>A set of exported <see cref="IAction"/>s.</returns>
        public override IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
        {
            IResourceResolver resolver   = new ApplicationThemeResourceResolver(this.GetType(), true);
            string            @namespace = typeof(RoiCalloutGraphic).FullName;

            List <IAction> actions    = new List <IAction>();
            MenuAction     hideAction = new MenuAction(@namespace + ":toggle", new ActionPath(site + "/MenuShowAnalysis", resolver), ClickActionFlags.None, resolver);

            hideAction.GroupHint  = new GroupHint("Tools.Measurements.Display");
            hideAction.Label      = SR.MenuShowAnalysis;
            hideAction.Checked    = this.ShowAnalysis;
            hideAction.Persistent = true;
            hideAction.SetClickHandler(this.ToggleShowAnalysis);
            actions.Add(hideAction);

            if (AllowRename)
            {
                MenuAction renameAction = new MenuAction(@namespace + ":rename", new ActionPath(site + "/MenuRename", resolver), ClickActionFlags.None, resolver);
                renameAction.GroupHint  = new GroupHint("Tools.Measurements.Properties");
                renameAction.Label      = SR.MenuRename;
                renameAction.Persistent = true;
                renameAction.SetClickHandler(this.Rename);
                actions.Add(renameAction);
            }

            IActionSet actionSet = new ActionSet(actions);

            if (this.ShowAnalysis)
            {
                var analyzerActionSets = GetAnalyzersExportedActions(site, mouseInformation);

                if (analyzerActionSets != null)
                {
                    foreach (var set in analyzerActionSets)
                    {
                        actionSet = actionSet.Union(set);
                    }
                }
            }

            IActionSet other = base.GetExportedActions(site, mouseInformation);

            if (other != null)
            {
                actionSet = actionSet.Union(other);
            }

            return(actionSet);
        }
        /// <summary>
        /// Passes user input to the builder when <see cref="IMouseButtonHandler.Start"/> is called on the owning tool.
        /// </summary>
        /// <param name="mouseInformation">The user input data.</param>
        /// <returns>True if the builder did something as a result of the call, and hence would like to receive capture; False otherwise.</returns>
        public override bool Start(IMouseInformation mouseInformation)
        {
            if (mouseInformation.ClickCount == 2 && StopOnDoubleClick && _numberOfPointsAnchored >= _minimumVertices)
            {
                NotifyGraphicComplete();
                return(true);
            }

            _numberOfPointsAnchored++;

            // We just started creating
            if (_numberOfPointsAnchored == 1)
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
                this.Graphic.Points.Add(mouseInformation.Location);
                this.Graphic.Points.Add(mouseInformation.Location);
                this.Graphic.ResetCoordinateSystem();
                point = mouseInformation.Location;
            }
            // We're done creating
            else if (_numberOfPointsAnchored == _maximumVertices)
            {
                // When user moves very quickly and events are filtered for performance purpose (eg web viewer case),
                // the final point may not be the same as the last tracked point. Must update the final point based on the latest mouse position.

                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;

                //this.Graphic.Points[this.Graphic.Points.Count-1] = mouseInformation.Location;
                this.Graphic.Points[this.Graphic.Points.Count - 1] = new Point(mouseInformation.Location.X, point.Y);
                this.Graphic.ResetCoordinateSystem();

                this.NotifyGraphicComplete();
            }
            // We're in the middle of creating
            else
            {
                this.Graphic.CoordinateSystem = CoordinateSystem.Destination;

                // Update the final position of current point based on the latest mouse position.
                //this.Graphic.Points[Graphic.Points.Count-1] = mouseInformation.Location;
                this.Graphic.Points[this.Graphic.Points.Count - 1] = new Point(mouseInformation.Location.X, point.Y);

                // Add a new point for tracking
                this.Graphic.Points.Add(mouseInformation.Location);
                this.Graphic.ResetCoordinateSystem();
            }

            return(true);
        }
Esempio n. 48
0
		private IEnumerable<IActionSet> GetAnalyzersExportedActions(string site, IMouseInformation mouseInformation)
		{
			var actionSets = new List<IActionSet>();
			foreach (var analyzer in _roiAnalyzers)
			{
				if (analyzer is IExportedActionsProvider)
				{
					var actionProvider = analyzer as IExportedActionsProvider;
					var actions = actionProvider.GetExportedActions(site, mouseInformation);
					actionSets.Add(actions);
				}
			}

			return actionSets;
		}
Esempio n. 49
0
        public override bool Stop(IMouseInformation mouseInformation)
        {
            if (!Enabled)
            {
                return(false);
            }

            if (_graphicBuilder != null && _graphicBuilder.Stop(mouseInformation))
            {
                _primitiveGraphic.Draw();
                return(true);
            }

            return(false);
        }
Esempio n. 50
0
		public override bool Start(IMouseInformation mouseInformation)
		{
		 	base.Start(mouseInformation);

			IPresentationImage selectedImage = this.Context.Viewer.SelectedPresentationImage;

			vtkGenericRenderWindowInteractor interactor = GetInteractor(selectedImage);

			if (interactor == null)
				return false;

			interactor.SetEventPositionFlipY(mouseInformation.Location.X, mouseInformation.Location.Y);
			interactor.RightButtonPressEvent();

			return true;
		}
		public override bool Start(IMouseInformation mouseInformation)
		{
			if (clickIndex == 0)
			{
				this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
				this.Graphic.AnchorPoint = mouseInformation.Location;
				this.Graphic.TextLocation = mouseInformation.Location;
				this.Graphic.ResetCoordinateSystem();
			}
			else if (clickIndex == 1)
			{
				this.NotifyGraphicComplete();
			}
			else
			{
				return false;
			}

			clickIndex++;
			return true;
		}
        public PriorityMouseInfomrmation( IMouseInformation mouseInfomration )
        {
            this.MouseInformation = mouseInfomration;

            this.MouseInformation.LeftButtonClicked.
                Subscribe( mouseState => this.ExecuteOnTopOfStack( s => s.LeftButtonClickedSubject.OnNext( mouseState ) ) );

            this.MouseInformation.LeftButtonPressed.
                Subscribe( mouseState => this.ExecuteOnTopOfStack( s => s.LeftButtonPressedSubject.OnNext( mouseState ) ) );

            this.MouseInformation.LeftButtonRelease.
                Subscribe( mouseState => this.ExecuteOnTopOfStack( s => s.LeftButtonReleaseSubject.OnNext( mouseState ) ) );

            this.MouseInformation.MousePositionChanged.
                Subscribe( mouseState => this.ExecuteOnTopOfStack( s => s.MousePositionChangedSubject.OnNext( mouseState ) ) );

            this.MouseInformation.ScrollWheelChanged
                .Subscribe( mousState => this.ExecuteOnTopOfStack( s => s.ScrollWheelValueDeltaSubject.OnNext( mousState ) ) );

            this.MouseInformation.DoubleClick
                .Subscribe( mousState => this.ExecuteOnTopOfStack( s => s.DoubleClickedSubject.OnNext( mousState ) ) );
        }
Esempio n. 53
0
 public ActionModelNode GetContextMenuModel(IMouseInformation mouseInformation)
 {
     return _actionModel;
 }
Esempio n. 54
0
		/// <summary>
		/// Gets a set of exported <see cref="IAction"/>s.
		/// </summary>
		/// <param name="site">The action model site at which the actions should reside.</param>
		/// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
		/// <returns>A set of exported <see cref="IAction"/>s.</returns>
		public virtual IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
		{
			if (_textControlGraphic.HitTest(mouseInformation.Location))
				return _textControlGraphic.GetExportedActions(site, mouseInformation);
			if (_pointControlGraphic.HitTest(mouseInformation.Location))
				return _pointControlGraphic.GetExportedActions(site, mouseInformation);
			return new ActionSet();
		}
Esempio n. 55
0
		/// <summary>
		/// Called by the framework when the mouse button is released.
		/// </summary>
		/// <returns>
		/// True if the framework should <b>not</b> release capture, otherwise false.
		/// </returns>
		bool IMouseButtonHandler.Stop(IMouseInformation mouseInformation)
		{
			return _textControlGraphic.Stop(mouseInformation) || _pointControlGraphic.Stop(mouseInformation);
		}
		/// <summary>
		/// Passes user input to the builder when <see cref="IMouseButtonHandler.Stop"/> is called on the owning tool.
		/// </summary>
		/// <param name="mouseInformation">The user input data.</param>
		/// <returns>True if the tool should not release capture; False otherwise.</returns>
		public override bool Stop(IMouseInformation mouseInformation)
		{
			return true;
		}
		/// <summary>
		/// Passes user input to the builder when <see cref="IMouseButtonHandler.Track"/> is called on the owning tool.
		/// </summary>
		/// <param name="mouseInformation">The user input data.</param>
		/// <returns>True if the builder handled the message; False otherwise.</returns>
		public override bool Track(IMouseInformation mouseInformation)
		{
			this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
			try
			{
				this.Graphic.BottomRight = mouseInformation.Location;
			}
			finally
			{
				this.Graphic.ResetCoordinateSystem();
			}

			this.Graphic.Draw();
			return true;
		}
Esempio n. 58
0
 public bool Stop(IMouseInformation mouseInformation)
 {
     return false;
 }
Esempio n. 59
0
 public bool Track(IMouseInformation mouseInformation)
 {
     return false;
 }
Esempio n. 60
0
        private IEnumerable<IActionSet> GetAnalyzersExportedActions(string site, IMouseInformation mouseInformation)
        {
            var actionSets = new List<IActionSet>();
            foreach(var analyzer in _roiAnalyzers)
            {
                if (analyzer is IExportedActionsProvider)
                {
                    var actionProvider = analyzer as IExportedActionsProvider;
                    var actions = actionProvider.GetExportedActions(site, mouseInformation);
                    actionSets.Add(actions);
                }   
            }

            return actionSets;
        }