Loading common/drawtxt.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -392,7 +392,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y ); } else GRLine( aPanel->GetClipBox(), aDC, GRLine( clipBox, aDC, current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor ); return; Loading pcbnew/zones_by_polygon.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -671,7 +671,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) { ii = zone->GetNumCorners() - 1; // edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse // edge in progress : the current corner coordinate was set // by Show_New_Edge_While_Move_Mouse if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) ) { if( !Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) ) Loading Loading @@ -705,6 +706,9 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) return true; } // Remove the last corner if is is at the same location as the prevoius corner zone->m_Poly->RemoveNullSegments(); // Validate the current edge: int icorner = zone->GetNumCorners() - 1; if( zone->IsOnCopperLayer() ) Loading polygon/PolyLine.cpp +39 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,42 @@ CPolyLine::~CPolyLine() UnHatch(); } /* Removes corners which create a null segment edge * (i.e. when 2 successive corners are at the same location) * returns the count of removed corners. */ int CPolyLine::RemoveNullSegments() { int removed = 0; unsigned startcountour = 0; for( unsigned icnt = 1; icnt < m_CornersList.size(); icnt ++ ) { unsigned last = icnt-1; if( m_CornersList[icnt].end_contour ) { last = startcountour; startcountour = icnt+1; } if( ( m_CornersList[last].x == m_CornersList[icnt].x ) && ( m_CornersList[last].y == m_CornersList[icnt].y ) ) { DeleteCorner( icnt ); icnt--; removed ++; } if( m_CornersList[icnt].end_contour ) { startcountour = icnt+1; icnt++; } } return removed; } /** * Function NormalizeAreaOutlines Loading Loading @@ -65,6 +101,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList ) if( corner.end_contour ) break; } ClipperLib::SimplifyPolygon( raw_polygon, normalized_polygons ); // enter main outline Loading Loading @@ -148,6 +185,8 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList ) polyline->CloseLastContour(); hole++; } polyline->RemoveNullSegments(); } return outlines.size(); Loading polygon/PolyLine.h +16 −1 Original line number Diff line number Diff line Loading @@ -103,6 +103,13 @@ public: void AppendCorner( int x, int y ); void InsertCorner( int ic, int x, int y ); /** * Function DeleteCorner * remove the given corner. if it is the last point of a contour * keep the controur closed by modifying the previous corner * @param ic = the index of the corner to delete */ void DeleteCorner ( int ic ); void MoveCorner( int ic, int x, int y ); void CloseLastContour(); Loading Loading @@ -137,6 +144,14 @@ public: */ CPolyLine* Fillet( unsigned int aRadius, unsigned int aSegments ); /** * Function RemoveNullSegments * Removes corners which create a null segment edge * (i.e. when 2 successive corners are at the same location) * @return the count of removed corners. */ int RemoveNullSegments(); void RemoveAllContours( void ); // Remove or create hatch Loading Loading
common/drawtxt.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -392,7 +392,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y ); } else GRLine( aPanel->GetClipBox(), aDC, GRLine( clipBox, aDC, current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor ); return; Loading
pcbnew/zones_by_polygon.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -671,7 +671,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) { ii = zone->GetNumCorners() - 1; // edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse // edge in progress : the current corner coordinate was set // by Show_New_Edge_While_Move_Mouse if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) ) { if( !Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) ) Loading Loading @@ -705,6 +706,9 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) return true; } // Remove the last corner if is is at the same location as the prevoius corner zone->m_Poly->RemoveNullSegments(); // Validate the current edge: int icorner = zone->GetNumCorners() - 1; if( zone->IsOnCopperLayer() ) Loading
polygon/PolyLine.cpp +39 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,42 @@ CPolyLine::~CPolyLine() UnHatch(); } /* Removes corners which create a null segment edge * (i.e. when 2 successive corners are at the same location) * returns the count of removed corners. */ int CPolyLine::RemoveNullSegments() { int removed = 0; unsigned startcountour = 0; for( unsigned icnt = 1; icnt < m_CornersList.size(); icnt ++ ) { unsigned last = icnt-1; if( m_CornersList[icnt].end_contour ) { last = startcountour; startcountour = icnt+1; } if( ( m_CornersList[last].x == m_CornersList[icnt].x ) && ( m_CornersList[last].y == m_CornersList[icnt].y ) ) { DeleteCorner( icnt ); icnt--; removed ++; } if( m_CornersList[icnt].end_contour ) { startcountour = icnt+1; icnt++; } } return removed; } /** * Function NormalizeAreaOutlines Loading Loading @@ -65,6 +101,7 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList ) if( corner.end_contour ) break; } ClipperLib::SimplifyPolygon( raw_polygon, normalized_polygons ); // enter main outline Loading Loading @@ -148,6 +185,8 @@ int CPolyLine::NormalizeAreaOutlines( std::vector<CPolyLine*>* aNewPolygonList ) polyline->CloseLastContour(); hole++; } polyline->RemoveNullSegments(); } return outlines.size(); Loading
polygon/PolyLine.h +16 −1 Original line number Diff line number Diff line Loading @@ -103,6 +103,13 @@ public: void AppendCorner( int x, int y ); void InsertCorner( int ic, int x, int y ); /** * Function DeleteCorner * remove the given corner. if it is the last point of a contour * keep the controur closed by modifying the previous corner * @param ic = the index of the corner to delete */ void DeleteCorner ( int ic ); void MoveCorner( int ic, int x, int y ); void CloseLastContour(); Loading Loading @@ -137,6 +144,14 @@ public: */ CPolyLine* Fillet( unsigned int aRadius, unsigned int aSegments ); /** * Function RemoveNullSegments * Removes corners which create a null segment edge * (i.e. when 2 successive corners are at the same location) * @return the count of removed corners. */ int RemoveNullSegments(); void RemoveAllContours( void ); // Remove or create hatch Loading