Changeset 14283


Ignore:
Timestamp:
01/23/13 10:42:37 (12 years ago)
Author:
jschierm
Message:

CHG: Change Shp2Exp wrapper to remove transformation specs.

Location:
issm/trunk-jpl/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.cpp

    r14281 r14283  
    1010#include "../../EnumDefinitions/EnumDefinitions.h"
    1111#include "../modules.h"
     12
     13int Shp2Expx(char* filshp,char* filexp){
     14
     15        #ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in.
     16
     17        return(Shp2Expx(filshp,filexp,
     18                                        0));
     19
     20        #else //ifdef _HAVE_SHAPELIB_
     21        return 0;
     22        #endif
     23}
    1224
    1325int Shp2Expx(char* filshp,char* filexp,
  • issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.h

    r14279 r14283  
    2222
    2323/* local prototypes: */
     24int Shp2Expx(char* filshp,char* filexp);
    2425int Shp2Expx(char* filshp,char* filexp, int sgn);
    2526int Shp2Expx(char* filshp,char* filexp, int sgn,double cm,double sp);
  • issm/trunk-jpl/src/wrappers/Shp2Exp/Shp2Exp.cpp

    r14279 r14283  
    2121        _pprintLine_("      filshp      file name of shp file to be read (char, extension optional)");
    2222        _pprintLine_("      filexp      file name of exp file to be written (char)");
    23         _pprintLine_("      sgn         sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))");
    24         _pprintLine_("");
    25         _pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
    26         _pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
    2723        _pprintLine_("");
    2824        _pprintLine_("      ret         return code (non-zero for warning)");
    2925        _pprintLine_("");
    3026        _pprintLine_("   Examples:");
    31         _pprintLine_("      [ret]=Shp2Exp('file.shp','file.exp', 0);");
    32         _pprintLine_("      [ret]=Shp2Exp('file.shp','file.exp', 1,'central_meridian',45,'standard_parallel',70);");
    33         _pprintLine_("      [ret]=Shp2Exp('file.shp','file.exp',-1,'central_meridian', 0,'standard_parallel',71);");
     27        _pprintLine_("      [ret]=Shp2Exp('file.shp','file.exp');");
    3428        _pprintLine_("");
    3529}/*}}}*/
     
    4034        /*input: */
    4135        char    *filshp=NULL,*filexp=NULL;
    42         int     sgn;
    43         Options* options=NULL;
    44         double   cm=0.,sp=0.;
    4536
    4637        /* output: */
     
    6556        FetchData(&filshp,SHP_IN);
    6657        FetchData(&filexp,EXP_IN);
    67         FetchData(&sgn,SGN_IN);
    68         FetchData(&options,NRHS,nrhs,prhs);
    69 
    70         /*  defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified  */
    71         if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
    72                 options->Get(&cm,"central_meridian");
    73                 if (verbose) _printLine_("  cm=" << cm);
    74                 options->Get(&sp,"standard_parallel");
    75                 if (verbose) _printLine_("  sp=" << sp);
    76         }
    77 
    78         /*some checks*/
    79         if (sgn < -1 || sgn > +1) _error_("Hemisphere sgn=" << sgn << " must be +1 (north), -1 (south), or 0 (no translation).");
    80         if (fabs(cm)      > 180.) _error_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
    81         if (sp < 0. || sp >  90.) _error_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
    8258
    8359        /* Run core computations: */
    84         if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
    85                 iret=Shp2Expx(filshp,filexp,sgn,cm,sp);
    86         else
    87                 iret=Shp2Expx(filshp,filexp,sgn);
     60        iret=Shp2Expx(filshp,filexp);
    8861
    8962        /*Write data: */
     
    9164
    9265        /*Clean-up*/
    93         delete options;
    9466        xDelete<char>(filexp);
    9567        xDelete<char>(filshp);
  • issm/trunk-jpl/src/wrappers/Shp2Exp/Shp2Exp.h

    r14279 r14283  
    3030#define SHP_IN  prhs[0]
    3131#define EXP_IN  prhs[1]
    32 #define SGN_IN  prhs[2]
    3332/* serial output macros: */
    3433#define RET_OUT (mxArray**)&plhs[0]
     
    3938#define SHP_IN PyTuple_GetItem(args,0)
    4039#define EXP_IN PyTuple_GetItem(args,1)
    41 #define SGN_IN PyTuple_GetItem(args,2)
    4240/* serial output macros: */
    4341#define RET_OUT output,0
     
    4644/* serial arg counts: */
    4745#undef NRHS
    48 #define NRHS  3
     46#define NRHS  2
    4947#undef NLHS
    5048#define NLHS  1
Note: See TracChangeset for help on using the changeset viewer.