Changeset 901


Ignore:
Timestamp:
Mar 29, 2019, 9:47:54 AM (5 years ago)
Author:
djay
Message:

Update saga2zcfg to SAGA-GIS version 7.2.0, add support for date dataType.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/thirds/saga2zcfg/saga2zcfg.c

    r703 r901  
    55
    66#include <api_core.h>
    7 #include <module_library.h>
     7#include <saga_api.h>
    88
    99int Callback(TSG_UI_Callback_ID ID, CSG_UI_Parameter &Param_1, CSG_UI_Parameter &Param_2){
     
    144144  static bool g_bShow_Messages = false;
    145145  SG_Set_UI_Callback(Get_Callback());
     146#if SAGA_MAJOR_VERSION == 2
    146147  int n = SG_Get_Module_Library_Manager().Add_Directory(wxT(MODULE_LIBRARY_PATH),false);
    147   if( SG_Get_Module_Library_Manager().Get_Count() <= 0 ){
     148  if( SG_Get_Module_Library_Manager().Get_Count() <= 0 )
     149#else
     150  int n = SG_Get_Tool_Library_Manager().Add_Directory(wxT(MODULE_LIBRARY_PATH),false);
     151  if( SG_Get_Tool_Library_Manager().Get_Count() <= 0 )
     152#endif
     153  {
    148154    fprintf(stderr,"could not load any tool library");
    149155    return -2;
    150156  }
    151157
    152   for(int i=0;i<SG_Get_Module_Library_Manager().Get_Count();i++){
     158#if SAGA_MAJOR_VERSION == 2
     159  for(int i=0;i<SG_Get_Module_Library_Manager().Get_Count();i++)
     160#else
     161  for(int i=0;i<SG_Get_Tool_Library_Manager().Get_Count();i++)
     162#endif
     163    {
    153164   
     165#if SAGA_MAJOR_VERSION == 2
    154166    CSG_Module_Library * library=SG_Get_Module_Library_Manager().Get_Library(i);
     167#else
     168    CSG_Tool_Library * library=SG_Get_Tool_Library_Manager().Get_Library(i);
     169#endif
    155170    int lc=library->Get_Count();
    156171    if(!library->Get_Library_Name().Contains("io_")) {
    157172
    158173      for(int j=0;j<lc;j++){
     174#if SAGA_MAJOR_VERSION == 2
    159175        CSG_Module * module=library->Get_Module(j);
     176#else
     177        CSG_Tool * module=library->Get_Tool(j);
     178#endif
    160179        if(module!=NULL && !module->needs_GUI() /*&& !module->is_Interactive()*/ ){
    161180
    162181          mkdir(library->Get_Library_Name().b_str(),0755);
    163 
     182         
    164183          FILE *stdout1=fopen((library->Get_Library_Name()+"/"+module->Get_ID()+".zcfg").b_str(),"w+");
    165184          fprintf(stdout1,"[%d]\n",j);
     
    203222             
    204223            }
     224            else if(CSG_String(param->Get_Type_Identifier()).is_Same_As(CSG_String("date"),true)){
     225              printBasicMetadata(stdout1,param,false,true,true);
     226              fprintf(stdout1,"  <LiteralData>\n");
     227              fprintf(stdout1,"   dataType = date\n");
     228              fprintf(stdout1,"   <Default/>\n");
     229              fprintf(stdout1,"  </LiteralData>\n");
     230             
     231            }
    205232            else if(CSG_String(param->Get_Type_Identifier()).is_Same_As(CSG_String("range"),true)){
    206233
     
    212239              CSG_Parameter_Range *range=param->asRange();
    213240              fprintf(stdout1,"   <Default>\n");
     241#if SAGA_MAJOR_VERSION == 2
    214242              fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->Get_Data())->Get_LoVal());
     243#else
     244              //fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->asDataObject())->Get_Min());         
     245#endif
    215246              fprintf(stdout1,"   </Default>\n");
    216247              fprintf(stdout1,"  </LiteralData>\n");
     
    220251              fprintf(stdout1,"   dataType = float\n");
    221252              fprintf(stdout1,"   <Default>\n");
     253#if SAGA_MAJOR_VERSION == 2
    222254              fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->Get_Data())->Get_HiVal());
     255#else
     256              //fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->asDataObject())->Get_Max());         
     257#endif
    223258              fprintf(stdout1,"   </Default>\n");
    224259              fprintf(stdout1,"  </LiteralData>\n");
     
    280315                fprintf(stdout1,"   dataType = string\n");
    281316                fprintf(stdout1,"   <Default>\n");
     317#if SAGA_MAJOR_VERSION == 2
    282318                if( !param->Get_Data()->Get_Default().is_Empty() ){
    283319                  fprintf(stdout1,"    value = %s\n",param->Get_Data()->Get_Default().b_str());
    284320                }
     321#else
     322                if( !param->Get_Default().is_Empty() ){
     323                  fprintf(stdout1,"    value = %s\n",param->Get_Default().b_str());
     324                }
     325#endif
    285326                fprintf(stdout1,"   </Default>\n");
    286327                fprintf(stdout1,"  </LiteralData>\n");
     
    299340
    300341                fprintf(stdout1,"   <Default>\n");
     342#if SAGA_MAJOR_VERSION == 2
    301343                if( !param->Get_Data()->Get_Default().is_Empty() ){
    302344                  fprintf(stdout1,"    value = %s\n",param->Get_Data()->Get_Default().b_str());
    303345                }
     346#else
     347                if( !param->Get_Default().is_Empty() ){
     348                  fprintf(stdout1,"    value = %s\n",param->Get_Default().b_str());
     349                }
     350#endif
    304351                if(param->asValue()->has_Minimum() && param->asValue()->has_Maximum()){
    305352                  fprintf(stdout1,"    rangeMin = %f\n",param->asValue()->Get_Minimum());
     
    314361                fprintf(stdout1,"   dataType = bool\n");
    315362                fprintf(stdout1,"   <Default>\n");
     363#if SAGA_MAJOR_VERSION == 2
    316364                if( !param->Get_Data()->Get_Default().is_Empty() ){
    317365                  fprintf(stdout1,"    value = %s\n",(param->Get_Data()->Get_Default().Contains("0")?"false":"true"));
    318366                }
     367#else
     368                if( !param->Get_Default().is_Empty() ){
     369                  fprintf(stdout1,"    value = %s\n",(param->Get_Default().Contains("0")?"false":"true"));
     370                }
     371#endif
    319372                fprintf(stdout1,"   </Default>\n");
    320373                fprintf(stdout1,"  </LiteralData>\n"); 
     
    337390                  }
    338391                  fprintf(stdout1,"   <Default>\n");
     392#if SAGA_MAJOR_VERSION == 2
    339393                  if( !param->Get_Data()->Get_Default().is_Empty() ){
    340394                    fprintf(stdout1,"    value = %s\n",CSG_String(choice->Get_Item(atoi(param->Get_Data()->Get_Default()))).b_str());
    341395                  }
     396#else
     397                  if( !param->Get_Default().is_Empty() ){
     398                    fprintf(stdout1,"    value = %s\n",CSG_String(choice->Get_Item(atoi(param->Get_Default()))).b_str());
     399                  }               
     400#endif
    342401                  fprintf(stdout1,"   </Default>\n");
    343402                  fprintf(stdout1,"  </LiteralData>\n");
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