⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gispoint.cpp

📁 基于小波的SAR斑点处理
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//	Output Parameters : None
//	Type of Return Value : void
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint ptA;
//			CGisPoint ptB;
//			......
//			ptB.SetPoint( ptA );
//			......

void CGisPoint::SetPoint( const CGisPoint& ptAnother )
{
	x = ptAnother.x;
	y = ptAnother.y;
	m_dwTag = ptAnother.m_dwTag;

	return;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : GetDistance
//	Function Code : None
//	Function : Get the distance from the current point to a given point
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : double
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			POINT ptAnother;
//			CGisPoint ptA;
//			double dDistance;
//			......
//			dDistance = ptA.GetDistance( ptAnother );
//			......

double CGisPoint::GetDistance( const POINT& ptAnother ) const
{
	double dDistance;
	double dTempX,dTempY;

	dTempX = ( double )( ptAnother.x );
	dTempY = ( double )( ptAnother.y );

	dDistance = ( x - dTempX ) * ( x - dTempX );
	dDistance += ( y - dTempY ) * ( y - dTempY );

	dDistance = sqrt( dDistance );

	return dDistance;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : GetDistance
//	Function Code : None
//	Function : Get the distance from the current point to a given point
//	Input Parameters : pptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : double
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			POINT *pptAnother;
//			CGisPoint ptA;
//			double dDistance;
//			......
//			dDistance = ptA.GetDistance( pptAnother );
//.			......

double CGisPoint::GetDistance( const POINT *pptAnother ) const
{
	double dDistance;
	double dTempX,dTempY;

	dTempX = ( double )( pptAnother->x );
	dTempY = ( double )( pptAnother->y );

	dDistance = ( x - dTempX ) * ( x - dTempX );
	dDistance += ( y - dTempY ) * ( y - dTempY );

	dDistance = sqrt( dDistance );

	return dDistance;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : GetDistance
//	Function Code : None
//	Function : Get the distance from the current point to a given point
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : double
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CPoint ptAnother;
//			CGisPoint ptA;
//			double dDistance;
//			......
//			dDistance = ptA.GetDistance( ptAnother );
//			......

double CGisPoint::GetDistance( const CPoint& ptAnother ) const
{
	double dDistance;
	double dTempX,dTempY;

	dTempX = ( double )( ptAnother.x );
	dTempY = ( double )( ptAnother.y );

	dDistance = ( x - dTempX ) * ( x - dTempX );
	dDistance += ( y - dTempY ) * ( y - dTempY );

	dDistance = sqrt( dDistance );

	return dDistance;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : GetDistance
//	Function Code : None
//	Function : Get the distance from the current point to a given point
//	Input Parameters : pptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : double
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CPoint *pptAnother;
//			CGisPoint ptA;
//			double dDistance;
//			......
//			dDistance = ptA.GetDistance( pptAnother );
//			......

double CGisPoint::GetDistance( const CPoint *pptAnother ) const
{
	double dDistance;
	double dTempX,dTempY;

	dTempX = ( double )( pptAnother->x );
	dTempY = ( double )( pptAnother->y );

	dDistance = ( x - dTempX ) * ( x - dTempX );
	dDistance += ( y - dTempY ) * ( y - dTempY );

	dDistance = sqrt( dDistance );

	return dDistance;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : GetDistance
//	Function Code : None
//	Function : Get the distance from the current point to a given point
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : double
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint ptA;
//			CGisPoint ptB;
//			double dDistance;
//			......
//			dDistance = ptB.GetDistance( ptA );
//			......

double CGisPoint::GetDistance( const CGisPoint& ptAnother ) const 
{
	double dDistance;

	dDistance = ( x - ptAnother.x ) * ( x - ptAnother.x );
	dDistance += ( y - ptAnother.y ) * ( y - ptAnother.y );
	dDistance = sqrt( dDistance );

	return dDistance;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : GetDistance
//	Function Code : None
//	Function : Get the distance from the current point to the given point
//	Input Parameters : pptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : double
//	Call : None
//	Called By : CGisPoint::RotatePoint()
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint *pptAnother;
//			CGisPoint ptA;
//			double dDistance;
//			......
//			dDistance = ptA.GetDistance( pptAnother );
//			......

double CGisPoint::GetDistance( const CGisPoint *pptAnother ) const
{
	ASSERT( pptAnother != NULL );

	double dDistance;

	dDistance = ( x - pptAnother->x ) * ( x - pptAnother->x );
	dDistance += ( y - pptAnother->y ) * ( y - pptAnother->y );
	
	dDistance = sqrt( dDistance );
	
	return dDistance;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : EqualTo
//	Function Code : None
//	Function : Determine whether the current point is equal to a given point 
//						 in a given distance( error scale ).
//						 If equal,return TRUE.Otherwise,return FALSE.
//	Input Parameters : ptAnother		Specifies the given point
//										 dDistance		Specifies the given distance( error scale )
//																	Default is 0.0
//	Output Parameters : None
//	Type of Return Value : BOOL
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint ptA;
//			CGisPoint ptB;
//			......	
//			if( ptB.EqualTo( ptA, 0.05 ) )
//			......

BOOL CGisPoint::EqualTo( const CGisPoint& ptAnother,double dDistance ) const
{
	ASSERT( dDistance >= 0.0 );

	if( dDistance == 0.0 )
		return ( x == ptAnother.x && y == ptAnother.y );
	else
	{
		/*dTemp = ( x - ptAnother.x ) * ( x - ptAnother.x );
		dTemp += ( y - ptAnother.y ) * ( y - ptAnother.y );
		
		return ( dTemp <= ( dDistance * dDistance ) );*/
		return ( fabs( x - ptAnother.x ) < dDistance 
			&& fabs( y - ptAnother.y ) < dDistance );
	}
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : operator ==
//	Function Code : None
//	Function : Overload operator ==
//						 It determines whether the current point is absolutely equal to a given point. 
//						 If absolutely equal,return TRUE.Otherwise,return FALSE.
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : BOOL
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint ptA;
//			CGisPoint ptB;
//			......
//			if( ptB == ptA )
//			......

BOOL CGisPoint::operator == ( const CGisPoint& ptAnother ) const
{
	return ( x == ptAnother.x && y == ptAnother.y );
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : operator !=
//	Function Code : None
//	Function : Overload operator != 
//						 It determines whether the current point is not equal to a given point.
//						 If absolutely equal,return FALSE.Otherwise,return TRUE.
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : BOOL
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint ptA;
//			CGisPoint ptB;
//			if( ptB != ptA )
//			......

BOOL CGisPoint::operator != ( const CGisPoint& ptAnother ) const
{
	return ( x != ptAnother.x || y != ptAnother.y );
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : operator =
//	Function Code : None
//	Function : Overload operator =
//						 It evaluates the current point with a given point.
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : void
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CGisPoint ptA;
//			CGisPoint ptB;
//			......
//			ptB = ptA;
//			......

void CGisPoint::operator = ( const CGisPoint& ptAnother )
{
	x = ptAnother.x;
	y = ptAnother.y;
	m_dwTag = ptAnother.m_dwTag;
	return;
}

///////////////////////////////////////////////////////////////////////////////
//	Function Name : operator =
//	Function Code : None
//	Function : Overload operator =
//						 It evaluates the current point with a given point.
//	Input Parameters : ptAnother		Specifies the given point	
//	Output Parameters : None
//	Type of Return Value : void
//	Call : None
//	Called By : None
//	Globals : None
//	Typical Usage:
//			......
//			CPoint ptA;
//			CGisPoint ptB;
//			......
//			ptB = ptA;
//			......

void CGisPoint::operator = ( const CPoint& ptAnother )
{
	x = (double) ptAnother.x;
	y = (double) ptAnother.y;

	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -