@Override
  protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doGetRestorableState(rs, context);

    rs.addStateValueAsDouble(context, "leftAzimuthDegrees", this.leftAzimuth.degrees);
    rs.addStateValueAsDouble(context, "rightAzimuthDegrees", this.rightAzimuth.degrees);
  }
Esempio n. 2
0
  @Override
  protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doGetRestorableState(rs, context);

    rs.addStateValueAsBoolean(context, "enableCaps", this.enableCaps);

    if (this.locations != null) rs.addStateValueAsLatLonList(context, "locations", this.locations);
  }
  protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doGetRestorableState(rs, context);

    Iterable<? extends LatLon> iterable = this.getLocations();
    if (iterable != null) rs.addStateValueAsLatLonList(context, "locationList", iterable);

    rs.addStateValueAsBoolean(context, "closed", this.isClosed());
  }
 protected void doGetRestorableStateForAVPair(
     String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context) {
   if (value instanceof URLBuilder) {
     rs.addStateValueAsString(context, "wms.Version", ((URLBuilder) value).wmsVersion);
     rs.addStateValueAsString(context, "wms.Crs", ((URLBuilder) value).crs);
   } else {
     super.doGetRestorableStateForAVPair(key, value, rs, context);
   }
 }
  protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doRestoreState(rs, context);

    Iterable<LatLon> iterable = rs.getStateValueAsLatLonList(context, "locationList");
    if (iterable != null) this.setLocations(iterable);

    Boolean b = rs.getStateValueAsBoolean(context, "closed");
    if (b != null) this.setClosed(b);
  }
Esempio n. 6
0
  @Override
  protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doRestoreState(rs, context);

    Boolean booleanState = rs.getStateValueAsBoolean(context, "enableCaps");
    if (booleanState != null) this.setEnableCaps(booleanState);

    List<LatLon> locations = rs.getStateValueAsLatLonList(context, "locations");
    if (locations != null) this.setLocations(locations);
  }
  protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doGetRestorableState(rs, context);

    if (this.boundaries.getContourCount() > 0) {
      RestorableSupport.StateObject so = rs.addStateObject(context, "boundaries");
      for (int i = 0; i < this.boundaries.getContourCount(); i++) {
        rs.addStateValueAsLatLonList(so, "boundary", this.boundaries.getContour(i));
      }
    }
  }
Esempio n. 8
0
  @Override
  protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doGetRestorableState(rs, context);

    RestorableSupport.StateObject so = rs.addStateObject(context, "layers");
    for (Layer layer : this.layers) {
      RestorableSupport.StateObject lso = rs.addStateObject(so, "layer");
      layer.doGetRestorableState(rs, lso);
    }
  }
  @Override
  protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doRestoreState(rs, context);

    Double la = rs.getStateValueAsDouble(context, "leftAzimuthDegrees");
    if (la == null) la = this.leftAzimuth.degrees;

    Double ra = rs.getStateValueAsDouble(context, "rightAzimuthDegrees");
    if (ra == null) ra = this.rightAzimuth.degrees;

    this.setAzimuths(Angle.fromDegrees(la), Angle.fromDegrees(ra));
  }
  protected static void wmsRestoreStateToParams(
      RestorableSupport rs, RestorableSupport.StateObject context, AVList params) {
    // Invoke the BasicTiledImageLayer functionality.
    restoreStateForParams(rs, context, params);
    // Parse any legacy WMSTiledImageLayer state values.
    legacyWmsRestoreStateToParams(rs, context, params);

    String s = rs.getStateValueAsString(context, AVKey.IMAGE_FORMAT);
    if (s != null) params.setValue(AVKey.IMAGE_FORMAT, s);

    s = rs.getStateValueAsString(context, AVKey.TITLE);
    if (s != null) params.setValue(AVKey.TITLE, s);

    s = rs.getStateValueAsString(context, AVKey.DISPLAY_NAME);
    if (s != null) params.setValue(AVKey.DISPLAY_NAME, s);

    RestorableSupport.adjustTitleAndDisplayName(params);

    s = rs.getStateValueAsString(context, AVKey.LAYER_NAMES);
    if (s != null) params.setValue(AVKey.LAYER_NAMES, s);

    s = rs.getStateValueAsString(context, AVKey.STYLE_NAMES);
    if (s != null) params.setValue(AVKey.STYLE_NAMES, s);

    s = rs.getStateValueAsString(context, "wms.Version");
    if (s != null) params.setValue(AVKey.WMS_VERSION, s);
    params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(params));
  }
  protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doRestoreState(rs, context);

    RestorableSupport.StateObject so = rs.getStateObject(context, "boundaries");
    if (so != null) {
      this.boundaries.removeAllContours();

      RestorableSupport.StateObject[] sos = rs.getAllStateObjects(so, "boundary");
      if (sos != null) {
        for (RestorableSupport.StateObject boundary : sos) {
          if (boundary == null) continue;

          Iterable<LatLon> locations = rs.getStateObjectAsLatLonList(boundary);
          if (locations != null) this.boundaries.addContour(locations);
        }
      }

      // We've changed the polygon's list of boundaries; flag the shape as changed.
      this.onShapeChanged();
    }
  }
