Commit f96d557e authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Fix issues in zones creation (DRC and merging) I created in 3658.1

parent 1c9433fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@


#include <pcbnew.h>
#include <pcbnew.h>
#include <zones.h>
#include <zones.h>
#include <math_for_graphics.h>




ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
@@ -912,7 +913,7 @@ void ZONE_CONTAINER::AddPolygon( std::vector< wxPoint >& aPolygon )
            AppendCorner( aPolygon[i] );
            AppendCorner( aPolygon[i] );
    }
    }


    m_Poly->Close();
    m_Poly->CloseLastContour();
}
}




+1 −1
Original line number Original line Diff line number Diff line
@@ -429,7 +429,7 @@ public:
        return m_Poly->GetHatchStyle();
        return m_Poly->GetHatchStyle();
    }
    }


    void SetHatchStyle( CPolyLine::hatch_style aStyle )
    void SetHatchStyle( CPolyLine::HATCH_STYLE aStyle )
    {
    {
        m_Poly->SetHatchStyle( aStyle );
        m_Poly->SetHatchStyle( aStyle );
    }
    }
+4 −1
Original line number Original line Diff line number Diff line
@@ -99,7 +99,6 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
    aTarget.m_FillMode = m_FillMode;
    aTarget.m_FillMode = m_FillMode;
    aTarget.m_ZoneClearance    = m_ZoneClearance;
    aTarget.m_ZoneClearance    = m_ZoneClearance;
    aTarget.m_ZoneMinThickness = m_ZoneMinThickness;
    aTarget.m_ZoneMinThickness = m_ZoneMinThickness;
    aTarget.m_Poly->SetHatch( m_Zone_HatchingStyle, Mils2iu( 20 ) );
    aTarget.m_ArcToSegmentsCount = m_ArcToSegmentsCount;
    aTarget.m_ArcToSegmentsCount = m_ArcToSegmentsCount;
    aTarget.m_ThermalReliefGap = m_ThermalReliefGap;
    aTarget.m_ThermalReliefGap = m_ThermalReliefGap;
    aTarget.m_ThermalReliefCopperBridge = m_ThermalReliefCopperBridge;
    aTarget.m_ThermalReliefCopperBridge = m_ThermalReliefCopperBridge;
@@ -118,4 +117,8 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
        aTarget.SetLayer( m_CurrentZone_Layer );
        aTarget.SetLayer( m_CurrentZone_Layer );
        aTarget.m_Poly->SetLayer( m_CurrentZone_Layer );
        aTarget.m_Poly->SetLayer( m_CurrentZone_Layer );
    }
    }

    // call SetHatch last, because hatch lines will be rebuilt,
    // using new parameters values
    aTarget.m_Poly->SetHatch( m_Zone_HatchingStyle, Mils2iu( 20 ), true );
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@
#include <class_track.h>
#include <class_track.h>
#include <class_zone.h>
#include <class_zone.h>
#include <class_marker_pcb.h>
#include <class_marker_pcb.h>
#include <math_for_graphics.h>




/* compare 2 trapezoids (can be rectangle) and return true if distance > aDist
/* compare 2 trapezoids (can be rectangle) and return true if distance > aDist
+8 −6
Original line number Original line Diff line number Diff line
@@ -1404,17 +1404,18 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics )
                zone->SetLayer( layer );
                zone->SetLayer( layer );
                zone->SetNet( 0 );
                zone->SetNet( 0 );


                int outline_hatch = CPolyLine::DIAGONAL_EDGE;
                CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE;


                zone->m_Poly->Start( layer, kicad_x( r.x1 ), kicad_y( r.y1 ), outline_hatch );
                zone->m_Poly->Start( layer, kicad_x( r.x1 ), kicad_y( r.y1 ), outline_hatch );
                zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) );
                zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) );
                zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) );
                zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) );
                zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) );
                zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) );
                zone->m_Poly->Close();
                zone->m_Poly->CloseLastContour();


                // this is not my fault:
                // this is not my fault:
                zone->m_Poly->SetHatch( outline_hatch,
                zone->m_Poly->SetHatch( outline_hatch,
                                      Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) );
                                      Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ),
                                      true );
            }
            }
            m_xpath->pop();
            m_xpath->pop();
        }
        }
@@ -2360,7 +2361,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
                    zone->SetNet( netCode );
                    zone->SetNet( netCode );
                    zone->SetNetName( netName );
                    zone->SetNetName( netName );


                    int outline_hatch = CPolyLine::DIAGONAL_EDGE;
                    CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::DIAGONAL_EDGE;


                    bool first = true;
                    bool first = true;
                    for( CITER vi = it->second.begin();  vi != it->second.end();  ++vi )
                    for( CITER vi = it->second.begin();  vi != it->second.end();  ++vi )
@@ -2380,10 +2381,11 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals )
                            zone->AppendCorner( wxPoint( kicad_x( v.x ), kicad_y( v.y ) ) );
                            zone->AppendCorner( wxPoint( kicad_x( v.x ), kicad_y( v.y ) ) );
                    }
                    }


                    zone->m_Poly->Close();
                    zone->m_Poly->CloseLastContour();


                    zone->m_Poly->SetHatch( outline_hatch,
                    zone->m_Poly->SetHatch( outline_hatch,
                                          Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) );
                                            Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ),
                                            true );


                    // clearances, etc.
                    // clearances, etc.
                    zone->SetArcSegCount( 32 );     // @todo: should be a constructor default?
                    zone->SetArcSegCount( 32 );     // @todo: should be a constructor default?
Loading