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. 2
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);
  }