当前位置: 首页>>代码示例>>C++>>正文


C++ Get_xTo函数代码示例

本文整理汇总了C++中Get_xTo函数的典型用法代码示例。如果您正苦于以下问题:C++ Get_xTo函数的具体用法?C++ Get_xTo怎么用?C++ Get_xTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Get_xTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pow

//---------------------------------------------------------
void CFlow_by_Slope::Set_Area(int x, int y)
{
	double	Decay;

	if( Get_Decay(x, y, Decay) )
	{
		int		i, ix, iy;
		double	z, dzSum, dz[8];

		for(i=0, dzSum=0.0, z=m_pDEM->asDouble(x, y); i<8; i++)
		{
			if( m_pDEM->is_InGrid(ix = Get_xTo(i, x), iy = Get_yTo(i, y)) && (dz[i] = z - m_pDEM->asDouble(ix, iy)) > 0.0 )
			{
				dzSum	+= (dz[i] = pow(dz[i] / Get_Length(i), 1.1));
			}
			else
			{
				dz[i]	= 0.0;
			}
		}

		if( dzSum > 0.0 )
		{
			Decay	*= m_pFlow->asDouble(x, y) / dzSum;

			for(i=0; i<8; i++)
			{
				if( dz[i] > 0.0 )
				{
					m_pFlow->Add_Value(Get_xTo(i, x), Get_yTo(i, y), Decay * dz[i]);
				}
			}
		}
	}
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:36,代码来源:flow_by_slope.cpp

示例2: Get_xTo

//---------------------------------------------------------
void CFlow_Parallel::Set_MFD(int x, int y)
{
	int		i, ix, iy;
	double	z, d, dzSum, dz[8];

	//-----------------------------------------------------
	for(i=0, dzSum=0.0, z=m_pDTM->asDouble(x, y); i<8; i++)
	{
		ix	= Get_xTo(i, x);
		iy	= Get_yTo(i, y);

		if( m_pDTM->is_InGrid(ix, iy) )
		{
			d	= z - m_pDTM->asDouble(ix, iy);
		}
		else
		{
			ix	= Get_xTo(i + 4, x);
			iy	= Get_yTo(i + 4, y);

			if( m_pDTM->is_InGrid(ix, iy) )
			{
				d	= m_pDTM->asDouble(ix, iy) - z;
			}
			else
			{
				d	= 0.0;
			}
		}

		if( d > 0.0 )
		{
			dzSum	+= (dz[i] = pow(d / Get_Length(i), m_Converge));
		}
		else
		{
			dz[i]	= 0.0;
		}
	}

	//-----------------------------------------------------
	if( dzSum > 0.0 )
	{
		for(i=0; i<8; i++)
		{
			if( dz[i] > 0.0 )
			{
				Add_Fraction(x, y, i, dz[i] / dzSum);
			}
		}
	}
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:53,代码来源:Flow_Parallel.cpp

示例3: Get_Gradient

//---------------------------------------------------------
void CFlow_Parallel::BRM_GetOrtho(int Dir, int x, int y, int ix[3], int iy[3], double nnei[6], int nexp[6])
{
	int		jx, jy, i,
			i0	= (Dir + 2) % 8,
			i4	= (Dir + 6) % 8;

	double	Slope, Aspect;

	for(i=0; i<3; i++)
	{
		jx		= ix[i];
		jy		= iy[i];

		Get_Gradient(jx, jy, Slope, Aspect);

		nnei[i]	= M_RAD_TO_DEG * Slope;
		nexp[i]	= (int)(M_RAD_TO_DEG * Aspect);
	}

	jx		= Get_xTo(i0,x);
	jy		= Get_yTo(i0,y);

	Get_Gradient(jx, jy, Slope, Aspect);

	nnei[3]	= M_RAD_TO_DEG * Slope;
	nexp[3]	= (int)(M_RAD_TO_DEG * Aspect);

	jx		= Get_xTo(i4,x);
	jy		= Get_yTo(i4,y);

	Get_Gradient(jx, jy, Slope, Aspect);

	nnei[5]	= M_RAD_TO_DEG * Slope;
	nexp[5]	= (int)(M_RAD_TO_DEG * Aspect);

	Get_Gradient(x, y, Slope, Aspect);

	nnei[4]	= M_RAD_TO_DEG * Slope;
	nexp[4]	= (int)(M_RAD_TO_DEG * Aspect);	//[jy][jx]) ????!!!!...;

	for(i=0; i<6; i++)
		if(nexp[i]<0)
			nexp[i]	= nexp[4];

	for(i=0; i<6; i++)
	{
		nexp[i]	+= BRM_idreh[Dir];

		if(nexp[i]>360)
			nexp[i]	-= 360;
	}
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:53,代码来源:Flow_Parallel.cpp

示例4: pow

//---------------------------------------------------------
void CChannelNetwork_Distance::Initialize_MFD(int x, int y)
{
	const double	MFD_Convergence	= 1.1;

	double	Flow[8], dz, zSum = 0.0, z = m_pDEM->asDouble(x, y);

	if( m_pRoute )
	{
		for(int i=0, ix, iy; i<8; i++)
		{
			if( m_pDEM->is_InGrid(ix=Get_xTo(i, x), iy=Get_yTo(i, y)) && !m_pRoute->is_NoData(ix, iy) && (dz = z - m_pDEM->asDouble(ix, iy)) > 0.0 )
			{
				zSum	+= (Flow[i]	= pow(dz / Get_Length(i), MFD_Convergence));
			}
			else
			{
				Flow[i]	= 0.0;
			}
		}
	}

	if( zSum == 0.0 )
	{
		for(int i=0, ix, iy; i<8; i++)
		{
			if( m_pDEM->is_InGrid(ix=Get_xTo(i, x), iy=Get_yTo(i, y)) && (dz = z - m_pDEM->asDouble(ix, iy)) > 0.0 )
			{
				zSum	+= (Flow[i]	= pow(dz / Get_Length(i), MFD_Convergence));
			}
			else
			{
				Flow[i]	= 0.0;
			}
		}
	}

	if( zSum > 0.0 )
	{
		m_Flow[8].Set_Value(x, y, zSum);

		for(int i=0; i<8; i++)
		{
			if( Flow[i] > 0.0 )
			{
				m_Flow[i].Set_Value(x, y, Flow[i] / zSum);
			}
		}
	}
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:50,代码来源:ChannelNetwork_Distance.cpp

示例5: Get_xTo

//---------------------------------------------------------
void CChannelNetwork::Set_Route_Standard(int x, int y)
{
	int		i, ix, iy, iMin;

	double	z, dz, dzMin;

	z		= pDTM->asDouble(x,y);
	iMin	= 0;

	for(i=1; i<=8; i++)
	{
		ix		= Get_xTo(i,x);
		iy		= Get_yTo(i,y);

		if( !pDTM->is_InGrid(ix,iy) )
		{
			iMin	= i;
			break;
		}
		else
		{
			dz		= (z - pDTM->asDouble(ix,iy)) / Get_Length(i);

			if( iMin <= 0 || dzMin < dz )
			{
				iMin	= i;
				dzMin	= dz;
			}
		}
	}

	pChannels->Set_Value(x,y, iMin );
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:34,代码来源:ChannelNetwork.cpp

示例6: Process_Set_Text

//---------------------------------------------------------
void CD8_Flow_Analysis::Get_Direction(void)
{
	Process_Set_Text(_TL("Flow Direction"));

	m_pDir->Set_NoData_Value(-1);

	CSG_Grid	*pCon	= Parameters("CONNECTION")	->asGrid();

	if( pCon )
	{
		pCon->Assign(0.0);
	}

	for(int y=0; y<Get_NY() && Set_Progress(y); y++)
	{
		for(int x=0, i, ix, iy; x<Get_NX(); x++)
		{
			if( (i = m_pDEM->Get_Gradient_NeighborDir(x, y)) >= 0 && m_pDEM->is_InGrid(ix = Get_xTo(i, x), iy = Get_yTo(i, y)) )
			{
				m_pDir->Set_Value(x, y, i);

				if( pCon )
				{
					pCon->Add_Value(ix, iy, 1);
				}
			}
			else
			{
				m_pDir->Set_NoData(x, y);
			}
		}
	}
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:34,代码来源:D8_Flow_Analysis.cpp

示例7: Get_Cellsize

//---------------------------------------------------------
double CExercise_14::Vectorise(int x, int y, CSG_Shape *pSegment)
{
	int		Dir, ix, iy;
	double	Length;

	Length	= 0.0;

	pSegment->Add_Point(Get_XMin() + x * Get_Cellsize(), Get_YMin() + y * Get_Cellsize());

	if( (Dir = m_pDir->asInt(x, y)) >= 0 )
	{
		Length	= Get_Length(Dir);

		ix		= Get_xTo(Dir, x);
		iy		= Get_yTo(Dir, y);

		switch( m_pChnl->asInt(ix, iy) )
		{
		case CHANNEL:
			Length	+= Vectorise(ix, iy, pSegment);	// recursive function call...
			break;

		case MOUTH:
			Length	+= Get_Length(Dir);
			pSegment->Add_Point(Get_XMin() + ix * Get_Cellsize(), Get_YMin() + iy * Get_Cellsize());
			break;
		}
	}

	return( Length );
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:32,代码来源:Exercise_14.cpp

示例8: Get_xTo

//---------------------------------------------------------
bool CPit_Eliminator::Dig_Channels(void)
{
	bool	bPit;
	int		x, y, i, ix, iy;
	double	z;

	for(y=0; y<Get_NY() && Set_Progress(y); y++)
	{
		for(x=0; x<Get_NX(); x++)
		{
			z		= pDTM->asDouble(x, y);

			for(i=0, bPit=true; i<8 && bPit; i++)
			{
				ix		= Get_xTo(i, x);
				iy		= Get_yTo(i, y);

				if( !is_InGrid(ix, iy) || z > pDTM->asDouble(ix, iy) )
				{
					bPit	= false;
				}
			}

			if( bPit )
			{
				Dig_Channel(x, y);
			}
		}
	}

	return( is_Progress() );
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:33,代码来源:Pit_Eliminator.cpp

示例9: Lock_Set

//---------------------------------------------------------
void CFlow_RecursiveUp::Get_Flow(int x, int y)
{
	int		i, ix, iy, j;

	double	jFlow;

	if( !is_Locked(x,y) )
	{
		Lock_Set(x,y);

		Init_Cell(x,y);

		for(i=0, j=4; i<8; i++, j=(j+1)%8)
		{
			ix	= Get_xTo(i,x);
			iy	= Get_yTo(i,y);

			if( is_InGrid(ix,iy) )
			{
				jFlow	= Flow[iy][ix][j];

				if( jFlow > 0 )
				{
					Get_Flow(ix,iy);

					Add_Fraction(ix,iy,j,jFlow);
				}
			}
		}
	}
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:32,代码来源:Flow_RecursiveUp.cpp

示例10: return

//---------------------------------------------------------
bool CChannelNetwork_Distance::Set_D8(int x, int y)
{
	int	Direction;

	if( !Get_D8(x, y, Direction) )
	{
		return( false );
	}

	int	ix = Get_xTo(Direction, x), iy = Get_yTo(Direction, y);

	double	dz	= m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy);
	double	dx	= Get_Length(Direction);

	m_pDistance->Set_Value(x, y, m_pDistance->asDouble(ix, iy) + sqrt(dz*dz + dx*dx));
	m_pDistVert->Set_Value(x, y, m_pDistVert->asDouble(ix, iy) + dz);
	m_pDistHorz->Set_Value(x, y, m_pDistHorz->asDouble(ix, iy) + dx);

	if( m_pTime )
	{
		double	dt	= Get_Travel_Time(x, y, Direction);

		m_pTime->Set_Value(x, y, m_pTime->asDouble(ix, iy) + dt);
	}

	if( m_pFields )
	{
		int	Crossed	= m_pFields->asDouble(ix, iy) == m_pFields->asDouble(x, y) ? 0 : 1;

		m_pPasses->Set_Value(x, y, m_pPasses->asInt(ix, iy) + Crossed);
	}

	return( true );
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:35,代码来源:ChannelNetwork_Distance.cpp

示例11: Get_xTo

//---------------------------------------------------------
inline double CChannelNetwork_Distance::Get_Travel_Time(int x, int y, int Direction)
{
	int	ix = Get_xTo(Direction, x), iy = Get_yTo(Direction, y);

	double	v, k, R, dz, dx;

	dz	= m_pDEM->is_InGrid(ix, iy) ? m_pDEM->asDouble(x, y) - m_pDEM->asDouble(ix, iy) : 0.1;
	dx	= Get_Length(Direction);

//	k	= m_pFlow_K && !m_pFlow_K->is_NoData(x, y) ? m_pFlow_K->asDouble(x, y) : m_Flow_K;
	k	= !m_pFlow_K || (m_pFlow_K->is_NoData(x, y) && m_pFlow_K->is_NoData(ix, iy)) ? m_Flow_K
		: m_pFlow_K->is_NoData( x,  y) ? m_pFlow_K->asDouble(ix, iy)
		: m_pFlow_K->is_NoData(ix, iy) ? m_pFlow_K->asDouble( x,  y)
		: (m_pFlow_K->asDouble(x, y) + m_pFlow_K->asDouble(ix, iy)) / 2.0;

//	R	= m_pFlow_R && !m_pFlow_R->is_NoData(x, y) ? m_pFlow_R->asDouble(x, y) : m_Flow_R;
	R	= !m_pFlow_R || (m_pFlow_R->is_NoData(x, y) && m_pFlow_R->is_NoData(ix, iy)) ? m_Flow_R
		: m_pFlow_R->is_NoData( x,  y) ? m_pFlow_R->asDouble(ix, iy)
		: m_pFlow_R->is_NoData(ix, iy) ? m_pFlow_R->asDouble( x,  y)
		: (m_pFlow_R->asDouble(x, y) + m_pFlow_R->asDouble(ix, iy)) / 2.0;

	v	= k * pow(R, 2.0 / 3.0) * sqrt(dz / dx);	// [m / s], simplified Manning equation

	return( dx / (v * 3600.0) );	// return travel time in hours
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:26,代码来源:ChannelNetwork_Distance.cpp

示例12: Parameters

//---------------------------------------------------------
void CHillslope_Evolution_FTCS::Set_Diffusion(double dFactor)
{
	int	iStep	= Parameters("NEIGHBOURS")->asInt() == 1 ? 1 : 2;

	m_pDEM_Old->Assign(m_pDEM);

	#pragma omp parallel for
	for(int y=0; y<Get_NY(); y++)
	{
		for(int x=0; x<Get_NX(); x++)
		{
			if( !m_pDEM_Old->is_NoData(x, y) )
			{
				double	z	= m_pDEM_Old->asDouble(x, y);
				double	dz	= 0.0;

				for(int i=0; i<8; i+=iStep)
				{
					int	ix	= Get_xTo(i, x);
					int	iy	= Get_yTo(i, y);

					if( m_pDEM_Old->is_InGrid(ix, iy) )
					{
						dz	+= (m_pDEM_Old->asDouble(ix, iy) - z) / Get_UnitLength(i);
					}
				}

				m_pDEM->Add_Value(x, y, dFactor * dz);
			}
		}
	}
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:33,代码来源:hillslope_evolution_ftcs.cpp

示例13: Get_xTo

//---------------------------------------------------------
void CChannelNetwork_Distance::Initialize_D8(int x, int y)
{
	int		i, iMax, iRoute;
	double	z, dz, dzMax, dzRoute;

	for(i=0, iMax=-1, dzMax=0.0, iRoute=-1, dzRoute=0.0, z=m_pDEM->asDouble(x, y); i<8; i++)
	{
		int	ix	= Get_xTo(i, x);
		int	iy	= Get_yTo(i, y);

		if( is_InGrid(ix, iy) && (dz = (z - m_pDEM->asDouble(ix, iy)) / Get_Length(i)) > 0.0 )
		{
			if( dz > dzMax )
			{
				iMax	= i;
				dzMax	= dz;
			}

			if( m_pRoute && !m_pRoute->is_NoData(ix, iy) && dz > dzRoute )
			{
				iRoute	= i;
				dzRoute	= dz;
			}
		}
	}

	m_Dir.Set_Value(x, y, iRoute >= 0 ? iRoute : iMax);
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:29,代码来源:ChannelNetwork_Distance.cpp

示例14: Get_xTo

//---------------------------------------------------------
void CFlow_RecursiveUp::Set_MFD(int x, int y)
{
	int		i, ix, iy;

	double	z, d, *dz, dzSum;

	z		= pDTM->asDouble(x,y);
	dz		= Flow[y][x];
	dzSum	= 0;

	for(i=0; i<8; i++)
	{
		ix	= Get_xTo(i,x);
		iy	= Get_yTo(i,y);

		if( is_InGrid(ix,iy) )
		{
			d	= z - pDTM->asDouble(ix,iy);

			if( d > 0 )
				dzSum	+= dz[i]	= pow(d / Get_Length(i), MFD_Converge);
		}
	}

	if( dzSum )
	{
		for(i=0; i<8; i++)
			if( dz[i] > 0 )
				dz[i]	/= dzSum;
	}
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:32,代码来源:Flow_RecursiveUp.cpp

示例15: DataObject_Add

//---------------------------------------------------------
bool CKinWav_D8::Gauges_Initialise(void)
{
	if( m_pGauges_Flow != NULL )
	{
		if( m_pGauges == NULL )
		{
			DataObject_Add(m_pGauges = SG_Create_Shapes(SHAPE_TYPE_Point, _TL("Gauges")));

			Parameters("GAUGES")->Set_Value(m_pGauges);

			m_pGauges->Add_Field(_TL("ID"), SG_DATATYPE_Int);

			for(int y=0; y<Get_NY() && Set_Progress(y); y++)
			{
				for(int x=0; x<Get_NX(); x++)
				{
					bool	bBorder	= false;
					bool	bLowest	= true;

					for(int i=0; i<8; i++)
					{
						int	ix	= Get_xTo(i, x);
						int	iy	= Get_yTo(i, y);

						if( !m_pDEM->is_InGrid(ix, iy) )
						{
							bBorder	= true;
						}
						else if( m_pDEM->asDouble(ix, iy) < m_pDEM->asDouble(x, y) )
						{
							bLowest	= false;
						}
					}

					if( bLowest && bBorder )
					{
						CSG_Shape	*pGauge	= m_pGauges->Add_Shape();

						pGauge->Add_Point(Get_System()->Get_Grid_to_World(x, y));
						pGauge->Set_Value(0, m_pGauges->Get_Count() + 1);
					}
				}
			}
		}

		m_pGauges_Flow->Destroy();
		m_pGauges_Flow->Set_Name(_TL("Outlet Hydrographs"));
		m_pGauges_Flow->Add_Field("TIME", SG_DATATYPE_Double);

		for(int i=0; i<m_pGauges->Get_Count(); i++)
		{
			m_pGauges_Flow->Add_Field(CSG_String::Format(SG_T("GAUGE_%02d"), i + 1), SG_DATATYPE_Double);
		}

		return( true );
	}

	return( false );
}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:60,代码来源:KinWav_D8.cpp


注:本文中的Get_xTo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。