#ifndef _POLY_WRITER_H #define _POLY_WRITER_H #include "head.h" class poly_writer { public: poly_writer(); ~poly_writer(); int readdat(string); int poly_plane(string); int poly_topo(string); int run(string,string,int,double,double*); private: int M,N; double bottom_depth; double xmin,xmax,dx,ymin,ymax,dy,zmin,zmax; double *topo; }; poly_writer::poly_writer() { topo = NULL; } poly_writer::~poly_writer() { if(topo!=NULL) delete[] topo; } int poly_writer::run(string inname,string outname,int bottom_type,double depth,double* Range) { bottom_depth = depth; xmin = *Range; dx = *(Range+1); xmax = *(Range+2); ymin = *(Range+3); dy = *(Range+4); ymax = *(Range+5); M = (xmax-xmin)/dx+1; N = (ymax-ymin)/dy+1; xmax = xmin+(M-1)*dx; ymax = ymin+(N-1)*dy; if (readdat(inname)) return 1; if (bottom_type==1) { if (poly_topo(outname)) return 1; } else if (bottom_type==2) { if (poly_plane(outname)) return 1; } return 0; } int poly_writer::readdat(string filename) { const char* openname = filename.c_str(); ifstream infile(openname); if (!infile) { cout<>temp>>temp>>topo[i]; if (zmin>topo[i]) zmin = topo[i]; if (zmax=2;i--) { for(int j=M;j>=2;j--) { outfile<<1<=2;i--) { for(int j=M;j>=2;j--) { outfile<<1<=2;i--) { for(int j=M;j>=2;j--) { outfile<<1<=1;i--) { outfile<=1;i--) { outfile<=1;i--) { outfile<=1;i--) { outfile<