예제 #1
0
        /**
         * Saves the size's current state in the specified <code>restorableSupport</code>. If <code>context</code> is not
         * <code>null</code>, the state is appended to it.  Otherwise the state is added to the
         * <code>RestorableSupport</code> root. This state can be restored later by calling {@link
         * #restoreState(gov.nasa.worldwind.util.RestorableSupport, SharpEarth.util.RestorableSupport.StateObject)}.
         *
         * @param restorableSupport the <code>RestorableSupport</code> that receives the size's state.
         * @param context           the <code>StateObject</code> the state is appended to, if not <code>null</code>.
         *
         * @throws ArgumentException if <code>restorableSupport</code> is <code>null</code>.
         */
        public void getRestorableState(RestorableSupport restorableSupport, RestorableSupport.StateObject context)
        {
            if (restorableSupport == null)
            {
                String message = Logging.getMessage("nullValue.RestorableSupportIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            RestorableSupport.StateObject so = restorableSupport.addStateObject(context, "width");
            if (so != null)
            {
                restorableSupport.addStateValueAsString(so, "mode", this.getWidthMode());
                restorableSupport.addStateValueAsDouble(so, "param", this.getWidth());

                if (this.getWidthUnits() != null)
                {
                    restorableSupport.addStateValueAsString(so, "units", this.getWidthUnits());
                }
            }

            so = restorableSupport.addStateObject(context, "height");
            if (so != null)
            {
                restorableSupport.addStateValueAsString(so, "mode", this.getHeightMode());
                restorableSupport.addStateValueAsDouble(so, "param", this.getHeight());

                if (this.getHeightUnits() != null)
                {
                    restorableSupport.addStateValueAsString(so, "units", this.getHeightUnits());
                }
            }
        }
예제 #2
0
        //**************************************************************//
        //******************** Restorable State  ***********************//
        //**************************************************************//

        protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
        {
            this.getViewPropertyLimits().getRestorableState(rs, rs.addStateObject(context, "viewPropertyLimits"));

            rs.addStateValueAsBoolean(context, "detectCollisions", this.isDetectCollisions());

            if (this.getFieldOfView() != null)
            {
                rs.addStateValueAsDouble(context, "fieldOfView", this.getFieldOfView().getDegrees());
            }

            rs.addStateValueAsDouble(context, "nearClipDistance", this.getNearClipDistance());
            rs.addStateValueAsDouble(context, "farClipDistance", this.getFarClipDistance());

            if (this.getEyePosition() != null)
            {
                rs.addStateValueAsPosition(context, "eyePosition", this.getEyePosition());
            }

            if (this.getHeading() != null)
            {
                rs.addStateValueAsDouble(context, "heading", this.getHeading().getDegrees());
            }

            if (this.getPitch() != null)
            {
                rs.addStateValueAsDouble(context, "pitch", this.getPitch().getDegrees());
            }
        }
예제 #3
0
        /** {@inheritDoc} */
        public void getRestorableState(RestorableSupport rs, RestorableSupport.StateObject so)
        {
            if (rs == null)
            {
                String message = Logging.getMessage("nullValue.RestorableSupportIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            rs.addStateValueAsBoolean(so, "drawInterior", this.isDrawInterior());

            rs.addStateValueAsBoolean(so, "drawOutline", this.isDrawOutline());

            rs.addStateValueAsBoolean(so, "enableAntialiasing", this.isEnableAntialiasing());

            rs.addStateValueAsBoolean(so, "enableLighting", this.isEnableLighting());

            this.getInteriorMaterial().getRestorableState(rs, rs.addStateObject(so, "interiorMaterial"));

            this.getOutlineMaterial().getRestorableState(rs, rs.addStateObject(so, "outlineMaterial"));

            rs.addStateValueAsDouble(so, "interiorOpacity", this.getInteriorOpacity());

            rs.addStateValueAsDouble(so, "outlineOpacity", this.getOutlineOpacity());

            rs.addStateValueAsDouble(so, "outlineWidth", this.getOutlineWidth());

            rs.addStateValueAsInteger(so, "outlineStippleFactor", this.getOutlineStippleFactor());

            rs.addStateValueAsInteger(so, "outlineStipplePattern", this.getOutlineStipplePattern());

            if (this.getImageSource() != null && this.getImageSource() is String)
            {
                rs.addStateValueAsString(so, "interiorImagePath", (String)this.getImageSource());
            }

            rs.addStateValueAsDouble(so, "interiorImageScale", this.getImageScale());
        }
예제 #4
0
        //**************************************************************//
        //******************** Restorable State  ***********************//
        //**************************************************************//

        protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
        {
            base.doGetRestorableState(rs, context);

            if (this.getCenterPosition() != null)
            {
                RestorableSupport.StateObject so = rs.addStateObject(context, "center");
                if (so != null)
                {
                    rs.addStateValueAsDouble(so, "latitude", this.getCenterPosition().getLatitude().degrees);
                    rs.addStateValueAsDouble(so, "longitude", this.getCenterPosition().getLongitude().degrees);
                    rs.addStateValueAsDouble(so, "elevation", this.getCenterPosition().getElevation());
                }
            }

            rs.addStateValueAsDouble(context, "zoom", this.getZoom());
        }