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));
      }
    }
  }
  /**
   * Overridden to clear the multi-polygon's boundary list upon an unsuccessful tessellation
   * attempt. This ensures the multi-polygon won't attempt to re-tessellate itself each frame.
   *
   * @param dc the current DrawContext.
   */
  @Override
  protected void handleUnsuccessfulInteriorTessellation(DrawContext dc) {
    super.handleUnsuccessfulInteriorTessellation(dc);

    // If tessellating the multi-polygon's interior was unsuccessful, we clear the boundary list to
    // avoid any
    // additional tessellation attempts and free any resources that the multi-polygon won't use.
    this.boundaries.removeAllContours();
    this.onShapeChanged();
  }
  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();
    }
  }