From 347e03363ad57375737ed0c0553752f5637dc79d Mon Sep 17 00:00:00 2001
From: Marek Roszko <mark.roszko@gmail.com>
Date: Wed, 29 Dec 2021 16:30:11 -0500
Subject: [PATCH] Convert wxPoint/wxSize starting from EDA_RECT usages

---
 common/eda_draw_frame.cpp                     |  4 +-
 common/eda_rect.cpp                           | 66 +++++++++----------
 common/eda_shape.cpp                          |  2 +-
 common/eda_text.cpp                           | 24 +++----
 common/marker_base.cpp                        |  4 +-
 eeschema/autoplace_fields.cpp                 |  4 +-
 eeschema/connection_graph.cpp                 |  2 +-
 eeschema/cross-probing.cpp                    |  2 +-
 eeschema/dialogs/dialog_change_symbols.cpp    |  4 +-
 eeschema/dialogs/dialog_field_properties.cpp  |  4 +-
 eeschema/dialogs/dialog_field_properties.h    |  2 +-
 eeschema/dialogs/dialog_pin_properties.cpp    |  2 +-
 eeschema/fields_grid_table.cpp                |  2 +-
 eeschema/lib_field.cpp                        | 16 ++---
 eeschema/lib_field.h                          |  2 +-
 eeschema/lib_text.cpp                         | 18 ++---
 eeschema/lib_text.h                           |  2 +-
 eeschema/sch_base_frame.h                     |  6 +-
 eeschema/sch_field.cpp                        | 28 ++++----
 eeschema/sch_field.h                          |  2 +-
 eeschema/sch_painter.cpp                      | 18 ++---
 eeschema/sch_painter.h                        |  2 +-
 .../cadstar/cadstar_sch_archive_loader.cpp    | 14 ++--
 .../sch_plugins/eagle/sch_eagle_plugin.cpp    | 14 ++--
 eeschema/sch_screen.h                         |  6 ++
 eeschema/sch_sheet.cpp                        |  8 +--
 eeschema/sch_sheet_pin.cpp                    | 10 +--
 eeschema/sch_symbol.cpp                       |  8 +--
 eeschema/sch_text.cpp                         | 64 +++++++++---------
 eeschema/sch_text.h                           |  2 +-
 eeschema/tools/sch_edit_tool.cpp              |  6 +-
 eeschema/tools/sch_editor_control.cpp         |  2 +-
 eeschema/tools/sch_move_tool.cpp              |  2 +-
 eeschema/tools/symbol_editor_control.cpp      |  3 +-
 eeschema/transform.cpp                        |  7 ++
 eeschema/transform.h                          | 10 +++
 gerbview/gerber_draw_item.cpp                 |  6 +-
 gerbview/gerbview_frame.h                     |  6 +-
 include/board_design_settings.h               | 12 ++--
 include/board_item.h                          |  2 +-
 include/drawing_sheet/ds_draw_item.h          |  2 +-
 include/eda_draw_frame.h                      |  4 +-
 include/eda_rect.h                            | 54 +++++++--------
 include/eda_text.h                            | 12 ++--
 include/pcb_base_frame.h                      |  8 +--
 libs/kimath/include/math/vector2d.h           | 10 +++
 libs/kimath/include/trigo.h                   | 18 +++--
 libs/kimath/src/trigo.cpp                     | 10 +--
 pagelayout_editor/pl_editor_frame.h           |  6 +-
 pcbnew/autorouter/ar_autoplacer.cpp           | 22 +++----
 pcbnew/autorouter/ar_matrix.cpp               |  2 +-
 pcbnew/autorouter/ar_matrix.h                 |  2 +-
 pcbnew/autorouter/spread_footprints.cpp       |  8 ++-
 pcbnew/board.h                                |  2 +-
 pcbnew/dialogs/dialog_export_svg.cpp          |  4 +-
 pcbnew/dialogs/dialog_export_vrml.cpp         |  2 +-
 pcbnew/dialogs/dialog_gendrill.cpp            |  2 +-
 pcbnew/dialogs/dialog_gendrill.h              |  2 +-
 pcbnew/dialogs/dialog_position_relative.cpp   |  8 +--
 pcbnew/dialogs/dialog_position_relative.h     |  6 +-
 pcbnew/drc/drc_test_provider_misc.cpp         |  2 +-
 pcbnew/exporters/export_d356.cpp              |  4 +-
 .../exporters/export_footprints_placefile.cpp | 10 +--
 .../exporters/export_footprints_placefile.h   | 16 ++---
 pcbnew/exporters/export_gencad.cpp            |  2 +-
 pcbnew/exporters/gen_drill_report_files.cpp   |  6 +-
 pcbnew/exporters/gendrill_Excellon_writer.h   |  4 +-
 pcbnew/exporters/gendrill_file_writer_base.h  |  8 +--
 pcbnew/exporters/gendrill_gerber_writer.cpp   |  2 +-
 pcbnew/exporters/gendrill_gerber_writer.h     |  2 +-
 pcbnew/exporters/gerber_placefile_writer.h    |  6 +-
 pcbnew/fp_text.cpp                            | 16 ++---
 pcbnew/fp_text.h                              |  2 +-
 pcbnew/pcb_base_frame.cpp                     | 10 +--
 pcbnew/pcb_dimension.cpp                      |  6 +-
 pcbnew/pcb_group.cpp                          |  2 +-
 pcbnew/pcb_painter.cpp                        |  6 +-
 pcbnew/pcb_text.cpp                           |  4 +-
 pcbnew/pcb_text.h                             |  2 +-
 pcbnew/pcbplot.cpp                            |  2 +-
 pcbnew/plot_board_layers.cpp                  |  6 +-
 pcbnew/plot_brditems_plotter.cpp              |  8 +--
 pcbnew/plugins/kicad/pcb_plugin.cpp           |  4 +-
 pcbnew/tools/board_editor_control.cpp         |  2 +-
 pcbnew/tools/pcb_control.cpp                  |  2 +-
 pcbnew/tools/position_relative_tool.cpp       |  6 +-
 pcbnew/tools/position_relative_tool.h         | 10 +--
 qa/eeschema/test_ee_item.cpp                  | 16 ++---
 88 files changed, 397 insertions(+), 351 deletions(-)

diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index 49cfc0b67c..5c2feb04b8 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -834,7 +834,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
 
 wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
 {
-    const wxPoint& gridOrigin = GetGridOrigin();
+    const VECTOR2I& gridOrigin = GetGridOrigin();
     VECTOR2D       gridSize = GetCanvas()->GetGAL()->GetGridSize();
 
     double xOffset = fmod( gridOrigin.x, gridSize.x );
@@ -848,7 +848,7 @@ wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
 
 wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) const
 {
-    const wxPoint& gridOrigin = GetGridOrigin();
+    const VECTOR2I& gridOrigin = GetGridOrigin();
     VECTOR2D       gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
 
     double xOffset = fmod( gridOrigin.x, gridSize.x );
diff --git a/common/eda_rect.cpp b/common/eda_rect.cpp
index 6522fb6cd3..4d3742a10c 100644
--- a/common/eda_rect.cpp
+++ b/common/eda_rect.cpp
@@ -48,16 +48,16 @@ void EDA_RECT::Normalize()
 }
 
 
-void EDA_RECT::Move( const wxPoint& aMoveVector )
+void EDA_RECT::Move( const VECTOR2I& aMoveVector )
 {
     m_pos += aMoveVector;
 }
 
 
-bool EDA_RECT::Contains( const wxPoint& aPoint ) const
+bool EDA_RECT::Contains( const VECTOR2I& aPoint ) const
 {
-    wxPoint rel_pos = aPoint - m_pos;
-    wxSize  size    = m_size;
+    VECTOR2I rel_pos = aPoint - m_pos;
+    VECTOR2I size = m_size;
 
     if( size.x < 0 )
     {
@@ -82,9 +82,9 @@ bool EDA_RECT::Contains( const EDA_RECT& aRect ) const
 }
 
 
-bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const
+bool EDA_RECT::Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2 ) const
 {
-    wxPoint point2, point4;
+    VECTOR2I point2, point4;
 
     if( Contains( aPoint1 ) || Contains( aPoint2 ) )
         return true;
@@ -108,10 +108,10 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) cons
 }
 
 
-bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2, wxPoint* aIntersection1,
-        wxPoint* aIntersection2 ) const
+bool EDA_RECT::Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2,
+                           VECTOR2I* aIntersection1, VECTOR2I* aIntersection2 ) const
 {
-    wxPoint point2, point4;
+    VECTOR2I point2, point4;
 
     point2.x = GetEnd().x;
     point2.y = GetOrigin().y;
@@ -120,7 +120,7 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2, wxPoi
 
     bool intersects = false;
 
-    wxPoint* aPointToFill = aIntersection1;
+    VECTOR2I* aPointToFill = aIntersection1;
 
     if( SegmentIntersectsSegment( aPoint1, aPoint2, GetOrigin(), point2, aPointToFill ) )
         intersects = true;
@@ -229,7 +229,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
      * C) One of the sides of the rotated rect intersect this
      */
 
-    wxPoint corners[4];
+    VECTOR2I corners[4];
 
     /* Test A : Any corners exist in rotated rect? */
     corners[0] = m_pos;
@@ -237,12 +237,12 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
     corners[2] = m_pos + wxPoint( m_size.x, m_size.y );
     corners[3] = m_pos + wxPoint( 0, m_size.y );
 