Esempio n. 12
0
  @Override
  protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.doRestoreState(rs, context);

    RestorableSupport.StateObject so = rs.getStateObject(context, "layers");
    if (so == null) return;

    RestorableSupport.StateObject[] lsos = rs.getAllStateObjects(so, "layer");
    if (lsos == null || lsos.length == 0) return;

    ArrayList<Layer> layerList = new ArrayList<Layer>(lsos.length);

    for (RestorableSupport.StateObject lso : lsos) {
      if (lso != null) {
        Layer layer = new Layer();
        layer.doRestoreState(rs, lso);
        layerList.add(layer);
      }
    }

    this.setLayers(layerList);
  }
Esempio n. 13
0
  public void getRestorableStateForAVPair(
      String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context) {
    if (value == null) return;

    if (key.equals(PROPERTY_CHANGE_SUPPORT)) return;

    if (rs == null) {
      String message = Logging.getMessage("nullValue.RestorableStateIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    rs.addStateValueAsString(context, key, value.toString());
  }
  public WMSTiledImageLayer(String stateInXml) {
    this(wmsRestorableStateToParams(stateInXml));

    RestorableSupport rs;
    try {
      rs = RestorableSupport.parse(stateInXml);
    } catch (Exception e) {
      // Parsing the document specified by stateInXml failed.
      String message = Logging.getMessage("generic.ExceptionAttemptingToParseStateXml", stateInXml);
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message, e);
    }

    this.doRestoreState(rs, null);
  }
  protected static AVList wmsRestorableStateToParams(String stateInXml) {
    if (stateInXml == null) {
      String message = Logging.getMessage("nullValue.StringIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    RestorableSupport rs;
    try {
      rs = RestorableSupport.parse(stateInXml);
    } catch (Exception e) {
      // Parsing the document specified by stateInXml failed.
      String message = Logging.getMessage("generic.ExceptionAttemptingToParseStateXml", stateInXml);
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message, e);
    }

    AVList params = new AVListImpl();
    wmsRestoreStateToParams(rs, null, params);
    return params;
  }
  protected static void legacyWmsRestoreStateToParams(
      RestorableSupport rs, RestorableSupport.StateObject context, AVList params) {
    // WMSTiledImageLayer has historically used a different format for storing LatLon and Sector
    // properties
    // in the restorable state XML documents. Although WMSTiledImageLayer no longer writes these
    // properties,
    // we must provide support for reading them here.
    Double lat = rs.getStateValueAsDouble(context, AVKey.LEVEL_ZERO_TILE_DELTA + ".Latitude");
    Double lon = rs.getStateValueAsDouble(context, AVKey.LEVEL_ZERO_TILE_DELTA + ".Longitude");
    if (lat != null && lon != null)
      params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, LatLon.fromDegrees(lat, lon));

    Double minLat = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MinLatitude");
    Double minLon = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MinLongitude");
    Double maxLat = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MaxLatitude");
    Double maxLon = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MaxLongitude");
    if (minLat != null && minLon != null && maxLat != null && maxLon != null)
      params.setValue(AVKey.SECTOR, Sector.fromDegrees(minLat, maxLat, minLon, maxLon));
  }
  public void getRestorableState(RestorableSupport rs, RestorableSupport.StateObject so) {
    rs.addStateValueAsBoolean(so, "drawInterior", this.isDrawInterior());

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

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

    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.getInteriorImageSource() != null && this.getInteriorImageSource() instanceof String)
      rs.addStateValueAsString(so, "interiorImagePath", (String) this.getInteriorImageSource());

    rs.addStateValueAsDouble(so, "interiorImageScale", this.getInteriorImageScale());
  }
  protected void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context) {
    super.legacyRestoreState(rs, context);

    java.util.ArrayList<LatLon> locations = rs.getStateValueAsLatLonList(context, "locations");
    if (locations != null) this.setLocations(locations);
  }
  public void restoreState(RestorableSupport rs, RestorableSupport.StateObject so) {
    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);

    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.setInteriorImageSource(s);

    d = rs.getStateValueAsDouble(so, "interiorImageScale");
    if (d != null) this.setInteriorImageScale(d);
  }