From f8829de5eac28ce4cdebea021616120f42ad4e50 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 1 Jun 2022 23:55:59 +0100 Subject: [PATCH] Formatting. --- pcbnew/tools/pcb_point_editor.cpp | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 1346a2879f..6d59f5d0cf 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -1216,14 +1216,11 @@ void PCB_POINT_EDITOR::updateItem() const case SHAPE_T::BEZIER: if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) ) - shape->SetStart( m_editPoints->Point( BEZIER_CURVE_START ). - GetPosition() ); + shape->SetStart( m_editPoints->Point( BEZIER_CURVE_START ).GetPosition() ); else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) ) - shape->SetBezierC1( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ). - GetPosition() ); + shape->SetBezierC1( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition() ); else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) ) - shape->SetBezierC2( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ). - GetPosition() ); + shape->SetBezierC2( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition() ); else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) ) shape->SetEnd( m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() ); @@ -1256,7 +1253,7 @@ void PCB_POINT_EDITOR::updateItem() const case PAD_SHAPE::CIRCLE: { VECTOR2I end = m_editPoints->Point( 0 ).GetPosition(); - int diameter = (int) EuclideanNorm( end - pad->GetPosition() ) * 2; + int diameter = (int) EuclideanNorm( end - pad->GetPosition() ) * 2; pad->SetSize( wxSize( diameter, diameter ) ); break; @@ -1301,7 +1298,7 @@ void PCB_POINT_EDITOR::updateItem() const dist[3] = botLeft.y - center.y; } - wxSize padSize( dist[0] + dist[2], dist[1] + dist[3] ); + wxSize padSize( dist[0] + dist[2], dist[1] + dist[3] ); VECTOR2I deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] ); if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 ) @@ -2119,12 +2116,12 @@ bool PCB_POINT_EDITOR::removeCornerCondition( const SELECTION& ) return false; } - auto vertex = findVertex( *polyset, *m_editedPoint ); + std::pair vertex = findVertex( *polyset, *m_editedPoint ); if( !vertex.first ) return false; - const auto& vertexIdx = vertex.second; + const SHAPE_POLY_SET::VERTEX_INDEX& vertexIdx = vertex.second; // Check if there are enough vertices so one can be removed without // degenerating the polygon. @@ -2132,7 +2129,9 @@ bool PCB_POINT_EDITOR::removeCornerCondition( const SELECTION& ) // there are only 2 vertices left, a hole is removed). if( vertexIdx.m_contour == 0 && polyset->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour].PointCount() <= 3 ) + { return false; + } // Remove corner does not work with lines if( dynamic_cast( m_editedPoint ) ) @@ -2147,9 +2146,9 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) if( !m_editPoints ) return 0; - EDA_ITEM* item = m_editPoints->GetParent(); + EDA_ITEM* item = m_editPoints->GetParent(); PCB_BASE_EDIT_FRAME* frame = getEditFrame(); - const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition(); + const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition(); // called without an active edited polygon if( !item || !canAddCorner( *item ) ) @@ -2174,7 +2173,9 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) zone->SetNeedRefill( true ); } else + { zoneOutline = &( graphicItem->GetPolyShape() ); + } commit.Modify( item ); @@ -2210,10 +2211,10 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) } // Find the point on the closest segment - auto& sideOrigin = zoneOutline->CVertex( nearestIdx ); - auto& sideEnd = zoneOutline->CVertex( nextNearestIdx ); - SEG nearestSide( sideOrigin, sideEnd ); - VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos ); + const VECTOR2I& sideOrigin = zoneOutline->CVertex( nearestIdx ); + const VECTOR2I& sideEnd = zoneOutline->CVertex( nextNearestIdx ); + SEG nearestSide( sideOrigin, sideEnd ); + VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos ); // Do not add points that have the same coordinates as ones that already belong to polygon // instead, add a point in the middle of the side @@ -2233,7 +2234,7 @@ int PCB_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent ) { commit.Modify( graphicItem ); - SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() ); + SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() ); VECTOR2I nearestPoint = seg.NearestPoint( cursorPos ); // Move the end of the line to the break point..