-    wxPoint rCentre = aRect.Centre();
+    VECTOR2I rCentre = aRect.Centre();
 
     for( int i = 0; i < 4; i++ )
     {
-        wxPoint delta = corners[i] - rCentre;
-        RotatePoint( &delta, -aRot );
+        VECTOR2I delta = corners[i] - rCentre;
+        RotatePoint( delta, -aRot );
         delta += rCentre;
 
         if( aRect.Contains( delta ) )
@@ -264,7 +264,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
     // Rotate and test each corner
     for( int j = 0; j < 4; j++ )
     {
-        RotatePoint( &corners[j], aRot );
+        RotatePoint( corners[j], aRot );
         corners[j] += rCentre;
 
         if( Contains( corners[j] ) )
@@ -445,8 +445,8 @@ void EDA_RECT::Merge( const EDA_RECT& aRect )
     Normalize(); // ensure width and height >= 0
     EDA_RECT rect = aRect;
     rect.Normalize(); // ensure width and height >= 0
-    wxPoint end      = GetEnd();
-    wxPoint rect_end = rect.GetEnd();
+    VECTOR2I end = GetEnd();
+    VECTOR2I rect_end = rect.GetEnd();
 
     // Change origin and size in order to contain the given rect
     m_pos.x = std::min( m_pos.x, rect.m_pos.x );
@@ -469,7 +469,7 @@ void EDA_RECT::Merge( const wxPoint& aPoint )
 
     Normalize(); // ensure width and height >= 0
 
-    wxPoint end = GetEnd();
+    VECTOR2I end = GetEnd();
 
     // Change origin and size in order to contain the given rect
     m_pos.x = std::min( m_pos.x, aPoint.x );
@@ -492,27 +492,27 @@ EDA_RECT EDA_RECT::Common( const EDA_RECT& aRect ) const
 
     if( Intersects( aRect ) )
     {
-        wxPoint originA(
-                std::min( GetOrigin().x, GetEnd().x ), std::min( GetOrigin().y, GetEnd().y ) );
-        wxPoint originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
-                std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
-        wxPoint endA(
-                std::max( GetOrigin().x, GetEnd().x ), std::max( GetOrigin().y, GetEnd().y ) );
-        wxPoint endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
-                std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
+        VECTOR2I originA( std::min( GetOrigin().x, GetEnd().x ),
+                          std::min( GetOrigin().y, GetEnd().y ) );
+        VECTOR2I originB( std::min( aRect.GetOrigin().x, aRect.GetEnd().x ),
+                          std::min( aRect.GetOrigin().y, aRect.GetEnd().y ) );
+        VECTOR2I endA( std::max( GetOrigin().x, GetEnd().x ),
+                       std::max( GetOrigin().y, GetEnd().y ) );
+        VECTOR2I endB( std::max( aRect.GetOrigin().x, aRect.GetEnd().x ),
+                       std::max( aRect.GetOrigin().y, aRect.GetEnd().y ) );
 
         r.SetOrigin(
-                wxPoint( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
-        r.SetEnd( wxPoint( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
+                VECTOR2I( std::max( originA.x, originB.x ), std::max( originA.y, originB.y ) ) );
+        r.SetEnd( VECTOR2I( std::min( endA.x, endB.x ), std::min( endA.y, endB.y ) ) );
     }
 
     return r;
 }
 
 
-const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const wxPoint& aRotCenter, double aAngle ) const
+const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const VECTOR2I& aRotCenter, double aAngle ) const
 {
-    wxPoint corners[4];
+    VECTOR2I corners[4];
 
     // Build the corners list
     corners[0]   = GetOrigin();
@@ -524,11 +524,11 @@ const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const wxPoint& aRotCenter, doubl
 
     // Rotate all corners, to find the bounding box
     for( int ii = 0; ii < 4; ii++ )
-        RotatePoint( &corners[ii], aRotCenter, aAngle );
+        RotatePoint( corners[ii], aRotCenter, aAngle );
 
     // Find the corners bounding box
-    wxPoint start = corners[0];
-    wxPoint end   = corners[0];
+    VECTOR2I start = corners[0];
+    VECTOR2I end = corners[0];
 
     for( int ii = 1; ii < 4; ii++ )
     {
diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp
index 0144f0b583..dbd81bfb15 100644
--- a/common/eda_shape.cpp
+++ b/common/eda_shape.cpp
@@ -408,7 +408,7 @@ wxPoint EDA_SHAPE::getCenter() const
     case SHAPE_T::POLY:
     case SHAPE_T::RECT:
     case SHAPE_T::BEZIER:
-        return getBoundingBox().Centre();
+        return (wxPoint)getBoundingBox().Centre();
 
     default:
         UNIMPLEMENTED_FOR( SHAPE_T_asString() );
diff --git a/common/eda_text.cpp b/common/eda_text.cpp
index b8ad90ec4c..954214c2db 100644
--- a/common/eda_text.cpp
+++ b/common/eda_text.cpp
@@ -283,7 +283,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
     // Creates bounding box (rectangle) for horizontal, left and top justified text. The
     // bounding box will be moved later according to the actual text options
     wxSize textsize = wxSize( dx, dy );
-    wxPoint pos = GetTextPos();
+    VECTOR2I pos = GetTextPos();
 
     if( IsMultilineAllowed() && aLine > 0 && ( aLine < static_cast<int>( strings.GetCount() ) ) )
     {
@@ -394,10 +394,10 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
 bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
 {
     EDA_RECT rect = GetTextBox();
-    wxPoint location = aPoint;
+    VECTOR2I location = aPoint;
 
     rect.Inflate( aAccuracy );
-    RotatePoint( &location, GetTextPos(), -GetTextAngle() );
+    RotatePoint( location, GetTextPos(), -GetTextAngle() );
 
     return rect.Contains( location );
 }
@@ -441,7 +441,7 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
 
 void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
 {
-    wxPoint pos  = GetTextPos();     // Position of first line of the multiline text according
+    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.
@@ -466,22 +466,22 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
     }
 
     // Rotate the position of the first line around the center of the multiline text block
-    RotatePoint( &pos, GetTextPos(), GetTextAngle() );
+    RotatePoint( pos, GetTextPos(), GetTextAngle() );
 
     // Rotate the offset lines to increase happened in the right direction
     RotatePoint( &offset, GetTextAngle() );
 
     for( int ii = 0; ii < aLineCount; ii++ )
     {
-        aPositions.push_back( pos );
+        aPositions.push_back( (wxPoint) pos );
         pos += offset;
     }
 }
 
 
-void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
+void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
                                    const COLOR4D& aColor, OUTLINE_MODE aFillMode,
-                                   const wxString& aText, const wxPoint &aPos )
+                                   const wxString& aText, const VECTOR2I& aPos )
 {
     wxDC* DC = aSettings->GetPrintDC();
     int   penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
@@ -489,7 +489,7 @@ void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoi
     if( aFillMode == SKETCH )
         penWidth = -penWidth;
 
-    wxSize size = GetTextSize();
+    VECTOR2I size = GetTextSize();
 
     if( IsMirrored() )
         size.x = -size.x;
@@ -704,7 +704,7 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
     if( GetText().Length() == 0 )
         return;
 
-    wxPoint  corners[4];    // Buffer of polygon corners
+    VECTOR2I  corners[4];    // Buffer of polygon corners
 
     EDA_RECT rect = GetTextBox();
 
@@ -735,10 +735,10 @@ void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCorn
 
     aCornerBuffer->NewOutline();
 
-    for( wxPoint& corner : corners )
+    for( VECTOR2I& corner : corners )
     {
         // Rotate polygon
-        RotatePoint( &corner, GetTextPos(), GetTextAngle() );
+        RotatePoint( corner, GetTextPos(), GetTextAngle() );
         aCornerBuffer->Append( corner.x, corner.y );
     }
 }
diff --git a/common/marker_base.cpp b/common/marker_base.cpp
index c1cab42bb8..7cd554d845 100644
--- a/common/marker_base.cpp
+++ b/common/marker_base.cpp
@@ -122,8 +122,8 @@ void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale ) const
 
 EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
 {
-    wxSize size_iu = m_shapeBoundingBox.GetSize();
-    wxPoint position_iu = m_shapeBoundingBox.GetPosition();
+    VECTOR2I size_iu = m_shapeBoundingBox.GetSize();
+    VECTOR2I position_iu = m_shapeBoundingBox.GetPosition();
     size_iu.x *= m_scalingFactor;
     size_iu.y *= m_scalingFactor;
     position_iu.x *= m_scalingFactor;
diff --git a/eeschema/autoplace_fields.cpp b/eeschema/autoplace_fields.cpp
index 758c9dffd1..4d4c7dacca 100644
--- a/eeschema/autoplace_fields.cpp
+++ b/eeschema/autoplace_fields.cpp
@@ -527,7 +527,7 @@ protected:
      */
     wxPoint fieldBoxPlacement( SIDE_AND_NPINS aFieldSideAndPins )
     {
-        wxPoint fbox_center = m_symbol_bbox.Centre();
+        VECTOR2I fbox_center = m_symbol_bbox.Centre();
         int     offs_x = ( m_symbol_bbox.GetWidth() + m_fbox_size.GetWidth() ) / 2;
         int     offs_y = ( m_symbol_bbox.GetHeight() + m_fbox_size.GetHeight() ) / 2;
 
@@ -617,7 +617,7 @@ protected:
         // return false after this point.
         m_fbox_size = computeFBoxSize( /* aDynamic */ false );
 
-        wxPoint pos = aBox->GetPosition();
+        VECTOR2I pos = aBox->GetPosition();
 
         pos.y = round_n( pos.y, WIRE_V_SPACING, aSide == SIDE_BOTTOM );
 
diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp
index 251255efb4..44756e988f 100644
--- a/eeschema/connection_graph.cpp
+++ b/eeschema/connection_graph.cpp
@@ -507,7 +507,7 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
 void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
                                                const std::vector<SCH_ITEM*>& aItemList )
 {
-    std::map< wxPoint, std::vector<SCH_ITEM*> > connection_map;
+    std::map<VECTOR2I, std::vector<SCH_ITEM*>> connection_map;
 
     for( SCH_ITEM* item : aItemList )
     {
diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp
index df5a9dc3ce..c3aab3015a 100644
--- a/eeschema/cross-probing.cpp
+++ b/eeschema/cross-probing.cpp
@@ -134,7 +134,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
             if( crossProbingSettings.zoom_to_fit )
             {
                 EDA_RECT bbox       = symbol->GetBoundingBox();
-                wxSize   bbSize     = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
+                VECTOR2I bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
                 VECTOR2D screenSize = getView()->GetViewport().GetSize();
 
                 // This code tries to come up with a zoom factor that doesn't simply zoom in
diff --git a/eeschema/dialogs/dialog_change_symbols.cpp b/eeschema/dialogs/dialog_change_symbols.cpp
index 9246e1bebd..6e2ce4c43c 100644
--- a/eeschema/dialogs/dialog_change_symbols.cpp
+++ b/eeschema/dialogs/dialog_change_symbols.cpp
@@ -647,7 +647,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
             }
 
             if( resetPositions )
-                field.SetTextPos( aSymbol->GetPosition() + libField->GetTextPos() );
+                field.SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField->GetTextPos() );
         }
         else if( i >= MANDATORY_FIELDS && removeExtras )
         {
@@ -675,7 +675,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
             // Careful: the visible bit and position are also set by SetAttributes()
             schField->SetAttributes( libField );
             schField->SetText( libField.GetText() );
-            schField->SetTextPos( aSymbol->GetPosition() + libField.GetTextPos() );
+            schField->SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField.GetTextPos() );
         }
     }
 
diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp
index 4fe0ae438f..8f4399601e 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() != m_position )
+    if( aField->GetPosition() != (wxPoint)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( m_position );
+    aField->SetPosition( (wxPoint)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_field_properties.h b/eeschema/dialogs/dialog_field_properties.h
index 443d8d6498..5facfe7374 100644
--- a/eeschema/dialogs/dialog_field_properties.h
+++ b/eeschema/dialogs/dialog_field_properties.h
@@ -94,7 +94,7 @@ protected:
     wxString    m_text;
     bool        m_isItalic;
     bool        m_isBold;
-    wxPoint     m_position;
+    VECTOR2I    m_position;
     int         m_size;
     bool        m_isVertical;
     int         m_verticalJustification;
diff --git a/eeschema/dialogs/dialog_pin_properties.cpp b/eeschema/dialogs/dialog_pin_properties.cpp
index 963205bb49..bec314e801 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, -bBox.Centre(), (void*) &opts, DefaultTransform );
+    m_dummyPin->Print( renderSettings, (wxPoint) - bBox.Centre(), (void*) &opts, DefaultTransform );
 
     event.Skip();
 }
diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp
index ff0d18f18e..373ad4973e 100644
--- a/eeschema/fields_grid_table.cpp
+++ b/eeschema/fields_grid_table.cpp
@@ -537,7 +537,7 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
 {
     wxCHECK( aRow < GetNumberRows(), /*void*/ );
     T& field = this->at( (size_t) aRow );
-    wxPoint    pos;
+    VECTOR2I pos;
 
     switch( aCol )
     {
diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp
index 8a39c3294d..82126bfa64 100644
--- a/eeschema/lib_field.cpp
+++ b/eeschema/lib_field.cpp
@@ -117,7 +117,7 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
     wxDC*    DC = aSettings->GetPrintDC();
     COLOR4D  color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
     int      penWidth = GetEffectivePenWidth( aSettings );
-    wxPoint  text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
+    VECTOR2I text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
     wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
 
     GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
@@ -276,8 +276,8 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
 {
     int rot_angle = aRotateCCW ? -900 : 900;
 
-    wxPoint pt = GetTextPos();
-    RotatePoint( &pt, center, rot_angle );
+    VECTOR2I pt = GetTextPos();
+    RotatePoint( pt, center, rot_angle );
     SetTextPos( pt );
 
     SetTextAngle( GetTextAngle() != EDA_ANGLE::HORIZONTAL ? EDA_ANGLE::HORIZONTAL
@@ -307,7 +307,7 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
 
     GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_CENTER;
     GR_TEXT_V_ALIGN_T vjustify = GR_TEXT_V_ALIGN_CENTER;
-    wxPoint textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
+    VECTOR2I          textpos = aTransform.TransformCoordinate( bbox.Centre() ) + aOffset;
 
     COLOR4D color;
 
@@ -349,11 +349,11 @@ const EDA_RECT LIB_FIELD::GetBoundingBox() const
     rect.RevertYAxis();
 
     // We are using now a bottom to top Y axis.
-    wxPoint orig = rect.GetOrigin();
-    wxPoint end = rect.GetEnd();
+    VECTOR2I orig = rect.GetOrigin();
+    VECTOR2I end = rect.GetEnd();
 
-    RotatePoint( &orig, GetTextPos(), -GetTextAngle() );
-    RotatePoint( &end, GetTextPos(), -GetTextAngle() );
+    RotatePoint( orig, GetTextPos(), -GetTextAngle() );
+    RotatePoint( end, GetTextPos(), -GetTextAngle() );
 
     rect.SetOrigin( orig );
     rect.SetEnd( end );
diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h
index 696507c2b0..61f6974cc4 100644
--- a/eeschema/lib_field.h
+++ b/eeschema/lib_field.h
@@ -154,7 +154,7 @@ public:
 
     void MoveTo( const wxPoint& aPosition ) override;
 
-    wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
+    wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); }
 
     void MirrorHorizontal( const wxPoint& aCenter ) override;
     void MirrorVertical( const wxPoint& aCenter ) override;
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index 68c840e3b1..fb46ca507e 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -228,8 +228,8 @@ void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW )
     NormalizeJustification( false );
     int rot_angle = aRotateCCW ? -900 : 900;
 
-    wxPoint pt = GetTextPos();
-    RotatePoint( &pt, center, rot_angle );
+    VECTOR2I pt = GetTextPos();
+    RotatePoint( pt, center, rot_angle );
     SetTextPos( pt );
 
     if( GetTextAngle().IsHorizontal() )
@@ -265,12 +265,12 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
     EDA_RECT bBox = GetBoundingBox();
     // convert coordinates from draw Y axis to symbol_editor Y axis
     bBox.RevertYAxis();
-    wxPoint txtpos = bBox.Centre();
+    VECTOR2I txtpos = bBox.Centre();
 
     // The text orientation may need to be flipped if the transformation matrix causes xy
     // axes to be flipped.
     int t1  = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != EDA_ANGLE::HORIZONTAL );
-    wxPoint pos = aTransform.TransformCoordinate( txtpos ) + offset;
+    VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
 
     // Get color
     COLOR4D color;
@@ -329,7 +329,7 @@ void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
 
     // convert coordinates from draw Y axis to symbol_editor Y axis:
     bBox.RevertYAxis();
-    wxPoint txtpos = bBox.Centre();
+    VECTOR2I txtpos = bBox.Centre();
 
     // Calculate pos according to mirror/rotation.
     txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
@@ -382,11 +382,11 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
     rect.RevertYAxis();
 
     // We are using now a bottom to top Y axis.
-    wxPoint orig = rect.GetOrigin();
-    wxPoint end  = rect.GetEnd();
+    VECTOR2I orig = rect.GetOrigin();
+    VECTOR2I end = rect.GetEnd();
 
-    RotatePoint( &orig, GetTextPos(), -GetTextAngle() );
-    RotatePoint( &end,  GetTextPos(), -GetTextAngle() );
+    RotatePoint( orig, GetTextPos(), -GetTextAngle() );
+    RotatePoint( end, GetTextPos(), -GetTextAngle() );
 
     rect.SetOrigin( orig );
     rect.SetEnd( end );
diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h
index 5fbf3f469a..ab79825e90 100644
--- a/eeschema/lib_text.h
+++ b/eeschema/lib_text.h
@@ -88,7 +88,7 @@ public:
 
     void MoveTo( const wxPoint& aPosition ) override;
 
-    wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
+    wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); }
 
     void MirrorHorizontal( const wxPoint& aCenter ) override;
     void MirrorVertical( const wxPoint& aCenter ) override;
diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h
index db2f40316e..065c58aef5 100644
--- a/eeschema/sch_base_frame.h
+++ b/eeschema/sch_base_frame.h
@@ -121,12 +121,12 @@ public:
     const PAGE_INFO& GetPageSettings () const override;
     const wxSize GetPageSizeIU() const override;
 
-    const wxPoint& GetGridOrigin() const override
+    const VECTOR2I& GetGridOrigin() const override
     {
-        static wxPoint zero;
+        static VECTOR2I zero;
         return zero;
     }
-    void SetGridOrigin( const wxPoint& aPoint ) override {}
+    void SetGridOrigin( const VECTOR2I& aPoint ) override {}
 
     const TITLE_BLOCK& GetTitleBlock() const override;
     void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index f9c5a12cad..38a9e904f2 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -217,7 +217,7 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
 {
     wxDC*    DC = aSettings->GetPrintDC();
     COLOR4D  color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer );
-    wxPoint  textpos;
+    VECTOR2I textpos;
     int      penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
 
     if( ( !IsVisible() && !IsForceVisible() ) || IsVoid() )
@@ -299,7 +299,7 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const
 
 wxPoint SCH_FIELD::GetDrawPos() const
 {
-    return GetBoundingBox().Centre();
+    return (wxPoint)GetBoundingBox().Centre();
 }
 
 
@@ -321,12 +321,12 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
     EDA_RECT rect = GetTextBox();
 
     // Calculate the bounding box position relative to the parent:
-    wxPoint origin = GetParentPosition();
-    wxPoint pos = GetTextPos() - origin;
-    wxPoint begin = rect.GetOrigin() - origin;
-    wxPoint end = rect.GetEnd() - origin;
-    RotatePoint( &begin, pos, GetTextAngle() );
-    RotatePoint( &end, pos, GetTextAngle() );
+    VECTOR2I origin = GetParentPosition();
+    VECTOR2I pos = GetTextPos() - origin;
+    VECTOR2I begin = rect.GetOrigin() - origin;
+    VECTOR2I end = rect.GetEnd() - origin;
+    RotatePoint( begin, pos, GetTextAngle() );
+    RotatePoint( end, pos, GetTextAngle() );
 
     // Now, apply the symbol transform (mirror/rot)
     TRANSFORM transform;
