Changeset 16414
- Timestamp:
- 10/15/13 14:49:15 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/wrappers/ShpRead/ShpRead.cpp
r16413 r16414 39 39 40 40 /*checks on arguments on the matlab side: */ 41 if(nlhs > NLHS){ 42 ShpReadUsage(); _error_("ShpRead usage error"); 43 } 44 if(nrhs != NRHS){ 45 ShpReadUsage(); _error_("ShpRead usage error"); 46 } 41 if(nlhs != NLHS){ShpReadUsage(); _error_("ShpRead usage error");} 42 if(nrhs != NRHS){ShpReadUsage(); _error_("ShpRead usage error");} 47 43 48 44 /*Input datasets: */ 49 45 FetchData(&filename,SHP_IN); 50 51 /*Intermediaries*/52 int nShapeType,nEntities;53 IssmPDouble adfMinBound[4], adfMaxBound[4];54 46 55 47 /*Open shapefile*/ … … 58 50 59 51 /*read header and print out file bounds*/ 52 int nShapeType,nEntities; 53 IssmPDouble adfMinBound[4], adfMaxBound[4]; 60 54 SHPGetInfo( hSHP, &nEntities, &nShapeType, adfMinBound, adfMaxBound ); 61 55 _printf_("Shapefile Type: "<<SHPTypeName(nShapeType)<<" number of Shapes: "<< nEntities<<"\n\n"); 62 56 63 57 /*Initialize output*/ 64 Contours* contours =new Contours();58 Contours* contours = new Contours(); 65 59 66 60 /*Read all objects*/ 67 61 for(int i=0; i<nEntities;i++ ){ 62 68 63 SHPObject* psShape = SHPReadObject(hSHP,i); 69 64 _printf_( "Shape #"<<i<<" ("<<SHPTypeName(psShape->nSHPType)<<") nVertices="<<psShape->nVertices<<", nParts="<<psShape->nParts<<"\n"); … … 71 66 Contour<double> *contour = NULL; 72 67 73 if(psShape->nSHPType==SHPT_ARC){ 74 contour=new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,false); 68 switch(psShape->nSHPType){ 69 case SHPT_ARC: 70 contour=new Contour<double>(0,psShape->nVertices,psShape->padfX,psShape->padfY,false); 71 break; 72 default: 73 _printf_("Shape type "<<SHPTypeName(psShape->nSHPType)<<"not supported yet, skipping...\n"); 75 74 } 76 75 77 /*Add to contours */76 /*Add to contours and clean up*/ 78 77 if(contour) contours->AddObject(contour); 79 80 /*Destroy current shape*/ 81 SHPDestroyObject( psShape ); 78 SHPDestroyObject(psShape); 82 79 } 83 80 84 81 /*Write output*/ 85 //ExpWrite(contours,filexp);82 WriteData(SHP_OUT,contours); 86 83 87 84 /*Clean-up*/
Note:
See TracChangeset
for help on using the changeset viewer.