Beispiel #1
0
        private FGenJob CreateJob(FJobRequest fJobRequest)
        {
            PointDd start = new PointDd(new Dd(fJobRequest.Coords.StartX), new Dd(fJobRequest.Coords.StartY));
            PointDd end   = new PointDd(new Dd(fJobRequest.Coords.EndX), new Dd(fJobRequest.Coords.EndY));

            qdDotNet.SizeInt      samplePoints = new qdDotNet.SizeInt(fJobRequest.SamplePoints.W, fJobRequest.SamplePoints.H);
            qdDotNet.RectangleInt area         = new qdDotNet.RectangleInt(
                new qdDotNet.PointInt(fJobRequest.Area.Point.X, fJobRequest.Area.Point.Y),
                new qdDotNet.SizeInt(fJobRequest.Area.Size.W, fJobRequest.Area.Size.H));

            FGenJob fGenJob = new FGenJob(fJobRequest.JobId, start, end, samplePoints, fJobRequest.MaxIterations, area);

            return(fGenJob);
        }
Beispiel #2
0
        public FCoordsResult GetNewCoords(FJobRequest fJobRequest)
        {
            FCoordsResult result = null;

            if (fJobRequest.RequestType != FJobRequestType.TransformCoords)
            {
                throw new ArgumentException("The request type must be TransformCoords.");
            }

            if (!fJobRequest.TransformType.HasValue)
            {
                throw new ArgumentException("The transform type cannot be null.");
            }

            MCoordsDd curCoords = GetMCoords(fJobRequest.Coords);

            switch (fJobRequest.TransformType)
            {
            case TransformType.In:
                qdDotNet.SizeInt sizeInt = new qdDotNet.SizeInt(fJobRequest.SamplePoints.W, fJobRequest.SamplePoints.H);

                qdDotNet.RectangleInt area = new qdDotNet.RectangleInt(
                    new qdDotNet.PointInt(fJobRequest.Area.Point.X, fJobRequest.Area.Point.Y),
                    new qdDotNet.SizeInt(fJobRequest.Area.Size.W, fJobRequest.Area.Size.H));

                MCoordsDd newCoords = _fCoordsMath.ZoomIn(curCoords, sizeInt, area);
                result = GetResult(fJobRequest.JobId, newCoords);
                break;

            case TransformType.Out:
                double amount = GetAmount(fJobRequest.Area.Point.X);
                newCoords = _fCoordsMath.ZoomOut(curCoords, amount);
                result    = GetResult(fJobRequest.JobId, newCoords);
                break;

            case TransformType.Right:
                amount    = GetAmount(fJobRequest.Area.Point.X);
                newCoords = _fCoordsMath.ShiftRight(curCoords, amount);
                result    = GetResult(fJobRequest.JobId, newCoords);
                break;

            case TransformType.Left:
                amount    = GetAmount(fJobRequest.Area.Point.X);
                newCoords = _fCoordsMath.ShiftRight(curCoords, -amount);
                result    = GetResult(fJobRequest.JobId, newCoords);
                break;

            case TransformType.Down:
                amount    = GetAmount(fJobRequest.Area.Point.X);
                newCoords = _fCoordsMath.ShiftUp(curCoords, -amount);
                result    = GetResult(fJobRequest.JobId, newCoords);
                break;

            case TransformType.Up:
                amount    = GetAmount(fJobRequest.Area.Point.X);
                newCoords = _fCoordsMath.ShiftUp(curCoords, amount);
                result    = GetResult(fJobRequest.JobId, newCoords);
                break;

            default:
                Debug.WriteLine($"Transform Type: {fJobRequest.TransformType} is not supported.");
                break;
            }

            return(result);
        }