@@ -359,7 +359,7 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
 
 bool SCH_FIELD::IsHorizJustifyFlipped() const
 {
-    wxPoint render_center = GetBoundingBox().Centre();
+    VECTOR2I render_center = GetBoundingBox().Centre();
     wxPoint pos = GetPosition();
 
     switch( GetHorizJustify() )
@@ -396,7 +396,7 @@ GR_TEXT_H_ALIGN_T SCH_FIELD::GetEffectiveHorizJustify() const
 
 bool SCH_FIELD::IsVertJustifyFlipped() const
 {
-    wxPoint render_center = GetBoundingBox().Centre();
+    VECTOR2I render_center = GetBoundingBox().Centre();
     wxPoint pos = GetPosition();
 
     switch( GetVertJustify() )
@@ -859,7 +859,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
      */
     GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_CENTER;
     GR_TEXT_V_ALIGN_T vjustify = GR_TEXT_V_ALIGN_CENTER;
-    wxPoint           textpos = GetBoundingBox().Centre();
+    VECTOR2I          textpos = GetBoundingBox().Centre();
 
     aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(),  hjustify, vjustify,
                     penWidth, IsItalic(), IsBold() );
@@ -891,14 +891,14 @@ wxPoint SCH_FIELD::GetPosition() const
     if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
     {
         SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
-        wxPoint     relativePos = GetTextPos() - parentSymbol->GetPosition();
+        VECTOR2I    relativePos = GetTextPos() - parentSymbol->GetPosition();
 
         relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos );
 
-        return relativePos + parentSymbol->GetPosition();
+        return (wxPoint)relativePos + parentSymbol->GetPosition();
     }
 
-    return GetTextPos();
+    return (wxPoint)GetTextPos();
 }
 
 
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index ff89831ac2..65c9accb65 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -196,7 +196,7 @@ public:
 
     bool IsReplaceable() const override;
 
-    wxPoint GetLibPosition() const { return EDA_TEXT::GetTextPos(); }
+    wxPoint GetLibPosition() const { return (wxPoint)EDA_TEXT::GetTextPos(); }
 
     wxPoint GetPosition() const override;
     void SetPosition( const wxPoint& aPosition ) override;
diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp
index 1032484957..57f951af82 100644
--- a/eeschema/sch_painter.cpp
+++ b/eeschema/sch_painter.cpp
@@ -416,7 +416,7 @@ float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows
 }
 
 
-static VECTOR2D mapCoords( const wxPoint& aCoord )
+static VECTOR2D mapCoords( const VECTOR2D& aCoord )
 {
     return VECTOR2D( aCoord.x, -aCoord.y );
 }
@@ -685,7 +685,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
     m_gal->SetFillColor( color );
 
     EDA_RECT bbox = aField->GetBoundingBox();
-    wxPoint  textpos = bbox.Centre();
+    VECTOR2I  textpos = bbox.Centre();
 
     if( drawingShadows && eeconfig()->m_Selection.text_as_box )
     {
@@ -1235,7 +1235,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
 
 // Draw the target (an open square) for a wire or label which has no connection or is
 // being moved.
-void SCH_PAINTER::drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor, int aWidth,
+void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
                                       bool aDrawingShadows, bool aBrightened )
 {
     wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
@@ -1706,7 +1706,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
         bbox.Offset( label->GetSchematicTextOffset( &m_schSettings ) );
     }
 
-    wxPoint  textpos = bbox.Centre();
+    VECTOR2I textpos = bbox.Centre();
 
     m_gal->SetIsStroke( true );
     m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
@@ -1767,7 +1767,7 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer )
     std::vector<wxPoint> pts;
     std::deque<VECTOR2D> pts2;
 
-    aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
+    aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() );
 
     for( const wxPoint& p : pts )
         pts2.emplace_back( VECTOR2D( p.x, p.y ) );
@@ -1841,7 +1841,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer )
     std::vector<wxPoint> pts;
     std::deque<VECTOR2D> pts2;
 
-    aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
+    aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint)aLabel->GetTextPos() );
 
     for( const wxPoint& p : pts )
         pts2.emplace_back( VECTOR2D( p.x, p.y ) );
@@ -1889,7 +1889,7 @@ void SCH_PAINTER::draw( const SCH_NETCLASS_FLAG *aLabel, int aLayer )
     std::vector<wxPoint> pts;
     std::deque<VECTOR2D> pts2;
 
-    aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
+    aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() );
 
     for( const wxPoint& p : pts )
         pts2.emplace_back( VECTOR2D( p.x, p.y ) );
@@ -1950,8 +1950,8 @@ void SCH_PAINTER::draw( const SCH_SHEET *aSheet, int aLayer )
             }
 
             int     width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
-            wxPoint initial_pos = sheetPin->GetTextPos();
-            wxPoint offset_pos = initial_pos;
+            VECTOR2I initial_pos = sheetPin->GetTextPos();
+            VECTOR2I offset_pos = initial_pos;
 
             // For aesthetic reasons, the SHEET_PIN is drawn with a small offset of width / 2
             switch( sheetPin->GetSide() )
diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h
index 11d806af25..464cc91b22 100644
--- a/eeschema/sch_painter.h
+++ b/eeschema/sch_painter.h
@@ -173,7 +173,7 @@ private:
 
     void drawPinDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor,
                                 bool aDrawingShadows, bool aBrightened );
-    void drawDanglingSymbol( const wxPoint& aPos, const COLOR4D& aColor, int aWidth,
+    void drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
                              bool aDrawingShadows, bool aBrightened );
 
     int internalPinDecoSize( const LIB_PIN &aPin );
diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
index 1f8380ebe5..78de7ba737 100644
--- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
+++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
@@ -217,7 +217,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
         // When exporting to pdf, CADSTAR applies a margin of 3% of the longest dimension (height
         // or width) to all 4 sides (top, bottom, left right). For the import, we are also rounding
         // the margin to the nearest grid, ensuring all items remain on the grid.
-        wxSize targetSheetSize = sheetBoundingBox.GetSize();
+        wxSize targetSheetSize = (wxSize)sheetBoundingBox.GetSize();
         int    longestSide = std::max( targetSheetSize.x, targetSheetSize.y );
         int    margin = ( (double) longestSide * 0.03 );
         margin = roundToNearestGrid( margin );
@@ -232,11 +232,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
         sheet->GetScreen()->SetPageSettings( pageInfo );
 
         wxSize  pageSizeIU = sheet->GetScreen()->GetPageSettings().GetSizeIU();
-        wxPoint sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
-        wxPoint itemsCentre = sheetBoundingBox.Centre();
+        VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
+        VECTOR2I itemsCentre = sheetBoundingBox.Centre();
 
         // round the translation to nearest point on the grid
-        wxPoint translation = sheetcentre - itemsCentre;
+        VECTOR2I translation = sheetcentre - itemsCentre;
         translation.x = roundToNearestGrid( translation.x );
         translation.y = roundToNearestGrid( translation.y );
 
@@ -248,7 +248,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
 
         for( SCH_ITEM* item : allItems )
         {
-            item->Move( translation );
+            item->Move( (wxPoint)translation );
             item->ClearFlags();
             sheet->GetScreen()->Update( item );
         }
