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


C++ EDA_RECT::Contains方法代码示例

本文整理汇总了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;
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:62,代码来源:block_module_editor.cpp

示例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;
    }
}
开发者ID:ianohara,项目名称:kicad-source-mirror,代码行数:56,代码来源:class_zone.cpp

示例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() );
}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:12,代码来源:class_track.cpp

示例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;
}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:14,代码来源:gerber_draw_item.cpp

示例5: HitTest

bool PCB_TARGET::HitTest( const EDA_RECT& aRect ) const
{
    if( aRect.Contains( m_Pos ) )
        return true;

    return false;
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:7,代码来源:class_mire.cpp

示例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 );
}
开发者ID:AlexanderBrevig,项目名称:kicad-source-mirror,代码行数:8,代码来源:lib_circle.cpp

示例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 );
}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:8,代码来源:lib_field.cpp

示例8: HitTest

bool SCH_SHEET_PIN::HitTest( const wxPoint& aPoint, int aAccuracy ) const
{
    EDA_RECT rect = GetBoundingBox();

    rect.Inflate( aAccuracy );

    return rect.Contains( aPoint );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:8,代码来源:sch_sheet_pin.cpp

示例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 );
}
开发者ID:nikgul,项目名称:kicad-source-mirror,代码行数:10,代码来源:class_module.cpp

示例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 );
}
开发者ID:johnbeard,项目名称:kicad,代码行数:10,代码来源:sch_text.cpp

示例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 );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:10,代码来源:class_pcb_target.cpp

示例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 );
}
开发者ID:Elphel,项目名称:kicad-source-mirror,代码行数:10,代码来源:eda_text.cpp

示例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;
}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:10,代码来源:lib_polyline.cpp

示例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 );
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:11,代码来源:class_text_mod.cpp

示例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() );
}
开发者ID:cpavlina,项目名称:kicad,代码行数:11,代码来源:sch_bus_entry.cpp


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