Exemple #1
0
        public View(Scene scene, ICanvas canvas, Quality quality)
        {
            BoundingBox3d sceneBounds = scene.Graph.Bounds;

            _viewpoint  = (Coord3d)DEFAULT_VIEW.Clone();
            _center     = (Coord3d)sceneBounds.getCenter();
            _scaling    = (Coord3d)Coord3d.IDENTITY.Clone();
            _viewmode   = ViewPositionMode.FREE;
            _boundmode  = ViewBoundMode.AUTO_FIT;
            _cameraMode = CameraMode.ORTHOGONAL;
            _axe        = (IAxe)AxeFactory.getInstance(sceneBounds, this);
            _cam        = CameraFactory.getInstance(_center);
            _scene      = scene;
            _canvas     = canvas;
            _quality    = quality;
            _renderers  = new List <IRenderer2D>();
            //_tooltips = New List(Of ITooltipRenderer)
            _bgViewport                = new ImageViewport();
            _viewOnTopListeners        = new List <IViewIsVerticalEventListener>();
            _viewPointChangedListeners = new List <IViewPointChangedListener>();
            _wasOnTopAtLastRendering   = false;
            //_overlay = New Overlay
            View.Current = this;
        }
Exemple #2
0
        internal void correctCameraPositionForIncludingTextLabels(ViewPort viewport)
        {
            _cam.SetViewPort(viewport);
            _cam.shoot(_cameraMode);
            _axe.Draw(_cam);
            Clear();
            AxeBox        abox      = (AxeBox)_axe;
            BoundingBox3d newBounds = abox.WholeBounds.scale(_scaling);

            if (_viewmode == Modes.ViewPositionMode.TOP)
            {
                float radius = (float)Math.Max(newBounds.xmax - newBounds.xmin, newBounds.ymax - newBounds.ymin);
                radius += radius * STRETCH_RATIO;
                _cam.RenderingSphereRadius = radius;
            }
            else
            {
                _cam.RenderingSphereRadius = (float)newBounds.getRadius();
                Coord3d target = newBounds.getCenter();
                Coord3d eye    = _viewpoint.cartesian().@add(target);
                _cam.Target = target;
                _cam.Eye    = eye;
            }
        }
Exemple #3
0
 /// <summary>
 /// Set the surrounding AxeBox dimensions and the Camera target, and the
 /// colorbar range.
 /// </summary>
 public void lookToBox(BoundingBox3d box)
 {
     _center = box.getCenter();
     _axe.setAxe(box);
     _targetBox = box;
 }