本文整理匯總了C++中DataObject_Update函數的典型用法代碼示例。如果您正苦於以下問題:C++ DataObject_Update函數的具體用法?C++ DataObject_Update怎麽用?C++ DataObject_Update使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DataObject_Update函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Parameters
//---------------------------------------------------------
bool CDVWK_SoilMoisture::On_Execute(void)
{
int Day, x, y, i, LandUseID;
CSG_Grid *pGrid;
//-----------------------------------------------------
if( pClimate->Get_Record_Count() > 0 )
{
pFK_mm = Parameters("STA_FC") ->asGrid();
FK_mm_Def = Parameters("STA_FC_DEF") ->asDouble();
pPWP_mm = Parameters("STA_PWP") ->asGrid();
PWP_mm_Def = Parameters("STA_PWP_DEF") ->asDouble();
pWi_mm = Parameters("DYN_W") ->asGrid();
DataObject_Set_Colors(pWi_mm, 100, SG_COLORS_YELLOW_BLUE);
//-------------------------------------------------
pLandUse = SG_Create_Grid(pWi_mm, pCropCoeff->Get_Record_Count() < 127 ? SG_DATATYPE_Char : SG_DATATYPE_Int);
pLandUse->Assign(Parameters("LANDUSE_DEF")->asInt());
if( (pGrid = Parameters("LANDUSE")->asGrid()) != NULL )
{
for(y=0; y<Get_NY(); y++)
{
for(x=0; x<Get_NX(); x++)
{
LandUseID = pGrid->asInt(x, y);
for(i=0; i<pCropCoeff->Get_Record_Count(); i++)
{
if( LandUseID == pCropCoeff->Get_Record(i)->asInt(0) )
{
pLandUse->Set_Value(x, y, i);
break;
}
}
}
}
}
//-------------------------------------------------
DataObject_Update(pWi_mm, 0, pFK_mm ? pFK_mm->Get_ZMax() : FK_mm_Def, true);
for(Day=0; Day<365 && Set_Progress(Day, 365); Day++)
{
Step_Day(Day);
DataObject_Update(pWi_mm, true);
}
//-------------------------------------------------
delete(pLandUse);
return( true );
}
return( false );
}
示例2: Get_Insolation
//---------------------------------------------------------
bool CSADO_SolarRadiation::Get_Insolation(void)
{
//-----------------------------------------------------
if( Initialise() )
{
if( m_bMoment )
{
Get_Insolation(m_Day_A, m_Hour);
Finalise();
}
//-------------------------------------------------
else
{
for(int Day=m_Day_A; Day<=m_Day_B && Process_Get_Okay(false); Day+=m_dDays)
{
for(double Hour=m_Hour; Hour<24.0 && Process_Get_Okay(false); Hour+=m_dHour)
{
Process_Set_Text(CSG_String::Format(SG_T("%s: %d(%d-%d), %s: %f"), _TL("Day"), Day, m_Day_A, m_Day_B, _TL("Hour"), Hour));
if( m_bUpdateDirect ) m_pSumDirect->Assign(0.0);
if( m_bUpdateDiffus ) m_pSumDiffus->Assign(0.0);
if( m_bUpdateTotal ) m_pSumTotal ->Assign(0.0);
if( Get_Insolation(Day, Hour) )
{
if( m_bUpdateDirect )
{
m_TmpDirect += *m_pSumDirect;
DataObject_Update(m_pSumDirect);
}
if( m_bUpdateDiffus )
{
m_TmpDiffus += *m_pSumDiffus;
DataObject_Update(m_pSumDiffus);
}
if( m_bUpdateTotal )
{
m_TmpTotal += *m_pSumTotal;
DataObject_Update(m_pSumTotal);
}
}
}
}
Finalise(m_dHour / (24.0 * (1 + m_Day_B - m_Day_A))); // *m_pSumDirect *= m_dHour / D->size();
}
}
//-----------------------------------------------------
return( true );
}
示例3: Error_Set
//---------------------------------------------------------
bool CLife::On_Execute(void)
{
//-----------------------------------------------------
m_pLife = m_Grid_Target.Get_Grid("LIFE", SG_DATATYPE_Byte);
if( !m_pLife )
{
Error_Set(_TL("could not create target grid"));
return( false );
}
//-----------------------------------------------------
m_nColors = Parameters("FADECOLOR")->asInt();
for(int y=0; y<m_pLife->Get_NY(); y++)
{
for(int x=0; x<m_pLife->Get_NX(); x++)
{
m_pLife->Set_Value(x, y, CSG_Random::Get_Uniform(0, 100) < 50 ? 0 : m_nColors);
}
}
//-----------------------------------------------------
m_pLife->Set_Name(_TL("Conway's Game of Life"));
m_pLife->Set_NoData_Value(-1);
DataObject_Add (m_pLife);
DataObject_Set_Colors(m_pLife, 11, SG_COLORS_WHITE_BLUE);
DataObject_Update (m_pLife, 0, m_nColors, SG_UI_DATAOBJECT_SHOW);
//-----------------------------------------------------
int i;
m_Count.Create(m_pLife->Get_System(), SG_DATATYPE_Byte);
for(i=1; Process_Get_Okay(true) && Next_Cycle(i > m_nColors); i++)
{
Process_Set_Text(CSG_String::Format("%s: %d", _TL("Life Cycle"), i));
DataObject_Update(m_pLife, 0, m_nColors);
}
m_Count.Destroy();
//-----------------------------------------------------
if( is_Progress() )
{
Message_Add(CSG_String::Format("\n%s %d %s\n", _TL("Dead after"), i, _TL("Life Cycles")), false);
}
return( true );
}
示例4: Parameters
//---------------------------------------------------------
bool CGrid_Profile::On_Execute(void)
{
m_pDEM = Parameters("DEM") ->asGrid();
m_pValues = Parameters("VALUES") ->asGridList();
m_pPoints = Parameters("POINTS") ->asShapes();
m_pLine = Parameters("LINE") ->asShapes();
m_bAdd = false;
DataObject_Update(m_pDEM , SG_UI_DATAOBJECT_SHOW_NEW_MAP);
DataObject_Update(m_pLine, SG_UI_DATAOBJECT_SHOW_LAST_MAP);
return( true );
}
示例5: DataObject_Update
//---------------------------------------------------------
bool CKinWav_D8::Gauges_Set_Flow(double Time)
{
if( m_pGauges_Flow && m_pGauges_Flow->Get_Field_Count() == m_pGauges->Get_Count() + 1 )
{
CSG_Table_Record *pRecord = m_pGauges_Flow->Add_Record();
pRecord->Set_Value(0, Time);
for(int i=0; i<m_pGauges->Get_Count(); i++)
{
double Flow;
if( m_pFlow->Get_Value(m_pGauges->Get_Shape(i)->Get_Point(0), Flow) )
{
pRecord->Set_Value(i + 1, Flow);
}
}
DataObject_Update(m_pGauges_Flow);
return( true );
}
return( false );
}
示例6: return
bool CIsochronesVar::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
{
int iX, iY;
if( Mode != MODULE_INTERACTIVE_LDOWN || !Get_Grid_Pos(iX, iY) )
{
return( false );
}
m_pTime->Assign((double)0);
writeTimeOut(iX, iY, iX, iY);
for(int y=0; y<Get_NY() && Set_Progress(y); y++){
for(int x=0; x<Get_NX(); x++){
m_pTime->Set_Value(x,y,m_pTime->asDouble(x,y)/3600.);
}// for
}// for
ZeroToNoData();
DataObject_Update(m_pTime, true);
return (true);
}//method
示例7: switch
//---------------------------------------------------------
bool CGrid_Profile::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
{
switch( Mode )
{
default:
break;
case MODULE_INTERACTIVE_LDOWN:
if( !m_bAdd )
{
m_bAdd = true;
m_pLine->Create(SHAPE_TYPE_Line, CSG_String::Format(SG_T("Profile [%s]"), m_pDEM->Get_Name()));
m_pLine->Add_Field("ID" , SG_DATATYPE_Int);
m_pLine->Add_Shape()->Set_Value(0, 1);
}
m_pLine->Get_Shape(0)->Add_Point(Get_System()->Fit_to_Grid_System(ptWorld));
DataObject_Update(m_pLine);
break;
case MODULE_INTERACTIVE_RDOWN:
Set_Profile();
m_bAdd = false;
break;
}
return( true );
}
示例8: switch
//---------------------------------------------------------
bool CSelect_Points::On_Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode)
{
switch( Mode )
{
case TOOL_INTERACTIVE_LUP:
m_pSelection->Del_Records();
if( m_bAddCenter )
{
m_pSelection->Add_Shape()->Add_Point(ptWorld);
}
if( m_Search.Select_Nearest_Points(ptWorld.Get_X(), ptWorld.Get_Y(), m_MaxPoints, m_Radius, m_Quadrant) )
{
for(int i=0; i<m_Search.Get_Selected_Count(); i++)
{
CSG_Shape *pPoint = m_pSelection->Add_Shape(m_pPoints->Get_Shape((int)m_Search.Get_Selected_Z(i)));
pPoint->Set_Value(m_pSelection->Get_Field_Count() - 2, i + 1);
pPoint->Set_Value(m_pSelection->Get_Field_Count() - 1, m_Search.Get_Selected_Distance(i));
}
}
DataObject_Update(m_pSelection);
break;
default:
break;
}
return( true );
}
示例9: DataObject_Get_Colors
void Cdodproperror::ApplyColors(CSG_Grid* from, CSG_Grid* to)
{
CSG_Colors colors;
DataObject_Get_Colors(from, colors);
DataObject_Set_Colors(to, colors);
DataObject_Update(to, false);
}
示例10: Parameters
//---------------------------------------------------------
void CHillslope_Evolution_FTCS::Set_Difference(void)
{
CSG_Grid *pDiff = Parameters("DIFF")->asGrid();
if( pDiff )
{
CSG_Grid *pDEM = Parameters("DEM")->asGrid();
#pragma omp parallel for
for(int i=0; i<Get_NCells(); i++)
{
if( pDEM->is_NoData(i) )
{
pDiff->Set_NoData(i);
}
else
{
pDiff->Set_Value(i, m_pDEM->asDouble(i) - pDEM->asDouble(i));
}
}
if( Parameters("UPDATE")->asBool() )
{
DataObject_Update(pDiff, SG_UI_DATAOBJECT_SHOW);
}
}
}
示例11: return
bool CSinuosity::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode){
int iX, iY;
if( Mode != MODULE_INTERACTIVE_LDOWN || !Get_Grid_Pos(iX, iY) )
{
return( false );
}
// if( !m_pDEM->is_InGrid_byPos(ptWorld.Get_X(), ptWorld.Get_Y()) ){
// return false;
// }//if
// iX = (int) ((ptWorld.Get_X() - m_pDEM->Get_XMin()) / m_pDEM->Get_Cellsize());
// iY = (int) ((ptWorld.Get_Y() - m_pDEM->Get_YMin()) / m_pDEM->Get_Cellsize());
m_iX = iX;
m_iY = iY;
m_pSinuosity->Assign((double)0);
writeDistOut(iX, iY, iX, iY);
ZeroToNoData();
calculateSinuosity();
DataObject_Update(m_pSinuosity);
return true;
}//method
示例12: switch
//---------------------------------------------------------
bool CMine_Sweeper::MakeBoard(int level)
{
int i, x, y;
CSG_Colors Colors;
switch( level )
{
case 0: Mine_NX = 8; Mine_NY = 8; N_Mines=10;
break;
case 1: Mine_NX = 16; Mine_NY = 16; N_Mines=40;
break;
case 2: Mine_NX = 30; Mine_NY = 16; N_Mines=99;
break;
}
pInput = SG_Create_Grid(SG_DATATYPE_Int,SPRITE_SIZE*Mine_NX, SPRITE_SIZE*Mine_NY);
pInput->Set_Name(_TL("Mine Sweeper"));
Parameters("GRID")->Set_Value(pInput);
//-----------------------------------------------------
CSG_Parameter *pLUT = DataObject_Get_Parameter(pInput, "LUT");
if( pLUT && pLUT->asTable() )
{
pLUT->asTable()->Del_Records();
for(i=0; i<16; i++)
{
CSG_Table_Record *pRecord = pLUT->asTable()->Add_Record();
pRecord->Set_Value(0, SG_GET_RGB(mine_res_color[i*3], mine_res_color[i*3+1], mine_res_color[i*3+2]));
pRecord->Set_Value(3, i);
}
DataObject_Set_Parameter(pInput, pLUT);
DataObject_Set_Parameter(pInput, "COLORS_TYPE", 1); // Color Classification Type: Lookup Table
}
Colors.Set_Count(16);
for ( i=0;i<16; i++)
{
Colors.Set_Color(i, SG_GET_RGB(mine_res_color[i*3], mine_res_color[i*3+1], mine_res_color[i*3+2]));
}
DataObject_Set_Colors(pInput, Colors);
DataObject_Update(pInput, 0.0, 15.0, true);
//-----------------------------------------------------
for( y = 0; y < Mine_NY; y++)
for( x = 0; x < Mine_NX; x++)
{
SetSprite(x,y,SPRITE_CLOSE);
}
pInput->Set_Value(0, 0);
return true;
}
示例13: Parameters
//---------------------------------------------------------
bool CFilter_Rank::On_Execute(void)
{
int x, y;
double Rank;
CSG_Grid *pResult;
//-----------------------------------------------------
m_pInput = Parameters("INPUT" )->asGrid();
pResult = Parameters("RESULT")->asGrid();
Rank = Parameters("RANK" )->asInt() / 100.0;
//-----------------------------------------------------
m_Kernel.Set_Radius(Parameters("RADIUS")->asInt(), Parameters("MODE")->asInt() == 0);
//-----------------------------------------------------
if( !pResult || pResult == m_pInput )
{
pResult = SG_Create_Grid(m_pInput);
}
else
{
pResult->Set_Name(CSG_String::Format(SG_T("%s [%s: %.1f]"), m_pInput->Get_Name(), _TL("Rank"), 100.0 * Rank));
pResult->Set_NoData_Value(m_pInput->Get_NoData_Value());
}
//-----------------------------------------------------
for(y=0; y<Get_NY() && Set_Progress(y); y++)
{
#pragma omp parallel private(x)
for(x=0; x<Get_NX(); x++)
{
double Value;
if( Get_Value(x, y, Rank, Value) )
{
pResult->Set_Value(x, y, Value);
}
else
{
pResult->Set_NoData(x, y);
}
}
}
//-----------------------------------------------------
if( !Parameters("RESULT")->asGrid() || Parameters("RESULT")->asGrid() == m_pInput )
{
m_pInput->Assign(pResult);
delete(pResult);
DataObject_Update(m_pInput);
}
m_Kernel.Destroy();
return( true );
}
示例14: if
//---------------------------------------------------------
bool CGeoref_Grid_Move::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
{
if( Mode == MODULE_INTERACTIVE_LDOWN )
{
m_Down = ptWorld;
}
else if( Mode == MODULE_INTERACTIVE_LUP )
{
if( m_Down != ptWorld )
{
if( m_pSource == NULL )
{
m_pSource = new CSG_Grid(*m_pGrid);
m_pSource ->Set_Name(m_pGrid->Get_Name());
m_Move = m_Down - ptWorld;
}
else
{
m_Move += m_Down - ptWorld;
}
//---------------------------------------------
int x, y, ix, iy, dx, dy;
dx = (int)(0.5 + m_Move.Get_X() / m_pSource->Get_Cellsize());
dy = (int)(0.5 + m_Move.Get_Y() / m_pSource->Get_Cellsize());
for(y=0, iy=dy; y<m_pGrid->Get_NY() && Set_Progress(y, m_pGrid->Get_NY()); y++, iy++)
{
if( iy >= 0 && iy < m_pSource->Get_NY() )
{
for(x=0, ix=dx; x<m_pGrid->Get_NX(); x++, ix++)
{
if( ix >= 0 && ix < m_pSource->Get_NX() )
{
m_pGrid->Set_Value(x, y, m_pSource->asDouble(ix, iy));
}
else
{
m_pGrid->Set_NoData(x, y);
}
}
}
else
{
for(x=0; x<m_pGrid->Get_NX(); x++)
{
m_pGrid->Set_NoData(x, y);
}
}
}
DataObject_Update(m_pGrid);
}
}
return( true );
}
示例15: switch
//---------------------------------------------------------
bool CShapes_Cut_Interactive::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
{
switch( Mode )
{
//-----------------------------------------------------
case MODULE_INTERACTIVE_LDOWN:
if( m_bDown == false )
{
m_bDown = true;
m_pDown = ptWorld;
}
return( true );
//-----------------------------------------------------
case MODULE_INTERACTIVE_LUP:
if( m_bDown == true )
{
m_bDown = false;
CSG_Rect r(m_pDown, ptWorld);
if( Get_Extent(r) )
{
if( Cut_Set_Extent(r, m_pExtent, true) )
{
DataObject_Update(m_pExtent);
}
if( Cut_Shapes(r, m_Method, m_pShapes, m_pCut) )
{
DataObject_Update(m_pCut);
}
else
{
Message_Add(_TL("No shapes in selection"));
}
}
}
return( true );
}
return( true );
}