Exemplo n.º 1
0
        protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
        {
            // Restore the property limits and collision detection flags before restoring the view's position and
            // orientation. This has the effect of ensuring that the view's position and orientation are consistent with the
            // current property limits and the current surface collision state.

            RestorableSupport.StateObject so = rs.getStateObject(context, "viewPropertyLimits");
            if (so != null)
            {
                this.getViewPropertyLimits().restoreState(rs, so);
            }

            Boolean b = rs.getStateValueAsBoolean(context, "detectCollisions");

            if (b != null)
            {
                this.setDetectCollisions(b);
            }

            Double d = rs.getStateValueAsDouble(context, "fieldOfView");

            if (d != null)
            {
                this.setFieldOfView(Angle.fromDegrees(d));
            }

            d = rs.getStateValueAsDouble(context, "nearClipDistance");
            if (d != null)
            {
                this.setNearClipDistance(d);
            }

            d = rs.getStateValueAsDouble(context, "farClipDistance");
            if (d != null)
            {
                this.setFarClipDistance(d);
            }

            Position p = rs.getStateValueAsPosition(context, "eyePosition");

            if (p != null)
            {
                this.setEyePosition(p);
            }

            d = rs.getStateValueAsDouble(context, "heading");
            if (d != null)
            {
                this.setHeading(Angle.fromDegrees(d));
            }

            d = rs.getStateValueAsDouble(context, "pitch");
            if (d != null)
            {
                this.setPitch(Angle.fromDegrees(d));
            }
        }