//--------------------------------------------------------- bool CCRS_Transform_Grid::On_Execute_Transformation(void) { m_Interpolation = Parameters("INTERPOLATION")->asInt(); //----------------------------------------------------- if( m_bList ) { int i; CSG_Parameters Grids; CSG_Parameter_Grid_List *pSources, *pTargets, *pGrids; pSources = Parameters("SOURCE")->asGridList(); pTargets = Parameters("TARGET")->asGridList(); pTargets->Del_Items(); pGrids = Grids.Add_Grid_List(NULL, "GRD", SG_T(""), SG_T(""), PARAMETER_INPUT, false)->asGridList(); for(i=0; i<pSources->Get_Count(); i++) { if( pSources->asGrid(i)->Get_Projection().is_Okay() ) { pGrids->Add_Item(pSources->asGrid(i)); } else { Error_Set(CSG_String::Format(SG_T("%s: %s\n"), _TL("unknown projection"), pSources->asGrid(i)->Get_Name())); } } pSources = Grids.Add_Grid_List(NULL, "SRC", SG_T(""), SG_T(""), PARAMETER_INPUT, false)->asGridList(); while( pGrids->Get_Count() > 0 ) { pSources->Add_Item(pGrids->asGrid(pGrids->Get_Count() - 1)); pGrids ->Del_Item(pGrids->Get_Count() - 1); for(i=pGrids->Get_Count()-1; i>=0; i--) { if( pGrids->asGrid(i)->Get_Projection() == pSources->asGrid(0)->Get_Projection() ) { pSources->Add_Item(pGrids->asGrid(i)); pGrids ->Del_Item(i); } } m_Projector.Set_Inverse(false); Transform(pSources); pSources->Del_Items(); } return( pTargets->Get_Count() > 0 ); } //----------------------------------------------------- else { return( Transform(Parameters("SOURCE")->asGrid()) ); } }
//--------------------------------------------------------- bool CCRS_Transform_Grid::On_Execute_Transformation(void) { switch( Parameters("RESAMPLING")->asInt() ) { default: m_Resampling = GRID_RESAMPLING_NearestNeighbour; break; case 1: m_Resampling = GRID_RESAMPLING_Bilinear ; break; case 2: m_Resampling = GRID_RESAMPLING_BicubicSpline ; break; case 3: m_Resampling = GRID_RESAMPLING_BSpline ; break; } //----------------------------------------------------- if( m_bList ) { int i; CSG_Parameters Grids; CSG_Parameter_Grid_List *pSources, *pTargets, *pGrids; pSources = Parameters("SOURCE")->asGridList(); pTargets = Parameters("GRIDS" )->asGridList(); pTargets->Del_Items(); pGrids = Grids.Add_Grid_List(NULL, "GRD", SG_T(""), SG_T(""), PARAMETER_INPUT, false)->asGridList(); for(i=pSources->Get_Count()-1; i>=0; i--) { if( pSources->asGrid(i)->Get_Projection().is_Okay() ) { pGrids->Add_Item(pSources->asGrid(i)); } else { Error_Fmt("%s: %s\n", _TL("unknown projection"), pSources->asGrid(i)->Get_Name()); } } pSources = Grids.Add_Grid_List(NULL, "SRC", SG_T(""), SG_T(""), PARAMETER_INPUT, false)->asGridList(); while( pGrids->Get_Count() > 0 ) { pSources->Add_Item(pGrids->asGrid(pGrids->Get_Count() - 1)); pGrids ->Del_Item(pGrids->Get_Count() - 1); for(i=pGrids->Get_Count()-1; i>=0; i--) { if( pGrids->asGrid(i)->Get_Projection() == pSources->asGrid(0)->Get_Projection() ) { pSources->Add_Item(pGrids->asGrid(i)); pGrids ->Del_Item(i); } } m_Projector.Set_Inverse(false); Transform(pSources); pSources->Del_Items(); } return( pTargets->Get_Count() > 0 ); } //----------------------------------------------------- else { return( Transform(Parameters("SOURCE")->asGrid()) ); } }