Ignore:
Timestamp:
Sep 29, 2012, 3:59:06 PM (9 years ago)
Author:
djay
Message:

Update to make ZOO-Kernel able to compile and run from Windows Platforms. A special thanks to Espen Messel, Knut Landmark and Benrd Härtwig for providing many patches that I can successfully apply on the SVN source tree and to Farkas for continuing requesting for ZOO-Kernel to run on Windows platforms privately and through the ZOO-Discuss mailing list.

File:
1 edited

Legend:

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

    r362 r364  
    7777
    7878void setReferenceUrl(maps* m,maps* tmpI){
    79   dumpMaps(tmpI);
     79  //dumpMaps(tmpI);
    8080  outputMapfile(m,tmpI);
    8181  map *msUrl=getMapFromMaps(m,"main","mapserverAddress");
     
    299299      sprintf(tmpSrsStr,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
    300300      addToMap(output->content,"wcs_extent",tmpExtent);
    301       dumpMap(output->content);
     301      //dumpMap(output->content);
    302302
    303303    }else{
     
    331331   */
    332332
    333   OGRDataSourceH *poDS1 = NULL;
     333  OGRDataSourceH poDS1 = NULL;
    334334  OGRSFDriverH *poDriver1 = NULL;
    335335  char *dsName=(char*)malloc((8+strlen(pszDataSource)+1)*sizeof(char));
     
    373373    char** demo=VSIReadDir(dsName);
    374374    int i=0;
    375     mkdir(sdsName,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH );
     375    mkdir(sdsName
     376#ifndef WIN32
     377                ,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
     378#endif
     379                );
    376380    while(demo[i]!=NULL){
    377381      fprintf(stderr,"ZIP File content : %s\n",demo[i]);
     
    414418  }
    415419
    416   OGRDataSourceH *poDS = NULL;
     420  OGRDataSourceH poDS = NULL;
    417421  OGRSFDriverH *poDriver = NULL;
    418422  poDS = OGROpen( pszDataSource, FALSE, poDriver );
     
    432436  int iLayer = 0;
    433437  for( iLayer=0; iLayer < OGR_DS_GetLayerCount(poDS); iLayer++ ){
    434     OGRLayerH *poLayer = OGR_DS_GetLayer(poDS,iLayer);
     438    OGRLayerH poLayer = OGR_DS_GetLayer(poDS,iLayer);
    435439
    436440    if( poLayer == NULL ){
     
    530534     * Detect the FID column or use the first attribute field as FID
    531535     */
    532     char *fid=OGR_L_GetFIDColumn(poLayer);
     536    char *fid=(char*)OGR_L_GetFIDColumn(poLayer);
    533537    if(strlen(fid)==0){
    534538      OGRFeatureDefnH def=OGR_L_GetLayerDefn(poLayer);
     
    536540      for(fIndex=0;fIndex<OGR_FD_GetFieldCount(def);fIndex++){
    537541        OGRFieldDefnH fdef=OGR_FD_GetFieldDefn(def,fIndex);
    538         fid=OGR_Fld_GetNameRef(fdef);
     542        fid=(char*)OGR_Fld_GetNameRef(fdef);
    539543        break;
    540544      }
     
    550554
    551555    if(msGrowLayerClasses(myLayer) == NULL)
    552       return;
    553     if(initClass((myLayer->class[myLayer->numclasses])) == -1)
    554       return;
    555     myLayer->class[myLayer->numclasses]->type = myLayer->type;
    556     if(msGrowClassStyles(myLayer->class[myLayer->numclasses]) == NULL)
    557       return ;
    558     if(initStyle(myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]) == -1)
    559       return;
     556      return -1;
     557    if(initClass((myLayer->_class[myLayer->numclasses])) == -1)
     558      return -1;
     559    myLayer->_class[myLayer->numclasses]->type = myLayer->type;
     560    if(msGrowClassStyles(myLayer->_class[myLayer->numclasses]) == NULL)
     561      return -1;
     562    if(initStyle(myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]) == -1)
     563      return -1;
    560564
    561565    /**
     
    564568    tmpMap=getMap(output->content,"msStyle");
    565569    if(tmpMap!=NULL)
    566       msUpdateStyleFromString(myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles],tmpMap->value,0);
     570      msUpdateStyleFromString(myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles],tmpMap->value,0);
    567571    else{
    568572      /**
    569573       * Set style
    570574       */
    571       myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->color.red=125;
    572       myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->color.green=125;
    573       myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->color.blue=255;
    574       myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->outlinecolor.red=80;
    575       myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->outlinecolor.green=80;
    576       myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->outlinecolor.blue=80;
     575      myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->color.red=125;
     576      myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->color.green=125;
     577      myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->color.blue=255;
     578      myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->outlinecolor.red=80;
     579      myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->outlinecolor.green=80;
     580      myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->outlinecolor.blue=80;
    577581
    578582      /**
     
    580584       */
    581585      if(myLayer->type == MS_LAYER_POLYGON)
    582         myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->width=3;
     586        myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->width=3;
    583587      if(myLayer->type == MS_LAYER_LINE){
    584         myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->width=3;
    585         myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->outlinewidth=1.5;
     588        myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->width=3;
     589        myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->outlinewidth=1.5;
    586590      }
    587591      if(myLayer->type == MS_LAYER_POINT){
    588         myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->symbol=1;
    589         myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->size=15;
    590       }
    591 
    592     }
    593     myLayer->class[myLayer->numclasses]->numstyles++;
     592        myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->symbol=1;
     593        myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->size=15;
     594      }
     595
     596    }
     597    myLayer->_class[myLayer->numclasses]->numstyles++;
    594598    myLayer->numclasses++;
    595599    m->layerorder[m->numlayers] = m->numlayers;
     
    606610
    607611int tryGdal(maps* conf,maps* output,mapObj* m){
    608 
    609612  map* tmpMap=getMap(output->content,"storage");
    610613  char *pszFilename=tmpMap->value;
     
    790793             */
    791794            if(msGrowLayerClasses(myLayer) == NULL)
    792               return;
    793             if(initClass((myLayer->class[myLayer->numclasses])) == -1)
    794               return;
    795             myLayer->class[myLayer->numclasses]->type = myLayer->type;
    796             if(msGrowClassStyles(myLayer->class[myLayer->numclasses]) == NULL)
    797               return ;
    798             if(initStyle(myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]) == -1)
    799               return;
     795              return -1;
     796            if(initClass((myLayer->_class[myLayer->numclasses])) == -1)
     797              return -1;
     798            myLayer->_class[myLayer->numclasses]->type = myLayer->type;
     799            if(msGrowClassStyles(myLayer->_class[myLayer->numclasses]) == NULL)
     800              return -1;
     801            if(initStyle(myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]) == -1)
     802              return -1;
    800803           
    801804            /**
     
    804807            char className[7];
    805808            sprintf(className,"class%d",i);
    806             myLayer->class[myLayer->numclasses]->name=strdup(className);
     809            myLayer->_class[myLayer->numclasses]->name=strdup(className);
    807810           
    808811            /**
     
    814817            else
    815818              sprintf(expression,"([pixel]>=%.3f AND [pixel]<=%.3f)",cstep,cstep+interval);
    816             msLoadExpressionString(&myLayer->class[myLayer->numclasses]->expression,expression);
     819            msLoadExpressionString(&myLayer->_class[myLayer->numclasses]->expression,expression);
    817820           
    818821            /**
    819822             * Set color
    820823             */
    821             myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->color.red=_tmpColors[i][0];
    822             myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->color.green=_tmpColors[i][1];
    823             myLayer->class[myLayer->numclasses]->styles[myLayer->class[myLayer->numclasses]->numstyles]->color.blue=_tmpColors[i][2];
     824            myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->color.red=_tmpColors[i][0];
     825            myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->color.green=_tmpColors[i][1];
     826            myLayer->_class[myLayer->numclasses]->styles[myLayer->_class[myLayer->numclasses]->numstyles]->color.blue=_tmpColors[i][2];
    824827            cstep+=interval;
    825             myLayer->class[myLayer->numclasses]->numstyles++;
     828            myLayer->_class[myLayer->numclasses]->numstyles++;
    826829            myLayer->numclasses++;
    827830           
     
    976979  }
    977980
     981  /*
     982   * Set mapserver PROJ_LIB/GDAL_DATA or any other config parameter from
     983   * the main.cfg [mapserver] section if any
     984   */
     985  maps *tmp3=getMaps(conf,"mapserver");
     986  if(tmp3!=NULL){
     987    map* tmp4=tmp3->content;
     988    while(tmp4!=NULL){
     989      msSetConfigOption(myMap,tmp4->name,tmp4->value);
     990      tmp4=tmp4->next;
     991    }
     992  }
     993
    978994  /**
    979995   * Set a ows_rootlayer_title, 
     
    10061022  if(tryOgr(conf,outputs,myMap)<0)
    10071023    if(tryGdal(conf,outputs,myMap)<0)
    1008       return NULL;
     1024      return ;
    10091025
    10101026  tmp1=getMapFromMaps(conf,"main","dataPath");
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