@@ -1425,9 +1425,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
             for( size_t ii = 0; ii < strings.size(); ++ii )
             {
                 EDA_RECT bbox = libtext->GetTextBox( ii, true );
-                wxPoint  linePos = { bbox.GetLeft(), -bbox.GetBottom() };
+                VECTOR2I linePos = { bbox.GetLeft(), -bbox.GetBottom() };
 
-                RotatePoint( &linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
+                RotatePoint( linePos, libtext->GetTextPos(), -libtext->GetTextAngle() );
 
                 LIB_TEXT* line = static_cast<LIB_TEXT*>( libtext->Clone() );
                 line->SetText( strings[ii] );
diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp
index 6a5993c99a..b667ccff3b 100644
--- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp
+++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp
@@ -929,8 +929,8 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
 
     // Calculate the new sheet size.
     EDA_RECT sheetBoundingBox = getSheetBbox( m_currentSheet );
-    wxSize   targetSheetSize  = sheetBoundingBox.GetSize();
-    targetSheetSize.IncBy( Mils2iu( 1500 ), Mils2iu( 1500 ) );
+    VECTOR2I targetSheetSize = sheetBoundingBox.GetSize();
+    targetSheetSize += VECTOR2I( Mils2iu( 1500 ), Mils2iu( 1500 ) );
 
     // Get current Eeschema sheet size.
     wxSize    pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
@@ -947,11 +947,11 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
     m_currentSheet->GetScreen()->SetPageSettings( pageInfo );
 
     pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
-    wxPoint sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
-    wxPoint itemsCentre = sheetBoundingBox.Centre();
+    VECTOR2I sheetcentre( pageSizeIU.x / 2, pageSizeIU.y / 2 );
+    VECTOR2I itemsCentre = sheetBoundingBox.Centre();
 
     // round the translation to nearest 100mil to place it on the grid.
-    wxPoint translation = sheetcentre - itemsCentre;
+    VECTOR2I translation = sheetcentre - itemsCentre;
     translation.x       = translation.x - translation.x % Mils2iu( 100 );
     translation.y       = translation.y - translation.y % Mils2iu( 100 );
 
@@ -972,7 +972,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
 
     for( SCH_ITEM* item : allItems )
     {
-        item->SetPosition( item->GetPosition() + translation );
+        item->SetPosition( item->GetPosition() + (wxPoint)translation );
         item->ClearFlags();
         m_currentSheet->GetScreen()->Update( item );
 
@@ -1341,7 +1341,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
     for( const LIB_FIELD* field : partFields )
     {
         symbol->GetFieldById( field->GetId() )->ImportValues( *field );
-        symbol->GetFieldById( field->GetId() )->SetTextPos( symbol->GetPosition()
+        symbol->GetFieldById( field->GetId() )->SetTextPos( (VECTOR2I)symbol->GetPosition()
                                                             + field->GetTextPos() );
     }
 
diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h
index 9456d54faa..a34a717685 100644
--- a/eeschema/sch_screen.h
+++ b/eeschema/sch_screen.h
@@ -432,6 +432,12 @@ public:
         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 a label item located at \a aPosition.
      *
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index ecd9ade1be..5e379e01d4 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -640,7 +640,7 @@ const EDA_RECT SCH_SHEET::GetBoundingBox() const
 wxPoint SCH_SHEET::GetRotationCenter() const
 {
     EDA_RECT box( m_pos, m_size );
-    return box.GetCenter();
+    return (wxPoint)box.GetCenter();
 }
 
 
@@ -803,7 +803,7 @@ void SCH_SHEET::Rotate( const wxPoint& aCenter )
         // Move the fields to the new position because the parent itself has moved.
         for( SCH_FIELD& field : m_fields )
         {
-            wxPoint pos = field.GetTextPos();
+            VECTOR2I pos = field.GetTextPos();
             pos.x -= prev.x - m_pos.x;
             pos.y -= prev.y - m_pos.y;
             field.SetTextPos( pos );
@@ -825,7 +825,7 @@ void SCH_SHEET::MirrorVertically( int aCenter )
 
     for( SCH_FIELD& field : m_fields )
     {
-        wxPoint pos = field.GetTextPos();
+        VECTOR2I pos = field.GetTextPos();
         pos.y -= dy;
         field.SetTextPos( pos );
     }
@@ -845,7 +845,7 @@ void SCH_SHEET::MirrorHorizontally( int aCenter )
 
     for( SCH_FIELD& field : m_fields )
     {
-        wxPoint pos = field.GetTextPos();
+        VECTOR2I pos = field.GetTextPos();
         pos.x -= dx;
         field.SetTextPos( pos );
     }
diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp
index 9baa3d0f4f..f340e1b937 100644
--- a/eeschema/sch_sheet_pin.cpp
+++ b/eeschema/sch_sheet_pin.cpp
@@ -249,13 +249,13 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
 
 void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
 {
-    wxPoint pt = GetTextPos();
-    wxPoint delta = pt - aCenter;
+    VECTOR2I pt = GetTextPos();
+    VECTOR2I delta = pt - aCenter;
 
-    RotatePoint( &pt, aCenter, 900 );
+    RotatePoint( pt, aCenter, 900 );
 
     SHEET_SIDE oldSide = GetSide();
-    ConstrainOnEdge( pt );
+    ConstrainOnEdge( (wxPoint)pt );
 
     // If the new side is the same as the old side, instead mirror across the center of that side.
     if( GetSide() == oldSide )
@@ -323,7 +323,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
 
 void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
 {
-    DANGLING_END_ITEM item( SHEET_LABEL_END, this, GetTextPos() );
+    DANGLING_END_ITEM item( SHEET_LABEL_END, this, (wxPoint)GetTextPos() );
     aItemList.push_back( item );
 }
 
diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp
index 17bb31d4c8..4d63904406 100644
--- a/eeschema/sch_symbol.cpp
+++ b/eeschema/sch_symbol.cpp
@@ -793,7 +793,7 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b
             if( aUpdateStyle )
             {
                 schField->ImportValues( *libField );
-                schField->SetTextPos( m_pos + libField->GetTextPos() );
+                schField->SetTextPos( (VECTOR2I)m_pos + libField->GetTextPos() );
             }
 
             if( id == REFERENCE_FIELD && aPath )
@@ -1459,7 +1459,7 @@ void SCH_SYMBOL::MirrorHorizontally( int aCenter )
     for( SCH_FIELD& field : m_fields )
     {
         // Move the fields to the new position because the symbol itself has moved.
-        wxPoint pos = field.GetTextPos();
+        VECTOR2I pos = field.GetTextPos();
         pos.x -= dx;
         field.SetTextPos( pos );
     }
@@ -1477,7 +1477,7 @@ void SCH_SYMBOL::MirrorVertically( int aCenter )
     for( SCH_FIELD& field : m_fields )
     {
         // Move the fields to the new position because the symbol itself has moved.
-        wxPoint pos = field.GetTextPos();
+        VECTOR2I pos = field.GetTextPos();
         pos.y -= dy;
         field.SetTextPos( pos );
     }
@@ -1495,7 +1495,7 @@ void SCH_SYMBOL::Rotate( const wxPoint& aCenter )
     for( SCH_FIELD& field : m_fields )
     {
         // Move the fields to the new position because the symbol itself has moved.
-        wxPoint pos = field.GetTextPos();
+        VECTOR2I pos = field.GetTextPos();
         pos.x -= prev.x - m_pos.x;
         pos.y -= prev.y - m_pos.y;
         field.SetTextPos( pos );
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index f1b6d8dbfa..e85d691c9e 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -283,9 +283,9 @@ void SCH_TEXT::MirrorVertically( int aCenter )
 
 void SCH_TEXT::Rotate( const wxPoint& aCenter )
 {
-    wxPoint pt = GetTextPos();
-    RotatePoint( &pt, aCenter, 900 );
-    wxPoint offset = pt - GetTextPos();
+    VECTOR2I pt = GetTextPos();
+    RotatePoint( pt, aCenter, 900 );
+    VECTOR2I offset = pt - GetTextPos();
 
     Rotate90( false );
 
@@ -419,11 +419,11 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const
 
     if( GetTextAngle() != EDA_ANGLE::ANGLE_0 ) // Rotate rect.
     {
-        wxPoint pos = rect.GetOrigin();
-        wxPoint end = rect.GetEnd();
+        VECTOR2I pos = rect.GetOrigin();
+        VECTOR2I end = rect.GetEnd();
 
-        RotatePoint( &pos, GetTextPos(), GetTextAngle() );
-        RotatePoint( &end, GetTextPos(), GetTextAngle() );
+        RotatePoint( pos, GetTextPos(), GetTextAngle() );
+        RotatePoint( end, GetTextPos(), GetTextAngle() );
 
         rect.SetOrigin( pos );
         rect.SetEnd( end );
@@ -728,9 +728,9 @@ void SCH_LABEL_BASE::SwapData( SCH_ITEM* aItem )
 
 void SCH_LABEL_BASE::Rotate( const wxPoint& aCenter )
 {
-    wxPoint pt = GetTextPos();
-    RotatePoint( &pt, aCenter, 900 );
-    wxPoint offset = pt - GetTextPos();
+    VECTOR2I pt = GetTextPos();
+    RotatePoint( pt, aCenter, 900 );
+    VECTOR2I offset = pt - GetTextPos();
 
     Rotate90( false );
 
@@ -786,8 +786,8 @@ void SCH_LABEL_BASE::Rotate90( bool aClockwise )
                 field.SetTextAngle( EDA_ANGLE::VERTICAL );
             }
 
-            wxPoint pos = field.GetTextPos();
-            RotatePoint( &pos, GetPosition(), aClockwise ? -900 : 900 );
+            VECTOR2I pos = field.GetTextPos();
+            RotatePoint( pos, GetPosition(), aClockwise ? -900 : 900 );
             field.SetTextPos( pos );
         }
     }
@@ -967,14 +967,14 @@ SEARCH_RESULT SCH_LABEL_BASE::Visit( INSPECTOR aInspector, void* testData,
 
 void SCH_LABEL_BASE::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
 {
-    DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
+    DANGLING_END_ITEM item( LABEL_END, this, (wxPoint)GetTextPos() );
     aItemList.push_back( item );
 }
 
 
 std::vector<wxPoint> SCH_LABEL_BASE::GetConnectionPoints() const
 {
-    return { GetTextPos() };
+    return { (wxPoint)GetTextPos() };
 }
 
 
@@ -1013,7 +1013,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBodyBoundingBox() const
     EDA_RECT             box;
     std::vector<wxPoint> pts;
 
-    CreateGraphicShape( nullptr, pts, GetTextPos() );
+    CreateGraphicShape( nullptr, pts, (wxPoint)GetTextPos() );
 
     for( const wxPoint& pt : pts )
         box.Merge( pt );
@@ -1241,12 +1241,12 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
     penWidth = std::max( penWidth, settings->GetMinPenWidth() );
     aPlotter->SetCurrentLineWidth( penWidth );
 
-    wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
+    VECTOR2I textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
 
     aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
                     GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
 
-    CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
+    CreateGraphicShape( aPlotter->RenderSettings(), s_poly, (wxPoint)GetTextPos() );
 
     if( s_poly.size() )
         aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
@@ -1266,7 +1266,7 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOf
 
     EDA_TEXT::Print( aSettings, text_offset, color );
 
-    CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
+    CreateGraphicShape( aSettings, s_poly, (wxPoint)GetTextPos() + aOffset );
 
     if( !s_poly.empty() )
         GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
@@ -1294,11 +1294,11 @@ const EDA_RECT SCH_LABEL::GetBodyBoundingBox() const
     if( GetTextAngle() != EDA_ANGLE::ANGLE_0 )
     {
         // Rotate rect
-        wxPoint pos = rect.GetOrigin();
-        wxPoint end = rect.GetEnd();
+        VECTOR2I pos = rect.GetOrigin();
+        VECTOR2I end = rect.GetEnd();
 
-        RotatePoint( &pos, GetTextPos(), GetTextAngle() );
-        RotatePoint( &end, GetTextPos(), GetTextAngle() );
+        RotatePoint( pos, GetTextPos(), GetTextAngle() );
+        RotatePoint( end, GetTextPos(), GetTextAngle() );
 
         rect.SetOrigin( pos );
         rect.SetEnd( end );
@@ -1552,8 +1552,8 @@ void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
                 field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
         }
 
-        wxPoint pos = field.GetTextPos();
-        wxPoint delta = GetPosition() - pos;
+        VECTOR2I pos = field.GetTextPos();
+        VECTOR2I delta = (VECTOR2I)GetPosition() - pos;
 
         if( aLeftRight )
             pos.x = GetPosition().x + delta.x;
@@ -1567,7 +1567,7 @@ void SCH_GLOBALLABEL::MirrorSpinStyle( bool aLeftRight )
 
 void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
 {
-    wxPoint old_pos = GetPosition();
+    VECTOR2I old_pos = GetPosition();
     SCH_TEXT::MirrorHorizontally( aCenter );
 
     for( SCH_FIELD& field : m_fields )
@@ -1577,27 +1577,27 @@ void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
         else
            field.SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
 
-        wxPoint pos = field.GetTextPos();
-        wxPoint delta = old_pos - pos;
+        VECTOR2I pos = field.GetTextPos();
+        VECTOR2I delta = old_pos - pos;
         pos.x = GetPosition().x + delta.x;
 
-        field.SetPosition( pos );
+        field.SetPosition( (wxPoint)pos );
     }
 }
 
 
 void SCH_GLOBALLABEL::MirrorVertically( int aCenter )
 {
-    wxPoint old_pos = GetPosition();
+    VECTOR2I old_pos = GetPosition();
     SCH_TEXT::MirrorVertically( aCenter );
 
     for( SCH_FIELD& field : m_fields )
     {
-        wxPoint pos = field.GetTextPos();
-        wxPoint delta = old_pos - pos;
+        VECTOR2I pos = field.GetTextPos();
+        VECTOR2I delta = old_pos - pos;
         pos.y = GetPosition().y + delta.y;
 
-        field.SetPosition( pos );
+        field.SetPosition( (wxPoint)pos );
     }
 }
 
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index a4ff049aa9..10b611412d 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -203,7 +203,7 @@ public:
 
     BITMAPS GetMenuImage() const override;
 
-    wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
+    wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); }
     void SetPosition( const wxPoint& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); }
 
     bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp
index e58a8a8e8c..47dd9419ec 100644
--- a/eeschema/tools/sch_edit_tool.cpp
+++ b/eeschema/tools/sch_edit_tool.cpp
@@ -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( sheet->GetBodyBoundingBox().GetCenter() );
+                pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() );
 
             break;
         }
@@ -628,7 +628,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
                     SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
                     SCH_SHEET*     sheet = pin->GetParent();
 
-                    pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
+                    pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() );
                 }
             }
             else if( item->Type() == SCH_FIELD_T )
@@ -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( item->GetBoundingBox().Centre() );
+            mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)item->GetBoundingBox().Centre() );
 
             if( vertical )
                 item->MirrorVertically( mirrorPoint.y );
diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index d394c94fa9..afbe783931 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -512,7 +512,7 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
     if( item )
     {
         m_selectionTool->AddItemToSel( item );
-        m_frame->FocusOnLocation( item->GetBoundingBox().GetCenter() );
+        m_frame->FocusOnLocation( (wxPoint)item->GetBoundingBox().GetCenter() );
         m_frame->GetCanvas()->Refresh();
     }
     else
diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp
index 0270991199..2282c7b75d 100644
--- a/eeschema/tools/sch_move_tool.cpp
+++ b/eeschema/tools/sch_move_tool.cpp
@@ -659,7 +659,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const wxPoin
                 SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
                 bool      oneEndFixed = !line->HasFlag( STARTPOINT ) || !line->HasFlag( ENDPOINT );
 
-                if( line->HitTest( label->GetTextPos(), 1 ) )
+                if( line->HitTest( (wxPoint)label->GetTextPos(), 1 ) )
                 {
                     label->SetFlags( TEMP_SELECTED );
                     aList.push_back( label );
diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp
index 713f124ed0..389fe9908a 100644
--- a/eeschema/tools/symbol_editor_control.cpp
+++ b/eeschema/tools/symbol_editor_control.cpp
@@ -442,7 +442,8 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
         PAGE_INFO pageSave = editFrame->GetScreen()->GetPageSettings();
         PAGE_INFO pageTemp = pageSave;
 
-        wxSize symbolSize = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
+        VECTOR2I symbolSize =
+                symbol->GetUnitBoundingBox( editFrame->GetUnit(),
                                                         editFrame->GetConvert() ).GetSize();
 
         // Add a small margin to the plot bounding box
diff --git a/eeschema/transform.cpp b/eeschema/transform.cpp
index f114a92ca1..1008b7e0f0 100644
--- a/eeschema/transform.cpp
+++ b/eeschema/transform.cpp
@@ -45,6 +45,13 @@ wxPoint TRANSFORM::TransformCoordinate( const wxPoint& aPoint ) const
                     ( x2 * aPoint.x ) + ( y2 * aPoint.y ) );
 }
 
