コード例 #1
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);
  }
コード例 #2
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);
  }
コード例 #3
0
ファイル: Cake.java プロジェクト: cicean/Comp504-FinalProject
  @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);
    }
  }
コード例 #4
0
ファイル: Cake.java プロジェクト: cicean/Comp504-FinalProject
  protected void doMoveTo(Position oldRef, Position newRef) {
    if (oldRef == null) {
      String message = "nullValue.OldRefIsNull";
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }
    if (newRef == null) {
      String message = "nullValue.NewRefIsNull";
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    super.doMoveTo(oldRef, newRef);

    for (Layer l : this.layers) {
      l.doMoveTo(oldRef, newRef);
    }

    this.setExtentOutOfDate();
  }
コード例 #5
0
ファイル: Cake.java プロジェクト: cicean/Comp504-FinalProject
  @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);
  }
コード例 #6
0
  protected void doMoveTo(Position oldRef, Position newRef) {
    if (oldRef == null) {
      String message = "nullValue.OldRefIsNull";
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }
    if (newRef == null) {
      String message = "nullValue.NewRefIsNull";
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    super.doMoveTo(oldRef, newRef);

    int count = this.locations.size();
    LatLon[] newLocations = new LatLon[count];
    for (int i = 0; i < count; i++) {
      LatLon ll = this.locations.get(i);
      double distance = LatLon.greatCircleDistance(oldRef, ll).radians;
      double azimuth = LatLon.greatCircleAzimuth(oldRef, ll).radians;
      newLocations[i] = LatLon.greatCircleEndPosition(newRef, azimuth, distance);
    }
    this.setLocations(Arrays.asList(newLocations));
  }
コード例 #7
0
ファイル: Cake.java プロジェクト: cicean/Comp504-FinalProject
 public void setTerrainConforming(boolean lowerTerrainConformant, boolean upperTerrainConformant) {
   super.setTerrainConforming(lowerTerrainConformant, upperTerrainConformant);
   for (Layer l : this.layers) {
     l.setTerrainConforming(lowerTerrainConformant, upperTerrainConformant);
   }
 }