示例#1
0
        public void Zoom(float factor, bool updateView)
        {
            nzy3D.Maths.Scale current = this.Scale;
            double            range   = current.Max - current.Min;

            if (range <= 0)
            {
                return;
            }
            double center = (current.Max + current.Min) / 2;
            double zmin   = center + (current.Min - center) * factor;
            double zmax   = center + (current.Max - center) * factor;

            // set min/max according to bounds
            nzy3D.Maths.Scale scale = null;
            if ((zmin < zmax))
            {
                scale = new nzy3D.Maths.Scale(zmin, zmax);
            }
            else
            {
                // forbid to have zmin = zmax if we zoom in
                if ((factor < 1))
                {
                    scale = new nzy3D.Maths.Scale(center, center);
                }
            }
            if ((scale != null))
            {
                setScale(scale, updateView);
                // fireControllerEvent(ControllerType.ZOOM, scale);
            }
        }
示例#2
0
 public void Shift(float factor, bool updateView)
 {
     nzy3D.Maths.Scale current  = this.Scale;
     nzy3D.Maths.Scale newScale = current.@add(factor * current.Range);
     setScale(newScale, updateView);
     //fireControllerEvent(ControllerType.SHIFT, newScale);
 }
示例#3
0
        public void setScale(nzy3D.Maths.Scale scale, bool notify)
        {
            BoundingBox3d bounds = this.Bounds;

            bounds.zmin      = scale.Min;
            bounds.zmax      = scale.Max;
            this.BoundManual = bounds;
            if (notify)
            {
                Shoot();
            }
        }
示例#4
0
        public void ZoomZ(float factor, bool updateView)
        {
            double range = this.Bounds.zmax - this.Bounds.zmin;

            if (range <= 0)
            {
                return;
            }
            double center = (this.Bounds.zmax + this.Bounds.zmin) / 2;
            double min    = center + (this.Bounds.zmin - center) * factor;
            double max    = center + (this.Bounds.zmax - center) * factor;

            // set min/max according to bounds
            nzy3D.Maths.Scale scale = null;
            if ((min < max))
            {
                scale = new nzy3D.Maths.Scale(min, max);
            }
            else
            {
                // forbid to have min = max if we zoom in
                if ((factor < 1))
                {
                    scale = new nzy3D.Maths.Scale(center, center);
                }
            }
            if ((scale != null))
            {
                BoundingBox3d bounds = this.Bounds;
                bounds.zmin      = scale.Min;
                bounds.zmax      = scale.Max;
                this.BoundManual = bounds;
                if (updateView)
                {
                    Shoot();
                }
                // fireControllerEvent(ControllerType.ZOOM, scale);
            }
        }