Changeset 917 for trunk/zoo-project/zoo-kernel/service_internal_saga.c
- Timestamp:
- May 7, 2019, 2:17:08 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
False
/branches/prototype-v0 merged eligible
-
Property
svn:mergeinfo
set to
False
-
trunk/zoo-project/zoo-kernel/service_internal_saga.c
r790 r917 30 30 #include <api_core.h> 31 31 #include <data_manager.h> 32 #include < module_library.h>32 #include <saga_api.h> 33 33 #define _ZOO_SAGA 34 34 #include "service_internal_saga.h" … … 237 237 return false; 238 238 } 239 return( param->Set_Value(SG_Get_Data_Manager().Find(&fileName)) ); 239 fprintf(stderr,"%s %s\n",carg->name,carg->value); 240 fflush(stderr); 241 return( param->Set_Value(SG_Get_Data_Manager().Find(&fileName,false)) ); 240 242 } 241 243 else … … 250 252 SG_Get_Data_Manager().Add(&fileName); 251 253 } 252 param->asList()->Add_Item(SG_Get_Data_Manager().Find(&fileName ));254 param->asList()->Add_Item(SG_Get_Data_Manager().Find(&fileName,false)); 253 255 } 254 256 } … … 327 329 inmap=getMap(argument,(CSG_String(param->Get_Identifier())+"_MIN").b_str()); 328 330 if(inmap!=NULL) 331 #if SAGA_MAJOR_VERSION == 2 329 332 param->asRange()->Set_LoVal(strtod(inmap->value,NULL)); 333 #else 334 param->asRange()->Set_Min(strtod(inmap->value,NULL)); 335 #endif 330 336 inmap=getMap(argument,(CSG_String(param->Get_Identifier())+"_MAX").b_str()); 331 337 if(inmap!=NULL) 338 #if SAGA_MAJOR_VERSION == 2 332 339 param->asRange()->Set_HiVal(strtod(inmap->value,NULL)); 340 #else 341 param->asRange()->Set_Max(strtod(inmap->value,NULL)); 342 #endif 333 343 } 334 344 if(inmap==NULL){ … … 386 396 else if( param->is_DataObject_List() ) 387 397 { 388 for(int i=0; i<param->asList()->Get_Count(); i++) 398 for(int i=0; i< 399 #if SAGA_MAJOR_VERSION == 2 400 param->asList()->Get_Count() 401 #else 402 param->asList()->Get_Data_Count() 403 #endif 404 ; i++) 389 405 { 390 CSG_Data_Object *pObject = param->asList()->asDataObject(i); 406 CSG_Data_Object *pObject = 407 #if SAGA_MAJOR_VERSION == 2 408 param->asList()->asDataObject(i) 409 #else 410 param->asList()->Get_Data(i) 411 #endif 412 ; 391 413 392 414 if( pObject->is_Modified() && SG_File_Exists(pObject->Get_File_Name()) ) … … 439 461 } 440 462 } 441 463 #if SAGA_MAJOR_VERSION == 2 442 464 int nFileNames = param->asList()->Get_Count() <= fileNames.Get_Count() ? fileNames.Get_Count() : fileNames.Get_Count() - 1; 443 465 for(int i=0; i<param->asList()->Get_Count(); i++) … … 458 480 CSG_String(param->asList()->asDataObject(i)->Get_File_Name()).b_str()); 459 481 } 482 #else 483 int nFileNames = param->asList()->Get_Data_Count() <= fileNames.Get_Count() ? fileNames.Get_Count() : fileNames.Get_Count() - 1; 484 for(int i=0; i<param->asList()->Get_Data_Count(); i++) 485 { 486 if( i < nFileNames ) 487 { 488 param->asList()->Get_Data(i)->Save(fileNames[i]); 489 } 490 else 491 { 492 param->asList()->Get_Data(i)->Save(CSG_String::Format(SG_T("%s_%0*d"), 493 fileNames[fileNames.Get_Count() - 1].c_str(), 494 SG_Get_Digit_Count(param->asList()->Get_Data_Count()), 495 1 + i - nFileNames 496 )); 497 } 498 setMapArray(cMaps->content,"generated_file",i, 499 CSG_String(param->asList()->Get_Data(i)->Get_File_Name()).b_str()); 500 } 501 502 #endif 460 503 } 461 504 } … … 477 520 int res=SERVICE_FAILED; 478 521 522 #if SAGA_MAJOR_VERSION == 2 479 523 CSG_Module_Library * library=SG_Get_Module_Library_Manager().Get_Library(CSG_String(lib_name),true); 524 #else 525 CSG_Tool_Library * library=SG_Get_Tool_Library_Manager().Get_Library(CSG_String(lib_name),true); 526 #endif 480 527 if( library == NULL){ 481 528 char tmp[255]; … … 486 533 } 487 534 535 #if SAGA_MAJOR_VERSION == 2 488 536 CSG_Module * module=library->Get_Module(atoi(module_name)); 537 #else 538 CSG_Tool * module=library->Get_Tool(atoi(module_name)); 539 #endif 489 540 if(module == NULL){ 490 541 char tmp[255]; … … 985 1036 SG_Set_UI_Callback(Get_Callback(watcher)); 986 1037 1038 #if SAGA_MAJOR_VERSION == 2 987 1039 int n = SG_Get_Module_Library_Manager().Add_Directory(wxT(MODULE_LIBRARY_PATH),false); 988 if( SG_Get_Module_Library_Manager().Get_Count() <= 0 ){ 1040 if( SG_Get_Module_Library_Manager().Get_Count() <= 0 ) 1041 #else 1042 int n = SG_Get_Tool_Library_Manager().Add_Directory(wxT(MODULE_LIBRARY_PATH),false); 1043 if( SG_Get_Tool_Library_Manager().Get_Count() <= 0 ) 1044 #endif 1045 { 989 1046 setMapInMaps(*main_conf,"lenv","message","Could not load any SAGA tool library"); 990 1047 res=SERVICE_FAILED; … … 995 1052 996 1053 // Load the SAGA-GIS library corresponding to the serviceProvider 1054 #if SAGA_MAJOR_VERSION == 2 997 1055 CSG_Module_Library * library=SG_Get_Module_Library_Manager().Get_Library(CSG_String(serviceProvider->value),true); 1056 #else 1057 CSG_Tool_Library * library=SG_Get_Tool_Library_Manager().Get_Library(CSG_String(serviceProvider->value),true); 1058 #endif 998 1059 if( library == NULL){ 999 1060 char tmp[255]; … … 1005 1066 1006 1067 // Load the SAGA-GIS module corresponding to the service name from the library 1068 #if SAGA_MAJOR_VERSION == 2 1007 1069 CSG_Module * module=library->Get_Module(atoi(s->name)); 1070 #else 1071 CSG_Tool * module=library->Get_Tool(atoi(s->name)); 1072 #endif 1008 1073 if(module == NULL){ 1009 1074 char tmp[255]; … … 1017 1082 // Load all the parameters defined for the module 1018 1083 CSG_Parameters * params=module->Get_Parameters(); 1019 int pc=params->Get_Count();1020 1084 if(!params){ 1021 1085 char tmp[255]; … … 1026 1090 return res; 1027 1091 } 1092 int pc=params->Get_Count(); 1028 1093 1029 1094 // Loop over each inputs to transform raster files to grid when needed,
Note: See TracChangeset
for help on using the changeset viewer.