Ignore:
Timestamp:
May 28, 2015, 4:25:06 PM (9 years ago)
Author:
djay
Message:

First version including zoo_service shared library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal_otb.c

    r632 r640  
    2828
    2929#include "service_internal_otb.h"
     30#include "response_print.h"
     31#include "server_internal.h"
    3032
    3133using namespace otb::Wrapper;
     34
     35/**
     36 * Global OTB counter
     37 */
     38int otbCounter=0;
    3239
    3340/**
     
    148155          for (unsigned int i = 0; i < appKeyList.size(); i++){
    149156            const std::string paramKey(appKeyList[i]);
    150             std::vector<std::string> values;
     157            fprintf(stderr,"%s %d %s !\n",__FILE__,__LINE__,paramKey.c_str());
    151158            Parameter::Pointer param = m_Application->GetParameterByKey(paramKey);
    152159            ParameterType type = m_Application->GetParameterType(paramKey);
     
    154161              map* test=getMapFromMaps(inputs,paramKey.c_str(),"cache_file");
    155162              if(test==NULL){
     163                fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,paramKey.c_str());
    156164                test=getMapFromMaps(inputs,paramKey.c_str(),"inRequest");
    157165                map* tmpPath=getMapFromMaps(m,"main","tmpPath");
     
    160168                map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
    161169                maps* tmpMaps=getMaps(outputs,paramKey.c_str());
    162                 if(test!=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){
    163171                  test=getMapFromMaps(inputs,paramKey.c_str(),"value");
    164172                  if(type == ParameterType_OutputImage){
     
    187195                            ext="jpeg";
    188196                    }
    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++;
    190199                    m_Application->SetParameterString(paramKey, tmp);
    191200                    setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp);
    192201                    dynamic_cast<OutputImageParameter *> (param.GetPointer())->SetPixelType(outPixType);
    193                   }
    194                   else{
    195                     if(test!=NULL && test->value!=NULL)
    196                       m_Application->SetParameterString(paramKey, test->value);
    197202                  }
    198203                }else{
     
    212217                              ext="kml";
    213218                      }
    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++;
    215221                      m_Application->SetParameterString(paramKey, tmp);
    216222                      setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp);
     
    234240                                if(strncasecmp(tmpVal->value,"application/vnd.google-earth.kmz",32)==0){
    235241                                  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);
    237243                                  m_Application->SetParameterString(paramKey, tmp);
    238244                                  setMapInMaps(outputs,paramKey.c_str(),"expected_generated_file",tmp);
     
    240246
    241247                      }
    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++;
    243250                      m_Application->SetParameterString(paramKey, tmp);
    244251                      setMapInMaps(inputs,paramKey.c_str(),"generated_file",tmp);
    245252                    }
    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                    }
    247277                }
    248278              }else{
    249279                if(type == ParameterType_InputImageList){
     280                  std::vector<std::string> values;
    250281                  values.push_back(test->value);
    251282                  map* tmpPath=getMapFromMaps(inputs,paramKey.c_str(),"length");
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png