private void UpdateRotationAxis()
        {
            _rotationAxis = -1;

            IPresentationImage selectedImage = base.Context.Viewer.SelectedPresentationImage;

            if (selectedImage == null)
            {
                return;
            }

            MprDisplaySet displaySet = selectedImage.ParentDisplaySet as MprDisplaySet;

            if (displaySet == null)
            {
                return;
            }

            if (displaySet.Identifier == MprDisplaySetIdentifier.Identity)
            {
                _rotationAxis = 0;                 //x
            }
            else if (displaySet.Identifier == MprDisplaySetIdentifier.OrthoX)
            {
                _rotationAxis = 1;                 //y
            }
            else if (displaySet.Identifier == MprDisplaySetIdentifier.OrthoY)
            {
                _rotationAxis = 2;                 //z
            }
        }
Beispiel #2
0
 public ImageHint(IPresentationImage image)
 {
     if (image != null)
     {
         _displaySet = image.ParentDisplaySet as MprDisplaySet;
         if (_displaySet != null)
         {
             _imageIndex = _displaySet.PresentationImages.IndexOf(image);
         }
     }
 }
        public override bool Track(IMouseInformation mouseInformation)
        {
            if (_rotationAxis < 0)
            {
                return(base.Track(mouseInformation));
            }

            if (_rotatingGraphic)
            {
                _currentPinwheelGraphic.CoordinateSystem = CoordinateSystem.Destination;
                PointF rotationAnchor = _currentPinwheelGraphic.RotationAnchor;
                PointF vertex         = _currentPinwheelGraphic.Anchor;
                PointF mouse          = mouseInformation.Location;
                double angle          = Vector.SubtendedAngle(mouse, vertex, rotationAnchor);

                MprDisplaySet obliqueDisplaySet = base.GetObliqueDisplaySet();
                int           rotationX         = obliqueDisplaySet.RotateAboutX;
                int           rotationY         = obliqueDisplaySet.RotateAboutY;
                int           rotationZ         = obliqueDisplaySet.RotateAboutZ;

                if (_rotationAxis == 0)
                {
                    rotationX += (int)angle;
                    _currentPinwheelGraphic.Rotation = rotationX;
                }
                else if (_rotationAxis == 1)
                {
                    rotationY += (int)angle;
                    _currentPinwheelGraphic.Rotation = rotationY;
                }
                else
                {
                    rotationZ += (int)angle;
                    _currentPinwheelGraphic.Rotation = rotationZ;
                }

                _currentPinwheelGraphic.ResetCoordinateSystem();
                _currentPinwheelGraphic.Draw();

                obliqueDisplaySet.Rotate(rotationX, rotationY, rotationZ);
                return(true);
            }

            return(false);
        }
        private int GetRotationAngle()
        {
            MprDisplaySet obliqueDisplaySet = base.GetObliqueDisplaySet();
            int           rotationX         = obliqueDisplaySet.RotateAboutX;
            int           rotationY         = obliqueDisplaySet.RotateAboutY;
            int           rotationZ         = obliqueDisplaySet.RotateAboutZ;

            if (_rotationAxis == 0)
            {
                return(rotationX);
            }
            else if (_rotationAxis == 1)
            {
                return(rotationY);
            }
            else if (_rotationAxis == 2)
            {
                return(rotationZ);
            }

            return(0);
        }
        private void AddPinwheelGraphic()
        {
            IPresentationImage selectedImage = base.SelectedPresentationImage;

            if (selectedImage == null)
            {
                return;
            }

            if (!base.IsMprImage(selectedImage))
            {
                return;
            }

            MprDisplaySet displaySet = (MprDisplaySet)selectedImage.ParentDisplaySet;

            if (displaySet.Identifier == MprDisplaySetIdentifier.Oblique)
            {
                return;
            }

            IOverlayGraphicsProvider overlayProvider      = selectedImage as IOverlayGraphicsProvider;
            IImageGraphicProvider    imageGraphicProvider = selectedImage as IImageGraphicProvider;

            if (overlayProvider != null && imageGraphicProvider != null)
            {
                _currentPinwheelGraphic = new PinwheelGraphic();

                int width  = imageGraphicProvider.ImageGraphic.Columns;
                int height = imageGraphicProvider.ImageGraphic.Rows;

                overlayProvider.OverlayGraphics.Add(_currentPinwheelGraphic);
                _currentPinwheelGraphic.CoordinateSystem = CoordinateSystem.Source;
                _currentPinwheelGraphic.Rotation         = GetRotationAngle();
                _currentPinwheelGraphic.Draw();
            }
        }