View Javadoc
1   /*
2    * *************************************************************************************************************************************************************
3    *
4    * MapView: a JavaFX map renderer for tile-based servers
5    * http://tidalwave.it/projects/mapview
6    *
7    * Copyright (C) 2024 - 2025 by Tidalwave s.a.s. (http://tidalwave.it)
8    *
9    * *************************************************************************************************************************************************************
10   *
11   * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12   * You may obtain a copy of the License at
13   *
14   *     http://www.apache.org/licenses/LICENSE-2.0
15   *
16   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17   * CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License.
18   *
19   * *************************************************************************************************************************************************************
20   *
21   * git clone https://bitbucket.org/tidalwave/mapview-src
22   * git clone https://github.com/tidalwave-it/mapview-src
23   *
24   * *************************************************************************************************************************************************************
25   */
26  package it.tidalwave.mapviewer;
27  
28  import jakarta.annotation.Nonnull;
29  import org.apiguardian.api.API;
30  import static org.apiguardian.api.API.Status.STABLE;
31  
32  /***************************************************************************************************************************************************************
33   *
34   * This class is responsible for converting (latitude, longitude) into rectilinear (x,y) coordinates (to be used by a map).
35   * 
36   * @author  Fabrizio Giudici
37   *
38   **************************************************************************************************************************************************************/
39  @API(status = STABLE)
40  public interface Projection
41    {
42      /***********************************************************************************************************************************************************
43       * {@return a {@link MapPoint} converted from the given coordinates and zoom level}.
44       * @param  coordinates   the coordinates to convert
45       * @param  zoom          the zoom level
46       **********************************************************************************************************************************************************/
47      @Nonnull
48      public MapPoint coordinatesToMapPoint (@Nonnull MapCoordinates coordinates, double zoom);
49  
50      /***********************************************************************************************************************************************************
51       * {@return {@link MapCoordinates} converted from the point coordinates and zoom level}.
52       * @param  mapPoint      the point
53       * @param  zoom          the zoom level
54       **********************************************************************************************************************************************************/
55      @Nonnull
56      public MapCoordinates mapPointToCoordinates (@Nonnull MapPoint mapPoint, double zoom);
57  
58      /***********************************************************************************************************************************************************
59       * {@return the map scale (expressed in meters per pixel) at the given zoom level}.
60       * @param  coordinates   coordinates
61       * @param  zoom          the zoom level
62       **********************************************************************************************************************************************************/
63      public double metersPerPixel (@Nonnull MapCoordinates coordinates, double zoom);
64    }