/** * Restores the state of any offset parameters contained in the specified <code>RestorableSupport</code>. If the * <code>StateObject</code> is not <code>null</code> it's searched for state values, otherwise the * <code>RestorableSupport</code> root is searched. * * @param restorableSupport the <code>RestorableSupport</code> that contains the offset's state. * @param context the <code>StateObject</code> to search for state values, if not <code>null</code>. * * @throws ArgumentException if <code>restorableSupport</code> is <code>null</code>. */ public void restoreState(RestorableSupport restorableSupport, RestorableSupport.StateObject context) { if (restorableSupport == null) { String message = Logging.getMessage("nullValue.RestorableSupportIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } Double d = restorableSupport.getStateValueAsDouble(context, "x"); if (d != null) { this.setX(d); } d = restorableSupport.getStateValueAsDouble(context, "y"); if (d != null) { this.setY(d); } String s = restorableSupport.getStateValueAsString(context, "xUnits"); if (s != null) { this.setXUnits(s); } s = restorableSupport.getStateValueAsString(context, "yUnits"); if (s != null) { this.setYUnits(s); } }
public Material restoreState(RestorableSupport rs, RestorableSupport.StateObject so) { double shininess = this.getShininess(); Double d = rs.getStateValueAsDouble(so, "shininess"); if (d != null) { shininess = d; } String as = rs.getStateValueAsString(so, "ambient"); Color ambient = RestorableSupport.decodeColor(as); if (ambient == null) { ambient = this.getAmbient(); } String ds = rs.getStateValueAsString(so, "diffuse"); Color diffuse = RestorableSupport.decodeColor(ds); if (diffuse == null) { diffuse = this.getDiffuse(); } String ss = rs.getStateValueAsString(so, "specular"); Color specular = RestorableSupport.decodeColor(ss); if (specular == null) { specular = this.getSpecular(); } String es = rs.getStateValueAsString(so, "emission"); Color emission = RestorableSupport.decodeColor(es); if (emission == null) { emission = this.getEmission(); } return(new Material(specular, diffuse, ambient, emission, (float)shininess)); }
/** * Restores the state of any size parameters contained in the specified <code>RestorableSupport</code>. If the * <code>StateObject</code> is not <code>null</code> it's searched for state values, otherwise the * <code>RestorableSupport</code> root is searched. * * @param restorableSupport the <code>RestorableSupport</code> that contains the size's state. * @param context the <code>StateObject</code> to search for state values, if not <code>null</code>. * * @throws ArgumentException if <code>restorableSupport</code> is <code>null</code>. */ public void restoreState(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.getStateObject(context, "width"); if (so != null) { String mode = restorableSupport.getStateValueAsString(so, "mode"); mode = convertLegacyModeString(mode); Double param = restorableSupport.getStateValueAsDouble(so, "param"); String units = restorableSupport.getStateValueAsString(so, "units"); // Restore the width only when the mode and param are specified. null is an acceptable value for units. if (mode != null && param != null) { this.setWidth(mode, param, units); } } so = restorableSupport.getStateObject(context, "height"); if (so != null) { String mode = restorableSupport.getStateValueAsString(so, "mode"); mode = convertLegacyModeString(mode); Double param = restorableSupport.getStateValueAsDouble(so, "param"); String units = restorableSupport.getStateValueAsString(so, "units"); // Restore the height only when the mode and param are specified. null is an acceptable value for units. if (mode != null && param != null) { this.setHeight(mode, param, units); } } }
protected static void wcsRestoreStateForParams(RestorableSupport rs, RestorableSupport.StateObject context, AVList parameters) { // Invoke the BasicElevationModel functionality. restoreStateForParams(rs, null, parameters); String s = rs.getStateValueAsString(context, AVKey.IMAGE_FORMAT); if (s != null) { parameters.setValue(AVKey.IMAGE_FORMAT, s); } s = rs.getStateValueAsString(context, AVKey.TITLE); if (s != null) { parameters.setValue(AVKey.TITLE, s); } s = rs.getStateValueAsString(context, AVKey.DISPLAY_NAME); if (s != null) { parameters.setValue(AVKey.DISPLAY_NAME, s); } RestorableSupport.adjustTitleAndDisplayName(parameters); s = rs.getStateValueAsString(context, AVKey.COVERAGE_IDENTIFIERS); if (s != null) { parameters.setValue(AVKey.COVERAGE_IDENTIFIERS, s); } s = rs.getStateValueAsString(context, AVKey.WCS_VERSION); if (s != null) { parameters.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(s, parameters)); } }
protected static void wmsRestoreStateToParams(RestorableSupport rs, RestorableSupport.StateObject context, AVList parameters) { // Invoke the BasicTiledImageLayer functionality. restoreStateForParams(rs, context, parameters); // Parse any legacy WMSTiledImageLayer state values. legacyWmsRestoreStateToParams(rs, context, parameters); String s = rs.getStateValueAsString(context, AVKey.IMAGE_FORMAT); if (s != null) { parameters.setValue(AVKey.IMAGE_FORMAT, s); } s = rs.getStateValueAsString(context, AVKey.TITLE); if (s != null) { parameters.setValue(AVKey.TITLE, s); } s = rs.getStateValueAsString(context, AVKey.DISPLAY_NAME); if (s != null) { parameters.setValue(AVKey.DISPLAY_NAME, s); } RestorableSupport.adjustTitleAndDisplayName(params); s = rs.getStateValueAsString(context, AVKey.LAYER_NAMES); if (s != null) { parameters.setValue(AVKey.LAYER_NAMES, s); } s = rs.getStateValueAsString(context, AVKey.STYLE_NAMES); if (s != null) { parameters.setValue(AVKey.STYLE_NAMES, s); } s = rs.getStateValueAsString(context, "wms.Version"); if (s != null) { parameters.setValue(AVKey.WMS_VERSION, s); } parameters.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(parameters)); }
/** {@inheritDoc} */ public void restoreState(RestorableSupport rs, RestorableSupport.StateObject so) { if (rs == null) { String message = Logging.getMessage("nullValue.RestorableSupportIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } Boolean b = rs.getStateValueAsBoolean(so, "drawInterior"); if (b != null) { this.setDrawInterior(b); } b = rs.getStateValueAsBoolean(so, "drawOutline"); if (b != null) { this.setDrawOutline(b); } b = rs.getStateValueAsBoolean(so, "enableAntialiasing"); if (b != null) { this.setEnableAntialiasing(b); } b = rs.getStateValueAsBoolean(so, "enableLighting"); if (b != null) { this.setEnableLighting(b); } RestorableSupport.StateObject mo = rs.getStateObject(so, "interiorMaterial"); if (mo != null) { this.setInteriorMaterial(this.getInteriorMaterial().restoreState(rs, mo)); } mo = rs.getStateObject(so, "outlineMaterial"); if (mo != null) { this.setOutlineMaterial(this.getOutlineMaterial().restoreState(rs, mo)); } Double d = rs.getStateValueAsDouble(so, "interiorOpacity"); if (d != null) { this.setInteriorOpacity(d); } d = rs.getStateValueAsDouble(so, "outlineOpacity"); if (d != null) { this.setOutlineOpacity(d); } d = rs.getStateValueAsDouble(so, "outlineWidth"); if (d != null) { this.setOutlineWidth(d); } Integer i = rs.getStateValueAsInteger(so, "outlineStippleFactor"); if (i != null) { this.setOutlineStippleFactor(i); } i = rs.getStateValueAsInteger(so, "outlineStipplePattern"); if (i != null) { this.setOutlineStipplePattern(i.shortValue()); } String s = rs.getStateValueAsString(so, "interiorImagePath"); if (s != null) { this.setImageSource(s); } d = rs.getStateValueAsDouble(so, "interiorImageScale"); if (d != null) { this.setImageScale(d); } }