Ignore:
Timestamp:
May 31, 2011, 3:30:49 AM (14 years ago)
Author:
djay
Message:

Merge trunk r111:r216 into branch-1.2

Location:
branches/branch-1.2
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/branch-1.2

  • branches/branch-1.2/zoo-services/cgal/Makefile

    r1 r217  
    1 CFLAGS=-I../../zoo-kernel-svn/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
     1CFLAGS=-I../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
    22CC=gcc
    33
    4 cgi-env/service.zo: service.c
    5         g++ ${CFLAGS} -shared -fpic -o cgi-env/service.zo ./service.c -lgdal
     4cgi-env/cgal_service.zo: service.c
     5        g++ ${CFLAGS} -shared -fpic -o cgi-env/cgal_service.zo ./service.c -lgdal -lCGAL
    66
    77clean:
    8         rm -f *.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling
     8        rm -f cgi-env/*.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling
    99        rm -rf service_loader.dSYM
  • branches/branch-1.2/zoo-services/cgal/service.c

    r1 r217  
    4646  void printExceptionReportResponse(maps*,map*);
    4747
    48   char *base64(const unsigned char *input, int length){
    49     BIO *bmem, *b64;
    50     BUF_MEM *bptr;
    51 
    52     b64 = BIO_new(BIO_f_base64());
    53     bmem = BIO_new(BIO_s_mem());
    54     b64 = BIO_push(b64, bmem);
    55     BIO_write(b64, input, length);
    56     BIO_flush(b64);
    57     BIO_get_mem_ptr(b64, &bptr);
    58 
    59     char *buff = (char *)malloc(bptr->length+1);
    60     memcpy(buff, bptr->data, bptr->length);
    61     buff[bptr->length] = 0;
    62 
    63     BIO_free_all(b64);
    64 
    65     return buff;
    66   }
    67 
    68   OGRGeometryH createGeometryFromGML(maps* conf,char* inputStr){
    69     xmlInitParser();
    70     xmlDocPtr doc = xmlParseMemory(inputStr,strlen(inputStr));
    71     xmlChar *xmlbuff;
    72     int buffersize;
    73     xmlXPathContextPtr xpathCtx;
    74     xmlXPathObjectPtr xpathObj;
    75     char * xpathExpr="/*/*/*/*/*[local-name()='Polygon' or local-name()='MultiPolygon']";
    76     xpathCtx = xmlXPathNewContext(doc);
    77     xpathObj = xmlXPathEvalExpression(BAD_CAST xpathExpr,xpathCtx);
    78     if(!xpathObj->nodesetval){
    79       map* tmp=createMap("text","Unable to parse Input Polygon");
    80       addToMap(tmp,"code","InvalidParameterValue");
    81       printExceptionReportResponse(conf,tmp);
    82       exit(0);
    83     }
    84     int size = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0;
    85     /**
    86      * Create a temporary XML document
    87      */
    88     xmlDocPtr ndoc = xmlNewDoc(BAD_CAST "1.0");
    89     /**
    90      * Only one polygon should be provided so we use it as the root node.
    91      */
    92     for(int k=size-1;k>=0;k--){
    93       xmlDocSetRootElement(ndoc, xpathObj->nodesetval->nodeTab[k]);
    94     }
    95     xmlDocDumpFormatMemory(ndoc, &xmlbuff, &buffersize, 1);
    96     char *tmp=strdup(strstr((char*)xmlbuff,"?>")+2);
    97     xmlXPathFreeObject(xpathObj);
    98     xmlXPathFreeContext(xpathCtx);
    99     xmlFree(xmlbuff);
    100     xmlFreeDoc(doc);
    101     xmlCleanupParser();
    102     fprintf(stderr,"\nService internal print\n Loading the geometry from GML string ...");
    103     OGRGeometryH res=OGR_G_CreateFromGML(tmp);
    104     if(res==NULL){
    105       map* tmp=createMap("text","Unable to call OGR_G_CreatFromGML");
    106       addToMap(tmp,"code","NoApplicableCode");
    107       printExceptionReportResponse(conf,tmp);
    108       exit(0);
    109     }
    110     else
    111       return OGR_G_CreateFromGML(tmp);
    112   }
    113 
    114  
    115   int Delaunay(maps*& conf,maps*& inputs,maps*& outputs){
     48  int Voronoi(maps*& conf,maps*& inputs,maps*& outputs){
     49#ifdef DEBUG
    11650    fprintf(stderr,"\nService internal print\nStarting\n");
     51#endif
    11752    maps* cursor=inputs;
    11853    OGRGeometryH geometry,res;
     
    12156    map* tmpm=NULL;
    12257    tmpm=getMapFromMaps(inputs,"InputPoints","value");
    123 
     58   
    12459    xmlInitParser();
    12560    xmlDocPtr doc =
     
    13570    xpathObj = xmlXPathEvalExpression(BAD_CAST "/*/*[local-name()='featureMember']/*/*/*[local-name()='Point']/*[local-name()='coordinates']",xpathCtx);
    13671    xmlXPathFreeContext(xpathCtx);
    137     xmlNodeSet* toto=xpathObj->nodesetval;
    138 
    139     if(toto==NULL)
    140       fprintf(stderr,"IMPOSSIBLE DE CONTINUER !!!!\n");
     72    xmlNodeSet* nSet=xpathObj->nodesetval;
     73
     74    if(nSet==NULL){
     75      setMapInMaps(conf,"lenv","message","Unable to continue !!!");
     76      return SERVICE_FAILED;
     77    }
    14178    char filepath[2048];
    14279    map* tmpMap=getMapFromMaps(conf,"main","tmpPath");
     
    14582    }
    14683    FILE *fo=fopen(filepath,"w");
    147     fprintf(stderr,"File Creation (%s) OK\nPrinting %d Points.\n",filepath,toto->nodeNr);
    148     for(int k=0;k<toto->nodeNr;k++){
    149       xmlNodePtr cur=toto->nodeTab[k];
     84#ifdef DEBUG
     85    fprintf(stderr,"File Creation (%s) OK\nPrinting %d Points.\n",filepath,nSet->nodeNr);
     86#endif
     87    for(int k=0;k<nSet->nodeNr;k++){
     88      xmlNodePtr cur=nSet->nodeTab[k];
    15089      char *val=
    15190        (char*)xmlNodeListGetString(doc,cur->xmlChildrenNode,1);
     
    15998    }
    16099    fclose(fo);
     100#ifdef DEBUG
    161101    fprintf(stderr,"File Close (%s) OK\n",filepath);
     102#endif
    162103
    163104    std::ifstream in(filepath);
    164 
    165     std::istream_iterator<Point1> begin(in);
    166     std::istream_iterator<Point1> end;
    167 
    168     DelaunayTriangulation dt1;
    169     dt1.insert(begin, end);
     105    std::istream_iterator<Point> begin(in);
     106    std::istream_iterator<Point> end;
     107    Triangulation T;
     108    T.insert(begin, end);
    170109
    171110    OGRRegisterAll();
     
    180119
    181120    tmpMap=getMapFromMaps(outputs,"Result","mimeType");
    182     char *oDriver=(char*)malloc(7*sizeof(char));
     121    const char *oDriver;
    183122    oDriver="GeoJSON";
    184123    if(tmpMap!=NULL){
    185124      if(strcmp(tmpMap->value,"text/xml")==0){
    186         fprintf(stderr,"USEING GML \n");
    187125        oDriver="GML";
    188126      }
     
    212150            sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
    213151          }
    214        
    215         fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
    216         exit( 1 );
     152
     153        setMapInMaps(conf,"lenv","message",emessage);
     154        return SERVICE_FAILED;
     155
    217156      }
    218157
     
    221160      sprintf( emessage,  "%s driver does not support data source creation.\n",
    222161               "json" );
    223       fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
    224       exit( 1 );
    225     }
    226 
    227     /* -------------------------------------------------------------------- */
    228     /*      Create the output data source.                                  */
    229     /* -------------------------------------------------------------------- */
    230     map* tpath=getMapFromMaps(conf,"main","tmpPath");
    231     char *pszDestDataSource=(char*)malloc(strlen(tpath->value)+20);
    232     char **papszDSCO=NULL;
    233     sprintf(pszDestDataSource,"%s/result_%d.json",tpath->value,getpid());
    234     fprintf(stderr,"\n *%s* \n",pszDestDataSource);
    235     poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO );
    236     if( poODS == NULL ){
    237       char emessage[1024];     
    238       sprintf( emessage,  "%s driver failed to create %s\n",
    239                "json", pszDestDataSource );
    240       fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
    241       exit( 1 );
    242     }
    243 
    244     /* -------------------------------------------------------------------- */
    245     /*      Create the layer.                                               */
    246     /* -------------------------------------------------------------------- */
    247     if( !poODS->TestCapability( ODsCCreateLayer ) )
    248       {
    249         char emessage[1024];
    250         sprintf( emessage,
    251                  "Layer %s not found, and CreateLayer not supported by driver.",
    252                  "Result" );
    253         fprintf(stderr,"{\"type\": \"error\",\"message\": \"%s\"}",emessage);
    254         return FALSE;
    255       }
    256    
    257     CPLErrorReset();
    258    
    259     OGRLayer *poDstLayer = poODS->CreateLayer( "Result", NULL,wkbLineString,NULL);
    260     if( poDstLayer == NULL ){
    261       fprintf( stderr,"Layer creation failed.\n" );
    262       exit( 1 );
    263     }
    264 
    265     Vertex_circulator vc = dt1.incident_vertices(dt1.infinite_vertex()),
    266       done(vc);
    267     if (vc != 0) {
    268       do {std::cout << vc->point() << std::endl;}while(++vc != done);
    269     }
    270 
    271     DelaunayTriangulation::Edge_iterator eit=dt1.edges_begin();
    272     int i=0;
    273     for ( ; eit !=dt1.edges_end(); ++eit) {
    274       fprintf(stderr,"Edge %d\n",i);
    275       i++;
    276       /*CGAL::Object o = dt1.dual(eit);
    277       if (const K::Segment_2 *tmp=CGAL::object_cast<K::Segment_2>(&o)) {
    278         const K::Point_2 p1=tmp->source();
    279         const K::Point_2 p2=tmp->target();
    280         //#ifdef DEBUG
    281         fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y());
    282         //#endif
    283         }*/
    284       /*if (const K::Segment_3 *tmp=CGAL::object_cast<K::Segment_3>(eit)) {
    285         const K::Point_3 p1=tmp->source();
    286         const K::Point_3 p2=tmp->target();
    287 #ifdef DEBUG
    288         fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y());
    289 #endif
    290         OGRFeatureH hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
    291         OGRGeometryH currLine=OGR_G_CreateGeometry(wkbLineString);
    292         OGR_G_AddPoint_2D(currLine,p1.x(),p1.y());
    293         OGR_G_AddPoint_2D(currLine,p2.x(),p2.y());
    294         OGR_F_SetGeometry( hFeature, currLine );
    295         OGR_G_DestroyGeometry(currLine);
    296         if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
    297           fprintf( stderr,"Failed to create feature in file.\n" );
    298           exit( 1 );
    299           }
    300           OGR_F_Destroy( hFeature );*/
    301     }
    302  
    303     int idg=0;
    304     for (DelaunayTriangulation::Face_iterator fit = dt1.faces_begin(); fit!=
    305            dt1.faces_end(); ++fit) {
    306       int idx = 0;
    307       int i0, i1, i2;
    308 
    309       OGRFeatureH hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
    310       OGRGeometryH currLine=OGR_G_CreateGeometry(wkbLineString);
    311      
    312       for(i0=0;i0<3;i0++){
    313         if(!dt1.is_infinite((*fit).vertex(i0)))
    314           OGR_G_AddPoint_2D(currLine,(*fit).vertex(i0)->point().x(),
    315                             (*fit).vertex(i0)->point().y());
    316         if(i0==2 && !dt1.is_infinite((*fit).vertex(0)))
    317           OGR_G_AddPoint_2D(currLine,(*fit).vertex(0)->point().x(),
    318                             (*fit).vertex(0)->point().y());
    319       }
    320       OGR_F_SetGeometry( hFeature, currLine );
    321       OGR_G_DestroyGeometry(currLine);
    322       if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
    323         fprintf( stderr,"Failed to create feature in file.\n" );
    324         exit( 1 );
    325       }
    326       OGR_F_Destroy( hFeature );
    327 
    328       /*OGRFeatureH hFeature=NULL;
    329       OGRGeometryH currLine=NULL;
    330       if(idg==0) {
    331         hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
    332         currLine=OGR_G_CreateGeometry(wkbLineString);     
    333         }*/
    334 
    335       for (DelaunayTriangulation::Vertex_iterator vit = dt1.vertices_begin(); vit!=
    336              dt1.vertices_end(); ++vit) {
    337         idx++;
    338         /*if(idg==0)
    339           OGR_G_AddPoint_2D(currLine,(*vit).point().x(),
    340           (*vit).point().y());*/
    341 
    342 
    343         if ((*vit).point() == (*fit).vertex(0)->point()){
    344           i0 = idx;
    345           /*OGR_G_AddPoint_2D(currLine,(*fit).vertex(i0)->point().x(),
    346             (*fit).vertex(i0)->point().y());**/
    347         }
    348         if ((*vit).point() == (*fit).vertex(1)->point()){ 
    349           i1 = idx;
    350           /*OGR_G_AddPoint_2D(currLine,(*fit).vertex(i1)->point().x(),
    351             (*fit).vertex(i1)->point().y());*/
    352         }
    353         if ((*vit).point() == (*fit).vertex(2)->point()){ 
    354           i2 = idx;
    355           /*OGR_G_AddPoint_2D(currLine,(*fit).vertex(i2)->point().x(),
    356             (*fit).vertex(i2)->point().y());*/
    357         }
    358       }
    359       /*if(idg==0){
    360         OGR_F_SetGeometry( hFeature, currLine );
    361         OGR_G_DestroyGeometry(currLine);
    362         if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
    363           fprintf( stderr,"Failed to create feature in file.\n" );
    364           exit( 1 );
    365         }
    366         OGR_F_Destroy( hFeature );
    367         idg++;
    368         }*/
    369 
    370       std::cerr << "f " << i0 << " " << dt1.triangle(fit) << std::endl;
    371      
    372     }
    373     OGR_DS_Destroy( poODS );
    374     OGRCleanupAll();
    375 
    376  
    377     char tmp1[1024];
    378     outputs=(maps*)malloc(sizeof(maps*));
    379     outputs->name="Result";
    380 
    381     FILE * fichier=fopen(pszDestDataSource,"r");
    382     struct stat file_status;
    383     stat(pszDestDataSource, &file_status);
    384     fprintf(stderr,"%s (%d)",pszDestDataSource,file_status.st_size);
    385     char *res1=(char *)malloc(file_status.st_size*sizeof(char));
    386     if(fichier==NULL)
    387       fprintf(stderr,"Failed to open file %s for reading purpose.\n",pszDestDataSource);
    388     fread(res1,1,(file_status.st_size)*sizeof(char),fichier);
    389     res1[strlen(res1)]=0;
    390     fclose(fichier);
    391     //unlink(pszDestDataSource);
    392     //fprintf(stderr,"Read (%s).\n",res1);
    393    
    394     outputs->content=createMap("value",res1);
    395    
    396     if(strcmp(oDriver,"GML")==0)
    397       addMapToMap(&outputs->content,createMap("mimeType","text/xml"));
    398     else
    399       addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
    400 
    401     addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
    402     outputs->next=NULL;
    403     fprintf(stderr,"\nService internal print\n===\n");
    404     xmlCleanupParser();
    405 
    406     return SERVICE_SUCCEEDED;
    407   }
    408  
    409 
    410   int Voronoi(maps*& conf,maps*& inputs,maps*& outputs){
    411     fprintf(stderr,"\nService internal print\nStarting\n");
    412     maps* cursor=inputs;
    413     OGRGeometryH geometry,res;
    414     int bufferDistance;
    415     xmlInitParser();
    416     map* tmpm=NULL;
    417     tmpm=getMapFromMaps(inputs,"InputPoints","value");
    418    
    419     xmlInitParser();
    420     xmlDocPtr doc =
    421       xmlParseMemory(tmpm->value,strlen(tmpm->value));
    422     xmlNodePtr cur = xmlDocGetRootElement(doc);
    423     /**
    424      * Parse every Input in DataInputs node.
    425      */
    426     maps* tempMaps=NULL;
    427     xmlXPathContextPtr xpathCtx;
    428     xmlXPathObjectPtr xpathObj;
    429     xpathCtx = xmlXPathNewContext(doc);
    430     xpathObj = xmlXPathEvalExpression(BAD_CAST "/*/*[local-name()='featureMember']/*/*/*[local-name()='Point']/*[local-name()='coordinates']",xpathCtx);
    431     xmlXPathFreeContext(xpathCtx);
    432     xmlNodeSet* toto=xpathObj->nodesetval;
    433 
    434     if(toto==NULL)
    435       fprintf(stderr,"IMPOSSIBLE DE CONTINUER !!!!\n");
    436     char filepath[2048];
    437     map* tmpMap=getMapFromMaps(conf,"main","tmpPath");
    438     if(tmpMap!=NULL){
    439       sprintf(filepath,"%s/varonoi_%d.tmp",tmpMap->value,getpid());
    440     }
    441     FILE *fo=fopen(filepath,"w");
    442     fprintf(stderr,"File Creation (%s) OK\nPrinting %d Points.\n",filepath,toto->nodeNr);
    443     for(int k=0;k<toto->nodeNr;k++){
    444       xmlNodePtr cur=toto->nodeTab[k];
    445       char *val=
    446         (char*)xmlNodeListGetString(doc,cur->xmlChildrenNode,1);
    447       char *tmp=strstr(val,",");
    448       char tmp1[1024];
    449       strncpy(tmp1,val,strlen(val)-strlen(tmp));
    450       tmp1[strlen(val)-strlen(tmp)]=0;
    451       char buff[1024];
    452       sprintf(buff,"%s %s\n",tmp1,tmp+1);
    453       fwrite(buff,1,strlen(buff)*sizeof(char),fo);
    454     }
    455     fclose(fo);
    456     fprintf(stderr,"File Close (%s) OK\n",filepath);
    457 
    458     std::ifstream in(filepath);
    459     std::istream_iterator<Point> begin(in);
    460     std::istream_iterator<Point> end;
    461     Triangulation T;
    462     T.insert(begin, end);
    463 
    464     OGRRegisterAll();
    465     /* -------------------------------------------------------------------- */
    466     /*      Try opening the output datasource as an existing, writable      */
    467     /* -------------------------------------------------------------------- */
    468     OGRDataSource       *poODS;
    469    
    470     OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();
    471     OGRSFDriver          *poDriver = NULL;
    472     int                  iDriver;
    473 
    474     tmpMap=getMapFromMaps(outputs,"Result","mimeType");
    475     char *oDriver=(char*)malloc(7*sizeof(char));
    476     oDriver="GeoJSON";
    477     if(tmpMap!=NULL){
    478       if(strcmp(tmpMap->value,"text/xml")==0){
    479         fprintf(stderr,"USEING GML \n");
    480         oDriver="GML";
    481       }
    482     }
    483    
    484     for( iDriver = 0;
    485          iDriver < poR->GetDriverCount() && poDriver == NULL;
    486          iDriver++ )
    487       {
    488 #ifdef DEBUG
    489         fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName());
    490 #endif
    491         if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver) )
    492           {
    493             poDriver = poR->GetDriver(iDriver);
    494           }
    495       }
    496 
    497     if( poDriver == NULL )
    498       {
    499         char emessage[8192];
    500         sprintf( emessage, "Unable to find driver `%s'.\n", oDriver );
    501         sprintf( emessage,  "%sThe following drivers are available:\n",emessage );
    502        
    503         for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
    504           {
    505             sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
    506           }
    507        
    508         fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
    509         exit( 1 );
    510       }
    511 
    512     if( !poDriver->TestCapability( ODrCCreateDataSource ) ){
    513       char emessage[1024];
    514       sprintf( emessage,  "%s driver does not support data source creation.\n",
    515                "json" );
    516       fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
    517       exit( 1 );
     162      setMapInMaps(conf,"lenv","message",emessage);
     163      return SERVICE_FAILED;
    518164    }
    519165
     
    530176      sprintf( emessage,  "%s driver failed to create %s\n",
    531177               "json", pszDestDataSource );
    532       fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
    533       exit( 1 );
     178      setMapInMaps(conf,"lenv","message",emessage);
     179      return SERVICE_FAILED;
    534180    }
    535181
     
    543189                 "Layer %s not found, and CreateLayer not supported by driver.",
    544190                 "Result" );
    545         fprintf(stderr,"{\"type\": \"error\",\"message\": \"%s\"}",emessage);
    546         return FALSE;
     191        setMapInMaps(conf,"lenv","message",emessage);
     192        return SERVICE_FAILED;
    547193      }
    548194   
     
    551197    OGRLayer *poDstLayer = poODS->CreateLayer( "Result", NULL,wkbLineString,NULL);
    552198    if( poDstLayer == NULL ){
    553       fprintf( stderr,"Layer creation failed.\n" );
    554       exit( 1 );
     199      setMapInMaps(conf,"lenv","message","Layer creation failed.\n");
     200      return SERVICE_FAILED;
    555201    }
    556202
     
    574220        OGR_G_DestroyGeometry(currLine);
    575221        if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
    576           fprintf( stderr,"Failed to create feature in file.\n" );
    577           exit( 1 );
     222          setMapInMaps(conf,"lenv","message","Failed to create feature in file.\n");
     223          return SERVICE_FAILED;
    578224        }
    579225        OGR_F_Destroy( hFeature );
     
    592238   
    593239    char tmp1[1024];
    594     outputs=(maps*)malloc(sizeof(maps*));
    595     outputs->name="Result";
    596240
    597241    FILE * fichier=fopen(pszDestDataSource,"r");
    598242    struct stat file_status;
    599243    stat(pszDestDataSource, &file_status);
    600     //fprintf(stderr,"%s (%d)",pszDestDataSource,file_status.st_size);
    601244    char *res1=(char *)malloc(file_status.st_size*sizeof(char));
    602     if(fichier==NULL)
    603       fprintf(stderr,"Failed to open file %s for reading purpose.\n",pszDestDataSource);
     245    if(fichier==NULL){
     246      char tmp[1024];
     247      sprintf(tmp,"Failed to open file %s for reading purpose.\n",
     248              pszDestDataSource);
     249      setMapInMaps(conf,"lenv","message",tmp);
     250      return SERVICE_FAILED;
     251    }
    604252    fread(res1,1,(file_status.st_size)*sizeof(char),fichier);
    605253    res1[strlen(res1)]=0;
    606254    fclose(fichier);
    607255    unlink(pszDestDataSource);
    608     //fprintf(stderr,"Read (%s).\n",res1);
    609    
    610     outputs->content=createMap("value",res1);
     256   
     257    setMapInMaps(outputs,"Result","value",res1);
    611258   
    612259    if(strcmp(oDriver,"GML")==0)
    613       addMapToMap(&outputs->content,createMap("mimeType","text/xml"));
     260      setMapInMaps(outputs,"Result","mimeType","text/xml");
    614261    else
    615       addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
    616 
    617     addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
    618     outputs->next=NULL;
     262      setMapInMaps(outputs,"Result","mimeType","text/plain");
     263
     264    setMapInMaps(outputs,"Result","encoding","UTF-8");
     265#ifdef DEBUG
    619266    fprintf(stderr,"\nService internal print\n===\n");
     267#endif
    620268    xmlCleanupParser();
    621269    return SERVICE_SUCCEEDED;
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