diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 738c4d0254..f30a367500 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -694,7 +694,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape, } else { - std::vector pts = aShape->GetRectCorners(); + std::vector pts = aShape->GetRectCorners(); const SFVEC2F topLeft3DU( pts[0].x * m_biuTo3Dunits, -pts[0].y * m_biuTo3Dunits ); const SFVEC2F topRight3DU( pts[1].x * m_biuTo3Dunits, -pts[1].y * m_biuTo3Dunits ); diff --git a/common/basic_gal.cpp b/common/basic_gal.cpp index 63bc89bbef..55064cae9e 100644 --- a/common/basic_gal.cpp +++ b/common/basic_gal.cpp @@ -53,7 +53,7 @@ const VECTOR2D BASIC_GAL::transform( const VECTOR2D& aPoint ) const } -void BASIC_GAL::doDrawPolyline( const std::vector& aLocalPointList ) +void BASIC_GAL::doDrawPolyline( const std::vector& aLocalPointList ) { if( m_DC ) { @@ -98,10 +98,10 @@ void BASIC_GAL::DrawPolyline( const std::deque& aPointList ) if( aPointList.size() < 2 ) return; - std::vector polyline_corners; + std::vector polyline_corners; for( const VECTOR2D& pt : aPointList ) - polyline_corners.emplace_back( (wxPoint) transform( pt ) ); + polyline_corners.emplace_back( (VECTOR2I) transform( pt ) ); doDrawPolyline( polyline_corners ); } @@ -112,10 +112,10 @@ void BASIC_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize ) if( aListSize < 2 ) return; - std::vector polyline_corners; + std::vector polyline_corners; for( int ii = 0; ii < aListSize; ++ii ) - polyline_corners.emplace_back( (wxPoint) transform( aPointList[ ii ] ) ); + polyline_corners.emplace_back( (VECTOR2I) transform( aPointList[ii] ) ); doDrawPolyline( polyline_corners ); } diff --git a/common/bitmap_base.cpp b/common/bitmap_base.cpp index ea712fa204..a3ecb4e99f 100644 --- a/common/bitmap_base.cpp +++ b/common/bitmap_base.cpp @@ -37,7 +37,7 @@ #include -BITMAP_BASE::BITMAP_BASE( const wxPoint& pos ) +BITMAP_BASE::BITMAP_BASE( const VECTOR2I& pos ) { m_scale = 1.0; // 1.0 = original bitmap size m_bitmap = nullptr; @@ -229,12 +229,12 @@ const EDA_RECT BITMAP_BASE::GetBoundingBox() const } -void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos ) +void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos ) { if( m_bitmap == nullptr ) return; - wxPoint pos = aPos; + VECTOR2I pos = aPos; wxSize size = GetSize(); // This fixes a bug in OSX that should be fixed in the 3.0.3 version or later. @@ -328,8 +328,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW ) } -void BITMAP_BASE::PlotImage( PLOTTER* aPlotter, - const wxPoint& aPos, +void BITMAP_BASE::PlotImage( PLOTTER* aPlotter, const VECTOR2I& aPos, const COLOR4D& aDefaultColor, int aDefaultPensize ) const { diff --git a/common/drawing_sheet/ds_data_item.cpp b/common/drawing_sheet/ds_data_item.cpp index ca356a4c02..9ea0861d63 100644 --- a/common/drawing_sheet/ds_data_item.cpp +++ b/common/drawing_sheet/ds_data_item.cpp @@ -143,7 +143,7 @@ int DS_DATA_ITEM::GetPenSizeUi() } -void DS_DATA_ITEM::MoveToUi( const wxPoint& aPosition ) +void DS_DATA_ITEM::MoveToUi( const VECTOR2I& aPosition ) { DPOINT pos_mm; pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; @@ -202,7 +202,7 @@ void DS_DATA_ITEM::MoveStartPointTo( const DPOINT& aPosition ) } -void DS_DATA_ITEM::MoveStartPointToUi( const wxPoint& aPosition ) +void DS_DATA_ITEM::MoveStartPointToUi( const VECTOR2I& aPosition ) { DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu, aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); @@ -254,7 +254,7 @@ void DS_DATA_ITEM::MoveEndPointTo( const DPOINT& aPosition ) } -void DS_DATA_ITEM::MoveEndPointToUi( const wxPoint& aPosition ) +void DS_DATA_ITEM::MoveEndPointToUi( const VECTOR2I& aPosition ) { DPOINT pos_mm; pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; @@ -295,10 +295,10 @@ const DPOINT DS_DATA_ITEM::GetStartPos( int ii ) const } -const wxPoint DS_DATA_ITEM::GetStartPosUi( int ii ) const +const VECTOR2I DS_DATA_ITEM::GetStartPosUi( int ii ) const { DPOINT pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; - return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) ); + return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) ); } @@ -332,11 +332,11 @@ const DPOINT DS_DATA_ITEM::GetEndPos( int ii ) const } -const wxPoint DS_DATA_ITEM::GetEndPosUi( int ii ) const +const VECTOR2I DS_DATA_ITEM::GetEndPosUi( int ii ) const { DPOINT pos = GetEndPos( ii ); pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; - return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) ); + return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) ); } @@ -510,11 +510,11 @@ bool DS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const } -const wxPoint DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const +const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const { DPOINT pos = GetCornerPosition( aIdx, aRepeat ); pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; - return wxPoint( int(pos.x), int(pos.y) ); + return VECTOR2I( int( pos.x ), int( pos.y ) ); } @@ -692,7 +692,7 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize() int linewidth = 0; size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE ); size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE ); - DS_DRAW_ITEM_TEXT dummy( DS_DRAW_ITEM_TEXT( this, 0, m_FullText, wxPoint( 0, 0 ), + DS_DRAW_ITEM_TEXT dummy( DS_DRAW_ITEM_TEXT( this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron, linewidth, m_Italic, m_Bold ) ); dummy.SetMultilineAllowed( true ); dummy.SetHorizJustify( m_Hjustify ) ; diff --git a/common/drawing_sheet/ds_draw_item.cpp b/common/drawing_sheet/ds_draw_item.cpp index 982d782b04..36e602aa2d 100644 --- a/common/drawing_sheet/ds_draw_item.cpp +++ b/common/drawing_sheet/ds_draw_item.cpp @@ -158,7 +158,7 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, // ============================ TEXT ============================== -void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_DRAWINGSHEET ), FILLED ); } @@ -170,7 +170,7 @@ const EDA_RECT DS_DRAW_ITEM_TEXT::GetBoundingBox() const } -bool DS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool DS_DRAW_ITEM_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { return EDA_TEXT::TextHitTest( aPosition, aAccuracy ); } @@ -197,13 +197,13 @@ void DS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle ) // ============================ POLYGON ================================= void DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings, - const wxPoint& aOffset ) + const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); - std::vector points_moved; + std::vector points_moved; for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx ) { @@ -222,10 +222,10 @@ void DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings, } -void DS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const wxPoint& aPos ) +void DS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const VECTOR2I& aPos ) { // Note: m_pos is the anchor point of the shape. - wxPoint move_vect = aPos - m_pos; + VECTOR2I move_vect = aPos - m_pos; m_pos = aPos; // Move polygon corners to the new position: @@ -247,7 +247,7 @@ const EDA_RECT DS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const } -bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { return m_Polygons.Collide( aPosition, aAccuracy ); } @@ -274,7 +274,7 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained, for( int ii = 0; ii < outline.PointCount(); ii++ ) { - wxPoint corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y ); + VECTOR2I corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y ); // Test if the point is within aRect if( sel.Contains( corner ) ) @@ -282,7 +282,7 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained, // Test if this edge intersects aRect int ii_next = (ii+1) % outline.PointCount(); - wxPoint next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y ); + VECTOR2I next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y ); if( sel.Intersects( corner, next_corner ) ) return true; @@ -301,7 +301,7 @@ wxString DS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const // ============================ RECT ============================== -void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); @@ -318,11 +318,11 @@ const EDA_RECT DS_DRAW_ITEM_RECT::GetBoundingBox() const } -bool DS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool DS_DRAW_ITEM_RECT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int dist = aAccuracy + ( GetPenWidth() / 2 ); - wxPoint start = GetStart(); - wxPoint end; + VECTOR2I start = GetStart(); + VECTOR2I end; end.x = GetEnd().x; end.y = start.y; @@ -400,7 +400,7 @@ wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const // ============================ LINE ============================== -void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); @@ -416,7 +416,7 @@ const EDA_RECT DS_DRAW_ITEM_LINE::GetBoundingBox() const } -bool DS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool DS_DRAW_ITEM_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1; return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist ); @@ -432,7 +432,7 @@ wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const // ============== BITMAP ================ -void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) GetPeer(); @@ -456,7 +456,7 @@ const EDA_RECT DS_DRAW_ITEM_BITMAP::GetBoundingBox() const } -bool DS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool DS_DRAW_ITEM_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT bbox = GetBoundingBox(); bbox.Inflate( aAccuracy ); diff --git a/common/drawing_sheet/ds_proxy_view_item.cpp b/common/drawing_sheet/ds_proxy_view_item.cpp index dd825752c0..d30d7e6fcc 100644 --- a/common/drawing_sheet/ds_proxy_view_item.cpp +++ b/common/drawing_sheet/ds_proxy_view_item.cpp @@ -135,7 +135,7 @@ void DS_PROXY_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const } -bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const wxPoint& aPosition ) +bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const VECTOR2I& aPosition ) { int accuracy = (int) aView->ToWorld( 5.0 ); // five pixels at current zoom DS_DRAW_ITEM_LIST drawList; diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 5c2feb04b8..fd7f8eddf8 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -832,7 +832,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas } -wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const +VECTOR2I EDA_DRAW_FRAME::GetNearestGridPosition( const VECTOR2I& aPosition ) const { const VECTOR2I& gridOrigin = GetGridOrigin(); VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize(); @@ -842,11 +842,11 @@ wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const double yOffset = fmod( gridOrigin.y, gridSize.y ); int y = KiROUND( (aPosition.y - yOffset) / gridSize.y ); - return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) ); + return VECTOR2I( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) ); } -wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) const +VECTOR2I EDA_DRAW_FRAME::GetNearestHalfGridPosition( const VECTOR2I& aPosition ) const { const VECTOR2I& gridOrigin = GetGridOrigin(); VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0; @@ -856,7 +856,7 @@ wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) c double yOffset = fmod( gridOrigin.y, gridSize.y ); int y = KiROUND( (aPosition.y - yOffset) / gridSize.y ); - return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) ); + return VECTOR2I( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) ); } @@ -893,7 +893,7 @@ std::vector EDA_DRAW_FRAME::findDialogs() } -void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos ) +void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos ) { bool centerView = false; BOX2D r = GetCanvas()->GetView()->GetViewport(); @@ -913,7 +913,7 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos ) } // Center if we're behind an obscuring dialog, or within 10% of its edge - for( BOX2D rect : dialogScreenRects ) + for( BOX2D rect : dialogScreenRects ) { rect.Inflate( rect.GetWidth() / 10 ); diff --git a/common/eda_rect.cpp b/common/eda_rect.cpp index 4d3742a10c..a9d85b7045 100644 --- a/common/eda_rect.cpp +++ b/common/eda_rect.cpp @@ -285,7 +285,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const } -const wxPoint EDA_RECT::ClosestPointTo( const wxPoint& aPoint ) const +const VECTOR2I EDA_RECT::ClosestPointTo( const VECTOR2I& aPoint ) const { EDA_RECT me( *this ); @@ -295,11 +295,11 @@ const wxPoint EDA_RECT::ClosestPointTo( const wxPoint& aPoint ) const int nx = std::max( me.GetLeft(), std::min( aPoint.x, me.GetRight() ) ); int ny = std::max( me.GetTop(), std::min( aPoint.y, me.GetBottom() ) ); - return wxPoint( nx, ny ); + return VECTOR2I( nx, ny ); } -const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const +const VECTOR2I EDA_RECT::FarthestPointTo( const VECTOR2I& aPoint ) const { EDA_RECT me( *this ); @@ -308,16 +308,16 @@ const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const int fx = std::max( std::abs( aPoint.x - me.GetLeft() ), std::abs( aPoint.x - me.GetRight() ) ); int fy = std::max( std::abs( aPoint.y - me.GetTop() ), std::abs( aPoint.y - me.GetBottom() ) ); - return wxPoint( fx, fy ); + return VECTOR2I( fx, fy ); } -bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const +bool EDA_RECT::IntersectsCircle( const VECTOR2I& aCenter, const int aRadius ) const { if( !m_init ) return false; - wxPoint closest = ClosestPointTo( aCenter ); + VECTOR2I closest = ClosestPointTo( aCenter ); double dx = static_cast( aCenter.x ) - closest.x; double dy = static_cast( aCenter.y ) - closest.y; @@ -328,7 +328,7 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con } -bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, +bool EDA_RECT::IntersectsCircleEdge( const VECTOR2I& aCenter, const int aRadius, const int aWidth ) const { if( !m_init ) @@ -343,7 +343,7 @@ bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, return false; } - wxPoint farpt = FarthestPointTo( aCenter ); + VECTOR2I farpt = FarthestPointTo( aCenter ); // Farthest point must be further than the inside of the line double fx = (double) farpt.x; double fy = (double) farpt.y; @@ -457,12 +457,12 @@ void EDA_RECT::Merge( const EDA_RECT& aRect ) } -void EDA_RECT::Merge( const wxPoint& aPoint ) +void EDA_RECT::Merge( const VECTOR2I& aPoint ) { if( !m_init ) { m_pos = aPoint; - m_size = wxSize( 0, 0 ); + m_size = VECTOR2I( 0, 0 ); m_init = true; return; } diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index dbd81bfb15..151dd17788 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -87,18 +87,18 @@ wxString EDA_SHAPE::SHAPE_T_asString() const } -void EDA_SHAPE::setPosition( const wxPoint& aPos ) +void EDA_SHAPE::setPosition( const VECTOR2I& aPos ) { move( aPos - getPosition() ); } -wxPoint EDA_SHAPE::getPosition() const +VECTOR2I EDA_SHAPE::getPosition() const { if( m_shape == SHAPE_T::ARC ) return getCenter(); else if( m_shape == SHAPE_T::POLY ) - return (wxPoint) m_poly.CVertex( 0 ); + return m_poly.CVertex( 0 ); else return m_start; } @@ -135,7 +135,7 @@ double EDA_SHAPE::GetLength() const } -void EDA_SHAPE::move( const wxPoint& aMoveVector ) +void EDA_SHAPE::move( const VECTOR2I& aMoveVector ) { switch ( m_shape ) { @@ -158,7 +158,7 @@ void EDA_SHAPE::move( const wxPoint& aMoveVector ) m_bezierC1 += aMoveVector; m_bezierC2 += aMoveVector; - for( wxPoint& pt : m_bezierPoints) + for( VECTOR2I& pt : m_bezierPoints ) pt += aMoveVector; break; @@ -172,7 +172,7 @@ void EDA_SHAPE::move( const wxPoint& aMoveVector ) void EDA_SHAPE::scale( double aScale ) { - auto scalePt = [&]( wxPoint& pt ) + auto scalePt = [&]( VECTOR2I& pt ) { pt.x = KiROUND( pt.x * aScale ); pt.y = KiROUND( pt.y * aScale ); @@ -196,7 +196,7 @@ void EDA_SHAPE::scale( double aScale ) case SHAPE_T::POLY: // polygon { - std::vector pts; + std::vector pts; for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() ) { @@ -222,27 +222,27 @@ void EDA_SHAPE::scale( double aScale ) } -void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle ) +void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle ) { switch( m_shape ) { case SHAPE_T::SEGMENT: case SHAPE_T::CIRCLE: - RotatePoint( &m_start, aRotCentre, aAngle ); - RotatePoint( &m_end, aRotCentre, aAngle ); + RotatePoint( m_start, aRotCentre, aAngle ); + RotatePoint( m_end, aRotCentre, aAngle ); break; case SHAPE_T::ARC: - RotatePoint( &m_start, aRotCentre, aAngle ); - RotatePoint( &m_end, aRotCentre, aAngle ); - RotatePoint( &m_arcCenter, aRotCentre, aAngle ); + RotatePoint( m_start, aRotCentre, aAngle ); + RotatePoint( m_end, aRotCentre, aAngle ); + RotatePoint( m_arcCenter, aRotCentre, aAngle ); break; case SHAPE_T::RECT: if( KiROUND( aAngle ) % 900 == 0 ) { - RotatePoint( &m_start, aRotCentre, aAngle ); - RotatePoint( &m_end, aRotCentre, aAngle ); + RotatePoint( m_start, aRotCentre, aAngle ); + RotatePoint( m_end, aRotCentre, aAngle ); break; } @@ -262,13 +262,13 @@ void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle ) break; case SHAPE_T::BEZIER: - RotatePoint( &m_start, aRotCentre, aAngle); - RotatePoint( &m_end, aRotCentre, aAngle); - RotatePoint( &m_bezierC1, aRotCentre, aAngle); - RotatePoint( &m_bezierC2, aRotCentre, aAngle); + RotatePoint( m_start, aRotCentre, aAngle ); + RotatePoint( m_end, aRotCentre, aAngle ); + RotatePoint( m_bezierC1, aRotCentre, aAngle ); + RotatePoint( m_bezierC2, aRotCentre, aAngle ); - for( wxPoint& pt : m_bezierPoints ) - RotatePoint( &pt, aRotCentre, aAngle); + for( VECTOR2I& pt : m_bezierPoints ) + RotatePoint( pt, aRotCentre, aAngle); break; @@ -279,7 +279,7 @@ void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle ) } -void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void EDA_SHAPE::flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { switch ( m_shape ) { @@ -330,7 +330,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight ) break; case SHAPE_T::POLY: - m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, VECTOR2I( aCentre ) ); + m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, aCentre ); break; case SHAPE_T::BEZIER: @@ -351,7 +351,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight ) // Rebuild the poly points shape { - std::vector ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; + std::vector ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; BEZIER_POLY converter( ctrlPoints ); converter.GetPoly( m_bezierPoints, m_stroke.GetWidth() ); } @@ -378,12 +378,12 @@ void EDA_SHAPE::RebuildBezierToSegmentsPointsList( int aMinSegLen ) } -const std::vector EDA_SHAPE::buildBezierToSegmentsPointsList( int aMinSegLen ) const +const std::vector EDA_SHAPE::buildBezierToSegmentsPointsList( int aMinSegLen ) const { - std::vector bezierPoints; + std::vector bezierPoints; // Rebuild the m_BezierPoints vertex list that approximate the Bezier curve - std::vector ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; + std::vector ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; BEZIER_POLY converter( ctrlPoints ); converter.GetPoly( bezierPoints, aMinSegLen ); @@ -391,7 +391,7 @@ const std::vector EDA_SHAPE::buildBezierToSegmentsPointsList( int aMinS } -wxPoint EDA_SHAPE::getCenter() const +VECTOR2I EDA_SHAPE::getCenter() const { switch( m_shape ) { @@ -408,16 +408,16 @@ wxPoint EDA_SHAPE::getCenter() const case SHAPE_T::POLY: case SHAPE_T::RECT: case SHAPE_T::BEZIER: - return (wxPoint)getBoundingBox().Centre(); + return getBoundingBox().Centre(); default: UNIMPLEMENTED_FOR( SHAPE_T_asString() ); - return wxPoint(); + return VECTOR2I(); } } -void EDA_SHAPE::SetCenter( const wxPoint& aCenter ) +void EDA_SHAPE::SetCenter( const VECTOR2I& aCenter ) { switch( m_shape ) { @@ -435,10 +435,10 @@ void EDA_SHAPE::SetCenter( const wxPoint& aCenter ) } -wxPoint EDA_SHAPE::GetArcMid() const +VECTOR2I EDA_SHAPE::GetArcMid() const { - wxPoint mid = m_start; - RotatePoint( &mid, m_arcCenter, -GetArcAngle() / 2.0 ); + VECTOR2I mid = m_start; + RotatePoint( mid, m_arcCenter, -GetArcAngle() / 2.0 ); return mid; } @@ -487,7 +487,7 @@ int EDA_SHAPE::GetRadius() const } -void EDA_SHAPE::SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd ) +void EDA_SHAPE::SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ) { m_start = aStart; m_end = aEnd; @@ -499,7 +499,7 @@ void EDA_SHAPE::SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, cons * on the other side of the arc. In this case, we need to flip the start/end points and flag this * change for the system */ - wxPoint new_mid = GetArcMid(); + VECTOR2I new_mid = GetArcMid(); VECTOR2D dist( new_mid - aMid ); VECTOR2D dist2( new_mid - m_arcCenter ); @@ -526,7 +526,7 @@ double EDA_SHAPE::GetArcAngle() const void EDA_SHAPE::SetArcAngleAndEnd( double aAngle, bool aCheckNegativeAngle ) { m_end = m_start; - RotatePoint( &m_end, m_arcCenter, -NormalizeAngle360Max( aAngle ) ); + RotatePoint( m_end, m_arcCenter, -NormalizeAngle360Max( aAngle ) ); if( aCheckNegativeAngle && aAngle < 0 ) { @@ -617,7 +617,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const switch( m_shape ) { case SHAPE_T::RECT: - for( wxPoint& pt : GetRectCorners() ) + for( VECTOR2I& pt : GetRectCorners() ) bbox.Merge( pt ); break; @@ -642,9 +642,9 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const for( auto iter = m_poly.CIterate(); iter; iter++ ) { - wxPoint pt( iter->x, iter->y ); + VECTOR2I pt( iter->x, iter->y ); - RotatePoint( &pt, getParentOrientation() ); + RotatePoint( pt, getParentOrientation() ); pt += getParentPosition(); bbox.Merge( pt ); @@ -671,7 +671,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const } -bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const +bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int maxdist = aAccuracy; @@ -699,9 +699,9 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const if( EuclideanNorm( aPosition - m_end ) <= maxdist ) return true; - wxPoint relPos = aPosition - getCenter(); - int radius = GetRadius(); - int dist = KiROUND( EuclideanNorm( relPos ) ); + VECTOR2I relPos = aPosition - getCenter(); + int radius = GetRadius(); + int dist = KiROUND( EuclideanNorm( relPos ) ); if( abs( radius - dist ) <= maxdist ) { @@ -747,14 +747,14 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const SHAPE_POLY_SET poly; poly.NewOutline(); - for( const wxPoint& pt : GetRectCorners() ) + for( const VECTOR2I& pt : GetRectCorners() ) poly.Append( pt ); return poly.Collide( VECTOR2I( aPosition ), maxdist ); } else // Open rect hit-test { - std::vector pts = GetRectCorners(); + std::vector pts = GetRectCorners(); return TestSegmentHit( aPosition, pts[0], pts[1], maxdist ) || TestSegmentHit( aPosition, pts[1], pts[2], maxdist ) @@ -836,7 +836,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) } else { - std::vector pts = GetRectCorners(); + std::vector pts = GetRectCorners(); // Account for the width of the lines arect.Inflate( GetWidth() / 2 ); @@ -877,7 +877,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) // Therefore, instead of using m_poly, we make a copy which is translated // to the actual location in the board. double orientation = 0.0; - wxPoint offset = getParentPosition(); + VECTOR2I offset = getParentPosition(); if( getParentOrientation() ) orientation = -DECIDEG2RAD( getParentOrientation() ); @@ -893,7 +893,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) VECTOR2I vertex = poly.GetPoint( ii ); // Test if the point is within aRect - if( arect.Contains( ( wxPoint ) vertex ) ) + if( arect.Contains( vertex ) ) return true; if( ii + 1 < count ) @@ -901,7 +901,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) VECTOR2I vertexNext = poly.GetPoint( ii + 1 ); // Test if this edge intersects aRect - if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) ) + if( arect.Intersects( vertex, vertexNext ) ) return true; } else if( poly.IsClosed() ) @@ -909,7 +909,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) VECTOR2I vertexNext = poly.GetPoint( 0 ); // Test if this edge intersects aRect - if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) ) + if( arect.Intersects( vertex, vertexNext ) ) return true; } } @@ -935,11 +935,11 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) for( unsigned ii = 1; ii < count; ii++ ) { - wxPoint vertex = m_bezierPoints[ ii - 1]; - wxPoint vertexNext = m_bezierPoints[ii]; + VECTOR2I vertex = m_bezierPoints[ii - 1]; + VECTOR2I vertexNext = m_bezierPoints[ii]; // Test if the point is within aRect - if( arect.Contains( ( wxPoint ) vertex ) ) + if( arect.Contains( vertex ) ) return true; // Test if this edge intersects aRect @@ -957,20 +957,20 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) } -std::vector EDA_SHAPE::GetRectCorners() const +std::vector EDA_SHAPE::GetRectCorners() const { - std::vector pts; - wxPoint topLeft = GetStart(); - wxPoint botRight = GetEnd(); + std::vector pts; + VECTOR2I topLeft = GetStart(); + VECTOR2I botRight = GetEnd(); // Un-rotate rect topLeft and botRight if( KiROUND( getParentOrientation() ) % 900 != 0 ) { topLeft -= getParentPosition(); - RotatePoint( &topLeft, -getParentOrientation() ); + RotatePoint( topLeft, -getParentOrientation() ); botRight -= getParentPosition(); - RotatePoint( &botRight, -getParentOrientation() ); + RotatePoint( botRight, -getParentOrientation() ); } // Set up the un-rotated 4 corners @@ -982,9 +982,9 @@ std::vector EDA_SHAPE::GetRectCorners() const // Now re-rotate the 4 corners to get a diamond if( KiROUND( getParentOrientation() ) % 900 != 0 ) { - for( wxPoint& pt : pts ) + for( VECTOR2I& pt : pts ) { - RotatePoint( &pt, getParentOrientation() ); + RotatePoint( pt, getParentOrientation() ); pt += getParentPosition(); } } @@ -995,8 +995,8 @@ std::vector EDA_SHAPE::GetRectCorners() const void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const { - wxPoint start = m_start; - wxPoint end = m_end; + VECTOR2I start = m_start; + VECTOR2I end = m_end; double t1, t2; CalcArcAngles( t1, t2 ); @@ -1049,10 +1049,10 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const { switch( quarter ) { - case 0: aBBox.Merge( wxPoint( m_arcCenter.x, m_arcCenter.y + radius ) ); break; // down - case 1: aBBox.Merge( wxPoint( m_arcCenter.x - radius, m_arcCenter.y ) ); break; // left - case 2: aBBox.Merge( wxPoint( m_arcCenter.x, m_arcCenter.y - radius ) ); break; // up - case 3: aBBox.Merge( wxPoint( m_arcCenter.x + radius, m_arcCenter.y ) ); break; // right + case 0: aBBox.Merge( VECTOR2I( m_arcCenter.x, m_arcCenter.y + radius ) ); break; // down + case 1: aBBox.Merge( VECTOR2I( m_arcCenter.x - radius, m_arcCenter.y ) ); break; // left + case 2: aBBox.Merge( VECTOR2I( m_arcCenter.x, m_arcCenter.y - radius ) ); break; // up + case 3: aBBox.Merge( VECTOR2I( m_arcCenter.x + radius, m_arcCenter.y ) ); break; // right } ++quarter %= 4; @@ -1061,12 +1061,12 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const } -void EDA_SHAPE::SetPolyPoints( const std::vector& aPoints ) +void EDA_SHAPE::SetPolyPoints( const std::vector& aPoints ) { m_poly.RemoveAllContours(); m_poly.NewOutline(); - for ( const wxPoint& p : aPoints ) + for( const VECTOR2I& p : aPoints ) m_poly.Append( p.x, p.y ); } @@ -1088,7 +1088,7 @@ std::vector EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const case SHAPE_T::RECT: { - std::vector pts = GetRectCorners(); + std::vector pts = GetRectCorners(); if( IsFilled() && !aEdgeOnly ) effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) ); @@ -1116,12 +1116,12 @@ std::vector EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const case SHAPE_T::BEZIER: { - std::vector bezierPoints = buildBezierToSegmentsPointsList( GetWidth() ); - wxPoint start_pt = bezierPoints[0]; + std::vector bezierPoints = buildBezierToSegmentsPointsList( GetWidth() ); + VECTOR2I start_pt = bezierPoints[0]; for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ ) { - wxPoint end_pt = bezierPoints[jj]; + VECTOR2I end_pt = bezierPoints[jj]; effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, GetWidth() ) ); start_pt = end_pt; } @@ -1156,7 +1156,7 @@ std::vector EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const } -void EDA_SHAPE::DupPolyPointsList( std::vector& aBuffer ) const +void EDA_SHAPE::DupPolyPointsList( std::vector& aBuffer ) const { if( m_poly.OutlineCount() ) { @@ -1196,7 +1196,7 @@ int EDA_SHAPE::GetPointCount() const } -void EDA_SHAPE::beginEdit( const wxPoint& aPosition ) +void EDA_SHAPE::beginEdit( const VECTOR2I& aPosition ) { switch( GetShape() ) { @@ -1227,7 +1227,7 @@ void EDA_SHAPE::beginEdit( const wxPoint& aPosition ) } -bool EDA_SHAPE::continueEdit( const wxPoint& aPosition ) +bool EDA_SHAPE::continueEdit( const VECTOR2I& aPosition ) { switch( GetShape() ) { @@ -1254,7 +1254,7 @@ bool EDA_SHAPE::continueEdit( const wxPoint& aPosition ) } -void EDA_SHAPE::calcEdit( const wxPoint& aPosition ) +void EDA_SHAPE::calcEdit( const VECTOR2I& aPosition ) { #define sq( x ) pow( x, 2 ) @@ -1291,7 +1291,7 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition ) case 2: case 3: { - wxPoint v = m_start - m_end; + VECTOR2I v = m_start - m_end; double chordBefore = sq( v.x ) + sq( v.y ); if( m_editState == 2 ) @@ -1328,15 +1328,15 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition ) // // Let 'l' be the length of the chord and 'm' the middle point of the chord double l = GetLineLength( m_start, m_end ); - wxPoint m = ( m_start + m_end ) / 2; + VECTOR2I m = ( m_start + m_end ) / 2; // Calculate 'd', the vector from the chord midpoint to the center - wxPoint d; + VECTOR2I d; d.x = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_start.y - m_end.y ) / l ); d.y = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_end.x - m_start.x ) / l ); - wxPoint c1 = m + d; - wxPoint c2 = m - d; + VECTOR2I c1 = m + d; + VECTOR2I c2 = m - d; // Solution gives us 2 centers; we need to pick one: switch( m_editState ) @@ -1344,12 +1344,12 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition ) case 1: { // Keep center clockwise from chord while drawing - wxPoint chordVector = m_end - m_start; + VECTOR2I chordVector = m_end - m_start; double chordAngle = ArcTangente( chordVector.y, chordVector.x ); NORMALIZE_ANGLE_POS( chordAngle ); - wxPoint c1Test = c1; - RotatePoint( &c1Test, m_start, -chordAngle ); + VECTOR2I c1Test = c1; + RotatePoint( c1Test, m_start, -chordAngle ); m_arcCenter = c1Test.x > 0 ? c2 : c1; } @@ -1500,13 +1500,13 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf case SHAPE_T::RECT: { - std::vector pts = GetRectCorners(); + std::vector pts = GetRectCorners(); if( IsFilled() ) { aCornerBuffer.NewOutline(); - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) aCornerBuffer.Append( pt ); } @@ -1538,15 +1538,15 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf // The polygon is expected to be a simple polygon; not self intersecting, no hole. double orientation = getParentOrientation(); - wxPoint offset = getParentPosition(); + VECTOR2I offset = getParentPosition(); // Build the polygon with the actual position and orientation: - std::vector poly; + std::vector poly; DupPolyPointsList( poly ); - for( wxPoint& point : poly ) + for( VECTOR2I& point : poly ) { - RotatePoint( &point, orientation ); + RotatePoint( point, orientation ); point += offset; } @@ -1554,15 +1554,15 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf { aCornerBuffer.NewOutline(); - for( const wxPoint& point : poly ) + for( const VECTOR2I& point : poly ) aCornerBuffer.Append( point.x, point.y ); } if( width > 0 || !IsFilled() ) { - wxPoint pt1( poly[ poly.size() - 1] ); + VECTOR2I pt1( poly[poly.size() - 1] ); - for( const wxPoint& pt2 : poly ) + for( const VECTOR2I& pt2 : poly ) { if( pt2 != pt1 ) TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc ); @@ -1576,9 +1576,9 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf case SHAPE_T::BEZIER: { - std::vector ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() }; + std::vector ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() }; BEZIER_POLY converter( ctrlPts ); - std::vector< wxPoint> poly; + std::vector poly; converter.GetPoly( poly, GetWidth() ); for( unsigned ii = 1; ii < poly.size(); ii++ ) diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 954214c2db..9d2b9cf0a5 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -65,7 +65,7 @@ class wxFindReplaceData; void addTextSegmToPoly( int x0, int y0, int xf, int yf, void* aData ) { TSEGM_2_POLY_PRMS* prm = static_cast( aData ); - TransformOvalToPolygon( *prm->m_cornerBuffer, wxPoint( x0, y0 ), wxPoint( xf, yf ), + TransformOvalToPolygon( *prm->m_cornerBuffer, VECTOR2I( x0, y0 ), VECTOR2I( xf, yf ), prm->m_textWidth, prm->m_error, ERROR_INSIDE ); } @@ -304,7 +304,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const extra_height += thickness / 2; textsize.y += extra_height; - rect.Move( wxPoint( 0, -extra_height ) ); + rect.Move( VECTOR2I( 0, -extra_height ) ); } // for multiline texts and aLine < 0, merge all rectangles @@ -391,7 +391,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const } -bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const +bool EDA_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const { EDA_RECT rect = GetTextBox(); VECTOR2I location = aPoint; @@ -416,12 +416,12 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy } -void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, +void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor, OUTLINE_MODE aFillMode ) { if( IsMultilineAllowed() ) { - std::vector positions; + std::vector positions; wxArrayString strings; wxStringSplit( GetShownText(), strings, '\n' ); @@ -439,12 +439,12 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, } -void EDA_TEXT::GetLinePositions( std::vector& aPositions, int aLineCount ) const +void EDA_TEXT::GetLinePositions( std::vector& aPositions, int aLineCount ) const { - VECTOR2I pos = GetTextPos(); // Position of first line of the multiline text according - // to the center of the multiline text block + VECTOR2I pos = GetTextPos(); // Position of first line of the multiline text according + // to the center of the multiline text block - wxPoint offset; // Offset to next line. + VECTOR2I offset; // Offset to next line. offset.y = GetInterline(); @@ -469,11 +469,11 @@ void EDA_TEXT::GetLinePositions( std::vector& aPositions, int aLineCoun RotatePoint( pos, GetTextPos(), GetTextAngle() ); // Rotate the offset lines to increase happened in the right direction - RotatePoint( &offset, GetTextAngle() ); + RotatePoint( offset, GetTextAngle() ); for( int ii = 0; ii < aLineCount; ii++ ) { - aPositions.push_back( (wxPoint) pos ); + aPositions.push_back( (VECTOR2I) pos ); pos += offset; } } @@ -599,21 +599,21 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl } // Convert the text shape to a list of segment -// each segment is stored as 2 wxPoints: its starting point and its ending point +// each segment is stored as 2 VECTOR2Is: its starting point and its ending point // we are using GRText to create the segments and therefore a call-back function is needed // This is a call back function, used by GRText to put each segment in buffer static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData ) { - std::vector* cornerBuffer = static_cast*>( aData ); - cornerBuffer->push_back( wxPoint( x0, y0 ) ); - cornerBuffer->push_back( wxPoint( xf, yf ) ); + std::vector* cornerBuffer = static_cast*>( aData ); + cornerBuffer->push_back( VECTOR2I( x0, y0 ) ); + cornerBuffer->push_back( VECTOR2I( xf, yf ) ); } -std::vector EDA_TEXT::TransformToSegmentList() const +std::vector EDA_TEXT::TransformToSegmentList() const { - std::vector cornerBuffer; + std::vector cornerBuffer; wxSize size = GetTextSize(); if( IsMirrored() ) @@ -628,7 +628,7 @@ std::vector EDA_TEXT::TransformToSegmentList() const { wxArrayString strings_list; wxStringSplit( GetShownText(), strings_list, wxChar('\n') ); - std::vector positions; + std::vector positions; positions.reserve( strings_list.Count() ); GetLinePositions( positions, strings_list.Count() ); @@ -654,8 +654,8 @@ std::vector EDA_TEXT::TransformToSegmentList() const std::shared_ptr EDA_TEXT::GetEffectiveTextShape( ) const { std::shared_ptr shape = std::make_shared(); - int penWidth = GetEffectiveTextPenWidth(); - std::vector pts = TransformToSegmentList(); + int penWidth = GetEffectiveTextPenWidth(); + std::vector pts = TransformToSegmentList(); for( unsigned jj = 0; jj < pts.size(); jj += 2 ) shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) ); diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index a9074a8e35..c8da398aa7 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -63,7 +63,7 @@ static const bool NOT_FILLED = false; GR_DRAWMODE g_XorMode = GR_NXOR; -static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const wxPoint* Points, int n ); +static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I* Points, int n ); /* These functions are used by corresponding functions * ( GRSCircle is called by GRCircle for instance) after mapping coordinates @@ -204,8 +204,8 @@ void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi } -void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, - const COLOR4D& aColor, wxPenStyle aStyle ) +void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + int aWidth, const COLOR4D& aColor, wxPenStyle aStyle ) { GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle ); } @@ -315,8 +315,8 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w } -void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, - const COLOR4D& aColor ) +void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + int aWidth, const COLOR4D& aColor ) { GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor ); } @@ -330,14 +330,14 @@ void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, i } -void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, +void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth, const COLOR4D& aColor ) { GRSetColorPen( aDC, aColor, aWidth ); WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth ); } -static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points ) +static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const VECTOR2I* Points ) { if( !ClipBox ) return true; @@ -379,7 +379,7 @@ static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points ) /** * Draw a new polyline and fill it if Fill, in screen space. */ -static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, +static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width, const COLOR4D& Color, const COLOR4D& BgColor ) { if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) @@ -412,7 +412,7 @@ static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, /** * Draw a new closed polyline and fill it if Fill, in screen space. */ -static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints, +static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const VECTOR2I* aPoints, bool aFill, int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor ) { if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) ) @@ -450,7 +450,7 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const /** * Draw a new polyline and fill it if Fill, in drawing space. */ -void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width, +void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width, const COLOR4D& Color, const COLOR4D& BgColor ) { GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor ); @@ -460,14 +460,14 @@ void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fil /** * Draw a closed polyline and fill it if Fill, in object space. */ -void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, +void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, const COLOR4D& Color, const COLOR4D& BgColor ) { GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor ); } -void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width, +void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width, const COLOR4D& Color, const COLOR4D& BgColor ) { GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor ); @@ -515,7 +515,7 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int r, int width, co } -void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth, +void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, int aWidth, const COLOR4D& aColor ) { GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor ); @@ -534,7 +534,7 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width } -void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, +void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, const COLOR4D& aColor ) { GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor ); @@ -573,16 +573,17 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc } -void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, - const wxPoint& aCenter, int aWidth, const COLOR4D& aColor ) +void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + const VECTOR2I& aCenter, int aWidth, const COLOR4D& aColor ) { GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y, aWidth, aColor ); } -void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const wxPoint& aStart, const wxPoint& aEnd, - const wxPoint& aCenter, int width, const COLOR4D& Color, const COLOR4D& BgColor ) +void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + const VECTOR2I& aCenter, int width, const COLOR4D& Color, + const COLOR4D& BgColor ) { /* Clip arcs off screen. */ if( ClipBox ) @@ -722,11 +723,11 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth, const COLOR4D& aColor ) { - wxPoint points[5]; - points[0] = wxPoint( x1, y1 ); - points[1] = wxPoint( x1, y2 ); - points[2] = wxPoint( x2, y2 ); - points[3] = wxPoint( x2, y1 ); + VECTOR2I points[5]; + points[0] = VECTOR2I( x1, y1 ); + points[1] = VECTOR2I( x1, y2 ); + points[2] = VECTOR2I( x2, y2 ); + points[3] = VECTOR2I( x2, y1 ); points[4] = points[0]; GRSClosedPoly( aClipBox, aDC, 5, points, NOT_FILLED, aWidth, aColor, aColor ); } @@ -735,11 +736,11 @@ void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor ) { - wxPoint points[5]; - points[0] = wxPoint( x1, y1 ); - points[1] = wxPoint( x1, y2 ); - points[2] = wxPoint( x2, y2 ); - points[3] = wxPoint( x2, y1 ); + VECTOR2I points[5]; + points[0] = VECTOR2I( x1, y1 ); + points[1] = VECTOR2I( x1, y2 ); + points[2] = VECTOR2I( x2, y2 ); + points[3] = VECTOR2I( x2, y1 ); points[4] = points[0]; GRSetBrush( aDC, aBgColor, FILLED ); @@ -768,16 +769,29 @@ void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y #include -void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint* Points, int n ) +static void vector2IwxDrawPolygon( wxDC* aDC, const VECTOR2I* Points, int n ) +{ + wxPoint* points = new wxPoint[n]; + + for( int i = 0; i < n; i++ ) + { + points[i] = wxPoint( Points[i].x, Points[i].y ); + } + + aDC->DrawPolygon( n, points ); + delete[] points; +} + +void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I* Points, int n ) { if( aClipBox == nullptr ) { - aDC->DrawPolygon( n, Points ); + vector2IwxDrawPolygon( aDC, Points, n ); return; } // A clip box exists: clip and draw the polygon. - static std::vector clippedPolygon; + static std::vector clippedPolygon; static pointVector inputPolygon, outputPolygon; inputPolygon.clear(); @@ -799,7 +813,7 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint* Points, int } if( clippedPolygon.size() ) - aDC->DrawPolygon( clippedPolygon.size(), &clippedPolygon[0] ); + vector2IwxDrawPolygon( aDC, &clippedPolygon[0], clippedPolygon.size() ); } diff --git a/common/marker_base.cpp b/common/marker_base.cpp index 7cd554d845..53598916b0 100644 --- a/common/marker_base.cpp +++ b/common/marker_base.cpp @@ -87,7 +87,7 @@ MARKER_BASE::~MARKER_BASE() } -bool MARKER_BASE::HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) const +bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const { EDA_RECT bbox = GetBoundingBoxMarker(); bbox.Inflate( aAccuracy ); @@ -134,12 +134,12 @@ EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const } -void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); // Build the marker shape polygon in internal units: - std::vector shape; + std::vector shape; shape.reserve( CORNERS_COUNT ); for( const VECTOR2I& corner : MarkerShapeCorners ) diff --git a/common/plugins/eagle/eagle_parser.cpp b/common/plugins/eagle/eagle_parser.cpp index ca1350dcfe..4c2c207c90 100644 --- a/common/plugins/eagle/eagle_parser.cpp +++ b/common/plugins/eagle/eagle_parser.cpp @@ -267,12 +267,12 @@ NODE_MAP MapChildren( wxXmlNode* aCurrentNode ) } -wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ) +VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle ) { // Eagle give us start and end. // S_ARC wants start to give the center, and end to give the start. double dx = aEnd.x - aStart.x, dy = aEnd.y - aStart.y; - wxPoint mid = ( aStart + aEnd ) / 2; + VECTOR2I mid = ( aStart + aEnd ) / 2; double dlen = sqrt( dx*dx + dy*dy ); @@ -285,7 +285,7 @@ wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAn double dist = dlen / ( 2 * tan( DEG2RAD( aAngle ) / 2 ) ); - wxPoint center( + VECTOR2I center( mid.x + dist * ( dy / dlen ), mid.y - dist * ( dx / dlen ) ); diff --git a/common/plugins/eagle/eagle_parser.h b/common/plugins/eagle/eagle_parser.h index 6de1c81465..b5662f0d47 100644 --- a/common/plugins/eagle/eagle_parser.h +++ b/common/plugins/eagle/eagle_parser.h @@ -358,7 +358,7 @@ public: NODE_MAP MapChildren( wxXmlNode* aCurrentNode ); ///< Convert an Eagle curve end to a KiCad center for S_ARC -wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ); +VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle ); // Pre-declare for typedefs struct EROT; diff --git a/common/rc_item.cpp b/common/rc_item.cpp index 0249b0d385..f4a7560d9f 100644 --- a/common/rc_item.cpp +++ b/common/rc_item.cpp @@ -44,7 +44,7 @@ wxString RC_ITEM::GetErrorMessage() const } -wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos ) +wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const VECTOR2I& aPos ) { return wxString::Format( "@(%s, %s)", MessageTextFromValue( aUnits, aPos.x ), diff --git a/common/tool/selection.cpp b/common/tool/selection.cpp index 7805fba153..61d3b345b6 100644 --- a/common/tool/selection.cpp +++ b/common/tool/selection.cpp @@ -90,7 +90,7 @@ VECTOR2I SELECTION::GetCenter() const if( hasOnlyText ) { - wxPoint center( 0, 0 ); + VECTOR2I center( 0, 0 ); for( EDA_ITEM* item : m_items ) center += item->GetPosition(); diff --git a/eeschema/autoplace_fields.cpp b/eeschema/autoplace_fields.cpp index 4d4c7dacca..66f544d72e 100644 --- a/eeschema/autoplace_fields.cpp +++ b/eeschema/autoplace_fields.cpp @@ -410,7 +410,7 @@ protected: if( line && !side.x ) { - wxPoint start = line->GetStartPoint(), end = line->GetEndPoint(); + VECTOR2I start = line->GetStartPoint(), end = line->GetEndPoint(); if( start.y == end.y && collision != COLLIDE_OBJECTS ) collision = COLLIDE_H_WIRES; @@ -600,7 +600,7 @@ protected: if( !line ) return false; - wxPoint start = line->GetStartPoint(), end = line->GetEndPoint(); + VECTOR2I start = line->GetStartPoint(), end = line->GetEndPoint(); if( start.y != end.y ) return false; diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 82401ba81a..6c8ce6b7cb 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -41,23 +41,23 @@ #include -std::vector SCH_EDIT_FRAME::GetSchematicConnections() +std::vector SCH_EDIT_FRAME::GetSchematicConnections() { - std::vector retval; + std::vector retval; for( SCH_ITEM* item : GetScreen()->Items() ) { // Avoid items that are changing if( !( item->GetEditFlags() & ( IS_DRAGGING | IS_MOVING | IS_DELETED ) ) ) { - std::vector pts = item->GetConnectionPoints(); + std::vector pts = item->GetConnectionPoints(); retval.insert( retval.end(), pts.begin(), pts.end() ); } } // We always have some overlapping connection points. Drop duplicates here std::sort( retval.begin(), retval.end(), - []( const wxPoint& a, const wxPoint& b ) -> bool + []( const VECTOR2I& a, const VECTOR2I& b ) -> bool { return a.x < b.x || (a.x == b.x && a.y < b.y); } ); retval.erase( std::unique( retval.begin(), retval.end() ), retval.end() ); @@ -78,7 +78,7 @@ void SCH_EDIT_FRAME::TestDanglingEnds() } -bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd ) +bool SCH_EDIT_FRAME::TrimWire( const VECTOR2I& aStart, const VECTOR2I& aEnd ) { SCH_SCREEN* screen = GetScreen(); bool retval = false; @@ -292,7 +292,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen ) } -bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, +bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const VECTOR2I& aPoint, SCH_LINE** aNewSegment, SCH_SCREEN* aScreen ) { if( aScreen == nullptr ) @@ -317,7 +317,7 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, } -bool SCH_EDIT_FRAME::BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen ) +bool SCH_EDIT_FRAME::BreakSegments( const VECTOR2I& aPoint, SCH_SCREEN* aScreen ) { static const KICAD_T wiresAndBuses[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT }; @@ -355,7 +355,7 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen ) bool brokenSegments = false; - std::set point_set; + std::set point_set; for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) ) point_set.insert( item->GetPosition() ); @@ -368,7 +368,7 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen ) } - for( const wxPoint& pt : point_set ) + for( const VECTOR2I& pt : point_set ) brokenSegments |= BreakSegments( pt, aScreen ); return brokenSegments; @@ -452,7 +452,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend ) } -SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_SCREEN* aScreen, const wxPoint& aPos, +SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_SCREEN* aScreen, const VECTOR2I& aPos, bool aUndoAppend, bool aFinal ) { SCH_JUNCTION* junction = new SCH_JUNCTION( aPos ); diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 44756e988f..4a182c1908 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -511,7 +511,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet, for( SCH_ITEM* item : aItemList ) { - std::vector< wxPoint > points = item->GetConnectionPoints(); + std::vector points = item->GetConnectionPoints(); item->ConnectedItems( aSheet ).clear(); if( item->Type() == SCH_SHEET_T ) @@ -534,7 +534,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet, { pin->InitializeConnection( aSheet, this ); - wxPoint pos = pin->GetPosition(); + VECTOR2I pos = pin->GetPosition(); // because calling the first time is not thread-safe pin->GetDefaultNetName( aSheet ); @@ -583,7 +583,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet, break; } - for( const wxPoint& point : points ) + for( const VECTOR2I& point : points ) connection_map[ point ].push_back( item ); } @@ -2559,7 +2559,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph bool has_other_items = false; SCH_PIN* pin = nullptr; std::vector invalid_items; - wxPoint noConnectPos = aSubgraph->m_no_connect->GetPosition(); + VECTOR2I noConnectPos = aSubgraph->m_no_connect->GetPosition(); double minDist = 0; // Any subgraph that contains both a pin and a no-connect should not diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index c3aab3015a..d14b79e5f0 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -46,7 +46,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx { SCH_SHEET_PATH* sheetWithSymbolFound = nullptr; SCH_SYMBOL* symbol = nullptr; - wxPoint pos; + VECTOR2I pos; SCH_PIN* pin = nullptr; SCH_SHEET_LIST sheetList; SCH_ITEM* foundItem = nullptr; diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp index 6e2ce4c43c..b863a7e445 100644 --- a/eeschema/dialogs/dialog_change_symbols.cpp +++ b/eeschema/dialogs/dialog_change_symbols.cpp @@ -637,8 +637,8 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_ if( resetEffects ) { // Careful: the visible bit and position are also set by SetAttributes() - bool visible = field.IsVisible(); - wxPoint pos = field.GetPosition(); + bool visible = field.IsVisible(); + VECTOR2I pos = field.GetPosition(); field.SetAttributes( *libField ); @@ -647,7 +647,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_ } if( resetPositions ) - field.SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField->GetTextPos() ); + field.SetTextPos( aSymbol->GetPosition() + libField->GetTextPos() ); } else if( i >= MANDATORY_FIELDS && removeExtras ) { @@ -669,13 +669,13 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_ if( !aSymbol->FindField( libField.GetName(), false ) ) { wxString fieldName = libField.GetCanonicalName(); - SCH_FIELD newField( wxPoint( 0, 0), aSymbol->GetFieldCount(), aSymbol, fieldName ); + SCH_FIELD newField( VECTOR2I( 0, 0), aSymbol->GetFieldCount(), aSymbol, fieldName ); SCH_FIELD* schField = aSymbol->AddField( newField ); // Careful: the visible bit and position are also set by SetAttributes() schField->SetAttributes( libField ); schField->SetText( libField.GetText() ); - schField->SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField.GetTextPos() ); + schField->SetTextPos( aSymbol->GetPosition() + libField.GetTextPos() ); } } diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index 8f4399601e..4fe0ae438f 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -600,7 +600,7 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH GR_TEXT_V_ALIGN_T vJustify = EDA_TEXT::MapVertJustify( m_verticalJustification - 1 ); bool positioningModified = false; - if( aField->GetPosition() != (wxPoint)m_position ) + if( aField->GetPosition() != m_position ) positioningModified = true; if( aField->GetTextAngle().IsVertical() != m_isVertical ) @@ -617,7 +617,7 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH aField->SetText( m_text ); updateText( aField ); - aField->SetPosition( (wxPoint)m_position ); + aField->SetPosition( m_position ); // Note that we must set justifications before we can ask if they're flipped. If the old // justification is center then it won't know (whereas if the new justification is center diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 25c3c5c262..8301f27251 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -619,7 +619,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event ) newPin->SetType( last->GetType() ); newPin->SetShape( last->GetShape() ); - wxPoint pos = last->GetPosition(); + VECTOR2I pos = last->GetPosition(); SYMBOL_EDITOR_SETTINGS* cfg = m_editFrame->GetSettings(); diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index bdf50cb05c..5090ae381b 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -155,7 +155,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow() // to bottom: we must change the y coord sign for editing for( size_t i = 0; i < m_fields->size(); ++i ) { - wxPoint pos = m_fields->at( i ).GetPosition(); + VECTOR2I pos = m_fields->at( i ).GetPosition(); pos.y = -pos.y; m_fields->at( i ).SetPosition( pos ); } @@ -329,7 +329,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow() // to bottom: we must change the y coord sign when writing back to the library for( size_t i = 0; i < m_fields->size(); ++i ) { - wxPoint pos = m_fields->at( i ).GetPosition(); + VECTOR2I pos = m_fields->at( i ).GetPosition(); pos.y = -pos.y; m_fields->at( i ).SetPosition( pos ); m_fields->at( i ).SetId( i ); diff --git a/eeschema/dialogs/dialog_pin_properties.cpp b/eeschema/dialogs/dialog_pin_properties.cpp index bec314e801..963205bb49 100644 --- a/eeschema/dialogs/dialog_pin_properties.cpp +++ b/eeschema/dialogs/dialog_pin_properties.cpp @@ -389,7 +389,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) RENDER_SETTINGS* renderSettings = symbolEditor->GetRenderSettings(); renderSettings->SetPrintDC( &dc ); - m_dummyPin->Print( renderSettings, (wxPoint) - bBox.Centre(), (void*) &opts, DefaultTransform ); + m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform ); event.Skip(); } diff --git a/eeschema/dialogs/dialog_pin_properties.h b/eeschema/dialogs/dialog_pin_properties.h index 992e68d63e..9306fdca59 100644 --- a/eeschema/dialogs/dialog_pin_properties.h +++ b/eeschema/dialogs/dialog_pin_properties.h @@ -81,7 +81,7 @@ private: UNIT_BINDER m_nameSize; UNIT_BINDER m_numberSize; - wxPoint m_origPos; + VECTOR2I m_origPos; ALT_PIN_DATA_MODEL* m_alternatesDataModel; diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index 8ee7d247c6..2ee8290dfe 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -608,7 +608,7 @@ public: if( !destField && !srcValue.IsEmpty() ) { - const wxPoint symbolPos = symbol.GetPosition(); + const VECTOR2I symbolPos = symbol.GetPosition(); destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) ); } diff --git a/eeschema/dialogs/dialog_update_symbol_fields.cpp b/eeschema/dialogs/dialog_update_symbol_fields.cpp index f08bb2cbfb..1c31d724a1 100644 --- a/eeschema/dialogs/dialog_update_symbol_fields.cpp +++ b/eeschema/dialogs/dialog_update_symbol_fields.cpp @@ -169,7 +169,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent ) { // Careful: the visible bit and position are also set by SetAttributes() bool visible = field.IsVisible(); - wxPoint pos = field.GetPosition(); + VECTOR2I pos = field.GetPosition(); field.SetAttributes( *parentField ); diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp index 05ee065689..e998399541 100644 --- a/eeschema/dialogs/panel_eeschema_color_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp @@ -260,7 +260,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems() m_previewItems.push_back( aItem ); }; - std::vector>> lines = { + std::vector>> lines = { { LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } }, { LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } }, { LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } }, @@ -277,7 +277,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems() { LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } } }; - for( const std::pair>& line : lines ) + for( const std::pair>& line : lines ) { SCH_LINE* wire = new SCH_LINE; wire->SetLayer( line.first ); @@ -295,14 +295,14 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems() wire->SetStroke( stroke ); - wire->SetStartPoint( wxPoint( Mils2iu( line.second.first.x ), - Mils2iu( line.second.first.y ) ) ); - wire->SetEndPoint( wxPoint( Mils2iu( line.second.second.x ), - Mils2iu( line.second.second.y ) ) ); + wire->SetStartPoint( VECTOR2I( Mils2iu( line.second.first.x ), + Mils2iu( line.second.first.y ) ) ); + wire->SetEndPoint( VECTOR2I( Mils2iu( line.second.second.x ), + Mils2iu( line.second.second.y ) ) ); addItem( wire ); } -#define MILS_POINT( x, y ) wxPoint( Mils2iu( x ), Mils2iu( y ) ) +#define MILS_POINT( x, y ) VECTOR2I( Mils2iu( x ), Mils2iu( y ) ) SCH_NO_CONNECT* nc = new SCH_NO_CONNECT; nc->SetPosition( MILS_POINT( 2525, 1300 ) ); @@ -347,13 +347,13 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems() { auto mapLibItemPosition = - []( const wxPoint& aLibPosition ) -> wxPoint + []( const VECTOR2I& aLibPosition ) -> VECTOR2I { - return wxPoint( aLibPosition.x, -aLibPosition.y ); + return VECTOR2I( aLibPosition.x, -aLibPosition.y ); }; LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString ); - wxPoint p( 2625, -1600 ); + VECTOR2I p( 2625, -1600 ); LIB_FIELD& ref = symbol->GetReferenceField(); diff --git a/eeschema/ee_collectors.cpp b/eeschema/ee_collectors.cpp index 7d6f345a5c..78e2538723 100644 --- a/eeschema/ee_collectors.cpp +++ b/eeschema/ee_collectors.cpp @@ -139,7 +139,7 @@ SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData ) } -void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const wxPoint& aPos, +void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const VECTOR2I& aPos, int aUnit, int aConvert ) { Empty(); // empty the collection just in case @@ -160,7 +160,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], - const wxPoint& aPos, int aUnit, int aConvert ) + const VECTOR2I& aPos, int aUnit, int aConvert ) { Empty(); // empty the collection just in case diff --git a/eeschema/ee_collectors.h b/eeschema/ee_collectors.h index 22347c554b..2d620e9632 100644 --- a/eeschema/ee_collectors.h +++ b/eeschema/ee_collectors.h @@ -81,7 +81,7 @@ public: * @param aUnit is the symbol unit filter (for symbol editor). * @param aConvert is the DeMorgan filter (for symbol editor) */ - void Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const wxPoint& aPos, + void Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 ); /** @@ -95,7 +95,7 @@ public: * @param aUnit is the symbol unit filter (for symbol editor). * @param aConvert is the DeMorgan filter (for symbol editor). */ - void Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], const wxPoint& aPos, + void Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 ); /** diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 451bf27d1c..1b79aa40f3 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -201,7 +201,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet ) { if( unresolved( field.GetShownText() ) ) { - wxPoint pos = field.GetPosition() - symbol->GetPosition(); + VECTOR2I pos = field.GetPosition() - symbol->GetPosition(); pos = symbol->GetTransform().TransformCoordinate( pos ); pos += symbol->GetPosition(); @@ -392,7 +392,7 @@ int ERC_TESTER::TestNoConnectPins() for( const SCH_SHEET_PATH& sheet : m_schematic->GetSheets() ) { - std::map> pinMap; + std::map> pinMap; for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) ) { diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 82126bfa64..68bcbd1453 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -111,7 +111,7 @@ int LIB_FIELD::GetPenWidth() const } -void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, +void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) { wxDC* DC = aSettings->GetPrintDC(); @@ -125,7 +125,7 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, } -bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool LIB_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // Because HitTest is mainly used to select the field return false if it is empty if( GetText().IsEmpty() ) @@ -236,19 +236,19 @@ int LIB_FIELD::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompare } -void LIB_FIELD::Offset( const wxPoint& aOffset ) +void LIB_FIELD::Offset( const VECTOR2I& aOffset ) { EDA_TEXT::Offset( aOffset ); } -void LIB_FIELD::MoveTo( const wxPoint& newPosition ) +void LIB_FIELD::MoveTo( const VECTOR2I& newPosition ) { EDA_TEXT::SetTextPos( newPosition ); } -void LIB_FIELD::MirrorHorizontal( const wxPoint& center ) +void LIB_FIELD::MirrorHorizontal( const VECTOR2I& center ) { int x = GetTextPos().x; @@ -260,7 +260,7 @@ void LIB_FIELD::MirrorHorizontal( const wxPoint& center ) } -void LIB_FIELD::MirrorVertical( const wxPoint& center ) +void LIB_FIELD::MirrorVertical( const VECTOR2I& center ) { int y = GetTextPos().y; @@ -272,7 +272,7 @@ void LIB_FIELD::MirrorVertical( const wxPoint& center ) } -void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW ) +void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW ) { int rot_angle = aRotateCCW ? -900 : 900; @@ -285,7 +285,7 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW ) } -void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, +void LIB_FIELD::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill, const TRANSFORM& aTransform ) const { if( GetText().IsEmpty() ) @@ -437,13 +437,13 @@ wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const } -void LIB_FIELD::BeginEdit( const wxPoint& aPosition ) +void LIB_FIELD::BeginEdit( const VECTOR2I& aPosition ) { SetTextPos( aPosition ); } -void LIB_FIELD::CalcEdit( const wxPoint& aPosition ) +void LIB_FIELD::CalcEdit( const VECTOR2I& aPosition ) { SetTextPos( aPosition ); } diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 61f6974cc4..948e383327 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -130,7 +130,7 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; LIB_FIELD& operator=( const LIB_FIELD& field ); @@ -148,19 +148,19 @@ public: SCH_LAYER_ID GetDefaultLayer() const; - void BeginEdit( const wxPoint& aStartPoint ) override; + void BeginEdit( const VECTOR2I& aStartPoint ) override; - void Offset( const wxPoint& aOffset ) override; + void Offset( const VECTOR2I& aOffset ) override; - void MoveTo( const wxPoint& aPosition ) override; + void MoveTo( const VECTOR2I& aPosition ) override; - wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } + VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); } - void MirrorHorizontal( const wxPoint& aCenter ) override; - void MirrorVertical( const wxPoint& aCenter ) override; - void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; + void MirrorHorizontal( const VECTOR2I& aCenter ) override; + void MirrorVertical( const VECTOR2I& aCenter ) override; + void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override; - void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, + void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill, const TRANSFORM& aTransform ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -194,7 +194,7 @@ private: * If \a aData not NULL, \a aData must point a wxString which is used instead of * the m_Text */ - void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, + void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) override; /** @@ -202,7 +202,7 @@ private: * * @param aPosition - The position to edit the circle in drawing coordinates. */ - void CalcEdit( const wxPoint& aPosition ) override; + void CalcEdit( const VECTOR2I& aPosition ) override; friend class SCH_LEGACY_PLUGIN_CACHE; // Required to access m_name. diff --git a/eeschema/lib_item.cpp b/eeschema/lib_item.cpp index 4ced5f420d..0036c81950 100644 --- a/eeschema/lib_item.cpp +++ b/eeschema/lib_item.cpp @@ -115,8 +115,8 @@ bool LIB_ITEM::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) } -void LIB_ITEM::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, - void* aData, const TRANSFORM& aTransform ) +void LIB_ITEM::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, + const TRANSFORM& aTransform ) { print( aSettings, aOffset, aData, aTransform ); } diff --git a/eeschema/lib_item.h b/eeschema/lib_item.h index b30f6507cc..19748d7578 100644 --- a/eeschema/lib_item.h +++ b/eeschema/lib_item.h @@ -94,7 +94,7 @@ public: * @param aPosition The position in drawing coordinates where the drawing was started. * May or may not be required depending on the item being drawn. */ - virtual void BeginEdit( const wxPoint& aPosition ) {} + virtual void BeginEdit( const VECTOR2I& aPosition ) {} /** * Continue an edit in progress at \a aPosition. @@ -106,7 +106,7 @@ public: * @param aPosition The position of the mouse left click in drawing coordinates. * @return True if additional mouse clicks are required to complete the edit in progress. */ - virtual bool ContinueEdit( const wxPoint& aPosition ) { return false; } + virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; } /** * End an object editing action. @@ -124,7 +124,7 @@ public: * * @param aPosition The current mouse position in drawing coordinates. */ - virtual void CalcEdit( const wxPoint& aPosition ) {} + virtual void CalcEdit( const VECTOR2I& aPosition ) {} /** * Draw an item @@ -137,8 +137,8 @@ public: * pass reference to the lib symbol for pins. * @param aTransform Transform Matrix (rotation, mirror ..) */ - virtual void Print( const RENDER_SETTINGS* aSettings, const wxPoint &aOffset, - void* aData, const TRANSFORM& aTransform ); + virtual void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, + const TRANSFORM& aTransform ); virtual int GetPenWidth() const = 0; @@ -160,7 +160,7 @@ public: void ViewGetLayers( int aLayers[], int& aCount ) const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { // This is just here to prevent annoying compiler warnings about hidden overloaded // virtual functions @@ -210,30 +210,30 @@ public: * * @param aOffset Coordinates to offset the item position. */ - virtual void Offset( const wxPoint& aOffset ) = 0; + virtual void Offset( const VECTOR2I& aOffset ) = 0; /** * Move a draw object to \a aPosition. * * @param aPosition Position to move draw item to. */ - virtual void MoveTo( const wxPoint& aPosition ) = 0; + virtual void MoveTo( const VECTOR2I& aPosition ) = 0; - void SetPosition( const wxPoint& aPosition ) override { MoveTo( aPosition ); } + void SetPosition( const VECTOR2I& aPosition ) override { MoveTo( aPosition ); } /** * Mirror the draw object along the horizontal (X) axis about \a aCenter point. * * @param aCenter Point to mirror around. */ - virtual void MirrorHorizontal( const wxPoint& aCenter ) = 0; + virtual void MirrorHorizontal( const VECTOR2I& aCenter ) = 0; /** * Mirror the draw object along the MirrorVertical (Y) axis about \a aCenter point. * * @param aCenter Point to mirror around. */ - virtual void MirrorVertical( const wxPoint& aCenter ) = 0; + virtual void MirrorVertical( const VECTOR2I& aCenter ) = 0; /** * Rotate the object about \a aCenter point. @@ -241,7 +241,7 @@ public: * @param aCenter Point to rotate around. * @param aRotateCCW True to rotate counter clockwise. False to rotate clockwise. */ - virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) = 0; + virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) = 0; /** * Plot the draw item using the plot object. @@ -251,7 +251,7 @@ public: * @param aFill Flag to indicate whether or not the object is filled. * @param aTransform The plot transform. */ - virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, + virtual void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill, const TRANSFORM& aTransform ) const = 0; void SetUnit( int aUnit ) { m_unit = aUnit; } @@ -296,7 +296,7 @@ protected: * @param aData A pointer to any object specific data required to perform the draw. * @param aTransform A reference to a #TRANSFORM object containing drawing transform. */ - virtual void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, + virtual void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) = 0; private: diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 426e38cfde..12a770c178 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -121,7 +121,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent ) : LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber, int aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, - int aNumTextSize, int aConvert, const wxPoint& aPos, int aUnit ) : + int aNumTextSize, int aConvert, const VECTOR2I& aPos, int aUnit ) : LIB_ITEM( LIB_PIN_T, aParent ), m_position( aPos ), m_length( aLength ), @@ -139,7 +139,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aN } -bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool LIB_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT rect = GetBoundingBox(); @@ -179,20 +179,20 @@ wxString LIB_PIN::GetShownName() const } -wxPoint LIB_PIN::GetPinRoot() const +VECTOR2I LIB_PIN::GetPinRoot() const { switch( m_orientation ) { default: - case PIN_RIGHT: return wxPoint( m_position.x + m_length, -( m_position.y ) ); - case PIN_LEFT: return wxPoint( m_position.x - m_length, -( m_position.y ) ); - case PIN_UP: return wxPoint( m_position.x, -( m_position.y + m_length ) ); - case PIN_DOWN: return wxPoint( m_position.x, -( m_position.y - m_length ) ); + case PIN_RIGHT: return VECTOR2I( m_position.x + m_length, -( m_position.y ) ); + case PIN_LEFT: return VECTOR2I( m_position.x - m_length, -( m_position.y ) ); + case PIN_UP: return VECTOR2I( m_position.x, -( m_position.y + m_length ) ); + case PIN_DOWN: return VECTOR2I( m_position.x, -( m_position.y - m_length ) ); } } -void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, +void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) { LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData; @@ -206,7 +206,7 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v int orient = PinDrawOrient( aTransform ); /* Calculate the pin position */ - wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset; + VECTOR2I pos1 = aTransform.TransformCoordinate( m_position ) + aOffset; if( IsVisible() || drawHiddenFields ) { @@ -230,7 +230,7 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v } -void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrient ) +void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos, int aOrient ) { wxDC* DC = aSettings->GetPrintDC(); int MapX1, MapY1, x1, y1; @@ -341,7 +341,7 @@ void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const wxPoint& a } -void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, int aPinOrient, +void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos, int aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName ) { if( !aDrawPinName && !aDrawPinNum ) @@ -394,14 +394,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, if( aPinOrient == PIN_RIGHT ) { x = x1 + aTextInside; - GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL, + GRText( DC, VECTOR2I( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL, PinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false, nullptr ); } else // Orient == PIN_LEFT { x = x1 - aTextInside; - GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL, + GRText( DC, VECTOR2I( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL, PinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false, nullptr ); } @@ -409,7 +409,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, if( aDrawPinNum ) { - GRText( DC, wxPoint(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number, + GRText( DC, VECTOR2I(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr ); } @@ -423,14 +423,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, if( aDrawPinName ) { - GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, + GRText( DC, VECTOR2I( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false, nullptr ); } if( aDrawPinNum ) { - GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, + GRText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr ); } @@ -441,14 +441,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, if( aDrawPinName ) { - GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, + GRText( DC, VECTOR2I( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false, nullptr ); } if( aDrawPinNum ) { - GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, + GRText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr ); } @@ -463,14 +463,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, if( aDrawPinName ) { x = ( x1 + aPinPos.x) / 2; - GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, name, EDA_ANGLE::HORIZONTAL, + GRText( DC, VECTOR2I( x, y1 - name_offset ), NameColor, name, EDA_ANGLE::HORIZONTAL, PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false, nullptr ); } if( aDrawPinNum ) { x = ( x1 + aPinPos.x) / 2; - GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL, + GRText( DC, VECTOR2I( x, y1 + num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false, nullptr ); } @@ -480,14 +480,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, if( aDrawPinName ) { y = ( y1 + aPinPos.y) / 2; - GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, name, EDA_ANGLE::VERTICAL, + GRText( DC, VECTOR2I( x1 - name_offset, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false, nullptr ); } if( aDrawPinNum ) { - GRText( DC, wxPoint( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number, + GRText( DC, VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false, nullptr ); } @@ -497,7 +497,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, -void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPoint& aPosition, +void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECTOR2I& aPosition, int aOrientation ) { wxDC* DC = aSettings->GetPrintDC(); @@ -517,7 +517,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo // Get a suitable color COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_NOTES : LAYER_HIDDEN ); - wxPoint txtpos = aPosition; + VECTOR2I txtpos = aPosition; int offset = Millimeter2iu( 0.4 ); GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_LEFT; EDA_ANGLE orient = EDA_ANGLE::HORIZONTAL; @@ -550,7 +550,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo } -void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) const +void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const VECTOR2I& aPosition, int aOrientation ) const { int MapX1, MapY1, x1, y1; COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN ); @@ -573,10 +573,10 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK ) { const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this ); - aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2, + aPlotter->Circle( VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2, FILL_T::NO_FILL, penWidth ); - aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) ); + aPlotter->MoveTo( VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) ); aPlotter->FinishTo( aPosition ); } else if( m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK ) @@ -584,23 +584,23 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this ); if( MapY1 == 0 ) /* MapX1 = +- 1 */ { - aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) ); - aPlotter->LineTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 ) ); - aPlotter->FinishTo( wxPoint( x1, y1 - deco_size ) ); + aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) ); + aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) ); + aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) ); } else /* MapX1 = 0 */ { - aPlotter->MoveTo( wxPoint( x1 + deco_size, y1 ) ); - aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * deco_size * 2 ) ); - aPlotter->FinishTo( wxPoint( x1 - deco_size, y1 ) ); + aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) ); + aPlotter->LineTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) ); + aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) ); } - aPlotter->MoveTo( wxPoint( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) ); + aPlotter->MoveTo( VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) ); aPlotter->FinishTo( aPosition ); } else { - aPlotter->MoveTo( wxPoint( x1, y1 ) ); + aPlotter->MoveTo( VECTOR2I( x1, y1 ) ); aPlotter->FinishTo( aPosition ); } @@ -611,15 +611,15 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this ); if( MapY1 == 0 ) /* MapX1 = +- 1 */ { - aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) ); - aPlotter->LineTo( wxPoint( x1 - MapX1 * deco_size * 2, y1 ) ); - aPlotter->FinishTo( wxPoint( x1, y1 - deco_size ) ); + aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) ); + aPlotter->LineTo( VECTOR2I( x1 - MapX1 * deco_size * 2, y1 ) ); + aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) ); } else /* MapX1 = 0 */ { - aPlotter->MoveTo( wxPoint( x1 + deco_size, y1 ) ); - aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * deco_size * 2 ) ); - aPlotter->FinishTo( wxPoint( x1 - deco_size, y1 ) ); + aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) ); + aPlotter->LineTo( VECTOR2I( x1, y1 - MapY1 * deco_size * 2 ) ); + aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) ); } } @@ -630,15 +630,15 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie if( MapY1 == 0 ) /* MapX1 = +- 1 */ { - aPlotter->MoveTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 ) ); - aPlotter->LineTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) ); - aPlotter->FinishTo( wxPoint( x1, y1 ) ); + aPlotter->MoveTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) ); + aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) ); + aPlotter->FinishTo( VECTOR2I( x1, y1 ) ); } else /* MapX1 = 0 */ { - aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * deco_size * 2 ) ); - aPlotter->LineTo( wxPoint( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) ); - aPlotter->FinishTo( wxPoint( x1, y1 ) ); + aPlotter->MoveTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) ); + aPlotter->LineTo( VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) ); + aPlotter->FinishTo( VECTOR2I( x1, y1 ) ); } } @@ -648,22 +648,26 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie if( MapY1 == 0 ) /* MapX1 = +- 1 */ { - aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) ); - aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) ); + aPlotter->MoveTo( VECTOR2I( x1, y1 - symbol_size * 2 ) ); + aPlotter->FinishTo( VECTOR2I( x1 + MapX1 * symbol_size * 2, y1 ) ); } else /* MapX1 = 0 */ { - aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) ); - aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) ); + aPlotter->MoveTo( VECTOR2I( x1 - symbol_size * 2, y1 ) ); + aPlotter->FinishTo( VECTOR2I( x1, y1 + MapY1 * symbol_size * 2 ) ); } } else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */ { const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this ); - aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ) ); - aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size ) ); - aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size ) ); - aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size ) ); + aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 + MapY1 ) * deco_size, + y1 - ( MapY1 - MapX1 ) * deco_size ) ); + aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 + MapY1 ) * deco_size, + y1 + ( MapY1 - MapX1 ) * deco_size ) ); + aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 - MapY1 ) * deco_size, + y1 - ( MapY1 + MapX1 ) * deco_size ) ); + aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 - MapY1 ) * deco_size, + y1 + ( MapY1 + MapX1 ) * deco_size ) ); } if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol @@ -671,15 +675,15 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie const int deco_size = TARGET_PIN_RADIUS; const int ex1 = aPosition.x; const int ey1 = aPosition.y; - aPlotter->MoveTo( wxPoint( ex1 - deco_size, ey1 - deco_size ) ); - aPlotter->FinishTo( wxPoint( ex1 + deco_size, ey1 + deco_size ) ); - aPlotter->MoveTo( wxPoint( ex1 + deco_size, ey1 - deco_size ) ); - aPlotter->FinishTo( wxPoint( ex1 - deco_size, ey1 + deco_size ) ); + aPlotter->MoveTo( VECTOR2I( ex1 - deco_size, ey1 - deco_size ) ); + aPlotter->FinishTo( VECTOR2I( ex1 + deco_size, ey1 + deco_size ) ); + aPlotter->MoveTo( VECTOR2I( ex1 + deco_size, ey1 - deco_size ) ); + aPlotter->FinishTo( VECTOR2I( ex1 - deco_size, ey1 + deco_size ) ); } } -void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinOrient, +void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPinOrient, int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const { wxString name = GetShownName(); @@ -740,13 +744,13 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO hjustify = GR_TEXT_H_ALIGN_RIGHT; } - aPlotter->Text( wxPoint( x, y1 ), nameColor, name, EDA_ANGLE::HORIZONTAL, + aPlotter->Text( VECTOR2I( x, y1 ), nameColor, name, EDA_ANGLE::HORIZONTAL, pinNameSize, hjustify, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false ); } if( aDrawPinNum ) { - aPlotter->Text( wxPoint( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor, + aPlotter->Text( VECTOR2I( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor, number, EDA_ANGLE::HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false ); } @@ -758,13 +762,13 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO y = y1 + aTextInside; if( aDrawPinName ) - aPlotter->Text( wxPoint( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL, + aPlotter->Text( VECTOR2I( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL, pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false ); if( aDrawPinNum ) { - aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor, + aPlotter->Text( VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor, number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false ); } @@ -775,14 +779,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO if( aDrawPinName ) { - aPlotter->Text( wxPoint( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL, + aPlotter->Text( VECTOR2I( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL, pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, false ); } if( aDrawPinNum ) { - aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor, + aPlotter->Text( VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor, number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false ); } @@ -797,7 +801,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO if( aDrawPinName ) { x = ( x1 + aPinPos.x) / 2; - aPlotter->Text( wxPoint( x, y1 - name_offset ), nameColor, name, + aPlotter->Text( VECTOR2I( x, y1 - name_offset ), nameColor, name, EDA_ANGLE::HORIZONTAL, pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false ); } @@ -805,7 +809,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO if( aDrawPinNum ) { x = ( x1 + aPinPos.x ) / 2; - aPlotter->Text( wxPoint( x, y1 + num_offset ), numColor, number, + aPlotter->Text( VECTOR2I( x, y1 + num_offset ), numColor, number, EDA_ANGLE::HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false ); } @@ -815,14 +819,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO if( aDrawPinName ) { y = ( y1 + aPinPos.y ) / 2; - aPlotter->Text( wxPoint( x1 - name_offset, y ), nameColor, name, + aPlotter->Text( VECTOR2I( x1 - name_offset, y ), nameColor, name, EDA_ANGLE::VERTICAL, pinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false ); } if( aDrawPinNum ) { - aPlotter->Text( wxPoint( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor, + aPlotter->Text( VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor, number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false ); } @@ -833,8 +837,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO int LIB_PIN::PinDrawOrient( const TRANSFORM& aTransform ) const { - int orient; - wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1 + int orient; + VECTOR2I end; // position of pin end starting at 0,0 according to its orientation, length = 1 switch( m_orientation ) { @@ -949,13 +953,13 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFl } -void LIB_PIN::Offset( const wxPoint& aOffset ) +void LIB_PIN::Offset( const VECTOR2I& aOffset ) { m_position += aOffset; } -void LIB_PIN::MoveTo( const wxPoint& aNewPosition ) +void LIB_PIN::MoveTo( const VECTOR2I& aNewPosition ) { if( m_position != aNewPosition ) { @@ -965,7 +969,7 @@ void LIB_PIN::MoveTo( const wxPoint& aNewPosition ) } -void LIB_PIN::MirrorHorizontal( const wxPoint& aCenter ) +void LIB_PIN::MirrorHorizontal( const VECTOR2I& aCenter ) { m_position.x -= aCenter.x; m_position.x *= -1; @@ -978,7 +982,7 @@ void LIB_PIN::MirrorHorizontal( const wxPoint& aCenter ) } -void LIB_PIN::MirrorVertical( const wxPoint& aCenter ) +void LIB_PIN::MirrorVertical( const VECTOR2I& aCenter ) { m_position.y -= aCenter.y; m_position.y *= -1; @@ -991,11 +995,11 @@ void LIB_PIN::MirrorVertical( const wxPoint& aCenter ) } -void LIB_PIN::Rotate( const wxPoint& aCenter, bool aRotateCCW ) +void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) { int rot_angle = aRotateCCW ? -900 : 900; - RotatePoint( &m_position, aCenter, rot_angle ); + RotatePoint( m_position, aCenter, rot_angle ); if( aRotateCCW ) { @@ -1020,14 +1024,14 @@ void LIB_PIN::Rotate( const wxPoint& aCenter, bool aRotateCCW ) } -void LIB_PIN::Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill, +void LIB_PIN::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill, const TRANSFORM& aTransform ) const { if( !IsVisible() ) return; int orient = PinDrawOrient( aTransform ); - wxPoint pos = aTransform.TransformCoordinate( m_position ) + aPffset; + VECTOR2I pos = aTransform.TransformCoordinate( m_position ) + aOffset; PlotSymbol( aPlotter, pos, orient ); PlotPinTexts( aPlotter, pos, orient, GetParent()->GetPinNameOffset(), @@ -1054,7 +1058,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorRenderSettings() ); FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL; - static std::vector cornerList; + static std::vector cornerList; if( GetShape() == SHAPE_T::POLY ) { @@ -127,13 +127,13 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, cornerList.clear(); for( const VECTOR2I& pt : poly.CPoints() ) - cornerList.push_back( aTransform.TransformCoordinate( (wxPoint) pt ) + aOffset ); + cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset ); } else if( GetShape() == SHAPE_T::BEZIER ) { cornerList.clear(); - for( const wxPoint& pt : m_bezierPoints ) + for( const VECTOR2I& pt : m_bezierPoints ) cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset ); } else if( GetShape() == SHAPE_T::ARC ) @@ -210,8 +210,8 @@ int LIB_SHAPE::GetPenWidth() const } -void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, - void* aData, const TRANSFORM& aTransform ) +void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, + const TRANSFORM& aTransform ) { bool forceNoFill = static_cast( aData ); int penWidth = GetEffectivePenWidth( aSettings ); @@ -220,29 +220,29 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, return; wxDC* DC = aSettings->GetPrintDC(); - wxPoint pt1 = aTransform.TransformCoordinate( m_start ) + aOffset; - wxPoint pt2 = aTransform.TransformCoordinate( m_end ) + aOffset; - wxPoint c; + VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset; + VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset; + VECTOR2I c; COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE ); COLOR4D fillColor = color; unsigned ptCount = 0; - wxPoint* buffer = nullptr; + VECTOR2I* buffer = nullptr; if( GetShape() == SHAPE_T::POLY ) { const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 ); ptCount = poly.GetPointCount(); - buffer = new wxPoint[ ptCount ]; + buffer = new VECTOR2I[ptCount]; for( unsigned ii = 0; ii < ptCount; ++ii ) - buffer[ii] = aTransform.TransformCoordinate( (wxPoint) poly.CPoint( ii ) ) + aOffset; + buffer[ii] = aTransform.TransformCoordinate( poly.CPoint( ii ) ) + aOffset; } else if( GetShape() == SHAPE_T::BEZIER ) { ptCount = m_bezierPoints.size(); - buffer = new wxPoint[ ptCount ]; + buffer = new VECTOR2I[ptCount]; for( size_t ii = 0; ii < ptCount; ++ii ) buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset; @@ -403,7 +403,7 @@ BITMAPS LIB_SHAPE::GetMenuImage() const } -void LIB_SHAPE::AddPoint( const wxPoint& aPosition ) +void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition ) { if( GetShape() == SHAPE_T::POLY ) { diff --git a/eeschema/lib_shape.h b/eeschema/lib_shape.h index 7f983a9d44..b0567b04ce 100644 --- a/eeschema/lib_shape.h +++ b/eeschema/lib_shape.h @@ -52,7 +52,7 @@ public: STROKE_PARAMS GetStroke() const { return m_stroke; } void SetStroke( const STROKE_PARAMS& aStroke ) { m_stroke = aStroke; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; int GetPenWidth() const override; @@ -74,30 +74,30 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - void BeginEdit( const wxPoint& aStartPoint ) override { beginEdit( aStartPoint ); } - bool ContinueEdit( const wxPoint& aPosition ) override { return continueEdit( aPosition ); } - void CalcEdit( const wxPoint& aPosition ) override { calcEdit( aPosition ); } + void BeginEdit( const VECTOR2I& aStartPoint ) override { beginEdit( aStartPoint ); } + bool ContinueEdit( const VECTOR2I& aPosition ) override { return continueEdit( aPosition ); } + void CalcEdit( const VECTOR2I& aPosition ) override { calcEdit( aPosition ); } void EndEdit() override { endEdit(); } void SetEditState( int aState ) { setEditState( aState ); } - void AddPoint( const wxPoint& aPosition ); + void AddPoint( const VECTOR2I& aPosition ); - void Offset( const wxPoint& aOffset ) override; + void Offset( const VECTOR2I& aOffset ) override; - void MoveTo( const wxPoint& aPosition ) override; + void MoveTo( const VECTOR2I& aPosition ) override; - wxPoint GetPosition() const override { return getPosition(); } - void SetPosition( const wxPoint& aPosition ) override { setPosition( aPosition ); } + VECTOR2I GetPosition() const override { return getPosition(); } + void SetPosition( const VECTOR2I& aPosition ) override { setPosition( aPosition ); } - wxPoint GetCenter() const { return getCenter(); } + VECTOR2I GetCenter() const { return getCenter(); } void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const; - void MirrorHorizontal( const wxPoint& aCenter ) override; - void MirrorVertical( const wxPoint& aCenter ) override; - void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; + void MirrorHorizontal( const VECTOR2I& aCenter ) override; + void MirrorVertical( const VECTOR2I& aCenter ) override; + void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override; - void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, + void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill, const TRANSFORM& aTransform ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -118,11 +118,11 @@ private: int compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override; - void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, + void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) override; double getParentOrientation() const override { return 0.0; } - wxPoint getParentPosition() const override { return wxPoint(); } + VECTOR2I getParentPosition() const override { return VECTOR2I(); } }; diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 27dc6f234f..2ff0cdf4bd 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -509,8 +509,8 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator ) } -void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, - int aUnit, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts ) +void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aUnit, + int aConvert, const LIB_SYMBOL_OPTIONS& aOpts ) { /* draw background for filled items using background option * Solid lines will be drawn after the background @@ -580,7 +580,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset } -void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset, +void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const { wxASSERT( aPlotter != nullptr ); @@ -635,8 +635,8 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint } -void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, - const wxPoint& aOffset, const TRANSFORM& aTransform ) +void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset, + const TRANSFORM& aTransform ) { wxASSERT( aPlotter != nullptr ); @@ -1107,7 +1107,7 @@ int LIB_SYMBOL::GetNextAvailableFieldId() const } -void LIB_SYMBOL::SetOffset( const wxPoint& aOffset ) +void LIB_SYMBOL::SetOffset( const VECTOR2I& aOffset ) { for( LIB_ITEM& item : m_drawings ) item.Offset( aOffset ); @@ -1155,8 +1155,8 @@ void LIB_SYMBOL::ClearEditFlags() } -LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, - KICAD_T aType, const wxPoint& aPoint ) +LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, + const VECTOR2I& aPoint ) { for( LIB_ITEM& item : m_drawings ) { @@ -1176,10 +1176,10 @@ LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, - const wxPoint& aPoint, const TRANSFORM& aTransform ) + const VECTOR2I& aPoint, const TRANSFORM& aTransform ) { /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const - * wxPoint& pt ) to search items. + * VECTOR2I& pt ) to search items. * because this function uses DefaultTransform as orient/mirror matrix * we temporary copy aTransform in DefaultTransform */ diff --git a/eeschema/lib_symbol.h b/eeschema/lib_symbol.h index cb837eae70..b058840d71 100644 --- a/eeschema/lib_symbol.h +++ b/eeschema/lib_symbol.h @@ -311,8 +311,8 @@ public: * @param aConvert - Symbol conversion (DeMorgan) if available. * @param aOpts - Drawing options */ - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, - int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts ); + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti, int aConvert, + const LIB_SYMBOL_OPTIONS& aOpts ); /** * Plot lib symbol to plotter. @@ -325,7 +325,7 @@ public: * @param aOffset - Distance to shift the plot coordinates. * @param aTransform - Symbol plot transform matrix. */ - void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset, + void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset, const TRANSFORM& aTransform ) const; /** @@ -338,7 +338,7 @@ public: * @param aOffset - Distance to shift the plot coordinates. * @param aTransform - Symbol plot transform matrix. */ - void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset, + void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset, const TRANSFORM& aTransform ); /** @@ -432,7 +432,7 @@ public: * * @param aOffset - Offset displacement. */ - void SetOffset( const wxPoint& aOffset ); + void SetOffset( const VECTOR2I& aOffset ); /** * Remove duplicate draw items from list. @@ -461,7 +461,7 @@ public: * @param aPoint - Coordinate for hit testing. * @return The draw object if found. Otherwise NULL. */ - LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint ); + LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint ); /** * Locate a draw object (overlaid) @@ -473,7 +473,7 @@ public: * @param aTransform = the transform matrix * @return The draw object if found. Otherwise NULL. */ - LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint, + LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint, const TRANSFORM& aTransform ); /** diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index fb46ca507e..92e501c7fb 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -53,7 +53,7 @@ void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const } -bool LIB_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool LIB_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_TEXT tmp_text( *this ); tmp_text.SetTextPos( DefaultTransform.TransformCoordinate( GetTextPos() ) ); @@ -116,13 +116,13 @@ int LIB_TEXT::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareF } -void LIB_TEXT::Offset( const wxPoint& aOffset ) +void LIB_TEXT::Offset( const VECTOR2I& aOffset ) { EDA_TEXT::Offset( aOffset ); } -void LIB_TEXT::MoveTo( const wxPoint& newPosition ) +void LIB_TEXT::MoveTo( const VECTOR2I& newPosition ) { SetTextPos( newPosition ); } @@ -130,7 +130,7 @@ void LIB_TEXT::MoveTo( const wxPoint& newPosition ) void LIB_TEXT::NormalizeJustification( bool inverse ) { - wxPoint delta( 0, 0 ); + VECTOR2I delta( 0, 0 ); EDA_RECT bbox = GetTextBox(); if( GetTextAngle().IsHorizontal() ) @@ -165,7 +165,7 @@ void LIB_TEXT::NormalizeJustification( bool inverse ) } -void LIB_TEXT::MirrorHorizontal( const wxPoint& center ) +void LIB_TEXT::MirrorHorizontal( const VECTOR2I& center ) { NormalizeJustification( false ); int x = GetTextPos().x; @@ -194,7 +194,7 @@ void LIB_TEXT::MirrorHorizontal( const wxPoint& center ) } -void LIB_TEXT::MirrorVertical( const wxPoint& center ) +void LIB_TEXT::MirrorVertical( const VECTOR2I& center ) { NormalizeJustification( false ); int y = GetTextPos().y; @@ -223,7 +223,7 @@ void LIB_TEXT::MirrorVertical( const wxPoint& center ) } -void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW ) +void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW ) { NormalizeJustification( false ); int rot_angle = aRotateCCW ? -900 : 900; @@ -257,7 +257,7 @@ void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW ) } -void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill, +void LIB_TEXT::Plot( PLOTTER* plotter, const VECTOR2I& offset, bool fill, const TRANSFORM& aTransform ) const { wxASSERT( plotter != nullptr ); @@ -296,7 +296,7 @@ int LIB_TEXT::GetPenWidth() const } -void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, +void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) { wxDC* DC = aSettings->GetPrintDC(); @@ -410,13 +410,13 @@ BITMAPS LIB_TEXT::GetMenuImage() const } -void LIB_TEXT::BeginEdit( const wxPoint& aPosition ) +void LIB_TEXT::BeginEdit( const VECTOR2I& aPosition ) { SetTextPos( aPosition ); } -void LIB_TEXT::CalcEdit( const wxPoint& aPosition ) +void LIB_TEXT::CalcEdit( const VECTOR2I& aPosition ) { SetTextPos( aPosition ); } diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index ab79825e90..51437a8b16 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -57,7 +57,7 @@ public: void ViewGetLayers( int aLayers[], int& aCount ) const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override { @@ -81,22 +81,22 @@ public: const EDA_RECT GetBoundingBox() const override; - void BeginEdit( const wxPoint& aStartPoint ) override; - void CalcEdit( const wxPoint& aPosition ) override; + void BeginEdit( const VECTOR2I& aStartPoint ) override; + void CalcEdit( const VECTOR2I& aPosition ) override; - void Offset( const wxPoint& aOffset ) override; + void Offset( const VECTOR2I& aOffset ) override; - void MoveTo( const wxPoint& aPosition ) override; + void MoveTo( const VECTOR2I& aPosition ) override; - wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } + VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); } - void MirrorHorizontal( const wxPoint& aCenter ) override; - void MirrorVertical( const wxPoint& aCenter ) override; - void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; + void MirrorHorizontal( const VECTOR2I& aCenter ) override; + void MirrorVertical( const VECTOR2I& aCenter ) override; + void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override; void NormalizeJustification( bool inverse ); - void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, + void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill, const TRANSFORM& aTransform ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -120,7 +120,7 @@ private: int compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override; - void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, + void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData, const TRANSFORM& aTransform ) override; }; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 54ef9def88..518e56a443 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -240,7 +240,7 @@ bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject ) } -void SCH_BASE_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ) +void SCH_BASE_FRAME::RedrawScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer ) { GetCanvas()->GetView()->SetCenter( aCenterPoint ); @@ -251,7 +251,7 @@ void SCH_BASE_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe } -void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointer ) +void SCH_BASE_FRAME::CenterScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer ) { GetCanvas()->GetView()->SetCenter( aCenterPoint ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index 065c58aef5..385bb79037 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -192,9 +192,9 @@ public: const LIB_ID& aPreselectedLibId, int aUnit, int aConvert ); - virtual void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); + virtual void RedrawScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer ); - virtual void CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); + virtual void CenterScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer ); void HardRedraw() override; diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index d05aba7b82..713dcafa2a 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -40,7 +40,7 @@ #include -SCH_BITMAP::SCH_BITMAP( const wxPoint& pos ) : +SCH_BITMAP::SCH_BITMAP( const VECTOR2I& pos ) : SCH_ITEM( nullptr, SCH_BITMAP_T ) { m_pos = pos; @@ -114,9 +114,9 @@ const EDA_RECT SCH_BITMAP::GetBoundingBox() const } -void SCH_BITMAP::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_BITMAP::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { - wxPoint pos = m_pos + aOffset; + VECTOR2I pos = m_pos + aOffset; m_image->DrawBitmap( aSettings->GetPrintDC(), pos ); } @@ -142,9 +142,9 @@ void SCH_BITMAP::MirrorHorizontally( int aCenter ) } -void SCH_BITMAP::Rotate( const wxPoint& aCenter ) +void SCH_BITMAP::Rotate( const VECTOR2I& aCenter ) { - RotatePoint( &m_pos, aCenter, 900 ); + RotatePoint( m_pos, aCenter, 900 ); m_image->Rotate( false ); } @@ -160,7 +160,7 @@ void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const #endif -bool SCH_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT rect = GetBoundingBox(); diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index 847b997a67..510e971d44 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -40,7 +40,7 @@ class SCH_BITMAP : public SCH_ITEM { public: - SCH_BITMAP( const wxPoint& pos = wxPoint( 0, 0 ) ); + SCH_BITMAP( const VECTOR2I& pos = VECTOR2I( 0, 0 ) ); SCH_BITMAP( const SCH_BITMAP& aSchBitmap ); @@ -92,7 +92,7 @@ public: void SwapData( SCH_ITEM* aItem ) override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; /// @copydoc VIEW_ITEM::ViewGetLayers() virtual void ViewGetLayers( int aLayers[], int& aCount ) const override; @@ -107,7 +107,7 @@ public: */ bool ReadImageFile( const wxString& aFullFilename ); - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_pos += aMoveVector; } @@ -122,7 +122,7 @@ public: void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { @@ -133,10 +133,10 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -148,7 +148,7 @@ public: #endif private: - wxPoint m_pos; // XY coordinates of center of the bitmap + VECTOR2I m_pos; // XY coordinates of center of the bitmap BITMAP_BASE* m_image; // the BITMAP_BASE item }; diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 87474bd956..8a65ef79bb 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -43,7 +43,7 @@ #include "sch_painter.h" -SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, bool aFlipY ) : +SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool aFlipY ) : SCH_ITEM( nullptr, aType ) { m_pos = pos; @@ -65,7 +65,7 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, bool } -SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, bool aFlipY ) : +SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, bool aFlipY ) : SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, aFlipY ) { m_layer = LAYER_WIRE; @@ -77,7 +77,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, bool aFlipY ) : } -SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, int aQuadrant ) : +SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant ) : SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, false ) { switch( aQuadrant ) @@ -123,15 +123,15 @@ EDA_ITEM* SCH_BUS_BUS_ENTRY::Clone() const } -bool SCH_BUS_ENTRY_BASE::doIsConnected( const wxPoint& aPosition ) const +bool SCH_BUS_ENTRY_BASE::doIsConnected( const VECTOR2I& aPosition ) const { return ( m_pos == aPosition || GetEnd() == aPosition ); } -wxPoint SCH_BUS_ENTRY_BASE::GetEnd() const +VECTOR2I SCH_BUS_ENTRY_BASE::GetEnd() const { - return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y ); + return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y ); } @@ -265,13 +265,13 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis } -void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED ) ? aSettings->GetLayerColor( m_layer ) : GetBusEntryColor(); - wxPoint start = m_pos + aOffset; - wxPoint end = GetEnd() + aOffset; + VECTOR2I start = m_pos + aOffset; + VECTOR2I end = GetEnd() + aOffset; int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth(); if( GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE ) @@ -305,9 +305,9 @@ void SCH_BUS_ENTRY_BASE::MirrorHorizontally( int aCenter ) } -void SCH_BUS_ENTRY_BASE::Rotate( const wxPoint& aCenter ) +void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter ) { - RotatePoint( &m_pos, aCenter, 900 ); + RotatePoint( m_pos, aCenter, 900 ); RotatePoint( &m_size.x, &m_size.y, 900 ); } @@ -415,7 +415,7 @@ bool SCH_BUS_ENTRY_BASE::IsDangling() const } -std::vector SCH_BUS_ENTRY_BASE::GetConnectionPoints() const +std::vector SCH_BUS_ENTRY_BASE::GetConnectionPoints() const { return { m_pos, GetEnd() }; } @@ -445,7 +445,7 @@ BITMAPS SCH_BUS_BUS_ENTRY::GetMenuImage() const } -bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_BUS_ENTRY_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // Insure minimum accuracy if( aAccuracy == 0 ) diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index fb987daff1..08acc960fd 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -37,7 +37,8 @@ class SCH_BUS_ENTRY_BASE : public SCH_ITEM { public: - SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos = wxPoint( 0, 0 ), bool aFlipY = false ); + SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos = VECTOR2I( 0, 0 ), + bool aFlipY = false ); bool IsDanglingStart() const { return m_isDanglingStart; } bool IsDanglingEnd() const { return m_isDanglingEnd; } @@ -65,7 +66,7 @@ public: */ bool IsMovableFromAnchorPoint() const override { return false; } - wxPoint GetEnd() const; + VECTOR2I GetEnd() const; wxSize GetSize() const { return m_size; } void SetSize( const wxSize& aSize ) { m_size = aSize; } @@ -84,29 +85,29 @@ public: void ViewGetLayers( int aLayers[], int& aCount ) const override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; const EDA_RECT GetBoundingBox() const override; - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_pos += aMoveVector; } void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; bool IsDangling() const override; bool IsConnectable() const override { return true; } - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -120,10 +121,10 @@ public: #endif private: - bool doIsConnected( const wxPoint& aPosition ) const override; + bool doIsConnected( const VECTOR2I& aPosition ) const override; protected: - wxPoint m_pos; + VECTOR2I m_pos; wxSize m_size; bool m_isDanglingStart; bool m_isDanglingEnd; @@ -143,9 +144,9 @@ protected: class SCH_BUS_WIRE_ENTRY : public SCH_BUS_ENTRY_BASE { public: - SCH_BUS_WIRE_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), bool aFlipY = false ); + SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos = VECTOR2I( 0, 0 ), bool aFlipY = false ); - SCH_BUS_WIRE_ENTRY( const wxPoint& pos, int aQuadrant ); + SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant ); ~SCH_BUS_WIRE_ENTRY() { } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index ba3131d491..689ea75a72 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -1288,7 +1288,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM* if( !aItem->IsMoving() && aItem->IsConnectable() ) { - std::vector< wxPoint > pts = aItem->GetConnectionPoints(); + std::vector pts = aItem->GetConnectionPoints(); for( auto i = pts.begin(); i != pts.end(); i++ ) { diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index c5960b4053..04247cc9c3 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -262,7 +262,7 @@ public: * @param aScreen is the screen to examine, or nullptr to examine the current screen. * @return True if any wires or buses were broken. */ - bool BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, + bool BreakSegment( SCH_LINE* aSegment, const VECTOR2I& aPoint, SCH_LINE** aNewSegment = nullptr, SCH_SCREEN* aScreen = nullptr ); /** @@ -275,7 +275,7 @@ public: * @param aScreen is the screen to examine, or nullptr to examine the current screen. * @return True if any wires or buses were broken. */ - bool BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen = nullptr ); + bool BreakSegments( const VECTOR2I& aPoint, SCH_SCREEN* aScreen = nullptr ); /** * Test all junctions and bus entries in the schematic for intersections with wires and @@ -502,7 +502,7 @@ public: */ bool AskToSaveChanges(); - SCH_JUNCTION* AddJunction( SCH_SCREEN* aScreen, const wxPoint& aPos, bool aAppendToUndo, + SCH_JUNCTION* AddJunction( SCH_SCREEN* aScreen, const VECTOR2I& aPos, bool aAppendToUndo, bool aFinal = true ); /** @@ -526,14 +526,14 @@ public: * @param aEnd The ending point for trimming * @return True if any wires were changed by this operation */ - bool TrimWire( const wxPoint& aStart, const wxPoint& aEnd ); + bool TrimWire( const VECTOR2I& aStart, const VECTOR2I& aEnd ); /** * Collect a unique list of all possible connection points in the schematic. * * @return vector of connections */ - std::vector GetSchematicConnections(); + std::vector GetSchematicConnections(); void OnOpenPcbnew( wxCommandEvent& event ); void OnOpenCvpcb( wxCommandEvent& event ); diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 38a9e904f2..d7680988b4 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -53,7 +53,7 @@ #include #include -SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, +SCH_FIELD::SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName ) : SCH_ITEM( aParent, SCH_FIELD_T ), EDA_TEXT( wxEmptyString ), @@ -213,7 +213,7 @@ int SCH_FIELD::GetPenWidth() const } -void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer ); @@ -297,9 +297,9 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const } -wxPoint SCH_FIELD::GetDrawPos() const +VECTOR2I SCH_FIELD::GetDrawPos() const { - return (wxPoint)GetBoundingBox().Centre(); + return GetBoundingBox().Centre(); } @@ -360,7 +360,7 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const bool SCH_FIELD::IsHorizJustifyFlipped() const { VECTOR2I render_center = GetBoundingBox().Centre(); - wxPoint pos = GetPosition(); + VECTOR2I pos = GetPosition(); switch( GetHorizJustify() ) { @@ -397,7 +397,7 @@ GR_TEXT_H_ALIGN_T SCH_FIELD::GetEffectiveHorizJustify() const bool SCH_FIELD::IsVertJustifyFlipped() const { VECTOR2I render_center = GetBoundingBox().Centre(); - wxPoint pos = GetPosition(); + VECTOR2I pos = GetPosition(); switch( GetVertJustify() ) { @@ -577,10 +577,10 @@ bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) } -void SCH_FIELD::Rotate( const wxPoint& aCenter ) +void SCH_FIELD::Rotate( const VECTOR2I& aCenter ) { - wxPoint pt = GetPosition(); - RotatePoint( &pt, aCenter, 900 ); + VECTOR2I pt = GetPosition(); + RotatePoint( pt, aCenter, 900 ); SetPosition( pt ); } @@ -786,7 +786,7 @@ BITMAPS SCH_FIELD::GetMenuImage() const } -bool SCH_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // Do not hit test hidden or empty fields. if( !IsVisible() || IsVoid() ) @@ -866,7 +866,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const } -void SCH_FIELD::SetPosition( const wxPoint& aPosition ) +void SCH_FIELD::SetPosition( const VECTOR2I& aPosition ) { // Actual positions are calculated by the rotation/mirror transform of the parent symbol // of the field. The inverse transform is used to calculate the position relative to the @@ -874,7 +874,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition ) if( m_parent && m_parent->Type() == SCH_SYMBOL_T ) { SCH_SYMBOL* parentSymbol = static_cast( m_parent ); - wxPoint relPos = aPosition - parentSymbol->GetPosition(); + VECTOR2I relPos = aPosition - parentSymbol->GetPosition(); relPos = parentSymbol->GetTransform().InverseTransform().TransformCoordinate( relPos ); @@ -886,7 +886,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition ) } -wxPoint SCH_FIELD::GetPosition() const +VECTOR2I SCH_FIELD::GetPosition() const { if( m_parent && m_parent->Type() == SCH_SYMBOL_T ) { @@ -895,14 +895,14 @@ wxPoint SCH_FIELD::GetPosition() const relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos ); - return (wxPoint)relativePos + parentSymbol->GetPosition(); + return relativePos + parentSymbol->GetPosition(); } - return (wxPoint)GetTextPos(); + return GetTextPos(); } -wxPoint SCH_FIELD::GetParentPosition() const +VECTOR2I SCH_FIELD::GetParentPosition() const { return m_parent ? m_parent->GetPosition() : wxPoint( 0, 0 ); } diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 65c9accb65..1f5ffd2115 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -49,7 +49,7 @@ class LIB_FIELD; class SCH_FIELD : public SCH_ITEM, public EDA_TEXT { public: - SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, + SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName = wxEmptyString ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -119,8 +119,8 @@ public: /** * Adjusters to allow EDA_TEXT to draw/print/etc. text in absolute coords. */ - EDA_ANGLE GetDrawRotation() const override; - wxPoint GetDrawPos() const override; + EDA_ANGLE GetDrawRotation() const override; + VECTOR2I GetDrawPos() const override; GR_TEXT_H_ALIGN_T GetDrawHorizJustify() const override; GR_TEXT_V_ALIGN_T GetDrawVertJustify() const override; @@ -154,14 +154,14 @@ public: int GetPenWidth() const override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { Offset( aMoveVector ); } - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; /** * @copydoc SCH_ITEM::MirrorVertically() @@ -198,12 +198,12 @@ public: wxPoint GetLibPosition() const { return (wxPoint)EDA_TEXT::GetTextPos(); } - wxPoint GetPosition() const override; - void SetPosition( const wxPoint& aPosition ) override; + VECTOR2I GetPosition() const override; + void SetPosition( const VECTOR2I& aPosition ) override; - wxPoint GetParentPosition() const; + VECTOR2I GetParentPosition() const; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; diff --git a/eeschema/sch_item.cpp b/eeschema/sch_item.cpp index 3817df9c6d..4c36ce4755 100644 --- a/eeschema/sch_item.cpp +++ b/eeschema/sch_item.cpp @@ -126,7 +126,7 @@ void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const } -bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const +bool SCH_ITEM::IsConnected( const VECTOR2I& aPosition ) const { if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) ) return false; diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h index 934deb1296..45981ed5cc 100644 --- a/eeschema/sch_item.h +++ b/eeschema/sch_item.h @@ -78,7 +78,7 @@ enum DANGLING_END_T class DANGLING_END_ITEM { public: - DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const wxPoint& aPosition ) + DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition ) { m_item = aItem; m_type = aType; @@ -86,7 +86,7 @@ public: m_parent = aItem; } - DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const wxPoint& aPosition, + DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition, const EDA_ITEM* aParent ) { m_item = aItem; @@ -117,14 +117,14 @@ public: || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) ); } - wxPoint GetPosition() const { return m_pos; } + VECTOR2I GetPosition() const { return m_pos; } EDA_ITEM* GetItem() const { return m_item; } const EDA_ITEM* GetParent() const { return m_parent; } DANGLING_END_T GetType() const { return m_type; } private: EDA_ITEM* m_item; /// A pointer to the connectable object. - wxPoint m_pos; /// The position of the connection point. + VECTOR2I m_pos; /// The position of the connection point. DANGLING_END_T m_type; /// The type of connection of #m_item. const EDA_ITEM* m_parent; /// A pointer to the parent object (in the case of pins) }; @@ -203,8 +203,8 @@ public: */ virtual bool IsMovableFromAnchorPoint() const { return true; } - wxPoint& GetStoredPos() { return m_storedPos; } - void SetStoredPos( const wxPoint& aPos ) { m_storedPos = aPos; } + VECTOR2I& GetStoredPos() { return m_storedPos; } + void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; } /** * Searches the item hierarchy to find a SCHEMATIC. @@ -267,12 +267,12 @@ public: * @param aOffset is the drawing offset (usually {0,0} but can be different when moving an * object). */ - virtual void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0; + virtual void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) = 0; /** * Move the item by \a aMoveVector to a new position. */ - virtual void Move( const wxPoint& aMoveVector ) = 0; + virtual void Move( const VECTOR2I& aMoveVector ) = 0; /** * Mirror item horizontally about \a aCenter. @@ -287,7 +287,7 @@ public: /** * Rotate the item around \a aCenter 90 degrees in the clockwise direction. */ - virtual void Rotate( const wxPoint& aCenter ) = 0; + virtual void Rotate( const VECTOR2I& aCenter ) = 0; /** * Add the schematic item end points to \a aItemList if the item has end points. @@ -336,7 +336,7 @@ public: * @return true if the given point can start drawing (usually means the anchor is * unused/free/dangling). */ - virtual bool IsPointClickableAnchor( const wxPoint& aPos ) const { return false; } + virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; } /** * Add all the connection points for this item to \a aPoints. @@ -345,7 +345,7 @@ public: * * @param aPoints is the list of connection points to add to. */ - virtual std::vector GetConnectionPoints() const { return {}; } + virtual std::vector GetConnectionPoints() const { return {}; } /** * Clears all of the connection items from the list. @@ -358,10 +358,10 @@ public: /** * Test the item to see if it is connected to \a aPoint. * - * @param aPoint is a reference to a wxPoint object containing the coordinates to test. + * @param aPoint is a reference to a VECTOR2I object containing the coordinates to test. * @return True if connection to \a aPoint exists. */ - bool IsConnected( const wxPoint& aPoint ) const; + bool IsConnected( const VECTOR2I& aPoint ) const; /** * Retrieve the connection associated with this object in the given sheet. @@ -462,16 +462,16 @@ private: * which performs tests common to all schematic items before calling the * item specific connection testing. * - * @param aPosition is a reference to a wxPoint object containing the test position. + * @param aPosition is a reference to a VECTOR2I object containing the test position. * @return True if connection to \a aPosition exists. */ - virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; } + virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; } protected: SCH_LAYER_ID m_layer; EDA_ITEMS m_connections; // List of items connected to this item. FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement - wxPoint m_storedPos; // a temporary variable used in some move commands + VECTOR2I m_storedPos; // a temporary variable used in some move commands // to store a initial pos of the item or mouse cursor /// Store pointers to other items that are connected to this one, per sheet. diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index f7e0a8dcc8..7d3a9dd9e2 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -42,7 +42,7 @@ #include -SCH_JUNCTION::SCH_JUNCTION( const wxPoint& aPosition, int aDiameter, SCH_LAYER_ID aLayer ) : +SCH_JUNCTION::SCH_JUNCTION( const VECTOR2I& aPosition, int aDiameter, SCH_LAYER_ID aLayer ) : SCH_ITEM( nullptr, SCH_JUNCTION_T ) { m_pos = aPosition; @@ -116,7 +116,7 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const } -void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = GetJunctionColor(); @@ -126,7 +126,7 @@ void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffs SHAPE_CIRCLE circle = getEffectiveShape(); - GRFilledCircle( nullptr, DC, (wxPoint) circle.GetCenter() + aOffset, circle.GetRadius(), + GRFilledCircle( nullptr, DC, circle.GetCenter() + aOffset, circle.GetRadius(), color ); } @@ -143,9 +143,9 @@ void SCH_JUNCTION::MirrorHorizontally( int aCenter ) } -void SCH_JUNCTION::Rotate( const wxPoint& aCenter ) +void SCH_JUNCTION::Rotate( const VECTOR2I& aCenter ) { - RotatePoint( &m_pos, aCenter, 900 ); + RotatePoint( m_pos, aCenter, 900 ); } @@ -156,7 +156,7 @@ void SCH_JUNCTION::GetEndPoints( std::vector & aItemList ) } -std::vector SCH_JUNCTION::GetConnectionPoints() const +std::vector SCH_JUNCTION::GetConnectionPoints() const { return { m_pos }; } @@ -198,7 +198,7 @@ int SCH_JUNCTION::GetEffectiveDiameter() const } -bool SCH_JUNCTION::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_JUNCTION::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { if( aAccuracy >= 0 ) return getEffectiveShape().Collide( SEG( aPosition, aPosition ), aAccuracy ); @@ -230,7 +230,7 @@ bool SCH_JUNCTION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac } -bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const +bool SCH_JUNCTION::doIsConnected( const VECTOR2I& aPosition ) const { return m_pos == aPosition; } diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index faac0494ee..ebe8f32ef3 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -35,7 +35,7 @@ class NETLIST_OBJECT_LIST; class SCH_JUNCTION : public SCH_ITEM { public: - SCH_JUNCTION( const wxPoint& aPosition = wxPoint( 0, 0 ), int aDiameter = 0, + SCH_JUNCTION( const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), int aDiameter = 0, SCH_LAYER_ID aLayer = LAYER_JUNCTION ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -69,22 +69,22 @@ public: const EDA_RECT GetBoundingBox() const override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_pos += aMoveVector; } void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; void GetEndPoints( std::vector & aItemList ) override; bool IsConnectable() const override { return true; } - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; bool CanConnect( const SCH_ITEM* aItem ) const override { @@ -100,10 +100,10 @@ public: BITMAPS GetMenuImage() const override; - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; } - bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return false; } + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return false; } int GetEffectiveDiameter() const; @@ -115,7 +115,7 @@ public: COLOR4D GetColor() const { return m_color; } void SetColor( const COLOR4D& aColor ) { m_color = aColor; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -129,11 +129,11 @@ public: #endif private: - bool doIsConnected( const wxPoint& aPosition ) const override; + bool doIsConnected( const VECTOR2I& aPosition ) const override; SHAPE_CIRCLE getEffectiveShape() const; - wxPoint m_pos; ///< Position of the junction. + VECTOR2I m_pos; ///< Position of the junction. int m_diameter; ///< Diameter of the junction. Zero is user default. COLOR4D m_color; ///< Color of the junction. #COLOR4D::UNSPECIFIED is user default. diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 623da0f82b..030a3931a0 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -132,9 +132,9 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyleByName( const wxString& aStyleName ) } -void SCH_LINE::Move( const wxPoint& aOffset ) +void SCH_LINE::Move( const VECTOR2I& aOffset ) { - if( aOffset != wxPoint( 0, 0 ) ) + if( aOffset != VECTOR2I( 0, 0 ) ) { m_start += aOffset; m_end += aOffset; @@ -143,9 +143,9 @@ void SCH_LINE::Move( const wxPoint& aOffset ) } -void SCH_LINE::MoveStart( const wxPoint& aOffset ) +void SCH_LINE::MoveStart( const VECTOR2I& aOffset ) { - if( aOffset != wxPoint( 0, 0 ) ) + if( aOffset != VECTOR2I( 0, 0 ) ) { m_start += aOffset; SetModified(); @@ -153,9 +153,9 @@ void SCH_LINE::MoveStart( const wxPoint& aOffset ) } -void SCH_LINE::MoveEnd( const wxPoint& aOffset ) +void SCH_LINE::MoveEnd( const VECTOR2I& aOffset ) { - if( aOffset != wxPoint( 0, 0 ) ) + if( aOffset != VECTOR2I( 0, 0 ) ) { m_end += aOffset; SetModified(); @@ -365,7 +365,7 @@ int SCH_LINE::GetPenWidth() const } -void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) +void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) { wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = GetLineColor(); @@ -373,8 +373,8 @@ void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) if( color == COLOR4D::UNSPECIFIED ) color = aSettings->GetLayerColor( GetLayer() ); - wxPoint start = m_start; - wxPoint end = m_end; + VECTOR2I start = m_start; + VECTOR2I end = m_end; PLOT_DASH_TYPE lineStyle = GetEffectiveLineStyle(); int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); @@ -415,31 +415,31 @@ void SCH_LINE::MirrorHorizontally( int aCenter ) } -void SCH_LINE::Rotate( const wxPoint& aCenter ) +void SCH_LINE::Rotate( const VECTOR2I& aCenter ) { if( m_flags & STARTPOINT ) - RotatePoint( &m_start, aCenter, 900 ); + RotatePoint( m_start, aCenter, 900 ); if( m_flags & ENDPOINT ) - RotatePoint( &m_end, aCenter, 900 ); + RotatePoint( m_end, aCenter, 900 ); } -void SCH_LINE::RotateStart( const wxPoint& aCenter ) +void SCH_LINE::RotateStart( const VECTOR2I& aCenter ) { - RotatePoint( &m_start, aCenter, 900 ); + RotatePoint( m_start, aCenter, 900 ); } -void SCH_LINE::RotateEnd( const wxPoint& aCenter ) +void SCH_LINE::RotateEnd( const VECTOR2I& aCenter ) { - RotatePoint( &m_end, aCenter, 900 ); + RotatePoint( m_end, aCenter, 900 ); } -int SCH_LINE::GetAngleFrom( const wxPoint& aPoint ) const +int SCH_LINE::GetAngleFrom( const VECTOR2I& aPoint ) const { - wxPoint vec; + VECTOR2I vec; if( aPoint == m_start ) vec = m_end - aPoint; @@ -450,9 +450,9 @@ int SCH_LINE::GetAngleFrom( const wxPoint& aPoint ) const } -int SCH_LINE::GetReverseAngleFrom( const wxPoint& aPoint ) const +int SCH_LINE::GetReverseAngleFrom( const VECTOR2I& aPoint ) const { - wxPoint vec; + VECTOR2I vec; if( aPoint == m_end ) vec = m_start - aPoint; @@ -468,8 +468,8 @@ bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false, wxT( "Cannot test line segment for overlap." ) ); - wxPoint firstSeg = m_end - m_start; - wxPoint secondSeg = aLine->m_end - aLine->m_start; + VECTOR2I firstSeg = m_end - m_start; + VECTOR2I secondSeg = aLine->m_end - aLine->m_start; // Use long long here to avoid overflow in calculations return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x ); @@ -479,7 +479,7 @@ bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCheckJunctions ) { auto less = - []( const wxPoint& lhs, const wxPoint& rhs ) -> bool + []( const VECTOR2I& lhs, const VECTOR2I& rhs ) -> bool { if( lhs.x == rhs.x ) return lhs.y < rhs.y; @@ -493,11 +493,11 @@ SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCh if( this == aLine || GetLayer() != aLine->GetLayer() ) return nullptr; - wxPoint leftmost_start = aLine->m_start; - wxPoint leftmost_end = aLine->m_end; + VECTOR2I leftmost_start = aLine->m_start; + VECTOR2I leftmost_end = aLine->m_end; - wxPoint rightmost_start = m_start; - wxPoint rightmost_end = m_end; + VECTOR2I rightmost_start = m_start; + VECTOR2I rightmost_end = m_end; // We place the start to the left and below the end of both lines if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) ) @@ -515,8 +515,8 @@ SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCh std::swap( leftmost_end, rightmost_end ); } - wxPoint other_start = rightmost_start; - wxPoint other_end = rightmost_end; + VECTOR2I other_start = rightmost_start; + VECTOR2I other_end = rightmost_end; if( less( rightmost_end, leftmost_end ) ) { @@ -700,7 +700,7 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const } -std::vector SCH_LINE::GetConnectionPoints() const +std::vector SCH_LINE::GetConnectionPoints() const { return { m_start, m_end }; } @@ -719,7 +719,7 @@ bool SCH_LINE::ConnectionPropagatesTo( const EDA_ITEM* aItem ) const } -void SCH_LINE::GetSelectedPoints( std::vector< wxPoint >& aPoints ) const +void SCH_LINE::GetSelectedPoints( std::vector& aPoints ) const { if( m_flags & STARTPOINT ) aPoints.push_back( m_start ); @@ -800,7 +800,7 @@ bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const } -bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // Performance enhancement for connection-building if( aPosition == m_start || aPosition == m_end ) @@ -852,7 +852,7 @@ void SCH_LINE::SwapData( SCH_ITEM* aItem ) } -bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const +bool SCH_LINE::doIsConnected( const VECTOR2I& aPosition ) const { if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS ) return false; @@ -882,7 +882,7 @@ void SCH_LINE::Plot( PLOTTER* aPlotter ) const } -void SCH_LINE::SetPosition( const wxPoint& aPosition ) +void SCH_LINE::SetPosition( const VECTOR2I& aPosition ) { m_end = m_end - ( m_start - aPosition ); m_start = aPosition; diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 2464e6c337..95ca301cee 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -79,21 +79,21 @@ public: return false; } - bool IsEndPoint( const wxPoint& aPoint ) const + bool IsEndPoint( const VECTOR2I& aPoint ) const { return aPoint == m_start || aPoint == m_end; } - int GetAngleFrom( const wxPoint& aPoint ) const; - int GetReverseAngleFrom( const wxPoint& aPoint ) const; + int GetAngleFrom( const VECTOR2I& aPoint ) const; + int GetReverseAngleFrom( const VECTOR2I& aPoint ) const; bool IsNull() const { return m_start == m_end; } - wxPoint GetStartPoint() const { return m_start; } - void SetStartPoint( const wxPoint& aPosition ) { m_start = aPosition; } + VECTOR2I GetStartPoint() const { return m_start; } + void SetStartPoint( const VECTOR2I& aPosition ) { m_start = aPosition; } - wxPoint GetEndPoint() const { return m_end; } - void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; } + VECTOR2I GetEndPoint() const { return m_end; } + void SetEndPoint( const VECTOR2I& aPosition ) { m_end = aPosition; } void SetLastResolvedState( const SCH_ITEM* aItem ) override { @@ -174,19 +174,19 @@ public: */ double GetLength() const; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; int GetPenWidth() const override; - void Move( const wxPoint& aMoveVector ) override; - void MoveStart( const wxPoint& aMoveVector ); - void MoveEnd( const wxPoint& aMoveVector ); + void Move( const VECTOR2I& aMoveVector ) override; + void MoveStart( const VECTOR2I& aMoveVector ); + void MoveEnd( const VECTOR2I& aMoveVector ); void MirrorVertically( int aCenter ) override; void MirrorHorizontally( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; - void RotateStart( const wxPoint& aCenter ); - void RotateEnd( const wxPoint& aCenter ); + void Rotate( const VECTOR2I& aCenter ) override; + void RotateStart( const VECTOR2I& aCenter ); + void RotateEnd( const VECTOR2I& aCenter ); /** * Check line against \a aLine to see if it overlaps and merge if it does. @@ -216,11 +216,11 @@ public: bool IsConnectable() const override; - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const override; - void GetSelectedPoints( std::vector< wxPoint >& aPoints ) const; + void GetSelectedPoints( std::vector& aPoints ) const; bool CanConnect( const SCH_ITEM* aItem ) const override; @@ -230,16 +230,16 @@ public: bool operator <( const SCH_ITEM& aItem ) const override; - wxPoint GetPosition() const override { return m_start; } - void SetPosition( const wxPoint& aPosition ) override; + VECTOR2I GetPosition() const override { return m_start; } + void SetPosition( const VECTOR2I& aPosition ) override; - bool IsPointClickableAnchor( const wxPoint& aPos ) const override + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return ( GetStartPoint() == aPos && IsStartDangling() ) || ( GetEndPoint() == aPos && IsEndDangling() ); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -276,12 +276,12 @@ public: bool IsBus() const; private: - bool doIsConnected( const wxPoint& aPosition ) const override; + bool doIsConnected( const VECTOR2I& aPosition ) const override; bool m_startIsDangling; ///< True if start point is not connected. bool m_endIsDangling; ///< True if end point is not connected. - wxPoint m_start; ///< Line start point - wxPoint m_end; ///< Line end point + VECTOR2I m_start; ///< Line start point + VECTOR2I m_end; ///< Line end point STROKE_PARAMS m_stroke; ///< Line stroke properties. // If real-time connectivity gets disabled (due to being too slow on a particular diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index c28f3bbc59..9662d67763 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -40,7 +40,7 @@ #define SCALING_FACTOR Millimeter2iu( 0.15 ) -SCH_MARKER::SCH_MARKER( std::shared_ptr aItem, const wxPoint& aPos ) : +SCH_MARKER::SCH_MARKER( std::shared_ptr aItem, const VECTOR2I& aPos ) : SCH_ITEM( nullptr, SCH_MARKER_T ), MARKER_BASE( SCALING_FACTOR, aItem, MARKER_BASE::MARKER_ERC ) { @@ -149,7 +149,7 @@ KIGFX::COLOR4D SCH_MARKER::getColor() const } -void SCH_MARKER::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_MARKER::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { PrintMarker( aSettings, aOffset ); } @@ -179,7 +179,7 @@ BITMAPS SCH_MARKER::GetMenuImage() const } -void SCH_MARKER::Rotate( const wxPoint& aCenter ) +void SCH_MARKER::Rotate( const VECTOR2I& aCenter ) { // Marker geometry isn't user-editable } @@ -197,7 +197,7 @@ void SCH_MARKER::MirrorHorizontally( int aCenter ) } -bool SCH_MARKER::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_MARKER::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { return HitTestMarker( aPosition, aAccuracy ); } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 7f74bdabd6..a0caba8b8d 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -33,7 +33,7 @@ class SCH_MARKER : public SCH_ITEM, public MARKER_BASE { public: - SCH_MARKER( std::shared_ptr aItem, const wxPoint& aPos ); + SCH_MARKER( std::shared_ptr aItem, const VECTOR2I& aPos ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -58,7 +58,7 @@ public: SCH_LAYER_ID GetColorLayer() const; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; void Plot( PLOTTER* /* aPlotter */ ) const override { @@ -71,14 +71,14 @@ public: // Geometric transforms (used in block operations): - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_Pos += aMoveVector; } void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; /** * Compare DRC marker main and auxiliary text against search string. @@ -98,10 +98,10 @@ public: BITMAPS GetMenuImage() const override; - wxPoint GetPosition() const override { return m_Pos; } - void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; } + VECTOR2I GetPosition() const override { return m_Pos; } + void SetPosition( const VECTOR2I& aPosition ) override { m_Pos = aPosition; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; EDA_ITEM* Clone() const override; diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 0dbd7737fb..9eebd84607 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -38,7 +38,7 @@ #include -SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) : +SCH_NO_CONNECT::SCH_NO_CONNECT( const VECTOR2I& pos ) : SCH_ITEM( nullptr, SCH_NO_CONNECT_T ) { m_pos = pos; @@ -101,7 +101,7 @@ int SCH_NO_CONNECT::GetPenWidth() const } -void SCH_NO_CONNECT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_NO_CONNECT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); int half = GetSize() / 2; @@ -127,29 +127,29 @@ void SCH_NO_CONNECT::MirrorHorizontally( int aCenter ) } -void SCH_NO_CONNECT::Rotate( const wxPoint& aCenter ) +void SCH_NO_CONNECT::Rotate( const VECTOR2I& aCenter ) { - RotatePoint( &m_pos, aCenter, 900 ); + RotatePoint( m_pos, aCenter, 900 ); } -std::vector SCH_NO_CONNECT::GetConnectionPoints() const +std::vector SCH_NO_CONNECT::GetConnectionPoints() const { return { m_pos }; } -bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const +bool SCH_NO_CONNECT::doIsConnected( const VECTOR2I& aPosition ) const { return m_pos == aPosition; } -bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_NO_CONNECT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int delta = ( GetPenWidth() + GetSize() ) / 2 + aAccuracy; - wxPoint dist = aPosition - m_pos; + VECTOR2I dist = aPosition - m_pos; if( ( std::abs( dist.x ) <= delta ) && ( std::abs( dist.y ) <= delta ) ) return true; diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index b3f4d9edeb..eeb8e0fbe4 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -38,7 +38,7 @@ class NETLIST_OBJECT_LIST; class SCH_NO_CONNECT : public SCH_ITEM { public: - SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) ); + SCH_NO_CONNECT( const VECTOR2I& pos = VECTOR2I( 0, 0 ) ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -65,7 +65,7 @@ public: void ViewGetLayers( int aLayers[], int& aCount ) const override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override; @@ -73,14 +73,14 @@ public: // Geometric transforms (used in block operations): - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_pos += aMoveVector; } void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; bool IsConnectable() const override { return true; } @@ -90,7 +90,7 @@ public: aItem->Type() == SCH_SYMBOL_T; } - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { @@ -99,10 +99,10 @@ public: BITMAPS GetMenuImage() const override; - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -114,10 +114,10 @@ public: #endif private: - bool doIsConnected( const wxPoint& aPosition ) const override; + bool doIsConnected( const VECTOR2I& aPosition ) const override; - wxPoint m_pos; ///< Position of the no connect object. - int m_size; ///< Size of the no connect object. + VECTOR2I m_pos; ///< Position of the no connect object. + int m_size; ///< Size of the no connect object. }; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 57f951af82..524ae60dfd 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -144,8 +144,8 @@ static LIB_SYMBOL* dummy() LIB_SHAPE* square = new LIB_SHAPE( symbol, SHAPE_T::RECT ); - square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) ); - square->SetEnd( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) ); + square->MoveTo( VECTOR2I( Mils2iu( -200 ), Mils2iu( 200 ) ) ); + square->SetEnd( VECTOR2I( Mils2iu( 200 ), Mils2iu( -200 ) ) ); LIB_TEXT* text = new LIB_TEXT( symbol ); @@ -446,7 +446,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition, dou const STROKE_FONT& font = m_gal->GetStrokeFont(); VECTOR2D extents = font.ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(), m_gal->GetLineWidth() ); - EDA_RECT box( (wxPoint) aPosition, wxSize( extents.x, extents.y ) ); + EDA_RECT box( (VECTOR2I) aPosition, wxSize( extents.x, extents.y ) ); if( m_gal->GetHorizontalJustify() == GR_TEXT_H_ALIGN_CENTER ) box.SetX( box.GetX() - ( box.GetWidth() / 2) ); @@ -459,7 +459,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition, dou box.SetY( box.GetY() - box.GetHeight() ); box.Normalize(); // Make h and v sizes always >= 0 - box = box.GetBoundingBoxRotated((wxPoint) aPosition, RAD2DECIDEG( aAngle ) ); + box = box.GetBoundingBoxRotated((VECTOR2I) aPosition, RAD2DECIDEG( aAngle ) ); box.RevertYAxis(); m_gal->DrawRectangle( mapCoords( box.GetOrigin() ), mapCoords( box.GetEnd() ) ); } @@ -617,7 +617,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer ) std::deque mappedPts; for( const VECTOR2I& pt : poly.CPoints() ) - mappedPts.push_back( mapCoords( (wxPoint) pt ) ); + mappedPts.push_back( mapCoords( pt ) ); m_gal->DrawPolygon( mappedPts ); } @@ -627,7 +627,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer ) { std::deque mappedPts; - for( const wxPoint& p : aShape->GetBezierPoints() ) + for( const VECTOR2I& p : aShape->GetBezierPoints() ) mappedPts.push_back( mapCoords( p ) ); m_gal->DrawPolygon( mappedPts ); @@ -709,7 +709,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer ) { m_gal->SetLineWidth( m_schSettings.m_outlineWidth ); m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) ); - m_gal->DrawLine( textpos, wxPoint( 0, 0 ) ); + m_gal->DrawLine( textpos, VECTOR2I( 0, 0 ) ); } } @@ -1238,8 +1238,8 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth, bool aDrawingShadows, bool aBrightened ) { - wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ), - aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) ); + VECTOR2I radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ), + aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) ); // Dangling symbols must be drawn in a slightly different colour so they can be seen when // they overlap with a junction dot. @@ -1319,7 +1319,7 @@ void SCH_PAINTER::draw( const SCH_LINE *aLine, int aLayer ) SHAPE_SEGMENT line( aLine->GetStartPoint(), aLine->GetEndPoint() ); STROKE_PARAMS::Stroke( &line, lineStyle, width, &m_schSettings, - [&]( const wxPoint& a, const wxPoint& b ) + [&]( const VECTOR2I& a, const VECTOR2I& b ) { m_gal->DrawLine( a, b ); } ); @@ -1422,7 +1422,7 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer ) for( SHAPE* shape : shapes ) { STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings, - [&]( const wxPoint& a, const wxPoint& b ) + [&]( const VECTOR2I& a, const VECTOR2I& b ) { m_gal->DrawLine( a, b ); } ); @@ -1564,13 +1564,13 @@ static void orientSymbol( LIB_SYMBOL* symbol, int orientation ) for( auto& item : symbol->GetDrawItems() ) { for( int i = 0; i < o.n_rots; i++ ) - item.Rotate( wxPoint(0, 0 ), true ); + item.Rotate( VECTOR2I(0, 0 ), true ); if( o.mirror_x ) - item.MirrorVertical( wxPoint( 0, 0 ) ); + item.MirrorVertical( VECTOR2I( 0, 0 ) ); if( o.mirror_y ) - item.MirrorHorizontal( wxPoint( 0, 0 ) ); + item.MirrorHorizontal( VECTOR2I( 0, 0 ) ); } } @@ -1612,7 +1612,7 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer ) for( auto& tempItem : tempSymbol.GetDrawItems() ) { tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED - tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) ); + tempItem.MoveTo( tempItem.GetPosition() + (VECTOR2I) mapCoords( aSymbol->GetPosition() ) ); } // Copy the pin info from the symbol to the temp pins @@ -1737,7 +1737,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer ) // Draw the umbilical line if( aField->IsMoving() ) { - wxPoint parentPos = aField->GetParentPosition(); + VECTOR2I parentPos = aField->GetParentPosition(); m_gal->SetLineWidth( m_schSettings.m_outlineWidth ); m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) ); @@ -1764,12 +1764,12 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer ) COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows ); - std::vector pts; + std::vector pts; std::deque pts2; - aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() ); + aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() ); - for( const wxPoint& p : pts ) + for( const VECTOR2I& p : pts ) pts2.emplace_back( VECTOR2D( p.x, p.y ) ); // The text is drawn inside the graphic shape. @@ -1838,12 +1838,12 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer ) color = getRenderColor( aLabel, LAYER_BUS, drawingShadows ); } - std::vector pts; + std::vector pts; std::deque pts2; - aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint)aLabel->GetTextPos() ); + aLabel->CreateGraphicShape( &m_schSettings, pts, (VECTOR2I)aLabel->GetTextPos() ); - for( const wxPoint& p : pts ) + for( const VECTOR2I& p : pts ) pts2.emplace_back( VECTOR2D( p.x, p.y ) ); m_gal->SetIsFill( true ); @@ -1886,12 +1886,12 @@ void SCH_PAINTER::draw( const SCH_NETCLASS_FLAG *aLabel, int aLayer ) return; } - std::vector pts; + std::vector pts; std::deque pts2; - aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() ); + aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() ); - for( const wxPoint& p : pts ) + for( const VECTOR2I& p : pts ) pts2.emplace_back( VECTOR2D( p.x, p.y ) ); m_gal->SetIsFill( false ); @@ -2017,7 +2017,7 @@ void SCH_PAINTER::draw( const SCH_NO_CONNECT *aNC, int aLayer ) void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer ) { SCH_LAYER_ID layer = aEntry->Type() == SCH_BUS_WIRE_ENTRY_T ? LAYER_WIRE : LAYER_BUS; - SCH_LINE line( wxPoint(), layer ); + SCH_LINE line( VECTOR2I(), layer ); bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; bool drawingDangling = aLayer == LAYER_DANGLING; diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 9efdc5487a..4ee0d3b9f7 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -302,7 +302,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoC } -wxPoint SCH_PIN::GetTransformedPosition() const +VECTOR2I SCH_PIN::GetTransformedPosition() const { TRANSFORM t = GetParentSymbol()->GetTransform(); return t.TransformCoordinate( GetLocalPosition() ) + GetParentSymbol()->GetPosition(); @@ -323,7 +323,7 @@ const EDA_RECT SCH_PIN::GetBoundingBox() const } -bool SCH_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // When looking for an "exact" hit aAccuracy will be 0 which works poorly if the pin has // no pin number or name. Give it a floor. diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index 544ee0ce63..c347f3f80e 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -69,20 +69,20 @@ public: wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {} + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override {} - void Move( const wxPoint& aMoveVector ) override {} + void Move( const VECTOR2I& aMoveVector ) override {} void MirrorHorizontally( int aCenter ) override {} void MirrorVertically( int aCenter ) override {} - void Rotate( const wxPoint& aCenter ) override {} + void Rotate( const VECTOR2I& aCenter ) override {} - wxPoint GetPosition() const override { return GetTransformedPosition(); } - const wxPoint GetLocalPosition() const { return m_position; } - void SetPosition( const wxPoint& aPosition ) override { m_position = aPosition; } + VECTOR2I GetPosition() const override { return GetTransformedPosition(); } + const VECTOR2I GetLocalPosition() const { return m_position; } + void SetPosition( const VECTOR2I& aPosition ) override { m_position = aPosition; } const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; EDA_ITEM* Clone() const override; @@ -98,13 +98,13 @@ public: void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; } - bool IsPointClickableAnchor( const wxPoint& aPos ) const override + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return m_isDangling && GetPosition() == aPos; } /// @return the pin's position in global coordinates. - wxPoint GetTransformedPosition() const; + VECTOR2I GetTransformedPosition() const; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; @@ -151,7 +151,7 @@ private: wxString m_number; wxString m_alt; - wxPoint m_position; + VECTOR2I m_position; bool m_isDangling; /// The name that this pin connection will drive onto a net. diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index 9ce7f4ed9b..6c39689f36 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -600,7 +600,7 @@ ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map& aProps, in underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false ); } -wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ) +VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ) { // From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet switch( aSheetSize ) diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.h b/eeschema/sch_plugins/altium/altium_parser_sch.h index 5b1e48019a..b450ffa91f 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.h +++ b/eeschema/sch_plugins/altium/altium_parser_sch.h @@ -30,6 +30,8 @@ #include #include +#include + #include #include @@ -128,9 +130,9 @@ struct ASCH_SYMBOL wxString sourcelibraryname; wxString componentdescription; - int orientation; - bool isMirrored; - wxPoint location; + int orientation; + bool isMirrored; + VECTOR2I location; int partcount; int displaymodecount; @@ -223,10 +225,10 @@ struct ASCH_PIN ASCH_PIN_ELECTRICAL electrical; ASCH_RECORD_ORIENTATION orientation; - wxPoint location; - int pinlength; + VECTOR2I location; + int pinlength; - wxPoint kicadLocation; // location of pin in KiCad without rounding error + VECTOR2I kicadLocation; // location of pin in KiCad without rounding error bool showPinName; bool showDesignator; @@ -264,7 +266,7 @@ struct ASCH_LABEL int ownerindex; int ownerpartid; - wxPoint location; + VECTOR2I location; wxString text; @@ -280,8 +282,8 @@ struct ASCH_LABEL struct ASCH_TEXT_FRAME { - wxPoint location; - wxSize size; + VECTOR2I location; + wxSize size; wxString text; @@ -311,7 +313,7 @@ struct ASCH_BEZIER int ownerpartid; int ownerpartdisplaymode; - std::vector points; + std::vector points; int lineWidth; @@ -334,7 +336,7 @@ struct ASCH_POLYLINE int ownerpartid; int ownerpartdisplaymode; - std::vector points; + std::vector points; int lineWidth; @@ -346,7 +348,7 @@ struct ASCH_POLYLINE struct ASCH_POLYGON : ASCH_SHAPE_INTERFACE { - std::vector points; + std::vector points; explicit ASCH_POLYGON( const std::map& aProps ); }; @@ -354,8 +356,8 @@ struct ASCH_POLYGON : ASCH_SHAPE_INTERFACE struct ASCH_ROUND_RECTANGLE : ASCH_SHAPE_INTERFACE { - wxPoint bottomLeft; - wxPoint topRight; + VECTOR2I bottomLeft; + VECTOR2I topRight; wxSize cornerradius; @@ -371,10 +373,10 @@ struct ASCH_ARC int ownerpartid; int ownerpartdisplaymode; - wxPoint center; - int radius; - double startAngle; - double endAngle; + VECTOR2I center; + int radius; + double startAngle; + double endAngle; int lineWidth; @@ -388,8 +390,8 @@ struct ASCH_LINE int ownerpartid; int ownerpartdisplaymode; - wxPoint point1; - wxPoint point2; + VECTOR2I point1; + VECTOR2I point2; int lineWidth; @@ -399,8 +401,8 @@ struct ASCH_LINE struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE { - wxPoint bottomLeft; - wxPoint topRight; + VECTOR2I bottomLeft; + VECTOR2I topRight; bool isTransparent; @@ -410,7 +412,7 @@ struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE struct ASCH_SHEET_SYMBOL { - wxPoint location; + VECTOR2I location; wxSize size; bool isSolid; @@ -495,7 +497,7 @@ struct ASCH_POWER_PORT wxString text; bool showNetName; - wxPoint location; + VECTOR2I location; ASCH_RECORD_ORIENTATION orientation; ASCH_POWER_PORT_STYLE style; @@ -510,9 +512,9 @@ struct ASCH_PORT wxString name; wxString harnessType; - wxPoint location; - int width; - int height; + VECTOR2I location; + int width; + int height; ASCH_PORT_IOTYPE iotype; ASCH_PORT_STYLE style; @@ -523,7 +525,7 @@ struct ASCH_PORT struct ASCH_NO_ERC { - wxPoint location; + VECTOR2I location; bool isActive; bool supressAll; @@ -536,7 +538,7 @@ struct ASCH_NET_LABEL { wxString text; - wxPoint location; + VECTOR2I location; ASCH_RECORD_ORIENTATION orientation; @@ -549,7 +551,7 @@ struct ASCH_BUS int indexinsheet; int lineWidth; - std::vector points; + std::vector points; explicit ASCH_BUS( const std::map& aProps ); }; @@ -560,7 +562,7 @@ struct ASCH_WIRE int indexinsheet; int lineWidth; - std::vector points; + std::vector points; explicit ASCH_WIRE( const std::map& aProps ); }; @@ -570,7 +572,7 @@ struct ASCH_JUNCTION { int ownerpartid; - wxPoint location; + VECTOR2I location; explicit ASCH_JUNCTION( const std::map& aProps ); }; @@ -582,8 +584,8 @@ struct ASCH_IMAGE int ownerpartid; wxString filename; - wxPoint location; - wxPoint corner; + VECTOR2I location; + VECTOR2I corner; bool embedimage; bool keepaspect; @@ -631,7 +633,7 @@ enum class ASCH_SHEET_SIZE ORCAD_E = 17 // 4280 × 3280 }; -wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ); +VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ); enum class ASCH_SHEET_WORKSPACEORIENTATION @@ -660,7 +662,7 @@ struct ASCH_SHEET_NAME wxString text; ASCH_RECORD_ORIENTATION orientation; - wxPoint location; + VECTOR2I location; bool isHidden; @@ -676,7 +678,7 @@ struct ASCH_FILE_NAME wxString text; ASCH_RECORD_ORIENTATION orientation; - wxPoint location; + VECTOR2I location; bool isHidden; @@ -694,7 +696,7 @@ struct ASCH_DESIGNATOR ASCH_RECORD_ORIENTATION orientation; ASCH_LABEL_JUSTIFICATION justification; - wxPoint location; + VECTOR2I location; explicit ASCH_DESIGNATOR( const std::map& aProps ); }; @@ -723,8 +725,8 @@ struct ASCH_IMPLEMENTATION_LIST struct ASCH_BUS_ENTRY { - wxPoint location; - wxPoint corner; + VECTOR2I location; + VECTOR2I corner; explicit ASCH_BUS_ENTRY( const std::map& aProps ); }; @@ -735,7 +737,7 @@ struct ASCH_PARAMETER int ownerindex; int ownerpartid; - wxPoint location; + VECTOR2I location; ASCH_LABEL_JUSTIFICATION justification; ASCH_RECORD_ORIENTATION orientation; diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index e2c38cec64..392921178b 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -61,7 +61,7 @@ #include #include -static const wxPoint GetRelativePosition( const wxPoint& aPosition, const SCH_SYMBOL* aSymbol ) +static const VECTOR2I GetRelativePosition( const VECTOR2I& aPosition, const SCH_SYMBOL* aSymbol ) { TRANSFORM t = aSymbol->GetTransform().InverseTransform(); return t.TransformCoordinate( aPosition - aSymbol->GetPosition() ); @@ -675,7 +675,7 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map& aPropertie if( !elem.showPinName ) pin->SetNameTextSize( 0 ); - wxPoint pinLocation = elem.location; // the location given is not the connection point! + VECTOR2I pinLocation = elem.location; // the location given is not the connection point! switch( elem.orientation ) { @@ -1049,8 +1049,8 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map& aProper else { // simulate Bezier using line segments - std::vector bezierPoints; - std::vector polyPoints; + std::vector bezierPoints; + std::vector polyPoints; for( size_t j = i; j < elem.points.size() && j < i + 4; j++ ) bezierPoints.push_back( elem.points.at( j ) ); @@ -1137,7 +1137,8 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map& aProper for( size_t j = i; j < elem.points.size() && j < i + 4; j++ ) { - wxPoint pos = GetRelativePosition( elem.points.at( j ) + m_sheetOffset, symbol ); + VECTOR2I pos = + GetRelativePosition( elem.points.at( j ) + m_sheetOffset, symbol ); switch( j - i ) { @@ -1164,7 +1165,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map& aProp { SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES ); - for( wxPoint& point : elem.points ) + for( VECTOR2I& point : elem.points ) poly->AddPoint( point + m_sheetOffset ); poly->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) ); @@ -1194,7 +1195,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map& aProp line->SetUnit( elem.ownerpartid ); - for( wxPoint& point : elem.points ) + for( VECTOR2I& point : elem.points ) line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) ); line->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) ); @@ -1210,7 +1211,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map& aPrope { SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES ); - for( wxPoint& point : elem.points ) + for( VECTOR2I& point : elem.points ) poly->AddPoint( point + m_sheetOffset ); poly->AddPoint( elem.points.front() + m_sheetOffset ); @@ -1241,7 +1242,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map& aPrope line->SetUnit( elem.ownerpartid ); - for( wxPoint& point : elem.points ) + for( VECTOR2I& point : elem.points ) line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) ); line->AddPoint( GetRelativePosition( elem.points.front() + m_sheetOffset, symbol ) ); @@ -1254,13 +1255,13 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map& { ASCH_ROUND_RECTANGLE elem( aProperties ); - wxPoint sheetTopRight = elem.topRight + m_sheetOffset; - wxPoint sheetBottomLeft = elem.bottomLeft + m_sheetOffset; + VECTOR2I sheetTopRight = elem.topRight + m_sheetOffset; + VECTOR2I sheetBottomLeft = elem.bottomLeft + m_sheetOffset; if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) { - const wxPoint topLeft = { sheetBottomLeft.x, sheetTopRight.y }; - const wxPoint bottomRight = { sheetTopRight.x, sheetBottomLeft.y }; + const VECTOR2I topLeft = { sheetBottomLeft.x, sheetTopRight.y }; + const VECTOR2I bottomRight = { sheetTopRight.x, sheetBottomLeft.y }; // TODO: misses rounded edges SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES ); @@ -1313,7 +1314,7 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aPropertie SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, SCH_LAYER_ID::LAYER_NOTES ); circle->SetPosition( elem.center + m_sheetOffset ); - circle->SetEnd( circle->GetPosition() + wxPoint( elem.radius, 0 ) ); + circle->SetEnd( circle->GetPosition() + VECTOR2I( elem.radius, 0 ) ); circle->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) ); m_currentSheet->GetScreen()->Append( circle ); @@ -1325,8 +1326,8 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aPropertie double includedAngle = elem.endAngle - elem.startAngle; double startAngle = DEG2RAD( elem.endAngle ); - wxPoint startOffset = wxPoint( KiROUND( std::cos( startAngle ) * elem.radius ), - -KiROUND( std::sin( startAngle ) * elem.radius ) ); + VECTOR2I startOffset = VECTOR2I( KiROUND( std::cos( startAngle ) * elem.radius ), + -KiROUND( std::sin( startAngle ) * elem.radius ) ); arc->SetCenter( elem.center + m_sheetOffset ); arc->SetStart( elem.center + startOffset + m_sheetOffset ); @@ -1363,7 +1364,7 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aPropertie circle->SetUnit( elem.ownerpartid ); circle->SetPosition( GetRelativePosition( elem.center + m_sheetOffset, symbol ) ); - circle->SetEnd( circle->GetPosition() + wxPoint( elem.radius, 0 ) ); + circle->SetEnd( circle->GetPosition() + VECTOR2I( elem.radius, 0 ) ); circle->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) ); } else @@ -1374,12 +1375,12 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map& aPropertie arc->SetCenter( GetRelativePosition( elem.center + m_sheetOffset, symbol ) ); - wxPoint arcStart( elem.radius, 0 ); + VECTOR2I arcStart( elem.radius, 0 ); RotatePoint( &arcStart.x, &arcStart.y, -elem.startAngle * 10.0 ); arcStart += arc->GetCenter(); arc->SetStart( arcStart ); - wxPoint arcEnd( elem.radius, 0 ); + VECTOR2I arcEnd( elem.radius, 0 ); RotatePoint( &arcEnd.x, &arcEnd.y, -elem.endAngle * 10.0 ); arcEnd += arc->GetCenter(); arc->SetEnd( arcEnd ); @@ -1438,13 +1439,13 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map& aPro { ASCH_RECTANGLE elem( aProperties ); - wxPoint sheetTopRight = elem.topRight + m_sheetOffset; - wxPoint sheetBottomLeft = elem.bottomLeft + m_sheetOffset; + VECTOR2I sheetTopRight = elem.topRight + m_sheetOffset; + VECTOR2I sheetBottomLeft = elem.bottomLeft + m_sheetOffset; if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) { - const wxPoint topLeft = { sheetBottomLeft.x, sheetTopRight.y }; - const wxPoint bottomRight = { sheetTopRight.x, sheetBottomLeft.y }; + const VECTOR2I topLeft = { sheetBottomLeft.x, sheetTopRight.y }; + const VECTOR2I bottomRight = { sheetTopRight.x, sheetBottomLeft.y }; SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES ); @@ -1537,7 +1538,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map& aPr //sheetPin->SetLabelSpinStyle( getSpinStyle( term.OrientAngle, false ) ); //sheetPin->SetPosition( getKiCadPoint( term.Position ) ); - wxPoint pos = sheetIt->second->GetPosition(); + VECTOR2I pos = sheetIt->second->GetPosition(); wxSize size = sheetIt->second->GetSize(); switch( elem.side ) @@ -1584,7 +1585,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map& aPr } -wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_STYLE aStyle, +VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_STYLE aStyle, REPORTER* aReporter ) { if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW ) @@ -1601,7 +1602,7 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_S aKsymbol->AddDrawItem( circle ); circle->SetStroke( STROKE_PARAMS( Mils2iu( 5 ), PLOT_DASH_TYPE::SOLID ) ); circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -75 ) } ); - circle->SetEnd( circle->GetPosition() + wxPoint( Mils2iu( 25 ), 0 ) ); + circle->SetEnd( circle->GetPosition() + VECTOR2I( Mils2iu( 25 ), 0 ) ); } else { @@ -1745,7 +1746,7 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_S aKsymbol->AddDrawItem( circle ); circle->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) ); circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -160 ) } ); - circle->SetEnd( circle->GetPosition() + wxPoint( Mils2iu( 120 ), 0 ) ); + circle->SetEnd( circle->GetPosition() + VECTOR2I( Mils2iu( 120 ), 0 ) ); return { 0, Mils2iu( 350 ) }; } @@ -1827,7 +1828,8 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map& aPro pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN ); pin->SetVisible( false ); - wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( libSymbol, elem.style, m_reporter ); + VECTOR2I valueFieldPos = + HelperGeneratePowerPortGraphics( libSymbol, elem.style, m_reporter ); libSymbol->GetValueField().SetPosition( valueFieldPos ); @@ -1888,8 +1890,8 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map& aPro void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem ) { bool isHarness = !aElem.harnessType.IsEmpty(); - wxPoint start = aElem.location + m_sheetOffset; - wxPoint end = start; + VECTOR2I start = aElem.location + m_sheetOffset; + VECTOR2I end = start; switch( aElem.style ) { @@ -1931,7 +1933,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem ) } // Select label position. In case both match, we will add a line later. - wxPoint position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end; + VECTOR2I position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end; SCH_TEXT* label; if( isHarness ) @@ -2108,7 +2110,7 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map& aPropert { ASCH_IMAGE elem( aProperties ); - wxPoint center = ( elem.location + elem.corner ) / 2 + m_sheetOffset; + VECTOR2I center = ( elem.location + elem.corner ) / 2 + m_sheetOffset; std::unique_ptr bitmap = std::make_unique( center ); if( elem.embedimage ) @@ -2161,7 +2163,7 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map& aPropert // we only support one scale, thus we need to select one in case it does not keep aspect ratio wxSize currentImageSize = bitmap->GetSize(); - wxPoint expectedImageSize = elem.location - elem.corner; + VECTOR2I expectedImageSize = elem.location - elem.corner; double scaleX = std::abs( static_cast( expectedImageSize.x ) / currentImageSize.x ); double scaleY = std::abs( static_cast( expectedImageSize.y ) / currentImageSize.y ); bitmap->SetImageScale( std::min( scaleX, scaleY ) ); @@ -2299,7 +2301,7 @@ void SCH_ALTIUM_PLUGIN::ParseBusEntry( const std::map& aProp SCH_BUS_WIRE_ENTRY* busWireEntry = new SCH_BUS_WIRE_ENTRY( elem.location + m_sheetOffset ); - wxPoint vector = elem.corner - elem.location; + VECTOR2I vector = elem.corner - elem.location; busWireEntry->SetSize( { vector.x, vector.y } ); busWireEntry->SetFlags( IS_NEW ); @@ -2376,7 +2378,7 @@ void SCH_ALTIUM_PLUGIN::ParseParameter( const std::map& aPro if( fieldName == "VALUE" ) fieldName = "ALTIUM_VALUE"; - field = symbol->AddField( SCH_FIELD( wxPoint(), fieldIdx, symbol, fieldName ) ); + field = symbol->AddField( SCH_FIELD( VECTOR2I(), fieldIdx, symbol, fieldName ) ); } wxString kicadText = AltiumSpecialStringsToKiCadVariables( elem.text, variableMap ); diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.h b/eeschema/sch_plugins/altium/sch_altium_plugin.h index 2bdcd64606..d33d2823b9 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.h +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.h @@ -157,7 +157,7 @@ private: std::unique_ptr m_currentTitleBlock; // Will be assigned at the end of parsing // a sheet - wxPoint m_sheetOffset; + VECTOR2I m_sheetOffset; std::unique_ptr m_altiumSheet; std::map m_symbols; std::map m_sheets; diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 78de7ba737..f077d302e4 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -62,11 +62,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh LONGPOINT designLimit = Assignments.Settings.DesignLimit; - //Note: can't use getKiCadPoint() due wxPoint being int - need long long to make the check + //Note: can't use getKiCadPoint() due VECTOR2I being int - need long long to make the check long long designSizeXkicad = (long long) designLimit.x / KiCadUnitDivider; long long designSizeYkicad = (long long) designLimit.y / KiCadUnitDivider; - // Max size limited by the positive dimension of wxPoint (which is an int) + // Max size limited by the positive dimension of VECTOR2I (which is an int) constexpr long long maxDesignSizekicad = std::numeric_limits::max(); if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad ) @@ -248,7 +248,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh for( SCH_ITEM* item : allItems ) { - item->Move( (wxPoint)translation ); + item->Move( translation ); item->ClearFlags(); sheet->GetScreen()->Update( item ); } @@ -276,8 +276,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets() for( LAYER_ID sheetID : orphanSheets ) { - wxPoint pos( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); - wxSize siz( Mils2iu( 1000 ), Mils2iu( 1000 ) ); + VECTOR2I pos( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); + wxSize siz( Mils2iu( 1000 ), Mils2iu( 1000 ) ); loadSheetAndChildSheets( sheetID, pos, siz, rootPath ); @@ -495,8 +495,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances() if( !partField ) { int fieldID = symbol->GetFieldCount(); - partField = symbol->AddField( SCH_FIELD( wxPoint(), fieldID, symbol, - PartNameFieldName ) ); + partField = symbol->AddField( + SCH_FIELD( VECTOR2I(), fieldID, symbol, PartNameFieldName ) ); } wxASSERT( partField->GetName() == PartNameFieldName ); @@ -525,8 +525,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances() if( !attrField ) { int fieldID = symbol->GetFieldCount(); - attrField = symbol->AddField( SCH_FIELD( wxPoint(), fieldID, - symbol, attrName ) ); + attrField = symbol->AddField( + SCH_FIELD( VECTOR2I(), fieldID, symbol, attrName ) ); } wxASSERT( attrField->GetName() == attrName ); @@ -607,7 +607,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances() TEXT_LOCATION txtLoc = symbolDef.TextLocations.at( SIGNALNAME_ORIGIN_ATTRID ); - wxPoint valPos = getKiCadLibraryPoint( txtLoc.Position, symbolDef.Origin ); + VECTOR2I valPos = getKiCadLibraryPoint( txtLoc.Position, symbolDef.Origin ); kiPart->GetValueField().SetPosition( valPos ); kiPart->GetValueField().SetVisible( true ); @@ -641,16 +641,16 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances() { // There should only be one pin and we'll use that to set the position TERMINAL& symbolTerminal = libSymDef.Terminals.begin()->second; - wxPoint terminalPosOffset = symbolTerminal.Position - libSymDef.Origin; + VECTOR2I terminalPosOffset = symbolTerminal.Position - libSymDef.Origin; double rotateDeciDegree = getAngleTenthDegree( sym.OrientAngle ); if( sym.Mirror ) rotateDeciDegree += 1800.0; - RotatePoint( &terminalPosOffset, -rotateDeciDegree ); + RotatePoint( terminalPosOffset, -rotateDeciDegree ); SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL; - netLabel->SetPosition( getKiCadPoint( sym.Origin + terminalPosOffset ) ); + netLabel->SetPosition( getKiCadPoint( (VECTOR2I)sym.Origin + terminalPosOffset ) ); netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist netLabel->SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) ); @@ -781,7 +781,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadBusses() { //lets find the closest point in the busline to the label VECTOR2I busLabelLoc = getKiCadPoint( bus.BusLabel.Position ); - wxPoint nearestPt = (wxPoint) busLineChain.NearestPoint( busLabelLoc ); + VECTOR2I nearestPt = busLineChain.NearestPoint( busLabelLoc ); label->SetPosition( nearestPt ); @@ -910,7 +910,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( getKiCadPoint( busTerm.FirstPoint ), false ); - wxPoint size = + VECTOR2I size = getKiCadPoint( busTerm.SecondPoint ) - getKiCadPoint( busTerm.FirstPoint ); busEntry->SetSize( wxSize( size.x, size.y ) ); @@ -984,7 +984,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() bool firstPt = true; bool secondPt = false; - wxPoint last; + VECTOR2I last; SCH_LINE* wire = nullptr; SHAPE_LINE_CHAIN wireChain; // Create a temp. line chain representing the connection @@ -1014,7 +1014,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() { SCH_SHEET* parentSheet = static_cast( sheetPin->GetParent() ); wxSize sheetSize = parentSheet->GetSize(); - wxPoint sheetPosition = parentSheet->GetPosition(); + VECTOR2I sheetPosition = parentSheet->GetPosition(); int leftSide = sheetPosition.x; int rightSide = sheetPosition.x + sheetSize.x; @@ -1057,7 +1057,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() else wireChain.Replace( intsctIndx + 1, /*end index*/ -1, intsctPt ); - sheetPin->SetPosition( (wxPoint) intsctPt ); + sheetPin->SetPosition( intsctPt ); } } } @@ -1082,7 +1082,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() { if( firstPt ) { - last = (wxPoint) pt; + last = pt; firstPt = false; secondPt = true; continue; @@ -1093,8 +1093,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() secondPt = false; - wxPoint kiLast = last; - wxPoint kiCurrent = (wxPoint) pt; + VECTOR2I kiLast = last; + VECTOR2I kiCurrent = pt; double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent ); fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.StartNode ); } @@ -1102,13 +1102,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() wire = new SCH_LINE(); wire->SetStartPoint( last ); - wire->SetEndPoint( (wxPoint) pt ); + wire->SetEndPoint( pt ); wire->SetLayer( LAYER_WIRE ); if( !conn.ConnectionLineCode.IsEmpty() ) wire->SetLineWidth( getLineThickness( conn.ConnectionLineCode ) ); - last = (wxPoint) pt; + last = pt; m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire ); } @@ -1116,8 +1116,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets() //Fix labels on the end wire if( wire ) { - wxPoint kiLast = wire->GetEndPoint(); - wxPoint kiCurrent = wire->GetStartPoint(); + VECTOR2I kiLast = wire->GetEndPoint(); + VECTOR2I kiCurrent = wire->GetStartPoint(); double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent ); fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.EndNode ); } @@ -1194,11 +1194,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols() } SYMDEF_SCM docSymDef = Library.SymbolDefinitions.at( docSym.SymdefID ); - wxPoint moveVector = getKiCadPoint( docSym.Origin ) - getKiCadPoint( docSymDef.Origin ); + VECTOR2I moveVector = getKiCadPoint( docSym.Origin ) - getKiCadPoint( docSymDef.Origin ); double rotationAngle = getAngleTenthDegree( docSym.OrientAngle ); double scalingFactor = (double) docSym.ScaleRatioNumerator / (double) docSym.ScaleRatioDenominator; - wxPoint centreOfTransform = getKiCadPoint( docSymDef.Origin ); + VECTOR2I centreOfTransform = getKiCadPoint( docSymDef.Origin ); bool mirrorInvert = docSym.Mirror; for( std::pair figPair : docSymDef.Figures ) @@ -1218,8 +1218,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols() SCH_TEXT* kiTxt = getKiCadSchText( txt ); - wxPoint newPosition = applyTransform( kiTxt->GetPosition(), moveVector, rotationAngle, - scalingFactor, centreOfTransform, mirrorInvert ); + VECTOR2I newPosition = applyTransform( kiTxt->GetPosition(), moveVector, rotationAngle, + scalingFactor, centreOfTransform, mirrorInvert ); int newTxtWidth = KiROUND( kiTxt->GetTextWidth() * scalingFactor ); int newTxtHeight = KiROUND( kiTxt->GetTextHeight() * scalingFactor ); @@ -1997,11 +1997,12 @@ wxString CADSTAR_SCH_ARCHIVE_LOADER::getNetName( const NET_SCH& aNet ) } -void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStartPoint, - const wxPoint& aEndPoint, const LINECODE_ID& aCadstarLineCodeID, - const LAYER_ID& aCadstarSheetID, const SCH_LAYER_ID& aKiCadSchLayerID, - const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, - const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) +void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( + const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint, + const LINECODE_ID& aCadstarLineCodeID, const LAYER_ID& aCadstarSheetID, + const SCH_LAYER_ID& aKiCadSchLayerID, const VECTOR2I& aMoveVector, + const double& aRotationAngleDeciDeg, const double& aScalingFactor, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { SCH_LINE* segment = new SCH_LINE(); @@ -2010,9 +2011,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStar segment->SetLineStyle( getLineStyle( aCadstarLineCodeID ) ); //Apply transforms - wxPoint startPoint = applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg, + VECTOR2I startPoint = applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg, aScalingFactor, aTransformCentre, aMirrorInvert ); - wxPoint endPoint = applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg, + VECTOR2I endPoint = applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg, aScalingFactor, aTransformCentre, aMirrorInvert ); segment->SetStartPoint( startPoint ); @@ -2022,10 +2023,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStar } -void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector& aCadstarVertices, - LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, - const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, - const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) +void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( + const std::vector& aCadstarVertices, LINECODE_ID aCadstarLineCodeID, + LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector, + const double& aRotationAngleDeciDeg, const double& aScalingFactor, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { const VERTEX* prev = &aCadstarVertices.at( 0 ); const VERTEX* cur; @@ -2037,9 +2039,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector& a { cur = &aCadstarVertices.at( ii ); - wxPoint startPoint = getKiCadPoint( prev->End ); - wxPoint endPoint = getKiCadPoint( cur->End ); - wxPoint centerPoint = getKiCadPoint( cur->Center ); + VECTOR2I startPoint = getKiCadPoint( prev->End ); + VECTOR2I endPoint = getKiCadPoint( cur->End ); + VECTOR2I centerPoint = getKiCadPoint( cur->Center ); bool cw = false; if( cur->Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE @@ -2075,8 +2077,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector& a for( int jj = 0; jj < arcSegments.SegmentCount(); jj++ ) { - wxPoint segStart = (wxPoint) arcSegments.Segment( jj ).A; - wxPoint segEnd = (wxPoint) arcSegments.Segment( jj ).B; + VECTOR2I segStart = (wxPoint) arcSegments.Segment( jj ).A; + VECTOR2I segEnd = (wxPoint) arcSegments.Segment( jj ).B; loadGraphicStaightSegment( segStart, segEnd, aCadstarLineCodeID, aCadstarSheetID, aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, @@ -2101,10 +2103,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector& a } -void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure, - const LAYER_ID& aCadstarSheetIDOverride, SCH_LAYER_ID aKiCadSchLayerID, - const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, - const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) +void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( + const FIGURE& aCadstarFigure, const LAYER_ID& aCadstarSheetIDOverride, + SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector, + const double& aRotationAngleDeciDeg, const double& aScalingFactor, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { loadShapeVertices( aCadstarFigure.Shape.Vertices, aCadstarFigure.LineCodeID, aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, @@ -2119,9 +2122,10 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure, } -void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( - LAYER_ID aCadstarSheetID, const wxPoint& aPosition, wxSize aSheetSize, - const SCH_SHEET_PATH& aParentSheet ) +void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, + const VECTOR2I& aPosition, + VECTOR2I aSheetSize, + const SCH_SHEET_PATH& aParentSheet ) { wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), , "Sheet already loaded!" ); @@ -2130,7 +2134,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SHEET_PATH instance( aParentSheet ); - sheet->SetSize( aSheetSize ); + sheet->SetSize( (wxSize) aSheetSize ); sheet->SetScreen( screen ); wxString name = Sheets.SheetNames.at( aCadstarSheetID ); @@ -2199,7 +2203,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets( LAYER_ID aCadstarSheetID, // In KiCad you can only draw rectangular shapes whereas in Cadstar arbitrary shapes // are allowed. We will calculate the extents of the Cadstar shape and draw a rectangle - std::pair blockExtents; + std::pair blockExtents; if( block.Figures.size() > 0 ) { @@ -2802,9 +2806,9 @@ LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_SYMBOL* aSym }; auto scalePt = - [&]( wxPoint aCoord ) -> wxPoint + [&]( VECTOR2I aCoord ) -> VECTOR2I { - return wxPoint( scaleLen( aCoord.x ), scaleLen( aCoord.y ) ); + return VECTOR2I( scaleLen( aCoord.x ), scaleLen( aCoord.y ) ); }; auto scaleSize = @@ -2947,11 +2951,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int } -std::pair +std::pair CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure ) { - wxPoint upperLeft( Assignments.Settings.DesignLimit.x, 0 ); - wxPoint lowerRight( 0, Assignments.Settings.DesignLimit.y ); + VECTOR2I upperLeft( Assignments.Settings.DesignLimit.x, 0 ); + VECTOR2I lowerRight( 0, Assignments.Settings.DesignLimit.y ); for( const VERTEX& v : aCadstarFigure.Shape.Vertices ) { @@ -2986,18 +2990,18 @@ CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure } } - wxPoint upperLeftKiCad = getKiCadPoint( upperLeft ); - wxPoint lowerRightKiCad = getKiCadPoint( lowerRight ); + VECTOR2I upperLeftKiCad = getKiCadPoint( upperLeft ); + VECTOR2I lowerRightKiCad = getKiCadPoint( lowerRight ); - wxPoint size = lowerRightKiCad - upperLeftKiCad; + VECTOR2I size = lowerRightKiCad - upperLeftKiCad; return { upperLeftKiCad, wxSize( abs( size.x ), abs( size.y ) ) }; } -wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint ) +VECTOR2I CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( const VECTOR2I& aCadstarPoint ) { - wxPoint retval; + VECTOR2I retval; retval.x = getKiCadLength( aCadstarPoint.x - m_designCenter.x ); retval.y = -getKiCadLength( aCadstarPoint.y - m_designCenter.y ); @@ -3018,11 +3022,11 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( const wxPoint& aCadsta } -wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint, - const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, - const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) +VECTOR2I CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( + const VECTOR2I& aPoint, const VECTOR2I& aMoveVector, const double& aRotationAngleDeciDeg, + const double& aScalingFactor, const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { - wxPoint retVal = aPoint; + VECTOR2I retVal = aPoint; if( aScalingFactor != 1.0 ) { @@ -3040,7 +3044,7 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint, if( aRotationAngleDeciDeg != 0.0 ) { - RotatePoint( &retVal, aTransformCentre, aRotationAngleDeciDeg ); + RotatePoint( retVal, aTransformCentre, aRotationAngleDeciDeg ); } if( aMoveVector != wxPoint{ 0, 0 } ) @@ -3052,13 +3056,13 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint, } -double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( const wxPoint& aPoint ) +double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( const VECTOR2I& aPoint ) { return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) ); } -double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( const wxPoint& aPoint ) +double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( const VECTOR2I& aPoint ) { return sqrt( ( (double) aPoint.x * (double) aPoint.x ) + ( (double) aPoint.y * (double) aPoint.y ) ); diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h index 8355bdf96b..3123e8b583 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.h @@ -126,8 +126,8 @@ private: void loadTextVariables(); //Helper Functions for loading sheets - void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const wxPoint& aPosition, - wxSize aSheetSize, const SCH_SHEET_PATH& aParentSheet ); + void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const VECTOR2I& aPosition, + VECTOR2I aSheetSize, const SCH_SHEET_PATH& aParentSheet ); void loadChildSheets( LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet ); @@ -164,22 +164,26 @@ private: wxString getNetName( const NET_SCH& aNet ); //Helper functions for loading figures / graphical items - void loadGraphicStaightSegment( const wxPoint& aStartPoint, const wxPoint& aEndPoint, + void loadGraphicStaightSegment( + const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint, const LINECODE_ID& aCadstarLineCodeID, const LAYER_ID& aCadstarSheetID, - const SCH_LAYER_ID& aKiCadSchLayerID, const wxPoint& aMoveVector = { 0, 0 }, + const SCH_LAYER_ID& aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); void loadShapeVertices( const std::vector& aCadstarVertices, - LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, - const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngleDeciDeg = 0.0, - const double& aScalingFactor = 1.0, const wxPoint& aTransformCentre = { 0, 0 }, - const bool& aMirrorInvert = false ); + LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, + SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 }, + const double& aRotationAngleDeciDeg = 0.0, + const double& aScalingFactor = 1.0, + const VECTOR2I& aTransformCentre = { 0, 0 }, + const bool& aMirrorInvert = false ); void loadFigure( const FIGURE& aCadstarFigure, const LAYER_ID& aCadstarSheetIDOverride, - SCH_LAYER_ID aKiCadSchLayerID, const wxPoint& aMoveVector = { 0, 0 }, - const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); + SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 }, + const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, + const VECTOR2I& aTransformCentre = { 0, 0 }, + const bool& aMirrorInvert = false ); //Helper functions for loading text elements void applyTextSettings( EDA_TEXT* aKiCadTextItem, @@ -223,15 +227,17 @@ private: void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber ); - std::pair getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); + std::pair getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); - wxPoint getKiCadPoint( const wxPoint& aCadstarPoint ); + VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint ); wxPoint getKiCadLibraryPoint( const wxPoint& aCadstarPoint, const wxPoint& aCadstarCentre ); - wxPoint applyTransform( const wxPoint& aPoint, const wxPoint& aMoveVector = { 0, 0 }, - const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); + VECTOR2I applyTransform( const VECTOR2I& aPoint, const VECTOR2I& aMoveVector = { 0, 0 }, + const double& aRotationAngleDeciDeg = 0.0, + const double& aScalingFactor = 1.0, + const VECTOR2I& aTransformCentre = { 0, 0 }, + const bool& aMirrorInvert = false ); int getKiCadLength( long long aCadstarLength ) { @@ -288,14 +294,14 @@ private: * @param aPoint * @return Angle in decidegrees of the polar representation of the point, scaled 0..360 */ - double getPolarAngle( const wxPoint& aPoint ); + double getPolarAngle( const VECTOR2I& aPoint ); /** * @brief * @param aPoint * @return Radius of polar representation of the point */ - double getPolarRadius( const wxPoint& aPoint ); + double getPolarRadius( const VECTOR2I& aPoint ); }; // CADSTAR_SCH_ARCHIVE_LOADER diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index b667ccff3b..ed35a4e21b 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -698,7 +698,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) while( sheetNode ) { - wxPoint pos = wxPoint( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); + VECTOR2I pos = VECTOR2I( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); std::unique_ptr sheet = std::make_unique( m_rootSheet, pos ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); @@ -750,7 +750,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) // placement for the new symbols wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU(); EDA_RECT sheetBbox = getSheetBbox( m_rootSheet ); - wxPoint newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() ); + VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() ); int maxY = sheetBbox.GetY(); SCH_SHEET_PATH sheetpath; @@ -778,12 +778,12 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) // Calculate the placement position EDA_RECT cmpBbox = symbol->GetBoundingBox(); int posY = newCmpPosition.y + cmpBbox.GetHeight(); - symbol->SetPosition( wxPoint( newCmpPosition.x, posY ) ); + symbol->SetPosition( VECTOR2I( newCmpPosition.x, posY ) ); newCmpPosition.x += cmpBbox.GetWidth(); maxY = std::max( maxY, posY ); if( newCmpPosition.x >= pageSizeIU.GetWidth() ) // reached the page boundary? - newCmpPosition = wxPoint( sheetBbox.GetLeft(), maxY ); // then start a new row + newCmpPosition = VECTOR2I( sheetBbox.GetLeft(), maxY ); // then start a new row // Add the global net labels to recreate the implicit connections addImplicitConnections( symbol.get(), m_rootSheet->GetScreen(), false ); @@ -972,7 +972,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex ) for( SCH_ITEM* item : allItems ) { - item->SetPosition( item->GetPosition() + (wxPoint)translation ); + item->SetPosition( item->GetPosition() + translation ); item->ClearFlags(); m_currentSheet->GetScreen()->Update( item ); @@ -984,10 +984,10 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& { EFRAME eframe( aFrameNode ); - wxPoint corner1( eframe.x1.ToSchUnits(), -eframe.y1.ToSchUnits() ); - wxPoint corner3( eframe.x2.ToSchUnits(), -eframe.y2.ToSchUnits() ); - wxPoint corner2( corner3.x, corner1.y ); - wxPoint corner4( corner1.x, corner3.y ); + VECTOR2I corner1( eframe.x1.ToSchUnits(), -eframe.y1.ToSchUnits() ); + VECTOR2I corner3( eframe.x2.ToSchUnits(), -eframe.y2.ToSchUnits() ); + VECTOR2I corner2( corner3.x, corner1.y ); + VECTOR2I corner4( corner1.x, corner3.y ); SCH_LINE* line = new SCH_LINE(); line->SetLineStyle( PLOT_DASH_TYPE::SOLID ); @@ -1156,7 +1156,7 @@ SCH_LINE* SCH_EAGLE_PLUGIN::loadWire( wxXmlNode* aWireNode ) wire->SetLayer( kiCadLayer( ewire.layer ) ); - wxPoint begin, end; + VECTOR2I begin, end; begin.x = ewire.x1.ToSchUnits(); begin.y = -ewire.y1.ToSchUnits(); @@ -1178,7 +1178,7 @@ SCH_JUNCTION* SCH_EAGLE_PLUGIN::loadJunction( wxXmlNode* aJunction ) std::unique_ptr junction = std::make_unique(); EJUNCTION ejunction = EJUNCTION( aJunction ); - wxPoint pos( ejunction.x.ToSchUnits(), -ejunction.y.ToSchUnits() ); + VECTOR2I pos( ejunction.x.ToSchUnits(), -ejunction.y.ToSchUnits() ); junction->SetPosition( pos ); @@ -1189,7 +1189,7 @@ SCH_JUNCTION* SCH_EAGLE_PLUGIN::loadJunction( wxXmlNode* aJunction ) SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aNetName ) { ELABEL elabel = ELABEL( aLabelNode, aNetName ); - wxPoint elabelpos( elabel.x.ToSchUnits(), -elabel.y.ToSchUnits() ); + VECTOR2I elabelpos( elabel.x.ToSchUnits(), -elabel.y.ToSchUnits() ); // Determine if the label is local or global depending on // the number of sheets the net appears in @@ -1223,7 +1223,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN std::pair -SCH_EAGLE_PLUGIN::findNearestLinePoint( const wxPoint& aPoint, +SCH_EAGLE_PLUGIN::findNearestLinePoint( const VECTOR2I& aPoint, const std::vector& aLines ) const { VECTOR2I nearestPoint; @@ -1324,7 +1324,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) std::unique_ptr symbol = std::make_unique(); symbol->SetLibId( libId ); symbol->SetUnit( unit ); - symbol->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) ); + symbol->SetPosition( VECTOR2I( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) ); symbol->GetField( FOOTPRINT_FIELD )->SetText( package ); if( einstance.rot ) @@ -1422,7 +1422,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) if( field ) { - field->SetPosition( wxPoint( attr.x->ToSchUnits(), -attr.y->ToSchUnits() ) ); + field->SetPosition( VECTOR2I( attr.x->ToSchUnits(), -attr.y->ToSchUnits() ) ); int align = attr.align ? *attr.align : ETEXT::BOTTOM_LEFT; int absdegrees = attr.rot ? attr.rot->degrees : 0; bool mirror = attr.rot ? attr.rot->mirror : false; @@ -1751,10 +1751,10 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolCircle( std::unique_ptr& aSym // Parse the circle properties ECIRCLE c( aCircleNode ); LIB_SHAPE* circle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::CIRCLE ); - wxPoint center( c.x.ToSchUnits(), c.y.ToSchUnits() ); + VECTOR2I center( c.x.ToSchUnits(), c.y.ToSchUnits() ); circle->SetPosition( center ); - circle->SetEnd( wxPoint( center.x + c.radius.ToSchUnits(), center.y ) ); + circle->SetEnd( VECTOR2I( center.x + c.radius.ToSchUnits(), center.y ) ); circle->SetStroke( STROKE_PARAMS( c.width.ToSchUnits(), PLOT_DASH_TYPE::SOLID ) ); circle->SetUnit( aGateNumber ); @@ -1768,8 +1768,8 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( std::unique_ptr& a ERECT rect( aRectNode ); LIB_SHAPE* rectangle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::RECT ); - rectangle->SetPosition( wxPoint( rect.x1.ToSchUnits(), rect.y1.ToSchUnits() ) ); - rectangle->SetEnd( wxPoint( rect.x2.ToSchUnits(), rect.y2.ToSchUnits() ) ); + rectangle->SetPosition( VECTOR2I( rect.x1.ToSchUnits(), rect.y1.ToSchUnits() ) ); + rectangle->SetEnd( VECTOR2I( rect.x2.ToSchUnits(), rect.y2.ToSchUnits() ) ); rectangle->SetUnit( aGateNumber ); @@ -1785,7 +1785,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr& aSymbol { EWIRE ewire = EWIRE( aWireNode ); - wxPoint begin, end; + VECTOR2I begin, end; begin.x = ewire.x1.ToSchUnits(); begin.y = ewire.y1.ToSchUnits(); @@ -1799,7 +1799,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr& aSymbol if( ewire.curve ) { LIB_SHAPE* arc = new LIB_SHAPE( aSymbol.get(), SHAPE_T::ARC ); - wxPoint center = ConvertArcCenter( begin, end, *ewire.curve * -1 ); + VECTOR2I center = ConvertArcCenter( begin, end, *ewire.curve * -1 ); double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) ) + ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) ) * 2; @@ -1807,8 +1807,8 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr& aSymbol // this emulates the filled semicircles created by a thick arc with flat ends caps. if( ewire.width.ToSchUnits() * 2 > radius ) { - wxPoint centerStartVector = begin - center; - wxPoint centerEndVector = end - center; + VECTOR2I centerStartVector = begin - center; + VECTOR2I centerEndVector = end - center; centerStartVector.x = centerStartVector.x * ewire.width.ToSchUnits() * 2 / radius; centerStartVector.y = centerStartVector.y * ewire.width.ToSchUnits() * 2 / radius; @@ -1831,7 +1831,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr& aSymbol arc->SetStroke( STROKE_PARAMS( ewire.width.ToSchUnits(), PLOT_DASH_TYPE::SOLID ) ); } - arc->SetArcGeometry( begin, (wxPoint) CalcArcMid( begin, end, center ), end ); + arc->SetArcGeometry( begin, CalcArcMid( begin, end, center ), end ); arc->SetUnit( aGateNumber ); return arc; @@ -1856,14 +1856,14 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr& aS LIB_SHAPE* poly = new LIB_SHAPE( aSymbol.get(), SHAPE_T::POLY ); EPOLYGON epoly( aPolygonNode ); wxXmlNode* vertex = aPolygonNode->GetChildren(); - wxPoint pt; + VECTOR2I pt; while( vertex ) { if( vertex->GetName() == "vertex" ) // skip node { EVERTEX evertex( vertex ); - pt = wxPoint( evertex.x.ToSchUnits(), evertex.y.ToSchUnits() ); + pt = VECTOR2I( evertex.x.ToSchUnits(), evertex.y.ToSchUnits() ); poly->AddPoint( pt ); } @@ -1881,7 +1881,7 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr& aSymbol, wxXmlN EPIN* aEPin, int aGateNumber ) { std::unique_ptr pin = std::make_unique( aSymbol.get() ); - pin->SetPosition( wxPoint( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) ); + pin->SetPosition( VECTOR2I( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) ); pin->SetName( aEPin->name ); pin->SetUnit( aGateNumber ); @@ -1961,7 +1961,7 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText( std::unique_ptr& aSymbol ETEXT etext( aLibText ); libtext->SetUnit( aGateNumber ); - libtext->SetPosition( wxPoint( etext.x.ToSchUnits(), etext.y.ToSchUnits() ) ); + libtext->SetPosition( VECTOR2I( etext.x.ToSchUnits(), etext.y.ToSchUnits() ) ); // Eagle supports multiple line text in library symbols. Legacy library symbol text cannot // contain CRs or LFs. @@ -1995,18 +1995,18 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& std::swap( yMin, yMax ); LIB_SHAPE* lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( xMin, yMin ) ); - lines->AddPoint( wxPoint( xMax, yMin ) ); - lines->AddPoint( wxPoint( xMax, yMax ) ); - lines->AddPoint( wxPoint( xMin, yMax ) ); - lines->AddPoint( wxPoint( xMin, yMin ) ); + lines->AddPoint( VECTOR2I( xMin, yMin ) ); + lines->AddPoint( VECTOR2I( xMax, yMin ) ); + lines->AddPoint( VECTOR2I( xMax, yMax ) ); + lines->AddPoint( VECTOR2I( xMin, yMax ) ); + lines->AddPoint( VECTOR2I( xMin, yMin ) ); aItems.push_back( lines ); if( !eframe.border_left ) { lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); - lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); aItems.push_back( lines ); int i; @@ -2021,8 +2021,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& { int newY = KiROUND( yMin + ( rowSpacing * (double) i ) ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( x1, newY ) ); - lines->AddPoint( wxPoint( x2, newY ) ); + lines->AddPoint( VECTOR2I( x1, newY ) ); + lines->AddPoint( VECTOR2I( x2, newY ) ); aItems.push_back( lines ); } @@ -2031,7 +2031,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& for( i = 0; i < eframe.rows; i++ ) { LIB_TEXT* legendText = new LIB_TEXT( nullptr ); - legendText->SetPosition( wxPoint( legendPosX, KiROUND( legendPosY ) ) ); + legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetText( wxString( legendChar ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); aItems.push_back( legendText ); @@ -2043,8 +2043,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& if( !eframe.border_right ) { lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); - lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); aItems.push_back( lines ); int i; @@ -2059,8 +2059,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& { int newY = KiROUND( yMin + ( rowSpacing * (double) i ) ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( x1, newY ) ); - lines->AddPoint( wxPoint( x2, newY ) ); + lines->AddPoint( VECTOR2I( x1, newY ) ); + lines->AddPoint( VECTOR2I( x2, newY ) ); aItems.push_back( lines ); } @@ -2069,7 +2069,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& for( i = 0; i < eframe.rows; i++ ) { LIB_TEXT* legendText = new LIB_TEXT( nullptr ); - legendText->SetPosition( wxPoint( legendPosX, KiROUND( legendPosY ) ) ); + legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetText( wxString( legendChar ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); aItems.push_back( legendText ); @@ -2081,8 +2081,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& if( !eframe.border_top ) { lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); - lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); aItems.push_back( lines ); int i; @@ -2097,8 +2097,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& { int newX = KiROUND( xMin + ( columnSpacing * (double) i ) ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( newX, y1 ) ); - lines->AddPoint( wxPoint( newX, y2 ) ); + lines->AddPoint( VECTOR2I( newX, y1 ) ); + lines->AddPoint( VECTOR2I( newX, y2 ) ); aItems.push_back( lines ); } @@ -2107,7 +2107,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& for( i = 0; i < eframe.columns; i++ ) { LIB_TEXT* legendText = new LIB_TEXT( nullptr ); - legendText->SetPosition( wxPoint( KiROUND( legendPosX ), legendPosY ) ); + legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) ); legendText->SetText( wxString( legendChar ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); aItems.push_back( legendText ); @@ -2119,8 +2119,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& if( !eframe.border_bottom ) { lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); - lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); + lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); aItems.push_back( lines ); int i; @@ -2135,8 +2135,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& { int newX = KiROUND( xMin + ( columnSpacing * (double) i ) ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); - lines->AddPoint( wxPoint( newX, y1 ) ); - lines->AddPoint( wxPoint( newX, y2 ) ); + lines->AddPoint( VECTOR2I( newX, y1 ) ); + lines->AddPoint( VECTOR2I( newX, y2 ) ); aItems.push_back( lines ); } @@ -2145,7 +2145,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector& for( i = 0; i < eframe.columns; i++ ) { LIB_TEXT* legendText = new LIB_TEXT( nullptr ); - legendText->SetPosition( wxPoint( KiROUND( legendPosX ), legendPosY ) ); + legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) ); legendText->SetText( wxString( legendChar ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); aItems.push_back( legendText ); @@ -2180,7 +2180,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadPlainText( wxXmlNode* aSchText ) } schtext->SetText( adjustedText.IsEmpty() ? "\" \"" : escapeName( adjustedText ) ); - schtext->SetPosition( wxPoint( etext.x.ToSchUnits(), -etext.y.ToSchUnits() ) ); + schtext->SetPosition( VECTOR2I( etext.x.ToSchUnits(), -etext.y.ToSchUnits() ) ); loadTextAttributes( schtext.get(), etext ); schtext->SetItalic( false ); @@ -2275,12 +2275,12 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels() // Move along the attached wire to find the new label position if( trial % 2 == 1 ) { - labelPos = wxPoint( origPos + wireDirection * trial / 2 ); + labelPos = VECTOR2I( origPos + wireDirection * trial / 2 ); move = checkPositive = segAttached->Contains( labelPos ); } else { - labelPos = wxPoint( origPos - wireDirection * trial / 2 ); + labelPos = VECTOR2I( origPos - wireDirection * trial / 2 ); move = checkNegative = segAttached->Contains( labelPos ); } @@ -2288,7 +2288,7 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels() } if( move ) - label->SetPosition( wxPoint( labelPos ) ); + label->SetPosition( VECTOR2I( labelPos ) ); } } @@ -2316,7 +2316,7 @@ bool SCH_EAGLE_PLUGIN::CheckHeader( const wxString& aFileName ) } -void SCH_EAGLE_PLUGIN::moveLabels( SCH_LINE* aWire, const wxPoint& aNewEndPoint ) +void SCH_EAGLE_PLUGIN::moveLabels( SCH_LINE* aWire, const VECTOR2I& aNewEndPoint ) { static KICAD_T labelTypes[] = { SCH_LABEL_LOCATE_ANY_T, EOT }; SCH_SCREEN* screen = m_currentSheet->GetScreen(); @@ -2355,23 +2355,23 @@ void SCH_EAGLE_PLUGIN::addBusEntries() for( SCH_LINE* wire : wires ) { - wxPoint wireStart = wire->GetStartPoint(); - wxPoint wireEnd = wire->GetEndPoint(); + VECTOR2I wireStart = wire->GetStartPoint(); + VECTOR2I wireEnd = wire->GetEndPoint(); for( SCH_LINE* bus : buses ) { - wxPoint busStart = bus->GetStartPoint(); - wxPoint busEnd = bus->GetEndPoint(); + VECTOR2I busStart = bus->GetStartPoint(); + VECTOR2I busEnd = bus->GetEndPoint(); auto entrySize = - []( int signX, int signY ) -> wxPoint + []( int signX, int signY ) -> VECTOR2I { - return wxPoint( Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signX, + return VECTOR2I( Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signX, Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signY ); }; auto testBusHit = - [&]( const wxPoint& aPt ) -> bool + [&]( const VECTOR2I& aPt ) -> bool { return TestSegmentHit( aPt, busStart, busEnd, 0 ); }; @@ -2391,7 +2391,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * ——————⎥⎢ * ⎥⎢ */ - wxPoint p = wireStart + entrySize( -1, 0 ); + VECTOR2I p = wireStart + entrySize( -1, 0 ); if( testBusHit( wireStart + entrySize( 0, -1 ) ) ) { @@ -2433,7 +2433,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * ⎥⎢—————— * ⎥⎢ */ - wxPoint p = wireStart + entrySize( 1, 0 ); + VECTOR2I p = wireStart + entrySize( 1, 0 ); if( testBusHit( wireStart + entrySize( 0, -1 ) ) ) { @@ -2482,7 +2482,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * ——————⎥⎢ * ⎥⎢ */ - wxPoint p = wireEnd + entrySize( -1, 0 ); + VECTOR2I p = wireEnd + entrySize( -1, 0 ); if( testBusHit( wireEnd + entrySize( 0, -1 ) ) ) { @@ -2524,7 +2524,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * ⎥⎢—————— * ⎥⎢ */ - wxPoint p = wireEnd + entrySize( 1, 0 ); + VECTOR2I p = wireEnd + entrySize( 1, 0 ); if( testBusHit( wireEnd + entrySize( 0, -1 ) ) ) { @@ -2579,7 +2579,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * | * ======= */ - wxPoint p = wireStart + entrySize( 0, -1 ); + VECTOR2I p = wireStart + entrySize( 0, -1 ); if( testBusHit( wireStart + entrySize( -1, 0 ) ) ) { @@ -2624,7 +2624,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * | * | */ - wxPoint p = wireStart + entrySize( 0, 1 ); + VECTOR2I p = wireStart + entrySize( 0, 1 ); if( testBusHit( wireStart + entrySize( -1, 0 ) ) ) { @@ -2676,7 +2676,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * | * ======= */ - wxPoint p = wireEnd + entrySize( 0, -1 ); + VECTOR2I p = wireEnd + entrySize( 0, -1 ); if( testBusHit( wireEnd + entrySize( -1, 0 ) ) ) { @@ -2721,7 +2721,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() * | * | */ - wxPoint p = wireEnd + entrySize( 0, 1 ); + VECTOR2I p = wireEnd + entrySize( 0, 1 ); if( testBusHit( wireEnd + entrySize( -1, 0 ) ) ) { @@ -2768,13 +2768,13 @@ void SCH_EAGLE_PLUGIN::addBusEntries() if( testBusHit( wireStart ) ) { - wxPoint wirevector = wireStart - wireEnd; + VECTOR2I wirevector = wireStart - wireEnd; if( wirevector.x > 0 ) { if( wirevector.y > 0 ) { - wxPoint p = wireStart + entrySize( -1, -1 ); + VECTOR2I p = wireStart + entrySize( -1, -1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 2 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2784,7 +2784,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else { - wxPoint p = wireStart + entrySize( -1, 1 ); + VECTOR2I p = wireStart + entrySize( -1, 1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 1 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2797,7 +2797,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() { if( wirevector.y > 0 ) { - wxPoint p = wireStart + entrySize( 1, -1 ); + VECTOR2I p = wireStart + entrySize( 1, -1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 3 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2807,7 +2807,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else { - wxPoint p = wireStart + entrySize( 1, 1 ); + VECTOR2I p = wireStart + entrySize( 1, 1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 4 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2821,13 +2821,13 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else if( testBusHit( wireEnd ) ) { - wxPoint wirevector = wireStart - wireEnd; + VECTOR2I wirevector = wireStart - wireEnd; if( wirevector.x > 0 ) { if( wirevector.y > 0 ) { - wxPoint p = wireEnd + entrySize( 1, 1 ); + VECTOR2I p = wireEnd + entrySize( 1, 1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 4 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2837,7 +2837,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else { - wxPoint p = wireEnd + entrySize( 1, -1 ); + VECTOR2I p = wireEnd + entrySize( 1, -1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 3 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2850,7 +2850,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() { if( wirevector.y > 0 ) { - wxPoint p = wireEnd + entrySize( -1, 1 ); + VECTOR2I p = wireEnd + entrySize( -1, 1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 1 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2860,7 +2860,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else { - wxPoint p = wireEnd + entrySize( -1, -1 ); + VECTOR2I p = wireEnd + entrySize( -1, -1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 2 ); busEntry->SetFlags( IS_NEW ); m_currentSheet->GetScreen()->Append( busEntry ); @@ -2896,8 +2896,8 @@ const SEG* SCH_EAGLE_PLUGIN::SEG_DESC::LabelAttached( const SCH_TEXT* aLabel ) c // (see SCH_EDIT_FRAME::importFile()) bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const { - wxPoint pinPosition = aSymbol->GetPinPhysicalPosition( aPin ); - auto pointIt = m_connPoints.find( pinPosition ); + VECTOR2I pinPosition = aSymbol->GetPinPhysicalPosition( aPin ); + auto pointIt = m_connPoints.find( pinPosition ); if( pointIt == m_connPoints.end() ) return false; diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h index ec586ed06d..26fba87aef 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h @@ -116,7 +116,7 @@ private: void countNets( wxXmlNode* aSchematicNode ); /// Move any labels on the wire to the new end point of the wire. - void moveLabels( SCH_LINE* aWire, const wxPoint& aNewEndPoint ); + void moveLabels( SCH_LINE* aWire, const VECTOR2I& aNewEndPoint ); /// This function finds best way to place a bus entry symbol for when an Eagle wire segment /// ends on an Eagle bus segment. @@ -125,7 +125,7 @@ private: /// Return the matching layer or return LAYER_NOTES SCH_LAYER_ID kiCadLayer( int aEagleLayer ); - std::pair findNearestLinePoint( const wxPoint& aPoint, + std::pair findNearestLinePoint( const VECTOR2I& aPoint, const std::vector& aLines ) const; void loadSegments( wxXmlNode* aSegmentsNode, const wxString& aNetName, @@ -258,7 +258,7 @@ private: std::map m_nets; ///< Positions of pins and wire endings mapped to its parent - std::map> m_connPoints; + std::map> m_connPoints; }; #endif // _SCH_EAGLE_PLUGIN_H_ diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 0c191df478..9ac94a4eae 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -985,7 +985,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc() */ if( !TRANSFORM().MapAngles( &startAngle, &endAngle ) ) { - wxPoint temp = arc->GetStart(); + VECTOR2I temp = arc->GetStart(); arc->SetStart( arc->GetEnd() ); arc->SetEnd( temp ); } @@ -2928,7 +2928,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchArc() */ if( !TRANSFORM().MapAngles( &startAngle, &endAngle ) ) { - wxPoint temp = arc->GetStart(); + VECTOR2I temp = arc->GetStart(); arc->SetStart( arc->GetEnd() ); arc->SetEnd( temp ); } diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 27423443d8..7ed158a6d4 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -329,8 +329,8 @@ static void formatBezier( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE { aFormatter->Print( aNestLevel, "(bezier (pts " ); - for( const wxPoint& pt : { aBezier->GetStart(), aBezier->GetBezierC1(), - aBezier->GetBezierC2(), aBezier->GetEnd() } ) + for( const VECTOR2I& pt : { aBezier->GetStart(), aBezier->GetBezierC1(), + aBezier->GetBezierC2(), aBezier->GetEnd() } ) { aFormatter->Print( 0, " (xy %s %s)", FormatInternalUnits( pt.x ).c_str(), diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 4f39d2818b..b52c232e3b 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -3271,7 +3271,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr& aSymbo LIB_SHAPE* arc = new LIB_SHAPE( aSymbol.get(), SHAPE_T::ARC ); - wxPoint center; + VECTOR2I center; center.x = Mils2Iu( parseInt( aReader, line, &line ) ); center.y = Mils2Iu( parseInt( aReader, line, &line ) ); @@ -3298,7 +3298,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr& aSymbo // Actual Coordinates of arc ends are read from file if( *line != 0 ) { - wxPoint arcStart, arcEnd; + VECTOR2I arcStart, arcEnd; arcStart.x = Mils2Iu( parseInt( aReader, line, &line ) ); arcStart.y = Mils2Iu( parseInt( aReader, line, &line ) ); @@ -3312,8 +3312,8 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr& aSymbo { // Actual Coordinates of arc ends are not read from file // (old library), calculate them - wxPoint arcStart( radius, 0 ); - wxPoint arcEnd( radius, 0 ); + VECTOR2I arcStart( radius, 0 ); + VECTOR2I arcEnd( radius, 0 ); RotatePoint( &arcStart.x, &arcStart.y, -angle1 ); arcStart += arc->GetCenter(); @@ -3332,7 +3332,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr& aSymbo */ if( !TRANSFORM().MapAngles( &angle1, &angle2 ) ) { - wxPoint temp = arc->GetStart(); + VECTOR2I temp = arc->GetStart(); arc->SetStart( arc->GetEnd() ); arc->SetEnd( temp ); } @@ -4026,7 +4026,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveBezier( LIB_SHAPE* aBezier, OUTPUTFORMATTER& a aBezier->GetConvert(), Iu2Mils( aBezier->GetWidth() ) ); - for( const wxPoint& pt : aBezier->GetBezierPoints() ) + for( const VECTOR2I& pt : aBezier->GetBezierPoints() ) aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) ); aFormatter.Print( 0, " %c\n", fill_tab[ static_cast( aBezier->GetFillMode() ) - 1 ] ); diff --git a/eeschema/sch_reference_list.h b/eeschema/sch_reference_list.h index 407743a172..873fa737a8 100644 --- a/eeschema/sch_reference_list.h +++ b/eeschema/sch_reference_list.h @@ -171,7 +171,7 @@ private: UTF8 m_ref; // it's private, use the accessors please SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object. LIB_SYMBOL* m_libPart; ///< The source symbol from a library. - wxPoint m_symbolPos; ///< The physical position of the symbol in schematic + VECTOR2I m_symbolPos; ///< The physical position of the symbol in schematic ///< used to annotate by X or Y position int m_unit; ///< The unit number for symbol with multiple parts ///< per package. diff --git a/eeschema/sch_rtree.h b/eeschema/sch_rtree.h index e4a6313057..ccfdc60e80 100644 --- a/eeschema/sch_rtree.h +++ b/eeschema/sch_rtree.h @@ -237,14 +237,14 @@ public: return EE_TYPE( m_tree, SCH_LOCATE_ANY_T, aRect ); } - EE_TYPE Overlapping( const wxPoint& aPoint, int aAccuracy = 0 ) const + EE_TYPE Overlapping( const VECTOR2I& aPoint, int aAccuracy = 0 ) const { EDA_RECT rect( aPoint, wxSize( 0, 0 ) ); rect.Inflate( aAccuracy ); return EE_TYPE( m_tree, SCH_LOCATE_ANY_T, rect ); } - EE_TYPE Overlapping( KICAD_T aType, const wxPoint& aPoint, int aAccuracy = 0 ) const + EE_TYPE Overlapping( KICAD_T aType, const VECTOR2I& aPoint, int aAccuracy = 0 ) const { EDA_RECT rect( aPoint, wxSize( 0, 0 ) ); rect.Inflate( aAccuracy ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 4ea4289414..c42b35eefe 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -339,7 +339,7 @@ bool SCH_SCREEN::CheckIfOnDrawList( const SCH_ITEM* aItem ) const } -SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T aType ) const +SCH_ITEM* SCH_SCREEN::GetItem( const VECTOR2I& aPosition, int aAccuracy, KICAD_T aType ) const { EDA_RECT bbox; bbox.SetOrigin( aPosition ); @@ -400,7 +400,7 @@ std::set SCH_SCREEN::MarkConnections( SCH_LINE* aSegment ) } -bool SCH_SCREEN::IsJunction( const wxPoint& aPosition ) const +bool SCH_SCREEN::IsJunction( const VECTOR2I& aPosition ) const { bool hasExplicitJunction; bool hasBusEntry; @@ -410,7 +410,7 @@ bool SCH_SCREEN::IsJunction( const wxPoint& aPosition ) const } -bool SCH_SCREEN::IsExplicitJunction( const wxPoint& aPosition ) const +bool SCH_SCREEN::IsExplicitJunction( const VECTOR2I& aPosition ) const { bool hasExplicitJunction; bool hasBusEntry; @@ -420,7 +420,7 @@ bool SCH_SCREEN::IsExplicitJunction( const wxPoint& aPosition ) const } -bool SCH_SCREEN::IsExplicitJunctionNeeded( const wxPoint& aPosition ) const +bool SCH_SCREEN::IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const { bool hasExplicitJunction; bool hasBusEntry; @@ -430,7 +430,7 @@ bool SCH_SCREEN::IsExplicitJunctionNeeded( const wxPoint& aPosition ) const } -bool SCH_SCREEN::IsExplicitJunctionAllowed( const wxPoint& aPosition ) const +bool SCH_SCREEN::IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const { bool hasExplicitJunction; bool hasBusEntry; @@ -441,7 +441,7 @@ bool SCH_SCREEN::IsExplicitJunctionAllowed( const wxPoint& aPosition ) const -bool SCH_SCREEN::doIsJunction( const wxPoint& aPosition, bool aBreakCrossings, +bool SCH_SCREEN::doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings, bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const { enum layers { WIRES = 0, BUSES }; @@ -542,7 +542,7 @@ bool SCH_SCREEN::doIsJunction( const wxPoint& aPosition, bool aBreakCrossings, } -bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const +bool SCH_SCREEN::IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const { wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false, wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) ); @@ -825,13 +825,13 @@ void SCH_SCREEN::Print( const RENDER_SETTINGS* aSettings ) } ); for( SCH_ITEM* item : bitmaps ) - item->Print( aSettings, wxPoint( 0, 0 ) ); + item->Print( aSettings, VECTOR2I( 0, 0 ) ); for( SCH_ITEM* item : other ) - item->Print( aSettings, wxPoint( 0, 0 ) ); + item->Print( aSettings, VECTOR2I( 0, 0 ) ); for( SCH_ITEM* item : junctions ) - item->Print( aSettings, wxPoint( 0, 0 ) ); + item->Print( aSettings, VECTOR2I( 0, 0 ) ); } @@ -897,7 +897,7 @@ void SCH_SCREEN::ClearDrawingState() } -LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol, +LIB_PIN* SCH_SCREEN::GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol, bool aEndPointOnly ) const { SCH_SYMBOL* candidate = nullptr; @@ -949,7 +949,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol, } -SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition ) const +SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const VECTOR2I& aPosition ) const { SCH_SHEET_PIN* sheetPin = nullptr; @@ -967,7 +967,7 @@ SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition ) const } -size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const +size_t SCH_SCREEN::CountConnectedItems( const VECTOR2I& aPos, bool aTestJunctions ) const { size_t count = 0; @@ -1073,7 +1073,7 @@ void SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath, } -SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLayer, +SCH_LINE* SCH_SCREEN::GetLine( const VECTOR2I& aPosition, int aAccuracy, int aLayer, SCH_LINE_TEST_T aSearchType ) const { // an accuracy of 0 had problems with rounding errors; use at least 1 @@ -1110,7 +1110,7 @@ SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLay } -SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy ) const +SCH_TEXT* SCH_SCREEN::GetLabel( const VECTOR2I& aPosition, int aAccuracy ) const { for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) ) { diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h index a34a717685..4c9cb44204 100644 --- a/eeschema/sch_screen.h +++ b/eeschema/sch_screen.h @@ -215,7 +215,7 @@ public: * @param aType The type of item to find. * @return The item found that meets the search criteria or NULL if none found. */ - SCH_ITEM* GetItem( const wxPoint& aPosition, int aAccuracy = 0, + SCH_ITEM* GetItem( const VECTOR2I& aPosition, int aAccuracy = 0, KICAD_T aType = SCH_LOCATE_ANY_T ) const; /** @@ -309,7 +309,7 @@ public: */ void ClearDrawingState(); - size_t CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const; + size_t CountConnectedItems( const VECTOR2I& aPos, bool aTestJunctions ) const; /** * Test if a junction is required for the items at \a aPosition on the screen. Note that @@ -325,25 +325,25 @@ public: * @param[in] aPosition The position to test. * @return True if a junction is required at \a aPosition. */ - bool IsJunction( const wxPoint& aPosition ) const; + bool IsJunction( const VECTOR2I& aPosition ) const; /** * Indicates that a junction dot is necessary at the given location. See IsJunctionNeeded * for more info. */ - bool IsExplicitJunction( const wxPoint& aPosition ) const; + bool IsExplicitJunction( const VECTOR2I& aPosition ) const; /** * Indicates that a junction dot is necessary at the given location, and does not yet exist. * See IsJunctionNeeded for more info. */ - bool IsExplicitJunctionNeeded( const wxPoint& aPosition ) const; + bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const; /** * Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded * for more info. */ - bool IsExplicitJunctionAllowed( const wxPoint& aPosition ) const; + bool IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const; /** * Test if \a aPosition is a connection point on \a aLayer. @@ -353,7 +353,7 @@ public: * #LAYER_BUS, and #LAYER_WIRE. * @return True if \a Position is a connection point on \a aLayer. */ - bool IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const; + bool IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const; /** * Test the screen for a symbol pin item at \a aPosition. @@ -364,7 +364,7 @@ public: * point of the pin. * @return The pin item if found, otherwise NULL. */ - LIB_PIN* GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol = nullptr, + LIB_PIN* GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol = nullptr, bool aEndPointOnly = false ) const; /** @@ -373,7 +373,7 @@ public: * @param[in] aPosition The position to test. * @return The sheet label object if found otherwise NULL. */ - SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition ) const; + SCH_SHEET_PIN* GetSheetPin( const VECTOR2I& aPosition ) const; /** * Clear the annotation for the symbols in \a aSheetPath on the screen. @@ -417,25 +417,19 @@ public: * @return The SCH_LINE* of the wire item found at \a aPosition or NULL if item not * found. */ - SCH_LINE* GetLine( const wxPoint& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES, + SCH_LINE* GetLine( const VECTOR2I& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES, SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const; - SCH_LINE* GetWire( const wxPoint& aPosition, int aAccuracy = 0, + SCH_LINE* GetWire( const VECTOR2I& aPosition, int aAccuracy = 0, SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const { return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType ); } - SCH_LINE* GetBus( const wxPoint& aPosition, int aAccuracy = 0, - SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const - { - return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType ); - } - SCH_LINE* GetBus( const VECTOR2I& aPosition, int aAccuracy = 0, SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const { - return GetLine( (wxPoint)aPosition, aAccuracy, LAYER_BUS, aSearchType ); + return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType ); } /** @@ -446,7 +440,7 @@ public: * @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not * found. */ - SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 ) const; + SCH_TEXT* GetLabel( const VECTOR2I& aPosition, int aAccuracy = 0 ) const; /** * Fetch a list of unique #LIB_SYMBOL object pointers required to properly render each @@ -514,7 +508,7 @@ public: double m_LastZoomLevel; private: - bool doIsJunction( const wxPoint& aPosition, bool aBreakCrossings, + bool doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings, bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const; private: diff --git a/eeschema/sch_shape.cpp b/eeschema/sch_shape.cpp index b2c88ffdc8..0a62aac168 100644 --- a/eeschema/sch_shape.cpp +++ b/eeschema/sch_shape.cpp @@ -53,7 +53,7 @@ void SCH_SHAPE::SetStroke( const STROKE_PARAMS& aStroke ) } -void SCH_SHAPE::Move( const wxPoint& aOffset ) +void SCH_SHAPE::Move( const VECTOR2I& aOffset ) { move( aOffset ); } @@ -71,7 +71,7 @@ void SCH_SHAPE::MirrorVertically( int aCenter ) } -void SCH_SHAPE::Rotate( const wxPoint& aCenter ) +void SCH_SHAPE::Rotate( const VECTOR2I& aCenter ) { rotate( aCenter, 900 ); } @@ -80,7 +80,7 @@ void SCH_SHAPE::Rotate( const wxPoint& aCenter ) void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const { int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() ); - wxPoint center; + VECTOR2I center; int radius = 0; int startAngle = 0; int endAngle = 0; @@ -123,7 +123,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const case SHAPE_T::RECT: { - std::vector pts = GetRectCorners(); + std::vector pts = GetRectCorners(); aPlotter->MoveTo( pts[0] ); aPlotter->LineTo( pts[1] ); @@ -198,26 +198,26 @@ int SCH_SHAPE::GetPenWidth() const } -void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { int penWidth = GetPenWidth(); wxDC* DC = aSettings->GetPrintDC(); - wxPoint pt1 = GetStart(); - wxPoint pt2 = GetEnd(); - wxPoint c; + VECTOR2I pt1 = GetStart(); + VECTOR2I pt2 = GetEnd(); + VECTOR2I c; COLOR4D color; penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); unsigned ptCount = 0; - wxPoint* buffer = nullptr; + VECTOR2I* buffer = nullptr; if( GetShape() == SHAPE_T::POLY ) { SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 ); ptCount = poly.GetPointCount(); - buffer = new wxPoint[ ptCount ]; + buffer = new VECTOR2I[ptCount]; for( unsigned ii = 0; ii < ptCount; ++ii ) buffer[ii] = (wxPoint) poly.CPoint( ii ); @@ -225,7 +225,7 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset else if( GetShape() == SHAPE_T::BEZIER ) { ptCount = m_bezierPoints.size(); - buffer = new wxPoint[ ptCount ]; + buffer = new VECTOR2I[ptCount]; for( size_t ii = 0; ii < ptCount; ++ii ) buffer[ii] = m_bezierPoints[ii]; @@ -392,7 +392,7 @@ void SCH_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const } -void SCH_SHAPE::AddPoint( const wxPoint& aPosition ) +void SCH_SHAPE::AddPoint( const VECTOR2I& aPosition ) { if( GetShape() == SHAPE_T::POLY ) { diff --git a/eeschema/sch_shape.h b/eeschema/sch_shape.h index 222ad2a61d..b4fa8d3a4a 100644 --- a/eeschema/sch_shape.h +++ b/eeschema/sch_shape.h @@ -43,7 +43,7 @@ public: return wxT( "SCH_SHAPE" ); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { return hitTest( aPosition, aAccuracy ); } @@ -71,10 +71,10 @@ public: const EDA_RECT GetBoundingBox() const override { return getBoundingBox(); } - wxPoint GetPosition() const override { return getPosition(); } - void SetPosition( const wxPoint& aPos ) override { setPosition( aPos ); } + VECTOR2I GetPosition() const override { return getPosition(); } + void SetPosition( const VECTOR2I& aPos ) override { setPosition( aPos ); } - wxPoint GetCenter() const { return getCenter(); } + VECTOR2I GetCenter() const { return getCenter(); } void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const; @@ -84,13 +84,13 @@ public: void EndEdit() { endEdit(); } void SetEditState( int aState ) { setEditState( aState ); } - void Move( const wxPoint& aOffset ) override; + void Move( const VECTOR2I& aOffset ) override; void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; - void AddPoint( const wxPoint& aPosition ); + void AddPoint( const VECTOR2I& aPosition ); void Plot( PLOTTER* aPlotter ) const override; @@ -109,10 +109,10 @@ public: #endif private: - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; double getParentOrientation() const override { return 0.0; } - wxPoint getParentPosition() const override { return wxPoint(); } + VECTOR2I getParentPosition() const override { return VECTOR2I(); } }; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 5e379e01d4..9691bc667d 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -84,7 +84,7 @@ const wxString SCH_SHEET::GetDefaultFieldName( int aFieldNdx, bool aTranslated ) } -SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const wxPoint& aPos, wxSize aSize, +SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, wxSize aSize, FIELDS_AUTOPLACED aAutoplaceFields ) : SCH_ITEM( aParent, SCH_SHEET_T ) { @@ -352,7 +352,7 @@ bool SCH_SHEET::HasPin( const wxString& aName ) const } -bool SCH_SHEET::doIsConnected( const wxPoint& aPosition ) const +bool SCH_SHEET::doIsConnected( const VECTOR2I& aPosition ) const { for( SCH_SHEET_PIN* sheetPin : m_pins ) { @@ -525,7 +525,7 @@ void SCH_SHEET::CleanupSheet() } -SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition ) +SCH_SHEET_PIN* SCH_SHEET::GetPin( const VECTOR2I& aPosition ) { for( SCH_SHEET_PIN* pin : m_pins ) { @@ -557,14 +557,14 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) if( IsVerticalOrientation() ) { - m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( -margin, m_size.y ) ); + m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( -margin, m_size.y ) ); m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::VERTICAL ); } else { - m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( 0, -margin ) ); + m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( 0, -margin ) ); m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL ); @@ -575,14 +575,14 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) if( IsVerticalOrientation() ) { - m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( m_size.x + margin, m_size.y ) ); + m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( m_size.x + margin, m_size.y ) ); m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP ); m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::VERTICAL ); } else { - m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( 0, m_size.y + margin ) ); + m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( 0, m_size.y + margin ) ); m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP ); m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL ); @@ -607,7 +607,7 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const { - wxPoint end; + VECTOR2I end; EDA_RECT box( m_pos, m_size ); int lineWidth = GetPenWidth(); int textLength = 0; @@ -637,10 +637,10 @@ const EDA_RECT SCH_SHEET::GetBoundingBox() const } -wxPoint SCH_SHEET::GetRotationCenter() const +VECTOR2I SCH_SHEET::GetRotationCenter() const { EDA_RECT box( m_pos, m_size ); - return (wxPoint)box.GetCenter(); + return box.GetCenter(); } @@ -758,7 +758,7 @@ void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aItemList, } -std::vector SCH_SHEET::GetConnectionPoints() const +std::vector SCH_SHEET::GetConnectionPoints() const { - std::vector retval; + std::vector retval; for( SCH_SHEET_PIN* sheetPin : m_pins ) retval.push_back( sheetPin->GetPosition() ); @@ -994,7 +994,7 @@ BITMAPS SCH_SHEET::GetMenuImage() const } -bool SCH_SHEET::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT rect = GetBodyBoundingBox(); @@ -1020,7 +1020,7 @@ bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) void SCH_SHEET::Plot( PLOTTER* aPlotter ) const { wxString msg; - wxPoint pos; + VECTOR2I pos; auto* settings = dynamic_cast( aPlotter->RenderSettings() ); bool override = settings ? settings->m_OverrideItemColors : false; COLOR4D borderColor = GetBorderColor(); @@ -1056,10 +1056,10 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) const } -void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { wxDC* DC = aSettings->GetPrintDC(); - wxPoint pos = m_pos + aOffset; + VECTOR2I pos = m_pos + aOffset; int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); const auto* settings = dynamic_cast( aSettings ); bool override = settings && settings->m_OverrideItemColors; diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 5078966302..89be486ecc 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -54,7 +54,7 @@ enum SHEET_FIELD_TYPE class SCH_SHEET : public SCH_ITEM { public: - SCH_SHEET( EDA_ITEM* aParent = nullptr, const wxPoint& aPos = wxPoint( 0, 0 ), + SCH_SHEET( EDA_ITEM* aParent = nullptr, const VECTOR2I& aPos = VECTOR2I( 0, 0 ), wxSize aSize = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) ), FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO ); @@ -212,7 +212,7 @@ public: * * @return The sheet pin found at \a aPosition or NULL if no sheet pin is found. */ - SCH_SHEET_PIN* GetPin( const wxPoint& aPosition ); + SCH_SHEET_PIN* GetPin( const VECTOR2I& aPosition ); /** * Checks if the sheet already has a sheet pin named \a aName. @@ -258,7 +258,7 @@ public: int GetPenWidth() const override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; /** * Return a bounding box for the sheet body but not the fields. @@ -272,7 +272,7 @@ public: * filename is longer than the edge it's on. Use this instead, which always returns * the center of the sheet itself. */ - wxPoint GetRotationCenter() const; + VECTOR2I GetRotationCenter() const; void SwapData( SCH_ITEM* aItem ) override; @@ -330,10 +330,10 @@ public: // Geometric transforms (used in block operations): - void Move( const wxPoint& aMoveVector ) override; + void Move( const VECTOR2I& aMoveVector ) override; void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; @@ -363,7 +363,7 @@ public: || ( aItem->Type() == SCH_SYMBOL_T ); } - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; @@ -379,10 +379,10 @@ public: void ViewGetLayers( int aLayers[], int& aCount ) const override; - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPosition ) override; + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPosition ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -465,7 +465,7 @@ protected: void renumberPins(); private: - bool doIsConnected( const wxPoint& aPosition ) const override; + bool doIsConnected( const VECTOR2I& aPosition ) const override; friend class SCH_SHEET_PIN; @@ -475,7 +475,7 @@ private: std::vector m_pins; // The list of sheet connection points. std::vector m_fields; - wxPoint m_pos; // The position of the sheet. + VECTOR2I m_pos; // The position of the sheet. wxSize m_size; // The size of the sheet. int m_borderWidth; KIGFX::COLOR4D m_borderColor; diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 9fbd6dea09..e8b4a522aa 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -73,12 +73,12 @@ public: } // pure virtuals: - void SetPosition( const wxPoint& ) override {} - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {} - void Move( const wxPoint& aMoveVector ) override {} + void SetPosition( const VECTOR2I& ) override {} + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override {} + void Move( const VECTOR2I& aMoveVector ) override {} void MirrorHorizontally( int aCenter ) override {} void MirrorVertically( int aCenter ) override {} - void Rotate( const wxPoint& aCenter ) override {} + void Rotate( const VECTOR2I& aCenter ) override {} #if defined(DEBUG) void Show( int , std::ostream& ) const override {} diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index f340e1b937..4a14c73093 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -38,7 +38,7 @@ #include -SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) : +SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const VECTOR2I& pos, const wxString& text ) : SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ), m_edge( SHEET_SIDE::UNDEFINED ) { @@ -65,7 +65,7 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const } -void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { // The icon selection is handle by the virtual method CreateGraphicShape called by ::Print SCH_HIERLABEL::Print( aSettings, aOffset ); @@ -156,7 +156,7 @@ enum SHEET_SIDE SCH_SHEET_PIN::GetSide() const } -void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos ) +void SCH_SHEET_PIN::ConstrainOnEdge( VECTOR2I Pos ) { SCH_SHEET* sheet = GetParent(); @@ -247,7 +247,7 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter ) } -void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter ) +void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter ) { VECTOR2I pt = GetTextPos(); VECTOR2I delta = pt - aCenter; @@ -300,7 +300,7 @@ void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter ) void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings, - std::vector& aPoints, const wxPoint& aPos ) const + std::vector& aPoints, const VECTOR2I& aPos ) const { /* * These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly @@ -340,7 +340,7 @@ BITMAPS SCH_SHEET_PIN::GetMenuImage() const } -bool SCH_SHEET_PIN::HitTest( const wxPoint& aPoint, int aAccuracy ) const +bool SCH_SHEET_PIN::HitTest( const VECTOR2I& aPoint, int aAccuracy ) const { EDA_RECT rect = GetBoundingBox(); diff --git a/eeschema/sch_sheet_pin.h b/eeschema/sch_sheet_pin.h index 2b260a7b05..1ff426ebf4 100644 --- a/eeschema/sch_sheet_pin.h +++ b/eeschema/sch_sheet_pin.h @@ -65,7 +65,7 @@ enum class SHEET_SIDE class SCH_SHEET_PIN : public SCH_HIERLABEL { public: - SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos = wxPoint( 0, 0 ), + SCH_SHEET_PIN( SCH_SHEET* parent, const VECTOR2I& pos = VECTOR2I( 0, 0 ), const wxString& text = wxEmptyString ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -104,7 +104,7 @@ public: */ bool IsMovableFromAnchorPoint() const override { return true; } - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; /** * Calculate the graphic shape (a polygon) associated to the text. @@ -112,8 +112,8 @@ public: * @param aPoints is a buffer to fill with polygon corners coordinates. * @param aPos is the position of the shape. */ - void CreateGraphicShape( const RENDER_SETTINGS* aSettings, - std::vector & aPoints, const wxPoint& aPos ) const override; + void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, + const VECTOR2I& aPos ) const override; void SwapData( SCH_ITEM* aItem ) override; @@ -141,7 +141,7 @@ public: * Adjust label position to edge based on proximity to vertical or horizontal edge * of the parent sheet. */ - void ConstrainOnEdge( wxPoint Pos ); + void ConstrainOnEdge( VECTOR2I Pos ); /** * Get the parent sheet object of this sheet pin. @@ -157,14 +157,14 @@ public: // Geometric transforms (used in block operations): - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { Offset( aMoveVector ); } void MirrorVertically( int aCenter ) override; void MirrorHorizontally( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override { @@ -186,14 +186,14 @@ public: BITMAPS GetMenuImage() const override; - void SetPosition( const wxPoint& aPosition ) override { ConstrainOnEdge( aPosition ); } + void SetPosition( const VECTOR2I& aPosition ) override { ConstrainOnEdge( aPosition ); } - bool IsPointClickableAnchor( const wxPoint& aPos ) const override + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return m_isDangling && GetPosition() == aPos; } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; EDA_ITEM* Clone() const override; diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 4d63904406..72f6b5904e 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -191,7 +191,7 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) : } -void SCH_SYMBOL::Init( const wxPoint& pos ) +void SCH_SYMBOL::Init( const VECTOR2I& pos ) { m_pos = pos; m_unit = 1; // In multi unit chip - which unit to draw. @@ -381,7 +381,7 @@ int SCH_SYMBOL::GetUnitCount() const } -void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { LIB_SYMBOL_OPTIONS opts; opts.transform = m_transform; @@ -1484,11 +1484,11 @@ void SCH_SYMBOL::MirrorVertically( int aCenter ) } -void SCH_SYMBOL::Rotate( const wxPoint& aCenter ) +void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter ) { - wxPoint prev = m_pos; + VECTOR2I prev = m_pos; - RotatePoint( &m_pos, aCenter, 900 ); + RotatePoint( m_pos, aCenter, 900 ); SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE ); @@ -1537,7 +1537,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector& aItemList, bool previousState = pin->IsDangling(); pin->SetIsDangling( true ); - wxPoint pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos; + VECTOR2I pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos; for( DANGLING_END_ITEM& each_item : aItemList ) { @@ -1577,7 +1577,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector& aItemList, } -wxPoint SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const +VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const { wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ), wxT( "Cannot get physical position of pin." ) ); @@ -1586,9 +1586,9 @@ wxPoint SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const } -std::vector SCH_SYMBOL::GetConnectionPoints() const +std::vector SCH_SYMBOL::GetConnectionPoints() const { - std::vector retval; + std::vector retval; for( const std::unique_ptr& pin : m_pins ) { @@ -1610,12 +1610,12 @@ std::vector SCH_SYMBOL::GetConnectionPoints() const } -LIB_ITEM* SCH_SYMBOL::GetDrawItem( const wxPoint& aPosition, KICAD_T aType ) +LIB_ITEM* SCH_SYMBOL::GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType ) { if( m_part ) { // Calculate the position relative to the symbol. - wxPoint libPosition = aPosition - m_pos; + VECTOR2I libPosition = aPosition - m_pos; return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform ); } @@ -1786,7 +1786,7 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem ) } -bool SCH_SYMBOL::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_SYMBOL::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT bBox = GetBodyBoundingBox(); bBox.Inflate( aAccuracy / 2 ); @@ -1814,9 +1814,9 @@ bool SCH_SYMBOL::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy } -bool SCH_SYMBOL::doIsConnected( const wxPoint& aPosition ) const +bool SCH_SYMBOL::doIsConnected( const VECTOR2I& aPosition ) const { - wxPoint new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos ); + VECTOR2I new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos ); for( const auto& pin : m_pins ) { @@ -1884,7 +1884,7 @@ void SCH_SYMBOL::ClearBrightenedPins() } -bool SCH_SYMBOL::IsPointClickableAnchor( const wxPoint& aPos ) const +bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const { for( const std::unique_ptr& pin : m_pins ) { diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index b00aece106..70b678fdf1 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -476,7 +476,7 @@ public: * @param aOffset is the drawing offset (usually wxPoint(0,0), but can be different when * moving an object) */ - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; void SwapData( SCH_ITEM* aItem ) override; @@ -561,7 +561,7 @@ public: // Geometric transforms (used in block operations): - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { if( aMoveVector == wxPoint( 0, 0 ) ) return; @@ -576,7 +576,7 @@ public: void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; @@ -595,7 +595,7 @@ public: bool UpdateDanglingState( std::vector& aItemList, const SCH_SHEET_PATH* aPath = nullptr ) override; - wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const; + VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const; bool IsConnectable() const override { return true; } @@ -616,7 +616,7 @@ public: */ bool IsInNetlist() const; - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; @@ -627,7 +627,7 @@ public: * @param aType is the type of symbol library object to find or any if set to TYPE_NOT_INIT. * @return is the symbol library object if found otherwise NULL. */ - LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT ); + LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT ); wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -642,10 +642,10 @@ public: bool IsReplaceable() const override { return true; } - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); } + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -666,16 +666,16 @@ public: bool GetIncludeOnBoard() const { return m_onBoard; } void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; } - bool IsPointClickableAnchor( const wxPoint& aPos ) const override; + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override; private: EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const; - bool doIsConnected( const wxPoint& aPosition ) const override; + bool doIsConnected( const VECTOR2I& aPosition ) const override; - void Init( const wxPoint& pos = wxPoint( 0, 0 ) ); + void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) ); - wxPoint m_pos; + VECTOR2I m_pos; LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00. int m_unit; ///< The unit for multiple part per package symbols. int m_convert; ///< The alternate body style for symbols that have more than diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index e85d691c9e..99a9175380 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -212,7 +212,7 @@ LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorY() } -SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : +SCH_TEXT::SCH_TEXT( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) : SCH_ITEM( nullptr, aType ), EDA_TEXT( text ) { @@ -243,9 +243,9 @@ bool SCH_TEXT::IncrementLabel( int aIncrement ) } -wxPoint SCH_TEXT::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const +VECTOR2I SCH_TEXT::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const { - wxPoint text_offset; + VECTOR2I text_offset; // add an offset to x (or y) position to aid readability of text on a wire or line int dist = GetTextOffset( aSettings ) + GetPenWidth(); @@ -281,7 +281,7 @@ void SCH_TEXT::MirrorVertically( int aCenter ) } -void SCH_TEXT::Rotate( const wxPoint& aCenter ) +void SCH_TEXT::Rotate( const VECTOR2I& aCenter ) { VECTOR2I pt = GetTextPos(); RotatePoint( pt, aCenter, 900 ); @@ -404,10 +404,10 @@ int SCH_TEXT::GetPenWidth() const } -void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { COLOR4D color = aSettings->GetLayerColor( m_layer ); - wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings ); + VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings ); EDA_TEXT::Print( aSettings, text_offset, color ); } @@ -509,7 +509,7 @@ BITMAPS SCH_TEXT::GetMenuImage() const } -bool SCH_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT bBox = GetBoundingBox(); bBox.Inflate( aAccuracy ); @@ -539,7 +539,7 @@ void SCH_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const void SCH_TEXT::Plot( PLOTTER* aPlotter ) const { - static std::vector s_poly; + static std::vector s_poly; RENDER_SETTINGS* settings = aPlotter->RenderSettings(); SCH_CONNECTION* connection = Connection(); @@ -550,7 +550,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) const penWidth = std::max( penWidth, settings->GetMinPenWidth() ); aPlotter->SetCurrentLineWidth( penWidth ); - std::vector positions; + std::vector positions; wxArrayString strings_list; wxStringSplit( GetShownText(), strings_list, '\n' ); positions.reserve( strings_list.Count() ); @@ -559,7 +559,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) const for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) { - wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() ); + VECTOR2I textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() ); wxString& txt = strings_list.Item( ii ); aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() ); @@ -611,7 +611,7 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const #endif -SCH_LABEL_BASE::SCH_LABEL_BASE( const wxPoint& aPos, const wxString& aText, KICAD_T aType ) : +SCH_LABEL_BASE::SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType ) : SCH_TEXT( aPos, aText, aType ), m_shape( L_UNSPECIFIED ), m_connectionType( CONNECTION_TYPE::NONE ), @@ -726,7 +726,7 @@ void SCH_LABEL_BASE::SwapData( SCH_ITEM* aItem ) } -void SCH_LABEL_BASE::Rotate( const wxPoint& aCenter ) +void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter ) { VECTOR2I pt = GetTextPos(); RotatePoint( pt, aCenter, 900 ); @@ -805,7 +805,7 @@ void SCH_LABEL_BASE::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) for( SCH_FIELD& field : m_fields ) { - wxPoint offset( 0, 0 ); + VECTOR2I offset( 0, 0 ); switch( GetLabelSpinStyle() ) { @@ -967,14 +967,14 @@ SEARCH_RESULT SCH_LABEL_BASE::Visit( INSPECTOR aInspector, void* testData, void SCH_LABEL_BASE::GetEndPoints( std::vector& aItemList ) { - DANGLING_END_ITEM item( LABEL_END, this, (wxPoint)GetTextPos() ); + DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() ); aItemList.push_back( item ); } -std::vector SCH_LABEL_BASE::GetConnectionPoints() const +std::vector SCH_LABEL_BASE::GetConnectionPoints() const { - return { (wxPoint)GetTextPos() }; + return { GetTextPos() }; } @@ -1011,11 +1011,11 @@ const EDA_RECT SCH_LABEL_BASE::GetBodyBoundingBox() const // build the bounding box of the label only, without taking into account its fields EDA_RECT box; - std::vector pts; + std::vector pts; - CreateGraphicShape( nullptr, pts, (wxPoint)GetTextPos() ); + CreateGraphicShape( nullptr, pts, GetTextPos() ); - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) box.Merge( pt ); box.Inflate( GetEffectiveTextPenWidth() / 2 ); @@ -1040,7 +1040,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBoundingBox() const } -bool SCH_LABEL_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_LABEL_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT bbox = GetBodyBoundingBox(); bbox.Inflate( aAccuracy ); @@ -1230,7 +1230,7 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector s_poly; + static std::vector s_poly; RENDER_SETTINGS* settings = aPlotter->RenderSettings(); SCH_CONNECTION* connection = Connection(); @@ -1246,27 +1246,27 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(), GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() ); - CreateGraphicShape( aPlotter->RenderSettings(), s_poly, (wxPoint)GetTextPos() ); + CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() ); if( s_poly.size() ) aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth ); } -void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) +void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) { - static std::vector s_poly; + static std::vector s_poly; SCH_CONNECTION* connection = Connection(); int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer; wxDC* DC = aSettings->GetPrintDC(); COLOR4D color = aSettings->GetLayerColor( layer ); int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); - wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings ); + VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings ); EDA_TEXT::Print( aSettings, text_offset, color ); - CreateGraphicShape( aSettings, s_poly, (wxPoint)GetTextPos() + aOffset ); + CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset ); if( !s_poly.empty() ) GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color ); @@ -1276,7 +1276,7 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOf } -SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : +SCH_LABEL::SCH_LABEL( const VECTOR2I& pos, const wxString& text ) : SCH_LABEL_BASE( pos, text, SCH_LABEL_T ) { m_layer = LAYER_LOCLABEL; @@ -1325,7 +1325,7 @@ BITMAPS SCH_LABEL::GetMenuImage() const } -SCH_NETCLASS_FLAG::SCH_NETCLASS_FLAG( const wxPoint& pos ) : +SCH_NETCLASS_FLAG::SCH_NETCLASS_FLAG( const VECTOR2I& pos ) : SCH_LABEL_BASE( pos, wxEmptyString, SCH_NETCLASS_FLAG_T ) { m_layer = LAYER_NETCLASS_REFS; @@ -1351,8 +1351,8 @@ SCH_NETCLASS_FLAG::SCH_NETCLASS_FLAG( const SCH_NETCLASS_FLAG& aClassLabel ) : void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, - std::vector& aPoints, - const wxPoint& aPos ) const + std::vector& aPoints, + const VECTOR2I& aPos ) const { int symbolSize = m_symbolSize; @@ -1366,36 +1366,36 @@ void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettin case LABEL_FLAG_SHAPE::F_ROUND: // First 3 points are used for generating shape - aPoints.emplace_back( wxPoint( 0, 0 ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength ) ); + aPoints.emplace_back( VECTOR2I( 0, 0 ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength ) ); // These points are just used to bulk out the bounding box - aPoints.emplace_back( wxPoint( -m_symbolSize, m_pinLength ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength ) ); - aPoints.emplace_back( wxPoint( m_symbolSize, m_pinLength + symbolSize ) ); + aPoints.emplace_back( VECTOR2I( -m_symbolSize, m_pinLength ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength ) ); + aPoints.emplace_back( VECTOR2I( m_symbolSize, m_pinLength + symbolSize ) ); break; case LABEL_FLAG_SHAPE::F_DIAMOND: - aPoints.emplace_back( wxPoint( 0, 0 ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( -2 * m_symbolSize, m_pinLength ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength + symbolSize ) ); - aPoints.emplace_back( wxPoint( 2 * m_symbolSize, m_pinLength ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( 0, 0 ) ); + aPoints.emplace_back( VECTOR2I( 0, 0 ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( -2 * m_symbolSize, m_pinLength ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength + symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 2 * m_symbolSize, m_pinLength ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 0, 0 ) ); break; case LABEL_FLAG_SHAPE::F_RECTANGLE: symbolSize = KiROUND( symbolSize * 0.8 ); - aPoints.emplace_back( wxPoint( 0, 0 ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( -2 * symbolSize, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( -2 * symbolSize, m_pinLength + symbolSize ) ); - aPoints.emplace_back( wxPoint( 2 * symbolSize, m_pinLength + symbolSize ) ); - aPoints.emplace_back( wxPoint( 2 * symbolSize, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); - aPoints.emplace_back( wxPoint( 0, 0 ) ); + aPoints.emplace_back( VECTOR2I( 0, 0 ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( -2 * symbolSize, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( -2 * symbolSize, m_pinLength + symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 2 * symbolSize, m_pinLength + symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 2 * symbolSize, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) ); + aPoints.emplace_back( VECTOR2I( 0, 0 ) ); break; default: @@ -1403,15 +1403,15 @@ void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettin } // Rotate outlines and move corners to real position - for( wxPoint& aPoint : aPoints ) + for( VECTOR2I& aPoint : aPoints ) { switch( GetLabelSpinStyle() ) { default: case LABEL_SPIN_STYLE::LEFT: break; - case LABEL_SPIN_STYLE::UP: RotatePoint( &aPoint, -900 ); break; - case LABEL_SPIN_STYLE::RIGHT: RotatePoint( &aPoint, 1800 ); break; - case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( &aPoint, 900 ); break; + case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -900 ); break; + case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, 1800 ); break; + case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, 900 ); break; } aPoint += aPos; @@ -1431,7 +1431,7 @@ void SCH_NETCLASS_FLAG::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) if( IsItalic() ) margin = KiROUND( margin * 1.5 ); - wxPoint offset; + VECTOR2I offset; for( SCH_FIELD& field : m_fields ) { @@ -1475,7 +1475,7 @@ wxString SCH_NETCLASS_FLAG::GetSelectMenuText( EDA_UNITS aUnits ) const } -SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : +SCH_GLOBALLABEL::SCH_GLOBALLABEL( const VECTOR2I& pos, const wxString& text ) : SCH_LABEL_BASE( pos, text, SCH_GLOBAL_LABEL_T ) { m_layer = LAYER_GLOBLABEL; @@ -1498,7 +1498,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel ) : } -wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const +VECTOR2I SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const { int horiz = GetLabelBoxExpansion( aSettings ); @@ -1522,10 +1522,10 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSetting switch( GetLabelSpinStyle() ) { default: - case LABEL_SPIN_STYLE::LEFT: return wxPoint( -horiz, vert ); - case LABEL_SPIN_STYLE::UP: return wxPoint( vert, -horiz ); - case LABEL_SPIN_STYLE::RIGHT: return wxPoint( horiz, vert ); - case LABEL_SPIN_STYLE::BOTTOM: return wxPoint( vert, horiz ); + case LABEL_SPIN_STYLE::LEFT: return VECTOR2I( -horiz, vert ); + case LABEL_SPIN_STYLE::UP: return VECTOR2I( vert, -horiz ); + case LABEL_SPIN_STYLE::RIGHT: return VECTOR2I( horiz, vert ); + case LABEL_SPIN_STYLE::BOTTOM: return VECTOR2I( vert, horiz ); } } @@ -1581,7 +1581,7 @@ void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter ) VECTOR2I delta = old_pos - pos; pos.x = GetPosition().x + delta.x; - field.SetPosition( (wxPoint)pos ); + field.SetPosition( pos ); } } @@ -1597,7 +1597,7 @@ void SCH_GLOBALLABEL::MirrorVertically( int aCenter ) VECTOR2I delta = old_pos - pos; pos.y = GetPosition().y + delta.y; - field.SetPosition( (wxPoint)pos ); + field.SetPosition( pos ); } } @@ -1667,8 +1667,8 @@ void SCH_GLOBALLABEL::ViewGetLayers( int aLayers[], int& aCount ) const void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, - std::vector& aPoints, - const wxPoint& aPos ) const + std::vector& aPoints, + const VECTOR2I& aPos ) const { int margin = GetLabelBoxExpansion( aRenderSettings ); int halfSize = ( GetTextHeight() / 2 ) + margin; @@ -1681,12 +1681,12 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings aPoints.clear(); // Create outline shape : 6 points - aPoints.emplace_back( wxPoint( 0, 0 ) ); - aPoints.emplace_back( wxPoint( 0, -y ) ); // Up - aPoints.emplace_back( wxPoint( -x, -y ) ); // left - aPoints.emplace_back( wxPoint( -x, 0 ) ); // Up left - aPoints.emplace_back( wxPoint( -x, y ) ); // left down - aPoints.emplace_back( wxPoint( 0, y ) ); // down + aPoints.emplace_back( VECTOR2I( 0, 0 ) ); + aPoints.emplace_back( VECTOR2I( 0, -y ) ); // Up + aPoints.emplace_back( VECTOR2I( -x, -y ) ); // left + aPoints.emplace_back( VECTOR2I( -x, 0 ) ); // Up left + aPoints.emplace_back( VECTOR2I( -x, y ) ); // left down + aPoints.emplace_back( VECTOR2I( 0, y ) ); // down int x_offset = 0; @@ -1714,7 +1714,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings } // Rotate outlines and move corners in real position - for( wxPoint& aPoint : aPoints ) + for( VECTOR2I& aPoint : aPoints ) { aPoint.x += x_offset; @@ -1722,9 +1722,9 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings { default: case LABEL_SPIN_STYLE::LEFT: break; - case LABEL_SPIN_STYLE::UP: RotatePoint( &aPoint, -900 ); break; - case LABEL_SPIN_STYLE::RIGHT: RotatePoint( &aPoint, 1800 ); break; - case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( &aPoint, 900 ); break; + case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -900 ); break; + case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, 1800 ); break; + case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, 900 ); break; } aPoint += aPos; @@ -1746,7 +1746,7 @@ BITMAPS SCH_GLOBALLABEL::GetMenuImage() const } -SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType ) : +SCH_HIERLABEL::SCH_HIERLABEL( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) : SCH_LABEL_BASE( pos, text, aType ) { m_layer = LAYER_HIERLABEL; @@ -1763,14 +1763,14 @@ void SCH_HIERLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, - std::vector& aPoints, const wxPoint& aPos ) const + std::vector& aPoints, const VECTOR2I& aPos ) const { CreateGraphicShape( aSettings, aPoints, aPos, m_shape ); } void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, - std::vector& aPoints, const wxPoint& aPos, + std::vector& aPoints, const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const { int* Template = TemplateShape[static_cast( aShape )][static_cast( m_spin_style )]; @@ -1782,7 +1782,7 @@ void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, for( int ii = 0; ii < imax; ii++ ) { - wxPoint corner; + VECTOR2I corner; corner.x = ( halfSize * (*Template) ) + aPos.x; Template++; @@ -1840,15 +1840,15 @@ const EDA_RECT SCH_HIERLABEL::GetBodyBoundingBox() const break; } - EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) ); + EDA_RECT box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) ); box.Normalize(); return box; } -wxPoint SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const +VECTOR2I SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const { - wxPoint text_offset; + VECTOR2I text_offset; int dist = GetTextOffset( aSettings ); dist += GetTextWidth(); diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 10b611412d..b7421c6a4e 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -114,7 +114,7 @@ extern const char* SheetLabelType[]; /* names of types of labels */ class SCH_TEXT : public SCH_ITEM, public EDA_TEXT { public: - SCH_TEXT( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, + SCH_TEXT( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString, KICAD_T aType = SCH_TEXT_T ); SCH_TEXT( const SCH_TEXT& aText ); @@ -159,9 +159,9 @@ public: * * @return the offset between the SCH_TEXT position and the text itself position */ - virtual wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const; + virtual VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override; void SwapData( SCH_ITEM* aItem ) override; @@ -173,14 +173,14 @@ public: int GetPenWidth() const override; - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { EDA_TEXT::Offset( aMoveVector ); } void MirrorHorizontally( int aCenter ) override; void MirrorVertically( int aCenter ) override; - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; virtual void Rotate90( bool aClockwise ); virtual void MirrorSpinStyle( bool aLeftRight ); @@ -203,10 +203,10 @@ public: BITMAPS GetMenuImage() const override; - wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } - void SetPosition( const wxPoint& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); } + VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); } + void SetPosition( const VECTOR2I& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; void Plot( PLOTTER* aPlotter ) const override; @@ -242,7 +242,7 @@ protected: class SCH_LABEL_BASE : public SCH_TEXT { public: - SCH_LABEL_BASE( const wxPoint& aPos, const wxString& aText, KICAD_T aType ); + SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType ); SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel ); @@ -273,7 +273,7 @@ public: m_fields = aFields; // vector copying, length is changed possibly } - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { SCH_TEXT::Move( aMoveVector ); @@ -281,7 +281,7 @@ public: field.Offset( aMoveVector ); } - void Rotate( const wxPoint& aCenter ) override; + void Rotate( const VECTOR2I& aCenter ) override; void Rotate90( bool aClockwise ) override; void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override; @@ -301,7 +301,7 @@ public: * @param Pos Position of the shape, for texts and labels: do nothing */ virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings, - std::vector& aPoints, const wxPoint& Pos ) const + std::vector& aPoints, const VECTOR2I& Pos ) const { aPoints.clear(); } @@ -318,10 +318,10 @@ public: */ const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; - std::vector GetConnectionPoints() const override; + std::vector GetConnectionPoints() const override; void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override; @@ -337,7 +337,7 @@ public: void Plot( PLOTTER* aPlotter ) const override; - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) override; + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override; protected: std::vector m_fields; @@ -352,7 +352,7 @@ protected: class SCH_LABEL : public SCH_LABEL_BASE { public: - SCH_LABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString ); + SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -389,13 +389,13 @@ public: return new SCH_LABEL( *this ); } - bool IsPointClickableAnchor( const wxPoint& aPos ) const override + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return m_isDangling && GetPosition() == aPos; } private: - bool doIsConnected( const wxPoint& aPosition ) const override + bool doIsConnected( const VECTOR2I& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; } @@ -405,7 +405,7 @@ private: class SCH_NETCLASS_FLAG : public SCH_LABEL_BASE { public: - SCH_NETCLASS_FLAG( const wxPoint& aPos = wxPoint( 0, 0 ) ); + SCH_NETCLASS_FLAG( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) ); SCH_NETCLASS_FLAG( const SCH_NETCLASS_FLAG& aClassLabel ); @@ -429,8 +429,8 @@ public: int GetPinLength() const { return m_pinLength; } void SetPinLength( int aLength ) { m_pinLength = aLength; } - void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, - const wxPoint& aPos ) const override; + void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, + const VECTOR2I& aPos ) const override; void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override; @@ -453,7 +453,7 @@ private: class SCH_GLOBALLABEL : public SCH_LABEL_BASE { public: - SCH_GLOBALLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString ); + SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString ); SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel ); @@ -483,10 +483,10 @@ public: void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override; - wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; + VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; - void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, - std::vector& aPoints, const wxPoint& aPos ) const override; + void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector& aPoints, + const VECTOR2I& aPos ) const override; bool ResolveTextVar( wxString* token, int aDepth ) const override; @@ -504,13 +504,13 @@ public: BITMAPS GetMenuImage() const override; - bool IsPointClickableAnchor( const wxPoint& aPos ) const override + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return m_isDangling && GetPosition() == aPos; } private: - bool doIsConnected( const wxPoint& aPosition ) const override + bool doIsConnected( const VECTOR2I& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; } @@ -520,7 +520,7 @@ private: class SCH_HIERLABEL : public SCH_LABEL_BASE { public: - SCH_HIERLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, + SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString, KICAD_T aType = SCH_HIER_LABEL_T ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -539,12 +539,12 @@ public: void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override; - wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; + VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; - void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, - const wxPoint& aPos ) const override; - void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, - const wxPoint& aPos, LABEL_FLAG_SHAPE aShape ) const; + void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, + const VECTOR2I& aPos ) const override; + void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector& aPoints, + const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const; const EDA_RECT GetBodyBoundingBox() const override; @@ -565,13 +565,13 @@ public: return new SCH_HIERLABEL( *this ); } - bool IsPointClickableAnchor( const wxPoint& aPos ) const override + bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return m_isDangling && GetPosition() == aPos; } private: - bool doIsConnected( const wxPoint& aPosition ) const override + bool doIsConnected( const VECTOR2I& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; } diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index f4cc93a7fa..7d54ca79aa 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -1313,7 +1313,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol ) for( int i = 0; i < (int) aSymbol->GetFields().size(); ++i ) { const SCH_FIELD& field = aSymbol->GetFields()[i]; - wxPoint pos = field.GetPosition() - aSymbol->GetPosition(); + VECTOR2I pos = field.GetPosition() - aSymbol->GetPosition(); LIB_FIELD libField( symbol.get(), field.GetId() ); if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() ) diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp index e30e21a490..9db9dfa356 100644 --- a/eeschema/tools/ee_grid_helper.cpp +++ b/eeschema/tools/ee_grid_helper.cpp @@ -296,9 +296,9 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b case SCH_NETCLASS_FLAG_T: case SCH_BUS_WIRE_ENTRY_T: { - std::vector pts = aItem->GetConnectionPoints(); + std::vector pts = aItem->GetConnectionPoints(); - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem ); break; diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index 46b0b1b76f..a4487ac5ac 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -184,8 +184,8 @@ public: case SCH_SHEET_T: { SCH_SHEET* sheet = (SCH_SHEET*) aItem; - wxPoint topLeft = sheet->GetPosition(); - wxPoint botRight = sheet->GetPosition() + sheet->GetSize(); + VECTOR2I topLeft = sheet->GetPosition(); + VECTOR2I botRight = sheet->GetPosition() + sheet->GetSize(); points->AddPoint( (wxPoint) topLeft ); points->AddPoint( wxPoint( botRight.x, topLeft.y ) ); @@ -197,8 +197,8 @@ public: case SCH_BITMAP_T: { SCH_BITMAP* bitmap = (SCH_BITMAP*) aItem; - wxPoint topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; - wxPoint botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; + VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; + VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; points->AddPoint( (wxPoint) topLeft ); points->AddPoint( wxPoint( botRight.x, topLeft.y ) ); @@ -703,7 +703,7 @@ void EE_POINT_EDITOR::updateParentItem() const // Pin positions are relative to origin. Attempt to leave them where they // are if the origin moves. - wxPoint originDelta = sheet->GetPosition() - (wxPoint) topLeft; + VECTOR2I originDelta = sheet->GetPosition() - (wxPoint) topLeft; sheet->SetPosition( (wxPoint) topLeft ); sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) ); @@ -715,7 +715,7 @@ void EE_POINT_EDITOR::updateParentItem() const // Keep sheet pins attached to edges: for( SCH_SHEET_PIN* pin : sheet->GetPins() ) { - wxPoint pos = pin->GetPosition(); + VECTOR2I pos = pin->GetPosition(); pos += originDelta; @@ -922,8 +922,8 @@ void EE_POINT_EDITOR::updatePoints() case SCH_BITMAP_T: { SCH_BITMAP* bitmap = (SCH_BITMAP*) item; - wxPoint topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; - wxPoint botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; + VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; + VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft ); m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y ); @@ -935,8 +935,8 @@ void EE_POINT_EDITOR::updatePoints() case SCH_SHEET_T: { SCH_SHEET* sheet = (SCH_SHEET*) item; - wxPoint topLeft = sheet->GetPosition(); - wxPoint botRight = sheet->GetPosition() + sheet->GetSize(); + VECTOR2I topLeft = sheet->GetPosition(); + VECTOR2I botRight = sheet->GetPosition() + sheet->GetSize(); m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft ); m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y ); diff --git a/eeschema/tools/ee_selection.cpp b/eeschema/tools/ee_selection.cpp index 697fd431f2..9d56093a30 100644 --- a/eeschema/tools/ee_selection.cpp +++ b/eeschema/tools/ee_selection.cpp @@ -40,13 +40,13 @@ EE_SELECTION::EE_SELECTION( SCH_SCREEN* aScreen ) : EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const { EDA_ITEM* topLeftItem = nullptr; - wxPoint topLeftPos; + VECTOR2I topLeftPos; // find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item // in the selection for( EDA_ITEM* item : m_items ) { - wxPoint pos = item->GetPosition(); + VECTOR2I pos = item->GetPosition(); if( ( topLeftItem == nullptr ) || ( pos.x < topLeftPos.x ) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 25e4ac819b..f3baff7143 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -1628,13 +1628,13 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos ) { - wxPoint pos = aSheet->GetPosition(); - wxPoint size = (wxPoint) aPos - pos; + VECTOR2I pos = aSheet->GetPosition(); + VECTOR2I size = aPos - pos; size.x = std::max( size.x, MIN_SHEET_WIDTH ); size.y = std::max( size.y, MIN_SHEET_HEIGHT ); - wxPoint grid = m_frame->GetNearestGridPosition( pos + size ); + VECTOR2I grid = m_frame->GetNearestGridPosition( pos + size ); aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) ); } diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 47dd9419ec..51670f1267 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -231,7 +231,7 @@ bool SCH_EDIT_TOOL::Init() DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet(); VECTOR2D cursor = getViewControls()->GetCursorPosition( false ); - if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursor ) ) + if( ds && ds->HitTestDrawingSheetItems( getView(), cursor ) ) return true; } @@ -457,7 +457,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) SCH_ITEM* head = nullptr; int principalItemCount = 0; // User-selected items (as opposed to connected wires) - wxPoint rotPoint; + VECTOR2I rotPoint; bool moving = false; bool connections = false; @@ -480,7 +480,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) if( principalItemCount == 1 ) { if( moving && selection.HasReferencePoint() ) - rotPoint = (wxPoint) selection.GetReferencePoint(); + rotPoint = selection.GetReferencePoint(); else rotPoint = head->GetPosition(); @@ -520,7 +520,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) SCH_SHEET* sheet = pin->GetParent(); for( int i = 0; clockwise ? i < 3 : i < 1; ++i ) - pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() ); + pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() ); break; } @@ -585,9 +585,9 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) else { if( moving && selection.HasReferencePoint() ) - rotPoint = (wxPoint) selection.GetReferencePoint(); + rotPoint = selection.GetReferencePoint(); else - rotPoint = m_frame->GetNearestHalfGridPosition( (wxPoint) selection.GetCenter() ); + rotPoint = m_frame->GetNearestHalfGridPosition( selection.GetCenter() ); } for( unsigned ii = 0; ii < selection.GetSize(); ii++ ) @@ -628,7 +628,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) SCH_SHEET_PIN* pin = static_cast( item ); SCH_SHEET* sheet = pin->GetParent(); - pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() ); + pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() ); } } else if( item->Type() == SCH_FIELD_T ) @@ -691,7 +691,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) if( selection.GetSize() == 0 ) return 0; - wxPoint mirrorPoint; + VECTOR2I mirrorPoint; bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) ); SCH_ITEM* item = static_cast( selection.Front() ); bool connections = false; @@ -787,7 +787,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) case SCH_SHEET_T: // Mirror the sheet on itself. Sheets do not have a anchor point. - mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)item->GetBoundingBox().Centre() ); + mirrorPoint = m_frame->GetNearestHalfGridPosition( item->GetBoundingBox().Centre() ); if( vertical ) item->MirrorVertically( mirrorPoint.y ); @@ -805,7 +805,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) } else if( selection.GetSize() > 1 ) { - mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)selection.GetCenter() ); + mirrorPoint = m_frame->GetNearestHalfGridPosition( selection.GetCenter() ); for( unsigned ii = 0; ii < selection.GetSize(); ii++ ) { @@ -885,7 +885,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) // If cloning a symbol then put into 'move' mode. if( newItem->Type() == SCH_SYMBOL_T ) { - wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition( true ); newItem->Move( cursorPos - newItem->GetPosition() ); performDrag = true; } @@ -903,8 +903,8 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true ); } - newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ), - Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) ); + newItem->Move( VECTOR2I( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ), + Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) ); } newItem->SetFlags( IS_NEW ); @@ -966,7 +966,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) SCH_SCREEN* screen = m_frame->GetScreen(); auto items = m_selectionTool->RequestSelection( deletableItems ).GetItems(); bool appendToUndo = false; - std::vector pts; + std::vector pts; if( items.empty() ) return 0; @@ -986,7 +986,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) if( sch_item->IsConnectable() ) { - std::vector tmp_pts = sch_item->GetConnectionPoints(); + std::vector tmp_pts = sch_item->GetConnectionPoints(); pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() ); } @@ -1026,7 +1026,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) } } - for( const wxPoint& point : pts ) + for( const VECTOR2I& point : pts ) { SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T ); @@ -1083,7 +1083,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) { EE_COLLECTOR collector; collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); - collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos ); + collector.Collect( m_frame->GetScreen(), deletableItems, aPos ); EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); selectionTool->GuessSelectionCandidates( collector, aPos ); @@ -1319,7 +1319,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet(); VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false ); - if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) ) + if( ds && ds->HitTestDrawingSheetItems( getView(), cursorPos ) ) m_toolMgr->RunAction( ACTIONS::pageSettings ); } @@ -1613,7 +1613,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent ) { bool selected = text->IsSelected(); SCH_TEXT* newtext = nullptr; - const wxPoint& position = text->GetPosition(); + const VECTOR2I& position = text->GetPosition(); LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle(); wxString txt = UnescapeString( text->GetText() ); diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index b045bd50de..a4b108c375 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -359,14 +359,14 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent ) } -SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const wxPoint& aPos ) +SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const VECTOR2I& aPos ) { SCHEMATIC_SETTINGS& cfg = getModel()->Settings(); - wxPoint pos = aPos; + VECTOR2I pos = aPos; - if( aPos == wxDefaultPosition ) - pos = static_cast( getViewControls()->GetCursorPosition() ); + if( aPos == VECTOR2I( 0, 0 ) ) + pos = static_cast( getViewControls()->GetCursorPosition() ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); @@ -390,7 +390,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const wxPoi } -const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const wxPoint& aPosition ) +const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const VECTOR2I& aPosition ) { SCH_SCREEN* screen = m_frame->GetScreen(); @@ -410,7 +410,7 @@ const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const wxPoint& aPositi void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair& aSegments, - wxPoint& aPosition ) + VECTOR2I& aPosition ) { wxCHECK_RET( aSegments.first && aSegments.second, wxT( "Cannot compute break point of NULL line segment." ) ); @@ -418,7 +418,7 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pairGetEndPoint().x - segment->GetStartPoint().x; int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y; @@ -548,11 +548,11 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, grid.ClearMaskFlag( GRID_HELPER::HORIZONTAL ); } - wxPoint cursorPos = static_cast( evt->HasPosition() ? - evt->Position() : - controls->GetMousePosition() ); + wxPoint eventPosition = static_cast( evt->HasPosition() ? + evt->Position() : + controls->GetMousePosition() ); - cursorPos = (wxPoint) grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, segment ); + VECTOR2I cursorPos = grid.BestSnapAnchor( eventPosition, LAYER_CONNECTABLE, segment ); controls->ForceCursorPosition( true, cursorPos ); bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only; @@ -686,7 +686,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, // Update the bus unfold posture based on the mouse movement if( m_busUnfold.in_progress && !m_busUnfold.label_placed ) { - wxPoint cursor_delta = cursorPos - m_busUnfold.origin; + VECTOR2I cursor_delta = cursorPos - m_busUnfold.origin; SCH_BUS_WIRE_ENTRY* entry = m_busUnfold.entry; bool flipX = ( cursor_delta.x < 0 ); @@ -743,7 +743,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, if( !segment ) m_toolMgr->VetoContextMenuMouseWarp(); - contextMenuPos = cursorPos; + contextMenuPos = (wxPoint)cursorPos; m_menu.ShowContextMenu( m_selectionTool->GetSelection() ); } else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE ) @@ -886,8 +886,8 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments() simplifyWireList(); // Collect the possible connection points for the new lines - std::vector< wxPoint > connections = m_frame->GetSchematicConnections(); - std::vector< wxPoint > new_ends; + std::vector connections = m_frame->GetSchematicConnections(); + std::vector new_ends; // Check each new segment for possible junctions and add/split if needed for( SCH_LINE* wire : m_wires ) @@ -895,11 +895,11 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments() if( wire->HasFlag( SKIP_STRUCT ) ) continue; - std::vector tmpends = wire->GetConnectionPoints(); + std::vector tmpends = wire->GetConnectionPoints(); new_ends.insert( new_ends.end(), tmpends.begin(), tmpends.end() ); - for( const wxPoint& pt : connections ) + for( const VECTOR2I& pt : connections ) { if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), pt ) ) new_ends.push_back( pt ); @@ -946,7 +946,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments() for( SCH_ITEM* symbol : symbols ) { - std::vector pts = symbol->GetConnectionPoints(); + std::vector pts = symbol->GetConnectionPoints(); if( pts.size() > 2 ) continue; @@ -958,7 +958,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments() } } - for( const wxPoint& pt : new_ends ) + for( const VECTOR2I& pt : new_ends ) { if( m_frame->GetScreen()->IsExplicitJunctionNeeded( pt ) ) m_frame->AddJunction( m_frame->GetScreen(), pt, true, false ); @@ -978,8 +978,8 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent ) { EE_SELECTION* aSelection = aEvent.Parameter(); - std::vector pts; - std::vector connections = m_frame->GetSchematicConnections(); + std::vector pts; + std::vector connections = m_frame->GetSchematicConnections(); for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ ) { @@ -988,7 +988,7 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent ) if( !item || !item->IsConnectable() ) continue; - std::vector new_pts = item->GetConnectionPoints(); + std::vector new_pts = item->GetConnectionPoints(); pts.insert( pts.end(), new_pts.begin(), new_pts.end() ); // If the item is a line, we also add any connection points from the rest of the schematic @@ -997,7 +997,7 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent ) { SCH_LINE* line = (SCH_LINE*) item; - for( const wxPoint& pt : connections ) + for( const VECTOR2I& pt : connections ) { if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), pt ) ) pts.push_back( pt ); @@ -1016,14 +1016,14 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent ) // We always have some overlapping connection points. Drop duplicates here std::sort( pts.begin(), pts.end(), - []( const wxPoint& a, const wxPoint& b ) -> bool + []( const VECTOR2I& a, const VECTOR2I& b ) -> bool { return a.x < b.x || ( a.x == b.x && a.y < b.y ); } ); pts.erase( unique( pts.begin(), pts.end() ), pts.end() ); - for( const wxPoint& point : pts ) + for( const VECTOR2I& point : pts ) { if( m_frame->GetScreen()->IsExplicitJunctionNeeded( point ) ) m_frame->AddJunction( m_frame->GetScreen(), point, true, false ); diff --git a/eeschema/tools/sch_line_wire_bus_tool.h b/eeschema/tools/sch_line_wire_bus_tool.h index f75505292d..d242b3c19d 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.h +++ b/eeschema/tools/sch_line_wire_bus_tool.h @@ -52,7 +52,7 @@ struct BUS_UNFOLDING_T bool flipY; ///< True if the bus entry should be flipped in the y-axis bool label_placed; ///< True if user has placed the net label - wxPoint origin; ///< Origin (on the bus) of the unfold + VECTOR2I origin; ///< Origin (on the bus) of the unfold wxString net_name; ///< Net label for the unfolding operation SCH_BUS_WIRE_ENTRY* entry; @@ -96,7 +96,7 @@ public: private: int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw ); SCH_LINE* startSegments( int aType, const VECTOR2D& aPos ); - SCH_LINE* doUnfoldBus( const wxString& aNet, const wxPoint& aPos = wxDefaultPosition ); + SCH_LINE* doUnfoldBus( const wxString& aNet, const VECTOR2I& aPos = VECTOR2I( 0, 0 ) ); void finishSegments(); /** @@ -114,7 +114,7 @@ private: * @param aPosition grid point to search for existing sheet pin * @return Pointer to sheet pin or nullptr on failure */ - const SCH_SHEET_PIN* getSheetPin( const wxPoint& aPosition ); + const SCH_SHEET_PIN* getSheetPin( const VECTOR2I& aPosition ); /** * Compute the middle coordinate for 2 segments from the start point to \a aPosition @@ -125,7 +125,7 @@ private: * @param aPosition A reference to a wxPoint object containing the coordinates of the * position used to calculate the line break point. */ - void computeBreakPoint( const std::pair& aSegments, wxPoint& aPosition ); + void computeBreakPoint( const std::pair& aSegments, VECTOR2I& aPosition ); private: /// Data related to bus unfolding tool. diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 2282c7b75d..9b64e0964f 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -204,14 +204,14 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) for( EDA_ITEM* edaItem : selection ) { SCH_ITEM* item = static_cast( edaItem ); - std::vector connections; + std::vector connections; if( item->Type() == SCH_LINE_T ) static_cast( item )->GetSelectedPoints( connections ); else connections = item->GetConnectionPoints(); - for( wxPoint point : connections ) + for( VECTOR2I point : connections ) getConnectedDragItems( item, point, connectedDragItems ); } @@ -525,7 +525,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) } -void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoint& aPoint, +void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const VECTOR2I& aPoint, EDA_ITEMS& aList ) { EE_RTREE& items = m_frame->GetScreen()->Items(); @@ -659,7 +659,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin SCH_LINE* line = static_cast( aOriginalItem ); bool oneEndFixed = !line->HasFlag( STARTPOINT ) || !line->HasFlag( ENDPOINT ); - if( line->HitTest( (wxPoint)label->GetTextPos(), 1 ) ) + if( line->HitTest( label->GetTextPos(), 1 ) ) { label->SetFlags( TEMP_SELECTED ); aList.push_back( label ); @@ -694,7 +694,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin continue; } - for( wxPoint& point : test->GetConnectionPoints() ) + for( VECTOR2I& point : test->GetConnectionPoints() ) { if( line->HitTest( point, 1 ) ) { @@ -702,8 +702,8 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin aList.push_back( test ); // A bus entry needs its wire & label as well - std::vector ends = test->GetConnectionPoints(); - wxPoint otherEnd; + std::vector ends = test->GetConnectionPoints(); + VECTOR2I otherEnd; if( ends[0] == point ) otherEnd = ends[1]; @@ -736,10 +736,10 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta ) SCH_LINE* line = static_cast( aItem ); if( aItem->HasFlag( STARTPOINT ) ) - line->MoveStart( (wxPoint) aDelta ); + line->MoveStart( aDelta ); if( aItem->HasFlag( ENDPOINT ) ) - line->MoveEnd( (wxPoint) aDelta ); + line->MoveEnd( aDelta ); } break; @@ -748,7 +748,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta ) case SCH_FIELD_T: { SCH_ITEM* parent = (SCH_ITEM*) aItem->GetParent(); - wxPoint delta( aDelta ); + VECTOR2I delta( aDelta ); if( parent && parent->Type() == SCH_SYMBOL_T ) { @@ -769,7 +769,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta ) case SCH_SHEET_PIN_T: { SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) aItem; - pin->SetStoredPos( pin->GetStoredPos() + (wxPoint) aDelta ); + pin->SetStoredPos( pin->GetStoredPos() + aDelta ); pin->ConstrainOnEdge( pin->GetStoredPos() ); break; } @@ -782,17 +782,17 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta ) { SPECIAL_CASE_LABEL_INFO info = m_specialCaseLabels[ label ]; SEG currentLine( info.attachedLine->GetStartPoint(), info.attachedLine->GetEndPoint() ); - label->SetPosition( (wxPoint) currentLine.NearestPoint( info.originalLabelPos ) ); + label->SetPosition( currentLine.NearestPoint( info.originalLabelPos ) ); } else { - label->Move( (wxPoint) aDelta ); + label->Move( aDelta ); } break; } default: - static_cast( aItem )->Move( (wxPoint) aDelta ); + static_cast( aItem )->Move( aDelta ); break; } @@ -830,7 +830,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent ) { SCH_LINE* line = static_cast( item ); std::vector flags{ STARTPOINT, ENDPOINT }; - std::vector pts{ line->GetStartPoint(), line->GetEndPoint() }; + std::vector pts{ line->GetStartPoint(), line->GetEndPoint() }; for( int ii = 0; ii < 2; ++ii ) { @@ -876,18 +876,18 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent ) } else { - std::vector connections; + std::vector connections; EDA_ITEMS drag_items{ item }; connections = static_cast( item )->GetConnectionPoints(); - for( const wxPoint& point : connections ) + for( const VECTOR2I& point : connections ) getConnectedDragItems( static_cast( item ), point, drag_items ); std::map shifts; VECTOR2I most_common( 0, 0 ); int max_count = 0; - for( const wxPoint& conn : connections ) + for( const VECTOR2I& conn : connections ) { VECTOR2I gridpt = grid.AlignGrid( conn ) - conn; diff --git a/eeschema/tools/sch_move_tool.h b/eeschema/tools/sch_move_tool.h index bf843f2e47..2850f8acac 100644 --- a/eeschema/tools/sch_move_tool.h +++ b/eeschema/tools/sch_move_tool.h @@ -36,7 +36,7 @@ class EE_SELECTION_TOOL; struct SPECIAL_CASE_LABEL_INFO { SCH_LINE* attachedLine; - wxPoint originalLabelPos; + VECTOR2I originalLabelPos; }; @@ -68,7 +68,7 @@ private: ///< Find additional items for a drag operation. ///< Connected items with no wire are included (as there is no wire to adjust for the drag). ///< Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT). - void getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoint& aPoint, EDA_ITEMS& aList ); + void getConnectedDragItems( SCH_ITEM* aOriginalItem, const VECTOR2I& aPoint, EDA_ITEMS& aList ); ///< Set up handlers for various events. void setTransitions() override; diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index 6a07bc87b3..30c01c5a08 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -151,7 +151,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) if( selection.GetSize() == 0 ) return 0; - wxPoint rotPoint; + VECTOR2I rotPoint; bool ccw = ( aEvent.Matches( EE_ACTIONS::rotateCCW.MakeEvent() ) ); LIB_ITEM* item = static_cast( selection.Front() ); @@ -195,7 +195,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent ) if( selection.GetSize() == 0 ) return 0; - wxPoint mirrorPoint; + VECTOR2I mirrorPoint; bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) ); LIB_ITEM* item = static_cast( selection.Front() ); @@ -267,7 +267,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) if( item->Type() == LIB_PIN_T ) { LIB_PIN* pin = static_cast( item ); - wxPoint pos = pin->GetPosition(); + VECTOR2I pos = pin->GetPosition(); toDelete.insert( pin ); diff --git a/eeschema/tools/symbol_editor_move_tool.cpp b/eeschema/tools/symbol_editor_move_tool.cpp index 20caf6a45b..64e758d432 100644 --- a/eeschema/tools/symbol_editor_move_tool.cpp +++ b/eeschema/tools/symbol_editor_move_tool.cpp @@ -206,8 +206,8 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) } else if( selection.Size() == 1 && m_frame->GetMoveWarpsCursor() ) { - wxPoint itemPos = lib_item->GetPosition(); - m_anchorPos = wxPoint( itemPos.x, -itemPos.y ); + VECTOR2I itemPos = lib_item->GetPosition(); + m_anchorPos = VECTOR2I( itemPos.x, -itemPos.y ); getViewControls()->WarpCursor( m_anchorPos, true, true ); m_cursor = m_anchorPos; diff --git a/gerbview/am_primitive.cpp b/gerbview/am_primitive.cpp index 912a31d3cd..ec35606264 100644 --- a/gerbview/am_primitive.cpp +++ b/gerbview/am_primitive.cpp @@ -95,7 +95,7 @@ const int seg_per_circle = 64; // Number of segments to approximate a circle void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer, - const wxPoint& aShapePos ) + const VECTOR2I& aShapePos ) { #define TO_POLY_SHAPE \ { \ @@ -112,10 +112,10 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S // Draw the primitive shape for flashed items. // Create a static buffer to avoid a lot of memory reallocation. - static std::vector polybuffer; + static std::vector polybuffer; polybuffer.clear(); - wxPoint curPos = aShapePos; + VECTOR2I curPos = aShapePos; D_CODE* tool = aParent->GetDcodeDescr(); double rotation; @@ -139,7 +139,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S if( rotation != 0) { for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); } } @@ -175,7 +175,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S if( rotation != 0) { for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); } // Move to current position: @@ -207,7 +207,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S if( rotation != 0 ) { for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); } // Move to current position: @@ -235,7 +235,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S if( rotation != 0) { for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); } // Move to current position: @@ -259,7 +259,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S * The thermal primitive is a ring (annulus) interrupted by four gaps. Exposure is always * on. */ - std::vector subshape_poly; + std::vector subshape_poly; curPos += mapPt( params[0].GetValue( tool ), params[1].GetValue( tool ), m_GerbMetric ); ConvertShapeToPolygon( aParent, subshape_poly ); @@ -274,7 +274,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S double sub_rotation = rotation + 900 * ii; for( unsigned jj = 0; jj < polybuffer.size(); jj++ ) - RotatePoint( &polybuffer[jj], -sub_rotation ); + RotatePoint( polybuffer[jj], -sub_rotation ); // Move to current position: for( unsigned jj = 0; jj < polybuffer.size(); jj++ ) @@ -309,7 +309,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S int numCircles = KiROUND( params[5].GetValue( tool ) ); // Draw circles: - wxPoint center = aParent->GetABPosition( curPos ); + VECTOR2I center = aParent->GetABPosition( curPos ); // adjust outerDiam by this on each nested circle int diamAdjust = ( gap + penThickness ) * 2; @@ -342,7 +342,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) { // shape rotation: - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); // Move to current position: polybuffer[ii] += curPos; @@ -403,7 +403,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S // rotate polygon and move it to the actual position shape rotation: for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) { - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); } // Move to current position: @@ -436,7 +436,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S rotation = params[5].GetValue( tool ) * 10.0; for( unsigned ii = 0; ii < polybuffer.size(); ii++ ) { - RotatePoint( &polybuffer[ii], -rotation ); + RotatePoint( polybuffer[ii], -rotation ); polybuffer[ii] += curPos; polybuffer[ii] = aParent->GetABPosition( polybuffer[ii] ); } @@ -457,7 +457,7 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_S void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, - std::vector& aBuffer ) + std::vector& aBuffer ) { D_CODE* tool = aParent->GetDcodeDescr(); @@ -478,16 +478,16 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, if( radius <= 0 ) break; - wxPoint center = mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), - m_GerbMetric ); - wxPoint corner; + VECTOR2I center = + mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric ); + VECTOR2I corner; const int delta = 3600 / seg_per_circle; // rot angle in 0.1 degree for( int angle = 0; angle < 3600; angle += delta ) { corner.x = radius; corner.y = 0; - RotatePoint( &corner, angle ); + RotatePoint( corner, angle ); corner += center; aBuffer.push_back( corner ); } @@ -523,7 +523,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, for( unsigned ii = 0; ii < 4; ii++ ) { - RotatePoint( &aBuffer[ii], -angle ); + RotatePoint( aBuffer[ii], -angle ); aBuffer[ii] += start; } @@ -532,10 +532,10 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, case AMP_LINE_CENTER: { - wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), - m_GerbMetric ); - wxPoint pos = mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ), - m_GerbMetric ); + VECTOR2I size = + mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric ); + VECTOR2I pos = + mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ), m_GerbMetric ); // Build poly: pos.x -= size.x / 2; @@ -552,10 +552,10 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, case AMP_LINE_LOWER_LEFT: { - wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), - m_GerbMetric ); - wxPoint lowerLeft = mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ), - m_GerbMetric ); + VECTOR2I size = + mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric ); + VECTOR2I lowerLeft = + mapPt( params[3].GetValue( tool ), params[4].GetValue( tool ), m_GerbMetric ); // Build poly: aBuffer.push_back( lowerLeft ); @@ -585,7 +585,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, double angle_start = RAD2DECIDEG( asin( (double) halfthickness / innerRadius ) ); // Draw shape in the first quadrant (X and Y > 0) - wxPoint pos, startpos; + VECTOR2I pos, startpos; // Inner arc startpos.x = innerRadius; @@ -594,13 +594,13 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, for( double angle = angle_start; angle < angle_end; angle += 100 ) { pos = startpos; - RotatePoint( &pos, angle ); + RotatePoint( pos, angle ); aBuffer.push_back( pos ); } // Last point pos = startpos; - RotatePoint( &pos, angle_end ); + RotatePoint( pos, angle_end ); aBuffer.push_back( pos ); // outer arc @@ -613,13 +613,13 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, for( double angle = angle_end; angle > angle_start; angle -= 100 ) { pos = startpos; - RotatePoint( &pos, angle ); + RotatePoint( pos, angle ); aBuffer.push_back( pos ); } // last point pos = startpos; - RotatePoint( &pos, angle_start ); + RotatePoint( pos, angle_start ); aBuffer.push_back( pos ); aBuffer.push_back( aBuffer[0] ); // Close poly @@ -635,7 +635,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, // Create cross. First create 1/4 of the shape. // Others point are the same, rotated by 90, 180 and 270 deg - wxPoint pos( crossHairThickness / 2, crossHairLength / 2 ); + VECTOR2I pos( crossHairThickness / 2, crossHairLength / 2 ); aBuffer.push_back( pos ); pos.y = crossHairThickness / 2; aBuffer.push_back( pos ); @@ -650,7 +650,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, for( int ii = 0; ii < 4; ii++ ) { pos = aBuffer[ii]; - RotatePoint( &pos, jj*900 ); + RotatePoint( pos, jj*900 ); aBuffer.push_back( pos ); } } @@ -711,16 +711,16 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent ) case AMP_LINE_CENTER: { - wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), - m_GerbMetric ); + VECTOR2I size = + mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric ); dim = std::min(size.x, size.y); break; } case AMP_LINE_LOWER_LEFT: { - wxPoint size = mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), - m_GerbMetric ); + VECTOR2I size = + mapPt( params[1].GetValue( tool ), params[2].GetValue( tool ), m_GerbMetric ); dim = std::min(size.x, size.y); break; } @@ -749,7 +749,7 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent ) // Read points. numPoints does not include the starting point, so add 1. // and calculate the bounding box; - wxSize pos_min, pos_max, pos; + VECTOR2I pos_min, pos_max, pos; int prm_idx = 2; // params[2] is the first X coordinate int last_prm = params.size() - 1; @@ -789,7 +789,7 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent ) } // calculate dim - wxSize size; + VECTOR2I size; size.x = pos_max.x - pos_min.x; size.y = pos_max.y - pos_min.y; dim = std::min( size.x, size.y ); @@ -811,7 +811,7 @@ int AM_PRIMITIVE::GetShapeDim( const GERBER_DRAW_ITEM* aParent ) SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent, - const wxPoint& aShapePos ) + const VECTOR2I& aShapePos ) { SHAPE_POLY_SET holeBuffer; bool hasHole = false; @@ -849,9 +849,11 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a if( hasHole ) m_shape.Fracture( SHAPE_POLY_SET::PM_FAST ); - m_boundingBox = EDA_RECT( wxPoint( 0, 0 ), wxSize( 1, 1 ) ); + m_boundingBox = EDA_RECT( VECTOR2I( 0, 0 ), VECTOR2I( 1, 1 ) ); + auto bb = m_shape.BBox(); - wxPoint center( bb.Centre().x, bb.Centre().y ); + VECTOR2I center( bb.Centre().x, bb.Centre().y ); + m_boundingBox.Move( aParent->GetABPosition( center ) ); m_boundingBox.Inflate( bb.GetWidth() / 2, bb.GetHeight() / 2 ); @@ -861,7 +863,7 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, const COLOR4D& aColor, - const wxPoint& aShapePos, bool aFilledShape ) + const VECTOR2I& aShapePos, bool aFilledShape ) { SHAPE_POLY_SET* shapeBuffer = GetApertureMacroShape( aParent, aShapePos ); @@ -872,7 +874,7 @@ void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT { SHAPE_LINE_CHAIN& poly = shapeBuffer->Outline( ii ); - GRClosedPoly( aClipBox, aDC, poly.PointCount(), (wxPoint*) &poly.CPoint( 0 ), aFilledShape, + GRClosedPoly( aClipBox, aDC, poly.PointCount(), (VECTOR2I*) &poly.CPoint( 0 ), aFilledShape, aColor, aColor ); } } diff --git a/gerbview/am_primitive.h b/gerbview/am_primitive.h index 233a44a01e..aff5aa1ce4 100644 --- a/gerbview/am_primitive.h +++ b/gerbview/am_primitive.h @@ -142,7 +142,7 @@ public: */ void DrawBasicShape( const GERBER_DRAW_ITEM* aParent, SHAPE_POLY_SET& aShapeBuffer, - const wxPoint& aShapePos ); + const VECTOR2I& aShapePos ); private: /** @@ -155,7 +155,7 @@ private: * converted because circles are very easy to draw (no rotation problem) so convert * them in polygons and draw them as polygons is not a good idea. */ - void ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, std::vector& aBuffer ); + void ConvertShapeToPolygon( const GERBER_DRAW_ITEM* aParent, std::vector& aBuffer ); }; @@ -190,7 +190,7 @@ struct APERTURE_MACRO * @return the shape of the item. */ SHAPE_POLY_SET* GetApertureMacroShape( const GERBER_DRAW_ITEM* aParent, - const wxPoint& aShapePos ); + const VECTOR2I& aShapePos ); /** * Draw the primitive shape for flashed items. @@ -205,7 +205,7 @@ struct APERTURE_MACRO * @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode. */ void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - const COLOR4D& aColor, const wxPoint& aShapePos, + const COLOR4D& aColor, const VECTOR2I& aShapePos, bool aFilledShape ); /** diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 90900fd4a5..0fb1b7b711 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -146,7 +146,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - const COLOR4D& aColor, const wxPoint& aShapePos, bool aFilledShape ) + const COLOR4D& aColor, const VECTOR2I& aShapePos, bool aFilledShape ) { int radius; @@ -186,10 +186,10 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx case APT_RECT: { - wxPoint start; + VECTOR2I start; start.x = aShapePos.x - m_Size.x / 2; start.y = aShapePos.y - m_Size.y / 2; - wxPoint end = start + m_Size; + VECTOR2I end = start + m_Size; start = aParent->GetABPosition( start ); end = aParent->GetABPosition( end ); @@ -213,8 +213,8 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx case APT_OVAL: { - wxPoint start = aShapePos; - wxPoint end = aShapePos; + VECTOR2I start = aShapePos; + VECTOR2I end = aShapePos; if( m_Size.x > m_Size.y ) // horizontal oval { @@ -264,18 +264,18 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wx void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - const COLOR4D& aColor, bool aFilled, const wxPoint& aPosition ) + const COLOR4D& aColor, bool aFilled, const VECTOR2I& aPosition ) { if( m_Polygon.OutlineCount() == 0 ) return; int pointCount = m_Polygon.VertexCount(); - std::vector points; + std::vector points; points.reserve( pointCount ); for( int ii = 0; ii < pointCount; ii++ ) { - wxPoint p( m_Polygon.CVertex( ii ).x, m_Polygon.CVertex( ii ).y ); + VECTOR2I p( m_Polygon.CVertex( ii ).x, m_Polygon.CVertex( ii ).y ); points[ii] = p + aPosition; points[ii] = aParent->GetABPosition( points[ii] ); } @@ -289,16 +289,14 @@ void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, // A helper function for D_CODE::ConvertShapeToPolygon(). Add a hole to a polygon -static void addHoleToPolygon( SHAPE_POLY_SET* aPolygon, - APERTURE_DEF_HOLETYPE aHoleShape, - const wxSize& aSize, - const wxPoint& aAnchorPos ); +static void addHoleToPolygon( SHAPE_POLY_SET* aPolygon, APERTURE_DEF_HOLETYPE aHoleShape, + const VECTOR2I& aSize, const VECTOR2I& aAnchorPos ); void D_CODE::ConvertShapeToPolygon() { - wxPoint initialpos; - wxPoint currpos; + VECTOR2I initialpos; + VECTOR2I currpos; m_Polygon.RemoveAllContours(); @@ -356,7 +354,7 @@ void D_CODE::ConvertShapeToPolygon() for( ; ii <= SEGS_CNT / 2; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT ); + RotatePoint( currpos, ii * 3600.0 / SEGS_CNT ); currpos.x += delta; m_Polygon.Append( VECTOR2I( currpos ) ); } @@ -365,7 +363,7 @@ void D_CODE::ConvertShapeToPolygon() for( ii = SEGS_CNT / 2; ii <= SEGS_CNT; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT ); + RotatePoint( currpos, ii * 3600.0 / SEGS_CNT ); currpos.x -= delta; m_Polygon.Append( VECTOR2I( currpos ) ); } @@ -395,7 +393,7 @@ void D_CODE::ConvertShapeToPolygon() for( int ii = 0; ii < m_EdgesCount; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600.0 / m_EdgesCount ); + RotatePoint( currpos, ii * 3600.0 / m_EdgesCount ); m_Polygon.Append( VECTOR2I( currpos ) ); } @@ -419,17 +417,15 @@ void D_CODE::ConvertShapeToPolygon() // The helper function for D_CODE::ConvertShapeToPolygon(). // Add a hole to a polygon -static void addHoleToPolygon( SHAPE_POLY_SET* aPolygon, - APERTURE_DEF_HOLETYPE aHoleShape, - const wxSize& aSize, - const wxPoint& aAnchorPos ) +static void addHoleToPolygon( SHAPE_POLY_SET* aPolygon, APERTURE_DEF_HOLETYPE aHoleShape, + const VECTOR2I& aSize, const VECTOR2I& aAnchorPos ) { - wxPoint currpos; + VECTOR2I currpos; SHAPE_POLY_SET holeBuffer; if( aHoleShape == APT_DEF_ROUND_HOLE ) { - TransformCircleToPolygon( holeBuffer, wxPoint( 0, 0 ), aSize.x / 2, ARC_HIGH_DEF, + TransformCircleToPolygon( holeBuffer, VECTOR2I( 0, 0 ), aSize.x / 2, ARC_HIGH_DEF, ERROR_INSIDE ); } else if( aHoleShape == APT_DEF_RECT_HOLE ) diff --git a/gerbview/dcode.h b/gerbview/dcode.h index 836ab8f96f..8947ac2ba4 100644 --- a/gerbview/dcode.h +++ b/gerbview/dcode.h @@ -144,7 +144,7 @@ public: * @param aFilledShape set to true to draw in filled mode, false to draw in sketch mode */ void DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - const COLOR4D& aColor, const wxPoint& aShapePos, bool aFilledShape ); + const COLOR4D& aColor, const VECTOR2I& aShapePos, bool aFilledShape ); /** * A helper function used to draw the polygon stored in m_PolyCorners. @@ -161,7 +161,7 @@ public: * @param aPosition is the actual shape position. */ void DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC, - const COLOR4D& aColor, bool aFilled, const wxPoint& aPosition ); + const COLOR4D& aColor, bool aFilled, const VECTOR2I& aPosition ); /** * Convert a shape to an equivalent polygon. diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 466bd4c8c5..75c163e546 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -144,8 +144,8 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( const GERBER_DRAW_ITEM* aGbrIt // used when a D_CODE is not found. default D_CODE to draw a flashed item static D_CODE dummyD_CODE( 0 ); - wxPoint seg_start = aGbrItem->m_Start; - wxPoint seg_end = aGbrItem->m_End; + VECTOR2I seg_start = aGbrItem->m_Start; + VECTOR2I seg_end = aGbrItem->m_End; D_CODE* d_codeDescr = aGbrItem->GetDcodeDescr(); SHAPE_POLY_SET polygon; @@ -256,7 +256,7 @@ void GBR_TO_PCB_EXPORTER::collect_hole( const GERBER_DRAW_ITEM* aGbrItem ) void GBR_TO_PCB_EXPORTER::export_via( const EXPORT_VIA& aVia ) { - wxPoint via_pos = aVia.m_Pos; + VECTOR2I via_pos = aVia.m_Pos; // Reverse Y axis: via_pos.y = -via_pos.y; @@ -310,7 +310,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( const GERBER_DRAW_ITEM* aGbrItem, void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aGbrItem, int aLayer ) { - wxPoint seg_start, seg_end; + VECTOR2I seg_start, seg_end; seg_start = aGbrItem->m_Start; seg_end = aGbrItem->m_End; @@ -323,7 +323,7 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( const GERBER_DRAW_ITEM* aG } -void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const wxPoint& aStart, const wxPoint& aEnd, +void GBR_TO_PCB_EXPORTER::writeCopperLineItem( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth, int aLayer ) { fprintf( m_fp, "(segment (start %s %s) (end %s %s) (width %s) (layer %s) (net 0))\n", @@ -343,8 +343,8 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb double b = atan2( (double) ( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ), (double) ( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) ); - wxPoint start = aGbrItem->m_Start; - wxPoint end = aGbrItem->m_End; + VECTOR2I start = aGbrItem->m_Start; + VECTOR2I end = aGbrItem->m_End; /* Because Pcbnew does not know arcs in tracks, * approximate arc by segments (SEG_COUNT__CIRCLE segment per 360 deg) @@ -358,16 +358,16 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( const GERBER_DRAW_ITEM* aGb if( a > b ) b += 2 * M_PI; - wxPoint curr_start = start; - wxPoint seg_start, seg_end; + VECTOR2I curr_start = start; + VECTOR2I seg_start, seg_end; int ii = 1; for( double rot = a; rot < (b - DELTA_ANGLE); rot += DELTA_ANGLE, ii++ ) { seg_start = curr_start; - wxPoint curr_end = start; - RotatePoint( &curr_end, aGbrItem->m_ArcCentre, -RAD2DECIDEG( DELTA_ANGLE * ii ) ); + VECTOR2I curr_end = start; + RotatePoint( curr_end, aGbrItem->m_ArcCentre, -RAD2DECIDEG( DELTA_ANGLE * ii ) ); seg_end = curr_end; // Reverse Y axis: @@ -413,7 +413,7 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aG } } - wxPoint offset = aGbrItem->GetABPosition( aGbrItem->m_Start ); + VECTOR2I offset = aGbrItem->GetABPosition( aGbrItem->m_Start ); if( aGbrItem->m_Shape == GBR_SPOT_CIRCLE ) // export it as filled circle { @@ -474,7 +474,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader( const int* aLayerLookUpTable ) void GBR_TO_PCB_EXPORTER::writePcbPolygon( const SHAPE_POLY_SET& aPolys, int aLayer, - const wxPoint& aOffset ) + const VECTOR2I& aOffset ) { SHAPE_POLY_SET polys = aPolys; diff --git a/gerbview/export_to_pcbnew.h b/gerbview/export_to_pcbnew.h index 0961ec4d1a..6d279b6bed 100644 --- a/gerbview/export_to_pcbnew.h +++ b/gerbview/export_to_pcbnew.h @@ -29,15 +29,15 @@ struct EXPORT_VIA { - EXPORT_VIA( const wxPoint& aPos, int aSize, int aDrill ) : + EXPORT_VIA( const VECTOR2I& aPos, int aSize, int aDrill ) : m_Pos( aPos ), m_Size( aSize ), m_Drill( aDrill ) { } - wxPoint m_Pos; - int m_Size; - int m_Drill; + VECTOR2I m_Pos; + int m_Size; + int m_Drill; }; @@ -95,7 +95,7 @@ private: * @param aLayer is the technical layer to use. */ void writePcbPolygon( const SHAPE_POLY_SET& aPolys, int aLayer, - const wxPoint& aOffset = { 0, 0 } ); + const VECTOR2I& aOffset = { 0, 0 } ); /** * Write a filled circle to the board file (with line thickness = 0). @@ -155,7 +155,8 @@ private: /** * Basic write function to write a a #PCB_TRACK to the board file from a non flashed item. */ - void writeCopperLineItem( const wxPoint& aStart, const wxPoint& aEnd, int aWidth, int aLayer ); + void writeCopperLineItem( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth, + int aLayer ); /** * Write a very basic header to the board file. diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index a9533b8ca7..20917a6ba1 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -84,7 +84,7 @@ int GERBER_DRAW_ITEM::GetLayer() const } -bool GERBER_DRAW_ITEM::GetTextD_CodePrms( int& aSize, wxPoint& aPos, double& aOrientation ) +bool GERBER_DRAW_ITEM::GetTextD_CodePrms( int& aSize, VECTOR2I& aPos, double& aOrientation ) { // calculate the best size and orientation of the D_Code text @@ -114,7 +114,7 @@ bool GERBER_DRAW_ITEM::GetTextD_CodePrms( int& aSize, wxPoint& aPos, double& aOr } else // this item is a line { - wxPoint delta = m_Start - m_End; + VECTOR2I delta = m_Start - m_End; aOrientation = RAD2DECIDEG( atan2( (double)delta.y, (double)delta.x ) ); NORMALIZE_ANGLE_90( aOrientation ); @@ -133,7 +133,7 @@ bool GERBER_DRAW_ITEM::GetTextD_CodePrms( double& aSize, VECTOR2D& aPos, double& { // aOrientation is returned in radians int size; - wxPoint pos; + VECTOR2I pos; if( ! GetTextD_CodePrms( size, pos, aOrientation ) ) return false; @@ -146,13 +146,13 @@ bool GERBER_DRAW_ITEM::GetTextD_CodePrms( double& aSize, VECTOR2D& aPos, double& } -wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const +VECTOR2I GERBER_DRAW_ITEM::GetABPosition( const VECTOR2I& aXYPosition ) const { /* Note: RS274Xrevd_e is obscure about the order of transforms: * For instance: Rotation must be made after or before mirroring ? * Note: if something is changed here, GetYXPosition must reflect changes */ - wxPoint abPos = aXYPosition + m_GerberImageFile->m_ImageJustifyOffset; + VECTOR2I abPos = aXYPosition + m_GerberImageFile->m_ImageJustifyOffset; if( m_swapAxis ) std::swap( abPos.x, abPos.y ); @@ -163,7 +163,7 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10; if( rotation ) - RotatePoint( &abPos, -rotation ); + RotatePoint( abPos, -rotation ); // Negate A axis if mirrored if( m_mirrorA ) @@ -177,10 +177,10 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const } -wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition ) const +VECTOR2I GERBER_DRAW_ITEM::GetXYPosition( const VECTOR2I& aABPosition ) const { // do the inverse transform made by GetABPosition - wxPoint xyPos = aABPosition; + VECTOR2I xyPos = aABPosition; if( m_mirrorA ) xyPos.x = -xyPos.x; @@ -191,7 +191,7 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition ) const double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10; if( rotation ) - RotatePoint( &xyPos, rotation ); + RotatePoint( xyPos, rotation ); xyPos.x = KiROUND( xyPos.x / m_drawScale.x ); xyPos.y = KiROUND( xyPos.y / m_drawScale.y ); @@ -397,7 +397,7 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const int ymin = std::min( m_Start.y, m_End.y ) - radius; int xmin = std::min( m_Start.x, m_End.x ) - radius; - bbox = EDA_RECT( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) ); + bbox = EDA_RECT( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin + 1, ymax - ymin + 1 ) ); } break; @@ -420,25 +420,25 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const } -void GERBER_DRAW_ITEM::MoveAB( const wxPoint& aMoveVector ) +void GERBER_DRAW_ITEM::MoveAB( const VECTOR2I& aMoveVector ) { - wxPoint xymove = GetXYPosition( aMoveVector ); + VECTOR2I xymove = GetXYPosition( aMoveVector ); m_Start += xymove; m_End += xymove; m_ArcCentre += xymove; - m_Polygon.Move( VECTOR2I( xymove ) ); + m_Polygon.Move( xymove ); } -void GERBER_DRAW_ITEM::MoveXY( const wxPoint& aMoveVector ) +void GERBER_DRAW_ITEM::MoveXY( const VECTOR2I& aMoveVector ) { m_Start += aMoveVector; m_End += aMoveVector; m_ArcCentre += aMoveVector; - m_Polygon.Move( VECTOR2I( aMoveVector ) ); + m_Polygon.Move( aMoveVector ); } @@ -451,7 +451,7 @@ bool GERBER_DRAW_ITEM::HasNegativeItems() } -void GERBER_DRAW_ITEM::Print( wxDC* aDC, const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aOptions ) +void GERBER_DRAW_ITEM::Print( wxDC* aDC, const VECTOR2I& aOffset, GBR_DISPLAY_OPTIONS* aOptions ) { // used when a D_CODE is not found. default D_CODE to draw a flashed item static D_CODE dummyD_CODE( 0 ); @@ -580,8 +580,8 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon( SHAPE_POLY_SET* aPolygon ) const aPolygon->RemoveAllContours(); aPolygon->NewOutline(); - wxPoint start = m_Start; - wxPoint end = m_End; + VECTOR2I start = m_Start; + VECTOR2I end = m_End; // make calculations more easy if ensure start.x < end.x // (only 2 quadrants to consider) @@ -589,7 +589,7 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon( SHAPE_POLY_SET* aPolygon ) const std::swap( start, end ); // calculate values relative to start point: - wxPoint delta = end - start; + VECTOR2I delta = end - start; // calculate corners for the first quadrant only (delta.x and delta.y > 0 ) // currently, delta.x already is > 0. @@ -604,10 +604,10 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon( SHAPE_POLY_SET* aPolygon ) const // 3 4 // 2 5 // 1 6 - wxPoint corner; + VECTOR2I corner; corner.x -= m_Size.x/2; corner.y -= m_Size.y/2; - wxPoint close = corner; + VECTOR2I close = corner; aPolygon->Append( VECTOR2I( corner ) ); // Lower left corner, start point (1) corner.y += m_Size.y; aPolygon->Append( VECTOR2I( corner ) ); // upper left corner, start point (2) @@ -645,10 +645,10 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon() } -void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const wxPoint& aOffset, +void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const VECTOR2I& aOffset, bool aFilledShape ) { - std::vector points; + std::vector points; SHAPE_LINE_CHAIN& poly = m_Polygon.Outline( 0 ); int pointCount = poly.PointCount() - 1; @@ -656,7 +656,7 @@ void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const for( int ii = 0; ii < pointCount; ii++ ) { - wxPoint p( poly.CPoint( ii ).x, poly.CPoint( ii ).y ); + VECTOR2I p( poly.CPoint( ii ).x, poly.CPoint( ii ).y ); points[ii] = p + aOffset; points[ii] = GetABPosition( points[ii] ); } @@ -794,13 +794,13 @@ BITMAPS GERBER_DRAW_ITEM::GetMenuImage() const } -bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos, int aAccuracy ) const +bool GERBER_DRAW_ITEM::HitTest( const VECTOR2I& aRefPos, int aAccuracy ) const { // In case the item has a very tiny width defined, allow it to be selected const int MIN_HIT_TEST_RADIUS = Millimeter2iu( 0.01 ); // calculate aRefPos in XY Gerber axis: - wxPoint ref_pos = GetXYPosition( aRefPos ); + VECTOR2I ref_pos = GetXYPosition( aRefPos ); SHAPE_POLY_SET poly; @@ -910,7 +910,7 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos, int aAccuracy ) const bool GERBER_DRAW_ITEM::HitTest( const EDA_RECT& aRefArea, bool aContained, int aAccuracy ) const { - wxPoint pos = GetABPosition( m_Start ); + VECTOR2I pos = GetABPosition( m_Start ); if( aRefArea.Contains( pos ) ) return true; diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h index cc53259a42..1d1d801112 100644 --- a/gerbview/gerber_draw_item.h +++ b/gerbview/gerber_draw_item.h @@ -87,7 +87,7 @@ public: * @param aOrientation is a reference to return the text orientation * @return true if the parameters can be calculated, false for unknown D_Code */ - bool GetTextD_CodePrms( int& aSize, wxPoint& aPos, double& aOrientation ); + bool GetTextD_CodePrms( int& aSize, VECTOR2I& aPos, double& aOrientation ); /** * Return the best size and orientation to display the D_Code in GAL @@ -121,14 +121,14 @@ public: * * @param aMoveVector the move vector for this object. */ - void MoveAB( const wxPoint& aMoveVector ); + void MoveAB( const VECTOR2I& aMoveVector ); /** * Move this object. * * @param aMoveVector the move vector for this object, in XY gerber axis. */ - void MoveXY( const wxPoint& aMoveVector ); + void MoveXY( const VECTOR2I& aMoveVector ); /** * Return the position of this object. @@ -137,8 +137,8 @@ public: * * @return The position of this object. */ - wxPoint GetPosition() const override { return m_Start; } - void SetPosition( const wxPoint& aPos ) override { m_Start = aPos; } + VECTOR2I GetPosition() const override { return m_Start; } + void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; } /** * Return the image position of aPosition for this object. @@ -149,12 +149,7 @@ public: * @param aXYPosition is position in X,Y gerber axis * @return The given position in plotter A,B axis. */ - wxPoint GetABPosition( const wxPoint& aXYPosition ) const; - - VECTOR2I GetABPosition( const VECTOR2I& aXYPosition ) const - { - return VECTOR2I( GetABPosition( wxPoint( aXYPosition.x, aXYPosition.y ) ) ); - } + VECTOR2I GetABPosition( const VECTOR2I& aXYPosition ) const; /** * Return the image position of aPosition for this object. @@ -165,7 +160,7 @@ public: * @param aABPosition = position in A,B plotter axis * @return The given position in X,Y axis. */ - wxPoint GetXYPosition( const wxPoint& aABPosition ) const; + VECTOR2I GetXYPosition( const VECTOR2I& aABPosition ) const; /** * Return the GetDcodeDescr of this object, or NULL. @@ -176,7 +171,7 @@ public: const EDA_RECT GetBoundingBox() const override; - void Print( wxDC* aDC, const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aOptions ); + void Print( wxDC* aDC, const VECTOR2I& aOffset, GBR_DISPLAY_OPTIONS* aOptions ); /** * Convert a line to an equivalent polygon. @@ -192,7 +187,7 @@ public: /** * Print the polygon stored in m_PolyCorners. */ - void PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const wxPoint& aOffset, + void PrintGerberPoly( wxDC* aDC, const COLOR4D& aColor, const VECTOR2I& aOffset, bool aFilledShape ); int Shape() const { return m_Shape; } @@ -207,7 +202,7 @@ public: * @param aRefPos a wxPoint to test * @return bool - true if a hit, else false */ - bool HitTest( const wxPoint& aRefPos, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aRefPos, int aAccuracy = 0 ) const override; /** * Test if the given wxRect intersect this object. @@ -253,10 +248,10 @@ public: bool m_UnitsMetric; // store here the gerber units (inch/mm). Used // only to calculate aperture macros shapes sizes int m_Shape; // Shape and type of this gerber item - wxPoint m_Start; // Line or arc start point or position of the shape + VECTOR2I m_Start; // Line or arc start point or position of the shape // for flashed items - wxPoint m_End; // Line or arc end point - wxPoint m_ArcCentre; // for arcs only: Center of arc + VECTOR2I m_End; // Line or arc end point + VECTOR2I m_ArcCentre; // for arcs only: Center of arc SHAPE_POLY_SET m_Polygon; // Polygon shape data (G36 to G37 coordinates) // or for complex shapes which are converted to polygon wxSize m_Size; // Flashed shapes: size of the shape diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index c007185f64..8cceb0e473 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -305,8 +305,8 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) // These are swapped because wxDC fills arcs counterclockwise and GAL // fills them clockwise. - wxPoint arcStart = aItem->m_End; - wxPoint arcEnd = aItem->m_Start; + VECTOR2I arcStart = aItem->m_End; + VECTOR2I arcEnd = aItem->m_Start; // Gerber arcs are 3-point (start, center, end) // GAL needs center, radius, start angle, end angle @@ -480,11 +480,11 @@ void GERBVIEW_PAINTER::drawFlashedShape( GERBER_DRAW_ITEM* aItem, bool aFilled ) case GBR_SPOT_RECT: { - wxPoint codeStart; - wxPoint aShapePos = aItem->m_Start; + VECTOR2I codeStart; + VECTOR2I aShapePos = aItem->m_Start; codeStart.x = aShapePos.x - code->m_Size.x / 2; codeStart.y = aShapePos.y - code->m_Size.y / 2; - wxPoint codeEnd = codeStart + code->m_Size; + VECTOR2I codeEnd = codeStart + code->m_Size; codeStart = aItem->GetABPosition( codeStart ); codeEnd = aItem->GetABPosition( codeEnd ); @@ -506,8 +506,8 @@ void GERBVIEW_PAINTER::drawFlashedShape( GERBER_DRAW_ITEM* aItem, bool aFilled ) { int radius = 0; - wxPoint codeStart = aItem->m_Start; - wxPoint codeEnd = aItem->m_Start; + VECTOR2I codeStart = aItem->m_Start; + VECTOR2I codeEnd = aItem->m_Start; if( code->m_Size.x > code->m_Size.y ) // horizontal oval { diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 11f87d01d7..5398777d97 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -341,12 +341,12 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const wxPoint& aStart, cons aGbrItem->SetNetAttributes( aGbrItem->m_GerberImageFile->m_NetAttributeDict ); - wxPoint center; + VECTOR2I center; center = dummyGbrItem.m_ArcCentre; // Calculate coordinates relative to arc center; - wxPoint start = dummyGbrItem.m_Start - center; - wxPoint end = dummyGbrItem.m_End - center; + VECTOR2I start = dummyGbrItem.m_Start - center; + VECTOR2I end = dummyGbrItem.m_End - center; /* Calculate angle arc * angles are in 0.1 deg @@ -379,7 +379,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const wxPoint& aStart, cons for( int ii = 0; ii <= count; ii++ ) { double rot; - wxPoint end_arc = start; + VECTOR2I end_arc = start; if( aClockwise ) rot = ii * increment_angle; // rot is in 0.1 deg @@ -387,11 +387,11 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, const wxPoint& aStart, cons rot = ( count - ii ) * increment_angle; // rot is in 0.1 deg if( ii < count ) - RotatePoint( &end_arc, -rot ); + RotatePoint( end_arc, -rot ); else // last point end_arc = aClockwise ? end : start; - aGbrItem->m_Polygon.Append( VECTOR2I( end_arc + center ) ); + aGbrItem->m_Polygon.Append( end_arc + center ); } } diff --git a/include/basic_gal.h b/include/basic_gal.h index 2c3914caeb..8ce68e8a18 100644 --- a/include/basic_gal.h +++ b/include/basic_gal.h @@ -146,7 +146,7 @@ public: } private: - void doDrawPolyline( const std::vector& aLocalPointList ); + void doDrawPolyline( const std::vector& aLocalPointList ); // Apply the rotation/translation transform to aPoint const VECTOR2D transform( const VECTOR2D& aPoint ) const; diff --git a/include/bitmap_base.h b/include/bitmap_base.h index 0afa4dc596..852425ef18 100644 --- a/include/bitmap_base.h +++ b/include/bitmap_base.h @@ -51,7 +51,7 @@ class PLOTTER; class BITMAP_BASE { public: - BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); + BITMAP_BASE( const VECTOR2I& pos = VECTOR2I( 0, 0 ) ); BITMAP_BASE( const BITMAP_BASE& aSchBitmap ); @@ -146,7 +146,7 @@ public: */ const EDA_RECT GetBoundingBox() const; - void DrawBitmap( wxDC* aDC, const wxPoint& aPos ); + void DrawBitmap( wxDC* aDC, const VECTOR2I& aPos ); /** * Reads and stores in memory an image file. @@ -230,7 +230,7 @@ public: * @param aDefaultColor the color used to plot the rectangle when bitmap is not supported. * @param aDefaultPensize the pen size used to plot the rectangle when bitmap is not supported. */ - void PlotImage( PLOTTER* aPlotter, const wxPoint& aPos, + void PlotImage( PLOTTER* aPlotter, const VECTOR2I& aPos, const KIGFX::COLOR4D& aDefaultColor, int aDefaultPensize ) const; private: diff --git a/include/board_item.h b/include/board_item.h index 6d533e8cbc..8c439dbce5 100644 --- a/include/board_item.h +++ b/include/board_item.h @@ -64,13 +64,13 @@ public: // The ones generated by the compiler are adequate. int GetX() const { - wxPoint p = GetPosition(); + VECTOR2I p = GetPosition(); return p.x; } int GetY() const { - wxPoint p = GetPosition(); + VECTOR2I p = GetPosition(); return p.y; } @@ -79,20 +79,20 @@ public: * * @return center point of the item */ - virtual wxPoint GetCenter() const + virtual VECTOR2I GetCenter() const { - return (wxPoint)GetBoundingBox().GetCenter(); + return GetBoundingBox().GetCenter(); } void SetX( int aX ) { - wxPoint p( aX, GetY() ); + VECTOR2I p( aX, GetY() ); SetPosition( p ); } void SetY( int aY ) { - wxPoint p( GetX(), aY ); + VECTOR2I p( GetX(), aY ); SetPosition( p ); } @@ -246,28 +246,18 @@ public: * * @param aMoveVector the move vector for this object. */ - virtual void Move( const wxPoint& aMoveVector ) + virtual void Move( const VECTOR2I& aMoveVector ) { wxFAIL_MSG( "virtual BOARD_ITEM::Move called for " + GetClass() ); } - void Move( const VECTOR2I& aMoveVector ) - { - Move( wxPoint( aMoveVector.x, aMoveVector.y ) ); - } - /** * Rotate this object. * * @param aRotCentre the rotation point. * @param aAngle the rotation angle in 0.1 degree. */ - virtual void Rotate( const wxPoint& aRotCentre, double aAngle ); - - void Rotate( const VECTOR2I& aRotCentre, double aAngle ) - { - Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle ); - } + virtual void Rotate( const VECTOR2I& aRotCentre, double aAngle ); /** * Flip this object, i.e. change the board side for this object. @@ -275,12 +265,7 @@ public: * @param aCentre the rotation point. * @param aFlipLeftRight mirror across Y axis instead of X (the default). */ - virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight ); - - void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) - { - Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight ); - } + virtual void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ); /** * Return the #BOARD in which this #BOARD_ITEM resides, or NULL if none. @@ -358,8 +343,8 @@ public: } // pure virtuals: - void SetPosition( const wxPoint& ) override {} - wxPoint GetPosition() const override { return wxPoint(0, 0); } + void SetPosition( const VECTOR2I& ) override {} + VECTOR2I GetPosition() const override { return VECTOR2I( 0, 0 ); } static DELETED_BOARD_ITEM* GetInstance() { diff --git a/include/collector.h b/include/collector.h index 9543c2eed9..cd80bc8943 100644 --- a/include/collector.h +++ b/include/collector.h @@ -215,7 +215,7 @@ public: m_scanTypes = scanTypes; } - void SetRefPos( const wxPoint& aRefPos ) { m_refPos = aRefPos; } + void SetRefPos( const VECTOR2I& aRefPos ) { m_refPos = aRefPos; } const EDA_RECT& GetBoundingBox() const { return m_refBox; } @@ -249,7 +249,7 @@ protected: const KICAD_T* m_scanTypes; INSPECTOR_FUNC m_inspector; - wxPoint m_refPos; // Reference position used to generate the collection. + VECTOR2I m_refPos; // Reference position used to generate the collection. EDA_RECT m_refBox; // Selection rectangle used to generate the collection.}; }; diff --git a/include/drawing_sheet/ds_data_item.h b/include/drawing_sheet/ds_data_item.h index ba4c57569d..05bc0e5cbb 100644 --- a/include/drawing_sheet/ds_data_item.h +++ b/include/drawing_sheet/ds_data_item.h @@ -134,8 +134,8 @@ public: void SetPage1Option( PAGE_OPTION aChoice ) { m_pageOption = aChoice; } // Coordinate handling - const wxPoint GetStartPosUi( int ii = 0 ) const; - const wxPoint GetEndPosUi( int ii = 0 ) const; + const VECTOR2I GetStartPosUi( int ii = 0 ) const; + const VECTOR2I GetEndPosUi( int ii = 0 ) const; const DPOINT GetStartPos( int ii = 0 ) const; const DPOINT GetEndPos( int ii = 0 ) const; @@ -153,7 +153,7 @@ public: * * @param aPosition the new position of the starting point in graphic units. */ - void MoveToUi( const wxPoint& aPosition ); + void MoveToUi( const VECTOR2I& aPosition ); /** * Move the starting point of the item to a new position. @@ -167,7 +167,7 @@ public: * * @param aPosition is the new position of item in graphic units. */ - void MoveStartPointToUi( const wxPoint& aPosition ); + void MoveStartPointToUi( const VECTOR2I& aPosition ); /** @@ -186,7 +186,7 @@ public: * * @param aPosition is the new position of the ending point in graphic units */ - void MoveEndPointToUi( const wxPoint& aPosition ); + void MoveEndPointToUi( const VECTOR2I& aPosition ); /** * @return true if the item is inside the rectangle defined by the 4 corners, false otherwise. @@ -275,7 +275,7 @@ public: * @return the coordinate (in draw/plot units) of the corner \a aIdx and the repeated * item \a aRepeat */ - const wxPoint GetCornerPositionUi( unsigned aIdx, int aRepeat = 0 ) const; + const VECTOR2I GetCornerPositionUi( unsigned aIdx, int aRepeat = 0 ) const; /** * Calculate the bounding box of the set polygons. diff --git a/include/drawing_sheet/ds_draw_item.h b/include/drawing_sheet/ds_draw_item.h index bc6e80aedd..b375e6c764 100644 --- a/include/drawing_sheet/ds_draw_item.h +++ b/include/drawing_sheet/ds_draw_item.h @@ -65,7 +65,7 @@ public: void ViewGetLayers( int aLayers[], int& aCount ) const override; - virtual void SetEnd( const wxPoint& aPos ) { /* not all types will need this */ } + virtual void SetEnd( const VECTOR2I& aPos ) { /* not all types will need this */ } virtual int GetPenWidth() const { @@ -78,17 +78,17 @@ public: // The function to print a WS_DRAW_ITEM virtual void PrintWsItem( const RENDER_SETTINGS* aSettings ) { - PrintWsItem( aSettings, wxPoint( 0, 0 ) ); + PrintWsItem( aSettings, VECTOR2I( 0, 0 ) ); } // More advanced version of DrawWsItem. This is what must be defined in the derived type. - virtual void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0; + virtual void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) = 0; // Derived types must define GetBoundingBox() as a minimum, and can then override the // two HitTest() functions if they need something more specific. const EDA_RECT GetBoundingBox() const override = 0; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { // This is just here to prevent annoying compiler warnings about hidden overloaded // virtual functions @@ -119,7 +119,7 @@ protected: class DS_DRAW_ITEM_LINE : public DS_DRAW_ITEM_BASE { public: - DS_DRAW_ITEM_LINE( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aStart, wxPoint aEnd, + DS_DRAW_ITEM_LINE( DS_DATA_ITEM* aPeer, int aIndex, VECTOR2I aStart, VECTOR2I aEnd, int aPenWidth ) : DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_LINE_T ) { @@ -130,18 +130,18 @@ public: virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_LINE" ); } - const wxPoint& GetStart() const { return m_start; } - void SetStart( const wxPoint& aPos ) { m_start = aPos; } - const wxPoint& GetEnd() const { return m_end; } - void SetEnd( const wxPoint& aPos ) override { m_end = aPos; } + const VECTOR2I& GetStart() const { return m_start; } + void SetStart( const VECTOR2I& aPos ) { m_start = aPos; } + const VECTOR2I& GetEnd() const { return m_end; } + void SetEnd( const VECTOR2I& aPos ) override { m_end = aPos; } - wxPoint GetPosition() const override { return GetStart(); } - void SetPosition( const wxPoint& aPos ) override { SetStart( aPos ); } + VECTOR2I GetPosition() const override { return GetStart(); } + void SetPosition( const VECTOR2I& aPos ) override { SetStart( aPos ); } const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; - void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -150,15 +150,15 @@ public: #endif private: - wxPoint m_start; // start point of line/rect - wxPoint m_end; // end point + VECTOR2I m_start; // start point of line/rect + VECTOR2I m_end; // end point }; class DS_DRAW_ITEM_POLYPOLYGONS : public DS_DRAW_ITEM_BASE { public: - DS_DRAW_ITEM_POLYPOLYGONS( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos, int aPenWidth ) : + DS_DRAW_ITEM_POLYPOLYGONS( DS_DATA_ITEM* aPeer, int aIndex, VECTOR2I aPos, int aPenWidth ) : DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_POLY_T ) { m_penWidth = aPenWidth; @@ -168,14 +168,15 @@ public: virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_POLYPOLYGONS" ); } SHAPE_POLY_SET& GetPolygons() { return m_Polygons; } - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPos ) override; + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPos ) override; const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; - void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -194,8 +195,8 @@ public: private: - wxPoint m_pos; // position of reference point, from the DS_DATA_ITEM_POLYGONS parent - // (used only in drawing sheet editor to draw anchors) + VECTOR2I m_pos; // position of reference point, from the DS_DATA_ITEM_POLYGONS parent + // (used only in drawing sheet editor to draw anchors) }; @@ -205,7 +206,7 @@ private: class DS_DRAW_ITEM_RECT : public DS_DRAW_ITEM_BASE { public: - DS_DRAW_ITEM_RECT( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aStart, wxPoint aEnd, + DS_DRAW_ITEM_RECT( DS_DATA_ITEM* aPeer, int aIndex, VECTOR2I aStart, VECTOR2I aEnd, int aPenWidth ) : DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_RECT_T ) { @@ -216,18 +217,19 @@ public: virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_RECT" ); } - const wxPoint& GetStart() const { return m_start; } - void SetStart( const wxPoint& aPos ) { m_start = aPos; } - const wxPoint& GetEnd() const { return m_end; } - void SetEnd( const wxPoint& aPos ) override { m_end = aPos; } + const VECTOR2I& GetStart() const { return m_start; } + void SetStart( const VECTOR2I& aPos ) { m_start = aPos; } + const VECTOR2I& GetEnd() const { return m_end; } + void SetEnd( const VECTOR2I& aPos ) override { m_end = aPos; } - wxPoint GetPosition() const override { return GetStart(); } - void SetPosition( const wxPoint& aPos ) override { SetStart( aPos ); } + VECTOR2I GetPosition() const override { return GetStart(); } + void SetPosition( const VECTOR2I& aPos ) override { SetStart( aPos ); } - void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -237,8 +239,8 @@ public: #endif private: - wxPoint m_start; // start point of line/rect - wxPoint m_end; // end point + VECTOR2I m_start; // start point of line/rect + VECTOR2I m_end; // end point }; @@ -261,19 +263,21 @@ public: virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_PAGE" ); } - void SetPageSize( const wxSize& aSize ) { m_pageSize = aSize; } - wxSize GetPageSize() const { return m_pageSize; } - const wxPoint& GetMarkerPos() const { return m_markerPos; } - void SetMarkerPos( const wxPoint& aPos ) { m_markerPos = aPos; } + void SetPageSize( const VECTOR2I& aSize ) { m_pageSize = aSize; } + VECTOR2I GetPageSize() const { return m_pageSize; } + + const VECTOR2I& GetMarkerPos() const { return m_markerPos; } + void SetMarkerPos( const VECTOR2I& aPos ) { m_markerPos = aPos; } + double GetMarkerSize() const { return m_markerSize; } - wxPoint GetPosition() const override { return wxPoint( 0, 0 ); } - void SetPosition( const wxPoint& aPos ) override { /* do nothing */ } + VECTOR2I GetPosition() const override { return VECTOR2I( 0, 0 ); } + void SetPosition( const VECTOR2I& aPos ) override { /* do nothing */ } - void PrintWsItem( const RENDER_SETTINGS* , const wxPoint& ) override { /* do nothing */ } + void PrintWsItem( const RENDER_SETTINGS* , const VECTOR2I& ) override { /* do nothing */ } const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override { return false; } + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { return false; } wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -282,8 +286,8 @@ public: #endif private: - wxPoint m_markerPos; // position of the marker - wxSize m_pageSize; // full size of the page + VECTOR2I m_markerPos; // position of the marker + VECTOR2I m_pageSize; // full size of the page double m_markerSize; }; @@ -297,14 +301,14 @@ private: class DS_DRAW_ITEM_TEXT : public DS_DRAW_ITEM_BASE, public EDA_TEXT { public: - DS_DRAW_ITEM_TEXT( DS_DATA_ITEM* aPeer, int aIndex, const wxString& aText, const wxPoint& aPos, - const wxSize& aSize, int aPenWidth, bool aItalic = false, + DS_DRAW_ITEM_TEXT( DS_DATA_ITEM* aPeer, int aIndex, const wxString& aText, const VECTOR2I& aPos, + const VECTOR2I& aSize, int aPenWidth, bool aItalic = false, bool aBold = false ) : DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_TEXT_T), EDA_TEXT( aText ) { SetTextPos( aPos ); - SetTextSize( aSize ); + SetTextSize( (wxSize) aSize ); SetTextThickness( aPenWidth ); SetItalic( aItalic ); SetBold( aBold ); @@ -312,15 +316,16 @@ public: virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_TEXT" ); } - void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; void SetTextAngle( double aAngle ) override; - wxPoint GetPosition() const override { return (wxPoint)GetTextPos(); } - void SetPosition( const wxPoint& aPos ) override { SetTextPos( aPos ); } + VECTOR2I GetPosition() const override { return GetTextPos(); } + void SetPosition( const VECTOR2I& aPos ) override { SetTextPos( aPos ); } const EDA_RECT GetBoundingBox() const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -337,7 +342,7 @@ public: class DS_DRAW_ITEM_BITMAP : public DS_DRAW_ITEM_BASE { public: - DS_DRAW_ITEM_BITMAP( DS_DATA_ITEM* aPeer, int aIndex, wxPoint aPos ) : + DS_DRAW_ITEM_BITMAP( DS_DATA_ITEM* aPeer, int aIndex, VECTOR2I aPos ) : DS_DRAW_ITEM_BASE( aPeer, aIndex, WSG_BITMAP_T ) { m_pos = aPos; @@ -347,12 +352,12 @@ public: virtual wxString GetClass() const override { return wxT( "DS_DRAW_ITEM_BITMAP" ); } - wxPoint GetPosition() const override { return m_pos; } - void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; } + VECTOR2I GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPos ) override { m_pos = aPos; } - void PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; + void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; const EDA_RECT GetBoundingBox() const override; @@ -363,7 +368,7 @@ public: #endif private: - wxPoint m_pos; // position of reference point + VECTOR2I m_pos; // position of reference point }; diff --git a/include/drawing_sheet/ds_proxy_view_item.h b/include/drawing_sheet/ds_proxy_view_item.h index b9e4723570..af88bdf136 100644 --- a/include/drawing_sheet/ds_proxy_view_item.h +++ b/include/drawing_sheet/ds_proxy_view_item.h @@ -121,7 +121,7 @@ public: return wxT( "DS_PROXY_VIEW_ITEM" ); } - bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const wxPoint& aPosition ); + bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const VECTOR2I& aPosition ); protected: void buildDrawList( KIGFX::VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const; diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index 084066301a..8e8091a880 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -144,7 +144,7 @@ public: * @param aPosition The position to check. * @return The nearest grid position. */ - wxPoint GetNearestGridPosition( const wxPoint& aPosition ) const; + VECTOR2I GetNearestGridPosition( const VECTOR2I& aPosition ) const; /** * Return the nearest \a aGridSize / 2 location to \a aPosition. @@ -155,7 +155,7 @@ public: * @param aPosition The position to check. * @return The nearest half-grid position. */ - wxPoint GetNearestHalfGridPosition( const wxPoint& aPosition ) const; + VECTOR2I GetNearestHalfGridPosition( const VECTOR2I& aPosition ) const; virtual const TITLE_BLOCK& GetTitleBlock() const = 0; virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0; @@ -291,7 +291,7 @@ public: * * @param aPos is the point to go to. */ - void FocusOnLocation( const wxPoint& aPos ); + void FocusOnLocation( const VECTOR2I& aPos ); /** * Construct a "basic" menu for a tool, containing only items that apply to all tools diff --git a/include/eda_item.h b/include/eda_item.h index d833fa6349..e1743b1921 100644 --- a/include/eda_item.h +++ b/include/eda_item.h @@ -217,11 +217,11 @@ public: /** * Test if \a aPosition is inside or on the boundary of this item. * - * @param aPosition A reference to a wxPoint object containing the coordinates to test. + * @param aPosition A reference to a VECTOR2I object containing the coordinates to test. * @param aAccuracy Increase the item bounding box by this amount. * @return True if \a aPosition is within the item bounding box. */ - virtual bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const + virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const { return false; // derived classes should override this function } @@ -248,14 +248,14 @@ public: */ virtual const EDA_RECT GetBoundingBox() const; - virtual wxPoint GetPosition() const { return wxPoint(); } - virtual void SetPosition( const wxPoint& aPos ) {}; + virtual VECTOR2I GetPosition() const { return VECTOR2I(); } + virtual void SetPosition( const VECTOR2I& aPos ){}; /** * Similar to GetPosition, but allows items to return their visual center rather * than their anchor. */ - virtual const wxPoint GetFocusPosition() const { return GetPosition(); } + virtual const VECTOR2I GetFocusPosition() const { return GetPosition(); } /** * Create a duplicate of this item with linked list members set to NULL. diff --git a/include/eda_rect.h b/include/eda_rect.h index 45e164854e..f7fc831638 100644 --- a/include/eda_rect.h +++ b/include/eda_rect.h @@ -257,12 +257,12 @@ public: /** * Return the point in this rect that is closest to the provided point */ - const wxPoint ClosestPointTo( const wxPoint& aPoint ) const; + const VECTOR2I ClosestPointTo( const VECTOR2I& aPoint ) const; /** * Return the point in this rect that is farthest from the provided point */ - const wxPoint FarthestPointTo( const wxPoint& aPoint ) const; + const VECTOR2I FarthestPointTo( const VECTOR2I& aPoint ) const; /** * Test for a common area between a circle and this rectangle. @@ -270,7 +270,7 @@ public: * @param aCenter center of the circle. * @param aRadius radius of the circle. */ - bool IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const; + bool IntersectsCircle( const VECTOR2I& aCenter, const int aRadius ) const; /** * Test for intersection between this rect and the edge (radius) of a circle. @@ -279,7 +279,7 @@ public: * @param aRadius radius of the circle. * @param aWidth width of the circle edge. */ - bool IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, const int aWidth ) const; + bool IntersectsCircleEdge( const VECTOR2I& aCenter, const int aRadius, const int aWidth ) const; /** * Overload the cast operator to return a wxRect. @@ -331,7 +331,7 @@ public: * * @param aPoint The point to merge with the rectangle. */ - void Merge( const wxPoint& aPoint ); + void Merge( const VECTOR2I& aPoint ); /** * Return the area of the rectangle. diff --git a/include/eda_shape.h b/include/eda_shape.h index 5b94203a2c..d5e8ae2960 100644 --- a/include/eda_shape.h +++ b/include/eda_shape.h @@ -102,11 +102,11 @@ public: /** * Return the starting point of the graphic. */ - const wxPoint& GetStart() const { return m_start; } - int GetStartY() { return m_start.y; } - int GetStartX() { return m_start.x; } + const VECTOR2I& GetStart() const { return m_start; } + int GetStartY() { return m_start.y; } + int GetStartX() { return m_start.x; } - void SetStart( const wxPoint& aStart ) + void SetStart( const VECTOR2I& aStart ) { m_start = aStart; m_endsSwapped = false; @@ -127,11 +127,11 @@ public: /** * Return the ending point of the graphic. */ - const wxPoint& GetEnd() const { return m_end; } - int GetEndY() { return m_end.y; } - int GetEndX() { return m_end.x; } + const VECTOR2I& GetEnd() const { return m_end; } + int GetEndY() { return m_end.y; } + int GetEndX() { return m_end.x; } - void SetEnd( const wxPoint& aEnd ) + void SetEnd( const VECTOR2I& aEnd ) { m_end = aEnd; m_endsSwapped = false; @@ -149,14 +149,14 @@ public: m_endsSwapped = false; } - void SetBezierC1( const wxPoint& aPt ) { m_bezierC1 = aPt; } - const wxPoint& GetBezierC1() const { return m_bezierC1; } + void SetBezierC1( const VECTOR2I& aPt ) { m_bezierC1 = aPt; } + const VECTOR2I& GetBezierC1() const { return m_bezierC1; } - void SetBezierC2( const wxPoint& aPt ) { m_bezierC2 = aPt; } - const wxPoint& GetBezierC2() const { return m_bezierC2; } + void SetBezierC2( const VECTOR2I& aPt ) { m_bezierC2 = aPt; } + const VECTOR2I& GetBezierC2() const { return m_bezierC2; } - wxPoint getCenter() const; - void SetCenter( const wxPoint& aCenter ); + VECTOR2I getCenter() const; + void SetCenter( const VECTOR2I& aCenter ); /** * Set the end point from the angle center and start. @@ -176,8 +176,8 @@ public: // Some attributes are read only, since they are derived from m_Start, m_End, and m_Angle. // No Set...() function for these attributes. - wxPoint GetArcMid() const; - std::vector GetRectCorners() const; + VECTOR2I GetArcMid() const; + std::vector GetRectCorners() const; /** * Calc arc start and end angles such that aStartAngle < aEndAngle. Each may be between @@ -193,18 +193,18 @@ public: * NB: these are NOT what's currently stored, so we have to do some calculations behind * the scenes. However, they are what SHOULD be stored. */ - void SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd ); + void SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ); - const std::vector& GetBezierPoints() const { return m_bezierPoints; } + const std::vector& GetBezierPoints() const { return m_bezierPoints; } /** - * Duplicate the list of corners in a std::vector + * Duplicate the list of corners in a std::vector * * It must be used only to convert the SHAPE_POLY_SET internal corner buffer - * to a list of wxPoints, and nothing else, because it duplicates the buffer, + * to a list of VECTOR2Is, and nothing else, because it duplicates the buffer, * that is inefficient to know for instance the corner count */ - void DupPolyPointsList( std::vector& aBuffer ) const; + void DupPolyPointsList( std::vector& aBuffer ) const; /** * @return the number of corners of the polygonal shape @@ -234,7 +234,7 @@ public: */ void RebuildBezierToSegmentsPointsList( int aMinSegLen ); - void SetPolyPoints( const std::vector& aPoints ); + void SetPolyPoints( const std::vector& aPoints ); /** * Make a set of SHAPE objects representing the EDA_SHAPE. Caller owns the objects. @@ -273,53 +273,53 @@ public: int Compare( const EDA_SHAPE* aOther ) const; protected: - void setPosition( const wxPoint& aPos ); - wxPoint getPosition() const; + void setPosition( const VECTOR2I& aPos ); + VECTOR2I getPosition() const; - void move( const wxPoint& aMoveVector ); - void rotate( const wxPoint& aRotCentre, double aAngle ); - void flip( const wxPoint& aCentre, bool aFlipLeftRight ); + void move( const VECTOR2I& aMoveVector ); + void rotate( const VECTOR2I& aRotCentre, double aAngle ); + void flip( const VECTOR2I& aCentre, bool aFlipLeftRight ); void scale( double aScale ); // To be implemented by concrete classes virtual double getParentOrientation() const = 0; - virtual wxPoint getParentPosition() const = 0; + virtual VECTOR2I getParentPosition() const = 0; const EDA_RECT getBoundingBox() const; void computeArcBBox( EDA_RECT& aBBox ) const; - bool hitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const; + bool hitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const; bool hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const; - const std::vector buildBezierToSegmentsPointsList( int aMinSegLen ) const; + const std::vector buildBezierToSegmentsPointsList( int aMinSegLen ) const; - void beginEdit( const wxPoint& aStartPoint ); - bool continueEdit( const wxPoint& aPosition ); - void calcEdit( const wxPoint& aPosition ); + void beginEdit( const VECTOR2I& aStartPoint ); + bool continueEdit( const VECTOR2I& aPosition ); + void calcEdit( const VECTOR2I& aPosition ); void endEdit(); void setEditState( int aState ) { m_editState = aState; } protected: - bool m_endsSwapped; // true if start/end were swapped e.g. SetArcAngleAndEnd - SHAPE_T m_shape; // Shape: line, Circle, Arc - STROKE_PARAMS m_stroke; // Line style, width, etc. - FILL_T m_fill; - COLOR4D m_fillColor; + bool m_endsSwapped; // true if start/end were swapped e.g. SetArcAngleAndEnd + SHAPE_T m_shape; // Shape: line, Circle, Arc + STROKE_PARAMS m_stroke; // Line style, width, etc. + FILL_T m_fill; + COLOR4D m_fillColor; - wxPoint m_start; // Line start point or Circle center - wxPoint m_end; // Line end point or Circle 3 o'clock point + VECTOR2I m_start; // Line start point or Circle center + VECTOR2I m_end; // Line end point or Circle 3 o'clock point - wxPoint m_arcCenter; // Used only for Arcs: arc end point + VECTOR2I m_arcCenter; // Used only for Arcs: arc end point - wxPoint m_bezierC1; // Bezier Control Point 1 - wxPoint m_bezierC2; // Bezier Control Point 2 + VECTOR2I m_bezierC1; // Bezier Control Point 1 + VECTOR2I m_bezierC2; // Bezier Control Point 2 - std::vector m_bezierPoints; - SHAPE_POLY_SET m_poly; // Stores the S_POLYGON shape + std::vector m_bezierPoints; + SHAPE_POLY_SET m_poly; // Stores the S_POLYGON shape - int m_editState; - bool m_eeWinding; // Awful hack + int m_editState; + bool m_eeWinding; // Awful hack }; #endif // EDA_SHAPE_H diff --git a/include/eda_text.h b/include/eda_text.h index dbc32beaff..ad44743c77 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -230,7 +230,7 @@ public: void SetTextX( int aX ) { m_pos.x = aX; } void SetTextY( int aY ) { m_pos.y = aY; } - void Offset( const wxPoint& aOffset ) { m_pos += aOffset; } + void Offset( const VECTOR2I& aOffset ) { m_pos += aOffset; } void Empty() { m_text.Empty(); } @@ -246,7 +246,7 @@ public: * @param aColor text color. * @param aDisplay_mode #FILLED or #SKETCH. */ - void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, + void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, const COLOR4D& aColor, OUTLINE_MODE aDisplay_mode = FILLED ); /** @@ -255,7 +255,7 @@ public: * Each segment is stored as 2 wxPoints: the starting point and the ending point * there are therefore 2*n points. */ - std::vector TransformToSegmentList() const; + std::vector TransformToSegmentList() const; /** * Convert the text bounding box to a rectangular polygon depending on the text @@ -280,7 +280,7 @@ public: * @param aAccuracy Amount to inflate the bounding box. * @return true if a hit, else false. */ - virtual bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const; + virtual bool TextHitTest( const VECTOR2I& aPoint, int aAccuracy = 0 ) const; /** * Test if object bounding box is contained within or intersects \a aRect. @@ -333,7 +333,7 @@ public: * @param aPositions is the list to populate by the wxPoint positions. * @param aLineCount is the number of lines (not recalculated here for efficiency reasons. */ - void GetLinePositions( std::vector& aPositions, int aLineCount ) const; + void GetLinePositions( std::vector& aPositions, int aLineCount ) const; /** * Output the object to \a aFormatter in s-expression form. @@ -346,7 +346,7 @@ public: virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const; virtual EDA_ANGLE GetDrawRotation() const { return GetTextAngle(); } - virtual wxPoint GetDrawPos() const { return (wxPoint)GetTextPos(); } + virtual VECTOR2I GetDrawPos() const { return GetTextPos(); } virtual GR_TEXT_H_ALIGN_T GetDrawHorizJustify() const { return GetHorizJustify(); }; virtual GR_TEXT_V_ALIGN_T GetDrawVertJustify() const { return GetVertJustify(); }; diff --git a/include/gr_basic.h b/include/gr_basic.h index 52abab3516..827290b168 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -88,14 +88,14 @@ void GRForceBlackPen( bool flagforce ); */ bool GetGRForceBlackPenState( void ); -void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, - const COLOR4D& aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID ); +void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + int aWidth, const COLOR4D& aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID ); void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, const COLOR4D& Color, wxPenStyle aStyle = wxPENSTYLE_SOLID ); void GRMoveTo( int x, int y ); void GRLineTo( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int width, const COLOR4D& Color ); -void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width, +void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width, const COLOR4D& Color, const COLOR4D& BgColor ); /** @@ -110,7 +110,7 @@ void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fil * @param aPenColor the color of the border. * @param aFillColor the fill color of the polygon's interior. */ -void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints, +void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const VECTOR2I* aPoints, bool doFill, const COLOR4D& aPenColor, const COLOR4D& aFillColor ); // @todo could make these 2 closed polygons calls a single function and default @@ -129,7 +129,7 @@ void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* * @param aPenColor the color of the border. * @param aFillColor the fill color of the polygon's interior. */ -void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints, +void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const VECTOR2I* aPoints, bool doFill, int aPenWidth, const COLOR4D& aPenColor, const COLOR4D& aFillColor ); @@ -148,9 +148,9 @@ void GRClosedPoly( EDA_RECT* ClipBox, wxDC* aDC, int aPointCount, const wxPoint* void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, const COLOR4D& Color ); void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, const COLOR4D& Color, const COLOR4D& BgColor ); -void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, +void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, const COLOR4D& aColor ); -void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth, +void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, int aWidth, const COLOR4D& aColor ); void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, @@ -159,21 +159,22 @@ void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle, int r, int width, const COLOR4D& Color ); void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, const COLOR4D& Color ); -void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, - const wxPoint& aCenter, int aWidth, const COLOR4D& aColor ); -void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const wxPoint& aStart, const wxPoint& aEnd, - const wxPoint& aCenter, int width, const COLOR4D& Color, const COLOR4D& BgColor ); +void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + const VECTOR2I& aCenter, int aWidth, const COLOR4D& aColor ); +void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I& aStart, const VECTOR2I& aEnd, + const VECTOR2I& aCenter, int width, const COLOR4D& Color, + const COLOR4D& BgColor ); void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, const COLOR4D& Color ); -void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, - int width, const COLOR4D& Color ); -void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, +void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, + const COLOR4D& Color ); +void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth, const COLOR4D& aColor ); void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, int aPenSize, const COLOR4D& Color ); -void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, +void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, int aWidth, const COLOR4D& aColor ); void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, diff --git a/include/marker_base.h b/include/marker_base.h index d95e869082..6d983c8e88 100644 --- a/include/marker_base.h +++ b/include/marker_base.h @@ -79,12 +79,12 @@ public: /** * Print the shape is the polygon defined in m_Corners (array of wxPoints). */ - void PrintMarker( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ); + void PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ); /** * @return the position of this marker in internal units. */ - const wxPoint& GetPos() const { return m_Pos; } + const VECTOR2I& GetPos() const { return m_Pos; } virtual const KIID GetUUID() const = 0; @@ -110,7 +110,7 @@ public: * @param aHitPosition is the wxPoint to test (in internal units). * @return true if a hit, else false. */ - bool HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) const; + bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const; /** * Return the orthogonal, bounding box of this object for display purposes. @@ -125,7 +125,7 @@ protected: virtual KIGFX::COLOR4D getColor() const = 0; public: - wxPoint m_Pos; ///< position of the marker + VECTOR2I m_Pos; ///< position of the marker protected: TYPEMARKER m_markerType; // The type of marker (useful to filter markers) diff --git a/include/origin_viewitem.h b/include/origin_viewitem.h index 7093e07036..9c8afb3bcf 100644 --- a/include/origin_viewitem.h +++ b/include/origin_viewitem.h @@ -94,14 +94,14 @@ public: m_drawAtZero = aDrawFlag; } - void SetPosition( const wxPoint& aPosition ) override + void SetPosition( const VECTOR2I& aPosition ) override { m_position = VECTOR2D( aPosition ); } - wxPoint GetPosition() const override + VECTOR2I GetPosition() const override { - return wxPoint( m_position.x, m_position.y ); + return VECTOR2I( m_position.x, m_position.y ); } inline void SetEndPosition( const VECTOR2D& aPosition ) diff --git a/include/pcb_group.h b/include/pcb_group.h index d658f31985..5fba9225ad 100644 --- a/include/pcb_group.h +++ b/include/pcb_group.h @@ -110,10 +110,10 @@ public: #endif ///< @copydoc EDA_ITEM::GetPosition - wxPoint GetPosition() const override; + VECTOR2I GetPosition() const override; ///< @copydoc EDA_ITEM::SetPosition - void SetPosition( const wxPoint& aNewpos ) override; + void SetPosition( const VECTOR2I& aNewpos ) override; ///< @copydoc BOARD_ITEM::GetLayerSet LSET GetLayerSet() const override; @@ -152,7 +152,7 @@ public: bool IsOnLayer( PCB_LAYER_ID aLayer ) const override; ///< @copydoc EDA_ITEM::HitTest - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; ///< @copydoc EDA_ITEM::HitTest bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; @@ -171,13 +171,13 @@ public: double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; ///< @copydoc BOARD_ITEM::Move - void Move( const wxPoint& aMoveVector ) override; + void Move( const VECTOR2I& aMoveVector ) override; ///< @copydoc BOARD_ITEM::Rotate - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; ///< @copydoc BOARD_ITEM::Flip - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; ///< @copydoc EDA_ITEM::GetSelectMenuText wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; diff --git a/include/rc_item.h b/include/rc_item.h index e5f744eea3..02ac5cae98 100644 --- a/include/rc_item.h +++ b/include/rc_item.h @@ -27,6 +27,7 @@ #include #include #include +#include class MARKER_BASE; class EDA_BASE_FRAME; @@ -160,7 +161,7 @@ public: /** * Format a coordinate or position to text. */ - static wxString ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos ); + static wxString ShowCoord( EDA_UNITS aUnits, const VECTOR2I& aPos ); protected: int m_errorCode; ///< The error code's numeric value diff --git a/libs/kimath/include/convert_basic_shapes_to_polygon.h b/libs/kimath/include/convert_basic_shapes_to_polygon.h index ee440fe552..c99df66522 100644 --- a/libs/kimath/include/convert_basic_shapes_to_polygon.h +++ b/libs/kimath/include/convert_basic_shapes_to_polygon.h @@ -75,8 +75,8 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa * @param aMinSegCount is the min count of segments to approximate. * Default = 0 to do not force a min count. */ -void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius, - int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 ); +void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I& aCenter, + int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 ); /** * Convert a circle to a polygon, using multiple straight lines. @@ -89,7 +89,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& a * @param aMinSegCount is the min count of segments to approximate. * Default = 0 to do not force a min count. */ -void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius, +void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount = 0 ); @@ -128,10 +128,9 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta * @param aError is the IU allowed for error in approximation. * @param aErrorLoc determines if the approximation error be placed outside or inside the polygon. */ -void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, - const wxPoint& aPosition, const wxSize& aSize, - double aRotation, int aDeltaX, int aDeltaY, int aInflate, - int aError, ERROR_LOC aErrorLoc ); +void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition, + const wxSize& aSize, double aRotation, int aDeltaX, int aDeltaY, + int aInflate, int aError, ERROR_LOC aErrorLoc ); /** * Convert a rectangle with rounded corners and/or chamfered corners to a polygon. @@ -173,8 +172,8 @@ void TransformRoundChamferedRectToPolygon( SHAPE_POLY_SET& aCornerBuffer, * @param aError is the internal units allowed for error in approximation. * @param aErrorLoc determines if the approximation error be placed outside or inside the polygon. */ -void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart, - const wxPoint& aMid, const wxPoint& aEnd, int aWidth, int aError, +void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart, + const VECTOR2I& aMid, const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc ); /** @@ -187,7 +186,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart * @param aError is the internal units allowed for error in approximation. * @param aErrorLoc determines if the approximation error be placed outside or inside the polygon. */ -void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius, +void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCentre, int aRadius, int aWidth, int aError, ERROR_LOC aErrorLoc ); #endif // CONVERT_BASIC_SHAPES_TO_POLYGON_H diff --git a/libs/kimath/include/trigo.h b/libs/kimath/include/trigo.h index b3ddb4aa9f..757a5ce0a9 100644 --- a/libs/kimath/include/trigo.h +++ b/libs/kimath/include/trigo.h @@ -41,8 +41,8 @@ * * @return true if the point is on the line segment. */ -bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd, - const wxPoint& aTestPoint ); +bool IsPointOnSegment( const VECTOR2I& aSegStart, const VECTOR2I& aSegEnd, + const VECTOR2I& aTestPoint ); /** * Test if two lines intersect. @@ -188,8 +188,8 @@ inline double EuclideanNorm( const VECTOR2I& vector ) //! @param linePointA Point on line //! @param linePointB Point on line //! @param referencePoint Reference point -inline double DistanceLinePoint( const wxPoint& linePointA, const wxPoint& linePointB, - const wxPoint& referencePoint ) +inline double DistanceLinePoint( const VECTOR2I& linePointA, const VECTOR2I& linePointB, + const VECTOR2I& referencePoint ) { // Some of the multiple double casts are redundant. However in the previous // definition the cast was (implicitly) done too late, just before @@ -208,9 +208,9 @@ inline double DistanceLinePoint( const wxPoint& linePointA, const wxPoint& lineP //! @param pointB Second point //! @param threshold The maximum distance //! @return True or false -inline bool HitTestPoints( const wxPoint& pointA, const wxPoint& pointB, double threshold ) +inline bool HitTestPoints( const VECTOR2I& pointA, const VECTOR2I& pointB, double threshold ) { - wxPoint vectorAB = pointB - pointA; + VECTOR2I vectorAB = pointB - pointA; // Compare the distances squared. The double is needed to avoid // overflow during int multiplication @@ -252,6 +252,19 @@ inline double GetLineLength( const wxPoint& aPointA, const wxPoint& aPointB ) return hypot( aPointA.x - aPointB.x, aPointA.y - aPointB.y ); } +/** + * Return the length of a line segment defined by \a aPointA and \a aPointB. + * + * See also EuclideanNorm and Distance for the single vector or four scalar versions. + * + * @return Length of a line (as double) + */ +inline double GetLineLength( const VECTOR2I& aPointA, const VECTOR2I& aPointB ) +{ + // Implicitly casted to double + return hypot( aPointA.x - aPointB.x, aPointA.y - aPointB.y ); +} + // These are the usual degrees <-> radians conversion routines inline double DEG2RAD( double deg ) { return deg * M_PI / 180.0; } inline double RAD2DEG( double rad ) { return rad * 180.0 / M_PI; } diff --git a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp index 6d9aa892e1..31fbec68cf 100644 --- a/libs/kimath/src/convert_basic_shapes_to_polygon.cpp +++ b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp @@ -39,10 +39,10 @@ #include -void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& aCenter, int aRadius, - int aError, ERROR_LOC aErrorLoc, int aMinSegCount ) +void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const VECTOR2I& aCenter, + int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount ) { - wxPoint corner_position; + VECTOR2I corner_position; int numSegs = GetArcToSegmentCount( aRadius, aError, 360.0 ); numSegs = std::max( aMinSegCount, numSegs ); @@ -69,7 +69,7 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& a { corner_position.x = radius; corner_position.y = 0; - RotatePoint( &corner_position, angle ); + RotatePoint( corner_position, angle ); corner_position += aCenter; aCornerBuffer.Append( corner_position.x, corner_position.y ); } @@ -78,12 +78,12 @@ void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aCornerBuffer, const wxPoint& a } -void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCenter, int aRadius, +void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount ) { - wxPoint corner_position; - int numSegs = GetArcToSegmentCount( aRadius, aError, 360.0 ); - numSegs = std::max( aMinSegCount, numSegs); + VECTOR2I corner_position; + int numSegs = GetArcToSegmentCount( aRadius, aError, 360.0 ); + numSegs = std::max( aMinSegCount, numSegs ); // The shape will be built with a even number of segs. Reason: the horizontal // diameter begins and ends to points on the actual circle, or circle @@ -110,7 +110,7 @@ void TransformCircleToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCe { corner_position.x = radius; corner_position.y = 0; - RotatePoint( &corner_position, angle ); + RotatePoint( corner_position, angle ); corner_position += aCenter; aCornerBuffer.Append( corner_position.x, corner_position.y ); } @@ -361,7 +361,7 @@ void CornerListRemoveDuplicates( std::vector& aCorners ) } -void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aPosition, +void TransformTrapezoidToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aPosition, const wxSize& aSize, double aRotation, int aDeltaX, int aDeltaY, int aInflate, int aError, ERROR_LOC aErrorLoc ) { @@ -532,8 +532,8 @@ int ConvertArcToPolyline( SHAPE_LINE_CHAIN& aPolyline, VECTOR2I aCenter, int aRa } -void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart, - const wxPoint& aMid, const wxPoint& aEnd, int aWidth, +void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aStart, + const VECTOR2I& aMid, const VECTOR2I& aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc ) { SHAPE_ARC arc( aStart, aMid, aEnd, aWidth ); @@ -665,7 +665,7 @@ void TransformArcToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aStart } -void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const wxPoint& aCentre, int aRadius, +void TransformRingToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aCentre, int aRadius, int aWidth, int aError, ERROR_LOC aErrorLoc ) { int inner_radius = aRadius - ( aWidth / 2 ); diff --git a/libs/kimath/src/trigo.cpp b/libs/kimath/src/trigo.cpp index 7b9a825460..c9c4fd523e 100644 --- a/libs/kimath/src/trigo.cpp +++ b/libs/kimath/src/trigo.cpp @@ -39,11 +39,11 @@ // Returns true if the point P is on the segment S. // faster than TestSegmentHit() because P should be exactly on S // therefore works fine only for H, V and 45 deg segm (suitable for wires in eeschema) -bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd, - const wxPoint& aTestPoint ) +bool IsPointOnSegment( const VECTOR2I& aSegStart, const VECTOR2I& aSegEnd, + const VECTOR2I& aTestPoint ) { - wxPoint vectSeg = aSegEnd - aSegStart; // Vector from S1 to S2 - wxPoint vectPoint = aTestPoint - aSegStart; // Vector from S1 to P + VECTOR2I vectSeg = aSegEnd - aSegStart; // Vector from S1 to S2 + VECTOR2I vectPoint = aTestPoint - aSegStart; // Vector from S1 to P // Use long long here to avoid overflow in calculations if( (long long) vectSeg.x * vectPoint.y - (long long) vectSeg.y * vectPoint.x ) diff --git a/pagelayout_editor/pl_draw_panel_gal.cpp b/pagelayout_editor/pl_draw_panel_gal.cpp index c0fffa2d4a..bfc714a639 100644 --- a/pagelayout_editor/pl_draw_panel_gal.cpp +++ b/pagelayout_editor/pl_draw_panel_gal.cpp @@ -126,7 +126,7 @@ void PL_DRAW_PANEL_GAL::DisplayDrawingSheet() m_view->SetBoundary( boundary ); m_pageDrawItem->SetPageSize( m_edaFrame->GetPageSizeIU() ); - wxPoint originCoord = static_cast( m_edaFrame )->ReturnCoordOriginCorner(); + VECTOR2I originCoord = static_cast( m_edaFrame )->ReturnCoordOriginCorner(); m_pageDrawItem->SetMarkerPos( originCoord ); } diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index feed8a0963..19d4f7b031 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -193,7 +193,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // Add the exit key handler setupUnits( config() ); - wxPoint originCoord = ReturnCoordOriginCorner(); + VECTOR2I originCoord = ReturnCoordOriginCorner(); SetGridOrigin( originCoord ); // Initialize the current drawing sheet @@ -612,11 +612,11 @@ void PL_EDITOR_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVar } -wxPoint PL_EDITOR_FRAME::ReturnCoordOriginCorner() const +VECTOR2I PL_EDITOR_FRAME::ReturnCoordOriginCorner() const { // calculate the position (in page, in iu) of the corner used as coordinate origin // coordinate origin can be the paper Top Left corner, or each of 4 page corners - wxPoint originCoord; + VECTOR2I originCoord; // To avoid duplicate code, we use a dummy segment starting at 0,0 in relative coord DS_DATA_ITEM dummy( DS_DATA_ITEM::DS_SEGMENT ); @@ -677,7 +677,7 @@ void PL_EDITOR_FRAME::UpdateStatusBar() SetStatusText( GetZoomLevelIndicator(), 1 ); // coordinate origin can be the paper Top Left corner, or each of 4 page corners - wxPoint originCoord = ReturnCoordOriginCorner(); + VECTOR2I originCoord = ReturnCoordOriginCorner(); SetGridOrigin( originCoord ); // We need the orientation of axis (sign of coordinates) diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index aa3e467b03..ed14451ebb 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -114,7 +114,7 @@ public: * Calculate the position (in page, in iu) of the corner used as coordinate origin * of items. */ - wxPoint ReturnCoordOriginCorner() const; + VECTOR2I ReturnCoordOriginCorner() const; const TITLE_BLOCK& GetTitleBlock() const override; void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override; diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp index e2e5d8b7be..ffd2fde7f4 100644 --- a/pagelayout_editor/tools/pl_edit_tool.cpp +++ b/pagelayout_editor/tools/pl_edit_tool.cpp @@ -305,7 +305,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent ) void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, const VECTOR2I& aDelta ) { - aItem->MoveToUi( aItem->GetStartPosUi() + (wxPoint) aDelta ); + aItem->MoveToUi( aItem->GetStartPosUi() + aDelta ); for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() ) { diff --git a/pagelayout_editor/tools/pl_point_editor.cpp b/pagelayout_editor/tools/pl_point_editor.cpp index 45a4c055d8..4fc61785a6 100644 --- a/pagelayout_editor/tools/pl_point_editor.cpp +++ b/pagelayout_editor/tools/pl_point_editor.cpp @@ -73,8 +73,8 @@ public: case WSG_RECT_T: { DS_DRAW_ITEM_RECT* rect = static_cast( aItem ); - wxPoint topLeft = rect->GetStart(); - wxPoint botRight = rect->GetEnd(); + VECTOR2I topLeft = rect->GetStart(); + VECTOR2I botRight = rect->GetEnd(); if( topLeft.y > botRight.y ) std::swap( topLeft.y, botRight.y ); @@ -82,10 +82,10 @@ public: if( topLeft.x > botRight.x ) std::swap( topLeft.x, botRight.x ); - points->AddPoint( (VECTOR2I) topLeft ); + points->AddPoint( topLeft ); points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) ); points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) ); - points->AddPoint( (VECTOR2I) botRight ); + points->AddPoint( botRight ); break; } default: @@ -319,10 +319,8 @@ void PL_POINT_EDITOR::updateItem() const { DS_DRAW_ITEM_LINE* line = static_cast( item ); - wxPoint move_startpoint = (wxPoint) m_editPoints->Point( LINE_START ).GetPosition() - - line->GetStart(); - wxPoint move_endpoint = (wxPoint) m_editPoints->Point( LINE_END ).GetPosition() - - line->GetEnd(); + VECTOR2I move_startpoint = m_editPoints->Point( LINE_START ).GetPosition() - line->GetStart(); + VECTOR2I move_endpoint = m_editPoints->Point( LINE_END ).GetPosition() - line->GetEnd(); dataItem->MoveStartPointToUi( dataItem->GetStartPosUi() + move_startpoint ); dataItem->MoveEndPointToUi( dataItem->GetEndPosUi() + move_endpoint ); @@ -350,7 +348,7 @@ void PL_POINT_EDITOR::updateItem() const pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ), topLeft, topRight, botLeft, botRight ); - wxPoint start_delta, end_delta; + VECTOR2I start_delta, end_delta; if( rect->GetStart().y > rect->GetEnd().y ) { @@ -426,8 +424,8 @@ void PL_POINT_EDITOR::updatePoints() case WSG_RECT_T: { DS_DRAW_ITEM_RECT* rect = static_cast( item ); - wxPoint topLeft = rect->GetPosition(); - wxPoint botRight = rect->GetEnd(); + VECTOR2I topLeft = rect->GetPosition(); + VECTOR2I botRight = rect->GetEnd(); if( topLeft.y > botRight.y ) std::swap( topLeft.y, botRight.y ); diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index 38791bda18..2eb62bef98 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -92,7 +92,7 @@ AR_AUTOPLACER::AR_AUTOPLACER( BOARD* aBoard ) void AR_AUTOPLACER::placeFootprint( FOOTPRINT* aFootprint, bool aDoNotRecreateRatsnest, - const wxPoint& aPos ) + const VECTOR2I& aPos ) { if( !aFootprint ) return; @@ -161,7 +161,7 @@ bool AR_AUTOPLACER::fillMatrix() std::vector x_coordinates; bool success = true; int step = m_matrix.m_GridRouting; - wxPoint coord_orgin = m_matrix.GetBrdCoordOrigin(); // Board coordinate of matruix cell (0,0) + VECTOR2I coord_orgin = m_matrix.GetBrdCoordOrigin(); // Board coordinate of matruix cell (0,0) // Create a single board outline: SHAPE_POLY_SET brd_shape = m_boardShape; @@ -285,7 +285,7 @@ void AR_AUTOPLACER::rotateFootprint( FOOTPRINT* aFootprint, double angle, bool i } -void AR_AUTOPLACER::addFpBody( const wxPoint& aStart, const wxPoint& aEnd, LSET aLayerMask ) +void AR_AUTOPLACER::addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, LSET aLayerMask ) { // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack if( aLayerMask[ F_Cu ] ) @@ -356,7 +356,7 @@ void AR_AUTOPLACER::buildFpAreas( FOOTPRINT* aFootprint, int aFpClearance ) fpBBox.Inflate( ( m_matrix.m_GridRouting / 2 ) + aFpClearance ); // Add a minimal area to the fp area: - addFpBody( (wxPoint)fpBBox.GetOrigin(), (wxPoint)fpBBox.GetEnd(), layerMask ); + addFpBody( fpBBox.GetOrigin(), fpBBox.GetEnd(), layerMask ); // Trace pads + clearance areas. for( PAD* pad : aFootprint->Pads() ) @@ -535,7 +535,7 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSide, - const wxPoint& aOffset ) + const VECTOR2I& aOffset ) { int side = AR_SIDE_TOP; int otherside = AR_SIDE_BOTTOM; @@ -546,7 +546,7 @@ int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSid } EDA_RECT fpBBox = aFootprint->GetBoundingBox( false, false ); - fpBBox.Move( -aOffset ); + fpBBox.Move( -1*aOffset ); buildFpAreas( aFootprint, 0 ); @@ -581,7 +581,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint ) lastPosOK = m_matrix.m_BrdBox.GetOrigin(); - wxPoint fpPos = aFootprint->GetPosition(); + VECTOR2I fpPos = aFootprint->GetPosition(); EDA_RECT fpBBox = aFootprint->GetBoundingBox( false, false ); // Move fpBBox to have the footprint position at (0,0) @@ -597,8 +597,8 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint ) initialPos.x -= initialPos.x % m_matrix.m_GridRouting; initialPos.y -= initialPos.y % m_matrix.m_GridRouting; - m_curPosition = (wxPoint)initialPos; - wxPoint fpOffset = fpPos - m_curPosition; + m_curPosition = initialPos; + VECTOR2I fpOffset = fpPos - m_curPosition; // Examine pads, and set testOtherSide to true if a footprint has at least 1 pad through. testOtherSide = false; @@ -657,14 +657,14 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint ) } // Regeneration of the modified variable. - m_curPosition = (wxPoint)lastPosOK; + m_curPosition = lastPosOK; m_minCost = min_cost; return error; } -const PAD* AR_AUTOPLACER::nearestPad( FOOTPRINT *aRefFP, PAD* aRefPad, const wxPoint& aOffset) +const PAD* AR_AUTOPLACER::nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const VECTOR2I& aOffset ) { const PAD* nearest = nullptr; int64_t nearestDist = INT64_MAX; @@ -697,7 +697,7 @@ const PAD* AR_AUTOPLACER::nearestPad( FOOTPRINT *aRefFP, PAD* aRefPad, const wxP } -double AR_AUTOPLACER::computePlacementRatsnestCost( FOOTPRINT *aFootprint, const wxPoint& aOffset ) +double AR_AUTOPLACER::computePlacementRatsnestCost( FOOTPRINT* aFootprint, const VECTOR2I& aOffset ) { double curr_cost; VECTOR2I start; // start point of a ratsnest @@ -862,9 +862,9 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector& aFootprin BOARD_COMMIT* aCommit, bool aPlaceOffboardModules ) { - wxPoint memopos; - int error; - bool cancelled = false; + VECTOR2I memopos; + int error; + bool cancelled = false; memopos = m_curPosition; diff --git a/pcbnew/autorouter/ar_autoplacer.h b/pcbnew/autorouter/ar_autoplacer.h index 3333674fe2..a4696f90ae 100644 --- a/pcbnew/autorouter/ar_autoplacer.h +++ b/pcbnew/autorouter/ar_autoplacer.h @@ -98,9 +98,9 @@ private: int testRectangle( const EDA_RECT& aRect, int side ); unsigned int calculateKeepOutArea( const EDA_RECT& aRect, int side ); - int testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSide, const wxPoint& aOffset ); + int testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSide, const VECTOR2I& aOffset ); int getOptimalFPPlacement( FOOTPRINT* aFootprint ); - double computePlacementRatsnestCost( FOOTPRINT* aFootprint, const wxPoint& aOffset ); + double computePlacementRatsnestCost( FOOTPRINT* aFootprint, const VECTOR2I& aOffset ); /** * Find the "best" footprint place. The criteria are: @@ -109,12 +109,12 @@ private: */ FOOTPRINT* pickFootprint(); - void placeFootprint( FOOTPRINT* aFootprint, bool aDoNotRecreateRatsnest, const wxPoint& aPos ); + void placeFootprint( FOOTPRINT* aFootprint, bool aDoNotRecreateRatsnest, const VECTOR2I& aPos ); - const PAD* nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const wxPoint& aOffset ); + const PAD* nearestPad( FOOTPRINT* aRefFP, PAD* aRefPad, const VECTOR2I& aOffset ); // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack - void addFpBody( const wxPoint& aStart, const wxPoint& aEnd, LSET aLayerMask ); + void addFpBody( const VECTOR2I& aStart, const VECTOR2I& aEnd, LSET aLayerMask ); // Add a polygonal shape (rectangle) to m_fpAreaFront and/or m_fpAreaBack void addPad( PAD* aPad, int aClearance ); @@ -134,9 +134,9 @@ private: BOARD* m_board; - wxPoint m_curPosition; - double m_minCost; - int m_gridSize; + VECTOR2I m_curPosition; + double m_minCost; + int m_gridSize; std::shared_ptr m_overlay; std::unique_ptr m_connectivity; diff --git a/pcbnew/autorouter/ar_matrix.cpp b/pcbnew/autorouter/ar_matrix.cpp index d68223769b..43139ff5e3 100644 --- a/pcbnew/autorouter/ar_matrix.cpp +++ b/pcbnew/autorouter/ar_matrix.cpp @@ -912,7 +912,7 @@ void AR_MATRIX::CreateKeepOutRectangle( void AR_MATRIX::PlacePad( PAD* aPad, int color, int marge, AR_MATRIX::CELL_OP op_logic ) { int dx, dy; - wxPoint shape_pos = aPad->ShapePos(); + VECTOR2I shape_pos = aPad->ShapePos(); dx = aPad->GetSize().x / 2; dx += marge; diff --git a/pcbnew/autorouter/spread_footprints.cpp b/pcbnew/autorouter/spread_footprints.cpp index 328133e5ae..2cd5020763 100644 --- a/pcbnew/autorouter/spread_footprints.cpp +++ b/pcbnew/autorouter/spread_footprints.cpp @@ -161,16 +161,16 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector GetBoundingBox( false, false ); - wxPoint mod_pos = - pos + ( footprint->GetPosition() - (wxPoint)fpBBox.GetOrigin() ) - + (wxPoint) aFreeArea.GetOrigin(); + VECTOR2I mod_pos = + pos + ( footprint->GetPosition() - fpBBox.GetOrigin() ) + + aFreeArea.GetOrigin(); footprint->Move( mod_pos - footprint->GetPosition() ); } diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index b3fa0be7cb..2c374141ab 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -281,19 +281,19 @@ bool BOARD::ResolveTextVar( wxString* token, int aDepth ) const } -wxPoint BOARD::GetPosition() const +VECTOR2I BOARD::GetPosition() const { return ZeroOffset; } -void BOARD::SetPosition( const wxPoint& aPos ) +void BOARD::SetPosition( const VECTOR2I& aPos ) { wxLogWarning( wxT( "This should not be called on the BOARD object") ); } -void BOARD::Move( const wxPoint& aMoveVector ) // overload +void BOARD::Move( const VECTOR2I& aMoveVector ) // overload { // @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class. static const KICAD_T top_level_board_stuff[] = { @@ -1482,7 +1482,7 @@ int BOARD::SetAreasNetCodesFromNetNames() } -PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const +PAD* BOARD::GetPad( const VECTOR2I& aPosition, LSET aLayerSet ) const { if( !aLayerSet.any() ) aLayerSet = LSET::AllCuMask(); @@ -1504,7 +1504,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const PAD* BOARD::GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const { - const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint ); + const VECTOR2I& aPosition = aTrace->GetEndPoint( aEndPoint ); LSET lset( aTrace->GetLayer() ); @@ -1512,7 +1512,7 @@ PAD* BOARD::GetPad( const PCB_TRACK* aTrace, ENDPOINT_T aEndPoint ) const } -PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet ) const +PAD* BOARD::GetPadFast( const VECTOR2I& aPosition, LSET aLayerSet ) const { for( FOOTPRINT* footprint : Footprints() ) { @@ -1531,7 +1531,7 @@ PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet ) const } -PAD* BOARD::GetPad( std::vector& aPadList, const wxPoint& aPosition, LSET aLayerSet ) const +PAD* BOARD::GetPad( std::vector& aPadList, const VECTOR2I& aPosition, LSET aLayerSet ) const { // Search aPadList for aPosition // aPadList is sorted by X then Y values, and a fast binary search is used diff --git a/pcbnew/board.h b/pcbnew/board.h index 573d8b2cf2..5f7cb65383 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -275,16 +275,16 @@ public: BOARD(); ~BOARD(); - wxPoint GetPosition() const override; - void SetPosition( const wxPoint& aPos ) override; - const wxPoint GetFocusPosition() const override { return (wxPoint)GetBoundingBox().GetCenter(); } + VECTOR2I GetPosition() const override; + void SetPosition( const VECTOR2I& aPos ) override; + const VECTOR2I GetFocusPosition() const override { return GetBoundingBox().GetCenter(); } bool IsEmpty() const { return m_drawings.empty() && m_footprints.empty() && m_tracks.empty() && m_zones.empty(); } - void Move( const wxPoint& aMoveVector ) override; + void Move( const VECTOR2I& aMoveVector ) override; void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; } int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; } @@ -909,8 +909,8 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a PAD object if found or NULL if not found. */ - PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask ) const; - PAD* GetPad( const wxPoint& aPosition ) const + PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask ) const; + PAD* GetPad( const VECTOR2I& aPosition ) const { return GetPad( aPosition, LSET().set() ); } @@ -933,7 +933,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a PAD object if found or NULL if not found. */ - PAD* GetPadFast( const wxPoint& aPosition, LSET aLayerMask ) const; + PAD* GetPadFast( const VECTOR2I& aPosition, LSET aLayerMask ) const; /** * Locate the pad connected at \a aPosition on \a aLayer starting at list position @@ -949,7 +949,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return a PAD object pointer to the connected pad. */ - PAD* GetPad( std::vector& aPadList, const wxPoint& aPosition, LSET aLayerMask ) const; + PAD* GetPad( std::vector& aPadList, const VECTOR2I& aPosition, LSET aLayerMask ) const; /** * Delete a given pad from the BOARD by removing it from its footprint and from the diff --git a/pcbnew/board_item.cpp b/pcbnew/board_item.cpp index 4aca8d3d2c..7fbc08b409 100644 --- a/pcbnew/board_item.cpp +++ b/pcbnew/board_item.cpp @@ -200,13 +200,13 @@ BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParentFootprint() const } -void BOARD_ITEM::Rotate( const wxPoint& aRotCentre, double aAngle ) +void BOARD_ITEM::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() ); } -void BOARD_ITEM::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void BOARD_ITEM::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { wxMessageBox( wxT( "virtual BOARD_ITEM::Flip used, should not occur" ), GetClass() ); } diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index b262c41a4b..f3f8f36754 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -593,7 +593,7 @@ exit: void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], - const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide ) + const VECTOR2I& aRefPos, const COLLECTORS_GUIDE& aGuide ) { Empty(); // empty the collection, primary criteria list Empty2nd(); // empty the collection, secondary criteria list diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index 6fa09c5986..f8604ec424 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -365,8 +365,8 @@ public: * @param aRefPos A wxPoint to use in hit-testing. * @param aGuide The COLLECTORS_GUIDE to use in collecting items. */ - void Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], - const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide ); + void Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], const VECTOR2I& aRefPos, + const COLLECTORS_GUIDE& aGuide ); }; diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 53ee26732c..04b96e8866 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -618,7 +618,7 @@ void CONNECTIVITY_DATA::GetUnconnectedEdges( std::vector& aEdges) const } -static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const wxPoint& aPoint ) +static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aPoint ) { switch( aItem->Type() ) { @@ -637,7 +637,7 @@ static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const wxPoint& aPoint ) } -bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, wxPoint* aPos ) +bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos ) { std::list items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems(); diff --git a/pcbnew/connectivity/connectivity_data.h b/pcbnew/connectivity/connectivity_data.h index 6af68f6626..85f8629e87 100644 --- a/pcbnew/connectivity/connectivity_data.h +++ b/pcbnew/connectivity/connectivity_data.h @@ -231,7 +231,7 @@ public: void GetUnconnectedEdges( std::vector& aEdges ) const; - bool TestTrackEndpointDangling( PCB_TRACK* aTrack, wxPoint* aPos = nullptr ); + bool TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos = nullptr ); /** * Function ClearDynamicRatsnest() diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index 5e0dfce5aa..380995ec7c 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -86,7 +86,7 @@ bool closer_to_first( VECTOR2I aRef, VECTOR2I aFirst, VECTOR2I aSecond ) * @return PCB_SHAPE* - The first PCB_SHAPE that has a start or end point matching * aPoint, otherwise NULL if none. */ -static PCB_SHAPE* findNext( PCB_SHAPE* aShape, const wxPoint& aPoint, +static PCB_SHAPE* findNext( PCB_SHAPE* aShape, const VECTOR2I& aPoint, const std::vector& aList, unsigned aLimit ) { // Look for an unused, exact hit @@ -160,7 +160,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // Find edge point with minimum x, this should be in the outer polygon // which will define the perimeter polygon polygon. - wxPoint xmin = wxPoint( INT_MAX, 0 ); + VECTOR2I xmin = VECTOR2I( INT_MAX, 0 ); int xmini = 0; for( size_t i = 0; i < aSegList.size(); i++ ) @@ -189,12 +189,12 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& case SHAPE_T::ARC: { - wxPoint pstart = graphic->GetStart(); - wxPoint center = graphic->GetCenter(); + VECTOR2I pstart = graphic->GetStart(); + VECTOR2I center = graphic->GetCenter(); double angle = -graphic->GetArcAngle(); double radius = graphic->GetRadius(); int steps = GetArcToSegmentCount( radius, aErrorMax, angle / 10.0 ); - wxPoint pt; + VECTOR2I pt; for( int step = 1; step<=steps; ++step ) { @@ -202,7 +202,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& pt = pstart; - RotatePoint( &pt, center, rotation ); + RotatePoint( pt, center, rotation ); if( pt.x < xmin.x ) { @@ -215,7 +215,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& case SHAPE_T::CIRCLE: { - wxPoint pt = graphic->GetCenter(); + VECTOR2I pt = graphic->GetCenter(); // pt has minimum x point pt.x -= graphic->GetRadius(); @@ -233,7 +233,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& { graphic->RebuildBezierToSegmentsPointsList( graphic->GetWidth() ); - for( const wxPoint& pt : graphic->GetBezierPoints() ) + for( const VECTOR2I& pt : graphic->GetBezierPoints() ) { if( pt.x < xmin.x ) { @@ -292,7 +292,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // enough graphics together by matching endpoints to formulate a cohesive polygon. PCB_SHAPE* prevGraphic = nullptr; - wxPoint prevPt; + VECTOR2I prevPt; graphic = (PCB_SHAPE*) aSegList[xmini]; graphic->SetFlags( SKIP_STRUCT ); @@ -307,11 +307,11 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& } else if( graphic->GetShape() == SHAPE_T::RECT ) { - std::vector pts = graphic->GetRectCorners(); + std::vector pts = graphic->GetRectCorners(); aPolygons.NewOutline(); - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) aPolygons.Append( pt ); segOwners[ std::make_pair( pts[0], pts[1] ) ] = graphic; @@ -357,7 +357,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // Polygon start point. Arbitrarily choose an end of the segment and build the polygon // from there. - wxPoint startPt = graphic->GetEnd(); + VECTOR2I startPt = graphic->GetEnd(); prevPt = startPt; aPolygons.NewOutline(); @@ -389,7 +389,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& case SHAPE_T::SEGMENT: { - wxPoint nextPt; + VECTOR2I nextPt; // Use the line segment end point furthest away from prevPt as we assume the // other end to be ON prevPt or very close to it. @@ -410,9 +410,9 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // We do not support arcs in polygons, so approximate an arc with a series of // short lines and put those line segments into the !same! PATH. - wxPoint pstart = graphic->GetStart(); - wxPoint pend = graphic->GetEnd(); - wxPoint pcenter = graphic->GetCenter(); + VECTOR2I pstart = graphic->GetStart(); + VECTOR2I pend = graphic->GetEnd(); + VECTOR2I pcenter = graphic->GetCenter(); double angle = -graphic->GetArcAngle(); double radius = graphic->GetRadius(); int steps = GetArcToSegmentCount( radius, aErrorMax, angle / 10.0 ); @@ -429,8 +429,8 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& for( int step = 1; step < steps; ++step ) { double rotation = ( angle * step ) / steps; - wxPoint pt = pstart; - RotatePoint( &pt, pcenter, rotation ); + VECTOR2I pt = pstart; + RotatePoint( pt, pcenter, rotation ); aPolygons.Append( pt ); segOwners[ std::make_pair( prevPt, pt ) ] = graphic; @@ -449,7 +449,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // We do not support Bezier curves in polygons, so approximate with a series // of short lines and put those line segments into the !same! PATH. - wxPoint nextPt; + VECTOR2I nextPt; bool first = true; bool reverse = false; @@ -471,7 +471,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& { for( int jj = graphic->GetBezierPoints().size()-1; jj >= 0; jj-- ) { - const wxPoint& pt = graphic->GetBezierPoints()[jj]; + const VECTOR2I& pt = graphic->GetBezierPoints()[jj]; aPolygons.Append( pt ); if( first ) @@ -484,7 +484,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& } else { - for( const wxPoint& pt : graphic->GetBezierPoints() ) + for( const VECTOR2I& pt : graphic->GetBezierPoints() ) { aPolygons.Append( pt ); @@ -589,12 +589,12 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& else if( graphic->GetShape() == SHAPE_T::CIRCLE ) { // make a circle by segments; - wxPoint center = graphic->GetCenter(); + VECTOR2I center = graphic->GetCenter(); double angle = 3600.0; - wxPoint start = center; + VECTOR2I start = center; int radius = graphic->GetRadius(); int steps = GetArcToSegmentCount( radius, aErrorMax, 360.0 ); - wxPoint nextPt; + VECTOR2I nextPt; start.x += radius; @@ -615,9 +615,9 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& } else if( graphic->GetShape() == SHAPE_T::RECT ) { - std::vector pts = graphic->GetRectCorners(); + std::vector pts = graphic->GetRectCorners(); - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) { aPolygons.Append( pt, -1, hole ); @@ -626,7 +626,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& else segOwners[ std::make_pair( prevPt, pt ) ] = graphic; - prevPt = (wxPoint) pt; + prevPt = pt; } } else @@ -634,7 +634,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // Polygon start point. Arbitrarily chosen end of the segment and build the poly // from here. - wxPoint startPt = graphic->GetEnd(); + VECTOR2I startPt = graphic->GetEnd(); prevPt = startPt; aPolygons.Append( prevPt, -1, hole ); @@ -645,7 +645,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& { case SHAPE_T::SEGMENT: { - wxPoint nextPt; + VECTOR2I nextPt; // Use the line segment end point furthest away from prevPt as we assume // the other end to be ON prevPt or very close to it. @@ -665,9 +665,9 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // We do not support arcs in polygons, so approximate an arc with a series of // short lines and put those line segments into the !same! PATH. { - wxPoint pstart = graphic->GetStart(); - wxPoint pend = graphic->GetEnd(); - wxPoint pcenter = graphic->GetCenter(); + VECTOR2I pstart = graphic->GetStart(); + VECTOR2I pend = graphic->GetEnd(); + VECTOR2I pcenter = graphic->GetCenter(); double angle = -graphic->GetArcAngle(); int radius = graphic->GetRadius(); int steps = GetArcToSegmentCount( radius, aErrorMax, angle / 10.0 ); @@ -684,9 +684,9 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& for( int step = 1; step < steps; ++step ) { double rotation = ( angle * step ) / steps; - wxPoint pt = pstart; + VECTOR2I pt = pstart; - RotatePoint( &pt, pcenter, rotation ); + RotatePoint( pt, pcenter, rotation ); aPolygons.Append( pt, -1, hole ); segOwners[ std::make_pair( prevPt, pt ) ] = graphic; @@ -704,7 +704,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& // We do not support Bezier curves in polygons, so approximate with a series // of short lines and put those line segments into the !same! PATH. { - wxPoint nextPt; + VECTOR2I nextPt; bool reverse = false; // Use the end point furthest away from prevPt as we assume the other @@ -724,7 +724,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& { for( int jj = graphic->GetBezierPoints().size()-1; jj >= 0; jj-- ) { - const wxPoint& pt = graphic->GetBezierPoints()[jj]; + const VECTOR2I& pt = graphic->GetBezierPoints()[jj]; aPolygons.Append( pt, -1, hole ); segOwners[ std::make_pair( prevPt, pt ) ] = graphic; prevPt = pt; @@ -732,7 +732,7 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SET& } else { - for( const wxPoint& pt : graphic->GetBezierPoints() ) + for( const VECTOR2I& pt : graphic->GetBezierPoints() ) { aPolygons.Append( pt, -1, hole ); segOwners[ std::make_pair( prevPt, pt ) ] = graphic; @@ -955,13 +955,13 @@ bool isCopperOutside( const FOOTPRINT* aMod, SHAPE_POLY_SET& aShape ) if( poly.OutlineCount() == 0 ) { - wxPoint padPos = pad->GetPosition(); + VECTOR2I padPos = pad->GetPosition(); wxLogTrace( traceBoardOutline, "Tested pad (%d, %d): outside", padPos.x, padPos.y ); padOutside = true; break; } - wxPoint padPos = pad->GetPosition(); + VECTOR2I padPos = pad->GetPosition(); wxLogTrace( traceBoardOutline, "Tested pad (%d, %d): not outside", padPos.x, padPos.y ); } diff --git a/pcbnew/convert_shape_list_to_polygon.h b/pcbnew/convert_shape_list_to_polygon.h index 2da04fe178..4723fb75a1 100644 --- a/pcbnew/convert_shape_list_to_polygon.h +++ b/pcbnew/convert_shape_list_to_polygon.h @@ -30,7 +30,7 @@ class wxPoint; typedef const std::function OUTLINE_ERROR_HANDLER; + const VECTOR2I& pt )> OUTLINE_ERROR_HANDLER; /** * Function ConvertOutlineToPolygon diff --git a/pcbnew/dialogs/dialog_footprint_checker.cpp b/pcbnew/dialogs/dialog_footprint_checker.cpp index 56ec7f0661..b2912f2ac1 100644 --- a/pcbnew/dialogs/dialog_footprint_checker.cpp +++ b/pcbnew/dialogs/dialog_footprint_checker.cpp @@ -102,7 +102,7 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks() } OUTLINE_ERROR_HANDLER errorHandler = - [&]( const wxString& aMsg, BOARD_ITEM* aItemA, BOARD_ITEM* aItemB, const wxPoint& aPt ) + [&]( const wxString& aMsg, BOARD_ITEM* aItemA, BOARD_ITEM* aItemB, const VECTOR2I& aPt ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_MALFORMED_COURTYARD ); @@ -130,8 +130,8 @@ void DIALOG_FOOTPRINT_CHECKER::runChecks() m_frame->GetCanvas()->GetView()->Add( marker ); }; - const std::function tstHoleInTHPad = - [&]( const wxString& aMsg, const wxPoint& aPosition ) + const std::function tstHoleInTHPad = + [&]( const wxString& aMsg, const VECTOR2I& aPosition ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_PAD_TH_WITH_NO_HOLE ); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 3b0150f064..5e3937b1a1 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -670,7 +670,7 @@ void DIALOG_PAD_PROPERTIES::initValues() } // A small helper function, to display coordinates: -static wxString formatCoord( EDA_UNITS aUnits, wxPoint aCoord ) +static wxString formatCoord( EDA_UNITS aUnits, VECTOR2I aCoord ) { return wxString::Format( "(X:%s Y:%s)", MessageTextFromValue( aUnits, aCoord.x ), @@ -1590,7 +1590,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() m_currentPad->SetDrillSize( m_padMaster->GetDrillSize() ); m_currentPad->SetDrillShape( m_padMaster->GetDrillShape() ); - wxPoint offset = m_padMaster->GetOffset(); + VECTOR2I offset = m_padMaster->GetOffset(); m_currentPad->SetOffset( offset ); m_currentPad->SetPadToDieLength( m_padMaster->GetPadToDieLength() ); @@ -1652,8 +1652,8 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow() // compute the pos 0 value, i.e. pad position for footprint with orientation = 0 // i.e. relative to footprint origin (footprint position) - wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition(); - RotatePoint( &pt, -footprint->GetOrientation() ); + VECTOR2I pt = m_currentPad->GetPosition() - footprint->GetPosition(); + RotatePoint( pt, -footprint->GetOrientation() ); m_currentPad->SetPos0( pt ); m_currentPad->SetOrientation( m_currentPad->GetOrientation() + footprint->GetOrientation() ); diff --git a/pcbnew/dialogs/dialog_pad_properties.h b/pcbnew/dialogs/dialog_pad_properties.h index 586f111db0..39e4e3a1cd 100644 --- a/pcbnew/dialogs/dialog_pad_properties.h +++ b/pcbnew/dialogs/dialog_pad_properties.h @@ -252,7 +252,7 @@ private: PCB_SHAPE* m_shape; // The working copy of the basic shape currently edited - std::vector m_currPoints; + std::vector m_currPoints; UNIT_BINDER m_thickness; }; diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 3acecac8eb..b1a48af36a 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -1363,7 +1363,7 @@ bool DRC_ENGINE::IsErrorLimitExceeded( int error_code ) } -void DRC_ENGINE::ReportViolation( const std::shared_ptr& aItem, const wxPoint& aPos, +void DRC_ENGINE::ReportViolation( const std::shared_ptr& aItem, const VECTOR2I& aPos, PCB_LAYER_ID aMarkerLayer ) { m_errorLimits[ aItem->GetErrorCode() ] -= 1; diff --git a/pcbnew/drc/drc_engine.h b/pcbnew/drc/drc_engine.h index 699e741d37..73f989ea37 100644 --- a/pcbnew/drc/drc_engine.h +++ b/pcbnew/drc/drc_engine.h @@ -65,7 +65,7 @@ class DRC_CONSTRAINT; typedef std::function& aItem, - const wxPoint& aPos, PCB_LAYER_ID aLayer )> DRC_VIOLATION_HANDLER; + const VECTOR2I& aPos, PCB_LAYER_ID aLayer )> DRC_VIOLATION_HANDLER; /** @@ -164,7 +164,7 @@ public: bool RulesValid() { return m_rulesValid; } - void ReportViolation( const std::shared_ptr& aItem, const wxPoint& aPos, + void ReportViolation( const std::shared_ptr& aItem, const VECTOR2I& aPos, PCB_LAYER_ID aMarkerLayer ); bool ReportProgress( double aProgress ); diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index 76f6c46865..0ec5827bb3 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -54,7 +54,7 @@ const wxString DRC_TEST_PROVIDER::GetDescription() const { return ""; } void DRC_TEST_PROVIDER::reportViolation( std::shared_ptr& item, - const wxPoint& aMarkerPos, PCB_LAYER_ID aMarkerLayer ) + const VECTOR2I& aMarkerPos, PCB_LAYER_ID aMarkerLayer ) { if( item->GetViolatingRule() ) accountCheck( item->GetViolatingRule() ); diff --git a/pcbnew/drc/drc_test_provider.h b/pcbnew/drc/drc_test_provider.h index 5ee9bbf99e..6cc1bc7fec 100644 --- a/pcbnew/drc/drc_test_provider.h +++ b/pcbnew/drc/drc_test_provider.h @@ -94,7 +94,7 @@ protected: const std::function& aFunc ); virtual void reportAux( wxString fmt, ... ); - virtual void reportViolation( std::shared_ptr& item, const wxPoint& aMarkerPos, + virtual void reportViolation( std::shared_ptr& item, const VECTOR2I& aMarkerPos, PCB_LAYER_ID aMarkerLayer ); virtual bool reportProgress( int aCount, int aSize, int aDelta ); virtual bool reportPhase( const wxString& aStageName ); diff --git a/pcbnew/drc/drc_test_provider_connectivity.cpp b/pcbnew/drc/drc_test_provider_connectivity.cpp index 3a3ddb1eba..afb66c61c8 100644 --- a/pcbnew/drc/drc_test_provider_connectivity.cpp +++ b/pcbnew/drc/drc_test_provider_connectivity.cpp @@ -103,7 +103,7 @@ bool DRC_TEST_PROVIDER_CONNECTIVITY::Run() // Test for dangling items int code = track->Type() == PCB_VIA_T ? DRCE_DANGLING_VIA : DRCE_DANGLING_TRACK; - wxPoint pos; + VECTOR2I pos; if( connectivity->TestTrackEndpointDangling( track, &pos ) ) { diff --git a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp index 317b627652..080e41d612 100644 --- a/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_courtyard_clearance.cpp @@ -106,7 +106,7 @@ bool DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testFootprintCourtyardDefinitions() continue; OUTLINE_ERROR_HANDLER errorHandler = - [&]( const wxString& msg, BOARD_ITEM* , BOARD_ITEM* , const wxPoint& pt ) + [&]( const wxString& msg, BOARD_ITEM*, BOARD_ITEM*, const VECTOR2I& pt ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_MALFORMED_COURTYARD ); drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + msg ); diff --git a/pcbnew/drc/drc_test_provider_mechanical_clearance.cpp b/pcbnew/drc/drc_test_provider_mechanical_clearance.cpp index b2e9fea504..840f04c32c 100644 --- a/pcbnew/drc/drc_test_provider_mechanical_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_mechanical_clearance.cpp @@ -306,7 +306,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run() shape->RebuildBezierToSegmentsPointsList( shape->GetWidth() ); - for( const wxPoint& pt : shape->GetBezierPoints() ) + for( const VECTOR2I& pt : shape->GetBezierPoints() ) asPoly.Append( pt ); testShapeLineChain( asPoly, shape->GetWidth(), layer, item, c ); @@ -317,7 +317,7 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run() { SHAPE_LINE_CHAIN asPoly; - wxPoint center = shape->GetCenter(); + VECTOR2I center = shape->GetCenter(); double angle = -shape->GetArcAngle(); double r = shape->GetRadius(); int steps = GetArcToSegmentCount( r, errorMax, angle / 10.0 ); @@ -328,8 +328,8 @@ bool DRC_TEST_PROVIDER_MECHANICAL_CLEARANCE::Run() { double rotation = ( angle * step ) / steps; - wxPoint pt = shape->GetStart(); - RotatePoint( &pt, center, rotation ); + VECTOR2I pt = shape->GetStart(); + RotatePoint( pt, center, rotation ); asPoly.Append( pt ); } diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp index 7a58ec20bd..db9754249c 100644 --- a/pcbnew/drc/drc_test_provider_misc.cpp +++ b/pcbnew/drc/drc_test_provider_misc.cpp @@ -83,7 +83,7 @@ void DRC_TEST_PROVIDER_MISC::testOutline() bool errorHandled = false; OUTLINE_ERROR_HANDLER errorHandler = - [&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const wxPoint& pt ) + [&]( const wxString& msg, BOARD_ITEM* itemA, BOARD_ITEM* itemB, const VECTOR2I& pt ) { std::shared_ptr drcItem = DRC_ITEM::Create( DRCE_INVALID_OUTLINE ); diff --git a/pcbnew/drc/drc_test_provider_track_width.cpp b/pcbnew/drc/drc_test_provider_track_width.cpp index 4683bdb333..9629015e73 100644 --- a/pcbnew/drc/drc_test_provider_track_width.cpp +++ b/pcbnew/drc/drc_test_provider_track_width.cpp @@ -85,7 +85,7 @@ bool DRC_TEST_PROVIDER_TRACK_WIDTH::Run() return false; int actual; - wxPoint p0; + VECTOR2I p0; if( PCB_ARC* arc = dyn_cast( item ) ) { diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index 6a696deb89..1d45f1a0be 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -419,7 +419,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) for( unsigned i = 0; iGetOffset(); + const VECTOR2I& off = pad->GetOffset(); pad->SetSubRatsnest( pad_name_number ); @@ -563,11 +563,11 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) int ddx = pad->GetDelta().x / 2; int ddy = pad->GetDelta().y / 2; - wxPoint poly[4]; - poly[0] = wxPoint( -dx + ddy, dy + ddx ); - poly[1] = wxPoint( dx - ddy, dy - ddx ); - poly[2] = wxPoint( dx + ddy, -dy + ddx ); - poly[3] = wxPoint( -dx - ddy, -dy - ddx ); + VECTOR2I poly[4]; + poly[0] = VECTOR2I( -dx + ddy, dy + ddx ); + poly[1] = VECTOR2I( dx - ddy, dy - ddx ); + poly[2] = VECTOR2I( dx + ddy, -dy + ddx ); + poly[3] = VECTOR2I( -dx - ddy, -dy - ddx ); for( int cur = 0; cur < 4; ++cur ) { @@ -588,7 +588,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) SHAPE_POLY_SET outline; int maxError = aPcb->GetDesignSettings().m_MaxError; - wxPoint padOffset( 0, 0 ); + VECTOR2I padOffset( 0, 0 ); TransformRoundChamferedRectToPolygon( outline, padOffset, pad->GetSize(), pad->GetOrientation(), @@ -1270,8 +1270,8 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr case SHAPE_T::ARC: { - wxPoint start = shape->GetStart0(); - wxPoint end = shape->GetEnd0(); + VECTOR2I start = shape->GetStart0(); + VECTOR2I end = shape->GetEnd0(); if( shape->GetArcAngle() > 0 ) std::swap( start, end ); diff --git a/pcbnew/exporters/gerber_placefile_writer.cpp b/pcbnew/exporters/gerber_placefile_writer.cpp index 72e32d4200..750025a69b 100644 --- a/pcbnew/exporters/gerber_placefile_writer.cpp +++ b/pcbnew/exporters/gerber_placefile_writer.cpp @@ -163,7 +163,7 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER gbr_metadata.m_NetlistMetadata.SetExtraData( pnpAttrib.FormatCmpPnPMetadata() ); - wxPoint flash_pos = footprint->GetPosition(); + VECTOR2I flash_pos = footprint->GetPosition(); plotter.FlashPadCircle( flash_pos, flash_position_shape_diam, FILLED, &gbr_metadata ); gbr_metadata.m_NetlistMetadata.ClearExtraData(); diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 67d4ec435c..a457090586 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -1024,14 +1024,14 @@ bool FOOTPRINT::IsOnLayer( PCB_LAYER_ID aLayer ) const } -bool FOOTPRINT::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool FOOTPRINT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { EDA_RECT rect = GetBoundingBox( false, false ); return rect.Inflate( aAccuracy ).Contains( aPosition ); } -bool FOOTPRINT::HitTestAccurate( const wxPoint& aPosition, int aAccuracy ) const +bool FOOTPRINT::HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy ) const { return GetBoundingHull().Collide( aPosition, aAccuracy ); } @@ -1103,7 +1103,7 @@ PAD* FOOTPRINT::FindPadByNumber( const wxString& aPadNumber, PAD* aSearchAfterMe } -PAD* FOOTPRINT::GetPad( const wxPoint& aPosition, LSET aLayerMask ) +PAD* FOOTPRINT::GetPad( const VECTOR2I& aPosition, LSET aLayerMask ) { for( PAD* pad : m_pads ) { @@ -1125,7 +1125,7 @@ PAD* FOOTPRINT::GetTopLeftPad() for( PAD* p : m_pads ) { - wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad + VECTOR2I pnt = p->GetPosition(); // GetPosition() returns the center of the pad if( ( pnt.x < topLeftPad->GetPosition().x ) || ( topLeftPad->GetPosition().x == pnt.x && pnt.y < topLeftPad->GetPosition().y ) ) @@ -1477,19 +1477,19 @@ const wxChar* FOOTPRINT::StringLibNameInvalidChars( bool aUserReadable ) } -void FOOTPRINT::Move( const wxPoint& aMoveVector ) +void FOOTPRINT::Move( const VECTOR2I& aMoveVector ) { - wxPoint newpos = m_pos + aMoveVector; + VECTOR2I newpos = m_pos + aMoveVector; SetPosition( newpos ); } -void FOOTPRINT::Rotate( const wxPoint& aRotCentre, double aAngle ) +void FOOTPRINT::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { double orientation = GetOrientation(); double newOrientation = orientation + aAngle; - wxPoint newpos = m_pos; - RotatePoint( &newpos, aRotCentre, aAngle ); + VECTOR2I newpos = m_pos; + RotatePoint( newpos, aRotCentre, aAngle ); SetPosition( newpos ); SetOrientation( newOrientation ); @@ -1509,10 +1509,10 @@ void FOOTPRINT::Rotate( const wxPoint& aRotCentre, double aAngle ) } -void FOOTPRINT::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { // Move footprint to its final position: - wxPoint finalPos = m_pos; + VECTOR2I finalPos = m_pos; // Now Flip the footprint. // Flipping a footprint is a specific transform: it is not mirrored like a text. @@ -1580,9 +1580,9 @@ void FOOTPRINT::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void FOOTPRINT::SetPosition( const wxPoint& aPos ) +void FOOTPRINT::SetPosition( const VECTOR2I& aPos ) { - wxPoint delta = aPos - m_pos; + VECTOR2I delta = aPos - m_pos; m_pos += delta; @@ -1634,7 +1634,7 @@ void FOOTPRINT::SetPosition( const wxPoint& aPos ) } -void FOOTPRINT::MoveAnchorPosition( const wxPoint& aMoveVector ) +void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector ) { /* Move the reference point of the footprint * the footprints elements (pads, outlines, edges .. ) are moved @@ -1646,8 +1646,8 @@ void FOOTPRINT::MoveAnchorPosition( const wxPoint& aMoveVector ) // Update (move) the relative coordinates relative to the new anchor point. - wxPoint moveVector = aMoveVector; - RotatePoint( &moveVector, -GetOrientation() ); + VECTOR2I moveVector = aMoveVector; + RotatePoint( moveVector, -GetOrientation() ); // Update of the reference and value. m_reference->SetPos0( m_reference->GetPos0() + moveVector ); @@ -2169,8 +2169,7 @@ void FOOTPRINT::CheckFootprintAttributes( const std::function* - aErrorHandler ) + const std::function* aErrorHandler ) { if( aErrorHandler == nullptr ) return; diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index be0c73b396..366f3fd821 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -188,8 +188,8 @@ public: std::vector& Models() { return m_3D_Drawings; } const std::vector& Models() const { return m_3D_Drawings; } - void SetPosition( const wxPoint& aPos ) override; - wxPoint GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPos ) override; + VECTOR2I GetPosition() const override { return m_pos; } void SetOrientation( double aNewAngle ); void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); } @@ -252,11 +252,11 @@ public: */ int GetLikelyAttribute() const; - void Move( const wxPoint& aMoveVector ) override; + void Move( const VECTOR2I& aMoveVector ) override; - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; /** * Move the reference point of the footprint. @@ -269,7 +269,7 @@ public: * (a move footprint does not change these local coordinates, * but changes the footprint position) */ - void MoveAnchorPosition( const wxPoint& aMoveVector ); + void MoveAnchorPosition( const VECTOR2I& aMoveVector ); /** * @return true if the footprint is flipped, i.e. on the back side of the board @@ -364,8 +364,7 @@ public: * * @param aErrorHandler callback to handle the error messages generated */ - void CheckFootprintTHPadNoHoles( const std::function - * + void CheckFootprintTHPadNoHoles( const std::function* aErrorHandler ); /** @@ -442,7 +441,7 @@ public: ///< @copydoc EDA_ITEM::GetMsgPanelInfo void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; /** * Test if a point is inside the bounding polygon of the footprint. @@ -453,7 +452,7 @@ public: * @param aPosition is the point to test * @return true if aPosition is inside the bounding polygon */ - bool HitTestAccurate( const wxPoint& aPosition, int aAccuracy = 0 ) const; + bool HitTestAccurate( const VECTOR2I& aPosition, int aAccuracy = 0 ) const; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; @@ -530,7 +529,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a #PAD object if found otherwise NULL. */ - PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask = LSET::AllLayersMask() ); + PAD* GetPad( const VECTOR2I& aPosition, LSET aLayerMask = LSET::AllLayersMask() ); PAD* GetTopLeftPad(); @@ -738,7 +737,7 @@ private: FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees. - wxPoint m_pos; // Position of footprint on the board in internal units. + VECTOR2I m_pos; // Position of footprint on the board in internal units. FP_TEXT* m_reference; // Component reference designator value (U34, R18..) FP_TEXT* m_value; // Component value (74LS00, 22K..) LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT. diff --git a/pcbnew/fp_shape.cpp b/pcbnew/fp_shape.cpp index ddb73b9b99..9e84413e0d 100644 --- a/pcbnew/fp_shape.cpp +++ b/pcbnew/fp_shape.cpp @@ -142,7 +142,7 @@ EDA_ITEM* FP_SHAPE::Clone() const } -wxPoint FP_SHAPE::GetCenter0() const +VECTOR2I FP_SHAPE::GetCenter0() const { switch( m_shape ) { @@ -154,12 +154,12 @@ wxPoint FP_SHAPE::GetCenter0() const default: UNIMPLEMENTED_FOR( SHAPE_T_asString() ); - return wxPoint(); + return VECTOR2I(); } } -void FP_SHAPE::SetCenter0( const wxPoint& aCenter ) +void FP_SHAPE::SetCenter0( const VECTOR2I& aCenter ) { switch( m_shape ) { @@ -177,10 +177,10 @@ void FP_SHAPE::SetCenter0( const wxPoint& aCenter ) } -wxPoint FP_SHAPE::GetArcMid0() const +VECTOR2I FP_SHAPE::GetArcMid0() const { - wxPoint mid0 = m_start0; - RotatePoint( &mid0, m_arcCenter0, -GetArcAngle() / 2.0 ); + VECTOR2I mid0 = m_start0; + RotatePoint( mid0, m_arcCenter0, -GetArcAngle() / 2.0 ); return mid0; } @@ -188,7 +188,7 @@ wxPoint FP_SHAPE::GetArcMid0() const void FP_SHAPE::SetArcAngleAndEnd0( double aAngle, bool aCheckNegativeAngle ) { m_end0 = m_start0; - RotatePoint( &m_end0, m_arcCenter0, -NormalizeAngle360Max( aAngle ) ); + RotatePoint( m_end0, m_arcCenter0, -NormalizeAngle360Max( aAngle ) ); if( aCheckNegativeAngle && aAngle < 0 ) std::swap( m_start0, m_end0 ); @@ -203,9 +203,9 @@ void FP_SHAPE::SetArcGeometry0( const wxPoint& aStart0, const wxPoint& aMid0, co } -void FP_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void FP_SHAPE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { - wxPoint pt( 0, 0 ); + VECTOR2I pt( 0, 0 ); switch( GetShape() ) { @@ -276,7 +276,7 @@ bool FP_SHAPE::IsParentFlipped() const return false; } -void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ) +void FP_SHAPE::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) { // Mirror an edge of the footprint. the layer is not modified // This is a footprint shape modification. @@ -323,7 +323,7 @@ void FP_SHAPE::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ) SetDrawCoord(); } -void FP_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle ) +void FP_SHAPE::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { // We should rotate the relative coordinates, but to avoid duplicate code do the base class // rotation of draw coordinates, which is acceptable because in the footprint editor @@ -335,7 +335,7 @@ void FP_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle ) } -void FP_SHAPE::Move( const wxPoint& aMoveVector ) +void FP_SHAPE::Move( const VECTOR2I& aMoveVector ) { // Move an edge of the footprint. // This is a footprint shape modification. diff --git a/pcbnew/fp_shape.h b/pcbnew/fp_shape.h index 627c9786df..f4be3f0e29 100644 --- a/pcbnew/fp_shape.h +++ b/pcbnew/fp_shape.h @@ -80,7 +80,7 @@ public: * This is a footprint shape modification. * (should be only called by a footprint editing function) */ - void Move( const wxPoint& aMoveVector ) override; + void Move( const VECTOR2I& aMoveVector ) override; /** * Mirror an edge of the footprint. @@ -88,14 +88,14 @@ public: * This is a footprint shape modification. * (should be only called by a footprint editing function) */ - void Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ); + void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ); /** * Rotate an edge of the footprint. * This is a footprint shape modification. * (should be only called by a footprint editing function ) */ - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; /** * Flip entity relative to aCentre. @@ -104,26 +104,26 @@ public: * This function should be called only from FOOTPRINT::Flip because it is not usual to flip * an item alone, without flipping the parent footprint (consider Mirror() instead). */ - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; bool IsParentFlipped() const; - void SetStart0( const wxPoint& aPoint ) { m_start0 = aPoint; } - const wxPoint& GetStart0() const { return m_start0; } + void SetStart0( const VECTOR2I& aPoint ) { m_start0 = aPoint; } + const VECTOR2I& GetStart0() const { return m_start0; } - void SetEnd0( const wxPoint& aPoint ) { m_end0 = aPoint; } - const wxPoint& GetEnd0() const { return m_end0; } + void SetEnd0( const VECTOR2I& aPoint ) { m_end0 = aPoint; } + const VECTOR2I& GetEnd0() const { return m_end0; } - void SetBezierC1_0( const wxPoint& aPoint ) { m_bezierC1_0 = aPoint; } - const wxPoint& GetBezierC1_0() const { return m_bezierC1_0; } + void SetBezierC1_0( const VECTOR2I& aPoint ) { m_bezierC1_0 = aPoint; } + const VECTOR2I& GetBezierC1_0() const { return m_bezierC1_0; } - void SetBezierC2_0( const wxPoint& aPoint ) { m_bezierC2_0 = aPoint; } - const wxPoint& GetBezierC2_0() const { return m_bezierC2_0; } + void SetBezierC2_0( const VECTOR2I& aPoint ) { m_bezierC2_0 = aPoint; } + const VECTOR2I& GetBezierC2_0() const { return m_bezierC2_0; } - wxPoint GetCenter0() const; - void SetCenter0( const wxPoint& aPt ); + VECTOR2I GetCenter0() const; + void SetCenter0( const VECTOR2I& aPt ); - wxPoint GetArcMid0() const; + VECTOR2I GetArcMid0() const; /** * Set relative coordinates from draw coordinates. @@ -160,11 +160,11 @@ public: #endif protected: - wxPoint m_start0; ///< Start point or circle center, relative to footprint origin, orient 0. - wxPoint m_end0; ///< End point or circle edge, relative to footprint origin, orient 0. - wxPoint m_arcCenter0; ///< Center of arc, relative to footprint origin, orient 0. - wxPoint m_bezierC1_0; ///< Bezier Control Point 1, relative to footprint origin, orient 0. - wxPoint m_bezierC2_0; ///< Bezier Control Point 2, relative to footprint origin, orient 0. + VECTOR2I m_start0; ///< Start point or circle center, relative to footprint origin, orient 0. + VECTOR2I m_end0; ///< End point or circle edge, relative to footprint origin, orient 0. + VECTOR2I m_arcCenter0; ///< Center of arc, relative to footprint origin, orient 0. + VECTOR2I m_bezierC1_0; ///< Bezier Control Point 1, relative to footprint origin, orient 0. + VECTOR2I m_bezierC2_0; ///< Bezier Control Point 2, relative to footprint origin, orient 0. }; #endif // FP_SHAPE_H diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp index d540a093b1..9eebe99844 100644 --- a/pcbnew/fp_text.cpp +++ b/pcbnew/fp_text.cpp @@ -82,7 +82,7 @@ void FP_TEXT::SetTextAngle( const EDA_ANGLE& aAngle ) } -bool FP_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const +bool FP_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const { EDA_RECT rect = GetTextBox(); VECTOR2I location = aPoint; @@ -126,7 +126,7 @@ void FP_TEXT::KeepUpright( double aOldOrientation, double aNewOrientation ) } -void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle ) +void FP_TEXT::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { // Used in footprint editing // Note also in footprint editor, m_Pos0 = m_Pos @@ -140,7 +140,7 @@ void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle ) } -void FP_TEXT::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void FP_TEXT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { // flipping the footprint is relative to the X axis if( aFlipLeftRight ) @@ -167,7 +167,7 @@ bool FP_TEXT::IsParentFlipped() const } -void FP_TEXT::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ) +void FP_TEXT::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) { // the position is mirrored, but the text itself is not mirrored @@ -180,7 +180,7 @@ void FP_TEXT::Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ) } -void FP_TEXT::Move( const wxPoint& aMoveVector ) +void FP_TEXT::Move( const VECTOR2I& aMoveVector ) { Offset( aMoveVector ); SetLocalCoord(); @@ -218,7 +218,7 @@ void FP_TEXT::SetLocalCoord() if( parentFootprint ) { - m_Pos0 = (wxPoint)GetTextPos() - parentFootprint->GetPosition(); + m_Pos0 = GetTextPos() - parentFootprint->GetPosition(); double angle = parentFootprint->GetOrientation(); diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h index e00781a703..b27ed57109 100644 --- a/pcbnew/fp_text.h +++ b/pcbnew/fp_text.h @@ -85,12 +85,12 @@ public: return BOARD_ITEM::Matches( GetShownText(), aSearchData ); } - virtual wxPoint GetPosition() const override + virtual VECTOR2I GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } - virtual void SetPosition( const wxPoint& aPos ) override + virtual void SetPosition( const VECTOR2I& aPos ) override { EDA_TEXT::SetTextPos( aPos ); SetLocalCoord(); @@ -113,10 +113,10 @@ public: /// Rotate text, in footprint editor /// (for instance in footprint rotation transform) - void Rotate( const wxPoint& aOffset, double aAngle ) override; + void Rotate( const VECTOR2I& aOffset, double aAngle ) override; /// Flip entity during footprint flip - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; bool IsParentFlipped() const; @@ -124,19 +124,19 @@ public: /// the text itself is not mirrored, and the layer not modified, /// only position is mirrored. /// (use Flip to change layer to its paired and mirror the text in fp editor). - void Mirror( const wxPoint& aCentre, bool aMirrorAroundXAxis ); + void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ); /// move text in move transform, in footprint editor - void Move( const wxPoint& aMoveVector ) override; + void Move( const VECTOR2I& aMoveVector ) override; /// @deprecated it seems (but the type is used to 'protect' // reference and value from deletion, and for identification) - void SetType( TEXT_TYPE aType ) { m_Type = aType; } - TEXT_TYPE GetType() const { return m_Type; } + void SetType( TEXT_TYPE aType ) { m_Type = aType; } + TEXT_TYPE GetType() const { return m_Type; } // The Pos0 accessors are for footprint-relative coordinates. - void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; SetDrawCoord(); } - const wxPoint& GetPos0() const { return m_Pos0; } + void SetPos0( const VECTOR2I& aPos ) { m_Pos0 = aPos; SetDrawCoord(); } + const VECTOR2I& GetPos0() const { return m_Pos0; } int GetLength() const; // text length @@ -157,10 +157,10 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override; + bool TextHitTest( const VECTOR2I& aPoint, int aAccuracy = 0 ) const override; bool TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy = 0 ) const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override { return TextHitTest( aPosition, aAccuracy ); } @@ -207,7 +207,7 @@ public: private: TEXT_TYPE m_Type; ///< 0=ref, 1=val, etc. - wxPoint m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0. + VECTOR2I m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0. ///< text coordinate ref point is the text center bool m_keepUpright; ///< if true, keep rotation angle between -90 .. 90 deg. diff --git a/pcbnew/fp_text_grid_table.cpp b/pcbnew/fp_text_grid_table.cpp index 16782ec61c..8f8ac76c5f 100644 --- a/pcbnew/fp_text_grid_table.cpp +++ b/pcbnew/fp_text_grid_table.cpp @@ -264,7 +264,7 @@ long FP_TEXT_GRID_TABLE::GetValueAsLong( int aRow, int aCol ) void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue ) { FP_TEXT& text = this->at( (size_t) aRow ); - wxPoint pos; + VECTOR2I pos; switch( aCol ) { diff --git a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp index 8de68643b2..7ccf0af4dc 100644 --- a/pcbnew/import_gfx/graphics_importer_pcbnew.cpp +++ b/pcbnew/import_gfx/graphics_importer_pcbnew.cpp @@ -124,7 +124,7 @@ void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D& void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector< VECTOR2D >& aVertices, double aWidth ) { - std::vector< wxPoint > convertedPoints; + std::vector convertedPoints; convertedPoints.reserve( convertedPoints.size() ); for( const VECTOR2D& precisePoint : aVertices ) diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 2fac08ae15..bb6ea673be 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -163,7 +163,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri // Set the new relative internal local coordinates of copied items FOOTPRINT* editedFootprint = m_board->Footprints().front(); - wxPoint moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition(); + VECTOR2I moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition(); partialFootprint.MoveAnchorPosition( moveVector ); diff --git a/pcbnew/microwave/microwave_footprint.cpp b/pcbnew/microwave/microwave_footprint.cpp index 7efb851d85..740dcdd10e 100644 --- a/pcbnew/microwave/microwave_footprint.cpp +++ b/pcbnew/microwave/microwave_footprint.cpp @@ -146,7 +146,7 @@ FOOTPRINT* MICROWAVE_TOOL::createFootprint( MICROWAVE_FOOTPRINT_SHAPE aFootprint pad->SetAnchorPadShape( PAD_SHAPE::RECT ); int numPoints = ( angle / 50 ) + 3; // Note: angles are in 0.1 degrees - std::vector polyPoints; + std::vector polyPoints; polyPoints.reserve( numPoints ); polyPoints.emplace_back( wxPoint( 0, 0 ) ); diff --git a/pcbnew/microwave/microwave_polygon.cpp b/pcbnew/microwave/microwave_polygon.cpp index c1c832145b..608b58fa04 100644 --- a/pcbnew/microwave/microwave_polygon.cpp +++ b/pcbnew/microwave/microwave_polygon.cpp @@ -327,7 +327,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape() footprint = createBaseFootprint( cmp_name, 0, pad_count ); // We try to place the footprint anchor to the middle of the shape len - wxPoint offset; + VECTOR2I offset; offset.x = -g_ShapeSize.x / 2; auto it = footprint->Pads().begin(); @@ -348,13 +348,13 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape() footprint->Add( shape, ADD_MODE::INSERT ); // Get the corner buffer of the polygonal edge - std::vector polyPoints; + std::vector polyPoints; polyPoints.reserve( g_PolyEdges.size() + 2 ); // Init start point coord: polyPoints.emplace_back( wxPoint( offset.x, 0 ) ); - wxPoint last_coordinate; + VECTOR2I last_coordinate; for( wxRealPoint& pt: g_PolyEdges ) // Copy points { @@ -377,7 +377,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape() case 1: // Symmetric shape: add the symmetric (mirrored) shape for( int ndx = (int) polyPoints.size() - 1; ndx >= 0; --ndx ) { - wxPoint pt = polyPoints[ndx]; + VECTOR2I pt = polyPoints[ndx]; pt.y = -pt.y; // mirror about X axis polyPoints.push_back( pt ); } diff --git a/pcbnew/netinfo.h b/pcbnew/netinfo.h index 8eb33ca077..d364ca225b 100644 --- a/pcbnew/netinfo.h +++ b/pcbnew/netinfo.h @@ -86,13 +86,13 @@ public: } #endif - wxPoint GetPosition() const override + VECTOR2I GetPosition() const override { - static wxPoint dummy(0, 0); + static VECTOR2I dummy( 0, 0 ); return dummy; } - void SetPosition( const wxPoint& aPos ) override + void SetPosition( const VECTOR2I& aPos ) override { } diff --git a/pcbnew/netlist_reader/board_netlist_updater.cpp b/pcbnew/netlist_reader/board_netlist_updater.cpp index b8ccf15621..37fa4bc5b2 100644 --- a/pcbnew/netlist_reader/board_netlist_updater.cpp +++ b/pcbnew/netlist_reader/board_netlist_updater.cpp @@ -761,7 +761,7 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist ) else { PCB_LAYER_ID layer = zone->GetLayer(); - wxPoint pos = zone->GetPosition(); + VECTOR2I pos = zone->GetPosition(); msg.Printf( _( "Copper zone on layer %s at (%s, %s) has no pads connected." ), m_board->GetLayerName( layer ), diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 8f55e2f400..146bfc183b 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -355,7 +355,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const m_effectiveShape->AddShape( aShape ); }; - wxPoint shapePos = ShapePos(); // Fetch only once; rotation involves trig + VECTOR2I shapePos = ShapePos(); // Fetch only once; rotation involves trig PAD_SHAPE effectiveShape = GetShape(); if( GetShape() == PAD_SHAPE::CUSTOM ) @@ -620,7 +620,7 @@ void PAD::SetOrientation( double aAngle ) } -void PAD::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PAD::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) { @@ -687,16 +687,16 @@ void PAD::FlipPrimitives( bool aFlipLeftRight ) } -wxPoint PAD::ShapePos() const +VECTOR2I PAD::ShapePos() const { if( m_offset.x == 0 && m_offset.y == 0 ) return m_pos; - wxPoint loc_offset = m_offset; + VECTOR2I loc_offset = m_offset; - RotatePoint( &loc_offset, m_orient ); + RotatePoint( loc_offset, m_orient ); - wxPoint shape_pos = m_pos + loc_offset; + VECTOR2I shape_pos = m_pos + loc_offset; return shape_pos; } @@ -961,7 +961,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& } -bool PAD::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PAD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { VECTOR2I delta = aPosition - GetPosition(); int boundingRadius = GetBoundingRadius() + aAccuracy; @@ -1091,9 +1091,9 @@ int PAD::Compare( const PAD* aPadRef, const PAD* aPadCmp ) } -void PAD::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PAD::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { - RotatePoint( &m_pos, aRotCentre, aAngle ); + RotatePoint( m_pos, aRotCentre, aAngle ); m_orient = NormalizeAngle360Min( m_orient + aAngle ); @@ -1512,7 +1512,7 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int dx = m_size.x / 2; int dy = m_size.y / 2; - wxPoint padShapePos = ShapePos(); // Note: for pad having a shape offset, + VECTOR2I padShapePos = ShapePos(); // Note: for pad having a shape offset, // the pad position is NOT the shape position switch( GetShape() ) diff --git a/pcbnew/pad.h b/pcbnew/pad.h index f795c2754b..d160ce9430 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -169,13 +169,13 @@ public: */ PAD_SHAPE GetShape() const { return m_padShape; } - void SetPosition( const wxPoint& aPos ) override + void SetPosition( const VECTOR2I& aPos ) override { m_pos = aPos; SetDirty(); } - wxPoint GetPosition() const override { return m_pos; } + VECTOR2I GetPosition() const override { return m_pos; } /** * @return the shape of the anchor pad shape, for custom shaped pads. @@ -223,8 +223,8 @@ public: void SetY( int y ) { m_pos.y = y; SetDirty(); } void SetX( int x ) { m_pos.x = x; SetDirty(); } - void SetPos0( const wxPoint& aPos ) { m_pos0 = aPos; } - const wxPoint& GetPos0() const { return m_pos0; } + void SetPos0( const VECTOR2I& aPos ) { m_pos0 = aPos; } + const VECTOR2I& GetPos0() const { return m_pos0; } void SetY0( int y ) { m_pos0.y = y; } void SetX0( int x ) { m_pos0.x = x; } @@ -246,10 +246,10 @@ public: void SetDrillSizeY( const int aY ) { m_drill.y = aY; SetDirty(); } const int GetDrillSizeY() const { return m_drill.y; } - void SetOffset( const wxPoint& aOffset ) { m_offset = aOffset; SetDirty(); } - const wxPoint& GetOffset() const { return m_offset; } + void SetOffset( const VECTOR2I& aOffset ) { m_offset = aOffset; SetDirty(); } + const VECTOR2I& GetOffset() const { return m_offset; } - wxPoint GetCenter() const override { return GetPosition(); } + VECTOR2I GetCenter() const override { return GetPosition(); } /** * Has meaning only for custom shape pads. @@ -263,15 +263,15 @@ public: * - a bezier curve */ void AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aFilled ); - void AddPrimitivePoly( const std::vector& aPoly, int aThickness, bool aFilled ); - void AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness ); - void AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled ); - void AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness, + void AddPrimitivePoly( const std::vector& aPoly, int aThickness, bool aFilled ); + void AddPrimitiveSegment( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aThickness ); + void AddPrimitiveCircle( const VECTOR2I& aCenter, int aRadius, int aThickness, bool aFilled ); + void AddPrimitiveRect( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aThickness, bool aFilled ); - void AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle, + void AddPrimitiveArc( const VECTOR2I& aCenter, const VECTOR2I& aStart, int aArcAngle, int aThickness ); - void AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1, - const wxPoint& aCtrl2, int aThickness ); + void AddPrimitiveCurve( const VECTOR2I& aStart, const VECTOR2I& aEnd, const VECTOR2I& aCtrl1, + const VECTOR2I& aCtrl2, int aThickness ); bool GetBestAnchorPosition( VECTOR2I& aPos ); @@ -303,7 +303,7 @@ public: return m_editPrimitives; } - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& VECTOR2I, bool aFlipLeftRight ) override; /** * Flip (mirror) the primitives left to right or top to bottom, around the anchor position @@ -507,7 +507,7 @@ public: void SetRoundRectCornerRadius( double aRadius ); int GetRoundRectCornerRadius() const; - wxPoint ShapePos() const; + VECTOR2I ShapePos() const; /** * Has meaning only for rounded rectangle pads. @@ -582,7 +582,7 @@ public: */ bool FlashLayer( LSET aLayers ) const; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; wxString GetClass() const override @@ -610,14 +610,14 @@ public: */ static int Compare( const PAD* aPadRef, const PAD* aPadCmp ); - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_pos += aMoveVector; SetLocalCoord(); SetDirty(); } - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; @@ -674,7 +674,7 @@ private: wxString m_pinFunction; // Pin name in schematic wxString m_pinType; // Pin electrical type in schematic - wxPoint m_pos; // Pad Position on board + VECTOR2I m_pos; // Pad Position on board PAD_SHAPE m_padShape; // Shape: PAD_SHAPE::CIRCLE, PAD_SHAPE::RECT, // PAD_SHAPE::OVAL, PAD_SHAPE::TRAPEZOID, @@ -728,7 +728,7 @@ private: * of the pad shape (ie: the copper area around the hole). * ShapePos() returns the board shape position according to the offset and the pad rotation. */ - wxPoint m_offset; + VECTOR2I m_offset; LSET m_layerMask; // Bitwise layer: 1 = copper layer, 15 = cmp, // 2..14 = internal layers, 16..31 = technical layers @@ -737,7 +737,7 @@ private: // one end and half expands the other. It is only valid // to have a single axis be non-0. - wxPoint m_pos0; // Initial Pad position (i.e. pad position relative to the + VECTOR2I m_pos0; // Initial Pad position (i.e. pad position relative to the // footprint anchor, orientation 0) PAD_ATTRIB m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB::SMD, PAD_ATTRIB::CONN, diff --git a/pcbnew/pad_custom_shape_functions.cpp b/pcbnew/pad_custom_shape_functions.cpp index 185a369429..d2e6cc3c57 100644 --- a/pcbnew/pad_custom_shape_functions.cpp +++ b/pcbnew/pad_custom_shape_functions.cpp @@ -55,7 +55,7 @@ void PAD::AddPrimitivePoly( const SHAPE_POLY_SET& aPoly, int aThickness, bool aF } -void PAD::AddPrimitivePoly( const std::vector& aPoly, int aThickness, bool aFilled ) +void PAD::AddPrimitivePoly( const std::vector& aPoly, int aThickness, bool aFilled ) { PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::POLY ); item->SetFilled( aFilled ); @@ -67,7 +67,7 @@ void PAD::AddPrimitivePoly( const std::vector& aPoly, int aThickness, b } -void PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int aThickness ) +void PAD::AddPrimitiveSegment( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aThickness ) { PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::SEGMENT ); item->SetFilled( false ); @@ -80,7 +80,7 @@ void PAD::AddPrimitiveSegment( const wxPoint& aStart, const wxPoint& aEnd, int a } -void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aArcAngle, +void PAD::AddPrimitiveArc( const VECTOR2I& aCenter, const VECTOR2I& aStart, int aArcAngle, int aThickness ) { PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::ARC ); @@ -95,8 +95,8 @@ void PAD::AddPrimitiveArc( const wxPoint& aCenter, const wxPoint& aStart, int aA } -void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aCtrl1, - const wxPoint& aCtrl2, int aThickness ) +void PAD::AddPrimitiveCurve( const VECTOR2I& aStart, const VECTOR2I& aEnd, const VECTOR2I& aCtrl1, + const VECTOR2I& aCtrl2, int aThickness ) { PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::BEZIER ); item->SetFilled( false ); @@ -111,7 +111,7 @@ void PAD::AddPrimitiveCurve( const wxPoint& aStart, const wxPoint& aEnd, const w } -void PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThickness, bool aFilled ) +void PAD::AddPrimitiveCircle( const VECTOR2I& aCenter, int aRadius, int aThickness, bool aFilled ) { PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T::CIRCLE ); item->SetFilled( aFilled ); @@ -124,7 +124,7 @@ void PAD::AddPrimitiveCircle( const wxPoint& aCenter, int aRadius, int aThicknes } -void PAD::AddPrimitiveRect( const wxPoint& aStart, const wxPoint& aEnd, int aThickness, +void PAD::AddPrimitiveRect( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aThickness, bool aFilled) { PCB_SHAPE* item = new PCB_SHAPE( nullptr, SHAPE_T:: RECT ); diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 9bc40a945e..c185d00036 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -287,7 +287,7 @@ void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer ) // Focus on the object's location. Prefer a visible part of the object to its anchor // in order to keep from scrolling around. - wxPoint focusPt = aItem->GetFocusPosition(); + VECTOR2I focusPt = aItem->GetFocusPosition(); KIGFX::VIEW* view = GetCanvas()->GetView(); SHAPE_POLY_SET viewportPoly( view->GetViewport() ); diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp index 2ffef7a189..4295b1035d 100644 --- a/pcbnew/pcb_dimension.cpp +++ b/pcbnew/pcb_dimension.cpp @@ -200,7 +200,7 @@ void PCB_DIMENSION_BASE::SetLayer( PCB_LAYER_ID aLayer ) } -void PCB_DIMENSION_BASE::Move( const wxPoint& offset ) +void PCB_DIMENSION_BASE::Move( const VECTOR2I& offset ) { m_text.Offset( offset ); @@ -211,7 +211,7 @@ void PCB_DIMENSION_BASE::Move( const wxPoint& offset ) } -void PCB_DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_DIMENSION_BASE::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { double newAngle = m_text.GetTextAngle().AsTenthsOfADegree() + aAngle; @@ -224,14 +224,14 @@ void PCB_DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle ) RotatePoint( pt, aRotCentre, aAngle ); m_text.SetTextPos( pt ); - RotatePoint( &m_start, aRotCentre, aAngle ); - RotatePoint( &m_end, aRotCentre, aAngle ); + RotatePoint( m_start, aRotCentre, aAngle ); + RotatePoint( m_end, aRotCentre, aAngle ); Update(); } -void PCB_DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_DIMENSION_BASE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { Mirror( aCentre ); @@ -239,7 +239,7 @@ void PCB_DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void PCB_DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) +void PCB_DIMENSION_BASE::Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight ) { int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y; VECTOR2I newPos = m_text.GetTextPos(); @@ -308,7 +308,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, if( Type() == PCB_DIM_CENTER_T || Type() == PCB_FP_DIM_CENTER_T ) { - wxPoint startCoord = originTransforms.ToDisplayAbs( GetStart() ); + VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() ); wxString start = wxString::Format( "@(%s, %s)", MessageTextFromValue( units, startCoord.x ), MessageTextFromValue( units, startCoord.y ) ); @@ -317,11 +317,11 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, } else { - wxPoint startCoord = originTransforms.ToDisplayAbs( GetStart() ); + VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() ); wxString start = wxString::Format( "@(%s, %s)", MessageTextFromValue( units, startCoord.x ), MessageTextFromValue( units, startCoord.y ) ); - wxPoint endCoord = originTransforms.ToDisplayAbs( GetEnd() ); + VECTOR2I endCoord = originTransforms.ToDisplayAbs( GetEnd() ); wxString end = wxString::Format( "@(%s, %s)", MessageTextFromValue( units, endCoord.x ), MessageTextFromValue( units, endCoord.y ) ); @@ -349,7 +349,7 @@ std::shared_ptr PCB_DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLaye } -bool PCB_DIMENSION_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_DIMENSION_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { if( m_text.TextHitTest( aPosition ) ) return true; @@ -552,7 +552,7 @@ BITMAPS PCB_DIM_ALIGNED::GetMenuImage() const } -void PCB_DIM_ALIGNED::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd ) +void PCB_DIM_ALIGNED::UpdateHeight( const VECTOR2I& aCrossbarStart, const VECTOR2I& aCrossbarEnd ) { VECTOR2D height( aCrossbarStart - GetStart() ); VECTOR2D crossBar( aCrossbarEnd - aCrossbarStart ); @@ -878,7 +878,7 @@ void PCB_DIM_ORTHOGONAL::updateText() } -void PCB_DIM_ORTHOGONAL::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_DIM_ORTHOGONAL::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { // restrict angle to -179.9 to 180.0 degrees if( aAngle > 1800 ) @@ -1069,7 +1069,7 @@ void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetOriginTransforms(); EDA_UNITS units = aFrame->GetUserUnits(); - wxPoint startCoord = originTransforms.ToDisplayAbs( GetStart() ); + VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() ); wxString start = wxString::Format( "@(%s, %s)", MessageTextFromValue( units, startCoord.x ), MessageTextFromValue( units, startCoord.y ) ); @@ -1117,11 +1117,11 @@ BITMAPS PCB_DIM_RADIAL::GetMenuImage() const } -wxPoint PCB_DIM_RADIAL::GetKnee() const +VECTOR2I PCB_DIM_RADIAL::GetKnee() const { VECTOR2I radial( m_end - m_start ); - return m_end + (wxPoint) radial.Resize( m_leaderLength ); + return m_end + radial.Resize( m_leaderLength ); } diff --git a/pcbnew/pcb_dimension.h b/pcbnew/pcb_dimension.h index b5811012e3..2cd63efc89 100644 --- a/pcbnew/pcb_dimension.h +++ b/pcbnew/pcb_dimension.h @@ -118,14 +118,14 @@ public: * one or more feature points, so every dimension has at least an origin. * @return the origin point of this dimension */ - virtual const wxPoint& GetStart() const { return m_start; } - virtual void SetStart( const wxPoint& aPoint ) { m_start = aPoint; } + virtual const VECTOR2I& GetStart() const { return m_start; } + virtual void SetStart( const VECTOR2I& aPoint ) { m_start = aPoint; } - virtual const wxPoint& GetEnd() const { return m_end; } - virtual void SetEnd( const wxPoint& aPoint ) { m_end = aPoint; } + virtual const VECTOR2I& GetEnd() const { return m_end; } + virtual void SetEnd( const VECTOR2I& aPoint ) { m_end = aPoint; } - wxPoint GetPosition() const override { return m_start; } - void SetPosition( const wxPoint& aPos ) override { m_start = aPos; } + VECTOR2I GetPosition() const override { return m_start; } + void SetPosition( const VECTOR2I& aPos ) override { m_start = aPos; } bool GetOverrideTextEnabled() const { return m_overrideTextEnabled; } void SetOverrideTextEnabled( bool aOverride ) { m_overrideTextEnabled = aOverride; } @@ -221,9 +221,9 @@ public: // BOARD_ITEM overrides - void Move( const wxPoint& offset ) override; - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Move( const VECTOR2I& offset ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; /** * Mirror the dimension relative to a given horizontal axis. @@ -233,11 +233,11 @@ public: * * @param axis_pos is the vertical axis position to mirror around. */ - void Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight = false ); + void Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight = false ); void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; const EDA_RECT GetBoundingBox() const override; @@ -304,8 +304,8 @@ protected: // Internal PCB_TEXT m_text; ///< The actual text object int m_measuredValue; ///< value of PCB dimensions - wxPoint m_start; - wxPoint m_end; + VECTOR2I m_start; + VECTOR2I m_end; ///< Internal cache of drawn shapes std::vector> m_shapes; @@ -363,9 +363,9 @@ public: BITMAPS GetMenuImage() const override; - const wxPoint& GetCrossbarStart() const { return m_crossBarStart; } + const VECTOR2I& GetCrossbarStart() const { return m_crossBarStart; } - const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; } + const VECTOR2I& GetCrossbarEnd() const { return m_crossBarEnd; } /** * Set the distance from the feature points to the crossbar line. @@ -380,7 +380,7 @@ public: * * @param aCrossbarStart is the start point of the crossbar. */ - void UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd ); + void UpdateHeight( const VECTOR2I& aCrossbarStart, const VECTOR2I& aCrossbarEnd ); void SetExtensionHeight( int aHeight ) { m_extensionHeight = aHeight; } int GetExtensionHeight() const { return m_extensionHeight; } @@ -413,8 +413,8 @@ protected: int m_height; ///< Perpendicular distance from features to crossbar int m_extensionHeight; ///< Length of extension lines past the crossbar - wxPoint m_crossBarStart; ///< Crossbar start control point - wxPoint m_crossBarEnd; ///< Crossbar end control point + VECTOR2I m_crossBarStart; ///< Crossbar start control point + VECTOR2I m_crossBarEnd; ///< Crossbar end control point }; @@ -460,7 +460,7 @@ public: { return wxT( "PCB_DIM_ORTHOGONAL" ); } - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; protected: void updateGeometry() override; @@ -513,7 +513,7 @@ public: int GetLeaderLength() const { return m_leaderLength; } // Returns the point (c). - wxPoint GetKnee() const; + VECTOR2I GetKnee() const; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index a9c0916b74..59eb446d4a 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -113,15 +113,15 @@ bool PCB_GROUP::WithinScope( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootpr } -wxPoint PCB_GROUP::GetPosition() const +VECTOR2I PCB_GROUP::GetPosition() const { - return (wxPoint)GetBoundingBox().Centre(); + return GetBoundingBox().Centre(); } -void PCB_GROUP::SetPosition( const wxPoint& aNewpos ) +void PCB_GROUP::SetPosition( const VECTOR2I& aNewpos ) { - wxPoint delta = aNewpos - GetPosition(); + VECTOR2I delta = aNewpos - GetPosition(); Move( delta ); } @@ -206,7 +206,7 @@ void PCB_GROUP::SwapData( BOARD_ITEM* aImage ) } -bool PCB_GROUP::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_GROUP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // Groups are selected by promoting a selection of one of their children return false; @@ -289,21 +289,21 @@ double PCB_GROUP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const } -void PCB_GROUP::Move( const wxPoint& aMoveVector ) +void PCB_GROUP::Move( const VECTOR2I& aMoveVector ) { for( BOARD_ITEM* member : m_items ) member->Move( aMoveVector ); } -void PCB_GROUP::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_GROUP::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { for( BOARD_ITEM* item : m_items ) item->Rotate( aRotCentre, aAngle ); } -void PCB_GROUP::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_GROUP::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { for( BOARD_ITEM* item : m_items ) item->Flip( aCentre, aFlipLeftRight ); diff --git a/pcbnew/pcb_marker.cpp b/pcbnew/pcb_marker.cpp index 9d9eec0bdc..fbf29475a6 100644 --- a/pcbnew/pcb_marker.cpp +++ b/pcbnew/pcb_marker.cpp @@ -44,7 +44,7 @@ -PCB_MARKER::PCB_MARKER( std::shared_ptr aItem, const wxPoint& aPosition ) : +PCB_MARKER::PCB_MARKER( std::shared_ptr aItem, const VECTOR2I& aPosition ) : BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add() MARKER_BASE( SCALING_FACTOR, aItem ) { @@ -137,13 +137,13 @@ void PCB_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector aItem, const wxPoint& aPosition ); + PCB_MARKER( std::shared_ptr aItem, const VECTOR2I& aPosition ); ~PCB_MARKER(); static inline bool ClassOf( const EDA_ITEM* aItem ) @@ -55,24 +55,24 @@ public: static PCB_MARKER* Deserialize( const wxString& data ); - void Move(const wxPoint& aMoveVector) override + void Move( const VECTOR2I& aMoveVector ) override { m_Pos += aMoveVector; } - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; - wxPoint GetPosition() const override { return m_Pos; } - void SetPosition( const wxPoint& aPos ) override { m_Pos = aPos; } + VECTOR2I GetPosition() const override { return m_Pos; } + void SetPosition( const VECTOR2I& aPos ) override { m_Pos = aPos; } - wxPoint GetCenter() const override + VECTOR2I GetCenter() const override { return GetPosition(); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { if( GetMarkerType() == MARKER_RATSNEST ) return false; diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 1911f5a869..b9f897d546 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -1353,7 +1353,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer ) case SHAPE_T::RECT: { - std::vector pts = aShape->GetRectCorners(); + std::vector pts = aShape->GetRectCorners(); if( outline_mode ) { @@ -1380,7 +1380,7 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer ) SHAPE_POLY_SET poly; poly.NewOutline(); - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) poly.Append( pt ); m_gal->DrawPolygon( poly ); diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index 0c258826ea..ab1eec36fd 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -52,7 +52,7 @@ PCB_SHAPE::~PCB_SHAPE() } -const wxPoint PCB_SHAPE::GetFocusPosition() const +const VECTOR2I PCB_SHAPE::GetFocusPosition() const { // For some shapes return the visual center, but for not filled polygonal shapes, // the center is usually far from the shape: a point on the outline is better @@ -94,7 +94,7 @@ const wxPoint PCB_SHAPE::GetFocusPosition() const } -void PCB_SHAPE::Move( const wxPoint& aMoveVector ) +void PCB_SHAPE::Move( const VECTOR2I& aMoveVector ) { move( aMoveVector ); } @@ -106,13 +106,13 @@ void PCB_SHAPE::Scale( double aScale ) } -void PCB_SHAPE::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_SHAPE::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { rotate( aRotCentre, aAngle ); } -void PCB_SHAPE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_SHAPE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { flip( aCentre, aFlipLeftRight ); @@ -138,7 +138,7 @@ double PCB_SHAPE::getParentOrientation() const } -wxPoint PCB_SHAPE::getParentPosition() const +VECTOR2I PCB_SHAPE::getParentPosition() const { if( GetParentFootprint() ) return GetParentFootprint()->GetPosition(); diff --git a/pcbnew/pcb_shape.h b/pcbnew/pcb_shape.h index fee90d02ef..0fd35d23a8 100644 --- a/pcbnew/pcb_shape.h +++ b/pcbnew/pcb_shape.h @@ -73,10 +73,10 @@ public: return false; } - void SetPosition( const wxPoint& aPos ) override { setPosition( aPos ); } - wxPoint GetPosition() const override { return getPosition(); } + void SetPosition( const VECTOR2I& aPos ) override { setPosition( aPos ); } + VECTOR2I GetPosition() const override { return getPosition(); } - wxPoint GetCenter() const override { return getCenter(); } + VECTOR2I GetCenter() const override { return getCenter(); } bool HasLineStroke() const override { return true; } @@ -87,7 +87,7 @@ public: * Allows items to return their visual center rather than their anchor. For some shapes this * is similar to GetCenter(), but for unfilled shapes a point on the outline is better. */ - const wxPoint GetFocusPosition() const override; + const VECTOR2I GetFocusPosition() const override; /** * Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint. @@ -105,7 +105,7 @@ public: const EDA_RECT GetBoundingBox() const override { return getBoundingBox(); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { return hitTest( aPosition, aAccuracy ); } @@ -115,11 +115,11 @@ public: return hitTest( aRect, aContained, aAccuracy ); } - virtual void Move( const wxPoint& aMoveVector ) override; + virtual void Move( const VECTOR2I& aMoveVector ) override; - virtual void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + virtual void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + virtual void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; void Scale( double aScale ); @@ -161,7 +161,7 @@ public: protected: double getParentOrientation() const override; - wxPoint getParentPosition() const override; + VECTOR2I getParentPosition() const override; }; #endif // PCB_SHAPE_H diff --git a/pcbnew/pcb_target.cpp b/pcbnew/pcb_target.cpp index 7db6c234bb..b55baa3726 100644 --- a/pcbnew/pcb_target.cpp +++ b/pcbnew/pcb_target.cpp @@ -62,7 +62,7 @@ PCB_TARGET::~PCB_TARGET() } -bool PCB_TARGET::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_TARGET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int dX = aPosition.x - m_pos.x; int dY = aPosition.y - m_pos.y; @@ -83,13 +83,13 @@ bool PCB_TARGET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy } -void PCB_TARGET::Rotate(const wxPoint& aRotCentre, double aAngle) +void PCB_TARGET::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { - RotatePoint( &m_pos, aRotCentre, aAngle ); + RotatePoint( m_pos, aRotCentre, aAngle ); } -void PCB_TARGET::Flip(const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_TARGET::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) m_pos.x = aCentre.x - ( m_pos.x - aCentre.x ); diff --git a/pcbnew/pcb_target.h b/pcbnew/pcb_target.h index 76545e1f5e..f9f3985d7d 100644 --- a/pcbnew/pcb_target.h +++ b/pcbnew/pcb_target.h @@ -52,8 +52,8 @@ public: return aItem && PCB_TARGET_T == aItem->Type(); } - void SetPosition( const wxPoint& aPos ) override { m_pos = aPos; } - wxPoint GetPosition() const override { return m_pos; } + void SetPosition( const VECTOR2I& aPos ) override { m_pos = aPos; } + VECTOR2I GetPosition() const override { return m_pos; } void SetShape( int aShape ) { m_shape = aShape; } int GetShape() const { return m_shape; } @@ -64,21 +64,21 @@ public: void SetWidth( int aWidth ) { m_lineWidth = aWidth; } int GetWidth() const { return m_lineWidth; } - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_pos += aMoveVector; } - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; wxString GetClass() const override { return wxT( "PCB_TARGET" ); } - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; // Virtual function @@ -101,10 +101,10 @@ public: #endif private: - int m_shape; // bit 0 : 0 = draw +, 1 = draw X - int m_size; - int m_lineWidth; - wxPoint m_pos; + int m_shape; // bit 0 : 0 = draw +, 1 = draw X + int m_size; + int m_lineWidth; + VECTOR2I m_pos; }; diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp index b48f53e6fb..53e496e67f 100644 --- a/pcbnew/pcb_text.cpp +++ b/pcbnew/pcb_text.cpp @@ -146,7 +146,7 @@ const EDA_RECT PCB_TEXT::GetBoundingBox() const } -bool PCB_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const +bool PCB_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const { return EDA_TEXT::TextHitTest( aPoint, aAccuracy ); } @@ -165,7 +165,7 @@ bool PCB_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy } -void PCB_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_TEXT::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { VECTOR2I pt = GetTextPos(); RotatePoint( pt, aRotCentre, aAngle ); @@ -175,7 +175,7 @@ void PCB_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle ) } -void PCB_TEXT::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_TEXT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) { diff --git a/pcbnew/pcb_text.h b/pcbnew/pcb_text.h index 70261bb30d..ee1b2db78a 100644 --- a/pcbnew/pcb_text.h +++ b/pcbnew/pcb_text.h @@ -73,17 +73,17 @@ public: return BOARD_ITEM::Matches( GetShownText(), aSearchData ); } - virtual wxPoint GetPosition() const override + virtual VECTOR2I GetPosition() const override { - return (wxPoint)EDA_TEXT::GetTextPos(); + return EDA_TEXT::GetTextPos(); } - virtual void SetPosition( const wxPoint& aPos ) override + virtual void SetPosition( const VECTOR2I& aPos ) override { EDA_TEXT::SetTextPos( aPos ); } - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { EDA_TEXT::Offset( aMoveVector ); } @@ -91,16 +91,16 @@ public: void SetTextAngle( double aAngle ) override; void SetTextAngle( const EDA_ANGLE& aAngle ); - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override; + bool TextHitTest( const VECTOR2I& aPoint, int aAccuracy = 0 ) const override; bool TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy = 0 ) const override; - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override + bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override { return TextHitTest( aPosition, aAccuracy ); } diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 1a61261f81..bef6167ed1 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -178,7 +178,7 @@ int PCB_VIA::GetDrillValue() const } -EDA_ITEM_FLAGS PCB_TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) const +EDA_ITEM_FLAGS PCB_TRACK::IsPointOnEnds( const VECTOR2I& point, int min_dist ) const { EDA_ITEM_FLAGS result = 0; @@ -262,22 +262,22 @@ double PCB_TRACK::GetLength() const } -void PCB_TRACK::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_TRACK::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { - RotatePoint( &m_Start, aRotCentre, aAngle ); - RotatePoint( &m_End, aRotCentre, aAngle ); + RotatePoint( m_Start, aRotCentre, aAngle ); + RotatePoint( m_End, aRotCentre, aAngle ); } -void PCB_ARC::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_ARC::Rotate( const VECTOR2I& aRotCentre, double aAngle ) { - RotatePoint( &m_Start, aRotCentre, aAngle ); - RotatePoint( &m_End, aRotCentre, aAngle ); - RotatePoint( &m_Mid, aRotCentre, aAngle ); + RotatePoint( m_Start, aRotCentre, aAngle ); + RotatePoint( m_End, aRotCentre, aAngle ); + RotatePoint( m_Mid, aRotCentre, aAngle ); } -void PCB_TRACK::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_TRACK::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) { @@ -295,7 +295,7 @@ void PCB_TRACK::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void PCB_ARC::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_ARC::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) { @@ -315,7 +315,7 @@ void PCB_ARC::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void PCB_VIA::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_VIA::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) { @@ -820,13 +820,13 @@ wxString PCB_VIA::layerMaskDescribe() const } -bool PCB_TRACK::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_TRACK::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { return TestSegmentHit( aPosition, m_Start, m_End, aAccuracy + ( m_Width / 2 ) ); } -bool PCB_ARC::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_ARC::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int max_dist = aAccuracy + ( m_Width / 2 ); @@ -837,8 +837,8 @@ bool PCB_ARC::HitTest( const wxPoint& aPosition, int aAccuracy ) const return true; } - wxPoint center = GetPosition(); - wxPoint relpos = aPosition - center; + VECTOR2I center = GetPosition(); + VECTOR2I relpos = aPosition - center; double dist = EuclideanNorm( relpos ); double radius = GetRadius(); @@ -862,12 +862,12 @@ bool PCB_ARC::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -bool PCB_VIA::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_VIA::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { int max_dist = aAccuracy + ( m_Width / 2 ); // rel_pos is aPosition relative to m_Start (or the center of the via) - wxPoint rel_pos = aPosition - m_Start; + VECTOR2I rel_pos = aPosition - m_Start; double dist = (double) rel_pos.x * rel_pos.x + (double) rel_pos.y * rel_pos.y; return dist <= (double) max_dist * max_dist; } @@ -957,24 +957,24 @@ void PCB_VIA::SwapData( BOARD_ITEM* aImage ) } -wxPoint PCB_ARC::GetPosition() const +VECTOR2I PCB_ARC::GetPosition() const { - auto center = CalcArcCenter( VECTOR2I( m_Start ), VECTOR2I( m_Mid ), VECTOR2I( m_End )); - return wxPoint( center.x, center.y ); + VECTOR2I center = CalcArcCenter( m_Start, m_Mid, m_End ); + return center; } double PCB_ARC::GetRadius() const { - auto center = CalcArcCenter( VECTOR2I( m_Start ), VECTOR2I( m_Mid ), VECTOR2I( m_End )); - return GetLineLength( wxPoint( center ), m_Start ); + auto center = CalcArcCenter( m_Start, m_Mid , m_End ); + return GetLineLength( center, m_Start ); } double PCB_ARC::GetAngle() const { - wxPoint center = GetPosition(); - wxPoint p0 = m_Start - center; - wxPoint p1 = m_Mid - center; - wxPoint p2 = m_End - center; + VECTOR2I center = GetPosition(); + VECTOR2I p0 = m_Start - center; + VECTOR2I p1 = m_Mid - center; + VECTOR2I p2 = m_End - center; double angle1 = ArcTangente( p1.y, p1.x ) - ArcTangente( p0.y, p0.x ); double angle2 = ArcTangente( p2.y, p2.x ) - ArcTangente( p1.y, p1.x ); @@ -983,7 +983,7 @@ double PCB_ARC::GetAngle() const double PCB_ARC::GetArcAngleStart() const { - wxPoint center = GetPosition(); + VECTOR2I center = GetPosition(); double angleStart = ArcTangente( m_Start.y - center.y, m_Start.x - center.x ); @@ -992,7 +992,7 @@ double PCB_ARC::GetArcAngleStart() const double PCB_ARC::GetArcAngleEnd() const { - wxPoint center = GetPosition(); + VECTOR2I center = GetPosition(); double angleEnd = ArcTangente( m_End.y - center.y, m_End.x - center.x ); diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index 409727f4a0..a1482c2a4e 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -84,28 +84,28 @@ public: // Do not create a copy constructor. The one generated by the compiler is adequate. - void Move( const wxPoint& aMoveVector ) override + void Move( const VECTOR2I& aMoveVector ) override { m_Start += aMoveVector; m_End += aMoveVector; } - void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; - void SetPosition( const wxPoint& aPos ) override { m_Start = aPos; } - wxPoint GetPosition() const override { return m_Start; } - const wxPoint GetFocusPosition() const override { return ( m_Start + m_End ) / 2; } + void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; } + VECTOR2I GetPosition() const override { return m_Start; } + const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; } void SetWidth( int aWidth ) { m_Width = aWidth; } int GetWidth() const { return m_Width; } - void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; } - const wxPoint& GetEnd() const { return m_End; } + void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; } + const VECTOR2I& GetEnd() const { return m_End; } - void SetStart( const wxPoint& aStart ) { m_Start = aStart; } - const wxPoint& GetStart() const { return m_Start; } + void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; } + const VECTOR2I& GetStart() const { return m_Start; } void SetEndX( int aX ) { m_End.x = aX; } void SetEndY( int aY ) { m_End.y = aY; } @@ -114,7 +114,7 @@ public: int GetEndY() const { return m_End.y; } /// Return the selected endpoint (start or end) - const wxPoint& GetEndPoint( ENDPOINT_T aEndPoint ) const + const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const { if( aEndPoint == ENDPOINT_START ) return m_Start; @@ -158,7 +158,7 @@ public: * (dist = min_dist) both ends, or 0 if none of the above. * if min_dist < 0: min_dist = track_width/2 */ - EDA_ITEM_FLAGS IsPointOnEnds( const wxPoint& point, int min_dist = 0 ) const; + EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const; /** * Function IsNull @@ -173,7 +173,7 @@ public: SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool ApproxCollinear( const PCB_TRACK& aTrack ); @@ -234,9 +234,9 @@ protected: void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector& aList ) const; - int m_Width; ///< Thickness of track, or via diameter - wxPoint m_Start; ///< Line start point - wxPoint m_End; ///< Line end point + int m_Width; ///< Thickness of track, or via diameter + VECTOR2I m_Start; ///< Line start point + VECTOR2I m_End; ///< Line end point }; @@ -256,34 +256,34 @@ public: return aItem && PCB_ARC_T == aItem->Type(); } - virtual void Move( const wxPoint& aMoveVector ) override + virtual void Move( const VECTOR2I& aMoveVector ) override { m_Start += aMoveVector; m_Mid += aMoveVector; m_End += aMoveVector; } - virtual void Rotate( const wxPoint& aRotCentre, double aAngle ) override; + virtual void Rotate( const VECTOR2I& aRotCentre, double aAngle ) override; - virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + virtual void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; - void SetMid( const wxPoint& aMid ) { m_Mid = aMid; } - const wxPoint& GetMid() const { return m_Mid; } + void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; } + const VECTOR2I& GetMid() const { return m_Mid; } - void SetPosition( const wxPoint& aPos ) override + void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; } - virtual wxPoint GetPosition() const override; + virtual VECTOR2I GetPosition() const override; - virtual wxPoint GetCenter() const override { return GetPosition(); } + virtual VECTOR2I GetCenter() const override { return GetPosition(); } double GetRadius() const; double GetAngle() const; double GetArcAngleStart() const; double GetArcAngleEnd() const; - virtual bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; virtual bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const override; @@ -313,7 +313,7 @@ public: virtual void SwapData( BOARD_ITEM* aImage ) override; private: - wxPoint m_Mid; ///< Arc mid point, halfway between start and end + VECTOR2I m_Mid; ///< Arc mid point, halfway between start and end }; @@ -388,12 +388,12 @@ public: */ void SanitizeLayers(); - wxPoint GetPosition() const override { return m_Start; } - void SetPosition( const wxPoint& aPoint ) override { m_Start = aPoint; m_End = aPoint; } + VECTOR2I GetPosition() const override { return m_Start; } + void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; } void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; wxString GetClass() const override @@ -411,7 +411,7 @@ public: double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; - void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; #if defined (DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 20cad0301a..bb3dfb356a 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -132,7 +132,7 @@ private: * * It compensate and clamp the drill mark size depending on the current plot options. */ - void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos, + void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I& aDrillPos, const wxSize& aDrillSize, const wxSize& aPadSize, double aOrientation, int aSmallDrill ); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 768dddd316..636242870d 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -79,7 +79,7 @@ COLOR4D BRDITEMS_PLOTTER::getColor( int aLayer ) const void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_MODE aPlotMode ) { - wxPoint shape_pos = aPad->ShapePos(); + VECTOR2I shape_pos = aPad->ShapePos(); GBR_METADATA gbr_metadata; bool plotOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any(); @@ -591,7 +591,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape ) case SHAPE_T::RECT: { - std::vector pts = aShape->GetRectCorners(); + std::vector pts = aShape->GetRectCorners(); if( sketch || thickness > 0 ) { @@ -605,7 +605,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape ) { SHAPE_LINE_CHAIN poly; - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) poly.Append( pt ); m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata ); @@ -653,7 +653,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape ) case SHAPE_T::POLY: if( aShape->IsPolyShapeValid() ) { - std::vector cornerList; + std::vector cornerList; aShape->DupPolyPointsList( cornerList ); // We must compute board coordinates from m_PolyList which are relative to the parent @@ -664,9 +664,8 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape ) { for( unsigned ii = 0; ii < cornerList.size(); ++ii ) { - wxPoint* corner = &cornerList[ii]; - RotatePoint( corner, parentFootprint->GetOrientation() ); - *corner += parentFootprint->GetPosition(); + RotatePoint( cornerList[ii], parentFootprint->GetOrientation() ); + cornerList[ii] += parentFootprint->GetPosition(); } } @@ -770,7 +769,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( const PCB_TEXT* aText ) if( aText->IsMultilineAllowed() ) { - std::vector positions; + std::vector positions; wxArrayString strings_list; wxStringSplit( shownText, strings_list, '\n' ); positions.reserve( strings_list.Count() ); @@ -1012,7 +1011,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) case SHAPE_T::RECT: { - std::vector pts = aShape->GetRectCorners(); + std::vector pts = aShape->GetRectCorners(); if( sketch || thickness > 0 ) { @@ -1026,7 +1025,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) { SHAPE_LINE_CHAIN poly; - for( const wxPoint& pt : pts ) + for( const VECTOR2I& pt : pts ) poly.Append( pt ); m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata ); @@ -1059,7 +1058,7 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape ) } -void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const wxPoint& aDrillPos, +void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I& aDrillPos, const wxSize& aDrillSize, const wxSize& aPadSize, double aOrientation, int aSmallDrill ) { diff --git a/pcbnew/plugins/altium/altium_parser_pcb.h b/pcbnew/plugins/altium/altium_parser_pcb.h index 3e7bafb67f..5a678f06d5 100644 --- a/pcbnew/plugins/altium/altium_parser_pcb.h +++ b/pcbnew/plugins/altium/altium_parser_pcb.h @@ -209,8 +209,8 @@ struct ALTIUM_VERTICE const int32_t radius; const double startangle; const double endangle; - const wxPoint position; - const wxPoint center; + const VECTOR2I position; + const VECTOR2I center; explicit ALTIUM_VERTICE( const wxPoint& aPosition ) : isRound( false ), @@ -218,7 +218,7 @@ struct ALTIUM_VERTICE startangle( 0. ), endangle( 0. ), position( aPosition ), - center( wxPoint( 0, 0 ) ) + center( VECTOR2I( 0, 0 ) ) { } @@ -412,10 +412,10 @@ struct ADIMENSION6 ALTIUM_UNIT textunit; - wxPoint xy1; + VECTOR2I xy1; - std::vector referencePoint; - std::vector textPoint; + std::vector referencePoint; + std::vector textPoint; explicit ADIMENSION6( ALTIUM_PARSER& aReader ); }; @@ -519,7 +519,7 @@ struct AARC6 uint16_t component; uint16_t subpolyindex; - wxPoint center; + VECTOR2I center; uint32_t radius; double startangle; double endangle; diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index a5fb22f60d..de55d1fc5d 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -180,14 +180,14 @@ void HelperShapeLineChainFromAltiumVertices( SHAPE_LINE_CHAIN& aLine, double startradiant = DEG2RAD( vertex.startangle ); double endradiant = DEG2RAD( vertex.endangle ); - wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * vertex.radius ), + VECTOR2I arcStartOffset = VECTOR2I( KiROUND( std::cos( startradiant ) * vertex.radius ), -KiROUND( std::sin( startradiant ) * vertex.radius ) ); - wxPoint arcEndOffset = wxPoint( KiROUND( std::cos( endradiant ) * vertex.radius ), + VECTOR2I arcEndOffset = VECTOR2I( KiROUND( std::cos( endradiant ) * vertex.radius ), -KiROUND( std::sin( endradiant ) * vertex.radius ) ); - wxPoint arcStart = vertex.center + arcStartOffset; - wxPoint arcEnd = vertex.center + arcEndOffset; + VECTOR2I arcStart = vertex.center + arcStartOffset; + VECTOR2I arcEnd = vertex.center + arcEndOffset; if( GetLineLength( arcStart, vertex.position ) < GetLineLength( arcEnd, vertex.position ) ) @@ -609,7 +609,7 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, // Enforce a minimum on the radialLine else we won't have enough precision to get the // angle from it. radialLine = radialLine.Resize( std::max( radius, 2 ) ); - dim->SetEnd( dim->GetStart() + (wxPoint) radialLine ); + dim->SetEnd( dim->GetStart() + (VECTOR2I) radialLine ); dim->SetLeaderLength( totalLength - radius ); dim->Update(); } @@ -623,7 +623,7 @@ void ALTIUM_PCB::Parse( const CFB::CompoundFileReader& aReader, int desired_x = ( w - bbbox.GetWidth() ) / 2; int desired_y = ( h - bbbox.GetHeight() ) / 2; - wxPoint movementVector( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ); + VECTOR2I movementVector( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ); m_board->Move( movementVector ); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); @@ -876,9 +876,9 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector& aV double includedAngle = cur->endangle - cur->startangle; double startAngle = DEG2RAD( cur->endangle ); - wxPoint startOffset = wxPoint( KiROUND( std::cos( startAngle ) * cur->radius ), + VECTOR2I startOffset = VECTOR2I( KiROUND( std::cos( startAngle ) * cur->radius ), -KiROUND( std::sin( startAngle ) * cur->radius ) ); - wxPoint arcStart = cur->center + startOffset; + VECTOR2I arcStart = cur->center + startOffset; shape->SetCenter( cur->center ); shape->SetStart( arcStart ); @@ -887,9 +887,9 @@ void ALTIUM_PCB::HelperCreateBoardOutline( const std::vector& aV if( !last->isRound ) { double endAngle = DEG2RAD( cur->endangle ); - wxPoint endOffset = wxPoint( KiROUND( std::cos( endAngle ) * cur->radius ), + VECTOR2I endOffset = VECTOR2I( KiROUND( std::cos( endAngle ) * cur->radius ), -KiROUND( std::sin( endAngle ) * cur->radius ) ); - wxPoint arcEnd = cur->center + endOffset; + VECTOR2I arcEnd = cur->center + endOffset; PCB_SHAPE* shape2 = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT ); m_board->Add( shape2, ADD_MODE::APPEND ); @@ -1030,7 +1030,7 @@ void ALTIUM_PCB::ParseComponentsBodies6Data( const CFB::CompoundFileReader& aRea } FOOTPRINT* footprint = m_components.at( elem.component ); - const wxPoint& fpPosition = footprint->GetPosition(); + const VECTOR2I& fpPosition = footprint->GetPosition(); FP_3DMODEL modelSettings; @@ -1080,8 +1080,8 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) klayer = Eco1_User; } - wxPoint referencePoint0 = aElem.referencePoint.at( 0 ); - wxPoint referencePoint1 = aElem.referencePoint.at( 1 ); + VECTOR2I referencePoint0 = aElem.referencePoint.at( 0 ); + VECTOR2I referencePoint1 = aElem.referencePoint.at( 1 ); PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board, PCB_DIM_ALIGNED_T ); m_board->Add( dimension, ADD_MODE::APPEND ); @@ -1101,11 +1101,11 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) * intersect it with REFERENCE1POINT pointing the same direction as REFERENCE0POINT -> XY1. * This should give us a valid measurement point where we can place the drawsegment. */ - wxPoint direction = aElem.xy1 - referencePoint0; - wxPoint directionNormalVector = wxPoint( -direction.y, direction.x ); + VECTOR2I direction = aElem.xy1 - referencePoint0; + VECTOR2I directionNormalVector = VECTOR2I( -direction.y, direction.x ); SEG segm1( referencePoint0, referencePoint0 + directionNormalVector ); SEG segm2( referencePoint1, referencePoint1 + direction ); - wxPoint intersection( segm1.Intersect( segm2, true, true ).get() ); + VECTOR2I intersection( segm1.Intersect( segm2, true, true ).get() ); dimension->SetEnd( intersection ); int height = static_cast( EuclideanNorm( direction ) ); @@ -1172,8 +1172,8 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem) klayer = Eco1_User; } - wxPoint referencePoint0 = aElem.referencePoint.at( 0 ); - wxPoint referencePoint1 = aElem.referencePoint.at( 1 ); + VECTOR2I referencePoint0 = aElem.referencePoint.at( 0 ); + VECTOR2I referencePoint1 = aElem.referencePoint.at( 1 ); PCB_DIM_RADIAL* dimension = new PCB_DIM_RADIAL( m_board ); m_board->Add( dimension, ADD_MODE::APPEND ); @@ -1232,7 +1232,7 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem) dimension->Text().SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); int yAdjust = dimension->Text().GetCenter().y - dimension->Text().GetPosition().y; - dimension->Text().Move( wxPoint( 0, yAdjust + aElem.textgap ) ); + dimension->Text().Move( VECTOR2I( 0, yAdjust + aElem.textgap ) ); dimension->Text().SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); } @@ -1251,10 +1251,10 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) if( !aElem.referencePoint.empty() ) { - wxPoint referencePoint0 = aElem.referencePoint.at( 0 ); + VECTOR2I referencePoint0 = aElem.referencePoint.at( 0 ); // line - wxPoint last = referencePoint0; + VECTOR2I last = referencePoint0; for( size_t i = 1; i < aElem.referencePoint.size(); i++ ) { PCB_SHAPE* shape = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT ); @@ -1269,13 +1269,13 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) // arrow if( aElem.referencePoint.size() >= 2 ) { - wxPoint dirVec = aElem.referencePoint.at( 1 ) - referencePoint0; + VECTOR2I dirVec = aElem.referencePoint.at( 1 ) - referencePoint0; if( dirVec.x != 0 || dirVec.y != 0 ) { - double scaling = EuclideanNorm( dirVec ) / aElem.arrowsize; - wxPoint arrVec = - wxPoint( KiROUND( dirVec.x / scaling ), KiROUND( dirVec.y / scaling ) ); - RotatePoint( &arrVec, 200. ); + double scaling = EuclideanNorm( dirVec ) / aElem.arrowsize; + VECTOR2I arrVec = + VECTOR2I( KiROUND( dirVec.x / scaling ), KiROUND( dirVec.y / scaling ) ); + RotatePoint( arrVec, 200. ); PCB_SHAPE* shape1 = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT ); m_board->Add( shape1, ADD_MODE::APPEND ); @@ -1284,7 +1284,7 @@ void ALTIUM_PCB::HelperParseDimensions6Leader( const ADIMENSION6& aElem ) shape1->SetStart( referencePoint0 ); shape1->SetEnd( referencePoint0 + arrVec ); - RotatePoint( &arrVec, -400. ); + RotatePoint( arrVec, -400. ); PCB_SHAPE* shape2 = new PCB_SHAPE( m_board, SHAPE_T::SEGMENT ); m_board->Add( shape2, ADD_MODE::APPEND ); @@ -1350,8 +1350,8 @@ void ALTIUM_PCB::HelperParseDimensions6Center( const ADIMENSION6& aElem ) klayer = Eco1_User; } - wxPoint vec = wxPoint( 0, aElem.height / 2 ); - RotatePoint( &vec, aElem.angle * 10. ); + VECTOR2I vec = VECTOR2I( 0, aElem.height / 2 ); + RotatePoint( vec, aElem.angle * 10. ); PCB_DIM_CENTER* dimension = new PCB_DIM_CENTER( m_board ); m_board->Add( dimension, ADD_MODE::APPEND ); @@ -1933,7 +1933,7 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, // TODO: other variants to define circle? shape.SetShape( SHAPE_T::CIRCLE ); shape.SetStart( elem.center ); - shape.SetEnd( elem.center - wxPoint( 0, elem.radius ) ); + shape.SetEnd( elem.center - VECTOR2I( 0, elem.radius ) ); return; } @@ -1942,8 +1942,8 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, double includedAngle = elem.endangle - elem.startangle; double startAngle = DEG2RAD( elem.endangle ); - wxPoint startOffset = wxPoint( KiROUND( std::cos( startAngle ) * elem.radius ), - -KiROUND( std::sin( startAngle ) * elem.radius ) ); + VECTOR2I startOffset = VECTOR2I( KiROUND( std::cos( startAngle ) * elem.radius ), + -KiROUND( std::sin( startAngle ) * elem.radius ) ); shape.SetCenter( elem.center ); shape.SetStart( elem.center + startOffset ); @@ -2019,9 +2019,10 @@ void ALTIUM_PCB::ParseArcs6Data( const CFB::CompoundFileReader& aReader, if( klayer >= F_Cu && klayer <= B_Cu ) { double angle = -NormalizeAngleDegreesPos( elem.endangle - elem.startangle ); - double startradiant = DEG2RAD( elem.startangle ); - wxPoint arcStartOffset = wxPoint( KiROUND( std::cos( startradiant ) * elem.radius ), - -KiROUND( std::sin( startradiant ) * elem.radius ) ); + double startradiant = DEG2RAD( elem.startangle ); + VECTOR2I arcStartOffset = + VECTOR2I( KiROUND( std::cos( startradiant ) * elem.radius ), + -KiROUND( std::sin( startradiant ) * elem.radius ) ); arcStartOffset += elem.center; @@ -2650,7 +2651,7 @@ void ALTIUM_PCB::ParseWideStrings6Data( const CFB::CompoundFileReader& aReader, m_progressReporter->Report( _( "Loading unicode strings..." ) ); ALTIUM_PARSER reader( aReader, aEntry ); - + m_unicodeStrings = reader.ReadWideStringTable(); if( reader.GetRemainingBytes() != 0 ) diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index f138aa057d..6e617ece03 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -819,7 +819,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers( const SYMDEF_PCB& aComponen // but not the other way round PADCODE anchorpadcode = getPadCode( anchorPad.PadCodeID ); int anchorSize = getKiCadLength( anchorpadcode.Shape.Size ); - wxPoint anchorPos = getKiCadPoint( anchorPad.Position ); + VECTOR2I anchorPos = getKiCadPoint( anchorPad.Position ); pad->SetShape( PAD_SHAPE::CUSTOM ); pad->SetAnchorPadShape( PAD_SHAPE::CIRCLE ); @@ -1401,8 +1401,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() getKiCadLength( csDim.ExtensionLineParams.Overshoot ) ); // Calculate height: - wxPoint crossbarStart = getKiCadPoint( csDim.Line.Start ); - wxPoint crossbarEnd = getKiCadPoint( csDim.Line.End ); + VECTOR2I crossbarStart = getKiCadPoint( csDim.Line.Start ); + VECTOR2I crossbarEnd = getKiCadPoint( csDim.Line.End ); VECTOR2I crossbarVector = crossbarEnd - crossbarStart; VECTOR2I heightVector = crossbarStart - dimension->GetStart(); double height = 0.0; @@ -1762,12 +1762,12 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDocumentationSymbols() } SYMDEF_PCB& docSymDefinition = ( *docSymIter ).second; - wxPoint moveVector = + VECTOR2I moveVector = getKiCadPoint( docSymInstance.Origin ) - getKiCadPoint( docSymDefinition.Origin ); double rotationAngle = getAngleTenthDegree( docSymInstance.OrientAngle ); double scalingFactor = (double) docSymInstance.ScaleRatioNumerator / (double) docSymInstance.ScaleRatioDenominator; - wxPoint centreOfTransform = getKiCadPoint( docSymDefinition.Origin ); + VECTOR2I centreOfTransform = getKiCadPoint( docSymDefinition.Origin ); bool mirrorInvert = docSymInstance.Mirror; //create a group to store the items in @@ -2504,18 +2504,18 @@ int CADSTAR_PCB_ARCHIVE_LOADER::loadNetVia( } -void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText( const TEXT& aCadstarText, - BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, - const LAYER_ID& aCadstarLayerOverride, const wxPoint& aMoveVector, - const double& aRotationAngle, const double& aScalingFactor, const wxPoint& aTransformCentre, - const bool& aMirrorInvert ) +void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText( + const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, + const LAYER_ID& aCadstarLayerOverride, const VECTOR2I& aMoveVector, + const double& aRotationAngle, const double& aScalingFactor, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { PCB_TEXT* txt = new PCB_TEXT( aContainer ); aContainer->Add( txt ); txt->SetText( aCadstarText.Text ); - wxPoint rotatedTextPos = getKiCadPoint( aCadstarText.Position ); - RotatePoint( &rotatedTextPos, aTransformCentre, aRotationAngle ); + VECTOR2I rotatedTextPos = getKiCadPoint( aCadstarText.Position ); + RotatePoint( rotatedTextPos, aTransformCentre, aRotationAngle ); rotatedTextPos.x = KiROUND( (double) ( rotatedTextPos.x - aTransformCentre.x ) * aScalingFactor ); rotatedTextPos.y = @@ -2658,10 +2658,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape, const wxString& aShapeName, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, - const wxPoint& aMoveVector, + const VECTOR2I& aMoveVector, const double& aRotationAngle, const double& aScalingFactor, - const wxPoint& aTransformCentre, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { switch( aCadstarShape.Type ) @@ -2720,10 +2720,10 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarCutoutsAsShapes( const std::vector shapes = getShapesFromVertices( aCadstarVertices, aContainer, @@ -2765,10 +2765,10 @@ std::vector CADSTAR_PCB_ARCHIVE_LOADER::getShapesFromVertices( const std::vector& aCadstarVertices, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, - const wxPoint& aMoveVector, + const VECTOR2I& aMoveVector, const double& aRotationAngle, const double& aScalingFactor, - const wxPoint& aTransformCentre, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { std::vector drawSegments; @@ -2797,19 +2797,19 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar const VERTEX& aCadstarVertex, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID, - const wxPoint& aMoveVector, + const VECTOR2I& aMoveVector, const double& aRotationAngle, const double& aScalingFactor, - const wxPoint& aTransformCentre, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { PCB_SHAPE* shape = nullptr; bool cw = false; double arcStartAngle, arcEndAngle, arcAngle; - wxPoint startPoint = getKiCadPoint( aCadstarStartPoint ); - wxPoint endPoint = getKiCadPoint( aCadstarVertex.End ); - wxPoint centerPoint; + VECTOR2I startPoint = getKiCadPoint( aCadstarStartPoint ); + VECTOR2I endPoint = getKiCadPoint( aCadstarVertex.End ); + VECTOR2I centerPoint; if( aCadstarVertex.Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE || aCadstarVertex.Type == VERTEX_TYPE::CLOCKWISE_SEMICIRCLE ) @@ -2871,7 +2871,7 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar if( aScalingFactor != 1.0 ) { - shape->Move( -aTransformCentre ); + shape->Move( -1*aTransformCentre ); shape->Scale( aScalingFactor ); shape->Move( aTransformCentre ); } @@ -2922,10 +2922,10 @@ ZONE* CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape( const SHAPE& aCadstar SHAPE_POLY_SET CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness, BOARD_ITEM_CONTAINER* aContainer, - const wxPoint& aMoveVector, + const VECTOR2I& aMoveVector, const double& aRotationAngle, const double& aScalingFactor, - const wxPoint& aTransformCentre, + const VECTOR2I& aTransformCentre, const bool& aMirrorInvert ) { GROUP_ID noGroup = wxEmptyString; @@ -3144,14 +3144,14 @@ std::vector CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes( if( offsetAmount > 0 ) { // modify the start of the current track - wxPoint newStart = track->GetStart(); + VECTOR2I newStart = track->GetStart(); applyRouteOffset( &newStart, track->GetEnd(), offsetAmount ); track->SetStart( newStart ); } else if( offsetAmount < 0 ) { // amend the end of the previous track - wxPoint newEnd = prevTrack->GetEnd(); + VECTOR2I newEnd = prevTrack->GetEnd(); applyRouteOffset( &newEnd, prevTrack->GetStart(), -offsetAmount ); prevTrack->SetEnd( newEnd ); } // don't do anything if offsetAmount == 0 @@ -3235,8 +3235,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta //TODO: Future improvement - allow user to decide what to do with attributes } - wxPoint rotatedTextPos = getKiCadPoint( aCadstarAttrLoc.Position ) - aFootprint->GetPosition(); - RotatePoint( &rotatedTextPos, -aFootprint->GetOrientation() ); + VECTOR2I rotatedTextPos = getKiCadPoint( aCadstarAttrLoc.Position ) - aFootprint->GetPosition(); + RotatePoint( rotatedTextPos, -aFootprint->GetOrientation() ); txt->SetTextPos( getKiCadPoint( aCadstarAttrLoc.Position ) ); txt->SetPos0( rotatedTextPos ); @@ -3322,8 +3322,8 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta } -void CADSTAR_PCB_ARCHIVE_LOADER::applyRouteOffset( wxPoint* aPointToOffset, - const wxPoint& aRefPoint, +void CADSTAR_PCB_ARCHIVE_LOADER::applyRouteOffset( VECTOR2I* aPointToOffset, + const VECTOR2I& aRefPoint, const long& aOffsetAmount ) { VECTOR2I v( *aPointToOffset - aRefPoint ); @@ -3870,9 +3870,9 @@ FOOTPRINT* CADSTAR_PCB_ARCHIVE_LOADER::getFootprintFromCadstarID( } -wxPoint CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint ) +VECTOR2I CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPoint( const VECTOR2I& aCadstarPoint ) { - wxPoint retval; + VECTOR2I retval; retval.x = ( aCadstarPoint.x - m_designCenter.x ) * KiCadUnitMultiplier; retval.y = -( aCadstarPoint.y - m_designCenter.y ) * KiCadUnitMultiplier; @@ -3881,7 +3881,7 @@ wxPoint CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint } -double CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle( const wxPoint& aPoint ) +double CADSTAR_PCB_ARCHIVE_LOADER::getPolarAngle( const VECTOR2I& aPoint ) { return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) ); } diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h index 7f7669fc70..78256dc7e9 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h @@ -200,10 +200,10 @@ private: void drawCadstarText( const TEXT& aCadstarText, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID = wxEmptyString, const LAYER_ID& aCadstarLayerOverride = wxEmptyString, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -224,9 +224,9 @@ private: const int& aLineThickness, const wxString& aShapeName, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID = wxEmptyString, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -246,10 +246,10 @@ private: const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID = wxEmptyString, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -270,10 +270,10 @@ private: const PCB_LAYER_ID& aKiCadLayer, const int& aLineThickness, BOARD_ITEM_CONTAINER* aContainer, const GROUP_ID& aCadstarGroupID = wxEmptyString, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -291,10 +291,10 @@ private: std::vector getShapesFromVertices( const std::vector& aCadstarVertices, BOARD_ITEM_CONTAINER* aContainer = nullptr, const GROUP_ID& aCadstarGroupID = wxEmptyString, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -314,10 +314,10 @@ private: const VERTEX& aCadstarVertex, BOARD_ITEM_CONTAINER* aContainer = nullptr, const GROUP_ID& aCadstarGroupID = wxEmptyString, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -345,10 +345,10 @@ private: SHAPE_POLY_SET getPolySetFromCadstarShape( const SHAPE& aCadstarShape, const int& aLineThickness = -1, BOARD_ITEM_CONTAINER* aContainer = nullptr, - const wxPoint& aMoveVector = { 0, 0 }, + const VECTOR2I& aMoveVector = { 0, 0 }, const double& aRotationAngle = 0.0, const double& aScalingFactor = 1.0, - const wxPoint& aTransformCentre = { 0, 0 }, + const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); /** @@ -395,7 +395,7 @@ private: * @param aRefPoint Reference point to use for determine the angle of the offset * @param aOffsetAmount */ - void applyRouteOffset( wxPoint* aPointToOffset, const wxPoint& aRefPoint, + void applyRouteOffset( VECTOR2I* aPointToOffset, const VECTOR2I& aRefPoint, const long& aOffsetAmount ); //Helper Functions for obtaining CADSTAR elements in the parsed structures @@ -427,7 +427,7 @@ private: * @param aCadstarPoint * @return */ - wxPoint getKiCadPoint( const wxPoint& aCadstarPoint ); + VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint ); /** * @brief @@ -474,7 +474,7 @@ private: * @param aPoint * @return Angle in decidegrees of the polar representation of the point, scaled 0..360 */ - double getPolarAngle( const wxPoint& aPoint ); + double getPolarAngle( const VECTOR2I& aPoint ); /** * @brief Searches m_netMap and returns the NETINFO_ITEM pointer if exists. Otherwise diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index aeefc9c623..3b49a9f86b 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -721,7 +721,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) } else { - wxPoint center = ConvertArcCenter( start, end, *w.curve ); + VECTOR2I center = ConvertArcCenter( start, end, *w.curve ); shape->SetShape( SHAPE_T::ARC ); shape->SetCenter( center ); @@ -1440,10 +1440,10 @@ ZONE* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) if( v1.curve ) { - EVERTEX v2 = vertices[i + 1]; - wxPoint center = ConvertArcCenter( wxPoint( kicad_x( v1.x ), kicad_y( v1.y ) ), - wxPoint( kicad_x( v2.x ), kicad_y( v2.y ) ), - *v1.curve ); + EVERTEX v2 = vertices[i + 1]; + VECTOR2I center = + ConvertArcCenter( VECTOR2I( kicad_x( v1.x ), kicad_y( v1.y ) ), + VECTOR2I( kicad_x( v2.x ), kicad_y( v2.y ) ), *v1.curve ); double angle = DEG2RAD( *v1.curve ); double end_angle = atan2( kicad_y( v2.y ) - center.y, kicad_x( v2.x ) - center.x ); double radius = sqrt( pow( center.x - kicad_x( v1.x ), 2 ) @@ -1796,7 +1796,7 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const else { dwg = new FP_SHAPE( aFootprint, SHAPE_T::ARC ); - wxPoint center = ConvertArcCenter( start, end, *w.curve ); + VECTOR2I center = ConvertArcCenter( start, end, *w.curve ); dwg->SetCenter0( center ); dwg->SetStart0( start ); @@ -1941,7 +1941,7 @@ void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const txt->SetText( FROM_UTF8( t.text.c_str() ) ); - wxPoint pos( kicad_x( t.x ), kicad_y( t.y ) ); + VECTOR2I pos( kicad_x( t.x ), kicad_y( t.y ) ); txt->SetTextPos( pos ); txt->SetPos0( pos - aFootprint->GetPosition() ); @@ -2051,8 +2051,8 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c if( r.rot ) { - wxPoint center( ( kicad_x( r.x1 ) + kicad_x( r.x2 ) ) / 2, - ( kicad_y( r.y1 ) + kicad_y( r.y2 ) ) / 2 ); + VECTOR2I center( ( kicad_x( r.x1 ) + kicad_x( r.x2 ) ) / 2, + ( kicad_y( r.y1 ) + kicad_y( r.y2 ) ) / 2 ); zone->Rotate( center, r.rot->degrees * 10 ); } @@ -2079,10 +2079,10 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c dwg->SetStroke( STROKE_PARAMS( 0 ) ); dwg->SetFilled( true ); - std::vector pts; + std::vector pts; - wxPoint start( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ) ); - wxPoint end( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) ); + VECTOR2I start( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ) ); + VECTOR2I end( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ) ); pts.push_back( start ); pts.emplace_back( kicad_x( r.x2 ), kicad_y( r.y1 ) ); @@ -2104,7 +2104,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con { EPOLYGON p( aTree ); - std::vector pts; + std::vector pts; // Get the first vertex and iterate wxXmlNode* vertex = aTree->GetChildren(); @@ -2133,10 +2133,10 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con if( v1.curve ) { - EVERTEX v2 = vertices[i + 1]; - wxPoint center = - ConvertArcCenter( wxPoint( kicad_x( v1.x ), kicad_y( v1.y ) ), - wxPoint( kicad_x( v2.x ), kicad_y( v2.y ) ), *v1.curve ); + EVERTEX v2 = vertices[i + 1]; + VECTOR2I center = + ConvertArcCenter( VECTOR2I( kicad_x( v1.x ), kicad_y( v1.y ) ), + VECTOR2I( kicad_x( v2.x ), kicad_y( v2.y ) ), *v1.curve ); double angle = DEG2RAD( *v1.curve ); double end_angle = atan2( kicad_y( v2.y ) - center.y, kicad_x( v2.x ) - center.x ); double radius = sqrt( pow( center.x - kicad_x( v1.x ), 2 ) @@ -2151,8 +2151,9 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con for( double a = end_angle + angle; fabs( a - end_angle ) > fabs( delta ); a -= delta ) { - pts.push_back( wxPoint( KiROUND( radius * cos( a ) ), - KiROUND( radius * sin( a ) ) ) + center ); + pts.push_back( + VECTOR2I( KiROUND( radius * cos( a ) ), KiROUND( radius * sin( a ) ) ) + + center ); } } } @@ -2307,7 +2308,7 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC // pad->SetOffset( wxPoint( 0, 0 ) ); // pad->SetNumber( wxEmptyString ); - wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); + VECTOR2I padpos( kicad_x( e.x ), kicad_y( e.y ) ); if( aCenter ) { @@ -2409,7 +2410,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const // pad's "Position" is not relative to the footprint's, // whereas Pos0 is relative to the footprint's but is the unrotated coordinate. - wxPoint padPos( kicad_x( aEaglePad.x ), kicad_y( aEaglePad.y ) ); + VECTOR2I padPos( kicad_x( aEaglePad.x ), kicad_y( aEaglePad.y ) ); aPad->SetPos0( padPos ); // Solder mask @@ -2426,7 +2427,7 @@ void EAGLE_PLUGIN::transferPad( const EPAD_COMMON& aEaglePad, PAD* aPad ) const FOOTPRINT* footprint = aPad->GetParent(); wxCHECK( footprint, /* void */ ); - RotatePoint( &padPos, footprint->GetOrientation() ); + RotatePoint( padPos, footprint->GetOrientation() ); aPad->SetPosition( padPos + footprint->GetPosition() ); } @@ -2552,12 +2553,12 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals ) if( IsCopperLayer( layer ) ) { - wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) ); + VECTOR2I start( kicad_x( w.x1 ), kicad_y( w.y1 ) ); double angle = 0.0; double end_angle = 0.0; double radius = 0.0; double delta_angle = 0.0; - wxPoint center; + VECTOR2I center; int width = w.width.ToPcbUnits(); diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index 6e9ab161e0..dfe3b29372 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -589,7 +589,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) angle = - RAD2DECIDEG( angle ); pad->SetOrientation( KiROUND( angle ) ); - wxPoint padPos( (x1 + x2) / 2, (y1 + y2) / 2 ); + VECTOR2I padPos( ( x1 + x2 ) / 2, ( y1 + y2 ) / 2 ); pad->SetSize( wxSize( KiROUND( EuclideanNorm( delta ) ) + width, width ) ); @@ -642,8 +642,8 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader ) // which is used for the same purpose. pad->SetNumber( parameters[paramCnt-3] ); - wxPoint padPos( parseInt( parameters[2], conv_unit ), - parseInt( parameters[3], conv_unit ) ); + VECTOR2I padPos( parseInt( parameters[2], conv_unit ), + parseInt( parameters[3], conv_unit ) ); int padSize = parseInt( parameters[4], conv_unit ); diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 20bab72d8a..61e2964077 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -3262,7 +3262,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FOOTPRINT." ) ); wxString name; - wxPoint pt; + VECTOR2I pt; T token; LIB_ID fpid; int attributes = 0; @@ -3544,7 +3544,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments PAD* pad = parsePAD( footprint.get() ); pt = pad->GetPos0(); - RotatePoint( &pt, footprint->GetOrientation() ); + RotatePoint( pt, footprint->GetOrientation() ); pad->SetPosition( pt + footprint->GetPosition() ); footprint->Add( pad, ADD_MODE::APPEND ); break; diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index 111fc733e7..5d2db33c89 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -1458,7 +1458,7 @@ void PCB_PLUGIN::format( const PAD* aPad, int aNestLevel ) const m_out->Print( 0, " (rect_delta %s)", FormatInternalUnits( aPad->GetDelta() ).c_str() ); wxSize sz = aPad->GetDrillSize(); - wxPoint shapeoffset = aPad->GetOffset(); + VECTOR2I shapeoffset = aPad->GetOffset(); if( (sz.GetWidth() > 0) || (sz.GetHeight() > 0) || (shapeoffset.x != 0) || (shapeoffset.y != 0) ) diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index d188fece54..acc8b960a9 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -1509,9 +1509,9 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) // pad's "Position" is not relative to the footprint's, whereas Pos0 is relative // to the footprint's but is the unrotated coordinate. - wxPoint padpos = pad->GetPos0(); + VECTOR2I padpos = pad->GetPos0(); - RotatePoint( &padpos, aFootprint->GetOrientation() ); + RotatePoint( padpos, aFootprint->GetOrientation() ); pad->SetPosition( padpos + aFootprint->GetPosition() ); @@ -1601,7 +1601,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint ) dwg->SetStart0( wxPoint( start0_x, start0_y ) ); dwg->SetEnd0( wxPoint( end0_x, end0_y ) ); - std::vector pts; + std::vector pts; pts.reserve( ptCount ); for( int ii = 0; ii < ptCount; ++ii ) diff --git a/pcbnew/plugins/pcad/pcb_pad.cpp b/pcbnew/plugins/pcad/pcb_pad.cpp index 485a59e928..5ae9ab3915 100644 --- a/pcbnew/plugins/pcad/pcb_pad.cpp +++ b/pcbnew/plugins/pcad/pcb_pad.cpp @@ -314,9 +314,9 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps { // pad's "Position" is not relative to the footprint's, whereas Pos0 is relative to // the footprint's but is the unrotated coordinate. - wxPoint padpos( m_positionX, m_positionY ); + VECTOR2I padpos( m_positionX, m_positionY ); pad->SetPos0( padpos ); - RotatePoint( &padpos, aFootprint->GetOrientation() ); + RotatePoint( padpos, aFootprint->GetOrientation() ); pad->SetPosition( padpos + aFootprint->GetPosition() ); } diff --git a/pcbnew/plugins/pcad/pcb_polygon.cpp b/pcbnew/plugins/pcad/pcb_polygon.cpp index f1e34eec88..a0bae95b07 100644 --- a/pcbnew/plugins/pcad/pcb_polygon.cpp +++ b/pcbnew/plugins/pcad/pcb_polygon.cpp @@ -169,9 +169,9 @@ void PCB_POLYGON::AddToFootprint( FOOTPRINT* aFootprint ) dwg->SetStroke( STROKE_PARAMS( 0 ) ); dwg->SetLayer( m_KiCadLayer ); - auto outline = new std::vector; + auto outline = new std::vector; for( auto point : m_outline ) - outline->push_back( wxPoint( point->x, point->y ) ); + outline->push_back( VECTOR2I( point->x, point->y ) ); dwg->SetPolyPoints( *outline ); dwg->SetStart0( *outline->begin() ); diff --git a/pcbnew/plugins/pcad/pcb_text.cpp b/pcbnew/plugins/pcad/pcb_text.cpp index 6b736c64ec..f195a60e6b 100644 --- a/pcbnew/plugins/pcad/pcb_text.cpp +++ b/pcbnew/plugins/pcad/pcb_text.cpp @@ -117,7 +117,7 @@ void PCB_TEXT::AddToBoard() pcbtxt->SetTextThickness( m_name.textstrokeWidth ); SetTextJustify( pcbtxt, m_name.justify ); - pcbtxt->SetTextPos( wxPoint( m_name.textPositionX, m_name.textPositionY ) ); + pcbtxt->SetTextPos( VECTOR2I( m_name.textPositionX, m_name.textPositionY ) ); pcbtxt->SetMirrored( m_name.mirror ); diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index d2eb6c080c..fce580c95e 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -475,7 +475,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits, engine->SetProgressReporter( nullptr ); engine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2D aPos, PCB_LAYER_ID aLayer ) { if( aItem->GetErrorCode() == DRCE_MISSING_FOOTPRINT || aItem->GetErrorCode() == DRCE_DUPLICATE_FOOTPRINT diff --git a/pcbnew/ratsnest/ratsnest_view_item.h b/pcbnew/ratsnest/ratsnest_view_item.h index a483f1f651..5f8dd4397a 100644 --- a/pcbnew/ratsnest/ratsnest_view_item.h +++ b/pcbnew/ratsnest/ratsnest_view_item.h @@ -53,7 +53,7 @@ public: /// @copydoc VIEW_ITEM::ViewGetLayers() void ViewGetLayers( int aLayers[], int& aCount ) const override; - bool HitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override + bool HitTest( const VECTOR2I& aPoint, int aAccuracy = 0 ) const override { return false; // Not selectable } diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 2d68d9c034..2fefffd37c 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -933,12 +933,12 @@ std::unique_ptr PNS_KICAD_IFACE_BASE::syncPad( PAD* aPad ) solid->SetPadToDie( aPad->GetPadToDieLength() ); solid->SetOrientation( aPad->GetOrientation() ); - wxPoint wx_c = aPad->ShapePos(); - wxPoint offset = aPad->GetOffset(); + VECTOR2I wx_c = aPad->ShapePos(); + VECTOR2I offset = aPad->GetOffset(); VECTOR2I c( wx_c.x, wx_c.y ); - RotatePoint( &offset, aPad->GetOrientation() ); + RotatePoint( offset, aPad->GetOrientation() ); solid->SetPos( VECTOR2I( c.x - offset.x, c.y - offset.y ) ); solid->SetOffset( VECTOR2I( offset.x, offset.y ) ); @@ -1110,7 +1110,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB return false; int textWidth = aText->GetEffectiveTextPenWidth(); - std::vector textShape = aText->TransformToSegmentList(); + std::vector textShape = aText->TransformToSegmentList(); if( textShape.size() < 2 ) return false; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index ce070570dd..5fd038a65a 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -1595,7 +1595,7 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT int refNet = reference->GetNetCode(); - wxPoint refPoint( aPt.x, aPt.y ); + VECTOR2I refPoint( aPt.x, aPt.y ); EDA_ITEM_FLAGS flags = reference->IsPointOnEnds( refPoint, -1 ); if( flags & STARTPOINT ) diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 9bc58cd721..d235f3bad5 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -200,7 +200,7 @@ static inline double mapY( int y ) * Kicad's #BOARD coordinates are in nanometers (called Internal Units or IU) and we are * exporting in units of mils, so we have to scale them. */ -static POINT mapPt( const wxPoint& pt ) +static POINT mapPt( const VECTOR2I& pt ) { POINT ret; @@ -749,7 +749,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) path->SetLayerId( "signal" ); double radius = graphic->GetRadius(); - wxPoint circle_centre = graphic->GetStart0(); + VECTOR2I circle_centre = graphic->GetStart0(); SHAPE_LINE_CHAIN polyline; ConvertArcToPolyline( polyline, VECTOR2I( circle_centre ), radius, 0.0, 360.0, @@ -757,7 +757,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) for( int ii = 0; ii < polyline.PointCount(); ++ii ) { - wxPoint corner( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y ); + VECTOR2I corner( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y ); path->AppendPoint( mapPt( corner ) ); } @@ -774,7 +774,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) outline->SetShape( path ); path->SetAperture( scale( graphic->GetWidth() ) ); path->SetLayerId( "signal" ); - wxPoint corner = graphic->GetStart0(); + VECTOR2I corner = graphic->GetStart0(); path->AppendPoint( mapPt( corner ) ); corner.x = graphic->GetEnd0().x; @@ -802,7 +802,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) path->SetAperture( 0 );//scale( graphic->GetWidth() ) ); path->SetLayerId( "signal" ); - wxPoint arc_centre = graphic->GetCenter0(); + VECTOR2I arc_centre = graphic->GetCenter0(); double radius = graphic->GetRadius() + graphic->GetWidth()/2; double arcAngleDeg = graphic->GetArcAngle() / 10.0; @@ -845,7 +845,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) // ensure the polygon is closed polyBuffer.Append( polyBuffer.Outline( 0 ).CPoint( 0 ) ); - wxPoint move = graphic->GetCenter() - arc_centre; + VECTOR2I move = graphic->GetCenter() - arc_centre; TransformCircleToPolygon( polyBuffer, graphic->GetStart() - move, graphic->GetWidth() / 2, ARC_HIGH_DEF, ERROR_INSIDE ); @@ -858,7 +858,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) for( int ii = 0; ii < poly.PointCount(); ++ii ) { - wxPoint corner( poly.CPoint( ii ).x, poly.CPoint( ii ).y ); + VECTOR2I corner( poly.CPoint( ii ).x, poly.CPoint( ii ).y ); path->AppendPoint( mapPt( corner ) ); } @@ -920,11 +920,11 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) // Handle the main outlines SHAPE_POLY_SET::ITERATOR iterator; bool is_first_point = true; - wxPoint startpoint; + VECTOR2I startpoint; for( iterator = untransformedZone.IterateWithHoles(); iterator; iterator++ ) { - wxPoint point( iterator->x, iterator->y ); + VECTOR2I point( iterator->x, iterator->y ); point -= aFootprint->GetPosition(); @@ -969,7 +969,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) wxASSERT( window ); wxASSERT( cutout ); - wxPoint point( iterator->x, iterator->y ); + VECTOR2I point( iterator->x, iterator->y ); point -= aFootprint->GetPosition(); diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index 1581160123..28c3c499be 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -695,10 +695,10 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT ); graphic->SetLayer( targetLayer ); - graphic->SetStart( wxPoint( seg.A ) ); - graphic->SetStart0( wxPoint( seg.A ) ); - graphic->SetEnd( wxPoint( seg.B ) ); - graphic->SetEnd0( wxPoint( seg.B ) ); + graphic->SetStart( VECTOR2I( seg.A ) ); + graphic->SetStart0( VECTOR2I( seg.A ) ); + graphic->SetEnd( VECTOR2I( seg.B ) ); + graphic->SetEnd0( VECTOR2I( seg.B ) ); commit.Add( graphic ); } else @@ -706,8 +706,8 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) PCB_SHAPE* graphic = new PCB_SHAPE( nullptr, SHAPE_T::SEGMENT ); graphic->SetLayer( targetLayer ); - graphic->SetStart( wxPoint( seg.A ) ); - graphic->SetEnd( wxPoint( seg.B ) ); + graphic->SetStart( VECTOR2I( seg.A ) ); + graphic->SetEnd( VECTOR2I( seg.B ) ); commit.Add( graphic ); } } @@ -734,10 +734,10 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) { FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT ); graphic->SetLayer( targetLayer ); - graphic->SetStart( wxPoint( seg.A ) ); - graphic->SetStart0( wxPoint( seg.A ) ); - graphic->SetEnd( wxPoint( seg.B ) ); - graphic->SetEnd0( wxPoint( seg.B ) ); + graphic->SetStart( VECTOR2I( seg.A ) ); + graphic->SetStart0( VECTOR2I( seg.A ) ); + graphic->SetEnd( VECTOR2I( seg.B ) ); + graphic->SetEnd0( VECTOR2I( seg.B ) ); commit.Add( graphic ); } } @@ -749,8 +749,8 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent ) PCB_TRACK* track = new PCB_TRACK( parent ); track->SetLayer( targetLayer ); - track->SetStart( wxPoint( seg.A ) ); - track->SetEnd( wxPoint( seg.B ) ); + track->SetStart( VECTOR2I( seg.A ) ); + track->SetEnd( VECTOR2I( seg.B ) ); commit.Add( track ); } } @@ -824,9 +824,9 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent ) arc->SetLayer( layer ); arc->SetStroke( line->GetStroke() ); - arc->SetCenter( wxPoint( center ) ); - arc->SetStart( wxPoint( start ) ); - arc->SetEnd( wxPoint( end ) ); + arc->SetCenter( VECTOR2I( center ) ); + arc->SetStart( VECTOR2I( start ) ); + arc->SetEnd( VECTOR2I( end ) ); commit.Add( arc ); } @@ -838,9 +838,9 @@ int CONVERT_TOOL::SegmentToArc( const TOOL_EVENT& aEvent ) arc->SetLayer( layer ); arc->SetWidth( line->GetWidth() ); - arc->SetStart( wxPoint( start ) ); - arc->SetMid( wxPoint( mid ) ); - arc->SetEnd( wxPoint( end ) ); + arc->SetStart( VECTOR2I( start ) ); + arc->SetMid( VECTOR2I( mid ) ); + arc->SetEnd( VECTOR2I( end ) ); commit.Add( arc ); } diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 40476ed599..4250f6c367 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1042,7 +1042,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) // Calculating the direction of travel perpendicular to the selected axis double angle = aligned->GetAngle() + ( M_PI / 2 ); - wxPoint delta( (wxPoint) cursorPos - dimension->GetEnd() ); + VECTOR2I delta( (VECTOR2I) cursorPos - dimension->GetEnd() ); double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) ); aligned->SetHeight( height ); aligned->Update(); @@ -1368,7 +1368,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent ) commit.Modify( footprint ); // set the new relative internal local coordinates of footprint items - wxPoint moveVector = footprint->GetPosition() - (wxPoint) cursorPos; + VECTOR2I moveVector = footprint->GetPosition() - (wxPoint) cursorPos; footprint->MoveAnchorPosition( moveVector ); commit.Push( _( "Move the footprint reference anchor" ) ); @@ -2368,7 +2368,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) PCB_TRACK* findTrack( PCB_VIA* aVia ) { const LSET lset = aVia->GetLayerSet(); - wxPoint position = aVia->GetPosition(); + VECTOR2I position = aVia->GetPosition(); BOX2I bbox = aVia->GetBoundingBox(); std::vector items; @@ -2448,7 +2448,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) if( aOther->Type() == PCB_VIA_T ) { PCB_VIA* via = static_cast( aOther ); - wxPoint pos = via->GetPosition(); + VECTOR2I pos = via->GetPosition(); holeShape.reset( new SHAPE_SEGMENT( pos, pos, via->GetDrill() ) ); } @@ -2517,7 +2517,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) PAD* findPad( PCB_VIA* aVia ) { - const wxPoint position = aVia->GetPosition(); + const VECTOR2I position = aVia->GetPosition(); const LSET lset = aVia->GetLayerSet(); for( FOOTPRINT* fp : m_board->Footprints() ) @@ -2535,7 +2535,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) int findStitchedZoneNet( PCB_VIA* aVia ) { - const wxPoint position = aVia->GetPosition(); + const VECTOR2I position = aVia->GetPosition(); const LSET lset = aVia->GetLayerSet(); std::vector foundZones; @@ -2582,7 +2582,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) m_gridHelper.SetSnap( !( m_modifiers & MD_SHIFT ) ); PCB_VIA* via = static_cast( aItem ); - wxPoint position = via->GetPosition(); + VECTOR2I position = via->GetPosition(); PCB_TRACK* track = findTrack( via ); PAD* pad = findPad( via ); @@ -2605,7 +2605,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) { WX_INFOBAR* infobar = m_frame->GetInfoBar(); PCB_VIA* via = static_cast( aItem ); - wxPoint viaPos = via->GetPosition(); + VECTOR2I viaPos = via->GetPosition(); PCB_TRACK* track = findTrack( via ); PAD* pad = findPad( via ); diff --git a/pcbnew/tools/drc_tool.cpp b/pcbnew/tools/drc_tool.cpp index da695f3275..e35bb6a59f 100644 --- a/pcbnew/tools/drc_tool.cpp +++ b/pcbnew/tools/drc_tool.cpp @@ -172,7 +172,7 @@ void DRC_TOOL::RunTests( PROGRESS_REPORTER* aProgressReporter, bool aRefillZones m_drcEngine->SetProgressReporter( aProgressReporter ); m_drcEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { PCB_MARKER* marker = new PCB_MARKER( aItem, aPos ); marker->SetLayer( aLayer ); diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index b215affd0f..249522426a 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -632,8 +632,8 @@ int EDIT_TOOL::DragArcTrack( const TOOL_EVENT& aEvent ) }; // Amend the end points of the arc if we delete the joining tracks - wxPoint newStart = trackOnStart->GetStart(); - wxPoint newEnd = trackOnEnd->GetStart(); + VECTOR2I newStart = trackOnStart->GetStart(); + VECTOR2I newEnd = trackOnEnd->GetStart(); if( isStartTrackOnStartPt ) newStart = trackOnStart->GetEnd(); @@ -1215,7 +1215,7 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent ) auto processFilletOp = [&]( bool aStartPoint ) { - wxPoint anchor = ( aStartPoint ) ? track->GetStart() : track->GetEnd(); + VECTOR2I anchor = ( aStartPoint ) ? track->GetStart() : track->GetEnd(); auto connectivity = board()->GetConnectivity(); auto itemsOnAnchor = connectivity->GetConnectedItemsAtAnchor( track, anchor, track_types ); @@ -1508,9 +1508,9 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) /** * Mirror a point about the vertical axis passing through another point. */ -static wxPoint mirrorPointX( const wxPoint& aPoint, const wxPoint& aMirrorPoint ) +static VECTOR2I mirrorPointX( const VECTOR2I& aPoint, const VECTOR2I& aMirrorPoint ) { - wxPoint mirrored = aPoint; + VECTOR2I mirrored = aPoint; mirrored.x -= aMirrorPoint.x; mirrored.x = -mirrored.x; @@ -1523,12 +1523,12 @@ static wxPoint mirrorPointX( const wxPoint& aPoint, const wxPoint& aMirrorPoint /** * Mirror a pad in the vertical axis passing through a point (mirror left to right). */ -static void mirrorPadX( PAD& aPad, const wxPoint& aMirrorPoint ) +static void mirrorPadX( PAD& aPad, const VECTOR2I& aMirrorPoint ) { if( aPad.GetShape() == PAD_SHAPE::CUSTOM ) aPad.FlipPrimitives( true ); // mirror primitives left to right - wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint ); + VECTOR2I tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint ); aPad.SetPosition( tmpPt ); aPad.SetX0( aPad.GetPosition().x ); diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 4aa4028a1c..e01860c0d0 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -579,10 +579,10 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos { SHAPE_LINE_CHAIN lc; lc.SetClosed( true ); - std::vector poly; + std::vector poly; shape->DupPolyPointsList( poly ); - for( const wxPoint& p : poly ) + for( const VECTOR2I& p : poly ) { addAnchor( p, CORNER | SNAPPABLE, shape ); lc.Append( p ); diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 1776691568..0bf89e62fe 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -252,8 +252,8 @@ std::shared_ptr PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem ) case PCB_PAD_T: { const PAD* pad = static_cast( aItem ); - wxPoint shapePos = pad->ShapePos(); - wxPoint halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 ); + VECTOR2I shapePos = pad->ShapePos(); + VECTOR2I halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 ); if( !m_isFootprintEditor || pad->IsLocked() ) break; @@ -1123,7 +1123,7 @@ void PCB_POINT_EDITOR::updateItem() const if( isModified( m_editPoints->Point( ARC_CENTER ) ) ) { - wxPoint moveVector = wxPoint( center.x, center.y ) - shape->GetCenter(); + VECTOR2I moveVector = VECTOR2I( center.x, center.y ) - shape->GetCenter(); shape->Move( moveVector ); } else if( isModified( m_editPoints->Point( ARC_MID ) ) ) @@ -1155,12 +1155,12 @@ void PCB_POINT_EDITOR::updateItem() const if( isModified( m_editPoints->Point( CIRC_CENTER ) ) ) { - wxPoint moveVector = wxPoint( center.x, center.y ) - shape->GetCenter(); + VECTOR2I moveVector = VECTOR2I( center.x, center.y ) - shape->GetCenter(); shape->Move( moveVector ); } else { - shape->SetEnd( wxPoint( end.x, end.y ) ); + shape->SetEnd( VECTOR2I( end.x, end.y ) ); } } break; @@ -1218,7 +1218,7 @@ void PCB_POINT_EDITOR::updateItem() const { case PAD_SHAPE::CIRCLE: { - wxPoint end = (wxPoint) m_editPoints->Point( 0 ).GetPosition(); + VECTOR2I end = (wxPoint) m_editPoints->Point( 0 ).GetPosition(); int diameter = (int) EuclideanNorm( end - pad->GetPosition() ) * 2; pad->SetSize( wxSize( diameter, diameter ) ); @@ -1246,8 +1246,8 @@ void PCB_POINT_EDITOR::updateItem() const { // Keep hole pinned at the current location; adjust the pad around the hole - wxPoint center = pad->GetPosition(); - int dist[4]; + VECTOR2I center = pad->GetPosition(); + int dist[4]; if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) ) @@ -1497,7 +1497,7 @@ void PCB_POINT_EDITOR::updateItem() const if( isModified( m_editPoints->Point( DIM_START ) ) ) { - dimension->SetStart( (wxPoint) m_editedPoint->GetPosition() ); + dimension->SetStart( (VECTOR2I) m_editedPoint->GetPosition() ); dimension->Update(); m_editPoints->Point( DIM_KNEE ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_START ), @@ -1505,12 +1505,12 @@ void PCB_POINT_EDITOR::updateItem() const } else if( isModified( m_editPoints->Point( DIM_END ) ) ) { - wxPoint oldKnee = dimension->GetKnee(); + VECTOR2I oldKnee = dimension->GetKnee(); - dimension->SetEnd( (wxPoint) m_editedPoint->GetPosition() ); + dimension->SetEnd( (VECTOR2I) m_editedPoint->GetPosition() ); dimension->Update(); - wxPoint kneeDelta = dimension->GetKnee() - oldKnee; + VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee; dimension->Text().SetPosition( dimension->Text().GetPosition() + kneeDelta ); dimension->Update(); @@ -1519,14 +1519,14 @@ void PCB_POINT_EDITOR::updateItem() const } else if( isModified( m_editPoints->Point( DIM_KNEE ) ) ) { - wxPoint oldKnee = dimension->GetKnee(); + VECTOR2I oldKnee = dimension->GetKnee(); VECTOR2I arrowVec = m_editPoints->Point( DIM_KNEE ).GetPosition() - m_editPoints->Point( DIM_END ).GetPosition(); dimension->SetLeaderLength( arrowVec.EuclideanNorm() ); dimension->Update(); - wxPoint kneeDelta = dimension->GetKnee() - oldKnee; + VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee; dimension->Text().SetPosition( dimension->Text().GetPosition() + kneeDelta ); dimension->Update(); } @@ -1546,19 +1546,19 @@ void PCB_POINT_EDITOR::updateItem() const if( isModified( m_editPoints->Point( DIM_START ) ) ) { - dimension->SetStart( (wxPoint) m_editedPoint->GetPosition() ); + dimension->SetStart( (VECTOR2I) m_editedPoint->GetPosition() ); } else if( isModified( m_editPoints->Point( DIM_END ) ) ) { - wxPoint newPoint( m_editedPoint->GetPosition() ); - wxPoint delta = newPoint - dimension->GetEnd(); + VECTOR2I newPoint( m_editedPoint->GetPosition() ); + VECTOR2I delta = newPoint - dimension->GetEnd(); dimension->SetEnd( newPoint ); dimension->Text().SetPosition( dimension->Text().GetPosition() + delta ); } else if( isModified( m_editPoints->Point( DIM_TEXT ) ) ) { - dimension->Text().SetPosition( (wxPoint) m_editedPoint->GetPosition() ); + dimension->Text().SetPosition( (VECTOR2I) m_editedPoint->GetPosition() ); } dimension->Update(); @@ -1654,7 +1654,7 @@ void PCB_POINT_EDITOR::updatePoints() case SHAPE_T::POLY: { - std::vector points; + std::vector points; shape->DupPolyPointsList( points ); if( m_editPoints->PointsSize() != (unsigned) points.size() ) @@ -1694,8 +1694,8 @@ void PCB_POINT_EDITOR::updatePoints() { const PAD* pad = static_cast( item ); bool locked = pad->GetParent() && pad->IsLocked(); - wxPoint shapePos = pad->ShapePos(); - wxPoint halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 ); + VECTOR2I shapePos = pad->ShapePos(); + VECTOR2I halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 ); switch( pad->GetShape() ) { diff --git a/pcbnew/tools/pcb_selection.cpp b/pcbnew/tools/pcb_selection.cpp index 4c5a06ccd6..73c7132cf6 100644 --- a/pcbnew/tools/pcb_selection.cpp +++ b/pcbnew/tools/pcb_selection.cpp @@ -52,7 +52,7 @@ EDA_ITEM* PCB_SELECTION::GetTopLeftItem( bool aFootprintsOnly ) const { EDA_ITEM* topLeftItem = nullptr; - wxPoint pnt; + VECTOR2I pnt; // find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item in the selection for( EDA_ITEM* item : m_items ) diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index cc6b6230cb..e9ac7b11e4 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -368,8 +368,8 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) []( const VECTOR2I& aWhere, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* aTool ) { - wxPoint location = wxPoint( aWhere ); - int accuracy = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() ); + VECTOR2I location = aWhere; + int accuracy = KiROUND( 5 * aCollector.GetGuide()->OnePixelInIU() ); std::set remove; for( EDA_ITEM* item : aCollector ) @@ -663,12 +663,12 @@ bool PCB_SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag, guide.SetIgnoreZoneFills( displayOpts.m_ZoneDisplayMode != ZONE_DISPLAY_MODE::SHOW_FILLED ); - if( m_enteredGroup && !m_enteredGroup->GetBoundingBox().Contains( (wxPoint) aWhere ) ) + if( m_enteredGroup && !m_enteredGroup->GetBoundingBox().Contains( aWhere ) ) ExitGroup(); collector.Collect( board(), m_isFootprintEditor ? GENERAL_COLLECTOR::FootprintItems : GENERAL_COLLECTOR::AllBoardItems, - (wxPoint) aWhere, guide ); + aWhere, guide ); // Remove unselectable items for( int i = collector.GetCount() - 1; i >= 0; --i ) @@ -1145,9 +1145,9 @@ void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem auto connectivity = board()->GetConnectivity(); auto connectedItems = connectivity->GetConnectedItems( &aStartItem, types, true ); - std::map> trackMap; - std::map viaMap; - std::map padMap; + std::map> trackMap; + std::map viaMap; + std::map padMap; // Build maps of connected items for( BOARD_CONNECTED_ITEM* item : connectedItems ) @@ -1184,7 +1184,7 @@ void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem item->ClearFlags( TEMP_SELECTED ); } - std::vector< std::pair > activePts; + std::vector> activePts; // Set up the initial active points switch( aStartItem.Type() ) @@ -1221,7 +1221,7 @@ void PCB_SELECTION_TOOL::selectConnectedTracks( BOARD_CONNECTED_ITEM& aStartItem for( int i = activePts.size() - 1; i >= 0; --i ) { - wxPoint pt = activePts[i].first; + VECTOR2I pt = activePts[i].first; PCB_LAYER_ID layer = activePts[i].second; size_t pt_count = 0; diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index d18804e2c7..a622bcba76 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -197,9 +197,9 @@ bool ZONE::UnFill() } -wxPoint ZONE::GetPosition() const +VECTOR2I ZONE::GetPosition() const { - return (wxPoint) GetCornerPosition( 0 ); + return GetCornerPosition( 0 ); } @@ -371,7 +371,7 @@ void ZONE::BuildHashValue( PCB_LAYER_ID aLayer ) } -bool ZONE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool ZONE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { // When looking for an "exact" hit aAccuracy will be 0 which works poorly for very thin // lines. Give it a floor. @@ -381,7 +381,7 @@ bool ZONE::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -void ZONE::SetSelectedCorner( const wxPoint& aPosition, int aAccuracy ) +void ZONE::SetSelectedCorner( const VECTOR2I& aPosition, int aAccuracy ) { SHAPE_POLY_SET::VERTEX_INDEX corner; @@ -396,28 +396,28 @@ void ZONE::SetSelectedCorner( const wxPoint& aPosition, int aAccuracy ) } } -bool ZONE::HitTestForCorner( const wxPoint& refPos, int aAccuracy, +bool ZONE::HitTestForCorner( const VECTOR2I& refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const { return m_Poly->CollideVertex( VECTOR2I( refPos ), aCornerHit, aAccuracy ); } -bool ZONE::HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const +bool ZONE::HitTestForCorner( const VECTOR2I& refPos, int aAccuracy ) const { SHAPE_POLY_SET::VERTEX_INDEX dummy; return HitTestForCorner( refPos, aAccuracy, dummy ); } -bool ZONE::HitTestForEdge( const wxPoint& refPos, int aAccuracy, +bool ZONE::HitTestForEdge( const VECTOR2I& refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const { return m_Poly->CollideEdge( VECTOR2I( refPos ), aCornerHit, aAccuracy ); } -bool ZONE::HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const +bool ZONE::HitTestForEdge( const VECTOR2I& refPos, int aAccuracy ) const { SHAPE_POLY_SET::VERTEX_INDEX dummy; return HitTestForEdge( refPos, aAccuracy, dummy ); @@ -477,7 +477,7 @@ int ZONE::GetLocalClearance( wxString* aSource ) const } -bool ZONE::HitTestFilledArea( PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy ) const +bool ZONE::HitTestFilledArea( PCB_LAYER_ID aLayer, const VECTOR2I& aRefPos, int aAccuracy ) const { // Rule areas have no filled area, but it's generally nice to treat their interior as if it were // filled so that people don't have to select them by their outline (which is min-width) @@ -645,7 +645,7 @@ void ZONE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& } -void ZONE::Move( const wxPoint& offset ) +void ZONE::Move( const VECTOR2I& offset ) { /* move outlines */ m_Poly->Move( offset ); @@ -659,14 +659,14 @@ void ZONE::Move( const wxPoint& offset ) { for( SEG& seg : pair.second ) { - seg.A += VECTOR2I( offset ); - seg.B += VECTOR2I( offset ); + seg.A += offset; + seg.B += offset; } } } -void ZONE::MoveEdge( const wxPoint& offset, int aEdge ) +void ZONE::MoveEdge( const VECTOR2I& offset, int aEdge ) { int next_corner; @@ -681,7 +681,7 @@ void ZONE::MoveEdge( const wxPoint& offset, int aEdge ) } -void ZONE::Rotate( const wxPoint& aCentre, double aAngle ) +void ZONE::Rotate( const VECTOR2I& aCentre, double aAngle ) { aAngle = -DECIDEG2RAD( aAngle ); @@ -690,24 +690,25 @@ void ZONE::Rotate( const wxPoint& aCentre, double aAngle ) /* rotate filled areas: */ for( std::pair& pair : m_FilledPolysList ) - pair.second.Rotate( aAngle, VECTOR2I( aCentre ) ); + pair.second.Rotate( aAngle, aCentre ); for( std::pair >& pair : m_FillSegmList ) { for( SEG& seg : pair.second ) { - wxPoint a( seg.A ); - RotatePoint( &a, aCentre, aAngle ); + VECTOR2I a( seg.A ); + RotatePoint( a, aCentre, aAngle ); seg.A = a; - wxPoint b( seg.B ); - RotatePoint( &b, aCentre, aAngle ); + + VECTOR2I b( seg.B ); + RotatePoint( b, aCentre, aAngle ); seg.B = a; } } } -void ZONE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void ZONE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { Mirror( aCentre, aFlipLeftRight ); int copperLayerCount = GetBoard()->GetCopperLayerCount(); @@ -719,15 +720,15 @@ void ZONE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void ZONE::Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight ) +void ZONE::Mirror( const VECTOR2I& aMirrorRef, bool aMirrorLeftRight ) { // ZONEs mirror about the x-axis (why?!?) - m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) ); + m_Poly->Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef ); HatchBorder(); for( std::pair& pair : m_FilledPolysList ) - pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, VECTOR2I( aMirrorRef ) ); + pair.second.Mirror( aMirrorLeftRight, !aMirrorLeftRight, aMirrorRef ); for( std::pair >& pair : m_FillSegmList ) { @@ -777,7 +778,7 @@ void ZONE::AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ) } -void ZONE::AddPolygon( std::vector< wxPoint >& aPolygon ) +void ZONE::AddPolygon( std::vector& aPolygon ) { if( aPolygon.empty() ) return; @@ -785,7 +786,7 @@ void ZONE::AddPolygon( std::vector< wxPoint >& aPolygon ) SHAPE_LINE_CHAIN outline; // Create an outline and populate it with the points of aPolygon - for( const wxPoint& pt : aPolygon) + for( const VECTOR2I& pt : aPolygon ) outline.Append( pt ); outline.SetClosed( true ); @@ -794,7 +795,7 @@ void ZONE::AddPolygon( std::vector< wxPoint >& aPolygon ) } -bool ZONE::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication ) +bool ZONE::AppendCorner( VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication ) { // Ensure the main outline exists: if( m_Poly->OutlineCount() == 0 ) diff --git a/pcbnew/zone.h b/pcbnew/zone.h index 81408e1aa9..0f0021a989 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -106,10 +106,10 @@ public: void InitDataFromSrcInCopyCtor( const ZONE& aZone ); /** - * @return a wxPoint, position of the first point of the outline + * @return a VECTOR2I, position of the first point of the outline */ - wxPoint GetPosition() const override; - void SetPosition( const wxPoint& aPos ) override {} + VECTOR2I GetPosition() const override; + void SetPosition( const VECTOR2I& aPos ) override {} /** * @param aPriority is the priority level. @@ -298,7 +298,7 @@ public: /// // Like HitTest but selects the current corner to be operated on - void SetSelectedCorner( const wxPoint& aPosition, int aAccuracy ); + void SetSelectedCorner( const VECTOR2I& aPosition, int aAccuracy ); int GetLocalFlags() const { return m_localFlgs; } void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; } @@ -327,20 +327,20 @@ public: /** * Test if a point is near an outline edge or a corner of this zone. * - * @param aPosition the wxPoint to test + * @param aPosition the VECTOR2I to test * @return true if a hit, else false */ - bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; + bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; /** - * Test if the given wxPoint is within the bounds of a filled area of this zone. + * Test if the given VECTOR2I is within the bounds of a filled area of this zone. * * @param aLayer is the layer to test on - * @param aRefPos A wxPoint to test + * @param aRefPos A VECTOR2I to test * @param aAccuracy Expand the distance by which the areas are expanded for the hittest * @return true if a hit, else false */ - bool HitTestFilledArea( PCB_LAYER_ID aLayer, const wxPoint &aRefPos, int aAccuracy = 0 ) const; + bool HitTestFilledArea( PCB_LAYER_ID aLayer, const VECTOR2I& aRefPos, int aAccuracy = 0 ) const; /** * Test if the given point is contained within a cutout of the zone. @@ -353,12 +353,6 @@ public: bool HitTestCutout( const VECTOR2I& aRefPos, int* aOutlineIdx = nullptr, int* aHoleIdx = nullptr ) const; - bool HitTestCutout( const wxPoint& aRefPos, int* aOutlineIdx = nullptr, - int* aHoleIdx = nullptr ) const - { - return HitTestCutout( VECTOR2I( aRefPos.x, aRefPos.y ), aOutlineIdx, aHoleIdx ); - } - /** * Some intersecting zones, despite being on the same layer with the same net, cannot be * merged due to other parameters such as fillet radius. The copper pour will end up @@ -411,47 +405,47 @@ public: bool ignoreLineWidth = false ) const override; /** - * Test if the given wxPoint is near a corner. + * Test if the given VECTOR2I is near a corner. * - * @param refPos is the wxPoint to test. + * @param refPos is the VECTOR2I to test. * @param aAccuracy increase the item bounding box by this amount. * @param aCornerHit [out] is the index of the closest vertex found, useless when return * value is false. * @return true if some corner was found to be closer to refPos than aClearance; false * otherwise. */ - bool HitTestForCorner( const wxPoint& refPos, int aAccuracy, + bool HitTestForCorner( const VECTOR2I& refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const; /** - * Test if the given wxPoint is near a corner. - * @param refPos is the wxPoint to test. + * Test if the given VECTOR2I is near a corner. + * @param refPos is the VECTOR2I to test. * @param aAccuracy increase the item bounding box by this amount. * @return true if some corner was found to be closer to refPos than aClearance; false * otherwise. */ - bool HitTestForCorner( const wxPoint& refPos, int aAccuracy ) const; + bool HitTestForCorner( const VECTOR2I& refPos, int aAccuracy ) const; /** - * Test if the given wxPoint is near a segment defined by 2 corners. + * Test if the given VECTOR2I is near a segment defined by 2 corners. * - * @param refPos is the wxPoint to test. + * @param refPos is the VECTOR2I to test. * @param aAccuracy increase the item bounding box by this amount. * @param aCornerHit [out] is the index of the closest vertex found, useless when return * value is false. * @return true if some edge was found to be closer to refPos than aClearance. */ - bool HitTestForEdge( const wxPoint& refPos, int aAccuracy, + bool HitTestForEdge( const VECTOR2I& refPos, int aAccuracy, SHAPE_POLY_SET::VERTEX_INDEX& aCornerHit ) const; /** - * Test if the given wxPoint is near a segment defined by 2 corners. + * Test if the given VECTOR2I is near a segment defined by 2 corners. * - * @param refPos is the wxPoint to test. + * @param refPos is the VECTOR2I to test. * @param aAccuracy increase the item bounding box by this amount. * @return true if some edge was found to be closer to refPos than aClearance. */ - bool HitTestForEdge( const wxPoint& refPos, int aAccuracy ) const; + bool HitTestForEdge( const VECTOR2I& refPos, int aAccuracy ) const; /** * @copydoc BOARD_ITEM::HitTest(const EDA_RECT& aRect, @@ -473,7 +467,7 @@ public: * * @param offset is moving vector */ - void Move( const wxPoint& offset ) override; + void Move( const VECTOR2I& offset ) override; /** * Move the outline Edge. @@ -481,7 +475,7 @@ public: * @param offset is moving vector * @param aEdge is start point of the outline edge */ - void MoveEdge( const wxPoint& offset, int aEdge ); + void MoveEdge( const VECTOR2I& offset, int aEdge ); /** * Move the outlines. @@ -489,7 +483,7 @@ public: * @param aCentre is rot centre * @param aAngle is in 0.1 degree */ - void Rotate( const wxPoint& aCentre, double aAngle ) override; + void Rotate( const VECTOR2I& aCentre, double aAngle ) override; /** * Flip this object, i.e. change the board side for this object @@ -497,7 +491,7 @@ public: * * @param aCentre is the rotation point. */ - virtual void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; + virtual void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; /** * Mirror the outlines relative to a given horizontal axis the layer is not changed. @@ -505,7 +499,7 @@ public: * @param aMirrorRef is axis position * @param aMirrorLeftRight mirror across Y axis (otherwise mirror across X) */ - void Mirror( const wxPoint& aMirrorRef, bool aMirrorLeftRight ); + void Mirror( const VECTOR2I& aMirrorRef, bool aMirrorLeftRight ); /** * @return the class name. @@ -569,7 +563,7 @@ public: return m_Poly->CVertex( index ); } - void SetCornerPosition( int aCornerIndex, const wxPoint& new_pos ) + void SetCornerPosition( int aCornerIndex, const VECTOR2I& new_pos ) { SHAPE_POLY_SET::VERTEX_INDEX relativeIndices; @@ -606,7 +600,7 @@ public: * even if it is duplicated. * @return true if the corner was added, false if error (aHoleIdx > hole count -1) */ - bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false ); + bool AppendCorner( VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplication = false ); ZONE_BORDER_DISPLAY_STYLE GetHatchStyle() const { return m_borderStyle; } void SetHatchStyle( ZONE_BORDER_DISPLAY_STYLE aStyle ) { m_borderStyle = aStyle; } @@ -710,7 +704,7 @@ public: * If the zone outline is empty, this is the main outline. Otherwise it is a hole * inside the main outline. */ - void AddPolygon( std::vector< wxPoint >& aPolygon ); + void AddPolygon( std::vector& aPolygon ); void AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ); diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 02af0d2f30..2bd8fa1efe 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -1337,7 +1337,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, // Thermal spokes consist of segments from the pad center to points just outside // the thermal relief. - wxPoint shapePos = pad->ShapePos(); + VECTOR2I shapePos = pad->ShapePos(); double spokesAngle = pad->GetOrientation() + pad->GetThermalSpokeAngle(); while( spokesAngle >= 900.0 ) @@ -1353,7 +1353,7 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer, dummy_pad.SetOrientation( spokesAngle ); // Spokes are from center of pad, not from hole - dummy_pad.SetPosition( -pad->GetOffset() ); + dummy_pad.SetPosition( -1*pad->GetOffset() ); BOX2I reliefBB = dummy_pad.GetBoundingBox(); reliefBB.Inflate( thermalReliefGap + epsilon ); diff --git a/qa/eeschema/test_ee_item.cpp b/qa/eeschema/test_ee_item.cpp index c1e396e746..2ab5e5a42a 100644 --- a/qa/eeschema/test_ee_item.cpp +++ b/qa/eeschema/test_ee_item.cpp @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE( Move ) []( EDA_ITEM* aOriginalItem, wxPoint aRef ) { auto item = std::unique_ptr( aOriginalItem->Clone() ); - wxPoint originalPos = item->GetPosition(); + VECTOR2I originalPos = item->GetPosition(); SCH_ITEM* schItem = dynamic_cast( item.get() ); LIB_ITEM* libItem = dynamic_cast( item.get() ); diff --git a/qa/eeschema/test_sch_sheet.cpp b/qa/eeschema/test_sch_sheet.cpp index 550849cfa9..c6fed03a58 100644 --- a/qa/eeschema/test_sch_sheet.cpp +++ b/qa/eeschema/test_sch_sheet.cpp @@ -233,7 +233,7 @@ BOOST_AUTO_TEST_CASE( EndconnectionPoints ) expectedConnections.push_back( pin.m_pos ); } - std::vector connections = m_sheet.GetConnectionPoints(); + std::vector connections = m_sheet.GetConnectionPoints(); BOOST_CHECK_EQUAL_COLLECTIONS( connections.begin(), connections.end(), expectedConnections.begin(), expectedConnections.end() ); diff --git a/qa/pcbnew/drc/test_custom_rule_severities.cpp b/qa/pcbnew/drc/test_custom_rule_severities.cpp index 2ca4b60c66..e11a0f6bcf 100644 --- a/qa/pcbnew/drc/test_custom_rule_severities.cpp +++ b/qa/pcbnew/drc/test_custom_rule_severities.cpp @@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCustomRuleSeverityTest, DRC_REGRESSION_TEST_FIXTURE BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { PCB_MARKER temp( aItem, aPos ); diff --git a/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp b/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp index dd809b4605..5f54fbb270 100644 --- a/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp +++ b/qa/pcbnew/drc/test_drc_courtyard_invalid.cpp @@ -304,7 +304,7 @@ void DoCourtyardInvalidTest( const COURTYARD_INVALID_CASE& aCase, drcEngine.InitEngine( wxFileName() ); drcEngine.SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS || aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD diff --git a/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp b/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp index d41e06cbc1..611f95458a 100644 --- a/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp +++ b/qa/pcbnew/drc/test_drc_courtyard_overlap.cpp @@ -460,7 +460,7 @@ static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase, drcEngine.InitEngine( wxFileName() ); drcEngine.SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { if( aItem->GetErrorCode() == DRCE_OVERLAPPING_FOOTPRINTS || aItem->GetErrorCode() == DRCE_MALFORMED_COURTYARD diff --git a/qa/pcbnew/drc/test_drc_regressions.cpp b/qa/pcbnew/drc/test_drc_regressions.cpp index b098e29c75..28d6575ea5 100644 --- a/qa/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/pcbnew/drc/test_drc_regressions.cpp @@ -69,7 +69,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTUR bds.m_DRCSeverities[ DRCE_UNCONNECTED_ITEMS ] = SEVERITY::RPT_SEVERITY_IGNORE; bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { if( bds.GetSeverity( aItem->GetErrorCode() ) == SEVERITY::RPT_SEVERITY_ERROR ) violations.push_back( *aItem ); @@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { PCB_MARKER temp( aItem, aPos ); diff --git a/qa/pcbnew/drc/test_solder_mask_bridging.cpp b/qa/pcbnew/drc/test_solder_mask_bridging.cpp index 645a8ce2c9..225806c05a 100644 --- a/qa/pcbnew/drc/test_solder_mask_bridging.cpp +++ b/qa/pcbnew/drc/test_solder_mask_bridging.cpp @@ -50,7 +50,7 @@ BOOST_FIXTURE_TEST_CASE( DRCSolderMaskBridgingTest, DRC_REGRESSION_TEST_FIXTURE BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { PCB_MARKER temp( aItem, aPos ); diff --git a/qa/pcbnew/test_board_item.cpp b/qa/pcbnew/test_board_item.cpp index 52da7c1dbc..82a1a65438 100644 --- a/qa/pcbnew/test_board_item.cpp +++ b/qa/pcbnew/test_board_item.cpp @@ -185,8 +185,8 @@ BOOST_AUTO_TEST_CASE( Move ) if( originalDimension != nullptr ) originalDimension->Update(); - auto item = std::unique_ptr( aOriginalItem->Duplicate() ); - wxPoint originalPos = item->GetPosition(); + auto item = std::unique_ptr( aOriginalItem->Duplicate() ); + VECTOR2I originalPos = item->GetPosition(); // Move to a point, then go back. // This has to be an identity transformation. diff --git a/qa/pcbnew/test_tracks_cleaner.cpp b/qa/pcbnew/test_tracks_cleaner.cpp index a885726526..0833fef5da 100644 --- a/qa/pcbnew/test_tracks_cleaner.cpp +++ b/qa/pcbnew/test_tracks_cleaner.cpp @@ -171,7 +171,7 @@ BOOST_FIXTURE_TEST_CASE( TrackCleanerRegressionTests, TRACK_CLEANER_TEST_FIXTURE BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { if( aItem->GetErrorCode() == DRCE_UNCONNECTED_ITEMS ) violations.push_back( *aItem ); diff --git a/qa/pcbnew/test_zone_filler.cpp b/qa/pcbnew/test_zone_filler.cpp index 0bc6ad3b1c..b2fd69beb9 100644 --- a/qa/pcbnew/test_zone_filler.cpp +++ b/qa/pcbnew/test_zone_filler.cpp @@ -98,7 +98,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE ) bds.m_DRCEngine->InitEngine( wxFileName() ); // Just to be sure to be sure bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, PCB_LAYER_ID aLayer ) { if( aItem->GetErrorCode() == DRCE_CLEARANCE ) { @@ -204,7 +204,8 @@ BOOST_FIXTURE_TEST_CASE( RegressionZoneFillTests, ZONE_FILL_TEST_FIXTURE ) std::vector violations; bds.m_DRCEngine->SetViolationHandler( - [&]( const std::shared_ptr& aItem, wxPoint aPos, PCB_LAYER_ID aLayer ) + [&]( const std::shared_ptr& aItem, VECTOR2I aPos, + PCB_LAYER_ID aLayer ) { if( aItem->GetErrorCode() == DRCE_CLEARANCE ) violations.push_back( *aItem );