Changeset 618 for trunk/zoo-project/zoo-kernel/service_internal_otb.c
- Timestamp:
- Mar 28, 2015, 12:58:00 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_otb.c
r580 r618 158 158 char tmp[1024]; 159 159 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType"); 160 maps* tmpMaps=getMaps(outputs,paramKey.c_str()); 160 161 if(test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){ 161 162 test=getMapFromMaps(inputs,paramKey.c_str(),"value"); … … 190 191 dynamic_cast<OutputImageParameter *> (param.GetPointer())->SetPixelType(outPixType); 191 192 }else{ 192 if(test->value!=NULL) 193 m_Application->SetParameterString(paramKey, test->value); 193 map* tmpVal=getMapFromMaps(inputs,paramKey.c_str(),"mimeType"); 194 char file_ext[32]; 195 getFileExtension(tmpVal != NULL ? tmpVal->value : NULL, file_ext, 32); 196 if(type == ParameterType_InputImageList){ 197 values.push_back(test->value); 198 map* tmpLength=getMapFromMaps(inputs,paramKey.c_str(),"length"); 199 if(tmpLength!=NULL){ 200 int len=atoi(tmpLength->value); 201 for(int k=1;k<len;k++){ 202 char *val=(char*)malloc((strlen(tmpPath->value)+strlen(s->name)+strlen(tmpSid->value)+strlen(file_ext)+13)*sizeof(char)); 203 sprintf(val,"%s/Input_%s_%s_%d.%s",tmpPath->value,s->name,tmpSid->value,k,file_ext); 204 FILE* of=fopen(val,"wb"); 205 int length=0; 206 map* tmpSize=getMap(test,"size"); 207 if(tmpSize!=NULL){ 208 length=atoi(tmpSize->value); 209 } 210 fwrite(test->value,sizeof(char),length,of); 211 fclose(of); 212 values.push_back(val); 213 free(val); 214 } 215 } 216 dynamic_cast<InputImageListParameter *> (param.GetPointer())->SetListFromFileName(values); 217 } 218 else 219 if(type == ParameterType_InputVectorData || type == ParameterType_InputImage 220 || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData 221 || type == ParameterType_InputFilename){ 222 map* tmpPath=getMapFromMaps(m,"main","tmpPath"); 223 map* tmpSid=getMapFromMaps(m,"lenv","sid"); 224 char tmp[1024]; 225 char* ext="json"; 226 if(tmpVal!=NULL){ 227 char *val=(char*)malloc((strlen(tmpPath->value)+strlen(s->name)+strlen(tmpSid->value)+strlen(file_ext)+10)*sizeof(char)); 228 sprintf(val,"%s/Input_%s_%s.%s",tmpPath->value,s->name,tmpSid->value,file_ext); 229 FILE* of=fopen(val,"wb"); 230 int length=0; 231 map* tmpSize=getMap(test,"size"); 232 if(tmpSize!=NULL){ 233 length=atoi(tmpSize->value); 234 } 235 fwrite(test->value,sizeof(char),length,of); 236 fclose(of); 237 238 if(strncasecmp(tmpVal->value,"application/zip",14)==0){ 239 240 char tmpName[1024]; 241 sprintf(tmpName,"/vsizip/%s",val); 242 char **files=VSIReadDir(tmpName); 243 int nFiles = CSLCount( files ); 244 char tmpSSName[1024]; 245 sprintf(tmpSSName,"%s/Input_%s_%s",tmpPath->value,s->name,tmpSid->value); 246 mkdir(tmpSSName,0777); 247 248 char tmpSName[1024]; 249 for(int kk=0;kk<nFiles;kk++){ 250 sprintf(tmpSName,"%s/%s",tmpName,files[kk]); 251 VSILFILE* fmain=VSIFOpenL(tmpSName, "rb"); 252 if(fmain!=NULL){ 253 VSIFSeekL(fmain,0,SEEK_END); 254 long count=VSIFTellL(fmain); 255 VSIRewindL(fmain); 256 257 char *content=(char*) malloc((count+1)*sizeof(char)); 258 VSIFReadL(content,1,count*sizeof(char),fmain); 259 260 char tmpSSSName[1024]; 261 sprintf(tmpSSSName,"%s/%s",tmpSSName,files[kk]); 262 263 FILE* fx=fopen(tmpSSSName, "wb"); 264 fwrite(content,1,count,fx); 265 fclose(fx); 266 VSIFCloseL(fmain); 267 free(content); 268 std::string test1(tmpSSSName); 269 if(test1.find(".shp")!=std::string::npos){ 270 setMapInMaps(inputs,paramKey.c_str(),"cache_file",tmpSSSName); 271 test=getMapFromMaps(inputs,paramKey.c_str(),"cache_file"); 272 } 273 } 274 } 275 m_Application->SetParameterString(paramKey, test->value); 276 }else{ 277 m_Application->SetParameterString(paramKey, val); 278 } 279 free(val); 280 } 281 } 282 else 283 if(test->value!=NULL) 284 m_Application->SetParameterString(paramKey, test->value); 194 285 } 195 286 … … 316 407 || type == ParameterType_InputFilename){ 317 408 m_Application->SetParameterString(paramKey, test->value); 318 } 409 } 319 410 } 320 411 }
Note: See TracChangeset
for help on using the changeset viewer.