+
+VECTOR2I TRANSFORM::TransformCoordinate( const VECTOR2I& aPoint ) const
+{
+    return VECTOR2I( ( x1 * aPoint.x ) + ( y1 * aPoint.y ), ( x2 * aPoint.x ) + ( y2 * aPoint.y ) );
+}
+
+
 EDA_RECT TRANSFORM::TransformCoordinate( const EDA_RECT& aRect ) const
 {
     EDA_RECT rect;
diff --git a/eeschema/transform.h b/eeschema/transform.h
index f6f1522f5a..b49c30274c 100644
--- a/eeschema/transform.h
+++ b/eeschema/transform.h
@@ -71,6 +71,16 @@ public:
     */
     wxPoint TransformCoordinate( const wxPoint& aPoint ) const;
 
+   /**
+    * Calculate a new coordinate according to the mirror/rotation transform.
+    * Useful to calculate actual coordinates of a point
+    * from coordinates relative to a symbol.
+    * which are given for a non rotated, non mirrored item
+    * @param aPoint = The position to transform
+    * @return The transformed coordinate.
+    */
+    VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const;
+
    /**
     * Calculate a new rect according to the mirror/rotation transform.
     * Useful to calculate actual coordinates of a point
diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp
index cbd7257278..a9533b8ca7 100644
--- a/gerbview/gerber_draw_item.cpp
+++ b/gerbview/gerber_draw_item.cpp
@@ -408,8 +408,8 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
     }
 
     // calculate the corners coordinates in current Gerber axis orientations
-    wxPoint org = GetABPosition( bbox.GetOrigin() );
-    wxPoint end = GetABPosition( bbox.GetEnd() );
+    VECTOR2I org = GetABPosition( bbox.GetOrigin() );
+    VECTOR2I end = GetABPosition( bbox.GetEnd() );
 
     // Set the corners position:
     bbox.SetOrigin( org );
@@ -827,7 +827,7 @@ bool GERBER_DRAW_ITEM::HitTest( const wxPoint& aRefPos, int aAccuracy ) const
 
         // This is similar to a segment with thickness = min( m_Size.x, m_Size.y )
         int radius = std::min( m_Size.x, m_Size.y )/2;
-        wxPoint start, end;
+        VECTOR2I start, end;
 
         if( m_Size.x > m_Size.y )   // Horizontal oval
         {
diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h
index 672994ae51..1e7addc9e8 100644
--- a/gerbview/gerbview_frame.h
+++ b/gerbview/gerbview_frame.h
@@ -422,8 +422,8 @@ public:
     const PAGE_INFO& GetPageSettings() const override;
     const wxSize GetPageSizeIU() const override;
 
-    const wxPoint& GetGridOrigin() const override { return m_grid_origin; }
-    void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; }
+    const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; }
+    void            SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; }
 
     const TITLE_BLOCK&  GetTitleBlock() const override;
     void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
@@ -520,7 +520,7 @@ private:
 
     GBR_LAYOUT*         m_gerberLayout;
     int                 m_activeLayer;
-    wxPoint             m_grid_origin;
+    VECTOR2I            m_grid_origin;
     PAGE_INFO           m_paper;            // used only to show paper limits to screen
     wxStaticText*       m_cmpText;          // a message on the auxiliary toolbar,
                                             // relative to the m_SelComponentBox
diff --git a/include/board_design_settings.h b/include/board_design_settings.h
index ebc70eb526..e9f0a90af5 100644
--- a/include/board_design_settings.h
+++ b/include/board_design_settings.h
@@ -645,11 +645,11 @@ public:
 
     int GetLayerClass( PCB_LAYER_ID aLayer ) const;
 
-    void SetAuxOrigin( const wxPoint& aOrigin ) { m_auxOrigin = aOrigin; }
-    const wxPoint& GetAuxOrigin() { return m_auxOrigin; }
+    void            SetAuxOrigin( const VECTOR2I& aOrigin ) { m_auxOrigin = aOrigin; }
+    const VECTOR2I& GetAuxOrigin() { return m_auxOrigin; }
 
-    void SetGridOrigin( const wxPoint& aOrigin ) { m_gridOrigin = aOrigin; }
-    const wxPoint& GetGridOrigin() { return m_gridOrigin; }
+    void            SetGridOrigin( const VECTOR2I& aOrigin ) { m_gridOrigin = aOrigin; }
+    const VECTOR2I& GetGridOrigin() { return m_gridOrigin; }
 
 private:
     void initFromOther( const BOARD_DESIGN_SETTINGS& aOther );
@@ -756,8 +756,8 @@ public:
     bool       m_UseHeightForLengthCalcs;
 
 private:
-    wxPoint    m_auxOrigin;                 ///< origin for plot exports
-    wxPoint    m_gridOrigin;                ///< origin for grid offsets
+    VECTOR2I m_auxOrigin;  ///< origin for plot exports
+    VECTOR2I m_gridOrigin; ///< origin for grid offsets
 
     // Indices into the trackWidth, viaSizes and diffPairDimensions lists.
     // The 0 index is always the current netclass value(s)
diff --git a/include/board_item.h b/include/board_item.h
index 707e2d0666..6d533e8cbc 100644
--- a/include/board_item.h
+++ b/include/board_item.h
@@ -81,7 +81,7 @@ public:
      */
     virtual wxPoint GetCenter() const
     {
-        return GetBoundingBox().GetCenter();
+        return (wxPoint)GetBoundingBox().GetCenter();
     }
 
     void SetX( int aX )
diff --git a/include/drawing_sheet/ds_draw_item.h b/include/drawing_sheet/ds_draw_item.h
index 7f4d209839..bc6e80aedd 100644
--- a/include/drawing_sheet/ds_draw_item.h
+++ b/include/drawing_sheet/ds_draw_item.h
@@ -316,7 +316,7 @@ public:
 
     void SetTextAngle( double aAngle ) override;
 
-    wxPoint GetPosition() const override { return GetTextPos(); }
+    wxPoint GetPosition() const override { return (wxPoint)GetTextPos(); }
     void SetPosition( const wxPoint& aPos ) override { SetTextPos( aPos ); }
 
     const EDA_RECT GetBoundingBox() const override;
diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h
index 9eb4846dd8..084066301a 100644
--- a/include/eda_draw_frame.h
+++ b/include/eda_draw_frame.h
@@ -135,8 +135,8 @@ public:
      * This is treated as a relative offset and snapping will occur at multiples of the grid
      * size relative to this point.
      */
-    virtual const wxPoint& GetGridOrigin() const = 0;
-    virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
+    virtual const VECTOR2I& GetGridOrigin() const = 0;
+    virtual void            SetGridOrigin( const VECTOR2I& aPosition ) = 0;
 
     /**
      * Return the nearest \a aGridSize location to \a aPosition.
diff --git a/include/eda_rect.h b/include/eda_rect.h
index d69b937072..45e164854e 100644
--- a/include/eda_rect.h
+++ b/include/eda_rect.h
@@ -44,14 +44,14 @@ class EDA_RECT
 public:
     EDA_RECT() : m_init( false ) { };
 
-    EDA_RECT( const wxPoint& aPos, const wxSize& aSize ) :
+    EDA_RECT( const VECTOR2I& aPos, const VECTOR2I& aSize ) :
             m_pos( aPos ),
             m_size( aSize ),
             m_init( true )
     { }
 
-    EDA_RECT( const VECTOR2I& aPos, const VECTOR2I& aSize ) :
-            EDA_RECT( wxPoint( aPos.x, aPos.y ), wxSize( aSize.x, aSize.y ) )
+    EDA_RECT( const wxPoint& aPos, const wxSize& aSize ) :
+            EDA_RECT( VECTOR2I( aPos.x, aPos.y ), VECTOR2I( aSize.x, aSize.y ) )
     { }
 
     template<class T>
@@ -65,9 +65,9 @@ public:
 
     virtual ~EDA_RECT() { };
 
-    wxPoint Centre() const
+    VECTOR2I Centre() const
     {
-        return wxPoint( m_pos.x + ( m_size.x >> 1 ), m_pos.y + ( m_size.y >> 1 ) );
+        return VECTOR2I( m_pos.x + ( m_size.x >> 1 ), m_pos.y + ( m_size.y >> 1 ) );
     }
 
     /**
@@ -75,7 +75,7 @@ public:
      *
      * @param aMoveVector A wxPoint that is the value to move this rectangle.
      */
-    void Move( const wxPoint& aMoveVector );
+    void Move( const VECTOR2I& aMoveVector );
 
     /**
      * Ensures that the height ant width are positive.
@@ -86,14 +86,14 @@ public:
      * @param aPoint the wxPoint to test.
      * @return true if aPoint is inside the boundary box. A point on a edge is seen as inside.
      */
-    bool Contains( const wxPoint& aPoint ) const;
+    bool Contains( const VECTOR2I& aPoint ) const;
 
     /**
      * @param x the x coordinate of the point to test.
      * @param y the x coordinate of the point to test.
      * @return true if point is inside the boundary box. A point on a edge is seen as inside
      */
-    bool Contains( int x, int y ) const { return Contains( wxPoint( x, y ) ); }
+    bool Contains( int x, int y ) const { return Contains( VECTOR2I( x, y ) ); }
 
     /**
      * @param aRect the EDA_RECT to test.
@@ -101,7 +101,7 @@ public:
      */
     bool Contains( const EDA_RECT& aRect ) const;
 
-    const wxSize GetSize() const { return m_size; }
+    const VECTOR2I GetSize() const { return m_size; }
 
     /**
      * @return the max size dimension.
@@ -111,12 +111,12 @@ public:
     int GetX() const { return m_pos.x; }
     int GetY() const { return m_pos.y; }
 
-    const wxPoint GetOrigin() const { return m_pos; }
-    const wxPoint GetPosition() const { return m_pos; }
-    const wxPoint GetEnd() const { return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y ); }
-    const wxPoint GetCenter() const
+    const VECTOR2I GetOrigin() const { return m_pos; }
+    const VECTOR2I GetPosition() const { return m_pos; }
+    const VECTOR2I GetEnd() const { return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y ); }
+    const VECTOR2I GetCenter() const
     {
-        return wxPoint( m_pos.x + ( m_size.x / 2 ), m_pos.y + ( m_size.y / 2 ) );
+        return VECTOR2I( m_pos.x + ( m_size.x / 2 ), m_pos.y + ( m_size.y / 2 ) );
     }
 
     int GetWidth() const { return m_size.x; }
@@ -131,7 +131,7 @@ public:
         return m_init;
     }
 
-    void SetOrigin( const wxPoint& pos )
+    void SetOrigin( const VECTOR2I& pos )
     {
         m_pos = pos;
         m_init = true;
@@ -144,7 +144,7 @@ public:
         m_init = true;
     }
 
-    void SetSize( const wxSize& size )
+    void SetSize( const VECTOR2I& size )
     {
         m_size = size;
         m_init = true;
@@ -163,7 +163,7 @@ public:
         m_pos.y += dy;
     }
 
-    void Offset( const wxPoint& offset )
+    void Offset( const VECTOR2I& offset )
     {
         m_pos += offset;
     }
@@ -194,11 +194,11 @@ public:
 
     void SetEnd( int x, int y )
     {
-        SetEnd( wxPoint( x, y ) );
+        SetEnd( VECTOR2I( x, y ) );
         m_init = true;
     }
 
-    void SetEnd( const wxPoint& pos )
+    void SetEnd( const VECTOR2I& pos )
     {
         m_size.x = pos.x - m_pos.x;
         m_size.y = pos.y - m_pos.y;
@@ -240,7 +240,7 @@ public:
      * @return true if the argument segment intersects this rectangle.
      * (i.e. if the segment and rectangle have at least a common point)
      */
-    bool Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const;
+    bool Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2 ) const;
 
     /**
      * Test for intersection between a segment and this rectangle, returning the intersections.
@@ -251,8 +251,8 @@ public:
      * @param aIntersection2 will be filled with the second intersection point, if any.
      * @return true if the segment intersects the rect.
      */
-    bool Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2,
-                     wxPoint* aIntersection1, wxPoint* aIntersection2 ) const;
+    bool Intersects( const VECTOR2I& aPoint1, const VECTOR2I& aPoint2, VECTOR2I* aIntersection1,
+                     VECTOR2I* aIntersection2 ) const;
 
     /**
      * Return the point in this rect that is closest to the provided point
@@ -290,7 +290,7 @@ public:
     {
         EDA_RECT rect( m_pos, m_size );
         rect.Normalize();
-        return wxRect( rect.m_pos, rect.m_size );
+        return wxRect( (wxPoint)rect.m_pos, (wxSize)rect.m_size );
     }
 
     /**
@@ -355,12 +355,12 @@ public:
      * @param aRotCenter the rotation point.
      * @return the bounding box of this, after rotation.
      */
-    const EDA_RECT GetBoundingBoxRotated( const wxPoint& aRotCenter, double aAngle ) const;
+    const EDA_RECT GetBoundingBoxRotated( const VECTOR2I& aRotCenter, double aAngle ) const;
 
 private:
-    wxPoint m_pos;      // Rectangle Origin
-    wxSize  m_size;     // Rectangle Size
-    bool    m_init;     // Is the rectangle initialized
+    VECTOR2I m_pos;      // Rectangle Origin
+    VECTOR2I m_size;     // Rectangle Size
+    bool     m_init;     // Is the rectangle initialized
 };
 
 
diff --git a/include/eda_text.h b/include/eda_text.h
index 2c3bfc151d..dbc32beaff 100644
--- a/include/eda_text.h
+++ b/include/eda_text.h
@@ -224,8 +224,8 @@ public:
     void SetTextHeight( int aHeight )           { m_attributes.m_Size.y = aHeight; }
     int GetTextHeight() const                   { return m_attributes.m_Size.y; }
 
-    void SetTextPos( const wxPoint& aPoint )    { m_pos = aPoint; }
-    const wxPoint& GetTextPos() const           { return m_pos; }
+    void SetTextPos( const VECTOR2I& aPoint )   { m_pos = aPoint; }
+    const VECTOR2I& GetTextPos() const          { return m_pos; }
 
     void SetTextX( int aX )                     { m_pos.x = aX; }
     void SetTextY( int aY )                     { m_pos.y = aY; }
@@ -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 GetTextPos(); }
+    virtual wxPoint GetDrawPos() const                      { return (wxPoint)GetTextPos(); }
     virtual GR_TEXT_H_ALIGN_T GetDrawHorizJustify() const   { return GetHorizJustify(); };
     virtual GR_TEXT_V_ALIGN_T GetDrawVertJustify() const    { return GetVertJustify(); };
 
@@ -364,16 +364,16 @@ private:
      * @param aText the single line of text to draw.
      * @param aPos the position of this line ).
      */
-    void printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
+    void printOneLineOfText( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
                              const COLOR4D& aColor, OUTLINE_MODE aFillMode, const wxString& aText,
-                             const wxPoint& aPos );
+                             const VECTOR2I& aPos );
 
     wxString        m_text;
     wxString        m_shown_text;           // Cache of unescaped text for efficient access
     bool            m_shown_text_has_text_var_refs;
 
     TEXT_ATTRIBUTES m_attributes;
-    wxPoint         m_pos;
+    VECTOR2I        m_pos;
 };
 
 
diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h
index bba60837d0..27118b508b 100644
--- a/include/pcb_base_frame.h
+++ b/include/pcb_base_frame.h
@@ -136,12 +136,12 @@ public:
     const PAGE_INFO& GetPageSettings() const override;
     const wxSize GetPageSizeIU() const override;
 
-    const wxPoint& GetGridOrigin() const override;
-    void SetGridOrigin( const wxPoint& aPoint ) override;
+    const VECTOR2I& GetGridOrigin() const override;
+    void            SetGridOrigin( const VECTOR2I& aPoint ) override;
 
-    const wxPoint& GetAuxOrigin() const;
+    const VECTOR2I& GetAuxOrigin() const;
 
-    const wxPoint GetUserOrigin() const;
+    const VECTOR2I GetUserOrigin() const;
 
     /**
      * Return a reference to the default ORIGIN_TRANSFORMS object
diff --git a/libs/kimath/include/math/vector2d.h b/libs/kimath/include/math/vector2d.h
index 2a2de73a5c..22d2427a5a 100644
--- a/libs/kimath/include/math/vector2d.h
+++ b/libs/kimath/include/math/vector2d.h
@@ -127,6 +127,16 @@ public:
         return wxPoint( x, y );
     }
 
+    /**
+     * Implement the cast to wxPoint.
+     *
+     * @return the vector cast to wxPoint.
+     */
+    explicit operator wxSize() const
+    {
+        return wxSize( x, y );
+    }
+
     // virtual ~VECTOR2();
 
     /**
diff --git a/libs/kimath/include/trigo.h b/libs/kimath/include/trigo.h
index 091db8dc99..b3ddb4aa9f 100644
--- a/libs/kimath/include/trigo.h
+++ b/libs/kimath/include/trigo.h
@@ -55,9 +55,9 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
  * @return bool - true if the two segments defined by four points intersect.
  * (i.e. if the 2 segments have at least a common point)
  */
-bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
-                               const wxPoint& a_p1_l2, const wxPoint& a_p2_l2,
-                               wxPoint* aIntersectionPoint = nullptr );
+bool SegmentIntersectsSegment( const VECTOR2I& a_p1_l1, const VECTOR2I& a_p2_l1,
+                               const VECTOR2I& a_p1_l2, const VECTOR2I& a_p2_l2,
+                               VECTOR2I* aIntersectionPoint = nullptr );
 
 /*
  * Calculate the new point of coord coord pX, pY,
@@ -94,8 +94,18 @@ inline void RotatePoint( wxPoint* point, EDA_ANGLE angle )
     RotatePoint( &point->x, &point->y, angle.AsTenthsOfADegree() );
 }
 
+inline void RotatePoint( VECTOR2I& point, EDA_ANGLE angle )
+{
+    RotatePoint( &point.x, &point.y, angle.AsTenthsOfADegree() );
+}
+
 void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, double angle );
 
+inline void RotatePoint( VECTOR2I& point, const VECTOR2I& centre, EDA_ANGLE angle )
+{
+    RotatePoint( point, centre, angle.AsTenthsOfADegree() );
+}
+
 /*
  * Calculate the new coord point point for a center rotation center and angle in (1/10 degree).
  */
@@ -226,7 +236,7 @@ inline double CrossProduct( const wxPoint& vectorA, const wxPoint& vectorB )
  * @param aEnd is the second end-point of the line segment
  * @param aDist = maximum distance for hit
 */
-bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd,
+bool TestSegmentHit( const VECTOR2I& aRefPoint, const VECTOR2I& aStart, const VECTOR2I& aEnd,
                      int aDist );
 
 /**
diff --git a/libs/kimath/src/trigo.cpp b/libs/kimath/src/trigo.cpp
index 31043dfc9b..7b9a825460 100644
--- a/libs/kimath/src/trigo.cpp
+++ b/libs/kimath/src/trigo.cpp
@@ -58,9 +58,9 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
 
 
 // Returns true if the segment 1 intersected the segment 2.
-bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
-                               const wxPoint& a_p1_l2, const wxPoint& a_p2_l2,
-                               wxPoint* aIntersectionPoint )
+bool SegmentIntersectsSegment( const VECTOR2I& a_p1_l1, const VECTOR2I& a_p2_l1,
+                               const VECTOR2I& a_p1_l2, const VECTOR2I& a_p2_l2,
+                               VECTOR2I* aIntersectionPoint )
 {
 
     //We are forced to use 64bit ints because the internal units can overflow 32bit ints when
@@ -126,14 +126,14 @@ bool SegmentIntersectsSegment( const wxPoint& a_p1_l1, const wxPoint& a_p2_l1,
 }
 
 
-bool TestSegmentHit( const wxPoint& aRefPoint, const wxPoint& aStart, const wxPoint& aEnd,
+bool TestSegmentHit( const VECTOR2I& aRefPoint, const VECTOR2I& aStart, const VECTOR2I& aEnd,
                      int aDist )
 {
     int xmin = aStart.x;
     int xmax = aEnd.x;
     int ymin = aStart.y;
     int ymax = aEnd.y;
-    wxPoint delta = aStart - aRefPoint;
+    VECTOR2I delta = aStart - aRefPoint;
 
     if( xmax < xmin )
         std::swap( xmax, xmin );
diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h
index 9b2eecb37e..aa3e467b03 100644
--- a/pagelayout_editor/pl_editor_frame.h
+++ b/pagelayout_editor/pl_editor_frame.h
@@ -107,8 +107,8 @@ public:
     PL_DRAW_PANEL_GAL* GetCanvas() const override;
     SELECTION& GetCurrentSelection() override;
 
-    const wxPoint& GetGridOrigin() const override { return m_grid_origin; }
-    void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; }
+    const VECTOR2I& GetGridOrigin() const override { return m_grid_origin; }
+    void            SetGridOrigin( const VECTOR2I& aPoint ) override { m_grid_origin = aPoint; }
 
     /**
      * Calculate the position (in page, in iu) of the corner used as coordinate origin
@@ -284,7 +284,7 @@ private:
     wxChoice*   m_pageSelectBox;        // The page number sel'ector (page 1 or other pages
                                         // useful when there are some items which are
                                         // only on page 1, not on page 1
-    wxPoint     m_grid_origin;
+    VECTOR2I m_grid_origin;
 };
 
 #endif /* _PL_EDITOR_FRAME_H */
diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp
index 2f1a288ac0..38791bda18 100644
--- a/pcbnew/autorouter/ar_autoplacer.cpp
+++ b/pcbnew/autorouter/ar_autoplacer.cpp
@@ -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( fpBBox.GetOrigin(), fpBBox.GetEnd(), layerMask );
+    addFpBody( (wxPoint)fpBBox.GetOrigin(), (wxPoint)fpBBox.GetEnd(), layerMask );
 
     // Trace pads + clearance areas.
     for( PAD* pad : aFootprint->Pads() )
@@ -438,8 +438,8 @@ int AR_AUTOPLACER::testRectangle( const EDA_RECT& aRect, int side )
 
     rect.Inflate( m_matrix.m_GridRouting / 2 );
 
-    wxPoint start   = rect.GetOrigin();
-    wxPoint end     = rect.GetEnd();
+    VECTOR2I start = rect.GetOrigin();
+    VECTOR2I end     = rect.GetEnd();
 
     start   -= m_matrix.m_BrdBox.GetOrigin();
     end     -= m_matrix.m_BrdBox.GetOrigin();
