LCOV - code coverage report
Current view: directory - ogr - ogr_opt.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 31 30 96.8 %
Date: 2010-01-09 Functions: 3 3 100.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_opt.cpp 18033 2009-11-15 19:18:57Z rouault $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features
       5                 :  * Purpose:  Functions for getting list of projection types, and their parms.
       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                 : #include "ogr_srs_api.h"
      31                 : #include "cpl_string.h"
      32                 : 
      33                 : CPL_CVSID("$Id: ogr_opt.cpp 18033 2009-11-15 19:18:57Z rouault $");
      34                 : 
      35                 : static const char *papszParameterDefinitions[] = {
      36                 :     SRS_PP_CENTRAL_MERIDIAN,    "Central Meridian",     "Long",  "0.0",
      37                 :     SRS_PP_SCALE_FACTOR,        "Scale Factor",         "Ratio", "1.0",
      38                 :     SRS_PP_STANDARD_PARALLEL_1, "Standard Parallel 1",  "Lat",   "0.0",
      39                 :     SRS_PP_STANDARD_PARALLEL_2, "Standard Parallel 2",  "Lat",   "0.0",
      40                 :     SRS_PP_LONGITUDE_OF_CENTER, "Longitude of Center",  "Long",  "0.0",
      41                 :     SRS_PP_LATITUDE_OF_CENTER,  "Latitude of Center",   "Lat",   "0.0",
      42                 :     SRS_PP_LONGITUDE_OF_ORIGIN, "Longitude of Origin",  "Long",  "0.0",
      43                 :     SRS_PP_LATITUDE_OF_ORIGIN,  "Latitude of Origin",   "Lat",   "0.0",
      44                 :     SRS_PP_FALSE_EASTING,       "False Easting",        "m",     "0.0",
      45                 :     SRS_PP_FALSE_NORTHING,      "False Northing",       "m",     "0.0",
      46                 :     SRS_PP_AZIMUTH,             "Azimuth",              "Angle", "0.0",
      47                 :     SRS_PP_LONGITUDE_OF_POINT_1,"Longitude of Point 1", "Long",  "0.0",
      48                 :     SRS_PP_LATITUDE_OF_POINT_1, "Latitude of Point 1",  "Lat",   "0.0",
      49                 :     SRS_PP_LONGITUDE_OF_POINT_2,"Longitude of Point 2", "Long",  "0.0",
      50                 :     SRS_PP_LATITUDE_OF_POINT_2, "Latitude of Point 2",  "Lat",   "0.0",
      51                 :     SRS_PP_LONGITUDE_OF_POINT_3,"Longitude of Point 3", "Long",  "0.0",
      52                 :     SRS_PP_LATITUDE_OF_POINT_3, "Latitude of Point 3",  "Lat",   "0.0",
      53                 :     SRS_PP_RECTIFIED_GRID_ANGLE,"Rectified Grid Angle", "Angle", "0.0", 
      54                 :     SRS_PP_SATELLITE_HEIGHT,    "Satellite Height",     "m",   "35785831.0", 
      55                 :     NULL
      56                 : };
      57                 : 
      58                 : static const char *papszProjectionDefinitions[] = {
      59                 : 
      60                 :     "*", 
      61                 :     SRS_PT_TRANSVERSE_MERCATOR,
      62                 :     "Transverse Mercator",
      63                 :     SRS_PP_LATITUDE_OF_ORIGIN,
      64                 :     SRS_PP_CENTRAL_MERIDIAN, 
      65                 :     SRS_PP_SCALE_FACTOR, 
      66                 :     SRS_PP_FALSE_EASTING,
      67                 :     SRS_PP_FALSE_NORTHING,
      68                 : 
      69                 :     "*", 
      70                 :     SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED,
      71                 :     "Transverse Mercator (South Oriented)",
      72                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
      73                 :     SRS_PP_CENTRAL_MERIDIAN,
      74                 :     SRS_PP_SCALE_FACTOR, 
      75                 :     SRS_PP_FALSE_EASTING,
      76                 :     SRS_PP_FALSE_NORTHING,
      77                 : 
      78                 :     "*",
      79                 :     SRS_PT_TUNISIA_MINING_GRID,
      80                 :     "Tunisia Mining Grid",
      81                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
      82                 :     SRS_PP_CENTRAL_MERIDIAN, 
      83                 :     SRS_PP_FALSE_EASTING, 
      84                 :     SRS_PP_FALSE_NORTHING, 
      85                 : 
      86                 :     "*",
      87                 :     SRS_PT_ALBERS_CONIC_EQUAL_AREA,
      88                 :     "Albers Conic Equal Area",
      89                 :     SRS_PP_STANDARD_PARALLEL_1,
      90                 :     SRS_PP_STANDARD_PARALLEL_2,
      91                 :     SRS_PP_LATITUDE_OF_CENTER, 
      92                 :     SRS_PP_LONGITUDE_OF_CENTER,
      93                 :     SRS_PP_FALSE_EASTING, 
      94                 :     SRS_PP_FALSE_NORTHING,
      95                 : 
      96                 :     "*", 
      97                 :     SRS_PT_AZIMUTHAL_EQUIDISTANT,
      98                 :     "Azimuthal Equidistant",
      99                 :     SRS_PP_LATITUDE_OF_CENTER, 
     100                 :     SRS_PP_LONGITUDE_OF_CENTER,
     101                 :     SRS_PP_FALSE_EASTING, 
     102                 :     SRS_PP_FALSE_NORTHING,
     103                 : 
     104                 :     "*",
     105                 :     SRS_PT_CYLINDRICAL_EQUAL_AREA,
     106                 :     "Cylindrical Equal Area",
     107                 :     SRS_PP_STANDARD_PARALLEL_1, 
     108                 :     SRS_PP_CENTRAL_MERIDIAN, 
     109                 :     SRS_PP_FALSE_EASTING, 
     110                 :     SRS_PP_FALSE_NORTHING,
     111                 : 
     112                 :     "*", 
     113                 :     SRS_PT_CASSINI_SOLDNER, 
     114                 :     "Cassini/Soldner", 
     115                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     116                 :     SRS_PP_CENTRAL_MERIDIAN, 
     117                 :     SRS_PP_FALSE_EASTING, 
     118                 :     SRS_PP_FALSE_NORTHING,
     119                 : 
     120                 :     "*",
     121                 :     SRS_PT_EQUIDISTANT_CONIC,
     122                 :     "Equidistant Conic", 
     123                 :     SRS_PP_STANDARD_PARALLEL_1,
     124                 :     SRS_PP_STANDARD_PARALLEL_2,
     125                 :     SRS_PP_LATITUDE_OF_CENTER, 
     126                 :     SRS_PP_LONGITUDE_OF_CENTER,
     127                 :     SRS_PP_FALSE_EASTING, 
     128                 :     SRS_PP_FALSE_NORTHING,
     129                 : 
     130                 :     "*",
     131                 :     SRS_PT_ECKERT_I,
     132                 :     "Eckert I",
     133                 :     SRS_PP_CENTRAL_MERIDIAN, 
     134                 :     SRS_PP_FALSE_EASTING, 
     135                 :     SRS_PP_FALSE_NORTHING,
     136                 :     
     137                 :     "*",
     138                 :     SRS_PT_ECKERT_II,
     139                 :     "Eckert II",
     140                 :     SRS_PP_CENTRAL_MERIDIAN, 
     141                 :     SRS_PP_FALSE_EASTING, 
     142                 :     SRS_PP_FALSE_NORTHING,
     143                 :     
     144                 :     "*",
     145                 :     SRS_PT_ECKERT_III,
     146                 :     "Eckert III",
     147                 :     SRS_PP_CENTRAL_MERIDIAN, 
     148                 :     SRS_PP_FALSE_EASTING, 
     149                 :     SRS_PP_FALSE_NORTHING,
     150                 :     
     151                 :     "*",
     152                 :     SRS_PT_ECKERT_IV,
     153                 :     "Eckert IV",
     154                 :     SRS_PP_CENTRAL_MERIDIAN, 
     155                 :     SRS_PP_FALSE_EASTING, 
     156                 :     SRS_PP_FALSE_NORTHING,
     157                 :     
     158                 :     "*",
     159                 :     SRS_PT_ECKERT_V,
     160                 :     "Eckert V",
     161                 :     SRS_PP_CENTRAL_MERIDIAN, 
     162                 :     SRS_PP_FALSE_EASTING, 
     163                 :     SRS_PP_FALSE_NORTHING,
     164                 :     
     165                 :     "*",
     166                 :     SRS_PT_ECKERT_VI,
     167                 :     "Eckert VI",
     168                 :     SRS_PP_CENTRAL_MERIDIAN, 
     169                 :     SRS_PP_FALSE_EASTING, 
     170                 :     SRS_PP_FALSE_NORTHING,
     171                 : 
     172                 :     "*",
     173                 :     SRS_PT_EQUIRECTANGULAR,
     174                 :     "Equirectangular",
     175                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     176                 :     SRS_PP_CENTRAL_MERIDIAN, 
     177                 :     SRS_PP_STANDARD_PARALLEL_1, 
     178                 :     SRS_PP_FALSE_EASTING, 
     179                 :     SRS_PP_FALSE_NORTHING,
     180                 : 
     181                 :     "*",
     182                 :     SRS_PT_GALL_STEREOGRAPHIC,
     183                 :     "Gall Stereographic",
     184                 :     SRS_PP_CENTRAL_MERIDIAN, 
     185                 :     SRS_PP_FALSE_EASTING, 
     186                 :     SRS_PP_FALSE_NORTHING,
     187                 : 
     188                 :     "*",
     189                 :     SRS_PT_GOODE_HOMOLOSINE,
     190                 :     "Goode Homolosine",
     191                 :     SRS_PP_CENTRAL_MERIDIAN, 
     192                 :     SRS_PP_FALSE_EASTING, 
     193                 :     SRS_PP_FALSE_NORTHING,
     194                 : 
     195                 :     "*",
     196                 :     SRS_PT_GEOSTATIONARY_SATELLITE,
     197                 :     "Geostationary Satellite",
     198                 :     SRS_PP_CENTRAL_MERIDIAN, 
     199                 :     SRS_PP_SATELLITE_HEIGHT,
     200                 :     SRS_PP_FALSE_EASTING, 
     201                 :     SRS_PP_FALSE_NORTHING,
     202                 : 
     203                 :     "*",
     204                 :     SRS_PT_GNOMONIC,
     205                 :     "Gnomonic",
     206                 :     SRS_PP_LATITUDE_OF_ORIGIN,
     207                 :     SRS_PP_CENTRAL_MERIDIAN, 
     208                 :     SRS_PP_FALSE_EASTING, 
     209                 :     SRS_PP_FALSE_NORTHING,
     210                 : 
     211                 :     "*",
     212                 :     SRS_PT_HOTINE_OBLIQUE_MERCATOR,
     213                 :     "Hotine Oblique Mercator",
     214                 :     SRS_PP_LATITUDE_OF_CENTER, 
     215                 :     SRS_PP_LONGITUDE_OF_CENTER,
     216                 :     SRS_PP_AZIMUTH, 
     217                 :     SRS_PP_RECTIFIED_GRID_ANGLE,
     218                 :     SRS_PP_SCALE_FACTOR, 
     219                 :     SRS_PP_FALSE_EASTING, 
     220                 :     SRS_PP_FALSE_NORTHING,
     221                 : 
     222                 :     "*",
     223                 :     SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN,
     224                 :     "Hotine Oblique Mercator Two Point Natural Origin",
     225                 :     SRS_PP_LATITUDE_OF_CENTER,
     226                 :     SRS_PP_LATITUDE_OF_POINT_1,
     227                 :     SRS_PP_LONGITUDE_OF_POINT_1,
     228                 :     SRS_PP_LATITUDE_OF_POINT_2,
     229                 :     SRS_PP_LONGITUDE_OF_POINT_2,
     230                 :     SRS_PP_SCALE_FACTOR, 
     231                 :     SRS_PP_FALSE_EASTING, 
     232                 :     SRS_PP_FALSE_NORTHING,
     233                 : 
     234                 :     "*",
     235                 :     SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA,
     236                 :     "Lambert Azimuthal Equal Area",
     237                 :     SRS_PP_LATITUDE_OF_CENTER, 
     238                 :     SRS_PP_LONGITUDE_OF_CENTER,
     239                 :     SRS_PP_FALSE_EASTING, 
     240                 :     SRS_PP_FALSE_NORTHING,
     241                 : 
     242                 :     "*",
     243                 :     SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP,
     244                 :     "Lambert Conformal Conic (2SP)",
     245                 :     SRS_PP_STANDARD_PARALLEL_1, 
     246                 :     SRS_PP_STANDARD_PARALLEL_2, 
     247                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     248                 :     SRS_PP_CENTRAL_MERIDIAN, 
     249                 :     SRS_PP_FALSE_EASTING, 
     250                 :     SRS_PP_FALSE_NORTHING,
     251                 : 
     252                 :     "*",
     253                 :     SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP,
     254                 :     "Lambert Conformal Conic (1SP)",
     255                 :     SRS_PP_LATITUDE_OF_ORIGIN,
     256                 :     SRS_PP_CENTRAL_MERIDIAN, 
     257                 :     SRS_PP_SCALE_FACTOR, 
     258                 :     SRS_PP_FALSE_EASTING,
     259                 :     SRS_PP_FALSE_NORTHING,
     260                 : 
     261                 :     "*",
     262                 :     SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM,
     263                 :     "Lambert Conformal Conic (2SP - Belgium)",
     264                 :     SRS_PP_STANDARD_PARALLEL_1, 
     265                 :     SRS_PP_STANDARD_PARALLEL_2, 
     266                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     267                 :     SRS_PP_CENTRAL_MERIDIAN, 
     268                 :     SRS_PP_FALSE_EASTING, 
     269                 :     SRS_PP_FALSE_NORTHING,
     270                 : 
     271                 :     "*",
     272                 :     SRS_PT_MILLER_CYLINDRICAL,
     273                 :     "Miller Cylindrical",
     274                 :     SRS_PP_LATITUDE_OF_CENTER, 
     275                 :     SRS_PP_LONGITUDE_OF_CENTER,
     276                 :     SRS_PP_FALSE_EASTING, 
     277                 :     SRS_PP_FALSE_NORTHING,
     278                 : 
     279                 :     "*",
     280                 :     SRS_PT_MERCATOR_1SP,
     281                 :     "Mercator (1SP)",
     282                 :     SRS_PP_LATITUDE_OF_ORIGIN,
     283                 :     SRS_PP_CENTRAL_MERIDIAN, 
     284                 :     SRS_PP_SCALE_FACTOR, 
     285                 :     SRS_PP_FALSE_EASTING,
     286                 :     SRS_PP_FALSE_NORTHING,
     287                 : 
     288                 :     "*",
     289                 :     SRS_PT_MOLLWEIDE,
     290                 :     "Mollweide",
     291                 :     SRS_PP_CENTRAL_MERIDIAN, 
     292                 :     SRS_PP_FALSE_EASTING, 
     293                 :     SRS_PP_FALSE_NORTHING,
     294                 : 
     295                 :     "*",
     296                 :     SRS_PT_NEW_ZEALAND_MAP_GRID,
     297                 :     "New Zealand Map Grid",
     298                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     299                 :     SRS_PP_CENTRAL_MERIDIAN, 
     300                 :     SRS_PP_FALSE_EASTING, 
     301                 :     SRS_PP_FALSE_NORTHING,
     302                 : 
     303                 :     "*",
     304                 :     SRS_PT_OBLIQUE_STEREOGRAPHIC,
     305                 :     "Oblique Stereographic",
     306                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     307                 :     SRS_PP_CENTRAL_MERIDIAN, 
     308                 :     SRS_PP_SCALE_FACTOR, 
     309                 :     SRS_PP_FALSE_EASTING,
     310                 :     SRS_PP_FALSE_NORTHING,
     311                 : 
     312                 :     "*",
     313                 :     SRS_PT_ORTHOGRAPHIC,
     314                 :     "Orthographic",
     315                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     316                 :     SRS_PP_CENTRAL_MERIDIAN, 
     317                 :     SRS_PP_FALSE_EASTING, 
     318                 :     SRS_PP_FALSE_NORTHING,
     319                 : 
     320                 :     "*",
     321                 :     SRS_PT_POLYCONIC,
     322                 :     "Polyconic",
     323                 :     SRS_PP_LATITUDE_OF_ORIGIN, 
     324                 :     SRS_PP_CENTRAL_MERIDIAN, 
     325                 :     SRS_PP_FALSE_EASTING, 
     326                 :     SRS_PP_FALSE_NORTHING,
     327                 :     
     328                 :     "*",
     329                 :     SRS_PT_POLAR_STEREOGRAPHIC,
     330                 :     "Polar Stereographic",
     331                 :     SRS_PP_LATITUDE_OF_ORIGIN,
     332                 :     SRS_PP_CENTRAL_MERIDIAN, 
     333                 :     SRS_PP_SCALE_FACTOR, 
     334                 :     SRS_PP_FALSE_EASTING,
     335                 :     SRS_PP_FALSE_NORTHING,
     336                 : 
     337                 :     "*",
     338                 :     SRS_PT_ROBINSON,
     339                 :     "Robinson",
     340                 :     SRS_PP_LONGITUDE_OF_CENTER,
     341                 :     SRS_PP_FALSE_EASTING, 
     342                 :     SRS_PP_FALSE_NORTHING,
     343                 : 
     344                 :     "*",
     345                 :     SRS_PT_SINUSOIDAL,
     346                 :     "Sinusoidal",
     347                 :     SRS_PP_LONGITUDE_OF_CENTER,
     348                 :     SRS_PP_FALSE_EASTING, 
     349                 :     SRS_PP_FALSE_NORTHING,
     350                 : 
     351                 :     "*"
     352                 :     SRS_PT_STEREOGRAPHIC,
     353                 :     "Stereographic",
     354                 :     SRS_PP_LATITUDE_OF_ORIGIN,
     355                 :     SRS_PP_CENTRAL_MERIDIAN, 
     356                 :     SRS_PP_SCALE_FACTOR, 
     357                 :     SRS_PP_FALSE_EASTING, 
     358                 :     SRS_PP_FALSE_NORTHING,
     359                 : 
     360                 :     "*",
     361                 :     SRS_PT_VANDERGRINTEN,
     362                 :     "Van Der Grinten",
     363                 :     SRS_PP_CENTRAL_MERIDIAN,
     364                 :     SRS_PP_FALSE_EASTING, 
     365                 :     SRS_PP_FALSE_NORTHING,
     366                 : 
     367                 :     "*",
     368                 :     SRS_PT_IMW_POLYCONIC,
     369                 :     "International Map of the World Polyconic",
     370                 :     SRS_PP_LATITUDE_OF_1ST_POINT,
     371                 :     SRS_PP_LATITUDE_OF_2ND_POINT,
     372                 :     SRS_PP_CENTRAL_MERIDIAN, 
     373                 :     SRS_PP_FALSE_EASTING, 
     374                 :     SRS_PP_FALSE_NORTHING,
     375                 : 
     376                 :     "*",
     377                 :     SRS_PT_WAGNER_I,
     378                 :     "Wagner I (Kavraisky VI)",
     379                 :     SRS_PP_FALSE_EASTING, 
     380                 :     SRS_PP_FALSE_NORTHING,
     381                 : 
     382                 :     "*",
     383                 :     SRS_PT_WAGNER_II,
     384                 :     "Wagner II",
     385                 :     SRS_PP_FALSE_EASTING, 
     386                 :     SRS_PP_FALSE_NORTHING,
     387                 : 
     388                 :     "*",
     389                 :     SRS_PT_WAGNER_III,
     390                 :     "Wagner III",
     391                 :     SRS_PP_LATITUDE_OF_ORIGIN,
     392                 :     SRS_PP_FALSE_EASTING, 
     393                 :     SRS_PP_FALSE_NORTHING,
     394                 : 
     395                 :     "*",
     396                 :     SRS_PT_WAGNER_IV,
     397                 :     "Wagner IV",
     398                 :     SRS_PP_FALSE_EASTING, 
     399                 :     SRS_PP_FALSE_NORTHING,
     400                 : 
     401                 :     "*",
     402                 :     SRS_PT_WAGNER_V,
     403                 :     "Wagner V",
     404                 :     SRS_PP_FALSE_EASTING, 
     405                 :     SRS_PP_FALSE_NORTHING,
     406                 : 
     407                 :     "*",
     408                 :     SRS_PT_WAGNER_VI,
     409                 :     "Wagner VI",
     410                 :     SRS_PP_FALSE_EASTING, 
     411                 :     SRS_PP_FALSE_NORTHING,
     412                 : 
     413                 :     "*",
     414                 :     SRS_PT_WAGNER_VII,
     415                 :     "Wagner VII",
     416                 :     SRS_PP_FALSE_EASTING, 
     417                 :     SRS_PP_FALSE_NORTHING,
     418                 : 
     419                 :     NULL
     420                 : };
     421                 : 
     422                 : 
     423                 : 
     424                 : 
     425                 : /************************************************************************/
     426                 : /*                      OPTGetProjectionMethods()                       */
     427                 : /************************************************************************/
     428                 : 
     429                 : /** 
     430                 :  * Fetch list of possible projection methods.
     431                 :  *
     432                 :  * @return Returns NULL terminated list of projection methods.  This should
     433                 :  * be freed with CSLDestroy() when no longer needed.
     434                 :  */
     435                 : 
     436               1 : char **OPTGetProjectionMethods()
     437                 : 
     438                 : {
     439                 :     int         i;
     440               1 :     char        **papszList = NULL;
     441                 : 
     442             313 :     for( i = 1; papszProjectionDefinitions[i] != NULL; i++ )
     443                 :     {
     444             312 :         if( EQUAL(papszProjectionDefinitions[i-1],"*") )
     445              44 :             papszList = CSLAddString(papszList,papszProjectionDefinitions[i]);
     446                 :     }
     447                 : 
     448               1 :     return papszList;
     449                 : }
     450                 : 
     451                 : /************************************************************************/
     452                 : /*                        OPTGetParameterList()                         */
     453                 : /************************************************************************/
     454                 : 
     455                 : /**
     456                 :  * Fetch the parameters for a given projection method. 
     457                 :  *
     458                 :  * @param pszProjectionMethod internal name of projection methods to fetch
     459                 :  * the parameters for, such as "Transverse_Mercator" 
     460                 :  * (SRS_PT_TRANSVERSE_MERCATOR).
     461                 :  *
     462                 :  * @param ppszUserName pointer in which to return a user visible name for
     463                 :  * the projection name.  The returned string should not be modified or
     464                 :  * freed by the caller.  Legal to pass in NULL if user name not required.
     465                 :  *
     466                 :  * @return returns a NULL terminated list of internal parameter names that
     467                 :  * should be freed by the caller when no longer needed.  Returns NULL if 
     468                 :  * projection method is unknown.
     469                 :  */
     470                 : 
     471              44 : char **OPTGetParameterList( const char *pszProjectionMethod, 
     472                 :                             char ** ppszUserName )
     473                 : 
     474                 : {
     475              44 :     char **papszList = NULL;
     476                 :     int  i;
     477                 : 
     478            6977 :     for( i = 1; papszProjectionDefinitions[i] != NULL; i++ )
     479                 :     {
     480            6977 :         if( papszProjectionDefinitions[i-1][0] == '*' 
     481                 :             && EQUAL(papszProjectionDefinitions[i],pszProjectionMethod) )
     482                 :         {
     483              44 :             i++;
     484                 : 
     485              44 :             if( ppszUserName != NULL )
     486              44 :                 *ppszUserName = (char *)papszProjectionDefinitions[i];
     487                 : 
     488              44 :             i++;
     489             479 :             while( papszProjectionDefinitions[i] != NULL 
     490             217 :                    && papszProjectionDefinitions[i][0] != '*' )
     491                 :             {
     492                 :                 papszList = CSLAddString( papszList, 
     493             174 :                                           papszProjectionDefinitions[i] );
     494             174 :                 i++;
     495                 :             }
     496              44 :             return papszList;
     497                 :         }
     498                 :     }
     499                 :     
     500               0 :     return NULL;
     501                 : }
     502                 : 
     503                 : /************************************************************************/
     504                 : /*                        OPTGetParameterInfo()                         */
     505                 : /************************************************************************/
     506                 : 
     507                 : /**
     508                 :  * Fetch information about a single parameter of a projection method. 
     509                 :  *
     510                 :  * @param pszProjectionMethod name of projection method for which the parameter
     511                 :  * applies.  Not currently used, but in the future this could affect defaults.
     512                 :  * This is the internal projection method name, such as "Tranverse_Mercator".
     513                 :  *
     514                 :  * @param pszParameterName name of the parameter to fetch information about.
     515                 :  * This is the internal name such as "central_meridian" 
     516                 :  * (SRS_PP_CENTRAL_MERIDIAN). 
     517                 :  * 
     518                 :  * @param ppszUserName location at which to return the user visible name for
     519                 :  * the parameter.  This pointer may be NULL to skip the user name.  The 
     520                 :  * returned name should not be modified or freed.
     521                 :  *
     522                 :  * @param ppszType location at which to return the parameter type for
     523                 :  * the parameter.  This pointer may be NULL to skip.  The  returned type 
     524                 :  * should not be modified or freed.  The type values are described above.
     525                 :  *
     526                 :  * @param pdfDefaultValue location at which to put the default value for
     527                 :  * this parameter.  The pointer may be NULL.
     528                 :  *
     529                 :  * @return TRUE if parameter found, or FALSE otherwise.
     530                 :  */
     531                 : 
     532             174 : int OPTGetParameterInfo( const char * pszProjectionMethod,
     533                 :                          const char * pszParameterName,
     534                 :                          char ** ppszUserName,
     535                 :                          char ** ppszType,
     536                 :                          double *pdfDefaultValue )
     537                 : 
     538                 : {
     539                 :     int         i;
     540                 : 
     541                 :     (void) pszProjectionMethod;
     542                 : 
     543            1266 :     for( i = 0; papszParameterDefinitions[i] != NULL; i += 4 )
     544                 :     {
     545            1264 :         if( EQUAL(papszParameterDefinitions[i],pszParameterName) )
     546                 :         {
     547             172 :             if( ppszUserName != NULL )
     548             172 :                 *ppszUserName = (char *)papszParameterDefinitions[i+1];
     549             172 :             if( ppszType != NULL )
     550             172 :                 *ppszType = (char *)papszParameterDefinitions[i+2];
     551             172 :             if( pdfDefaultValue != NULL )
     552             172 :                 *pdfDefaultValue = atof(papszParameterDefinitions[i+3]);
     553                 : 
     554             172 :             return TRUE;
     555                 :         }
     556                 :     }
     557                 : 
     558               2 :     return FALSE;
     559                 : }
     560                 : 

Generated by: LCOV version 1.7