source: josm/trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java@ 6135

Last change on this file since 6135 was 6135, checked in by Don-vip, 11 years ago

fix javadoc/warnings

File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection.datum;
3
4import java.io.InputStream;
5
6import org.openstreetmap.josm.io.MirroredInputStream;
7
8/**
9 * Wrapper for {@link NTV2GridShiftFile}.
10 *
11 * Loads the shift file from disk, when it is first accessed.
12 * @since 5226
13 */
14public class NTV2GridShiftFileWrapper {
15
16 /**
17 * Used in Germany to convert coordinates between the DHDN (<i>Deutsches Hauptdreiecksnetz</i>)
18 * and ETRS89 (<i>European Terrestrial Reference System 1989</i>) datums.
19 * @see <a href="http://crs.bkg.bund.de/crseu/crs/descrtrans/eu-descrtrans.php?crs_id=REVfREhETiAvIEdLXzM=&op_id=REVfREhETiAoQmVUQSwgMjAwNykgdG8gRVRSUzg5">
20 * Description of Transformation - DE_DHDN (BeTA, 2007) to ETRS89</a>
21 */
22 public final static NTV2GridShiftFileWrapper BETA2007 = new NTV2GridShiftFileWrapper("resource://data/BETA2007.gsb");
23
24 /**
25 * Used in France to convert coordinates between the NTF (<i>Nouvelle triangulation de la France</i>)
26 * and RGF93 (<i>Réseau géodésique français 1993</i>) datums.
27 * @see <a href="http://geodesie.ign.fr/contenu/fichiers/documentation/algorithmes/notice/NT111_V1_HARMEL_TransfoNTF-RGF93_FormatGrilleNTV2.pdf">
28 * [French] Transformation de coordonnées NTF – RGF93 / Format de grille NTv2</a>
29 */
30 public final static NTV2GridShiftFileWrapper ntf_rgf93 = new NTV2GridShiftFileWrapper("resource://data/ntf_r93_b.gsb");
31
32
33 private NTV2GridShiftFile instance = null;
34 private String gridFileName;
35
36 /**
37 * Constructs a new {@code NTV2GridShiftFileWrapper}.
38 * @param filename Path to the grid file (GSB format)
39 */
40 public NTV2GridShiftFileWrapper(String filename) {
41 this.gridFileName = filename;
42 }
43
44 /**
45 * Returns the actual {@link NTV2GridShiftFile} behind this wrapper.
46 * The grid file is only loaded once, when first accessed.
47 * @return The NTv2 grid file
48 */
49 public NTV2GridShiftFile getShiftFile() {
50 if (instance == null) {
51 try {
52 InputStream is = new MirroredInputStream(gridFileName);
53 instance = new NTV2GridShiftFile();
54 instance.loadGridShiftFile(is, false);
55 } catch (Exception e) {
56 throw new RuntimeException(e);
57 }
58 }
59 return instance;
60 }
61
62}
Note: See TracBrowser for help on using the repository browser.