"Fossies" - the Fresh Open Source Software Archive

Member "proj-6.2.1/src/projections/latlong.cpp" (6 May 2019, 3396 Bytes) of package /linux/privat/proj-6.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "latlong.cpp" see the Fossies "Dox" file reference documentation.

    1 /******************************************************************************
    2  * Project:  PROJ.4
    3  * Purpose:  Stub projection implementation for lat/long coordinates. We
    4  *           don't actually change the coordinates, but we want proj=latlong
    5  *           to act sort of like a projection.
    6  * Author:   Frank Warmerdam, warmerdam@pobox.com
    7  *
    8  ******************************************************************************
    9  * Copyright (c) 2000, Frank Warmerdam
   10  *
   11  * Permission is hereby granted, free of charge, to any person obtaining a
   12  * copy of this software and associated documentation files (the "Software"),
   13  * to deal in the Software without restriction, including without limitation
   14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   15  * and/or sell copies of the Software, and to permit persons to whom the
   16  * Software is furnished to do so, subject to the following conditions:
   17  *
   18  * The above copyright notice and this permission notice shall be included
   19  * in all copies or substantial portions of the Software.
   20  *
   21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
   24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   27  * DEALINGS IN THE SOFTWARE.
   28  *****************************************************************************/
   29 
   30 /* very loosely based upon DMA code by Bradford W. Drew */
   31 #define PJ_LIB__
   32 #include "proj_internal.h"
   33 
   34 PROJ_HEAD(lonlat, "Lat/long (Geodetic)")  "\n\t";
   35 PROJ_HEAD(latlon, "Lat/long (Geodetic alias)")  "\n\t";
   36 PROJ_HEAD(latlong, "Lat/long (Geodetic alias)")  "\n\t";
   37 PROJ_HEAD(longlat, "Lat/long (Geodetic alias)")  "\n\t";
   38 
   39 
   40  static PJ_XY latlong_forward(PJ_LP lp, PJ *P) {
   41     PJ_XY xy = {0.0,0.0};
   42     (void) P;
   43     xy.x = lp.lam;
   44     xy.y = lp.phi;
   45     return xy;
   46 }
   47 
   48 
   49 static PJ_LP latlong_inverse(PJ_XY xy, PJ *P) {
   50     PJ_LP lp = {0.0,0.0};
   51     (void) P;
   52     lp.phi = xy.y;
   53     lp.lam = xy.x;
   54     return lp;
   55 }
   56 
   57 
   58  static PJ_XYZ latlong_forward_3d (PJ_LPZ lpz, PJ *P) {
   59     PJ_XYZ xyz = {0,0,0};
   60     (void) P;
   61     xyz.x = lpz.lam;
   62     xyz.y = lpz.phi;
   63     xyz.z = lpz.z;
   64     return xyz;
   65 }
   66 
   67 
   68 static PJ_LPZ latlong_inverse_3d (PJ_XYZ xyz, PJ *P) {
   69     PJ_LPZ lpz = {0,0,0};
   70     (void) P;
   71     lpz.lam = xyz.x;
   72     lpz.phi = xyz.y;
   73     lpz.z   = xyz.z;
   74     return lpz;
   75 }
   76 
   77 static PJ_COORD latlong_forward_4d (PJ_COORD obs, PJ *P) {
   78     (void) P;
   79     return obs;
   80 }
   81 
   82 
   83 static PJ_COORD latlong_inverse_4d (PJ_COORD obs, PJ *P) {
   84     (void) P;
   85     return obs;
   86 }
   87 
   88 
   89 
   90 static PJ *latlong_setup (PJ *P) {
   91     P->is_latlong = 1;
   92     P->x0 = 0;
   93     P->y0 = 0;
   94     P->inv = latlong_inverse;
   95     P->fwd = latlong_forward;
   96     P->inv3d = latlong_inverse_3d;
   97     P->fwd3d = latlong_forward_3d;
   98     P->inv4d = latlong_inverse_4d;
   99     P->fwd4d = latlong_forward_4d;
  100     P->left = PJ_IO_UNITS_RADIANS;
  101     P->right = PJ_IO_UNITS_RADIANS;
  102     return P;
  103 }
  104 
  105 PJ *PROJECTION(latlong) {
  106     return latlong_setup (P);
  107 }
  108 
  109 
  110 PJ *PROJECTION(longlat) {
  111     return latlong_setup (P);
  112 }
  113 
  114 
  115 PJ *PROJECTION(latlon) {
  116     return latlong_setup (P);
  117 }
  118 
  119 
  120 PJ *PROJECTION(lonlat) {
  121     return latlong_setup (P);
  122 }
  123