@@ -487,8 +487,8 @@ int AR_AUTOPLACER::testRectangle( const EDA_RECT& aRect, int side )
 
 unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int side )
 {
-    wxPoint start   = aRect.GetOrigin();
-    wxPoint end     = aRect.GetEnd();
+    VECTOR2I start = aRect.GetOrigin();
+    VECTOR2I end = aRect.GetEnd();
 
     start   -= m_matrix.m_BrdBox.GetOrigin();
     end     -= m_matrix.m_BrdBox.GetOrigin();
@@ -575,7 +575,7 @@ int AR_AUTOPLACER::testFootprintOnBoard( FOOTPRINT* aFootprint, bool TstOtherSid
 int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
 {
     int     error = 1;
-    wxPoint lastPosOK;
+    VECTOR2I lastPosOK;
     double  min_cost, curr_cost, Score;
     bool    testOtherSide;
 
@@ -586,18 +586,18 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
 
     // Move fpBBox to have the footprint position at (0,0)
     fpBBox.Move( -fpPos );
-    wxPoint fpBBoxOrg = fpBBox.GetOrigin();
+    VECTOR2I fpBBoxOrg = fpBBox.GetOrigin();
 
     // Calculate the limit of the footprint position, relative to the routing matrix area
-    wxPoint xylimit = m_matrix.m_BrdBox.GetEnd() - fpBBox.GetEnd();
+    VECTOR2I xylimit = m_matrix.m_BrdBox.GetEnd() - fpBBox.GetEnd();
 
-    wxPoint initialPos = m_matrix.m_BrdBox.GetOrigin() - fpBBoxOrg;
+    VECTOR2I initialPos = m_matrix.m_BrdBox.GetOrigin() - fpBBoxOrg;
 
     // Stay on grid.
     initialPos.x    -= initialPos.x % m_matrix.m_GridRouting;
     initialPos.y    -= initialPos.y % m_matrix.m_GridRouting;
 
-    m_curPosition = initialPos;
+    m_curPosition = (wxPoint)initialPos;
     wxPoint fpOffset = fpPos - m_curPosition;
 
     // Examine pads, and set testOtherSide to true if a footprint has at least 1 pad through.
@@ -657,7 +657,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( FOOTPRINT* aFootprint )
     }
 
     // Regeneration of the modified variable.
-    m_curPosition = lastPosOK;
+    m_curPosition = (wxPoint)lastPosOK;
 
     m_minCost = min_cost;
     return error;
diff --git a/pcbnew/autorouter/ar_matrix.cpp b/pcbnew/autorouter/ar_matrix.cpp
index 18d67e475b..d68223769b 100644
--- a/pcbnew/autorouter/ar_matrix.cpp
+++ b/pcbnew/autorouter/ar_matrix.cpp
@@ -67,7 +67,7 @@ bool AR_MATRIX::ComputeMatrixSize( const EDA_RECT& aBoundingBox )
     m_BrdBox.SetY( m_BrdBox.GetY() - ( m_BrdBox.GetY() % m_GridRouting ) );
 
     // The boundary box must have its end point on routing grid:
-    wxPoint end = m_BrdBox.GetEnd();
+    VECTOR2I end = m_BrdBox.GetEnd();
 
     end.x -= end.x % m_GridRouting;
     end.x += m_GridRouting;
diff --git a/pcbnew/autorouter/ar_matrix.h b/pcbnew/autorouter/ar_matrix.h
index fd1e67ee33..bb87a31d01 100644
--- a/pcbnew/autorouter/ar_matrix.h
+++ b/pcbnew/autorouter/ar_matrix.h
@@ -73,7 +73,7 @@ public:
      */
     wxPoint GetBrdCoordOrigin()
     {
-        return m_BrdBox.GetOrigin();
+        return (wxPoint)m_BrdBox.GetOrigin();
     }
 
     /**
diff --git a/pcbnew/autorouter/spread_footprints.cpp b/pcbnew/autorouter/spread_footprints.cpp
index 8b140f3ce5..328133e5ae 100644
--- a/pcbnew/autorouter/spread_footprints.cpp
+++ b/pcbnew/autorouter/spread_footprints.cpp
@@ -168,8 +168,9 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <FOOTPRIN
         FOOTPRINT* footprint = aFootprintList[vecSubRects[it].n];
 
         EDA_RECT fpBBox = footprint->GetBoundingBox( false, false );
-        wxPoint mod_pos = pos + ( footprint->GetPosition() - fpBBox.GetOrigin() )
-                          + aFreeArea.GetOrigin();
+        wxPoint  mod_pos =
+                pos + ( footprint->GetPosition() - (wxPoint)fpBBox.GetOrigin() )
+                          + (wxPoint) aFreeArea.GetOrigin();
 
         footprint->Move( mod_pos - footprint->GetPosition() );
     }
@@ -260,7 +261,8 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadArea
 
                 if( pass == 1 )
                 {
-                    wxPoint areapos = placementSheetAreas[subareaIdx].GetOrigin()
+                    VECTOR2I areapos =
+                            placementSheetAreas[subareaIdx].GetOrigin()
                                       + aSpreadAreaPosition;
                     freeArea.SetOrigin( areapos );
                 }
diff --git a/pcbnew/board.h b/pcbnew/board.h
index 1080bc9b2c..573d8b2cf2 100644
--- a/pcbnew/board.h
+++ b/pcbnew/board.h
@@ -277,7 +277,7 @@ public:
 
     wxPoint GetPosition() const override;
     void SetPosition( const wxPoint& aPos ) override;
-    const wxPoint GetFocusPosition() const override { return GetBoundingBox().GetCenter(); }
+    const wxPoint GetFocusPosition() const override { return (wxPoint)GetBoundingBox().GetCenter(); }
 
     bool IsEmpty() const
     {
diff --git a/pcbnew/dialogs/dialog_export_svg.cpp b/pcbnew/dialogs/dialog_export_svg.cpp
index 7579ff45fc..e3a7cdc079 100644
--- a/pcbnew/dialogs/dialog_export_svg.cpp
+++ b/pcbnew/dialogs/dialog_export_svg.cpp
@@ -319,7 +319,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
     plot_opts.SetFormat( PLOT_FORMAT::SVG );
 
     PAGE_INFO   savedPageInfo = m_board->GetPageSettings();
-    wxPoint     savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
+    VECTOR2I  savedAuxOrigin = m_board->GetDesignSettings().GetAuxOrigin();
 
     if( m_rbSvgPageSizeOpt->GetSelection() == 2 )   // Page is board boundary size
     {
@@ -330,7 +330,7 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
         currpageInfo.SetHeightMils( bbox.GetHeight() / IU_PER_MILS );
         m_board->SetPageSettings( currpageInfo );
         plot_opts.SetUseAuxOrigin( true );
-        wxPoint origin = bbox.GetOrigin();
+        VECTOR2I origin = bbox.GetOrigin();
         m_board->GetDesignSettings().SetAuxOrigin( origin );
     }
 
diff --git a/pcbnew/dialogs/dialog_export_vrml.cpp b/pcbnew/dialogs/dialog_export_vrml.cpp
index b696bda23c..abd582b0e3 100644
--- a/pcbnew/dialogs/dialog_export_vrml.cpp
+++ b/pcbnew/dialogs/dialog_export_vrml.cpp
@@ -230,7 +230,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
     {
         // Origin = board center:
         BOARD* pcb = GetBoard();
-        wxPoint center = pcb->GetBoundingBox().GetCenter();
+        VECTOR2I center = pcb->GetBoundingBox().GetCenter();
         aXRef = Iu2Millimeter( center.x );
         aYRef = Iu2Millimeter( center.y );
     }
diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp
index bb7d1777d7..7ccbb06d73 100644
--- a/pcbnew/dialogs/dialog_gendrill.cpp
+++ b/pcbnew/dialogs/dialog_gendrill.cpp
@@ -341,7 +341,7 @@ void DIALOG_GENDRILL::UpdateDrillParams()
     m_UseRouteModeForOvalHoles = m_radioBoxOvalHoleMode->GetSelection() == 0;
 
     if( m_Choice_Drill_Offset->GetSelection() == 0 )
-        m_DrillFileOffset = wxPoint( 0, 0 );
+        m_DrillFileOffset = VECTOR2I( 0, 0 );
     else
         m_DrillFileOffset = m_board->GetDesignSettings().GetAuxOrigin();
 
diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h
index ce9cb6947a..1b6bc4643e 100644
--- a/pcbnew/dialogs/dialog_gendrill.h
+++ b/pcbnew/dialogs/dialog_gendrill.h
@@ -99,7 +99,7 @@ public:
     static bool      m_Mirror;
     static bool      m_Merge_PTH_NPTH;
     DRILL_PRECISION  m_Precision;                // Precision for drill files, in non decimal format
-    wxPoint          m_DrillFileOffset;          // Drill offset: 0,0 for absolute coordinates,
+    VECTOR2I         m_DrillFileOffset;          // Drill offset: 0,0 for absolute coordinates,
                                                  // or origin of the auxiliary axis
     static bool      m_UseRouteModeForOvalHoles; // True to use a G00 route command for oval holes
                                                  // False to use a G85 canned mode for oval holes
diff --git a/pcbnew/dialogs/dialog_position_relative.cpp b/pcbnew/dialogs/dialog_position_relative.cpp
index a4cb0b7055..0640bdde4f 100644
--- a/pcbnew/dialogs/dialog_position_relative.cpp
+++ b/pcbnew/dialogs/dialog_position_relative.cpp
@@ -33,8 +33,8 @@
 DIALOG_POSITION_RELATIVE::POSITION_RELATIVE_OPTIONS DIALOG_POSITION_RELATIVE::m_options;
 
 
-DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxPoint& translation,
-                                                    wxPoint& anchor ) :
+DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, VECTOR2I& translation,
+                                                    VECTOR2I& anchor ) :
     DIALOG_POSITION_RELATIVE_BASE( aParent ),
     m_toolMgr( aParent->GetToolManager() ),
     m_translation( translation ),
@@ -182,7 +182,7 @@ void DIALOG_POSITION_RELATIVE::OnClear( wxCommandEvent& event )
     POSITION_RELATIVE_TOOL* posrelTool = m_toolMgr->GetTool<POSITION_RELATIVE_TOOL>();
     wxASSERT( posrelTool );
 
-    wxPoint offset = posrelTool->GetSelectionAnchorPosition() - m_anchor_position;
+    VECTOR2I offset = posrelTool->GetSelectionAnchorPosition() - m_anchor_position;
     double  r, q;
     ToPolarDeg( offset.x, offset.y, r, q );
 
@@ -245,7 +245,7 @@ void DIALOG_POSITION_RELATIVE::OnUseUserOriginClick( wxCommandEvent& event )
 {
     PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) m_toolMgr->GetToolHolder();
 
-    m_anchor_position = (wxPoint) frame->GetScreen()->m_LocalOrigin;
+    m_anchor_position = frame->GetScreen()->m_LocalOrigin;
     m_referenceInfo->SetLabel( _( "Reference location: local coordinates origin" ) );
 }
 
diff --git a/pcbnew/dialogs/dialog_position_relative.h b/pcbnew/dialogs/dialog_position_relative.h
index 6aec6efc25..773ada614f 100644
--- a/pcbnew/dialogs/dialog_position_relative.h
+++ b/pcbnew/dialogs/dialog_position_relative.h
@@ -36,7 +36,7 @@ class DIALOG_POSITION_RELATIVE : public DIALOG_POSITION_RELATIVE_BASE
 {
 public:
     // Constructor and destructor
-    DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, wxPoint& translation, wxPoint& anchor );
+    DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, VECTOR2I& translation, VECTOR2I& anchor );
     ~DIALOG_POSITION_RELATIVE() { };
 
     void UpdateAnchor( EDA_ITEM* aItem );
@@ -96,8 +96,8 @@ private:
     static POSITION_RELATIVE_OPTIONS m_options;
 
     TOOL_MANAGER* m_toolMgr;
-    wxPoint&      m_translation;
-    wxPoint&      m_anchor_position;
+    VECTOR2I&     m_translation;
+    VECTOR2I&     m_anchor_position;
 
     UNIT_BINDER   m_xOffset;
     UNIT_BINDER   m_yOffset;
diff --git a/pcbnew/drc/drc_test_provider_misc.cpp b/pcbnew/drc/drc_test_provider_misc.cpp
index c618b8c73a..7a58ec20bd 100644
--- a/pcbnew/drc/drc_test_provider_misc.cpp
+++ b/pcbnew/drc/drc_test_provider_misc.cpp
@@ -114,7 +114,7 @@ void DRC_TEST_PROVIDER_MISC::testOutline()
             drcItem->SetErrorMessage( drcItem->GetErrorText() + wxS( " " ) + m_msg );
             drcItem->SetItems( m_board );
 
-            reportViolation( drcItem, m_board->GetBoundingBox().Centre(), Edge_Cuts );
+            reportViolation( drcItem, (wxPoint)m_board->GetBoundingBox().Centre(), Edge_Cuts );
         }
     }
 }
diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp
index fee6b713af..7ad4ec03b1 100644
--- a/pcbnew/exporters/export_d356.cpp
+++ b/pcbnew/exporters/export_d356.cpp
@@ -95,7 +95,7 @@ static int iu_to_d356(int iu, int clamp)
 /* Extract the D356 record from the footprints (pads) */
 static void build_pad_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecords )
 {
-    wxPoint origin = aPcb->GetDesignSettings().GetAuxOrigin();
+    VECTOR2I origin = aPcb->GetDesignSettings().GetAuxOrigin();
 
     for( FOOTPRINT* footprint : aPcb->Footprints() )
     {
@@ -168,7 +168,7 @@ static int via_access_code( BOARD *aPcb, int top_layer, int bottom_layer )
 /* Extract the D356 record from the vias */
 static void build_via_testpoints( BOARD *aPcb, std::vector <D356_RECORD>& aRecords )
 {
-    wxPoint origin = aPcb->GetDesignSettings().GetAuxOrigin();
+    VECTOR2I origin = aPcb->GetDesignSettings().GetAuxOrigin();
 
     // Enumerate all the track segments and keep the vias
     for( auto track : aPcb->Tracks() )
diff --git a/pcbnew/exporters/export_footprints_placefile.cpp b/pcbnew/exporters/export_footprints_placefile.cpp
index 218e4b4949..155b134eb5 100644
--- a/pcbnew/exporters/export_footprints_placefile.cpp
+++ b/pcbnew/exporters/export_footprints_placefile.cpp
@@ -97,7 +97,7 @@ PLACE_FILE_EXPORTER::PLACE_FILE_EXPORTER( BOARD* aBoard, bool aUnitsMM, bool aOn
     if( aUseAuxOrigin )
         m_place_Offset = m_board->GetDesignSettings().GetAuxOrigin();
     else
-        m_place_Offset = wxPoint( 0, 0 );
+        m_place_Offset = VECTOR2I( 0, 0 );
 }
 
 
@@ -173,7 +173,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
 
         for( int ii = 0; ii < m_fpCount; ii++ )
         {
-            wxPoint  footprint_pos;
+            VECTOR2I footprint_pos;
             footprint_pos  = list[ii].m_Footprint->GetPosition();
             footprint_pos -= m_place_Offset;
 
@@ -239,7 +239,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
 
         for( int ii = 0; ii < m_fpCount; ii++ )
         {
-            wxPoint  footprint_pos;
+            VECTOR2I footprint_pos;
             footprint_pos  = list[ii].m_Footprint->GetPosition();
             footprint_pos -= m_place_Offset;
 
@@ -280,7 +280,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
 {
     std::string buffer;
 
-    m_place_Offset = wxPoint( 0, 0 );
+    m_place_Offset = VECTOR2I( 0, 0 );
 
     // Select units:
     double conv_unit = m_unitsMM ? conv_unit_mm : conv_unit_inch;
@@ -351,7 +351,7 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
 
         buffer += "\n";
 
-        wxPoint footprint_pos = footprint->GetPosition();
+        VECTOR2I footprint_pos = footprint->GetPosition();
         footprint_pos -= m_place_Offset;
 
         sprintf( line, "position %9.6f %9.6f  orientation %.2f\n",
diff --git a/pcbnew/exporters/export_footprints_placefile.h b/pcbnew/exporters/export_footprints_placefile.h
index fa523d6af9..4bcd3b7595 100644
--- a/pcbnew/exporters/export_footprints_placefile.h
+++ b/pcbnew/exporters/export_footprints_placefile.h
@@ -90,14 +90,14 @@ public:
     static std::string GetBackSideName() { return std::string( "bottom" ); }
 
 private:
-    BOARD*  m_board;
-    bool    m_unitsMM;        // true for mm, false for inches
-    bool    m_onlySMD;        // Include only SMD components
-    bool    m_excludeAllTH;   // Exclude any footprints with through-hole pads
-    int     m_side;           // PCB_BACK_SIDE, PCB_FRONT_SIDE, PCB_BOTH_SIDES
-    bool    m_formatCSV;      // true for csv format, false for ascii (utf8) format
-    int     m_fpCount;        // Number of footprints in list, for info
-    wxPoint m_place_Offset;   // Offset for coordinates in generated data.
+    BOARD*   m_board;
+    bool     m_unitsMM;        // true for mm, false for inches
+    bool     m_onlySMD;        // Include only SMD components
+    bool     m_excludeAllTH;   // Exclude any footprints with through-hole pads
+    int      m_side;           // PCB_BACK_SIDE, PCB_FRONT_SIDE, PCB_BOTH_SIDES
+    bool     m_formatCSV;      // true for csv format, false for ascii (utf8) format
+    int      m_fpCount;        // Number of footprints in list, for info
+    VECTOR2I m_place_Offset;   // Offset for coordinates in generated data.
 };
 
 #endif      // #ifndef EXPORT_FOOTPRINTS_PLACEFILE_H
diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp
index e4e7705e97..6a696deb89 100644
--- a/pcbnew/exporters/export_gencad.cpp
+++ b/pcbnew/exporters/export_gencad.cpp
@@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
     GetBoard()->ComputeBoundingBox();
 
     // Save the auxiliary origin for the rest of the footprint
-    wxPoint auxOrigin = m_pcb->GetDesignSettings().GetAuxOrigin();
+    VECTOR2I auxOrigin = m_pcb->GetDesignSettings().GetAuxOrigin();
     GencadOffsetX = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.x : 0;
     GencadOffsetY = optionsDialog.GetOption( USE_AUX_ORIGIN ) ? auxOrigin.y : 0;
 
diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp
index 39f3da0bc4..317d32fc37 100644
--- a/pcbnew/exporters/gen_drill_report_files.cpp
+++ b/pcbnew/exporters/gen_drill_report_files.cpp
@@ -73,7 +73,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
     // for the right holes set (PTH, NPTH, buried/blind vias ...)
 
     double    scale = 1.0;
-    wxPoint   offset = GetOffset();
+    VECTOR2I  offset = GetOffset();
     PLOTTER*  plotter = nullptr;
     PAGE_INFO dummy( PAGE_INFO::A4, false );
     int       bottom_limit = 0;        // Y coord limit of page. 0 mean do not use
@@ -440,7 +440,7 @@ bool GENDRILL_WRITER_BASE::GenDrillReportFile( const wxString& aFullFileName )
 bool GENDRILL_WRITER_BASE::plotDrillMarks( PLOTTER* aPlotter )
 {
     // Plot the drill map:
-    wxPoint pos;
+    VECTOR2I pos;
 
     for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
     {
@@ -455,7 +455,7 @@ bool GENDRILL_WRITER_BASE::plotDrillMarks( PLOTTER* aPlotter )
 
         if( hole.m_Hole_Shape != 0 )
         {
-            wxSize oblong_size = hole.m_Hole_Size;
+            VECTOR2I oblong_size = hole.m_Hole_Size;
             aPlotter->FlashPadOval( pos, oblong_size, hole.m_Hole_Orient, SKETCH, nullptr );
         }
     }
diff --git a/pcbnew/exporters/gendrill_Excellon_writer.h b/pcbnew/exporters/gendrill_Excellon_writer.h
index 33b71620fb..9911af6694 100644
--- a/pcbnew/exporters/gendrill_Excellon_writer.h
+++ b/pcbnew/exporters/gendrill_Excellon_writer.h
@@ -53,7 +53,7 @@ public:
     /**
      * Return the plot offset (usually the position of the auxiliary axis.
      */
-    wxPoint GetOffset() { return m_offset; }
+    VECTOR2I GetOffset() { return m_offset; }
 
     /**
      *
@@ -86,7 +86,7 @@ public:
      * @param aMerge_PTH_NPTH set to true to create only one file containing PTH and NPTH
      *                        false to create 2 separate files : one for PTH and one for NPTH.
      */
-    void SetOptions( bool aMirror, bool aMinimalHeader, const wxPoint& aOffset,
+    void SetOptions( bool aMirror, bool aMinimalHeader, const VECTOR2I& aOffset,
                      bool aMerge_PTH_NPTH )
     {
         m_mirror = aMirror;
diff --git a/pcbnew/exporters/gendrill_file_writer_base.h b/pcbnew/exporters/gendrill_file_writer_base.h
index b2e7efca21..bc48257504 100644
--- a/pcbnew/exporters/gendrill_file_writer_base.h
+++ b/pcbnew/exporters/gendrill_file_writer_base.h
@@ -103,10 +103,10 @@ public:
                                          // size y).
     int          m_Tool_Reference;       // Tool reference for this hole = 1 ... n (values <=0
                                          // must not be used).
-    wxSize       m_Hole_Size;            // hole size for oblong holes
+    VECTOR2I     m_Hole_Size;            // hole size for oblong holes
     double       m_Hole_Orient;          // Hole rotation (= pad rotation) for oblong holes
     int          m_Hole_Shape;           // hole shape: round (0) or oval (1)
-    wxPoint      m_Hole_Pos;             // hole position
+    VECTOR2I     m_Hole_Pos;             // hole position
     PCB_LAYER_ID m_Hole_Bottom_Layer;    // hole ending layer (usually back layer)
     PCB_LAYER_ID m_Hole_Top_Layer;       // hole starting layer (usually front layer):
                                          // m_Hole_Top_Layer < m_Hole_Bottom_Layer
@@ -180,7 +180,7 @@ public:
     /**
      * Return the plot offset (usually the position of the drill/place origin).
      */
-    wxPoint GetOffset() { return m_offset; }
+    VECTOR2I GetOffset() { return m_offset; }
 
     /**
      * Set the page info used to plot drill maps.
@@ -380,7 +380,7 @@ protected:
     double                   m_conversionUnits;         // scaling factor to convert the board
                                                         // unites to Excellon/Gerber units (i.e
                                                         // inches or mm)
-    wxPoint                  m_offset;                  // Drill offset coordinates
+    VECTOR2I                 m_offset;                  // Drill offset coordinates
     bool                     m_merge_PTH_NPTH;          // True to generate only one drill file
     std::vector<HOLE_INFO>   m_holeListBuffer;          // Buffer containing holes
     std::vector<DRILL_TOOL>  m_toolListBuffer;          // Buffer containing tools
diff --git a/pcbnew/exporters/gendrill_gerber_writer.cpp b/pcbnew/exporters/gendrill_gerber_writer.cpp
index e60326cc6c..c3a0f3e30d 100644
--- a/pcbnew/exporters/gendrill_gerber_writer.cpp
+++ b/pcbnew/exporters/gendrill_gerber_writer.cpp
@@ -172,7 +172,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
 
     holes_count = 0;
 
-    wxPoint hole_pos;
+    VECTOR2I hole_pos;
     bool last_item_is_via = true;   // a flag to clear object attributes when a via hole is created.
 
     for( unsigned ii = 0; ii < m_holeListBuffer.size(); ii++ )
diff --git a/pcbnew/exporters/gendrill_gerber_writer.h b/pcbnew/exporters/gendrill_gerber_writer.h
index 6110bc8ea3..c07d829c23 100644
--- a/pcbnew/exporters/gendrill_gerber_writer.h
+++ b/pcbnew/exporters/gendrill_gerber_writer.h
@@ -60,7 +60,7 @@ public:
      *
      * @param aOffset is the drill coordinates offset.
      */
-    void SetOptions( const wxPoint& aOffset )
+    void SetOptions( const VECTOR2I& aOffset )
     {
         m_offset = aOffset;
         m_merge_PTH_NPTH = false;
diff --git a/pcbnew/exporters/gerber_placefile_writer.h b/pcbnew/exporters/gerber_placefile_writer.h
index 46a4e26f7e..8b3e1ff34f 100644
--- a/pcbnew/exporters/gerber_placefile_writer.h
+++ b/pcbnew/exporters/gerber_placefile_writer.h
@@ -27,7 +27,7 @@
 #define PLACEFILE_GERBER_WRITER_H
 
 #include <layer_ids.h>
-#include <wx/gdicmn.h>
+#include <math/vector2d.h>
 
 class BOARD;
 class FOOTPRINT;
@@ -53,7 +53,7 @@ public:
      *
      * @param aOffset is the drill coordinates offset.
      */
-    void SetOptions( const wxPoint& aOffset )
+    void SetOptions( const VECTOR2I& aOffset )
     {
         m_offset = aOffset;
     }
@@ -95,7 +95,7 @@ private:
 
     BOARD*       m_pcb;
     PCB_LAYER_ID m_layer;            // The board layer currently used (typically F_Cu or B_Cu)
-    wxPoint      m_offset;           // Drill offset coordinates
+    VECTOR2I     m_offset;           // Drill offset coordinates
 
     bool         m_plotPad1Marker;       // True to plot a flashed marker shape at pad 1 position
     bool         m_plotOtherPadsMarker;  // True to plot a marker shape at other pads position
diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp
index a2dd13ba02..d540a093b1 100644
--- a/pcbnew/fp_text.cpp
+++ b/pcbnew/fp_text.cpp
@@ -85,11 +85,11 @@ void FP_TEXT::SetTextAngle( const EDA_ANGLE& aAngle )
 bool FP_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
 {
     EDA_RECT rect = GetTextBox();
-    wxPoint location = aPoint;
+    VECTOR2I location = aPoint;
 
     rect.Inflate( aAccuracy );
 
-    RotatePoint( &location, GetTextPos(), -GetDrawRotation() );
+    RotatePoint( location, GetTextPos(), -GetDrawRotation() );
 
     return rect.Contains( location );
 }
@@ -131,8 +131,8 @@ void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
     // Used in footprint editing
     // Note also in footprint editor, m_Pos0 = m_Pos
 
-    wxPoint pt = GetTextPos();
-    RotatePoint( &pt, aRotCentre, aAngle );
+    VECTOR2I pt = GetTextPos();
+    RotatePoint( pt, aRotCentre, aAngle );
     SetTextPos( pt );
 
     SetTextAngle( GetTextAngle().AsTenthsOfADegree() + aAngle );
@@ -203,8 +203,8 @@ void FP_TEXT::SetDrawCoord()
     {
         double angle = parentFootprint->GetOrientation();
 
-        wxPoint pt = GetTextPos();
-        RotatePoint( &pt, angle );
+        VECTOR2I pt = GetTextPos();
+        RotatePoint( pt, angle );
         SetTextPos( pt );
 
         Offset( parentFootprint->GetPosition() );
@@ -218,7 +218,7 @@ void FP_TEXT::SetLocalCoord()
 
     if( parentFootprint )
     {
-        m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
+        m_Pos0 = (wxPoint)GetTextPos() - parentFootprint->GetPosition();
 
         double angle = parentFootprint->GetOrientation();
 
@@ -226,7 +226,7 @@ void FP_TEXT::SetLocalCoord()
     }
     else
     {
-        m_Pos0 = GetTextPos();
+        m_Pos0 = (wxPoint)GetTextPos();
     }
 }
 
diff --git a/pcbnew/fp_text.h b/pcbnew/fp_text.h
index 29a6c7b075..e00781a703 100644
--- a/pcbnew/fp_text.h
+++ b/pcbnew/fp_text.h
@@ -87,7 +87,7 @@ public:
 
     virtual wxPoint GetPosition() const override
     {
-        return EDA_TEXT::GetTextPos();
+        return (wxPoint)EDA_TEXT::GetTextPos();
     }
 
     virtual void SetPosition( const wxPoint& aPos ) override
diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp
index 25956ae1e9..9bc40a945e 100644
--- a/pcbnew/pcb_base_frame.cpp
+++ b/pcbnew/pcb_base_frame.cpp
@@ -453,27 +453,27 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
 }
 
 
-const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
+const VECTOR2I& PCB_BASE_FRAME::GetGridOrigin() const
 {
     return m_pcb->GetDesignSettings().GetGridOrigin();
 }
 
 
-void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
+void PCB_BASE_FRAME::SetGridOrigin( const VECTOR2I& aPoint )
 {
     m_pcb->GetDesignSettings().SetGridOrigin( aPoint );
 }
 
 
-const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
+const VECTOR2I& PCB_BASE_FRAME::GetAuxOrigin() const
 {
     return m_pcb->GetDesignSettings().GetAuxOrigin();
 }
 
 
-const wxPoint PCB_BASE_FRAME::GetUserOrigin() const
+const VECTOR2I PCB_BASE_FRAME::GetUserOrigin() const
 {
-    wxPoint origin( 0, 0 );
+    VECTOR2I origin( 0, 0 );
 
     switch( Settings().m_Display.m_DisplayOrigin )
     {
diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp
index bdddd1c161..2ffef7a189 100644
--- a/pcbnew/pcb_dimension.cpp
+++ b/pcbnew/pcb_dimension.cpp
@@ -220,8 +220,8 @@ void PCB_DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle )
 
     m_text.SetTextAngle( newAngle );
 
-    wxPoint pt = m_text.GetTextPos();
-    RotatePoint( &pt, aRotCentre, aAngle );
+    VECTOR2I pt = m_text.GetTextPos();
+    RotatePoint( pt, aRotCentre, aAngle );
     m_text.SetTextPos( pt );
 
     RotatePoint( &m_start, aRotCentre, aAngle );
@@ -242,7 +242,7 @@ void PCB_DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
 void PCB_DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight )
 {
     int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y;
-    wxPoint newPos = m_text.GetTextPos();
+    VECTOR2I newPos = m_text.GetTextPos();
 
 #define INVERT( pos ) ( ( pos ) = axis - ( ( pos ) - axis ) )
     if( aMirrorLeftRight )
diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp
index 27eff858de..a9c0916b74 100644
--- a/pcbnew/pcb_group.cpp
+++ b/pcbnew/pcb_group.cpp
@@ -115,7 +115,7 @@ bool PCB_GROUP::WithinScope( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool isFootpr
 
 wxPoint PCB_GROUP::GetPosition() const
 {
-    return GetBoundingBox().Centre();
+    return (wxPoint)GetBoundingBox().Centre();
 }
 
 
diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index 05a2f2914c..1911f5a869 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -1652,9 +1652,9 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
         EDA_RECT bbox = aGroup->GetBoundingBox();
         m_gal->SetStrokeColor( color );
         m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth * 2.0f );
-        wxPoint topLeft = bbox.GetPosition();
-        wxPoint width = wxPoint( bbox.GetWidth(), 0 );
-        wxPoint height = wxPoint( 0, bbox.GetHeight() );
+        VECTOR2I topLeft = bbox.GetPosition();
+        VECTOR2I width = VECTOR2I( bbox.GetWidth(), 0 );
+        VECTOR2I height = VECTOR2I( 0, bbox.GetHeight() );
 
         m_gal->DrawLine( topLeft, topLeft + width );
         m_gal->DrawLine( topLeft + width, topLeft + width + height );
diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp
index a03464812f..b48f53e6fb 100644
--- a/pcbnew/pcb_text.cpp
+++ b/pcbnew/pcb_text.cpp
@@ -167,8 +167,8 @@ bool PCB_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
 
 void PCB_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
 {
-    wxPoint pt = GetTextPos();
-    RotatePoint( &pt, aRotCentre, aAngle );
+    VECTOR2I pt = GetTextPos();
+    RotatePoint( pt, aRotCentre, aAngle );
     SetTextPos( pt );
 
     SetTextAngle( GetTextAngle().AsTenthsOfADegree() + aAngle );
diff --git a/pcbnew/pcb_text.h b/pcbnew/pcb_text.h
index c2f8f6fd6c..70261bb30d 100644
--- a/pcbnew/pcb_text.h
+++ b/pcbnew/pcb_text.h
@@ -75,7 +75,7 @@ public:
 
     virtual wxPoint GetPosition() const override
     {
-        return EDA_TEXT::GetTextPos();
+        return (wxPoint)EDA_TEXT::GetTextPos();
     }
 
     virtual void SetPosition( const wxPoint& aPos ) override
diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp
index e8789a457a..47913e9e5f 100644
--- a/pcbnew/pcbplot.cpp
+++ b/pcbnew/pcbplot.cpp
@@ -340,7 +340,7 @@ void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard, bool aUseX1Compa
     // Please, if absolute Pcbnew coordinates, one day, are set by user, change the way
     // the key is built to ensure file only using the *same* axis have the same key.
     wxString registration_id = "Original";
-    wxPoint auxOrigin = aBoard->GetDesignSettings().GetAuxOrigin();
+    VECTOR2I auxOrigin = aBoard->GetDesignSettings().GetAuxOrigin();
 
     if( aBoard->GetPlotOptions().GetUseAuxOrigin() && auxOrigin.x && auxOrigin.y )
         registration_id.Printf( "PX%xPY%x", auxOrigin.x, auxOrigin.y );
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index 6ad7849e62..1e19584603 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -1037,8 +1037,8 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
     }
 
     EDA_RECT bbox = aBoard->ComputeBoundingBox();
-    wxPoint boardCenter = bbox.Centre();
-    wxSize boardSize = bbox.GetSize();
+    VECTOR2I boardCenter = bbox.Centre();
+    VECTOR2I boardSize = bbox.GetSize();
 
     double compound_scale;
 
@@ -1058,7 +1058,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
 
     // For the plot offset we have to keep in mind the auxiliary origin too: if autoscaling is
     // off we check that plot option (i.e. autoscaling overrides auxiliary origin)
-    wxPoint offset( 0, 0);
+    VECTOR2I offset( 0, 0);
 
     if( autocenter )
     {
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index 263ef594b3..768dddd316 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -386,8 +386,8 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4
     m_plotter->SetColor( color );
 
     // calculate some text parameters :
-    wxSize  size      = aText->GetTextSize();
-    wxPoint pos       = aText->GetTextPos();
+    VECTOR2I size = aText->GetTextSize();
+    VECTOR2I pos = aText->GetTextPos();
     int     thickness = aText->GetEffectiveTextPenWidth();
 
     if( aText->IsMirrored() )
@@ -753,8 +753,8 @@ void BRDITEMS_PLOTTER::PlotPcbText( const PCB_TEXT* aText )
     COLOR4D color = getColor( aText->GetLayer() );
     m_plotter->SetColor( color );
 
-    wxSize  size      = aText->GetTextSize();
-    wxPoint pos       = aText->GetTextPos();
+    VECTOR2I size = aText->GetTextSize();
+    VECTOR2I pos = aText->GetTextPos();
     int     thickness = aText->GetEffectiveTextPenWidth();
 
     if( aText->IsMirrored() )
diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp
index 9e56414755..111fc733e7 100644
--- a/pcbnew/plugins/kicad/pcb_plugin.cpp
+++ b/pcbnew/plugins/kicad/pcb_plugin.cpp
@@ -498,9 +498,9 @@ void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const
         m_out->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %s)\n",
                       Double2Str( dsnSettings.m_SolderPasteMarginRatio ).c_str() );
 
-    wxPoint origin = dsnSettings.GetAuxOrigin();
+    VECTOR2I origin = dsnSettings.GetAuxOrigin();
 
-    if( origin != wxPoint( 0, 0 ) )
+    if( origin != VECTOR2I( 0, 0 ) )
     {
         m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
                       FormatInternalUnits( origin.x ).c_str(),
diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp
index 7a07a083bb..58a03db1ec 100644
--- a/pcbnew/tools/board_editor_control.cpp
+++ b/pcbnew/tools/board_editor_control.cpp
@@ -196,7 +196,7 @@ void BOARD_EDITOR_CONTROL::Reset( RESET_REASON aReason )
 
     if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
     {
-        m_placeOrigin->SetPosition( getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
+        m_placeOrigin->SetPosition( (wxPoint)getModel<BOARD>()->GetDesignSettings().GetAuxOrigin() );
         getView()->Remove( m_placeOrigin.get() );
         getView()->Add( m_placeOrigin.get() );
     }
diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp
index 15f3c632a8..f0df64a505 100644
--- a/pcbnew/tools/pcb_control.cpp
+++ b/pcbnew/tools/pcb_control.cpp
@@ -88,7 +88,7 @@ void PCB_CONTROL::Reset( RESET_REASON aReason )
 
     if( aReason == MODEL_RELOAD || aReason == GAL_SWITCH )
     {
-        m_gridOrigin->SetPosition( board()->GetDesignSettings().GetGridOrigin() );
+        m_gridOrigin->SetPosition( (wxPoint) board()->GetDesignSettings().GetGridOrigin() );
         m_gridOrigin->SetColor( m_frame->GetGridColor() );
         getView()->Remove( m_gridOrigin.get() );
         getView()->Add( m_gridOrigin.get() );
diff --git a/pcbnew/tools/position_relative_tool.cpp b/pcbnew/tools/position_relative_tool.cpp
index 2ba163fd62..002f5bfa6f 100644
--- a/pcbnew/tools/position_relative_tool.cpp
+++ b/pcbnew/tools/position_relative_tool.cpp
@@ -133,10 +133,10 @@ int POSITION_RELATIVE_TOOL::PositionRelative( const TOOL_EVENT& aEvent )
 }
 
 
-int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const wxPoint& aPosAnchor,
-                                                       const wxPoint& aTranslation )
+int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const VECTOR2I& aPosAnchor,
+                                                       const VECTOR2I& aTranslation )
 {
-    wxPoint aggregateTranslation = aPosAnchor + aTranslation - GetSelectionAnchorPosition();
+    VECTOR2I aggregateTranslation = aPosAnchor + aTranslation - GetSelectionAnchorPosition();
 
     for( auto item : m_selection )
     {
diff --git a/pcbnew/tools/position_relative_tool.h b/pcbnew/tools/position_relative_tool.h
index 7bc4bbad67..64a832d05f 100644
--- a/pcbnew/tools/position_relative_tool.h
+++ b/pcbnew/tools/position_relative_tool.h
@@ -66,13 +66,13 @@ public:
     /**
      * Return the position of the selected item(s)
      */
-    wxPoint GetSelectionAnchorPosition() const { return m_selectionAnchor; }
+    VECTOR2I GetSelectionAnchorPosition() const { return m_selectionAnchor; }
 
     /**
      * Position the m_position_relative_selection selection relative to anchor position using
      * the given translation.
      */
-    int RelativeItemSelectionMove( const wxPoint& anchor, const wxPoint& translation );
+    int RelativeItemSelectionMove( const VECTOR2I& anchor, const VECTOR2I& translation );
 
     ///< Set up handlers for various events.
     void setTransitions() override;
@@ -82,14 +82,14 @@ private:
 
     PCB_SELECTION_TOOL*           m_selectionTool;
     PCB_SELECTION                 m_selection;
-    wxPoint                       m_selectionAnchor;
+    VECTOR2I                      m_selectionAnchor;
 
     std::unique_ptr<BOARD_COMMIT> m_commit;
 
     EDA_ITEM*                     m_anchor_item;
-    wxPoint                       m_anchor;
+    VECTOR2I                      m_anchor;
 
-    wxPoint                       m_translation;
+    VECTOR2I                      m_translation;
 };
 
 #endif
diff --git a/qa/eeschema/test_ee_item.cpp b/qa/eeschema/test_ee_item.cpp
index 6e9d8e858a..c1e396e746 100644
--- a/qa/eeschema/test_ee_item.cpp
+++ b/qa/eeschema/test_ee_item.cpp
@@ -212,18 +212,18 @@ BOOST_AUTO_TEST_CASE( Rotate )
                 if( schItem != nullptr )
                 {
                     // Only rotating pins around the center of parent sheet works.
-                    schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
-                    schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
-                    schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
-                    schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
+                    schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
+                    schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
+                    schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
+                    schItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
                 }
 
                 if( libItem != nullptr )
                 {
-                    libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
-                    libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
-                    libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
-                    libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
+                    libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
+                    libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
+                    libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
+                    libItem->Rotate( (wxPoint) m_sheet.GetBodyBoundingBox().GetCenter() );
                 }
 
                 CompareItems( newItem.get(), item.get() );