Changeset 640 for trunk/zoo-project/zoo-kernel/service_internal_otb.c
- Timestamp:
- May 28, 2015, 4:25:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal_otb.c
r632 r640 28 28 29 29 #include "service_internal_otb.h" 30 #include "response_print.h" 31 #include "server_internal.h" 30 32 31 33 using namespace otb::Wrapper; 34 35 /** 36 * Global OTB counter 37 */ 38 int otbCounter=0; 32 39 33 40 /** … … 148 155 for (unsigned int i = 0; i < appKeyList.size(); i++){ 149 156 const std::string paramKey(appKeyList[i]); 150 std::vector<std::string> values;157 fprintf(stderr,"%s %d %s !\n",__FILE__,__LINE__,paramKey.c_str()); 151 158 Parameter::Pointer param = m_Application->GetParameterByKey(paramKey); 152 159 ParameterType type = m_Application->GetParameterType(paramKey); … … 154 161 map* test=getMapFromMaps(inputs,paramKey.c_str(),"cache_file"); 155 162 if(test==NULL){ 163 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,paramKey.c_str()); 156 164 test=getMapFromMaps(inputs,paramKey.c_str(),"inRequest"); 157 165 map* tmpPath=getMapFromMaps(m,"main","tmpPath"); … … 160 168 map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType"); 161 169 maps* tmpMaps=getMaps(outputs,paramKey.c_str()); 162 if(t est!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){170 if(tmpMaps!=NULL && test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){ 163 171 test=getMapFromMaps(inputs,paramKey.c_str(),"value"); 164 172 if(type == ParameterType_OutputImage){ … … 187 195 ext="jpeg"; 188 196 } 189 sprintf(tmp,"%s/%s_%s.%s",tmpPath->value,s->name,tmpSid->value,ext); 197 sprintf(tmp,"%s/%s_%d_%s.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext); 198 otbCounter++; 190 199 m_Application->SetParameterString(paramKey, tmp); 191 200 setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp); 192 201 dynamic_cast<OutputImageParameter *> (param.GetPointer())->SetPixelType(outPixType); 193 }194 else{195 if(test!=NULL && test->value!=NULL)196 m_Application->SetParameterString(paramKey, test->value);197 202 } 198 203 }else{ … … 212 217 ext="kml"; 213 218 } 214 sprintf(tmp,"%s/%s_%s.%s",tmpPath->value,s->name,tmpSid->value,ext); 219 sprintf(tmp,"%s/%s_%d_%s.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext); 220 otbCounter++; 215 221 m_Application->SetParameterString(paramKey, tmp); 216 222 setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp); … … 234 240 if(strncasecmp(tmpVal->value,"application/vnd.google-earth.kmz",32)==0){ 235 241 ext="kmz"; 236 sprintf(tmp,"%s/%s_% sxt.%s",tmpPath->value,s->name,tmpSid->value,ext);242 sprintf(tmp,"%s/%s_%d_%sxt.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext); 237 243 m_Application->SetParameterString(paramKey, tmp); 238 244 setMapInMaps(outputs,paramKey.c_str(),"expected_generated_file",tmp); … … 240 246 241 247 } 242 sprintf(tmp,"%s/%s_%s.%s",tmpPath->value,s->name,tmpSid->value,ext); 248 sprintf(tmp,"%s/%s_%d_%s.%s",tmpPath->value,s->name,otbCounter,tmpSid->value,ext); 249 otbCounter++; 243 250 m_Application->SetParameterString(paramKey, tmp); 244 251 setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp); 245 252 } 246 253 else{ 254 test=getMapFromMaps(inputs,paramKey.c_str(),"value"); 255 if(test!=NULL && type!=ParameterType_ListView){ 256 m_Application->SetParameterString(paramKey, test->value); 257 } 258 else 259 if(type==ParameterType_ListView){ 260 std::vector<std::string> values; 261 values.push_back(test->value); 262 map* tmpLength=getMapFromMaps(inputs,paramKey.c_str(),"length"); 263 if(tmpLength!=NULL){ 264 int len=atoi(tmpLength->value); 265 for(int k=1;k<len;k++){ 266 char tmp[15]; 267 sprintf(tmp,"cache_file_%d",k); 268 map* tmpVal=getMapFromMaps(inputs,paramKey.c_str(),tmp); 269 if(tmpVal!=NULL){ 270 values.push_back(tmpVal->value); 271 } 272 } 273 } 274 dynamic_cast<ListViewParameter *> (param.GetPointer())->SetSelectedItems(values); 275 } 276 } 247 277 } 248 278 }else{ 249 279 if(type == ParameterType_InputImageList){ 280 std::vector<std::string> values; 250 281 values.push_back(test->value); 251 282 map* tmpPath=getMapFromMaps(inputs,paramKey.c_str(),"length");
Note: See TracChangeset
for help on using the changeset viewer.