本文整理汇总了C++中EDA_RECT::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ EDA_RECT::Contains方法的具体用法?C++ EDA_RECT::Contains怎么用?C++ EDA_RECT::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDA_RECT
的用法示例。
在下文中一共展示了EDA_RECT::Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MarkItemsInBloc
/* Mark items inside rect.
* Items are inside rect when an end point is inside rect
*/
int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
{
EDA_ITEM* item;
int ItemsCount = 0;
wxPoint pos;
D_PAD* pad;
if( module == NULL )
return 0;
pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
{
pad->ClearFlags( SELECTED );
pos = pad->GetPosition();
if( Rect.Contains( pos ) )
{
pad->SetFlags( SELECTED );
ItemsCount++;
}
}
item = module->GraphicalItems();
for( ; item != NULL; item = item->Next() )
{
item->ClearFlags( SELECTED );
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
if( ((EDGE_MODULE*)item )->HitTest( Rect ) )
{
item->SetFlags( SELECTED );
ItemsCount++;
}
break;
case PCB_MODULE_TEXT_T:
pos = ( (TEXTE_MODULE*) item )->GetTextPosition();
if( Rect.Contains( pos ) )
{
item->SetFlags( SELECTED );
ItemsCount++;
}
break;
default:
break;
}
}
return ItemsCount;
}
示例2: HitTest
bool ZONE_CONTAINER::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT arect = aRect;
arect.Inflate( aAccuracy );
CRect rect = m_Poly->GetBoundingBox();
EDA_RECT bbox;
bbox.SetOrigin( rect.left, rect.bottom );
bbox.SetEnd( rect.right, rect.top );
if( aContained )
return arect.Contains( bbox );
else // Test for intersection between aRect and the polygon
// For a polygon, using its bounding box has no sense here
{
// Fast test: if aRect is outside the polygon bounding box,
// rectangles cannot intersect
if( ! bbox.Intersects( arect ) )
return false;
// aRect is inside the polygon bounding box,
// and can intersect the polygon: use a fine test.
// aRect intersects the polygon if at least one aRect corner
// is inside the polygon
wxPoint corner = arect.GetOrigin();
if( HitTestInsideZone( corner ) )
return true;
corner.x = arect.GetEnd().x;
if( HitTestInsideZone( corner ) )
return true;
corner = arect.GetEnd();
if( HitTestInsideZone( corner ) )
return true;
corner.x = arect.GetOrigin().x;
if( HitTestInsideZone( corner ) )
return true;
// No corner inside arect, but outlines can intersect arect
// if one of outline corners is inside arect
int count = m_Poly->GetCornersCount();
for( int ii =0; ii < count; ii++ )
{
if( arect.Contains( m_Poly->GetPos( ii ) ) )
return true;
}
return false;
}
}
示例3: HitTest
bool TRACK::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT arect = aRect;
arect.Inflate( aAccuracy );
if( aContained )
/* Tracks are a special case:
* they are considered inside the rect if one end is inside the rect */
return arect.Contains( GetStart() ) || arect.Contains( GetEnd() );
else
return arect.Intersects( GetStart(), GetEnd() );
}
示例4: HitTest
bool GERBER_DRAW_ITEM::HitTest( const EDA_RECT& aRefArea ) const
{
wxPoint pos = GetABPosition( m_Start );
if( aRefArea.Contains( pos ) )
return true;
pos = GetABPosition( m_End );
if( aRefArea.Contains( pos ) )
return true;
return false;
}
示例5: HitTest
bool PCB_TARGET::HitTest( const EDA_RECT& aRect ) const
{
if( aRect.Contains( m_Pos ) )
return true;
return false;
}
示例6: Inside
bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const
{
/*
* FIXME: This fails to take into account the radius around the center
* point.
*/
return aRect.Contains( m_Pos.x, -m_Pos.y );
}
示例7: Inside
bool LIB_FIELD::Inside( EDA_RECT& rect ) const
{
/*
* FIXME: This fails to take into account the size and/or orientation of
* the text.
*/
return rect.Contains( m_Pos.x, -m_Pos.y );
}
示例8: HitTest
bool SCH_SHEET_PIN::HitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetBoundingBox();
rect.Inflate( aAccuracy );
return rect.Contains( aPoint );
}
示例9: HitTest
bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT arect = aRect;
arect.Inflate( aAccuracy );
if( aContained )
return arect.Contains( m_BoundaryBox );
else
return m_BoundaryBox.Intersects( arect );
}
示例10: HitTest
bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( aAccuracy );
if( aContained )
return aRect.Contains( bBox );
return aRect.Intersects( bBox );
}
示例11: HitTest
bool PCB_TARGET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT arect = aRect;
arect.Inflate( aAccuracy );
if( aContained )
return arect.Contains( GetBoundingBox() );
else
return GetBoundingBox().Intersects( arect );
}
示例12: TextHitTest
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetTextBox( -1 ); // Get the full text area.
wxPoint location = aPoint;
rect.Inflate( aAccuracy );
RotatePoint( &location, m_Pos, -m_Orient );
return rect.Contains( location );
}
示例13: Inside
bool LIB_POLYLINE::Inside( EDA_RECT& aRect ) const
{
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
{
if( aRect.Contains( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
return true;
}
return false;
}
示例14: TextHitTest
bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetTextBox( -1 );
wxPoint location = aPoint;
rect.Inflate( aAccuracy );
RotatePoint( &location, GetTextPos(), -GetDrawRotation() );
return rect.Contains( location );
}
示例15: HitTest
bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
EDA_RECT rect = aRect;
rect.Inflate( aAccuracy );
if( aContained )
return rect.Contains( GetBoundingBox() );
return rect.Intersects( GetBoundingBox() );
}