Beispiel #1
0
        /// <summary>
        /// 计算放大区域,并进行放大
        /// </summary>
        /// <param name="zoomRectangle"></param>
        private void CalRealZoomRect(Rectangle zoomRectangle)
        {
            if (zoomRectangle.Width != 0 & zoomRectangle.Height != 0)
            {
                if (firstZoom)
                {
                    ima.DisplayZoneMin[0] = zoomRectangle.X / (float)(Width - 1);
                    ima.DisplayZoneMin[1] = zoomRectangle.Y / (float)(Height - 1);
                    ima.DisplayZoneMax[0] = (zoomRectangle.X + zoomRectangle.Width - 1) / (float)(Width - 1);
                    ima.DisplayZoneMax[1] = (zoomRectangle.Y + zoomRectangle.Height - 1) / (float)(Height - 1);
                    wt = ima.DisplayZoneMax[0] - ima.DisplayZoneMin[0];
                    ht = ima.DisplayZoneMax[1] - ima.DisplayZoneMin[1];
                }
                else
                {
                    ima.DisplayZoneMax[0]  = (zoomRectangle.X + zoomRectangle.Width - 1) / (float)(Width - 1) * wt + ima.DisplayZoneMin[0];
                    ima.DisplayZoneMax[1]  = (zoomRectangle.Y + zoomRectangle.Height - 1) / (float)(Height - 1) * ht + ima.DisplayZoneMin[1];
                    ima.DisplayZoneMin[0] += zoomRectangle.X / (float)(Width - 1) * wt;
                    ima.DisplayZoneMin[1] += zoomRectangle.Y / (float)(Height - 1) * ht;
                    wt = ima.DisplayZoneMax[0] - ima.DisplayZoneMin[0];
                    ht = ima.DisplayZoneMax[1] - ima.DisplayZoneMin[1];
                }

                RangeChange?.Invoke(new float[] {
                    (float)(ima.x0 + ima.xw * ima.DisplayZoneMin[0]),
                    (float)(ima.x0 + ima.xw * ima.DisplayZoneMax[0]),
                    (float)(ima.y1 - ima.yh * ima.DisplayZoneMax[1]),
                    (float)(ima.y1 - ima.yh * ima.DisplayZoneMin[1])
                });

                firstZoom = false;
                ima.Refresh(true);
                Invalidate();
            }
        }
Beispiel #2
0
        private void longStripToolLayout1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 32)
            {
                ima.DisplayZoneMin = new double[2] {
                    0, 0
                };
                ima.DisplayZoneMax = new double[2] {
                    1, 1
                };

                firstZoom = true;

                StartX = ima.x0;
                EndX   = ima.x1;
                StartY = ima.y0;
                EndY   = ima.y1;

                RangeChange?.Invoke(new float[] {
                    ima.x0, ima.x1, ima.y0, ima.y1
                });
                UpdataDataAndState(-1, 0);
                Invalidate();
            }
        }
Beispiel #3
0
        private void Plot2D_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ima.Refresh(true);
            //ima.inputData.ReSet();

            ima.DisplayZoneMin = new double[2] {
                0, 0
            };
            ima.DisplayZoneMax = new double[2] {
                1, 1
            };
            ima.Refresh(true);
            firstZoom = true;

            RangeChange?.Invoke(new float[] { ima.x0, ima.x1, ima.y0, ima.y1 });
        }
Beispiel #4
0
        private void FitRange(RangeChange change)
        {
            var min = this.Minimum;
            var max = this.Maximum;

            if (max < min)
            {
                if (change == RangeChange.Min)
                {
                    min = max;
                    this.ChangePropertyInternally(MinimumProperty, min);
                }
                else if (change == RangeChange.Max)
                {
                    max = min;
                    this.ChangePropertyInternally(MaximumProperty, max);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// 用来重置图片,等于按了一次空格键
        /// </summary>
        public void Reset()
        {
            ima.DisplayZoneMin = new double[2] {
                0, 0
            };
            ima.DisplayZoneMax = new double[2] {
                1, 1
            };

            firstZoom = true;

            StartX = ima.x0;
            EndX   = ima.x1;
            StartY = ima.y0;
            EndY   = ima.y1;

            RangeChange?.Invoke(new float[] {
                ima.x0, ima.x1, ima.y0, ima.y1
            });
            Invalidate();
        }
Beispiel #6
0
 private void CalRealZoomRect(float[] rectangle)
 {
     CalRealZoomRect(new Rectangle((int)rectangle[4], (int)rectangle[5], (int)rectangle[6], (int)rectangle[7]));
     RangeChange?.Invoke(new float[] { rectangle[0], rectangle[1], rectangle[2], rectangle[3] });
 }