Changeset 14283
- Timestamp:
- 01/23/13 10:42:37 (12 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.cpp
r14281 r14283 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 #include "../modules.h" 12 13 int 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 } 12 24 13 25 int Shp2Expx(char* filshp,char* filexp, -
issm/trunk-jpl/src/c/modules/Shp2Expx/Shp2Expx.h
r14279 r14283 22 22 23 23 /* local prototypes: */ 24 int Shp2Expx(char* filshp,char* filexp); 24 25 int Shp2Expx(char* filshp,char* filexp, int sgn); 25 26 int Shp2Expx(char* filshp,char* filexp, int sgn,double cm,double sp); -
issm/trunk-jpl/src/wrappers/Shp2Exp/Shp2Exp.cpp
r14279 r14283 21 21 _pprintLine_(" filshp file name of shp file to be read (char, extension optional)"); 22 22 _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)");27 23 _pprintLine_(""); 28 24 _pprintLine_(" ret return code (non-zero for warning)"); 29 25 _pprintLine_(""); 30 26 _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');"); 34 28 _pprintLine_(""); 35 29 }/*}}}*/ … … 40 34 /*input: */ 41 35 char *filshp=NULL,*filexp=NULL; 42 int sgn;43 Options* options=NULL;44 double cm=0.,sp=0.;45 36 46 37 /* output: */ … … 65 56 FetchData(&filshp,SHP_IN); 66 57 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).");82 58 83 59 /* 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); 88 61 89 62 /*Write data: */ … … 91 64 92 65 /*Clean-up*/ 93 delete options;94 66 xDelete<char>(filexp); 95 67 xDelete<char>(filshp); -
issm/trunk-jpl/src/wrappers/Shp2Exp/Shp2Exp.h
r14279 r14283 30 30 #define SHP_IN prhs[0] 31 31 #define EXP_IN prhs[1] 32 #define SGN_IN prhs[2]33 32 /* serial output macros: */ 34 33 #define RET_OUT (mxArray**)&plhs[0] … … 39 38 #define SHP_IN PyTuple_GetItem(args,0) 40 39 #define EXP_IN PyTuple_GetItem(args,1) 41 #define SGN_IN PyTuple_GetItem(args,2)42 40 /* serial output macros: */ 43 41 #define RET_OUT output,0 … … 46 44 /* serial arg counts: */ 47 45 #undef NRHS 48 #define NRHS 346 #define NRHS 2 49 47 #undef NLHS 50 48 #define NLHS 1
Note:
See TracChangeset
for help on using the changeset viewer.