Loading pcbnew/class_zone.h +0 −13 Original line number Original line Diff line number Diff line Loading @@ -358,19 +358,6 @@ public: */ */ bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const; bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const; /** * Function Fill_Zone * Calculate the zone filling * The zone outline is a frontier, and can be complex (with holes) * The filling starts from starting points like pads, tracks. * If exists the old filling is removed * @param frame = reference to the main frame * @param DC = current Device Context * @param verbose = true to show error messages * @return error level (0 = no error) */ int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = true ); /** /** * Function FillZoneAreasWithSegments * Function FillZoneAreasWithSegments * Fill sub areas in a zone with segments with m_ZoneMinThickness width * Fill sub areas in a zone with segments with m_ZoneMinThickness width Loading pcbnew/legacy_plugin.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2339,7 +2339,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() arcsegcount = 32; arcsegcount = 32; zc->SetArcSegmentCount( arcsegcount ); zc->SetArcSegmentCount( arcsegcount ); zc->SetIsFilled( fillstate == 'S' ? true : false ); zc->SetIsFilled( fillstate == 'S' ); zc->SetThermalReliefGap( thermalReliefGap ); zc->SetThermalReliefGap( thermalReliefGap ); zc->SetThermalReliefCopperBridge( thermalReliefCopperBridge ); zc->SetThermalReliefCopperBridge( thermalReliefCopperBridge ); } } Loading pcbnew/tools/point_editor.cpp +16 −0 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "selection_tool.h" #include "selection_tool.h" #include "point_editor.h" #include "point_editor.h" #include <wxPcbStruct.h> #include <class_drawsegment.h> #include <class_drawsegment.h> #include <class_zone.h> #include <class_zone.h> Loading Loading @@ -206,6 +207,7 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent ) if( m_editPoints ) if( m_editPoints ) { { finishItem(); item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); m_toolMgr->GetView()->Remove( m_editPoints.get() ); m_toolMgr->GetView()->Remove( m_editPoints.get() ); m_editPoints.reset(); m_editPoints.reset(); Loading Loading @@ -326,6 +328,20 @@ void POINT_EDITOR::updateItem() const } } void POINT_EDITOR::finishItem() const { EDA_ITEM* item = m_editPoints->GetParent(); if( item->Type() == PCB_ZONE_AREA_T ) { ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item ); if( zone->IsFilled() ) getEditFrame<PCB_EDIT_FRAME>()->Fill_Zone( zone ); } } void POINT_EDITOR::updatePoints() const void POINT_EDITOR::updatePoints() const { { EDA_ITEM* item = m_editPoints->GetParent(); EDA_ITEM* item = m_editPoints->GetParent(); Loading pcbnew/tools/point_editor.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,9 @@ private: ///> Updates item's points with edit points. ///> Updates item's points with edit points. void updateItem() const; void updateItem() const; ///> Applies the last changes to the edited item. void finishItem() const; ///> Updates edit points with item's points. ///> Updates edit points with item's points. void updatePoints() const; void updatePoints() const; Loading pcbnew/zone_filling_algorithm.cpp +29 −29 Original line number Original line Diff line number Diff line Loading @@ -54,8 +54,7 @@ * to add holes for pads and tracks and other items not in net. * to add holes for pads and tracks and other items not in net. */ */ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, CPOLYGONS_LIST* aCornerBuffer ) CPOLYGONS_LIST* aCornerBuffer ) { { if( aCornerBuffer == NULL ) if( aCornerBuffer == NULL ) m_FilledPolysList.RemoveAllContours(); m_FilledPolysList.RemoveAllContours(); Loading @@ -80,9 +79,11 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, case ZONE_SETTINGS::SMOOTHING_CHAMFER: case ZONE_SETTINGS::SMOOTHING_CHAMFER: m_smoothedPoly = m_Poly->Chamfer( m_cornerRadius ); m_smoothedPoly = m_Poly->Chamfer( m_cornerRadius ); break; break; case ZONE_SETTINGS::SMOOTHING_FILLET: case ZONE_SETTINGS::SMOOTHING_FILLET: m_smoothedPoly = m_Poly->Fillet( m_cornerRadius, m_ArcToSegmentsCount ); m_smoothedPoly = m_Poly->Fillet( m_cornerRadius, m_ArcToSegmentsCount ); break; break; default: default: m_smoothedPoly = new CPolyLine; m_smoothedPoly = new CPolyLine; m_smoothedPoly->Copy( m_Poly ); m_smoothedPoly->Copy( m_Poly ); Loading @@ -90,11 +91,9 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, } } if( aCornerBuffer ) if( aCornerBuffer ) ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, *aCornerBuffer ); *aCornerBuffer ); else else ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, m_FilledPolysList ); m_FilledPolysList ); /* For copper layers, we now must add holes in the Polygon list. /* For copper layers, we now must add holes in the Polygon list. * holes are pads and tracks with their clearance area * holes are pads and tracks with their clearance area Loading Loading @@ -124,10 +123,13 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, m_FilledPolysList.RemoveAllContours(); m_FilledPolysList.RemoveAllContours(); CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas ); CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas ); } } if( m_FillMode ) // if fill mode uses segments, create them: if( m_FillMode ) // if fill mode uses segments, create them: FillZoneAreasWithSegments(); FillZoneAreasWithSegments(); } } m_IsFilled = true; return 1; return 1; } } Loading @@ -145,9 +147,7 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments() int count = 0; int count = 0; std::vector <int> x_coordinates; std::vector <int> x_coordinates; bool error = false; bool error = false; int istart, iend; // index of the starting and the endif corner of one filled area in m_FilledPolysList int istart, iend; // index of the starting and the endif corner of one filled area in m_FilledPolysList int margin = m_ZoneMinThickness * 2 / 10; int margin = m_ZoneMinThickness * 2 / 10; int minwidth = Mils2iu( 2 ); int minwidth = Mils2iu( 2 ); margin = std::max ( minwidth, margin ); margin = std::max ( minwidth, margin ); Loading @@ -168,10 +168,7 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments() EDA_RECT rect = CalculateSubAreaBoundaryBox( istart, iend ); EDA_RECT rect = CalculateSubAreaBoundaryBox( istart, iend ); // Calculate the y limits of the zone // Calculate the y limits of the zone int refy = rect.GetY(); for( int refy = rect.GetY(), endy = rect.GetBottom(); refy < endy; refy += step ) int endy = rect.GetBottom(); for( ; refy < endy; refy += step ) { { // find all intersection points of an infinite line with polyline sides // find all intersection points of an infinite line with polyline sides x_coordinates.clear(); x_coordinates.clear(); Loading Loading @@ -267,6 +264,9 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments() break; break; } // End examine all areas } // End examine all areas if( !error ) m_IsFilled = true; return count; return count; } } Loading Loading
pcbnew/class_zone.h +0 −13 Original line number Original line Diff line number Diff line Loading @@ -358,19 +358,6 @@ public: */ */ bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const; bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const; /** * Function Fill_Zone * Calculate the zone filling * The zone outline is a frontier, and can be complex (with holes) * The filling starts from starting points like pads, tracks. * If exists the old filling is removed * @param frame = reference to the main frame * @param DC = current Device Context * @param verbose = true to show error messages * @return error level (0 = no error) */ int Fill_Zone( PCB_EDIT_FRAME* frame, wxDC* DC, bool verbose = true ); /** /** * Function FillZoneAreasWithSegments * Function FillZoneAreasWithSegments * Fill sub areas in a zone with segments with m_ZoneMinThickness width * Fill sub areas in a zone with segments with m_ZoneMinThickness width Loading
pcbnew/legacy_plugin.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -2339,7 +2339,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() arcsegcount = 32; arcsegcount = 32; zc->SetArcSegmentCount( arcsegcount ); zc->SetArcSegmentCount( arcsegcount ); zc->SetIsFilled( fillstate == 'S' ? true : false ); zc->SetIsFilled( fillstate == 'S' ); zc->SetThermalReliefGap( thermalReliefGap ); zc->SetThermalReliefGap( thermalReliefGap ); zc->SetThermalReliefCopperBridge( thermalReliefCopperBridge ); zc->SetThermalReliefCopperBridge( thermalReliefCopperBridge ); } } Loading
pcbnew/tools/point_editor.cpp +16 −0 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "selection_tool.h" #include "selection_tool.h" #include "point_editor.h" #include "point_editor.h" #include <wxPcbStruct.h> #include <class_drawsegment.h> #include <class_drawsegment.h> #include <class_zone.h> #include <class_zone.h> Loading Loading @@ -206,6 +207,7 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent ) if( m_editPoints ) if( m_editPoints ) { { finishItem(); item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); item->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); m_toolMgr->GetView()->Remove( m_editPoints.get() ); m_toolMgr->GetView()->Remove( m_editPoints.get() ); m_editPoints.reset(); m_editPoints.reset(); Loading Loading @@ -326,6 +328,20 @@ void POINT_EDITOR::updateItem() const } } void POINT_EDITOR::finishItem() const { EDA_ITEM* item = m_editPoints->GetParent(); if( item->Type() == PCB_ZONE_AREA_T ) { ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item ); if( zone->IsFilled() ) getEditFrame<PCB_EDIT_FRAME>()->Fill_Zone( zone ); } } void POINT_EDITOR::updatePoints() const void POINT_EDITOR::updatePoints() const { { EDA_ITEM* item = m_editPoints->GetParent(); EDA_ITEM* item = m_editPoints->GetParent(); Loading
pcbnew/tools/point_editor.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -69,6 +69,9 @@ private: ///> Updates item's points with edit points. ///> Updates item's points with edit points. void updateItem() const; void updateItem() const; ///> Applies the last changes to the edited item. void finishItem() const; ///> Updates edit points with item's points. ///> Updates edit points with item's points. void updatePoints() const; void updatePoints() const; Loading
pcbnew/zone_filling_algorithm.cpp +29 −29 Original line number Original line Diff line number Diff line Loading @@ -54,8 +54,7 @@ * to add holes for pads and tracks and other items not in net. * to add holes for pads and tracks and other items not in net. */ */ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, CPOLYGONS_LIST* aCornerBuffer ) CPOLYGONS_LIST* aCornerBuffer ) { { if( aCornerBuffer == NULL ) if( aCornerBuffer == NULL ) m_FilledPolysList.RemoveAllContours(); m_FilledPolysList.RemoveAllContours(); Loading @@ -80,9 +79,11 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, case ZONE_SETTINGS::SMOOTHING_CHAMFER: case ZONE_SETTINGS::SMOOTHING_CHAMFER: m_smoothedPoly = m_Poly->Chamfer( m_cornerRadius ); m_smoothedPoly = m_Poly->Chamfer( m_cornerRadius ); break; break; case ZONE_SETTINGS::SMOOTHING_FILLET: case ZONE_SETTINGS::SMOOTHING_FILLET: m_smoothedPoly = m_Poly->Fillet( m_cornerRadius, m_ArcToSegmentsCount ); m_smoothedPoly = m_Poly->Fillet( m_cornerRadius, m_ArcToSegmentsCount ); break; break; default: default: m_smoothedPoly = new CPolyLine; m_smoothedPoly = new CPolyLine; m_smoothedPoly->Copy( m_Poly ); m_smoothedPoly->Copy( m_Poly ); Loading @@ -90,11 +91,9 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, } } if( aCornerBuffer ) if( aCornerBuffer ) ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, *aCornerBuffer ); *aCornerBuffer ); else else ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, ConvertPolysListWithHolesToOnePolygon( m_smoothedPoly->m_CornersList, m_FilledPolysList ); m_FilledPolysList ); /* For copper layers, we now must add holes in the Polygon list. /* For copper layers, we now must add holes in the Polygon list. * holes are pads and tracks with their clearance area * holes are pads and tracks with their clearance area Loading Loading @@ -124,10 +123,13 @@ bool ZONE_CONTAINER::BuildFilledSolidAreasPolygons( BOARD* aPcb, m_FilledPolysList.RemoveAllContours(); m_FilledPolysList.RemoveAllContours(); CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas ); CopyPolygonsFromKiPolygonListToFilledPolysList( polyset_zone_solid_areas ); } } if( m_FillMode ) // if fill mode uses segments, create them: if( m_FillMode ) // if fill mode uses segments, create them: FillZoneAreasWithSegments(); FillZoneAreasWithSegments(); } } m_IsFilled = true; return 1; return 1; } } Loading @@ -145,9 +147,7 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments() int count = 0; int count = 0; std::vector <int> x_coordinates; std::vector <int> x_coordinates; bool error = false; bool error = false; int istart, iend; // index of the starting and the endif corner of one filled area in m_FilledPolysList int istart, iend; // index of the starting and the endif corner of one filled area in m_FilledPolysList int margin = m_ZoneMinThickness * 2 / 10; int margin = m_ZoneMinThickness * 2 / 10; int minwidth = Mils2iu( 2 ); int minwidth = Mils2iu( 2 ); margin = std::max ( minwidth, margin ); margin = std::max ( minwidth, margin ); Loading @@ -168,10 +168,7 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments() EDA_RECT rect = CalculateSubAreaBoundaryBox( istart, iend ); EDA_RECT rect = CalculateSubAreaBoundaryBox( istart, iend ); // Calculate the y limits of the zone // Calculate the y limits of the zone int refy = rect.GetY(); for( int refy = rect.GetY(), endy = rect.GetBottom(); refy < endy; refy += step ) int endy = rect.GetBottom(); for( ; refy < endy; refy += step ) { { // find all intersection points of an infinite line with polyline sides // find all intersection points of an infinite line with polyline sides x_coordinates.clear(); x_coordinates.clear(); Loading Loading @@ -267,6 +264,9 @@ int ZONE_CONTAINER::FillZoneAreasWithSegments() break; break; } // End examine all areas } // End examine all areas if( !error ) m_IsFilled = true; return count; return count; } } Loading