| | 12427 | return NULL; |
|---|
| | 12428 | } |
|---|
| | 12429 | |
|---|
| | 12430 | |
|---|
| | 12431 | SWIGINTERN PyObject *_wrap_ComputeProximity(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { |
|---|
| | 12432 | PyObject *resultobj = 0; |
|---|
| | 12433 | GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ; |
|---|
| | 12434 | GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ; |
|---|
| | 12435 | char **arg3 = (char **) NULL ; |
|---|
| | 12436 | GDALProgressFunc arg4 = (GDALProgressFunc) NULL ; |
|---|
| | 12437 | void *arg5 = (void *) NULL ; |
|---|
| | 12438 | int result; |
|---|
| | 12439 | void *argp1 = 0 ; |
|---|
| | 12440 | int res1 = 0 ; |
|---|
| | 12441 | void *argp2 = 0 ; |
|---|
| | 12442 | int res2 = 0 ; |
|---|
| | 12443 | PyObject * obj0 = 0 ; |
|---|
| | 12444 | PyObject * obj1 = 0 ; |
|---|
| | 12445 | PyObject * obj2 = 0 ; |
|---|
| | 12446 | PyObject * obj3 = 0 ; |
|---|
| | 12447 | PyObject * obj4 = 0 ; |
|---|
| | 12448 | char * kwnames[] = { |
|---|
| | 12449 | (char *) "srcBand",(char *) "proximityBand",(char *) "options",(char *) "callback",(char *) "callback_data", NULL |
|---|
| | 12450 | }; |
|---|
| | 12451 | |
|---|
| | 12452 | /* %typemap(arginit) ( const char* callback_data=NULL) */ |
|---|
| | 12453 | PyProgressData *psProgressInfo; |
|---|
| | 12454 | psProgressInfo = (PyProgressData *) CPLCalloc(1,sizeof(PyProgressData)); |
|---|
| | 12455 | psProgressInfo->nLastReported = -1; |
|---|
| | 12456 | psProgressInfo->psPyCallback = NULL; |
|---|
| | 12457 | psProgressInfo->psPyCallbackData = NULL; |
|---|
| | 12458 | if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OOO:ComputeProximity",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; |
|---|
| | 12459 | res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 | 0 ); |
|---|
| | 12460 | if (!SWIG_IsOK(res1)) { |
|---|
| | 12461 | SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ComputeProximity" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); |
|---|
| | 12462 | } |
|---|
| | 12463 | arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1); |
|---|
| | 12464 | res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 | 0 ); |
|---|
| | 12465 | if (!SWIG_IsOK(res2)) { |
|---|
| | 12466 | SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ComputeProximity" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); |
|---|
| | 12467 | } |
|---|
| | 12468 | arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2); |
|---|
| | 12469 | if (obj2) { |
|---|
| | 12470 | { |
|---|
| | 12471 | /* %typemap(in) char **options */ |
|---|
| | 12472 | /* Check if is a list */ |
|---|
| | 12473 | if ( ! PySequence_Check(obj2)) { |
|---|
| | 12474 | PyErr_SetString(PyExc_TypeError,"not a sequence"); |
|---|
| | 12475 | SWIG_fail; |
|---|
| | 12476 | } |
|---|
| | 12477 | |
|---|
| | 12478 | int size = PySequence_Size(obj2); |
|---|
| | 12479 | for (int i = 0; i < size; i++) { |
|---|
| | 12480 | char *pszItem = NULL; |
|---|
| | 12481 | if ( ! PyArg_Parse( PySequence_GetItem(obj2,i), "s", &pszItem ) ) { |
|---|
| | 12482 | PyErr_SetString(PyExc_TypeError,"sequence must contain strings"); |
|---|
| | 12483 | SWIG_fail; |
|---|
| | 12484 | } |
|---|
| | 12485 | arg3 = CSLAddString( arg3, pszItem ); |
|---|
| | 12486 | } |
|---|
| | 12487 | } |
|---|
| | 12488 | } |
|---|
| | 12489 | if (obj3) { |
|---|
| | 12490 | { |
|---|
| | 12491 | /* %typemap(in) (GDALProgressFunc callback = NULL) */ |
|---|
| | 12492 | /* callback_func typemap */ |
|---|
| | 12493 | if (obj3) { |
|---|
| | 12494 | void* cbfunction = NULL; |
|---|
| | 12495 | SWIG_ConvertPtr( obj3, |
|---|
| | 12496 | (void**)&cbfunction, |
|---|
| | 12497 | SWIGTYPE_p_f_double_p_q_const__char_p_void__int, |
|---|
| | 12498 | SWIG_POINTER_EXCEPTION | 0 ); |
|---|
| | 12499 | |
|---|
| | 12500 | if ( cbfunction == GDALTermProgress ) { |
|---|
| | 12501 | arg4 = GDALTermProgress; |
|---|
| | 12502 | } else { |
|---|
| | 12503 | if (!PyFunction_Check(obj3)) { |
|---|
| | 12504 | PyErr_SetString( PyExc_RuntimeError, |
|---|
| | 12505 | "Object given is not a Python function" ); |
|---|
| | 12506 | SWIG_fail; |
|---|
| | 12507 | } |
|---|
| | 12508 | psProgressInfo->psPyCallback = obj3; |
|---|
| | 12509 | arg4 = PyProgressProxy; |
|---|
| | 12510 | } |
|---|
| | 12511 | |
|---|
| | 12512 | } |
|---|
| | 12513 | |
|---|
| | 12514 | } |
|---|
| | 12515 | } |
|---|
| | 12516 | if (obj4) { |
|---|
| | 12517 | { |
|---|
| | 12518 | /* %typemap(in) ( void* callback_data=NULL) */ |
|---|
| | 12519 | |
|---|
| | 12520 | psProgressInfo->psPyCallbackData = obj4 ; |
|---|
| | 12521 | arg5 = psProgressInfo; |
|---|
| | 12522 | |
|---|
| | 12523 | } |
|---|
| | 12524 | } |
|---|
| | 12525 | { |
|---|
| | 12526 | result = (int)ComputeProximity(arg1,arg2,arg3,arg4,arg5); |
|---|
| | 12527 | if ( bUseExceptions ) { |
|---|
| | 12528 | CPLErr eclass = CPLGetLastErrorType(); |
|---|
| | 12529 | if ( eclass == CE_Failure || eclass == CE_Fatal ) { |
|---|
| | 12530 | SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() ); |
|---|
| | 12531 | } |
|---|
| | 12532 | } |
|---|
| | 12533 | } |
|---|
| | 12534 | resultobj = SWIG_From_int(static_cast< int >(result)); |
|---|
| | 12535 | { |
|---|
| | 12536 | /* %typemap(freearg) char **options */ |
|---|
| | 12537 | CSLDestroy( arg3 ); |
|---|
| | 12538 | } |
|---|
| | 12539 | { |
|---|
| | 12540 | /* %typemap(freearg) ( void* callback_data=NULL) */ |
|---|
| | 12541 | |
|---|
| | 12542 | CPLFree(psProgressInfo); |
|---|
| | 12543 | |
|---|
| | 12544 | } |
|---|
| | 12545 | return resultobj; |
|---|
| | 12546 | fail: |
|---|
| | 12547 | { |
|---|
| | 12548 | /* %typemap(freearg) char **options */ |
|---|
| | 12549 | CSLDestroy( arg3 ); |
|---|
| | 12550 | } |
|---|
| | 12551 | { |
|---|
| | 12552 | /* %typemap(freearg) ( void* callback_data=NULL) */ |
|---|
| | 12553 | |
|---|
| | 12554 | CPLFree(psProgressInfo); |
|---|
| | 12555 | |
|---|
| | 12556 | } |
|---|