Changeset 901 for branches/prototype-v0
- Timestamp:
- Mar 29, 2019, 9:47:54 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/thirds/saga2zcfg/saga2zcfg.c
r703 r901 5 5 6 6 #include <api_core.h> 7 #include < module_library.h>7 #include <saga_api.h> 8 8 9 9 int Callback(TSG_UI_Callback_ID ID, CSG_UI_Parameter &Param_1, CSG_UI_Parameter &Param_2){ … … 144 144 static bool g_bShow_Messages = false; 145 145 SG_Set_UI_Callback(Get_Callback()); 146 #if SAGA_MAJOR_VERSION == 2 146 147 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 { 148 154 fprintf(stderr,"could not load any tool library"); 149 155 return -2; 150 156 } 151 157 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 { 153 164 165 #if SAGA_MAJOR_VERSION == 2 154 166 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 155 170 int lc=library->Get_Count(); 156 171 if(!library->Get_Library_Name().Contains("io_")) { 157 172 158 173 for(int j=0;j<lc;j++){ 174 #if SAGA_MAJOR_VERSION == 2 159 175 CSG_Module * module=library->Get_Module(j); 176 #else 177 CSG_Tool * module=library->Get_Tool(j); 178 #endif 160 179 if(module!=NULL && !module->needs_GUI() /*&& !module->is_Interactive()*/ ){ 161 180 162 181 mkdir(library->Get_Library_Name().b_str(),0755); 163 182 164 183 FILE *stdout1=fopen((library->Get_Library_Name()+"/"+module->Get_ID()+".zcfg").b_str(),"w+"); 165 184 fprintf(stdout1,"[%d]\n",j); … … 203 222 204 223 } 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 } 205 232 else if(CSG_String(param->Get_Type_Identifier()).is_Same_As(CSG_String("range"),true)){ 206 233 … … 212 239 CSG_Parameter_Range *range=param->asRange(); 213 240 fprintf(stdout1," <Default>\n"); 241 #if SAGA_MAJOR_VERSION == 2 214 242 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 215 246 fprintf(stdout1," </Default>\n"); 216 247 fprintf(stdout1," </LiteralData>\n"); … … 220 251 fprintf(stdout1," dataType = float\n"); 221 252 fprintf(stdout1," <Default>\n"); 253 #if SAGA_MAJOR_VERSION == 2 222 254 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 223 258 fprintf(stdout1," </Default>\n"); 224 259 fprintf(stdout1," </LiteralData>\n"); … … 280 315 fprintf(stdout1," dataType = string\n"); 281 316 fprintf(stdout1," <Default>\n"); 317 #if SAGA_MAJOR_VERSION == 2 282 318 if( !param->Get_Data()->Get_Default().is_Empty() ){ 283 319 fprintf(stdout1," value = %s\n",param->Get_Data()->Get_Default().b_str()); 284 320 } 321 #else 322 if( !param->Get_Default().is_Empty() ){ 323 fprintf(stdout1," value = %s\n",param->Get_Default().b_str()); 324 } 325 #endif 285 326 fprintf(stdout1," </Default>\n"); 286 327 fprintf(stdout1," </LiteralData>\n"); … … 299 340 300 341 fprintf(stdout1," <Default>\n"); 342 #if SAGA_MAJOR_VERSION == 2 301 343 if( !param->Get_Data()->Get_Default().is_Empty() ){ 302 344 fprintf(stdout1," value = %s\n",param->Get_Data()->Get_Default().b_str()); 303 345 } 346 #else 347 if( !param->Get_Default().is_Empty() ){ 348 fprintf(stdout1," value = %s\n",param->Get_Default().b_str()); 349 } 350 #endif 304 351 if(param->asValue()->has_Minimum() && param->asValue()->has_Maximum()){ 305 352 fprintf(stdout1," rangeMin = %f\n",param->asValue()->Get_Minimum()); … … 314 361 fprintf(stdout1," dataType = bool\n"); 315 362 fprintf(stdout1," <Default>\n"); 363 #if SAGA_MAJOR_VERSION == 2 316 364 if( !param->Get_Data()->Get_Default().is_Empty() ){ 317 365 fprintf(stdout1," value = %s\n",(param->Get_Data()->Get_Default().Contains("0")?"false":"true")); 318 366 } 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 319 372 fprintf(stdout1," </Default>\n"); 320 373 fprintf(stdout1," </LiteralData>\n"); … … 337 390 } 338 391 fprintf(stdout1," <Default>\n"); 392 #if SAGA_MAJOR_VERSION == 2 339 393 if( !param->Get_Data()->Get_Default().is_Empty() ){ 340 394 fprintf(stdout1," value = %s\n",CSG_String(choice->Get_Item(atoi(param->Get_Data()->Get_Default()))).b_str()); 341 395 } 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 342 401 fprintf(stdout1," </Default>\n"); 343 402 fprintf(stdout1," </LiteralData>\n");
Note: See TracChangeset
for help on using the changeset viewer.