예제 #1
0
void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
    wxString msg;

    msg = _( "Zone Outline" );

    // Display Cutout instead of Outline for holes inside a zone
    // i.e. when num contour !=0
    int ncont = m_Poly->GetContour( m_CornerSelection );

    if( ncont )
        msg << wxT( " " ) << _( "(Cutout)" );

    aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );

    if( GetIsKeepout() )
    {
        msg.Empty();

        if( GetDoNotAllowVias() )
            AccumulateDescription( msg, _("No via") );

        if( GetDoNotAllowTracks() )
            AccumulateDescription( msg, _("No track") );

        if( GetDoNotAllowCopperPour() )
            AccumulateDescription( msg, _("No copper pour") );

        aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) );
    }
    else if( IsOnCopperLayer() )
    {
        if( GetNetCode() >= 0 )
        {
            NETINFO_ITEM* equipot = GetNet();

            if( equipot )
                msg = equipot->GetNetname();
            else
                msg = wxT( "<noname>" );
        }
        else // a netcode < 0 is an error
        {
            msg = wxT( " [" );
            msg << GetNetname() + wxT( "]" );
            msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
        }

        aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );

#if 1
        // Display net code : (useful in test or debug)
        msg.Printf( wxT( "%d" ), GetNetCode() );
        aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
#endif

        // Display priority level
        msg.Printf( wxT( "%d" ), GetPriority() );
        aList.push_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) );
    }
    else
    {
        aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) );
    }

    aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );

    msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.GetCornersCount() );
    aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) );

    if( m_FillMode )
        msg = _( "Segments" );
    else
        msg = _( "Polygons" );

    aList.push_back( MSG_PANEL_ITEM( _( "Fill mode" ), msg, BROWN ) );

    // Useful for statistics :
    msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() );
    aList.push_back( MSG_PANEL_ITEM( _( "Hatch lines" ), msg, BLUE ) );

    if( m_FilledPolysList.GetCornersCount() )
    {
        msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.GetCornersCount() );
        aList.push_back( MSG_PANEL_ITEM( _( "Corners in DrawList" ), msg, BLUE ) );
    }
}
bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb,
        CPOLYGONS_LIST* aCornerBuffer )
{
    if( aCornerBuffer == NULL )
        m_FilledPolysList.RemoveAllContours();

    /* convert outlines + holes to outlines without holes (adding extra segments if necessary)
     * m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building
     * this zone
     */

    if( GetNumCorners() <= 2 )  // malformed zone. polygon calculations do not like it ...
        return 0;

    // Make a smoothed polygon out of the user-drawn polygon if required
    if( m_smoothedPoly )
    {
        delete m_smoothedPoly;
        m_smoothedPoly = NULL;
    }

    switch( m_cornerSmoothingType )
    {
    case ZONE_SETTINGS::SMOOTHING_CHAMFER:
        m_smoothedPoly = m_Poly->Chamfer( m_cornerRadius );
        break;
    case ZONE_SETTINGS::SMOOTHING_FILLET:
        m_smoothedPoly = m_Poly->Fillet( m_cornerRadius, m_ArcToSegmentsCount );
        break;
    default:
        m_smoothedPoly = new CPolyLine;
        m_smoothedPoly->Copy( m_Poly );
        break;
    }

    if( aCornerBuffer )
        ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList,
                                               *aCornerBuffer );
    else
        ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList,
                                               m_FilledPolysList );

    /* For copper layers, we now must add holes in the Polygon list.
     * holes are pads and tracks with their clearance area
     * for non copper layers just recalculate the m_FilledPolysList
     * with m_ZoneMinThickness taken in account
     */
    if( ! aCornerBuffer )
    {
        if( IsOnCopperLayer() )
            AddClearanceAreasPolygonsToPolysList( aPcb );
        else
        {
            // This KI_POLYGON_SET is the area(s) to fill, with m_ZoneMinThickness/2
            KI_POLYGON_SET polyset_zone_solid_areas;
            int         margin = m_ZoneMinThickness / 2;

            /* First, creates the main polygon (i.e. the filled area using only one outline)
             * to reserve a m_ZoneMinThickness/2 margin around the outlines and holes
             * this margin is the room to redraw outlines with segments having a width set to
             * m_ZoneMinThickness
             * so m_ZoneMinThickness is the min thickness of the filled zones areas
             * the polygon is stored in polyset_zone_solid_areas
             */
            CopyPolygonsFromFilledPolysListToKiPolygonList( polyset_zone_solid_areas );
            polyset_zone_solid_areas -= margin;
            // put solid area in m_FilledPolysList:
            m_FilledPolysList.RemoveAllContours();
            CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas );
        }
        if ( m_FillMode )   // if fill mode uses segments, create them:
            FillZoneAreasWithSegments( );
    }

    return 1;
}