@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); }
@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); }
@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); } }
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(); }
@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); }
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)); }
public void setTerrainConforming(boolean lowerTerrainConformant, boolean upperTerrainConformant) { super.setTerrainConforming(lowerTerrainConformant, upperTerrainConformant); for (Layer l : this.layers) { l.setTerrainConforming(lowerTerrainConformant, upperTerrainConformant); } }