本文整理汇总了C++中Get_NY函数的典型用法代码示例。如果您正苦于以下问题:C++ Get_NY函数的具体用法?C++ Get_NY怎么用?C++ Get_NY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get_NY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Set_NoData_Value_Range
//---------------------------------------------------------
bool CSG_Grid::_Assign_Interpolated(CSG_Grid *pGrid, TSG_Grid_Interpolation Interpolation)
{
int x, y;
double xPosition, yPosition, z;
Set_NoData_Value_Range(pGrid->Get_NoData_Value(), pGrid->Get_NoData_hiValue());
for(y=0, yPosition=Get_YMin(); y<Get_NY() && SG_UI_Process_Set_Progress(y, Get_NY()); y++, yPosition+=Get_Cellsize())
{
for(x=0, xPosition=Get_XMin(); x<Get_NX(); x++, xPosition+=Get_Cellsize())
{
if( pGrid->Get_Value(xPosition, yPosition, z, Interpolation) )
{
Set_Value (x, y, z);
}
else
{
Set_NoData(x, y);
}
}
}
Get_History() = pGrid->Get_History();
Get_History().Add_Child(SG_T("GRID_OPERATION"), CSG_String::Format(SG_T("%f -> %f"), pGrid->Get_Cellsize(), Get_Cellsize()))->Add_Property(SG_T("NAME"), LNG("Resampling"));
SG_UI_Process_Set_Ready();
return( true );
}
示例2: Parameters
//---------------------------------------------------------
bool CViGrA_Watershed::On_Execute(void)
{
CSG_Grid *pInput = Parameters("INPUT" )->asGrid();
CSG_Grid *pOutput = Parameters("OUTPUT")->asGrid();
//-----------------------------------------------------
if( !Parameters("RGB")->asBool() )
{
vigra::FImage Input, Output(Get_NX(), Get_NY());
Copy_Grid_SAGA_to_VIGRA(*pInput, Input, true);
Segmentation(Input, Output, Parameters("SCALE")->asDouble(), Parameters("EDGES")->asBool());
Copy_Grid_VIGRA_to_SAGA(*pOutput, Output, false);
}
//-----------------------------------------------------
else // perform watershed segmentation on color image
{
vigra::BRGBImage Input, Output(Get_NX(), Get_NY());
Copy_RGBGrid_SAGA_to_VIGRA(*pInput, Input, true);
Segmentation(Input, Output, Parameters("SCALE")->asDouble(), Parameters("EDGES")->asBool());
Copy_RGBGrid_VIGRA_to_SAGA(*pOutput, Output, false);
}
//-----------------------------------------------------
pOutput->Fmt_Name("%s [%s]", pInput->Get_Name(), Get_Name().c_str());
return( true );
}
示例3: if
//---------------------------------------------------------
double CGSGrid_Variance::Get_GSGrid_Variance(int x, int y, int iRadius, int &Count)
{
int i, ix, iy;
double d, z, Variance;
Variance = 0;
z = pInput->asDouble(x,y);
for(i=rLength[iRadius-1], Count=0; i<rLength[iRadius]; i++, Count++)
{
ix = x + x_diff[i];
if( ix < 0 )
ix = 0;
else if( ix >= Get_NX() )
ix = Get_NX() - 1;
iy = y + y_diff[i];
if( iy < 0 )
iy = 0;
else if( iy >= Get_NY() )
iy = Get_NY() - 1;
d = z - pInput->asDouble(ix,iy);
Variance += d * d;
}
return( Variance );
}
示例4: Get_ZMin
//---------------------------------------------------------
void CSG_Grid::Invert(void)
{
int x, y;
double zMin, zMax;
if( is_Valid() && Get_ZRange() > 0.0 )
{
zMin = Get_ZMin();
zMax = Get_ZMax();
for(y=0; y<Get_NY() && SG_UI_Process_Set_Progress(y, Get_NY()); y++)
{
for(x=0; x<Get_NX(); x++)
{
if( !is_NoData(x, y) )
{
Set_Value(x, y, zMax - (asDouble(x, y) - zMin));
}
}
}
SG_UI_Process_Set_Ready();
Get_History().Add_Child(SG_T("GRID_OPERATION"), LNG("Inversion"));
}
}
示例5: switch
//---------------------------------------------------------
CSG_Grid & CSG_Grid::_Operation_Arithmetic(double Value, TSG_Grid_Operation Operation)
{
//-----------------------------------------------------
switch( Operation )
{
case GRID_OPERATION_Addition:
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Addition"));
break;
case GRID_OPERATION_Subtraction:
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Subtraction"));
Value = -Value;
break;
case GRID_OPERATION_Multiplication:
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Multiplication"));
break;
case GRID_OPERATION_Division:
if( Value == 0.0 )
return( *this );
Get_History().Add_Child(SG_T("GRID_OPERATION"), Value)->Add_Property(SG_T("NAME"), LNG("Division"));
Value = 1.0 / Value;
break;
}
//-----------------------------------------------------
for(int y=0; y<Get_NY() && SG_UI_Process_Set_Progress(y, Get_NY()); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( !is_NoData(x, y) )
{
switch( Operation )
{
case GRID_OPERATION_Addition:
case GRID_OPERATION_Subtraction:
Add_Value(x, y, Value);
break;
case GRID_OPERATION_Multiplication:
case GRID_OPERATION_Division:
Mul_Value(x, y, Value);
break;
}
}
}
}
SG_UI_Process_Set_Ready();
return( *this );
}
示例6: Parameters
//---------------------------------------------------------
bool CGrid_Histogram_Surface::Get_Lines(bool bRows)
{
int i, j, n_i, n_j;
CSG_Table Values;
CSG_Grid *pHist;
//-----------------------------------------------------
Parameters("HIST")->Set_Value(pHist = SG_Create_Grid(m_pGrid));
pHist->Set_NoData_Value_Range(
m_pGrid->Get_NoData_Value(),
m_pGrid->Get_NoData_hiValue()
);
n_i = bRows ? Get_NX() : Get_NY();
n_j = bRows ? Get_NY() : Get_NX();
Values.Add_Field(SG_T("Z"), SG_DATATYPE_Double);
for(i=0; i<n_i; i++)
{
Values.Add_Record();
}
//-----------------------------------------------------
for(j=0; j<n_j && Set_Progress(j, n_j); j++)
{
for(i=0; i<n_i; i++)
{
Values.Get_Record(i)->Set_Value(0, bRows ? m_pGrid->asDouble(i, j) : m_pGrid->asDouble(j, i));
}
Values.Set_Index(0, TABLE_INDEX_Ascending);
for(i=0; i<n_i; i++)
{
int k = i % 2 ? i / 2 : n_i - 1 - i / 2;
if( bRows )
{
pHist->Set_Value(k, j, Values.Get_Record_byIndex(i)->asDouble(0));
}
else
{
pHist->Set_Value(j, k, Values.Get_Record_byIndex(i)->asDouble(0));
}
}
}
//-----------------------------------------------------
return( true );
}
示例7: is_InGrid
///////////////////////////////////////////////////////////
//---------------------------------------------------------
// This function modifies the incoming integer variables!!!
//---------------------------------------------------------
bool CGrid_Polygon_Clip::Get_Extent(int &xMin, int &xCount, int &yMin, int &yCount, CSG_Grid *pMask, CSG_Parameter_Grid_List *pGrids)
{
bool bFound;
for(yMin=0, bFound=false; yMin<Get_NY() && !bFound && Process_Get_Okay(true); yMin++)
{
for(int x=0; x<Get_NX() && !bFound; x++)
{
bFound = is_InGrid(x, yMin, pMask, pGrids);
}
}
yMin--;
//-----------------------------------------------------
if( yMin < Get_NY() && Process_Get_Okay() )
{
int xMax, yMax;
for(yMax=Get_NY()-1, bFound=false; yMax>=yMin && !bFound && Process_Get_Okay(true); yMax--)
{
for(int x=0; x<Get_NX() && !bFound; x++)
{
bFound = is_InGrid(x, yMax, pMask, pGrids);
}
}
for(xMin=0, bFound=false; xMin<Get_NX() && !bFound && Process_Get_Okay(true); xMin++)
{
for(int y=yMin; y<yMax && !bFound; y++)
{
bFound = is_InGrid(xMin, y, pMask, pGrids);
}
}
xMin--;
for(xMax=Get_NX()-1, bFound=false; xMax>=xMin && !bFound && Process_Get_Okay(true); xMax--)
{
for(int y=yMin; y<yMax && !bFound; y++)
{
bFound = is_InGrid(xMax, y, pMask, pGrids);
}
}
xCount = 1 + xMax - xMin;
yCount = 1 + yMax - yMin;
return( xCount > 0 && yCount > 0 );
}
return( false );
}
示例8: return
//---------------------------------------------------------
bool CSG_Grid::_Assign_ExtremeValue(CSG_Grid *pGrid, bool bMaximum)
{
if( Get_Cellsize() < pGrid->Get_Cellsize() || is_Intersecting(pGrid->Get_Extent()) == INTERSECTION_None )
{
return( false );
}
//-----------------------------------------------------
int x, y, ix, iy;
double px, py, ax, ay, d, z;
CSG_Matrix S(Get_NY(), Get_NX()), N(Get_NY(), Get_NX());
d = pGrid->Get_Cellsize() / Get_Cellsize();
Set_NoData_Value(pGrid->Get_NoData_Value());
Assign_NoData();
//-----------------------------------------------------
ax = 0.5 + (pGrid->Get_XMin() - Get_XMin()) / Get_Cellsize();
ay = 0.5 + (pGrid->Get_YMin() - Get_YMin()) / Get_Cellsize();
for(y=0, py=ay; y<pGrid->Get_NY() && SG_UI_Process_Set_Progress(y, pGrid->Get_NY()); y++, py+=d)
{
if( (iy = (int)floor(py)) >= 0 && iy < Get_NY() )
{
for(x=0, px=ax; x<pGrid->Get_NX(); x++, px+=d)
{
if( !pGrid->is_NoData(x, y) && (ix = (int)floor(px)) >= 0 && ix < Get_NX() )
{
z = pGrid->asDouble(x, y);
if( is_NoData(ix, iy)
|| (bMaximum == true && z > asDouble(ix, iy))
|| (bMaximum == false && z < asDouble(ix, iy)) )
{
Set_Value(ix, iy, z);
}
}
}
}
}
//-----------------------------------------------------
Get_History() = pGrid->Get_History();
Get_History().Add_Child(SG_T("GRID_OPERATION"), CSG_String::Format(SG_T("%f -> %f"), pGrid->Get_Cellsize(), Get_Cellsize()))->Add_Property(SG_T("NAME"), LNG("Resampling"));
SG_UI_Process_Set_Ready();
return( true );
}
示例9: Parameters
//---------------------------------------------------------
bool CGSGrid_Variance::On_Execute(void)
{
int x, y;
//-----------------------------------------------------
pInput = Parameters("INPUT" )->asGrid();
pOutput = Parameters("RESULT" )->asGrid();
maxRadius = Parameters("RADIUS" )->asInt();
Exponent = Parameters("EXPONENT" )->asDouble();
//-----------------------------------------------------
Initialize();
//-----------------------------------------------------
for(y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(x=0; x<Get_NX(); x++)
{
pOutput->Set_Value(x,y, Get_Laenge(x,y) );
}
}
//-----------------------------------------------------
Finalize();
//-----------------------------------------------------
return( true );
}
示例10: log
//---------------------------------------------------------
bool CMRVBF::Get_MRVBF(int Level, CSG_Grid *pMRVBF, CSG_Grid *pVF, CSG_Grid *pMRRTF, CSG_Grid *pRF)
{
if( pMRVBF && pVF && pMRRTF && pRF )
{
double d, w, t, p;
t = 0.4;
p = log((Level - 0.5) / 0.1) / log(1.5);
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( !pMRVBF->is_NoData(x, y) && !pVF->is_NoData(x, y) )
{
d = pVF->asDouble(x, y);
w = 1.0 - Get_Transformation(d, t, p);
pMRVBF->Set_Value(x, y, w * (Level - 1 + d) + (1.0 - w) * pMRVBF->asDouble(x, y));
}
if( !pMRRTF->is_NoData(x, y) && !pRF->is_NoData(x, y) )
{
d = pRF->asDouble(x, y);
w = 1.0 - Get_Transformation(d, t, p);
pMRRTF->Set_Value(x, y, w * (Level - 1 + d) + (1.0 - w) * pMRRTF->asDouble(x, y));
}
}
}
return( true );
}
return( false );
}
示例11: Parameters
//---------------------------------------------------------
bool CGrid_Volume::On_Execute(void)
{
int x, y, Method;
double Level, Volume, z;
CSG_Grid *pGrid;
CSG_String s;
//-----------------------------------------------------
pGrid = Parameters("GRID") ->asGrid();
Level = Parameters("LEVEL") ->asDouble();
Method = Parameters("METHOD") ->asInt();
//-----------------------------------------------------
for(y=0, Volume=0.0; y<Get_NY() && Set_Progress(y); y++)
{
for(x=0; x<Get_NX(); x++)
{
if( !pGrid->is_NoData(x, y) )
{
z = pGrid->asDouble(x, y) - Level;
switch( Method )
{
case 0: // Count Only Above Base Level
if( z > 0.0 )
{
Volume += z;
}
break;
case 1: // Count Only Below Base Level
if( z < 0.0 )
{
Volume -= z;
}
break;
case 2: // Subtract Volumes Below Base Level
Volume += z;
break;
case 3: // Add Volumes Below Base Level
Volume += fabs(z);
break;
}
}
}
}
//-----------------------------------------------------
Volume *= pGrid->Get_Cellarea();
s.Printf(_TL("Volume: %f"), Volume);
Message_Add(s);
Message_Dlg(s, _TL("Grid Volume"));
//-----------------------------------------------------
return( true );
}
示例12: Parameters
//---------------------------------------------------------
bool CGradient_Polar_To_Cartes::On_Execute(void)
{
bool bDegree, bClockwise;
int Method;
double LEN, DIR, Zero;
CSG_Grid *pDX, *pDY, *pDIR, *pLEN;
//-----------------------------------------------------
pDX = Parameters("DX") ->asGrid();
pDY = Parameters("DY") ->asGrid();
pDIR = Parameters("DIR") ->asGrid();
pLEN = Parameters("LEN") ->asGrid();
bDegree = Parameters("UNITS") ->asInt() == 1;
Method = Parameters("SYSTEM") ->asInt();
if( Method == 0 ) // mathematic
{
Zero = M_PI_090;
bClockwise = false;
}
else
{
Zero = Parameters("SYSTEM_ZERO")->asDouble() * M_DEG_TO_RAD;
bClockwise = Parameters("SYSTEM_ORIENT")->asInt() == 0;
}
//-----------------------------------------------------
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( pLEN->is_NoData(x, y) || pDIR->is_NoData(x, y) )
{
pDX->Set_NoData(x, y);
pDY->Set_NoData(x, y);
}
else
{
LEN = pLEN->asDouble(x, y);
DIR = pDIR->asDouble(x, y);
if( bDegree )
{
DIR *= M_DEG_TO_RAD;
}
if( Method != 1 ) // not geographic
{
DIR = bClockwise ? DIR - Zero : Zero - DIR;
}
pDX->Set_Value(x, y, LEN * sin(DIR));
pDY->Set_Value(x, y, LEN * cos(DIR));
}
}
}
return( true );
}
示例13: Parameters
//---------------------------------------------------------
bool CCost_Accumulated::Get_Destinations(CPoints &Points)
{
Points.Clear();
m_pAccumulated->Set_NoData_Value(-1.0); m_pAccumulated->Assign(-1.0);
m_pAllocation ->Set_NoData_Value(-1.0); m_pAllocation ->Assign( 0.0);
if( Parameters("DEST_TYPE")->asInt() == 0 ) // Point
{
CSG_Shapes *pDestinations = Parameters("DEST_POINTS")->asShapes();
for(int i=0, x, y; i<pDestinations->Get_Count(); i++)
{
if( Get_System().Get_World_to_Grid(x, y, pDestinations->Get_Shape(i)->Get_Point(0)) && !m_pCost->is_NoData(x, y) )
{
Points.Add(x, y); m_pAllocation->Set_Value(x, y, Points.Get_Count()); m_pAccumulated->Set_Value(x, y, 0.0);
}
}
}
else // Grid
{
CSG_Grid *pDestinations = Parameters("DEST_GRID")->asGrid();
for(int y=0; y<Get_NY(); y++) for(int x=0; x<Get_NX(); x++)
{
if( !pDestinations->is_NoData(x, y) && !m_pCost->is_NoData(x, y) )
{
Points.Add(x, y); m_pAllocation->Set_Value(x, y, Points.Get_Count()); m_pAccumulated->Set_Value(x, y, 0.0);
}
}
}
return( Points.Get_Count() > 0 );
}
示例14: Parameters
//---------------------------------------------------------
bool CFragmentation_Classify::On_Execute(void)
{
CSG_Grid *pDensity, *pConnectivity, *pFragmentation;
pDensity = Parameters("DENSITY") ->asGrid();
pConnectivity = Parameters("CONNECTIVITY") ->asGrid();
pFragmentation = Parameters("FRAGMENTATION") ->asGrid();
m_Weight = Parameters("WEIGHT") ->asDouble();
m_Density_Min = Parameters("DENSITY_MIN") ->asDouble() / 100.0;
m_Density_Interior = Parameters("DENSITY_INT") ->asDouble() / 100.0;
//-----------------------------------------------------
CSG_Parameters Parms;
DataObject_Set_Colors(pFragmentation, 100, SG_COLORS_WHITE_GREEN, true);
if( DataObject_Get_Parameters(pFragmentation, Parms) && Parms("COLORS_TYPE") && Parms("LUT") )
{
Parms("LUT")->asTable()->Assign_Values(&m_LUT); // Lookup Table
Parms("COLORS_TYPE")->Set_Value(1); // Color Classification Type: Lookup Table
DataObject_Set_Parameters(pFragmentation, Parms);
}
// pFragmentation->Set_NoData_Value(CLASS_NONE);
//-----------------------------------------------------
if( 1 )
{
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
for(int x=0; x<Get_NX(); x++)
{
if( !pDensity->is_NoData(x, y) && !pConnectivity->is_NoData(x, y) )
{
double Density = pDensity ->asDouble(x, y) / 100.0;
double Connectivity = pConnectivity ->asDouble(x, y) / 100.0;
// pFragmentation ->Set_Value (x, y, 100.0 * Density * Connectivity);
pFragmentation ->Set_Value (x, y, Get_Classification(Density, Connectivity));
}
else
{
pFragmentation ->Set_NoData(x, y);
}
}
}
//-------------------------------------------------
if( Parameters("BORDER")->asBool() )
{
Add_Border(pFragmentation);
}
return( true );
}
return( false );
}
示例15: Parameters
//---------------------------------------------------------
bool CGrid_Division::On_Execute(void)
{
//-----------------------------------------------------
CSG_Grid *pA = Parameters("A")->asGrid();
CSG_Grid *pB = Parameters("B")->asGrid();
CSG_Grid *pC = Parameters("C")->asGrid();
DataObject_Set_Colors(pC, 11, SG_COLORS_RED_GREY_BLUE);
//-----------------------------------------------------
for(int y=0; y<Get_NY() && Set_Progress(y); y++)
{
#pragma omp parallel for
for(int x=0; x<Get_NX(); x++)
{
if( pA->is_NoData(x, y) || pB->is_NoData(x, y) || pB->asDouble(x, y) == 0.0 )
{
pC->Set_NoData(x, y);
}
else
{
pC->Set_Value(x, y, pA->asDouble(x, y) / pB->asDouble(x, y));
}
}
}
//-----------------------------------------------------
return( true );
}