Changeset 8741
- Timestamp:
- 06/28/11 12:07:29 (14 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/Exp2Kmlx/Exp2Kmlx.cpp
r8737 r8741 41 41 KML_Polygon* kpoly =NULL; 42 42 KML_LinearRing* kring =NULL; 43 KML_LineString* kline =NULL; 43 44 44 45 FILE* fid=NULL; … … 53 54 /* read exp file */ 54 55 55 if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp ))56 if (!DomainOutlineRead(&nprof,&pnvert,&pprofx,&pprofy,&closed,filexp,false)) 56 57 _error_("Error reading exp file."); 57 58 … … 70 71 71 72 kfold =new KML_Folder(); 72 sprintf(kfold->name ,"P olygons translated from file \"%s\".",filexp);73 sprintf(kfold->name ,"Profiles translated from file \"%s\".",filexp); 73 74 kfold->open =1; 74 75 75 76 /* polygon with multiple holes */ 77 78 if (holes && nprof && !closed[0]) { 79 _printf_(true,"Warning -- Outer profile is not closed, so \"holes\" option will be ignored.\n"); 80 holes=false; 81 } 76 82 77 83 if (holes) { … … 102 108 103 109 for (i=1; i<nprof; i++) { 110 if (!closed[i]) { 111 _printf_(true,"Warning -- Inner profile %d is not closed with \"holes\" specified, so it will be ignored.\n",i+1); 112 continue; 113 } 114 104 115 kring =new KML_LinearRing(); 105 116 … … 127 138 } 128 139 129 /* multiple polygons */140 /* multiple polygons or linestrings */ 130 141 131 142 else { 132 143 for (i=0; i<nprof; i++) { 133 144 kplace=new KML_Placemark(); 134 sprintf(kplace->name ,"Polygon %d",i); 135 kplace->visibility=true; 136 137 kpoly =new KML_Polygon(); 138 kring =new KML_LinearRing(); 139 140 lat=(double *) xmalloc(pnvert[i]*sizeof(double)); 141 lon=(double *) xmalloc(pnvert[i]*sizeof(double)); 142 Xy2llx(lat,lon,pprofx[i],pprofy[i],pnvert[i],sgn,cm,sp); 143 144 kring->ncoord =pnvert[i]; 145 kring->coords =(double (*)[3]) xmalloc(pnvert[i]*3*sizeof(double)); 146 for (j=0; j<pnvert[i]; j++) { 147 kring->coords[j][0]=lon[j]; 148 kring->coords[j][1]=lat[j]; 149 kring->coords[j][2]=0.; 150 } 151 xfree((void**)&lon); 152 xfree((void**)&lat); 153 154 (kpoly ->outer )->AddObject((Object*)kring); 155 kring =NULL; 156 157 (kplace->geometry )->AddObject((Object*)kpoly); 158 kpoly =NULL; 145 146 if (closed[i]) { 147 sprintf(kplace->name ,"Polygon %d",i+1); 148 kplace->visibility=true; 149 150 kpoly =new KML_Polygon(); 151 kring =new KML_LinearRing(); 152 153 lat=(double *) xmalloc(pnvert[i]*sizeof(double)); 154 lon=(double *) xmalloc(pnvert[i]*sizeof(double)); 155 Xy2llx(lat,lon,pprofx[i],pprofy[i],pnvert[i],sgn,cm,sp); 156 157 kring->ncoord =pnvert[i]; 158 kring->coords =(double (*)[3]) xmalloc(pnvert[i]*3*sizeof(double)); 159 for (j=0; j<pnvert[i]; j++) { 160 kring->coords[j][0]=lon[j]; 161 kring->coords[j][1]=lat[j]; 162 kring->coords[j][2]=0.; 163 } 164 xfree((void**)&lon); 165 xfree((void**)&lat); 166 167 (kpoly ->outer )->AddObject((Object*)kring); 168 kring =NULL; 169 170 (kplace->geometry )->AddObject((Object*)kpoly); 171 kpoly =NULL; 172 } 173 174 else { 175 sprintf(kplace->name ,"LineString %d",i+1); 176 kplace->visibility=true; 177 178 kline =new KML_LineString(); 179 180 lat=(double *) xmalloc(pnvert[i]*sizeof(double)); 181 lon=(double *) xmalloc(pnvert[i]*sizeof(double)); 182 Xy2llx(lat,lon,pprofx[i],pprofy[i],pnvert[i],sgn,cm,sp); 183 184 kline->ncoord =pnvert[i]; 185 kline->coords =(double (*)[3]) xmalloc(pnvert[i]*3*sizeof(double)); 186 for (j=0; j<pnvert[i]; j++) { 187 kline->coords[j][0]=lon[j]; 188 kline->coords[j][1]=lat[j]; 189 kline->coords[j][2]=0.; 190 } 191 xfree((void**)&lon); 192 xfree((void**)&lat); 193 194 (kplace->geometry )->AddObject((Object*)kline); 195 kline =NULL; 196 } 197 159 198 (kfold ->feature )->AddObject((Object*)kplace); 160 199 kplace=NULL; -
issm/trunk/src/c/shared/Exp/DomainOutlineRead.cpp
r8737 r8741 11 11 #include "../Exceptions/exceptions.h" 12 12 13 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname ){13 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole){ 14 14 15 15 … … 102 102 cl=false; 103 103 if((x[0]==x[n-1]) && (y[0]==y[n-1])){ 104 n=n-1;105 104 cl=true; 105 if (!whole) { 106 n=n-1; 107 } 106 108 } 107 109 -
issm/trunk/src/c/shared/Exp/exp.h
r8737 r8741 12 12 int IsOutsidePoly(Vec in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue); 13 13 int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue); 14 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname );14 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole); 15 15 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue); 16 16 -
issm/trunk/src/mex/TriMesh/TriMesh.cpp
r8737 r8741 96 96 97 97 /*Start reading the domain outline file: */ 98 if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,NULL,domainname )){98 if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,NULL,domainname,false)){ 99 99 printf("%s%s%s\n",__FUNCT__," error message reading domain outline ",domainname); 100 100 mexErrMsgTxt(" "); … … 103 103 /*Read rifts file if present: */ 104 104 if(riftname){ 105 if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,NULL,riftname )){105 if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,NULL,riftname,false)){ 106 106 printf("%s%s%s\n",__FUNCT__," error message reading rifts outline ",riftname); 107 107 mexErrMsgTxt(" "); -
issm/trunk/src/mex/TriMeshNoDensity/TriMeshNoDensity.cpp
r8737 r8741 86 86 87 87 /*Start reading the domain outline file: */ 88 if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,NULL,domainname )){88 if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,NULL,domainname,false)){ 89 89 printf("%s%s%s\n",__FUNCT__," error message reading domain outline ",domainname); 90 90 mexErrMsgTxt(" "); … … 93 93 /*Read rifts file if present: */ 94 94 if(riftname){ 95 if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,NULL,riftname )){95 if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,NULL,riftname,false)){ 96 96 printf("%s%s%s\n",__FUNCT__," error message reading rifts outline ",riftname); 97 97 mexErrMsgTxt(" ");
Note:
See TracChangeset
for help on using the changeset viewer.