1   /* Copyright 2013-2019 CS Systèmes d'Information
2    * Licensed to CS Systèmes d'Information (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.rugged.raster;
18  
19  /** Interface used to update Digital Elevation Model tiles.
20   * <p>
21   * Implementations of this interface are must be provided by
22   * the image processing mission-specific layer, thus allowing
23   * the Rugged library to access the Digital Elevation Model data.
24   * </p>
25   * @author Luc Maisonobe
26   * @author Guylaine Prat
27   */
28  public interface TileUpdater {
29  
30      /** Update the tile according to the Digital Elevation Model.
31       * <p>
32       * This method is the hook used by the Rugged library to delegate
33       * Digital Elevation Model loading to user-provided mission-specific
34       * code. When this method is called, the specified {@link UpdatableTile
35       * tile} is empty and must be updated by calling {@link
36       * UpdatableTile#setGeometry(double, double, double, double, int, int)
37       * tile.setGeometry} once at the start of the method to set up the tile
38       * geometry, and then calling {@link UpdatableTile#setElevation(int, int,
39       * double) tile.setElevation} once for each cell in the tile to set the
40       * cell elevation.
41       * </p>
42       * <p>
43       * The implementation must fulfill the requirements:
44       * </p>
45       * <ul>
46       *   <li>
47       *     The tiles must overlap each other by one cell (i.e. cells
48       *     that belong to the northernmost row of one tile must also belong
49       *     to the sourthernmost row of another tile and cells that
50       *     belong to the easternmost column of one tile must also belong
51       *     to the westernmost column of another tile).
52       *   </li>
53       *   <li>
54       *     As elevations are interpolated within Digital Elevation Model
55       *     cells using four cells at indices (kLat, kLon), (kLat+1, kLon),
56       *     (kLat, kLon+1), (kLat+1, kLon+1). A point in the northernmost row
57       *     (resp. easternmost column) miss neighboring points at row kLat+1
58       *     (resp. neighboring points at column kLon+1) and therefore cannot
59       *     be interpolated. The method should therefore select the northernmost
60       *     tile if the specified latitude is in the overlapping row between two
61       *     tiles, and it should select the easternmost tile if the specified
62       *     longitude is in the overlapping column between two tiles. Failing
63       *     to do so will trigger an error at caller level mentioning the missing
64       *     required neighbors.
65       *   </li>
66       *   <li>
67       *     The elevation at cells as set when calling {@link
68       *     UpdatableTile#setElevation(int, int, double) tile.setElevation(kLat, kLon,
69       *     elevation)} must be the elevation corresponding to the latitude
70       *     {@code minLatitude + kLat * latitudeStep} and longitude {@code
71       *     minLongitude + kLon * longitudeStep}, where {@code minLatitude},
72       *     {@code latitudeStep}, {@code minLongitude} and {@code longitudeStep}
73       *     correspond to the parameter of the {@link UpdatableTile#setGeometry(double,
74       *     double, double, double, int, int) tile.setGeometry(minLatitude, minLongitude,
75             latitudeStep, longitudeStep, latitudeRows, longitudeColumns)} call.
76       *   </li>
77       * </ul>
78       * @param latitude latitude that must be covered by the tile (rad)
79       * @param longitude longitude that must be covered by the tile (rad)
80       * @param tile to update
81       */
82      void updateTile(double latitude, double longitude, UpdatableTile tile);
83  
84  }