Neurotically update position wxPoint usages

This commit is contained in:
Marek Roszko 2022-01-01 01:04:08 -05:00
parent cadc0639eb
commit c4c56de708
239 changed files with 2459 additions and 2442 deletions

View File

@ -694,7 +694,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_SHAPE* aShape,
} }
else else
{ {
std::vector<wxPoint> pts = aShape->GetRectCorners(); std::vector<VECTOR2I> pts = aShape->GetRectCorners();
const SFVEC2F topLeft3DU( pts[0].x * m_biuTo3Dunits, -pts[0].y * m_biuTo3Dunits ); const SFVEC2F topLeft3DU( pts[0].x * m_biuTo3Dunits, -pts[0].y * m_biuTo3Dunits );
const SFVEC2F topRight3DU( pts[1].x * m_biuTo3Dunits, -pts[1].y * m_biuTo3Dunits ); const SFVEC2F topRight3DU( pts[1].x * m_biuTo3Dunits, -pts[1].y * m_biuTo3Dunits );

View File

@ -53,7 +53,7 @@ const VECTOR2D BASIC_GAL::transform( const VECTOR2D& aPoint ) const
} }
void BASIC_GAL::doDrawPolyline( const std::vector<wxPoint>& aLocalPointList ) void BASIC_GAL::doDrawPolyline( const std::vector<VECTOR2I>& aLocalPointList )
{ {
if( m_DC ) if( m_DC )
{ {
@ -98,10 +98,10 @@ void BASIC_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
if( aPointList.size() < 2 ) if( aPointList.size() < 2 )
return; return;
std::vector<wxPoint> polyline_corners; std::vector<VECTOR2I> polyline_corners;
for( const VECTOR2D& pt : aPointList ) for( const VECTOR2D& pt : aPointList )
polyline_corners.emplace_back( (wxPoint) transform( pt ) ); polyline_corners.emplace_back( (VECTOR2I) transform( pt ) );
doDrawPolyline( polyline_corners ); doDrawPolyline( polyline_corners );
} }
@ -112,10 +112,10 @@ void BASIC_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize )
if( aListSize < 2 ) if( aListSize < 2 )
return; return;
std::vector<wxPoint> polyline_corners; std::vector<VECTOR2I> polyline_corners;
for( int ii = 0; ii < aListSize; ++ii ) for( int ii = 0; ii < aListSize; ++ii )
polyline_corners.emplace_back( (wxPoint) transform( aPointList[ ii ] ) ); polyline_corners.emplace_back( (VECTOR2I) transform( aPointList[ii] ) );
doDrawPolyline( polyline_corners ); doDrawPolyline( polyline_corners );
} }

View File

@ -37,7 +37,7 @@
#include <wx/mstream.h> #include <wx/mstream.h>
BITMAP_BASE::BITMAP_BASE( const wxPoint& pos ) BITMAP_BASE::BITMAP_BASE( const VECTOR2I& pos )
{ {
m_scale = 1.0; // 1.0 = original bitmap size m_scale = 1.0; // 1.0 = original bitmap size
m_bitmap = nullptr; m_bitmap = nullptr;
@ -229,12 +229,12 @@ const EDA_RECT BITMAP_BASE::GetBoundingBox() const
} }
void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos ) void BITMAP_BASE::DrawBitmap( wxDC* aDC, const VECTOR2I& aPos )
{ {
if( m_bitmap == nullptr ) if( m_bitmap == nullptr )
return; return;
wxPoint pos = aPos; VECTOR2I pos = aPos;
wxSize size = GetSize(); wxSize size = GetSize();
// This fixes a bug in OSX that should be fixed in the 3.0.3 version or later. // This fixes a bug in OSX that should be fixed in the 3.0.3 version or later.
@ -328,8 +328,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
} }
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter, void BITMAP_BASE::PlotImage( PLOTTER* aPlotter, const VECTOR2I& aPos,
const wxPoint& aPos,
const COLOR4D& aDefaultColor, const COLOR4D& aDefaultColor,
int aDefaultPensize ) const int aDefaultPensize ) const
{ {

View File

@ -143,7 +143,7 @@ int DS_DATA_ITEM::GetPenSizeUi()
} }
void DS_DATA_ITEM::MoveToUi( const wxPoint& aPosition ) void DS_DATA_ITEM::MoveToUi( const VECTOR2I& aPosition )
{ {
DPOINT pos_mm; DPOINT pos_mm;
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
@ -202,7 +202,7 @@ void DS_DATA_ITEM::MoveStartPointTo( const DPOINT& aPosition )
} }
void DS_DATA_ITEM::MoveStartPointToUi( const wxPoint& aPosition ) void DS_DATA_ITEM::MoveStartPointToUi( const VECTOR2I& aPosition )
{ {
DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu, DPOINT pos_mm( aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu,
aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu ); aPosition.y / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu );
@ -254,7 +254,7 @@ void DS_DATA_ITEM::MoveEndPointTo( const DPOINT& aPosition )
} }
void DS_DATA_ITEM::MoveEndPointToUi( const wxPoint& aPosition ) void DS_DATA_ITEM::MoveEndPointToUi( const VECTOR2I& aPosition )
{ {
DPOINT pos_mm; DPOINT pos_mm;
pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos_mm.x = aPosition.x / DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
@ -295,10 +295,10 @@ const DPOINT DS_DATA_ITEM::GetStartPos( int ii ) const
} }
const wxPoint DS_DATA_ITEM::GetStartPosUi( int ii ) const const VECTOR2I DS_DATA_ITEM::GetStartPosUi( int ii ) const
{ {
DPOINT pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; DPOINT pos = GetStartPos( ii ) * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) ); return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
} }
@ -332,11 +332,11 @@ const DPOINT DS_DATA_ITEM::GetEndPos( int ii ) const
} }
const wxPoint DS_DATA_ITEM::GetEndPosUi( int ii ) const const VECTOR2I DS_DATA_ITEM::GetEndPosUi( int ii ) const
{ {
DPOINT pos = GetEndPos( ii ); DPOINT pos = GetEndPos( ii );
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return wxPoint( KiROUND( pos.x ), KiROUND( pos.y ) ); return VECTOR2I( KiROUND( pos.x ), KiROUND( pos.y ) );
} }
@ -510,11 +510,11 @@ bool DS_DATA_ITEM_POLYGONS::IsInsidePage( int ii ) const
} }
const wxPoint DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const const VECTOR2I DS_DATA_ITEM_POLYGONS::GetCornerPositionUi( unsigned aIdx, int aRepeat ) const
{ {
DPOINT pos = GetCornerPosition( aIdx, aRepeat ); DPOINT pos = GetCornerPosition( aIdx, aRepeat );
pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu; pos = pos * DS_DATA_MODEL::GetTheInstance().m_WSunits2Iu;
return wxPoint( int(pos.x), int(pos.y) ); return VECTOR2I( int( pos.x ), int( pos.y ) );
} }
@ -692,7 +692,7 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
int linewidth = 0; int linewidth = 0;
size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE ); size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE ); size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
DS_DRAW_ITEM_TEXT dummy( DS_DRAW_ITEM_TEXT( this, 0, m_FullText, wxPoint( 0, 0 ), DS_DRAW_ITEM_TEXT dummy( DS_DRAW_ITEM_TEXT( this, 0, m_FullText, VECTOR2I( 0, 0 ),
size_micron, linewidth, m_Italic, m_Bold ) ); size_micron, linewidth, m_Italic, m_Bold ) );
dummy.SetMultilineAllowed( true ); dummy.SetMultilineAllowed( true );
dummy.SetHorizJustify( m_Hjustify ) ; dummy.SetHorizJustify( m_Hjustify ) ;

View File

@ -158,7 +158,7 @@ void DS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
// ============================ TEXT ============================== // ============================ TEXT ==============================
void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_DRAWINGSHEET ), FILLED ); Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_DRAWINGSHEET ), FILLED );
} }
@ -170,7 +170,7 @@ const EDA_RECT DS_DRAW_ITEM_TEXT::GetBoundingBox() const
} }
bool DS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool DS_DRAW_ITEM_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
return EDA_TEXT::TextHitTest( aPosition, aAccuracy ); return EDA_TEXT::TextHitTest( aPosition, aAccuracy );
} }
@ -197,13 +197,13 @@ void DS_DRAW_ITEM_TEXT::SetTextAngle( double aAngle )
// ============================ POLYGON ================================= // ============================ POLYGON =================================
void DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings, void DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings,
const wxPoint& aOffset ) const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
std::vector<wxPoint> points_moved; std::vector<VECTOR2I> points_moved;
for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx ) for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
{ {
@ -222,10 +222,10 @@ void DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( const RENDER_SETTINGS* aSettings,
} }
void DS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const wxPoint& aPos ) void DS_DRAW_ITEM_POLYPOLYGONS::SetPosition( const VECTOR2I& aPos )
{ {
// Note: m_pos is the anchor point of the shape. // Note: m_pos is the anchor point of the shape.
wxPoint move_vect = aPos - m_pos; VECTOR2I move_vect = aPos - m_pos;
m_pos = aPos; m_pos = aPos;
// Move polygon corners to the new position: // Move polygon corners to the new position:
@ -247,7 +247,7 @@ const EDA_RECT DS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox() const
} }
bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
return m_Polygons.Collide( aPosition, aAccuracy ); return m_Polygons.Collide( aPosition, aAccuracy );
} }
@ -274,7 +274,7 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
for( int ii = 0; ii < outline.PointCount(); ii++ ) for( int ii = 0; ii < outline.PointCount(); ii++ )
{ {
wxPoint corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y ); VECTOR2I corner( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
// Test if the point is within aRect // Test if the point is within aRect
if( sel.Contains( corner ) ) if( sel.Contains( corner ) )
@ -282,7 +282,7 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained,
// Test if this edge intersects aRect // Test if this edge intersects aRect
int ii_next = (ii+1) % outline.PointCount(); int ii_next = (ii+1) % outline.PointCount();
wxPoint next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y ); VECTOR2I next_corner( outline.CPoint( ii_next ).x, outline.CPoint( ii_next ).y );
if( sel.Intersects( corner, next_corner ) ) if( sel.Intersects( corner, next_corner ) )
return true; return true;
@ -301,7 +301,7 @@ wxString DS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ RECT ============================== // ============================ RECT ==============================
void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void DS_DRAW_ITEM_RECT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
@ -318,11 +318,11 @@ const EDA_RECT DS_DRAW_ITEM_RECT::GetBoundingBox() const
} }
bool DS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool DS_DRAW_ITEM_RECT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
int dist = aAccuracy + ( GetPenWidth() / 2 ); int dist = aAccuracy + ( GetPenWidth() / 2 );
wxPoint start = GetStart(); VECTOR2I start = GetStart();
wxPoint end; VECTOR2I end;
end.x = GetEnd().x; end.x = GetEnd().x;
end.y = start.y; end.y = start.y;
@ -400,7 +400,7 @@ wxString DS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ LINE ============================== // ============================ LINE ==============================
void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void DS_DRAW_ITEM_LINE::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET ); COLOR4D color = aSettings->GetLayerColor( LAYER_DRAWINGSHEET );
@ -416,7 +416,7 @@ const EDA_RECT DS_DRAW_ITEM_LINE::GetBoundingBox() const
} }
bool DS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool DS_DRAW_ITEM_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1; int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist ); return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
@ -432,7 +432,7 @@ wxString DS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============== BITMAP ================ // ============== BITMAP ================
void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void DS_DRAW_ITEM_BITMAP::PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) GetPeer(); DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) GetPeer();
@ -456,7 +456,7 @@ const EDA_RECT DS_DRAW_ITEM_BITMAP::GetBoundingBox() const
} }
bool DS_DRAW_ITEM_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool DS_DRAW_ITEM_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT bbox = GetBoundingBox(); EDA_RECT bbox = GetBoundingBox();
bbox.Inflate( aAccuracy ); bbox.Inflate( aAccuracy );

View File

@ -135,7 +135,7 @@ void DS_PROXY_VIEW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
} }
bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const wxPoint& aPosition ) bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const VECTOR2I& aPosition )
{ {
int accuracy = (int) aView->ToWorld( 5.0 ); // five pixels at current zoom int accuracy = (int) aView->ToWorld( 5.0 ); // five pixels at current zoom
DS_DRAW_ITEM_LIST drawList; DS_DRAW_ITEM_LIST drawList;

View File

@ -832,7 +832,7 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
} }
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const VECTOR2I EDA_DRAW_FRAME::GetNearestGridPosition( const VECTOR2I& aPosition ) const
{ {
const VECTOR2I& gridOrigin = GetGridOrigin(); const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize(); VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
@ -842,11 +842,11 @@ wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
double yOffset = fmod( gridOrigin.y, gridSize.y ); double yOffset = fmod( gridOrigin.y, gridSize.y );
int y = KiROUND( (aPosition.y - yOffset) / gridSize.y ); int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) ); return VECTOR2I( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
} }
wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) const VECTOR2I EDA_DRAW_FRAME::GetNearestHalfGridPosition( const VECTOR2I& aPosition ) const
{ {
const VECTOR2I& gridOrigin = GetGridOrigin(); const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0; VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
@ -856,7 +856,7 @@ wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) c
double yOffset = fmod( gridOrigin.y, gridSize.y ); double yOffset = fmod( gridOrigin.y, gridSize.y );
int y = KiROUND( (aPosition.y - yOffset) / gridSize.y ); int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) ); return VECTOR2I( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
} }
@ -893,7 +893,7 @@ std::vector<wxWindow*> EDA_DRAW_FRAME::findDialogs()
} }
void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos ) void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos )
{ {
bool centerView = false; bool centerView = false;
BOX2D r = GetCanvas()->GetView()->GetViewport(); BOX2D r = GetCanvas()->GetView()->GetViewport();
@ -913,7 +913,7 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos )
} }
// Center if we're behind an obscuring dialog, or within 10% of its edge // Center if we're behind an obscuring dialog, or within 10% of its edge
for( BOX2D rect : dialogScreenRects ) for( BOX2D rect : dialogScreenRects )
{ {
rect.Inflate( rect.GetWidth() / 10 ); rect.Inflate( rect.GetWidth() / 10 );

View File

@ -285,7 +285,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
} }
const wxPoint EDA_RECT::ClosestPointTo( const wxPoint& aPoint ) const const VECTOR2I EDA_RECT::ClosestPointTo( const VECTOR2I& aPoint ) const
{ {
EDA_RECT me( *this ); EDA_RECT me( *this );
@ -295,11 +295,11 @@ const wxPoint EDA_RECT::ClosestPointTo( const wxPoint& aPoint ) const
int nx = std::max( me.GetLeft(), std::min( aPoint.x, me.GetRight() ) ); int nx = std::max( me.GetLeft(), std::min( aPoint.x, me.GetRight() ) );
int ny = std::max( me.GetTop(), std::min( aPoint.y, me.GetBottom() ) ); int ny = std::max( me.GetTop(), std::min( aPoint.y, me.GetBottom() ) );
return wxPoint( nx, ny ); return VECTOR2I( nx, ny );
} }
const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const const VECTOR2I EDA_RECT::FarthestPointTo( const VECTOR2I& aPoint ) const
{ {
EDA_RECT me( *this ); EDA_RECT me( *this );
@ -308,16 +308,16 @@ const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const
int fx = std::max( std::abs( aPoint.x - me.GetLeft() ), std::abs( aPoint.x - me.GetRight() ) ); int fx = std::max( std::abs( aPoint.x - me.GetLeft() ), std::abs( aPoint.x - me.GetRight() ) );
int fy = std::max( std::abs( aPoint.y - me.GetTop() ), std::abs( aPoint.y - me.GetBottom() ) ); int fy = std::max( std::abs( aPoint.y - me.GetTop() ), std::abs( aPoint.y - me.GetBottom() ) );
return wxPoint( fx, fy ); return VECTOR2I( fx, fy );
} }
bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const bool EDA_RECT::IntersectsCircle( const VECTOR2I& aCenter, const int aRadius ) const
{ {
if( !m_init ) if( !m_init )
return false; return false;
wxPoint closest = ClosestPointTo( aCenter ); VECTOR2I closest = ClosestPointTo( aCenter );
double dx = static_cast<double>( aCenter.x ) - closest.x; double dx = static_cast<double>( aCenter.x ) - closest.x;
double dy = static_cast<double>( aCenter.y ) - closest.y; double dy = static_cast<double>( aCenter.y ) - closest.y;
@ -328,7 +328,7 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con
} }
bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, bool EDA_RECT::IntersectsCircleEdge( const VECTOR2I& aCenter, const int aRadius,
const int aWidth ) const const int aWidth ) const
{ {
if( !m_init ) if( !m_init )
@ -343,7 +343,7 @@ bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius,
return false; return false;
} }
wxPoint farpt = FarthestPointTo( aCenter ); VECTOR2I farpt = FarthestPointTo( aCenter );
// Farthest point must be further than the inside of the line // Farthest point must be further than the inside of the line
double fx = (double) farpt.x; double fx = (double) farpt.x;
double fy = (double) farpt.y; double fy = (double) farpt.y;
@ -457,12 +457,12 @@ void EDA_RECT::Merge( const EDA_RECT& aRect )
} }
void EDA_RECT::Merge( const wxPoint& aPoint ) void EDA_RECT::Merge( const VECTOR2I& aPoint )
{ {
if( !m_init ) if( !m_init )
{ {
m_pos = aPoint; m_pos = aPoint;
m_size = wxSize( 0, 0 ); m_size = VECTOR2I( 0, 0 );
m_init = true; m_init = true;
return; return;
} }

View File

@ -87,18 +87,18 @@ wxString EDA_SHAPE::SHAPE_T_asString() const
} }
void EDA_SHAPE::setPosition( const wxPoint& aPos ) void EDA_SHAPE::setPosition( const VECTOR2I& aPos )
{ {
move( aPos - getPosition() ); move( aPos - getPosition() );
} }
wxPoint EDA_SHAPE::getPosition() const VECTOR2I EDA_SHAPE::getPosition() const
{ {
if( m_shape == SHAPE_T::ARC ) if( m_shape == SHAPE_T::ARC )
return getCenter(); return getCenter();
else if( m_shape == SHAPE_T::POLY ) else if( m_shape == SHAPE_T::POLY )
return (wxPoint) m_poly.CVertex( 0 ); return m_poly.CVertex( 0 );
else else
return m_start; return m_start;
} }
@ -135,7 +135,7 @@ double EDA_SHAPE::GetLength() const
} }
void EDA_SHAPE::move( const wxPoint& aMoveVector ) void EDA_SHAPE::move( const VECTOR2I& aMoveVector )
{ {
switch ( m_shape ) switch ( m_shape )
{ {
@ -158,7 +158,7 @@ void EDA_SHAPE::move( const wxPoint& aMoveVector )
m_bezierC1 += aMoveVector; m_bezierC1 += aMoveVector;
m_bezierC2 += aMoveVector; m_bezierC2 += aMoveVector;
for( wxPoint& pt : m_bezierPoints) for( VECTOR2I& pt : m_bezierPoints )
pt += aMoveVector; pt += aMoveVector;
break; break;
@ -172,7 +172,7 @@ void EDA_SHAPE::move( const wxPoint& aMoveVector )
void EDA_SHAPE::scale( double aScale ) void EDA_SHAPE::scale( double aScale )
{ {
auto scalePt = [&]( wxPoint& pt ) auto scalePt = [&]( VECTOR2I& pt )
{ {
pt.x = KiROUND( pt.x * aScale ); pt.x = KiROUND( pt.x * aScale );
pt.y = KiROUND( pt.y * aScale ); pt.y = KiROUND( pt.y * aScale );
@ -196,7 +196,7 @@ void EDA_SHAPE::scale( double aScale )
case SHAPE_T::POLY: // polygon case SHAPE_T::POLY: // polygon
{ {
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() ) for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
{ {
@ -222,27 +222,27 @@ void EDA_SHAPE::scale( double aScale )
} }
void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle ) void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
{ {
switch( m_shape ) switch( m_shape )
{ {
case SHAPE_T::SEGMENT: case SHAPE_T::SEGMENT:
case SHAPE_T::CIRCLE: case SHAPE_T::CIRCLE:
RotatePoint( &m_start, aRotCentre, aAngle ); RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle ); RotatePoint( m_end, aRotCentre, aAngle );
break; break;
case SHAPE_T::ARC: case SHAPE_T::ARC:
RotatePoint( &m_start, aRotCentre, aAngle ); RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle ); RotatePoint( m_end, aRotCentre, aAngle );
RotatePoint( &m_arcCenter, aRotCentre, aAngle ); RotatePoint( m_arcCenter, aRotCentre, aAngle );
break; break;
case SHAPE_T::RECT: case SHAPE_T::RECT:
if( KiROUND( aAngle ) % 900 == 0 ) if( KiROUND( aAngle ) % 900 == 0 )
{ {
RotatePoint( &m_start, aRotCentre, aAngle ); RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle ); RotatePoint( m_end, aRotCentre, aAngle );
break; break;
} }
@ -262,13 +262,13 @@ void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle )
break; break;
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
RotatePoint( &m_start, aRotCentre, aAngle); RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle); RotatePoint( m_end, aRotCentre, aAngle );
RotatePoint( &m_bezierC1, aRotCentre, aAngle); RotatePoint( m_bezierC1, aRotCentre, aAngle );
RotatePoint( &m_bezierC2, aRotCentre, aAngle); RotatePoint( m_bezierC2, aRotCentre, aAngle );
for( wxPoint& pt : m_bezierPoints ) for( VECTOR2I& pt : m_bezierPoints )
RotatePoint( &pt, aRotCentre, aAngle); RotatePoint( pt, aRotCentre, aAngle);
break; break;
@ -279,7 +279,7 @@ void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle )
} }
void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight ) void EDA_SHAPE::flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
{ {
switch ( m_shape ) switch ( m_shape )
{ {
@ -330,7 +330,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
break; break;
case SHAPE_T::POLY: case SHAPE_T::POLY:
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, VECTOR2I( aCentre ) ); m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, aCentre );
break; break;
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
@ -351,7 +351,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
// Rebuild the poly points shape // Rebuild the poly points shape
{ {
std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; std::vector<VECTOR2I> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
BEZIER_POLY converter( ctrlPoints ); BEZIER_POLY converter( ctrlPoints );
converter.GetPoly( m_bezierPoints, m_stroke.GetWidth() ); converter.GetPoly( m_bezierPoints, m_stroke.GetWidth() );
} }
@ -378,12 +378,12 @@ void EDA_SHAPE::RebuildBezierToSegmentsPointsList( int aMinSegLen )
} }
const std::vector<wxPoint> EDA_SHAPE::buildBezierToSegmentsPointsList( int aMinSegLen ) const const std::vector<VECTOR2I> EDA_SHAPE::buildBezierToSegmentsPointsList( int aMinSegLen ) const
{ {
std::vector<wxPoint> bezierPoints; std::vector<VECTOR2I> bezierPoints;
// Rebuild the m_BezierPoints vertex list that approximate the Bezier curve // Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end }; std::vector<VECTOR2I> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
BEZIER_POLY converter( ctrlPoints ); BEZIER_POLY converter( ctrlPoints );
converter.GetPoly( bezierPoints, aMinSegLen ); converter.GetPoly( bezierPoints, aMinSegLen );
@ -391,7 +391,7 @@ const std::vector<wxPoint> EDA_SHAPE::buildBezierToSegmentsPointsList( int aMinS
} }
wxPoint EDA_SHAPE::getCenter() const VECTOR2I EDA_SHAPE::getCenter() const
{ {
switch( m_shape ) switch( m_shape )
{ {
@ -408,16 +408,16 @@ wxPoint EDA_SHAPE::getCenter() const
case SHAPE_T::POLY: case SHAPE_T::POLY:
case SHAPE_T::RECT: case SHAPE_T::RECT:
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
return (wxPoint)getBoundingBox().Centre(); return getBoundingBox().Centre();
default: default:
UNIMPLEMENTED_FOR( SHAPE_T_asString() ); UNIMPLEMENTED_FOR( SHAPE_T_asString() );
return wxPoint(); return VECTOR2I();
} }
} }
void EDA_SHAPE::SetCenter( const wxPoint& aCenter ) void EDA_SHAPE::SetCenter( const VECTOR2I& aCenter )
{ {
switch( m_shape ) switch( m_shape )
{ {
@ -435,10 +435,10 @@ void EDA_SHAPE::SetCenter( const wxPoint& aCenter )
} }
wxPoint EDA_SHAPE::GetArcMid() const VECTOR2I EDA_SHAPE::GetArcMid() const
{ {
wxPoint mid = m_start; VECTOR2I mid = m_start;
RotatePoint( &mid, m_arcCenter, -GetArcAngle() / 2.0 ); RotatePoint( mid, m_arcCenter, -GetArcAngle() / 2.0 );
return mid; return mid;
} }
@ -487,7 +487,7 @@ int EDA_SHAPE::GetRadius() const
} }
void EDA_SHAPE::SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd ) void EDA_SHAPE::SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd )
{ {
m_start = aStart; m_start = aStart;
m_end = aEnd; m_end = aEnd;
@ -499,7 +499,7 @@ void EDA_SHAPE::SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, cons
* on the other side of the arc. In this case, we need to flip the start/end points and flag this * on the other side of the arc. In this case, we need to flip the start/end points and flag this
* change for the system * change for the system
*/ */
wxPoint new_mid = GetArcMid(); VECTOR2I new_mid = GetArcMid();
VECTOR2D dist( new_mid - aMid ); VECTOR2D dist( new_mid - aMid );
VECTOR2D dist2( new_mid - m_arcCenter ); VECTOR2D dist2( new_mid - m_arcCenter );
@ -526,7 +526,7 @@ double EDA_SHAPE::GetArcAngle() const
void EDA_SHAPE::SetArcAngleAndEnd( double aAngle, bool aCheckNegativeAngle ) void EDA_SHAPE::SetArcAngleAndEnd( double aAngle, bool aCheckNegativeAngle )
{ {
m_end = m_start; m_end = m_start;
RotatePoint( &m_end, m_arcCenter, -NormalizeAngle360Max( aAngle ) ); RotatePoint( m_end, m_arcCenter, -NormalizeAngle360Max( aAngle ) );
if( aCheckNegativeAngle && aAngle < 0 ) if( aCheckNegativeAngle && aAngle < 0 )
{ {
@ -617,7 +617,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
switch( m_shape ) switch( m_shape )
{ {
case SHAPE_T::RECT: case SHAPE_T::RECT:
for( wxPoint& pt : GetRectCorners() ) for( VECTOR2I& pt : GetRectCorners() )
bbox.Merge( pt ); bbox.Merge( pt );
break; break;
@ -642,9 +642,9 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
for( auto iter = m_poly.CIterate(); iter; iter++ ) for( auto iter = m_poly.CIterate(); iter; iter++ )
{ {
wxPoint pt( iter->x, iter->y ); VECTOR2I pt( iter->x, iter->y );
RotatePoint( &pt, getParentOrientation() ); RotatePoint( pt, getParentOrientation() );
pt += getParentPosition(); pt += getParentPosition();
bbox.Merge( pt ); bbox.Merge( pt );
@ -671,7 +671,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
} }
bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
int maxdist = aAccuracy; int maxdist = aAccuracy;
@ -699,9 +699,9 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
if( EuclideanNorm( aPosition - m_end ) <= maxdist ) if( EuclideanNorm( aPosition - m_end ) <= maxdist )
return true; return true;
wxPoint relPos = aPosition - getCenter(); VECTOR2I relPos = aPosition - getCenter();
int radius = GetRadius(); int radius = GetRadius();
int dist = KiROUND( EuclideanNorm( relPos ) ); int dist = KiROUND( EuclideanNorm( relPos ) );
if( abs( radius - dist ) <= maxdist ) if( abs( radius - dist ) <= maxdist )
{ {
@ -747,14 +747,14 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
SHAPE_POLY_SET poly; SHAPE_POLY_SET poly;
poly.NewOutline(); poly.NewOutline();
for( const wxPoint& pt : GetRectCorners() ) for( const VECTOR2I& pt : GetRectCorners() )
poly.Append( pt ); poly.Append( pt );
return poly.Collide( VECTOR2I( aPosition ), maxdist ); return poly.Collide( VECTOR2I( aPosition ), maxdist );
} }
else // Open rect hit-test else // Open rect hit-test
{ {
std::vector<wxPoint> pts = GetRectCorners(); std::vector<VECTOR2I> pts = GetRectCorners();
return TestSegmentHit( aPosition, pts[0], pts[1], maxdist ) return TestSegmentHit( aPosition, pts[0], pts[1], maxdist )
|| TestSegmentHit( aPosition, pts[1], pts[2], maxdist ) || TestSegmentHit( aPosition, pts[1], pts[2], maxdist )
@ -836,7 +836,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
} }
else else
{ {
std::vector<wxPoint> pts = GetRectCorners(); std::vector<VECTOR2I> pts = GetRectCorners();
// Account for the width of the lines // Account for the width of the lines
arect.Inflate( GetWidth() / 2 ); arect.Inflate( GetWidth() / 2 );
@ -877,7 +877,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
// Therefore, instead of using m_poly, we make a copy which is translated // Therefore, instead of using m_poly, we make a copy which is translated
// to the actual location in the board. // to the actual location in the board.
double orientation = 0.0; double orientation = 0.0;
wxPoint offset = getParentPosition(); VECTOR2I offset = getParentPosition();
if( getParentOrientation() ) if( getParentOrientation() )
orientation = -DECIDEG2RAD( getParentOrientation() ); orientation = -DECIDEG2RAD( getParentOrientation() );
@ -893,7 +893,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I vertex = poly.GetPoint( ii ); VECTOR2I vertex = poly.GetPoint( ii );
// Test if the point is within aRect // Test if the point is within aRect
if( arect.Contains( ( wxPoint ) vertex ) ) if( arect.Contains( vertex ) )
return true; return true;
if( ii + 1 < count ) if( ii + 1 < count )
@ -901,7 +901,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I vertexNext = poly.GetPoint( ii + 1 ); VECTOR2I vertexNext = poly.GetPoint( ii + 1 );
// Test if this edge intersects aRect // Test if this edge intersects aRect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) ) if( arect.Intersects( vertex, vertexNext ) )
return true; return true;
} }
else if( poly.IsClosed() ) else if( poly.IsClosed() )
@ -909,7 +909,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I vertexNext = poly.GetPoint( 0 ); VECTOR2I vertexNext = poly.GetPoint( 0 );
// Test if this edge intersects aRect // Test if this edge intersects aRect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) ) if( arect.Intersects( vertex, vertexNext ) )
return true; return true;
} }
} }
@ -935,11 +935,11 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
for( unsigned ii = 1; ii < count; ii++ ) for( unsigned ii = 1; ii < count; ii++ )
{ {
wxPoint vertex = m_bezierPoints[ ii - 1]; VECTOR2I vertex = m_bezierPoints[ii - 1];
wxPoint vertexNext = m_bezierPoints[ii]; VECTOR2I vertexNext = m_bezierPoints[ii];
// Test if the point is within aRect // Test if the point is within aRect
if( arect.Contains( ( wxPoint ) vertex ) ) if( arect.Contains( vertex ) )
return true; return true;
// Test if this edge intersects aRect // Test if this edge intersects aRect
@ -957,20 +957,20 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
} }
std::vector<wxPoint> EDA_SHAPE::GetRectCorners() const std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
{ {
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
wxPoint topLeft = GetStart(); VECTOR2I topLeft = GetStart();
wxPoint botRight = GetEnd(); VECTOR2I botRight = GetEnd();
// Un-rotate rect topLeft and botRight // Un-rotate rect topLeft and botRight
if( KiROUND( getParentOrientation() ) % 900 != 0 ) if( KiROUND( getParentOrientation() ) % 900 != 0 )
{ {
topLeft -= getParentPosition(); topLeft -= getParentPosition();
RotatePoint( &topLeft, -getParentOrientation() ); RotatePoint( topLeft, -getParentOrientation() );
botRight -= getParentPosition(); botRight -= getParentPosition();
RotatePoint( &botRight, -getParentOrientation() ); RotatePoint( botRight, -getParentOrientation() );
} }
// Set up the un-rotated 4 corners // Set up the un-rotated 4 corners
@ -982,9 +982,9 @@ std::vector<wxPoint> EDA_SHAPE::GetRectCorners() const
// Now re-rotate the 4 corners to get a diamond // Now re-rotate the 4 corners to get a diamond
if( KiROUND( getParentOrientation() ) % 900 != 0 ) if( KiROUND( getParentOrientation() ) % 900 != 0 )
{ {
for( wxPoint& pt : pts ) for( VECTOR2I& pt : pts )
{ {
RotatePoint( &pt, getParentOrientation() ); RotatePoint( pt, getParentOrientation() );
pt += getParentPosition(); pt += getParentPosition();
} }
} }
@ -995,8 +995,8 @@ std::vector<wxPoint> EDA_SHAPE::GetRectCorners() const
void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
{ {
wxPoint start = m_start; VECTOR2I start = m_start;
wxPoint end = m_end; VECTOR2I end = m_end;
double t1, t2; double t1, t2;
CalcArcAngles( t1, t2 ); CalcArcAngles( t1, t2 );
@ -1049,10 +1049,10 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
{ {
switch( quarter ) switch( quarter )
{ {
case 0: aBBox.Merge( wxPoint( m_arcCenter.x, m_arcCenter.y + radius ) ); break; // down case 0: aBBox.Merge( VECTOR2I( m_arcCenter.x, m_arcCenter.y + radius ) ); break; // down
case 1: aBBox.Merge( wxPoint( m_arcCenter.x - radius, m_arcCenter.y ) ); break; // left case 1: aBBox.Merge( VECTOR2I( m_arcCenter.x - radius, m_arcCenter.y ) ); break; // left
case 2: aBBox.Merge( wxPoint( m_arcCenter.x, m_arcCenter.y - radius ) ); break; // up case 2: aBBox.Merge( VECTOR2I( m_arcCenter.x, m_arcCenter.y - radius ) ); break; // up
case 3: aBBox.Merge( wxPoint( m_arcCenter.x + radius, m_arcCenter.y ) ); break; // right case 3: aBBox.Merge( VECTOR2I( m_arcCenter.x + radius, m_arcCenter.y ) ); break; // right
} }
++quarter %= 4; ++quarter %= 4;
@ -1061,12 +1061,12 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
} }
void EDA_SHAPE::SetPolyPoints( const std::vector<wxPoint>& aPoints ) void EDA_SHAPE::SetPolyPoints( const std::vector<VECTOR2I>& aPoints )
{ {
m_poly.RemoveAllContours(); m_poly.RemoveAllContours();
m_poly.NewOutline(); m_poly.NewOutline();
for ( const wxPoint& p : aPoints ) for( const VECTOR2I& p : aPoints )
m_poly.Append( p.x, p.y ); m_poly.Append( p.x, p.y );
} }
@ -1088,7 +1088,7 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
case SHAPE_T::RECT: case SHAPE_T::RECT:
{ {
std::vector<wxPoint> pts = GetRectCorners(); std::vector<VECTOR2I> pts = GetRectCorners();
if( IsFilled() && !aEdgeOnly ) if( IsFilled() && !aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) ); effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) );
@ -1116,12 +1116,12 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
{ {
std::vector<wxPoint> bezierPoints = buildBezierToSegmentsPointsList( GetWidth() ); std::vector<VECTOR2I> bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
wxPoint start_pt = bezierPoints[0]; VECTOR2I start_pt = bezierPoints[0];
for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ ) for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ )
{ {
wxPoint end_pt = bezierPoints[jj]; VECTOR2I end_pt = bezierPoints[jj];
effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, GetWidth() ) ); effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, GetWidth() ) );
start_pt = end_pt; start_pt = end_pt;
} }
@ -1156,7 +1156,7 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
} }
void EDA_SHAPE::DupPolyPointsList( std::vector<wxPoint>& aBuffer ) const void EDA_SHAPE::DupPolyPointsList( std::vector<VECTOR2I>& aBuffer ) const
{ {
if( m_poly.OutlineCount() ) if( m_poly.OutlineCount() )
{ {
@ -1196,7 +1196,7 @@ int EDA_SHAPE::GetPointCount() const
} }
void EDA_SHAPE::beginEdit( const wxPoint& aPosition ) void EDA_SHAPE::beginEdit( const VECTOR2I& aPosition )
{ {
switch( GetShape() ) switch( GetShape() )
{ {
@ -1227,7 +1227,7 @@ void EDA_SHAPE::beginEdit( const wxPoint& aPosition )
} }
bool EDA_SHAPE::continueEdit( const wxPoint& aPosition ) bool EDA_SHAPE::continueEdit( const VECTOR2I& aPosition )
{ {
switch( GetShape() ) switch( GetShape() )
{ {
@ -1254,7 +1254,7 @@ bool EDA_SHAPE::continueEdit( const wxPoint& aPosition )
} }
void EDA_SHAPE::calcEdit( const wxPoint& aPosition ) void EDA_SHAPE::calcEdit( const VECTOR2I& aPosition )
{ {
#define sq( x ) pow( x, 2 ) #define sq( x ) pow( x, 2 )
@ -1291,7 +1291,7 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
case 2: case 2:
case 3: case 3:
{ {
wxPoint v = m_start - m_end; VECTOR2I v = m_start - m_end;
double chordBefore = sq( v.x ) + sq( v.y ); double chordBefore = sq( v.x ) + sq( v.y );
if( m_editState == 2 ) if( m_editState == 2 )
@ -1328,15 +1328,15 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
// //
// Let 'l' be the length of the chord and 'm' the middle point of the chord // Let 'l' be the length of the chord and 'm' the middle point of the chord
double l = GetLineLength( m_start, m_end ); double l = GetLineLength( m_start, m_end );
wxPoint m = ( m_start + m_end ) / 2; VECTOR2I m = ( m_start + m_end ) / 2;
// Calculate 'd', the vector from the chord midpoint to the center // Calculate 'd', the vector from the chord midpoint to the center
wxPoint d; VECTOR2I d;
d.x = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_start.y - m_end.y ) / l ); d.x = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_start.y - m_end.y ) / l );
d.y = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_end.x - m_start.x ) / l ); d.y = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_end.x - m_start.x ) / l );
wxPoint c1 = m + d; VECTOR2I c1 = m + d;
wxPoint c2 = m - d; VECTOR2I c2 = m - d;
// Solution gives us 2 centers; we need to pick one: // Solution gives us 2 centers; we need to pick one:
switch( m_editState ) switch( m_editState )
@ -1344,12 +1344,12 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
case 1: case 1:
{ {
// Keep center clockwise from chord while drawing // Keep center clockwise from chord while drawing
wxPoint chordVector = m_end - m_start; VECTOR2I chordVector = m_end - m_start;
double chordAngle = ArcTangente( chordVector.y, chordVector.x ); double chordAngle = ArcTangente( chordVector.y, chordVector.x );
NORMALIZE_ANGLE_POS( chordAngle ); NORMALIZE_ANGLE_POS( chordAngle );
wxPoint c1Test = c1; VECTOR2I c1Test = c1;
RotatePoint( &c1Test, m_start, -chordAngle ); RotatePoint( c1Test, m_start, -chordAngle );
m_arcCenter = c1Test.x > 0 ? c2 : c1; m_arcCenter = c1Test.x > 0 ? c2 : c1;
} }
@ -1500,13 +1500,13 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
case SHAPE_T::RECT: case SHAPE_T::RECT:
{ {
std::vector<wxPoint> pts = GetRectCorners(); std::vector<VECTOR2I> pts = GetRectCorners();
if( IsFilled() ) if( IsFilled() )
{ {
aCornerBuffer.NewOutline(); aCornerBuffer.NewOutline();
for( const wxPoint& pt : pts ) for( const VECTOR2I& pt : pts )
aCornerBuffer.Append( pt ); aCornerBuffer.Append( pt );
} }
@ -1538,15 +1538,15 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
// The polygon is expected to be a simple polygon; not self intersecting, no hole. // The polygon is expected to be a simple polygon; not self intersecting, no hole.
double orientation = getParentOrientation(); double orientation = getParentOrientation();
wxPoint offset = getParentPosition(); VECTOR2I offset = getParentPosition();
// Build the polygon with the actual position and orientation: // Build the polygon with the actual position and orientation:
std::vector<wxPoint> poly; std::vector<VECTOR2I> poly;
DupPolyPointsList( poly ); DupPolyPointsList( poly );
for( wxPoint& point : poly ) for( VECTOR2I& point : poly )
{ {
RotatePoint( &point, orientation ); RotatePoint( point, orientation );
point += offset; point += offset;
} }
@ -1554,15 +1554,15 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
{ {
aCornerBuffer.NewOutline(); aCornerBuffer.NewOutline();
for( const wxPoint& point : poly ) for( const VECTOR2I& point : poly )
aCornerBuffer.Append( point.x, point.y ); aCornerBuffer.Append( point.x, point.y );
} }
if( width > 0 || !IsFilled() ) if( width > 0 || !IsFilled() )
{ {
wxPoint pt1( poly[ poly.size() - 1] ); VECTOR2I pt1( poly[poly.size() - 1] );
for( const wxPoint& pt2 : poly ) for( const VECTOR2I& pt2 : poly )
{ {
if( pt2 != pt1 ) if( pt2 != pt1 )
TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc ); TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc );
@ -1576,9 +1576,9 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
case SHAPE_T::BEZIER: case SHAPE_T::BEZIER:
{ {
std::vector<wxPoint> ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() }; std::vector<VECTOR2I> ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() };
BEZIER_POLY converter( ctrlPts ); BEZIER_POLY converter( ctrlPts );
std::vector< wxPoint> poly; std::vector<VECTOR2I> poly;
converter.GetPoly( poly, GetWidth() ); converter.GetPoly( poly, GetWidth() );
for( unsigned ii = 1; ii < poly.size(); ii++ ) for( unsigned ii = 1; ii < poly.size(); ii++ )

View File

@ -65,7 +65,7 @@ class wxFindReplaceData;
void addTextSegmToPoly( int x0, int y0, int xf, int yf, void* aData ) void addTextSegmToPoly( int x0, int y0, int xf, int yf, void* aData )
{ {
TSEGM_2_POLY_PRMS* prm = static_cast<TSEGM_2_POLY_PRMS*>( aData ); TSEGM_2_POLY_PRMS* prm = static_cast<TSEGM_2_POLY_PRMS*>( aData );
TransformOvalToPolygon( *prm->m_cornerBuffer, wxPoint( x0, y0 ), wxPoint( xf, yf ), TransformOvalToPolygon( *prm->m_cornerBuffer, VECTOR2I( x0, y0 ), VECTOR2I( xf, yf ),
prm->m_textWidth, prm->m_error, ERROR_INSIDE ); prm->m_textWidth, prm->m_error, ERROR_INSIDE );
} }
@ -304,7 +304,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
extra_height += thickness / 2; extra_height += thickness / 2;
textsize.y += extra_height; textsize.y += extra_height;
rect.Move( wxPoint( 0, -extra_height ) ); rect.Move( VECTOR2I( 0, -extra_height ) );
} }
// for multiline texts and aLine < 0, merge all rectangles // for multiline texts and aLine < 0, merge all rectangles
@ -391,7 +391,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
} }
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const bool EDA_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
{ {
EDA_RECT rect = GetTextBox(); EDA_RECT rect = GetTextBox();
VECTOR2I location = aPoint; VECTOR2I location = aPoint;
@ -416,12 +416,12 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
} }
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
const COLOR4D& aColor, OUTLINE_MODE aFillMode ) const COLOR4D& aColor, OUTLINE_MODE aFillMode )
{ {
if( IsMultilineAllowed() ) if( IsMultilineAllowed() )
{ {
std::vector<wxPoint> positions; std::vector<VECTOR2I> positions;
wxArrayString strings; wxArrayString strings;
wxStringSplit( GetShownText(), strings, '\n' ); wxStringSplit( GetShownText(), strings, '\n' );
@ -439,12 +439,12 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
} }
void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const void EDA_TEXT::GetLinePositions( std::vector<VECTOR2I>& aPositions, int aLineCount ) const
{ {
VECTOR2I 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 // to the center of the multiline text block
wxPoint offset; // Offset to next line. VECTOR2I offset; // Offset to next line.
offset.y = GetInterline(); offset.y = GetInterline();
@ -469,11 +469,11 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
RotatePoint( pos, GetTextPos(), GetTextAngle() ); RotatePoint( pos, GetTextPos(), GetTextAngle() );
// Rotate the offset lines to increase happened in the right direction // Rotate the offset lines to increase happened in the right direction
RotatePoint( &offset, GetTextAngle() ); RotatePoint( offset, GetTextAngle() );
for( int ii = 0; ii < aLineCount; ii++ ) for( int ii = 0; ii < aLineCount; ii++ )
{ {
aPositions.push_back( (wxPoint) pos ); aPositions.push_back( (VECTOR2I) pos );
pos += offset; pos += offset;
} }
} }
@ -599,21 +599,21 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
} }
// Convert the text shape to a list of segment // Convert the text shape to a list of segment
// each segment is stored as 2 wxPoints: its starting point and its ending point // each segment is stored as 2 VECTOR2Is: its starting point and its ending point
// we are using GRText to create the segments and therefore a call-back function is needed // we are using GRText to create the segments and therefore a call-back function is needed
// This is a call back function, used by GRText to put each segment in buffer // This is a call back function, used by GRText to put each segment in buffer
static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData ) static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData )
{ {
std::vector<wxPoint>* cornerBuffer = static_cast<std::vector<wxPoint>*>( aData ); std::vector<VECTOR2I>* cornerBuffer = static_cast<std::vector<VECTOR2I>*>( aData );
cornerBuffer->push_back( wxPoint( x0, y0 ) ); cornerBuffer->push_back( VECTOR2I( x0, y0 ) );
cornerBuffer->push_back( wxPoint( xf, yf ) ); cornerBuffer->push_back( VECTOR2I( xf, yf ) );
} }
std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const std::vector<VECTOR2I> EDA_TEXT::TransformToSegmentList() const
{ {
std::vector<wxPoint> cornerBuffer; std::vector<VECTOR2I> cornerBuffer;
wxSize size = GetTextSize(); wxSize size = GetTextSize();
if( IsMirrored() ) if( IsMirrored() )
@ -628,7 +628,7 @@ std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const
{ {
wxArrayString strings_list; wxArrayString strings_list;
wxStringSplit( GetShownText(), strings_list, wxChar('\n') ); wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
std::vector<wxPoint> positions; std::vector<VECTOR2I> positions;
positions.reserve( strings_list.Count() ); positions.reserve( strings_list.Count() );
GetLinePositions( positions, strings_list.Count() ); GetLinePositions( positions, strings_list.Count() );
@ -654,8 +654,8 @@ std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const
std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const
{ {
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>(); std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
int penWidth = GetEffectiveTextPenWidth(); int penWidth = GetEffectiveTextPenWidth();
std::vector<wxPoint> pts = TransformToSegmentList(); std::vector<VECTOR2I> pts = TransformToSegmentList();
for( unsigned jj = 0; jj < pts.size(); jj += 2 ) for( unsigned jj = 0; jj < pts.size(); jj += 2 )
shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) ); shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );

View File

@ -63,7 +63,7 @@ static const bool NOT_FILLED = false;
GR_DRAWMODE g_XorMode = GR_NXOR; GR_DRAWMODE g_XorMode = GR_NXOR;
static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const wxPoint* Points, int n ); static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I* Points, int n );
/* These functions are used by corresponding functions /* These functions are used by corresponding functions
* ( GRSCircle is called by GRCircle for instance) after mapping coordinates * ( GRSCircle is called by GRCircle for instance) after mapping coordinates
@ -204,8 +204,8 @@ void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi
} }
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const COLOR4D& aColor, wxPenStyle aStyle ) int aWidth, const COLOR4D& aColor, wxPenStyle aStyle )
{ {
GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle ); GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
} }
@ -315,8 +315,8 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w
} }
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth, void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const COLOR4D& aColor ) int aWidth, const COLOR4D& aColor )
{ {
GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor ); GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor );
} }
@ -330,14 +330,14 @@ void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, i
} }
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aWidth, const COLOR4D& aColor ) int aWidth, const COLOR4D& aColor )
{ {
GRSetColorPen( aDC, aColor, aWidth ); GRSetColorPen( aDC, aColor, aWidth );
WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth ); WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth );
} }
static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points ) static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const VECTOR2I* Points )
{ {
if( !ClipBox ) if( !ClipBox )
return true; return true;
@ -379,7 +379,7 @@ static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points )
/** /**
* Draw a new polyline and fill it if Fill, in screen space. * Draw a new polyline and fill it if Fill, in screen space.
*/ */
static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill,
int width, const COLOR4D& Color, const COLOR4D& BgColor ) int width, const COLOR4D& Color, const COLOR4D& BgColor )
{ {
if( !IsGRSPolyDrawable( ClipBox, n, Points ) ) if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
@ -412,7 +412,7 @@ static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points,
/** /**
* Draw a new closed polyline and fill it if Fill, in screen space. * Draw a new closed polyline and fill it if Fill, in screen space.
*/ */
static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints, static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const VECTOR2I* aPoints,
bool aFill, int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor ) bool aFill, int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor )
{ {
if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) ) if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) )
@ -450,7 +450,7 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const
/** /**
* Draw a new polyline and fill it if Fill, in drawing space. * Draw a new polyline and fill it if Fill, in drawing space.
*/ */
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width, void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width,
const COLOR4D& Color, const COLOR4D& BgColor ) const COLOR4D& Color, const COLOR4D& BgColor )
{ {
GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor ); GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
@ -460,14 +460,14 @@ void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fil
/** /**
* Draw a closed polyline and fill it if Fill, in object space. * Draw a closed polyline and fill it if Fill, in object space.
*/ */
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill,
const COLOR4D& Color, const COLOR4D& BgColor ) const COLOR4D& Color, const COLOR4D& BgColor )
{ {
GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor ); GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
} }
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width, void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width,
const COLOR4D& Color, const COLOR4D& BgColor ) const COLOR4D& Color, const COLOR4D& BgColor )
{ {
GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor ); GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
@ -515,7 +515,7 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int r, int width, co
} }
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth, void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, int aWidth,
const COLOR4D& aColor ) const COLOR4D& aColor )
{ {
GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor ); GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor );
@ -534,7 +534,7 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width
} }
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius,
const COLOR4D& aColor ) const COLOR4D& aColor )
{ {
GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor ); GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor );
@ -573,16 +573,17 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc
} }
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const wxPoint& aCenter, int aWidth, const COLOR4D& aColor ) const VECTOR2I& aCenter, int aWidth, const COLOR4D& aColor )
{ {
GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y, GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y,
aWidth, aColor ); aWidth, aColor );
} }
void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const wxPoint& aStart, const wxPoint& aEnd, void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const wxPoint& aCenter, int width, const COLOR4D& Color, const COLOR4D& BgColor ) const VECTOR2I& aCenter, int width, const COLOR4D& Color,
const COLOR4D& BgColor )
{ {
/* Clip arcs off screen. */ /* Clip arcs off screen. */
if( ClipBox ) if( ClipBox )
@ -722,11 +723,11 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth, void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth,
const COLOR4D& aColor ) const COLOR4D& aColor )
{ {
wxPoint points[5]; VECTOR2I points[5];
points[0] = wxPoint( x1, y1 ); points[0] = VECTOR2I( x1, y1 );
points[1] = wxPoint( x1, y2 ); points[1] = VECTOR2I( x1, y2 );
points[2] = wxPoint( x2, y2 ); points[2] = VECTOR2I( x2, y2 );
points[3] = wxPoint( x2, y1 ); points[3] = VECTOR2I( x2, y1 );
points[4] = points[0]; points[4] = points[0];
GRSClosedPoly( aClipBox, aDC, 5, points, NOT_FILLED, aWidth, aColor, aColor ); GRSClosedPoly( aClipBox, aDC, 5, points, NOT_FILLED, aWidth, aColor, aColor );
} }
@ -735,11 +736,11 @@ void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth, void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth,
const COLOR4D& aColor, const COLOR4D& aBgColor ) const COLOR4D& aColor, const COLOR4D& aBgColor )
{ {
wxPoint points[5]; VECTOR2I points[5];
points[0] = wxPoint( x1, y1 ); points[0] = VECTOR2I( x1, y1 );
points[1] = wxPoint( x1, y2 ); points[1] = VECTOR2I( x1, y2 );
points[2] = wxPoint( x2, y2 ); points[2] = VECTOR2I( x2, y2 );
points[3] = wxPoint( x2, y1 ); points[3] = VECTOR2I( x2, y1 );
points[4] = points[0]; points[4] = points[0];
GRSetBrush( aDC, aBgColor, FILLED ); GRSetBrush( aDC, aBgColor, FILLED );
@ -768,16 +769,29 @@ void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y
#include <SutherlandHodgmanClipPoly.h> #include <SutherlandHodgmanClipPoly.h>
void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint* Points, int n ) static void vector2IwxDrawPolygon( wxDC* aDC, const VECTOR2I* Points, int n )
{
wxPoint* points = new wxPoint[n];
for( int i = 0; i < n; i++ )
{
points[i] = wxPoint( Points[i].x, Points[i].y );
}
aDC->DrawPolygon( n, points );
delete[] points;
}
void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I* Points, int n )
{ {
if( aClipBox == nullptr ) if( aClipBox == nullptr )
{ {
aDC->DrawPolygon( n, Points ); vector2IwxDrawPolygon( aDC, Points, n );
return; return;
} }
// A clip box exists: clip and draw the polygon. // A clip box exists: clip and draw the polygon.
static std::vector<wxPoint> clippedPolygon; static std::vector<VECTOR2I> clippedPolygon;
static pointVector inputPolygon, outputPolygon; static pointVector inputPolygon, outputPolygon;
inputPolygon.clear(); inputPolygon.clear();
@ -799,7 +813,7 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint* Points, int
} }
if( clippedPolygon.size() ) if( clippedPolygon.size() )
aDC->DrawPolygon( clippedPolygon.size(), &clippedPolygon[0] ); vector2IwxDrawPolygon( aDC, &clippedPolygon[0], clippedPolygon.size() );
} }

View File

@ -87,7 +87,7 @@ MARKER_BASE::~MARKER_BASE()
} }
bool MARKER_BASE::HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) const bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const
{ {
EDA_RECT bbox = GetBoundingBoxMarker(); EDA_RECT bbox = GetBoundingBoxMarker();
bbox.Inflate( aAccuracy ); bbox.Inflate( aAccuracy );
@ -134,12 +134,12 @@ EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
} }
void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
// Build the marker shape polygon in internal units: // Build the marker shape polygon in internal units:
std::vector<wxPoint> shape; std::vector<VECTOR2I> shape;
shape.reserve( CORNERS_COUNT ); shape.reserve( CORNERS_COUNT );
for( const VECTOR2I& corner : MarkerShapeCorners ) for( const VECTOR2I& corner : MarkerShapeCorners )

View File

@ -267,12 +267,12 @@ NODE_MAP MapChildren( wxXmlNode* aCurrentNode )
} }
wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ) VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle )
{ {
// Eagle give us start and end. // Eagle give us start and end.
// S_ARC wants start to give the center, and end to give the start. // S_ARC wants start to give the center, and end to give the start.
double dx = aEnd.x - aStart.x, dy = aEnd.y - aStart.y; double dx = aEnd.x - aStart.x, dy = aEnd.y - aStart.y;
wxPoint mid = ( aStart + aEnd ) / 2; VECTOR2I mid = ( aStart + aEnd ) / 2;
double dlen = sqrt( dx*dx + dy*dy ); double dlen = sqrt( dx*dx + dy*dy );
@ -285,7 +285,7 @@ wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAn
double dist = dlen / ( 2 * tan( DEG2RAD( aAngle ) / 2 ) ); double dist = dlen / ( 2 * tan( DEG2RAD( aAngle ) / 2 ) );
wxPoint center( VECTOR2I center(
mid.x + dist * ( dy / dlen ), mid.x + dist * ( dy / dlen ),
mid.y - dist * ( dx / dlen ) mid.y - dist * ( dx / dlen )
); );

View File

@ -358,7 +358,7 @@ public:
NODE_MAP MapChildren( wxXmlNode* aCurrentNode ); NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
///< Convert an Eagle curve end to a KiCad center for S_ARC ///< Convert an Eagle curve end to a KiCad center for S_ARC
wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ); VECTOR2I ConvertArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double aAngle );
// Pre-declare for typedefs // Pre-declare for typedefs
struct EROT; struct EROT;

View File

@ -44,7 +44,7 @@ wxString RC_ITEM::GetErrorMessage() const
} }
wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos ) wxString RC_ITEM::ShowCoord( EDA_UNITS aUnits, const VECTOR2I& aPos )
{ {
return wxString::Format( "@(%s, %s)", return wxString::Format( "@(%s, %s)",
MessageTextFromValue( aUnits, aPos.x ), MessageTextFromValue( aUnits, aPos.x ),

View File

@ -90,7 +90,7 @@ VECTOR2I SELECTION::GetCenter() const
if( hasOnlyText ) if( hasOnlyText )
{ {
wxPoint center( 0, 0 ); VECTOR2I center( 0, 0 );
for( EDA_ITEM* item : m_items ) for( EDA_ITEM* item : m_items )
center += item->GetPosition(); center += item->GetPosition();

View File

@ -410,7 +410,7 @@ protected:
if( line && !side.x ) if( line && !side.x )
{ {
wxPoint start = line->GetStartPoint(), end = line->GetEndPoint(); VECTOR2I start = line->GetStartPoint(), end = line->GetEndPoint();
if( start.y == end.y && collision != COLLIDE_OBJECTS ) if( start.y == end.y && collision != COLLIDE_OBJECTS )
collision = COLLIDE_H_WIRES; collision = COLLIDE_H_WIRES;
@ -600,7 +600,7 @@ protected:
if( !line ) if( !line )
return false; return false;
wxPoint start = line->GetStartPoint(), end = line->GetEndPoint(); VECTOR2I start = line->GetStartPoint(), end = line->GetEndPoint();
if( start.y != end.y ) if( start.y != end.y )
return false; return false;

View File

@ -41,23 +41,23 @@
#include <trigo.h> #include <trigo.h>
std::vector<wxPoint> SCH_EDIT_FRAME::GetSchematicConnections() std::vector<VECTOR2I> SCH_EDIT_FRAME::GetSchematicConnections()
{ {
std::vector<wxPoint> retval; std::vector<VECTOR2I> retval;
for( SCH_ITEM* item : GetScreen()->Items() ) for( SCH_ITEM* item : GetScreen()->Items() )
{ {
// Avoid items that are changing // Avoid items that are changing
if( !( item->GetEditFlags() & ( IS_DRAGGING | IS_MOVING | IS_DELETED ) ) ) if( !( item->GetEditFlags() & ( IS_DRAGGING | IS_MOVING | IS_DELETED ) ) )
{ {
std::vector<wxPoint> pts = item->GetConnectionPoints(); std::vector<VECTOR2I> pts = item->GetConnectionPoints();
retval.insert( retval.end(), pts.begin(), pts.end() ); retval.insert( retval.end(), pts.begin(), pts.end() );
} }
} }
// We always have some overlapping connection points. Drop duplicates here // We always have some overlapping connection points. Drop duplicates here
std::sort( retval.begin(), retval.end(), std::sort( retval.begin(), retval.end(),
[]( const wxPoint& a, const wxPoint& b ) -> bool []( const VECTOR2I& a, const VECTOR2I& b ) -> bool
{ return a.x < b.x || (a.x == b.x && a.y < b.y); } ); { return a.x < b.x || (a.x == b.x && a.y < b.y); } );
retval.erase( retval.erase(
std::unique( retval.begin(), retval.end() ), retval.end() ); std::unique( retval.begin(), retval.end() ), retval.end() );
@ -78,7 +78,7 @@ void SCH_EDIT_FRAME::TestDanglingEnds()
} }
bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd ) bool SCH_EDIT_FRAME::TrimWire( const VECTOR2I& aStart, const VECTOR2I& aEnd )
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
bool retval = false; bool retval = false;
@ -292,7 +292,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( SCH_SCREEN* aScreen )
} }
bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const VECTOR2I& aPoint,
SCH_LINE** aNewSegment, SCH_SCREEN* aScreen ) SCH_LINE** aNewSegment, SCH_SCREEN* aScreen )
{ {
if( aScreen == nullptr ) if( aScreen == nullptr )
@ -317,7 +317,7 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
} }
bool SCH_EDIT_FRAME::BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen ) bool SCH_EDIT_FRAME::BreakSegments( const VECTOR2I& aPoint, SCH_SCREEN* aScreen )
{ {
static const KICAD_T wiresAndBuses[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT }; static const KICAD_T wiresAndBuses[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT };
@ -355,7 +355,7 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen )
bool brokenSegments = false; bool brokenSegments = false;
std::set<wxPoint> point_set; std::set<VECTOR2I> point_set;
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) ) for( SCH_ITEM* item : aScreen->Items().OfType( SCH_JUNCTION_T ) )
point_set.insert( item->GetPosition() ); point_set.insert( item->GetPosition() );
@ -368,7 +368,7 @@ bool SCH_EDIT_FRAME::BreakSegmentsOnJunctions( SCH_SCREEN* aScreen )
} }
for( const wxPoint& pt : point_set ) for( const VECTOR2I& pt : point_set )
brokenSegments |= BreakSegments( pt, aScreen ); brokenSegments |= BreakSegments( pt, aScreen );
return brokenSegments; return brokenSegments;
@ -452,7 +452,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
} }
SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_SCREEN* aScreen, const wxPoint& aPos, SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( SCH_SCREEN* aScreen, const VECTOR2I& aPos,
bool aUndoAppend, bool aFinal ) bool aUndoAppend, bool aFinal )
{ {
SCH_JUNCTION* junction = new SCH_JUNCTION( aPos ); SCH_JUNCTION* junction = new SCH_JUNCTION( aPos );

View File

@ -511,7 +511,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
for( SCH_ITEM* item : aItemList ) for( SCH_ITEM* item : aItemList )
{ {
std::vector< wxPoint > points = item->GetConnectionPoints(); std::vector<VECTOR2I> points = item->GetConnectionPoints();
item->ConnectedItems( aSheet ).clear(); item->ConnectedItems( aSheet ).clear();
if( item->Type() == SCH_SHEET_T ) if( item->Type() == SCH_SHEET_T )
@ -534,7 +534,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
{ {
pin->InitializeConnection( aSheet, this ); pin->InitializeConnection( aSheet, this );
wxPoint pos = pin->GetPosition(); VECTOR2I pos = pin->GetPosition();
// because calling the first time is not thread-safe // because calling the first time is not thread-safe
pin->GetDefaultNetName( aSheet ); pin->GetDefaultNetName( aSheet );
@ -583,7 +583,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
break; break;
} }
for( const wxPoint& point : points ) for( const VECTOR2I& point : points )
connection_map[ point ].push_back( item ); connection_map[ point ].push_back( item );
} }
@ -2559,7 +2559,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
bool has_other_items = false; bool has_other_items = false;
SCH_PIN* pin = nullptr; SCH_PIN* pin = nullptr;
std::vector<SCH_ITEM*> invalid_items; std::vector<SCH_ITEM*> invalid_items;
wxPoint noConnectPos = aSubgraph->m_no_connect->GetPosition(); VECTOR2I noConnectPos = aSubgraph->m_no_connect->GetPosition();
double minDist = 0; double minDist = 0;
// Any subgraph that contains both a pin and a no-connect should not // Any subgraph that contains both a pin and a no-connect should not

View File

@ -46,7 +46,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString* aPath, const wx
{ {
SCH_SHEET_PATH* sheetWithSymbolFound = nullptr; SCH_SHEET_PATH* sheetWithSymbolFound = nullptr;
SCH_SYMBOL* symbol = nullptr; SCH_SYMBOL* symbol = nullptr;
wxPoint pos; VECTOR2I pos;
SCH_PIN* pin = nullptr; SCH_PIN* pin = nullptr;
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
SCH_ITEM* foundItem = nullptr; SCH_ITEM* foundItem = nullptr;

View File

@ -637,8 +637,8 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
if( resetEffects ) if( resetEffects )
{ {
// Careful: the visible bit and position are also set by SetAttributes() // Careful: the visible bit and position are also set by SetAttributes()
bool visible = field.IsVisible(); bool visible = field.IsVisible();
wxPoint pos = field.GetPosition(); VECTOR2I pos = field.GetPosition();
field.SetAttributes( *libField ); field.SetAttributes( *libField );
@ -647,7 +647,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
} }
if( resetPositions ) if( resetPositions )
field.SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField->GetTextPos() ); field.SetTextPos( aSymbol->GetPosition() + libField->GetTextPos() );
} }
else if( i >= MANDATORY_FIELDS && removeExtras ) else if( i >= MANDATORY_FIELDS && removeExtras )
{ {
@ -669,13 +669,13 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
if( !aSymbol->FindField( libField.GetName(), false ) ) if( !aSymbol->FindField( libField.GetName(), false ) )
{ {
wxString fieldName = libField.GetCanonicalName(); wxString fieldName = libField.GetCanonicalName();
SCH_FIELD newField( wxPoint( 0, 0), aSymbol->GetFieldCount(), aSymbol, fieldName ); SCH_FIELD newField( VECTOR2I( 0, 0), aSymbol->GetFieldCount(), aSymbol, fieldName );
SCH_FIELD* schField = aSymbol->AddField( newField ); SCH_FIELD* schField = aSymbol->AddField( newField );
// Careful: the visible bit and position are also set by SetAttributes() // Careful: the visible bit and position are also set by SetAttributes()
schField->SetAttributes( libField ); schField->SetAttributes( libField );
schField->SetText( libField.GetText() ); schField->SetText( libField.GetText() );
schField->SetTextPos( (VECTOR2I)aSymbol->GetPosition() + libField.GetTextPos() ); schField->SetTextPos( aSymbol->GetPosition() + libField.GetTextPos() );
} }
} }

View File

@ -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 ); GR_TEXT_V_ALIGN_T vJustify = EDA_TEXT::MapVertJustify( m_verticalJustification - 1 );
bool positioningModified = false; bool positioningModified = false;
if( aField->GetPosition() != (wxPoint)m_position ) if( aField->GetPosition() != m_position )
positioningModified = true; positioningModified = true;
if( aField->GetTextAngle().IsVertical() != m_isVertical ) 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 ); aField->SetText( m_text );
updateText( aField ); updateText( aField );
aField->SetPosition( (wxPoint)m_position ); aField->SetPosition( m_position );
// Note that we must set justifications before we can ask if they're flipped. If the old // 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 // justification is center then it won't know (whereas if the new justification is center

View File

@ -619,7 +619,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
newPin->SetType( last->GetType() ); newPin->SetType( last->GetType() );
newPin->SetShape( last->GetShape() ); newPin->SetShape( last->GetShape() );
wxPoint pos = last->GetPosition(); VECTOR2I pos = last->GetPosition();
SYMBOL_EDITOR_SETTINGS* cfg = m_editFrame->GetSettings(); SYMBOL_EDITOR_SETTINGS* cfg = m_editFrame->GetSettings();

View File

@ -155,7 +155,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
// to bottom: we must change the y coord sign for editing // to bottom: we must change the y coord sign for editing
for( size_t i = 0; i < m_fields->size(); ++i ) for( size_t i = 0; i < m_fields->size(); ++i )
{ {
wxPoint pos = m_fields->at( i ).GetPosition(); VECTOR2I pos = m_fields->at( i ).GetPosition();
pos.y = -pos.y; pos.y = -pos.y;
m_fields->at( i ).SetPosition( pos ); m_fields->at( i ).SetPosition( pos );
} }
@ -329,7 +329,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
// to bottom: we must change the y coord sign when writing back to the library // to bottom: we must change the y coord sign when writing back to the library
for( size_t i = 0; i < m_fields->size(); ++i ) for( size_t i = 0; i < m_fields->size(); ++i )
{ {
wxPoint pos = m_fields->at( i ).GetPosition(); VECTOR2I pos = m_fields->at( i ).GetPosition();
pos.y = -pos.y; pos.y = -pos.y;
m_fields->at( i ).SetPosition( pos ); m_fields->at( i ).SetPosition( pos );
m_fields->at( i ).SetId( i ); m_fields->at( i ).SetId( i );

View File

@ -389,7 +389,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
RENDER_SETTINGS* renderSettings = symbolEditor->GetRenderSettings(); RENDER_SETTINGS* renderSettings = symbolEditor->GetRenderSettings();
renderSettings->SetPrintDC( &dc ); renderSettings->SetPrintDC( &dc );
m_dummyPin->Print( renderSettings, (wxPoint) - bBox.Centre(), (void*) &opts, DefaultTransform ); m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
event.Skip(); event.Skip();
} }

View File

@ -81,7 +81,7 @@ private:
UNIT_BINDER m_nameSize; UNIT_BINDER m_nameSize;
UNIT_BINDER m_numberSize; UNIT_BINDER m_numberSize;
wxPoint m_origPos; VECTOR2I m_origPos;
ALT_PIN_DATA_MODEL* m_alternatesDataModel; ALT_PIN_DATA_MODEL* m_alternatesDataModel;

View File

@ -608,7 +608,7 @@ public:
if( !destField && !srcValue.IsEmpty() ) if( !destField && !srcValue.IsEmpty() )
{ {
const wxPoint symbolPos = symbol.GetPosition(); const VECTOR2I symbolPos = symbol.GetPosition();
destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) ); destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) );
} }

View File

@ -169,7 +169,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
{ {
// Careful: the visible bit and position are also set by SetAttributes() // Careful: the visible bit and position are also set by SetAttributes()
bool visible = field.IsVisible(); bool visible = field.IsVisible();
wxPoint pos = field.GetPosition(); VECTOR2I pos = field.GetPosition();
field.SetAttributes( *parentField ); field.SetAttributes( *parentField );

View File

@ -260,7 +260,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
m_previewItems.push_back( aItem ); m_previewItems.push_back( aItem );
}; };
std::vector<std::pair<SCH_LAYER_ID, std::pair<wxPoint, wxPoint>>> lines = { std::vector<std::pair<SCH_LAYER_ID, std::pair<VECTOR2I, VECTOR2I>>> lines = {
{ LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } }, { LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } },
{ LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } }, { LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } },
{ LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } }, { LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } },
@ -277,7 +277,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
{ LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } } { LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } }
}; };
for( const std::pair<SCH_LAYER_ID, std::pair<wxPoint, wxPoint>>& line : lines ) for( const std::pair<SCH_LAYER_ID, std::pair<VECTOR2I, VECTOR2I>>& line : lines )
{ {
SCH_LINE* wire = new SCH_LINE; SCH_LINE* wire = new SCH_LINE;
wire->SetLayer( line.first ); wire->SetLayer( line.first );
@ -295,14 +295,14 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
wire->SetStroke( stroke ); wire->SetStroke( stroke );
wire->SetStartPoint( wxPoint( Mils2iu( line.second.first.x ), wire->SetStartPoint( VECTOR2I( Mils2iu( line.second.first.x ),
Mils2iu( line.second.first.y ) ) ); Mils2iu( line.second.first.y ) ) );
wire->SetEndPoint( wxPoint( Mils2iu( line.second.second.x ), wire->SetEndPoint( VECTOR2I( Mils2iu( line.second.second.x ),
Mils2iu( line.second.second.y ) ) ); Mils2iu( line.second.second.y ) ) );
addItem( wire ); addItem( wire );
} }
#define MILS_POINT( x, y ) wxPoint( Mils2iu( x ), Mils2iu( y ) ) #define MILS_POINT( x, y ) VECTOR2I( Mils2iu( x ), Mils2iu( y ) )
SCH_NO_CONNECT* nc = new SCH_NO_CONNECT; SCH_NO_CONNECT* nc = new SCH_NO_CONNECT;
nc->SetPosition( MILS_POINT( 2525, 1300 ) ); nc->SetPosition( MILS_POINT( 2525, 1300 ) );
@ -347,13 +347,13 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
{ {
auto mapLibItemPosition = auto mapLibItemPosition =
[]( const wxPoint& aLibPosition ) -> wxPoint []( const VECTOR2I& aLibPosition ) -> VECTOR2I
{ {
return wxPoint( aLibPosition.x, -aLibPosition.y ); return VECTOR2I( aLibPosition.x, -aLibPosition.y );
}; };
LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString ); LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString );
wxPoint p( 2625, -1600 ); VECTOR2I p( 2625, -1600 );
LIB_FIELD& ref = symbol->GetReferenceField(); LIB_FIELD& ref = symbol->GetReferenceField();

View File

@ -139,7 +139,7 @@ SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
} }
void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const wxPoint& aPos, void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const VECTOR2I& aPos,
int aUnit, int aConvert ) int aUnit, int aConvert )
{ {
Empty(); // empty the collection just in case Empty(); // empty the collection just in case
@ -160,7 +160,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[],
const wxPoint& aPos, int aUnit, int aConvert ) const VECTOR2I& aPos, int aUnit, int aConvert )
{ {
Empty(); // empty the collection just in case Empty(); // empty the collection just in case

View File

@ -81,7 +81,7 @@ public:
* @param aUnit is the symbol unit filter (for symbol editor). * @param aUnit is the symbol unit filter (for symbol editor).
* @param aConvert is the DeMorgan filter (for symbol editor) * @param aConvert is the DeMorgan filter (for symbol editor)
*/ */
void Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const wxPoint& aPos, void Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const VECTOR2I& aPos,
int aUnit = 0, int aConvert = 0 ); int aUnit = 0, int aConvert = 0 );
/** /**
@ -95,7 +95,7 @@ public:
* @param aUnit is the symbol unit filter (for symbol editor). * @param aUnit is the symbol unit filter (for symbol editor).
* @param aConvert is the DeMorgan filter (for symbol editor). * @param aConvert is the DeMorgan filter (for symbol editor).
*/ */
void Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], const wxPoint& aPos, void Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], const VECTOR2I& aPos,
int aUnit = 0, int aConvert = 0 ); int aUnit = 0, int aConvert = 0 );
/** /**

View File

@ -201,7 +201,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{ {
if( unresolved( field.GetShownText() ) ) if( unresolved( field.GetShownText() ) )
{ {
wxPoint pos = field.GetPosition() - symbol->GetPosition(); VECTOR2I pos = field.GetPosition() - symbol->GetPosition();
pos = symbol->GetTransform().TransformCoordinate( pos ); pos = symbol->GetTransform().TransformCoordinate( pos );
pos += symbol->GetPosition(); pos += symbol->GetPosition();
@ -392,7 +392,7 @@ int ERC_TESTER::TestNoConnectPins()
for( const SCH_SHEET_PATH& sheet : m_schematic->GetSheets() ) for( const SCH_SHEET_PATH& sheet : m_schematic->GetSheets() )
{ {
std::map<wxPoint, std::vector<SCH_PIN*>> pinMap; std::map<VECTOR2I, std::vector<SCH_PIN*>> pinMap;
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) ) for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{ {

View File

@ -111,7 +111,7 @@ int LIB_FIELD::GetPenWidth() const
} }
void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
@ -125,7 +125,7 @@ void LIB_FIELD::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
} }
bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool LIB_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
// Because HitTest is mainly used to select the field return false if it is empty // Because HitTest is mainly used to select the field return false if it is empty
if( GetText().IsEmpty() ) if( GetText().IsEmpty() )
@ -236,19 +236,19 @@ int LIB_FIELD::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompare
} }
void LIB_FIELD::Offset( const wxPoint& aOffset ) void LIB_FIELD::Offset( const VECTOR2I& aOffset )
{ {
EDA_TEXT::Offset( aOffset ); EDA_TEXT::Offset( aOffset );
} }
void LIB_FIELD::MoveTo( const wxPoint& newPosition ) void LIB_FIELD::MoveTo( const VECTOR2I& newPosition )
{ {
EDA_TEXT::SetTextPos( newPosition ); EDA_TEXT::SetTextPos( newPosition );
} }
void LIB_FIELD::MirrorHorizontal( const wxPoint& center ) void LIB_FIELD::MirrorHorizontal( const VECTOR2I& center )
{ {
int x = GetTextPos().x; int x = GetTextPos().x;
@ -260,7 +260,7 @@ void LIB_FIELD::MirrorHorizontal( const wxPoint& center )
} }
void LIB_FIELD::MirrorVertical( const wxPoint& center ) void LIB_FIELD::MirrorVertical( const VECTOR2I& center )
{ {
int y = GetTextPos().y; int y = GetTextPos().y;
@ -272,7 +272,7 @@ void LIB_FIELD::MirrorVertical( const wxPoint& center )
} }
void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW ) void LIB_FIELD::Rotate( const VECTOR2I& center, bool aRotateCCW )
{ {
int rot_angle = aRotateCCW ? -900 : 900; int rot_angle = aRotateCCW ? -900 : 900;
@ -285,7 +285,7 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
} }
void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void LIB_FIELD::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const const TRANSFORM& aTransform ) const
{ {
if( GetText().IsEmpty() ) if( GetText().IsEmpty() )
@ -437,13 +437,13 @@ wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
} }
void LIB_FIELD::BeginEdit( const wxPoint& aPosition ) void LIB_FIELD::BeginEdit( const VECTOR2I& aPosition )
{ {
SetTextPos( aPosition ); SetTextPos( aPosition );
} }
void LIB_FIELD::CalcEdit( const wxPoint& aPosition ) void LIB_FIELD::CalcEdit( const VECTOR2I& aPosition )
{ {
SetTextPos( aPosition ); SetTextPos( aPosition );
} }

View File

@ -130,7 +130,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
LIB_FIELD& operator=( const LIB_FIELD& field ); LIB_FIELD& operator=( const LIB_FIELD& field );
@ -148,19 +148,19 @@ public:
SCH_LAYER_ID GetDefaultLayer() const; SCH_LAYER_ID GetDefaultLayer() const;
void BeginEdit( const wxPoint& aStartPoint ) override; void BeginEdit( const VECTOR2I& aStartPoint ) override;
void Offset( const wxPoint& aOffset ) override; void Offset( const VECTOR2I& aOffset ) override;
void MoveTo( const wxPoint& aPosition ) override; void MoveTo( const VECTOR2I& aPosition ) override;
wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); }
void MirrorHorizontal( const wxPoint& aCenter ) override; void MirrorHorizontal( const VECTOR2I& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override; void MirrorVertical( const VECTOR2I& aCenter ) override;
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const override; const TRANSFORM& aTransform ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -194,7 +194,7 @@ private:
* If \a aData not NULL, \a aData must point a wxString which is used instead of * If \a aData not NULL, \a aData must point a wxString which is used instead of
* the m_Text * the m_Text
*/ */
void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
/** /**
@ -202,7 +202,7 @@ private:
* *
* @param aPosition - The position to edit the circle in drawing coordinates. * @param aPosition - The position to edit the circle in drawing coordinates.
*/ */
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const VECTOR2I& aPosition ) override;
friend class SCH_LEGACY_PLUGIN_CACHE; // Required to access m_name. friend class SCH_LEGACY_PLUGIN_CACHE; // Required to access m_name.

View File

@ -115,8 +115,8 @@ bool LIB_ITEM::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
} }
void LIB_ITEM::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void LIB_ITEM::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
void* aData, const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
print( aSettings, aOffset, aData, aTransform ); print( aSettings, aOffset, aData, aTransform );
} }

View File

@ -94,7 +94,7 @@ public:
* @param aPosition The position in drawing coordinates where the drawing was started. * @param aPosition The position in drawing coordinates where the drawing was started.
* May or may not be required depending on the item being drawn. * May or may not be required depending on the item being drawn.
*/ */
virtual void BeginEdit( const wxPoint& aPosition ) {} virtual void BeginEdit( const VECTOR2I& aPosition ) {}
/** /**
* Continue an edit in progress at \a aPosition. * Continue an edit in progress at \a aPosition.
@ -106,7 +106,7 @@ public:
* @param aPosition The position of the mouse left click in drawing coordinates. * @param aPosition The position of the mouse left click in drawing coordinates.
* @return True if additional mouse clicks are required to complete the edit in progress. * @return True if additional mouse clicks are required to complete the edit in progress.
*/ */
virtual bool ContinueEdit( const wxPoint& aPosition ) { return false; } virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
/** /**
* End an object editing action. * End an object editing action.
@ -124,7 +124,7 @@ public:
* *
* @param aPosition The current mouse position in drawing coordinates. * @param aPosition The current mouse position in drawing coordinates.
*/ */
virtual void CalcEdit( const wxPoint& aPosition ) {} virtual void CalcEdit( const VECTOR2I& aPosition ) {}
/** /**
* Draw an item * Draw an item
@ -137,8 +137,8 @@ public:
* pass reference to the lib symbol for pins. * pass reference to the lib symbol for pins.
* @param aTransform Transform Matrix (rotation, mirror ..) * @param aTransform Transform Matrix (rotation, mirror ..)
*/ */
virtual void Print( const RENDER_SETTINGS* aSettings, const wxPoint &aOffset, virtual void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
void* aData, const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
virtual int GetPenWidth() const = 0; virtual int GetPenWidth() const = 0;
@ -160,7 +160,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
{ {
// This is just here to prevent annoying compiler warnings about hidden overloaded // This is just here to prevent annoying compiler warnings about hidden overloaded
// virtual functions // virtual functions
@ -210,30 +210,30 @@ public:
* *
* @param aOffset Coordinates to offset the item position. * @param aOffset Coordinates to offset the item position.
*/ */
virtual void Offset( const wxPoint& aOffset ) = 0; virtual void Offset( const VECTOR2I& aOffset ) = 0;
/** /**
* Move a draw object to \a aPosition. * Move a draw object to \a aPosition.
* *
* @param aPosition Position to move draw item to. * @param aPosition Position to move draw item to.
*/ */
virtual void MoveTo( const wxPoint& aPosition ) = 0; virtual void MoveTo( const VECTOR2I& aPosition ) = 0;
void SetPosition( const wxPoint& aPosition ) override { MoveTo( aPosition ); } void SetPosition( const VECTOR2I& aPosition ) override { MoveTo( aPosition ); }
/** /**
* Mirror the draw object along the horizontal (X) axis about \a aCenter point. * Mirror the draw object along the horizontal (X) axis about \a aCenter point.
* *
* @param aCenter Point to mirror around. * @param aCenter Point to mirror around.
*/ */
virtual void MirrorHorizontal( const wxPoint& aCenter ) = 0; virtual void MirrorHorizontal( const VECTOR2I& aCenter ) = 0;
/** /**
* Mirror the draw object along the MirrorVertical (Y) axis about \a aCenter point. * Mirror the draw object along the MirrorVertical (Y) axis about \a aCenter point.
* *
* @param aCenter Point to mirror around. * @param aCenter Point to mirror around.
*/ */
virtual void MirrorVertical( const wxPoint& aCenter ) = 0; virtual void MirrorVertical( const VECTOR2I& aCenter ) = 0;
/** /**
* Rotate the object about \a aCenter point. * Rotate the object about \a aCenter point.
@ -241,7 +241,7 @@ public:
* @param aCenter Point to rotate around. * @param aCenter Point to rotate around.
* @param aRotateCCW True to rotate counter clockwise. False to rotate clockwise. * @param aRotateCCW True to rotate counter clockwise. False to rotate clockwise.
*/ */
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) = 0; virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) = 0;
/** /**
* Plot the draw item using the plot object. * Plot the draw item using the plot object.
@ -251,7 +251,7 @@ public:
* @param aFill Flag to indicate whether or not the object is filled. * @param aFill Flag to indicate whether or not the object is filled.
* @param aTransform The plot transform. * @param aTransform The plot transform.
*/ */
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, virtual void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const = 0; const TRANSFORM& aTransform ) const = 0;
void SetUnit( int aUnit ) { m_unit = aUnit; } void SetUnit( int aUnit ) { m_unit = aUnit; }
@ -296,7 +296,7 @@ protected:
* @param aData A pointer to any object specific data required to perform the draw. * @param aData A pointer to any object specific data required to perform the draw.
* @param aTransform A reference to a #TRANSFORM object containing drawing transform. * @param aTransform A reference to a #TRANSFORM object containing drawing transform.
*/ */
virtual void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, virtual void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) = 0; const TRANSFORM& aTransform ) = 0;
private: private:

View File

@ -121,7 +121,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent ) :
LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber, LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber,
int aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize,
int aNumTextSize, int aConvert, const wxPoint& aPos, int aUnit ) : int aNumTextSize, int aConvert, const VECTOR2I& aPos, int aUnit ) :
LIB_ITEM( LIB_PIN_T, aParent ), LIB_ITEM( LIB_PIN_T, aParent ),
m_position( aPos ), m_position( aPos ),
m_length( aLength ), m_length( aLength ),
@ -139,7 +139,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aN
} }
bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool LIB_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();
@ -179,20 +179,20 @@ wxString LIB_PIN::GetShownName() const
} }
wxPoint LIB_PIN::GetPinRoot() const VECTOR2I LIB_PIN::GetPinRoot() const
{ {
switch( m_orientation ) switch( m_orientation )
{ {
default: default:
case PIN_RIGHT: return wxPoint( m_position.x + m_length, -( m_position.y ) ); case PIN_RIGHT: return VECTOR2I( m_position.x + m_length, -( m_position.y ) );
case PIN_LEFT: return wxPoint( m_position.x - m_length, -( m_position.y ) ); case PIN_LEFT: return VECTOR2I( m_position.x - m_length, -( m_position.y ) );
case PIN_UP: return wxPoint( m_position.x, -( m_position.y + m_length ) ); case PIN_UP: return VECTOR2I( m_position.x, -( m_position.y + m_length ) );
case PIN_DOWN: return wxPoint( m_position.x, -( m_position.y - m_length ) ); case PIN_DOWN: return VECTOR2I( m_position.x, -( m_position.y - m_length ) );
} }
} }
void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData; LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData;
@ -206,7 +206,7 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
int orient = PinDrawOrient( aTransform ); int orient = PinDrawOrient( aTransform );
/* Calculate the pin position */ /* Calculate the pin position */
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset; VECTOR2I pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
if( IsVisible() || drawHiddenFields ) if( IsVisible() || drawHiddenFields )
{ {
@ -230,7 +230,7 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
} }
void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrient ) void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos, int aOrient )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
@ -341,7 +341,7 @@ void LIB_PIN::printPinSymbol( const RENDER_SETTINGS* aSettings, const wxPoint& a
} }
void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, int aPinOrient, void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ) int aTextInside, bool aDrawPinNum, bool aDrawPinName )
{ {
if( !aDrawPinName && !aDrawPinNum ) if( !aDrawPinName && !aDrawPinNum )
@ -394,14 +394,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
if( aPinOrient == PIN_RIGHT ) if( aPinOrient == PIN_RIGHT )
{ {
x = x1 + aTextInside; x = x1 + aTextInside;
GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL, GRText( DC, VECTOR2I( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL,
PinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, PinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
false, false, nullptr ); false, false, nullptr );
} }
else // Orient == PIN_LEFT else // Orient == PIN_LEFT
{ {
x = x1 - aTextInside; x = x1 - aTextInside;
GRText( DC, wxPoint( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL, GRText( DC, VECTOR2I( x, y1 ), NameColor, name, EDA_ANGLE::HORIZONTAL,
PinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, PinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
false, false, nullptr ); false, false, nullptr );
} }
@ -409,7 +409,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
if( aDrawPinNum ) if( aDrawPinNum )
{ {
GRText( DC, wxPoint(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number, GRText( DC, VECTOR2I(( x1 + aPinPos.x) / 2, y1 - num_offset ), NumColor, number,
EDA_ANGLE::HORIZONTAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, EDA_ANGLE::HORIZONTAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr ); GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr );
} }
@ -423,14 +423,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
if( aDrawPinName ) if( aDrawPinName )
{ {
GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, GRText( DC, VECTOR2I( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize,
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false,
false, nullptr ); false, nullptr );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, GRText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr ); GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr );
} }
@ -441,14 +441,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
if( aDrawPinName ) if( aDrawPinName )
{ {
GRText( DC, wxPoint( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize, GRText( DC, VECTOR2I( x1, y ), NameColor, name, EDA_ANGLE::VERTICAL, PinNameSize,
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, namePenWidth, false,
false, nullptr ); false, nullptr );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
GRText( DC, wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, GRText( DC, VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), NumColor,
number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, number, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr ); GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false, nullptr );
} }
@ -463,14 +463,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
if( aDrawPinName ) if( aDrawPinName )
{ {
x = ( x1 + aPinPos.x) / 2; x = ( x1 + aPinPos.x) / 2;
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, name, EDA_ANGLE::HORIZONTAL, GRText( DC, VECTOR2I( x, y1 - name_offset ), NameColor, name, EDA_ANGLE::HORIZONTAL,
PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
namePenWidth, false, false, nullptr ); namePenWidth, false, false, nullptr );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
x = ( x1 + aPinPos.x) / 2; x = ( x1 + aPinPos.x) / 2;
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL, GRText( DC, VECTOR2I( x, y1 + num_offset ), NumColor, number, EDA_ANGLE::HORIZONTAL,
PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, numPenWidth,
false, false, nullptr ); false, false, nullptr );
} }
@ -480,14 +480,14 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
if( aDrawPinName ) if( aDrawPinName )
{ {
y = ( y1 + aPinPos.y) / 2; y = ( y1 + aPinPos.y) / 2;
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, name, EDA_ANGLE::VERTICAL, GRText( DC, VECTOR2I( x1 - name_offset, y ), NameColor, name, EDA_ANGLE::VERTICAL,
PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM, PinNameSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM,
namePenWidth, false, false, nullptr ); namePenWidth, false, false, nullptr );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
GRText( DC, wxPoint( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number, GRText( DC, VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y) / 2 ), NumColor, number,
EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP, EDA_ANGLE::VERTICAL, PinNumSize, GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP,
numPenWidth, false, false, nullptr ); numPenWidth, false, false, nullptr );
} }
@ -497,7 +497,7 @@ void LIB_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos,
void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPoint& aPosition, void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECTOR2I& aPosition,
int aOrientation ) int aOrientation )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
@ -517,7 +517,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo
// Get a suitable color // Get a suitable color
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_NOTES : LAYER_HIDDEN ); COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_NOTES : LAYER_HIDDEN );
wxPoint txtpos = aPosition; VECTOR2I txtpos = aPosition;
int offset = Millimeter2iu( 0.4 ); int offset = Millimeter2iu( 0.4 );
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_LEFT; GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_LEFT;
EDA_ANGLE orient = EDA_ANGLE::HORIZONTAL; EDA_ANGLE orient = EDA_ANGLE::HORIZONTAL;
@ -550,7 +550,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo
} }
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) const void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const VECTOR2I& aPosition, int aOrientation ) const
{ {
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN ); COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
@ -573,10 +573,10 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK ) if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{ {
const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this ); const int radius = externalPinDecoSize( aPlotter->RenderSettings(), *this );
aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2, aPlotter->Circle( VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
FILL_T::NO_FILL, penWidth ); FILL_T::NO_FILL, penWidth );
aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) ); aPlotter->MoveTo( VECTOR2I( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
aPlotter->FinishTo( aPosition ); aPlotter->FinishTo( aPosition );
} }
else if( m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK ) else if( m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
@ -584,23 +584,23 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this ); const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) ); aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) );
aPlotter->LineTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 ) ); aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 - deco_size ) ); aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
aPlotter->MoveTo( wxPoint( x1 + deco_size, y1 ) ); aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) );
aPlotter->LineTo( wxPoint( x1, y1 + MapY1 * deco_size * 2 ) ); aPlotter->LineTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) );
aPlotter->FinishTo( wxPoint( x1 - deco_size, y1 ) ); aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) );
} }
aPlotter->MoveTo( wxPoint( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) ); aPlotter->MoveTo( VECTOR2I( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 ) );
aPlotter->FinishTo( aPosition ); aPlotter->FinishTo( aPosition );
} }
else else
{ {
aPlotter->MoveTo( wxPoint( x1, y1 ) ); aPlotter->MoveTo( VECTOR2I( x1, y1 ) );
aPlotter->FinishTo( aPosition ); aPlotter->FinishTo( aPosition );
} }
@ -611,15 +611,15 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this ); const int deco_size = internalPinDecoSize( aPlotter->RenderSettings(), *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
aPlotter->MoveTo( wxPoint( x1, y1 + deco_size ) ); aPlotter->MoveTo( VECTOR2I( x1, y1 + deco_size ) );
aPlotter->LineTo( wxPoint( x1 - MapX1 * deco_size * 2, y1 ) ); aPlotter->LineTo( VECTOR2I( x1 - MapX1 * deco_size * 2, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 - deco_size ) ); aPlotter->FinishTo( VECTOR2I( x1, y1 - deco_size ) );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
aPlotter->MoveTo( wxPoint( x1 + deco_size, y1 ) ); aPlotter->MoveTo( VECTOR2I( x1 + deco_size, y1 ) );
aPlotter->LineTo( wxPoint( x1, y1 - MapY1 * deco_size * 2 ) ); aPlotter->LineTo( VECTOR2I( x1, y1 - MapY1 * deco_size * 2 ) );
aPlotter->FinishTo( wxPoint( x1 - deco_size, y1 ) ); aPlotter->FinishTo( VECTOR2I( x1 - deco_size, y1 ) );
} }
} }
@ -630,15 +630,15 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
aPlotter->MoveTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 ) ); aPlotter->MoveTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 ) );
aPlotter->LineTo( wxPoint( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) ); aPlotter->LineTo( VECTOR2I( x1 + MapX1 * deco_size * 2, y1 - deco_size * 2 ) );
aPlotter->FinishTo( wxPoint( x1, y1 ) ); aPlotter->FinishTo( VECTOR2I( x1, y1 ) );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
aPlotter->MoveTo( wxPoint( x1, y1 + MapY1 * deco_size * 2 ) ); aPlotter->MoveTo( VECTOR2I( x1, y1 + MapY1 * deco_size * 2 ) );
aPlotter->LineTo( wxPoint( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) ); aPlotter->LineTo( VECTOR2I( x1 - deco_size * 2, y1 + MapY1 * deco_size * 2 ) );
aPlotter->FinishTo( wxPoint( x1, y1 ) ); aPlotter->FinishTo( VECTOR2I( x1, y1 ) );
} }
} }
@ -648,22 +648,26 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( MapY1 == 0 ) /* MapX1 = +- 1 */ if( MapY1 == 0 ) /* MapX1 = +- 1 */
{ {
aPlotter->MoveTo( wxPoint( x1, y1 - symbol_size * 2 ) ); aPlotter->MoveTo( VECTOR2I( x1, y1 - symbol_size * 2 ) );
aPlotter->FinishTo( wxPoint( x1 + MapX1 * symbol_size * 2, y1 ) ); aPlotter->FinishTo( VECTOR2I( x1 + MapX1 * symbol_size * 2, y1 ) );
} }
else /* MapX1 = 0 */ else /* MapX1 = 0 */
{ {
aPlotter->MoveTo( wxPoint( x1 - symbol_size * 2, y1 ) ); aPlotter->MoveTo( VECTOR2I( x1 - symbol_size * 2, y1 ) );
aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) ); aPlotter->FinishTo( VECTOR2I( x1, y1 + MapY1 * symbol_size * 2 ) );
} }
} }
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */ else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
{ {
const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this ); const int deco_size = externalPinDecoSize( aPlotter->RenderSettings(), *this );
aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ) ); aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 + MapY1 ) * deco_size,
aPlotter->FinishTo( wxPoint( x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size ) ); y1 - ( MapY1 - MapX1 ) * deco_size ) );
aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size ) ); aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 + MapY1 ) * deco_size,
aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size ) ); y1 + ( MapY1 - MapX1 ) * deco_size ) );
aPlotter->MoveTo( VECTOR2I( x1 - ( MapX1 - MapY1 ) * deco_size,
y1 - ( MapY1 + MapX1 ) * deco_size ) );
aPlotter->FinishTo( VECTOR2I( x1 + ( MapX1 - MapY1 ) * deco_size,
y1 + ( MapY1 + MapX1 ) * deco_size ) );
} }
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
@ -671,15 +675,15 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
const int deco_size = TARGET_PIN_RADIUS; const int deco_size = TARGET_PIN_RADIUS;
const int ex1 = aPosition.x; const int ex1 = aPosition.x;
const int ey1 = aPosition.y; const int ey1 = aPosition.y;
aPlotter->MoveTo( wxPoint( ex1 - deco_size, ey1 - deco_size ) ); aPlotter->MoveTo( VECTOR2I( ex1 - deco_size, ey1 - deco_size ) );
aPlotter->FinishTo( wxPoint( ex1 + deco_size, ey1 + deco_size ) ); aPlotter->FinishTo( VECTOR2I( ex1 + deco_size, ey1 + deco_size ) );
aPlotter->MoveTo( wxPoint( ex1 + deco_size, ey1 - deco_size ) ); aPlotter->MoveTo( VECTOR2I( ex1 + deco_size, ey1 - deco_size ) );
aPlotter->FinishTo( wxPoint( ex1 - deco_size, ey1 + deco_size ) ); aPlotter->FinishTo( VECTOR2I( ex1 - deco_size, ey1 + deco_size ) );
} }
} }
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinOrient, void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const
{ {
wxString name = GetShownName(); wxString name = GetShownName();
@ -740,13 +744,13 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
hjustify = GR_TEXT_H_ALIGN_RIGHT; hjustify = GR_TEXT_H_ALIGN_RIGHT;
} }
aPlotter->Text( wxPoint( x, y1 ), nameColor, name, EDA_ANGLE::HORIZONTAL, aPlotter->Text( VECTOR2I( x, y1 ), nameColor, name, EDA_ANGLE::HORIZONTAL,
pinNameSize, hjustify, GR_TEXT_V_ALIGN_CENTER, namePenWidth, pinNameSize, hjustify, GR_TEXT_V_ALIGN_CENTER, namePenWidth,
false, false ); false, false );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
aPlotter->Text( wxPoint( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor, aPlotter->Text( VECTOR2I( ( x1 + aPinPos.x) / 2, y1 - num_offset ), numColor,
number, EDA_ANGLE::HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, number, EDA_ANGLE::HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false ); GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
} }
@ -758,13 +762,13 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
y = y1 + aTextInside; y = y1 + aTextInside;
if( aDrawPinName ) if( aDrawPinName )
aPlotter->Text( wxPoint( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL, aPlotter->Text( VECTOR2I( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL,
pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, pinNameSize, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER,
namePenWidth, false, false ); namePenWidth, false, false );
if( aDrawPinNum ) if( aDrawPinNum )
{ {
aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor, aPlotter->Text( VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false ); GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
} }
@ -775,14 +779,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
if( aDrawPinName ) if( aDrawPinName )
{ {
aPlotter->Text( wxPoint( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL, aPlotter->Text( VECTOR2I( x1, y ), nameColor, name, EDA_ANGLE::VERTICAL,
pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, pinNameSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER,
namePenWidth, false, false ); namePenWidth, false, false );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
aPlotter->Text( wxPoint( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor, aPlotter->Text( VECTOR2I( x1 - num_offset, ( y1 + aPinPos.y) / 2 ), numColor,
number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false ); GR_TEXT_V_ALIGN_BOTTOM, numPenWidth, false, false );
} }
@ -797,7 +801,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
if( aDrawPinName ) if( aDrawPinName )
{ {
x = ( x1 + aPinPos.x) / 2; x = ( x1 + aPinPos.x) / 2;
aPlotter->Text( wxPoint( x, y1 - name_offset ), nameColor, name, aPlotter->Text( VECTOR2I( x, y1 - name_offset ), nameColor, name,
EDA_ANGLE::HORIZONTAL, pinNameSize, GR_TEXT_H_ALIGN_CENTER, EDA_ANGLE::HORIZONTAL, pinNameSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false ); GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false );
} }
@ -805,7 +809,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
if( aDrawPinNum ) if( aDrawPinNum )
{ {
x = ( x1 + aPinPos.x ) / 2; x = ( x1 + aPinPos.x ) / 2;
aPlotter->Text( wxPoint( x, y1 + num_offset ), numColor, number, aPlotter->Text( VECTOR2I( x, y1 + num_offset ), numColor, number,
EDA_ANGLE::HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, EDA_ANGLE::HORIZONTAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false ); GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false );
} }
@ -815,14 +819,14 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
if( aDrawPinName ) if( aDrawPinName )
{ {
y = ( y1 + aPinPos.y ) / 2; y = ( y1 + aPinPos.y ) / 2;
aPlotter->Text( wxPoint( x1 - name_offset, y ), nameColor, name, aPlotter->Text( VECTOR2I( x1 - name_offset, y ), nameColor, name,
EDA_ANGLE::VERTICAL, pinNameSize, GR_TEXT_H_ALIGN_CENTER, EDA_ANGLE::VERTICAL, pinNameSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false ); GR_TEXT_V_ALIGN_BOTTOM, namePenWidth, false, false );
} }
if( aDrawPinNum ) if( aDrawPinNum )
{ {
aPlotter->Text( wxPoint( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor, aPlotter->Text( VECTOR2I( x1 + num_offset, ( y1 + aPinPos.y ) / 2 ), numColor,
number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER, number, EDA_ANGLE::VERTICAL, pinNumSize, GR_TEXT_H_ALIGN_CENTER,
GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false ); GR_TEXT_V_ALIGN_TOP, numPenWidth, false, false );
} }
@ -833,8 +837,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinO
int LIB_PIN::PinDrawOrient( const TRANSFORM& aTransform ) const int LIB_PIN::PinDrawOrient( const TRANSFORM& aTransform ) const
{ {
int orient; int orient;
wxPoint end; // position of pin end starting at 0,0 according to its orientation, length = 1 VECTOR2I end; // position of pin end starting at 0,0 according to its orientation, length = 1
switch( m_orientation ) switch( m_orientation )
{ {
@ -949,13 +953,13 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFl
} }
void LIB_PIN::Offset( const wxPoint& aOffset ) void LIB_PIN::Offset( const VECTOR2I& aOffset )
{ {
m_position += aOffset; m_position += aOffset;
} }
void LIB_PIN::MoveTo( const wxPoint& aNewPosition ) void LIB_PIN::MoveTo( const VECTOR2I& aNewPosition )
{ {
if( m_position != aNewPosition ) if( m_position != aNewPosition )
{ {
@ -965,7 +969,7 @@ void LIB_PIN::MoveTo( const wxPoint& aNewPosition )
} }
void LIB_PIN::MirrorHorizontal( const wxPoint& aCenter ) void LIB_PIN::MirrorHorizontal( const VECTOR2I& aCenter )
{ {
m_position.x -= aCenter.x; m_position.x -= aCenter.x;
m_position.x *= -1; m_position.x *= -1;
@ -978,7 +982,7 @@ void LIB_PIN::MirrorHorizontal( const wxPoint& aCenter )
} }
void LIB_PIN::MirrorVertical( const wxPoint& aCenter ) void LIB_PIN::MirrorVertical( const VECTOR2I& aCenter )
{ {
m_position.y -= aCenter.y; m_position.y -= aCenter.y;
m_position.y *= -1; m_position.y *= -1;
@ -991,11 +995,11 @@ void LIB_PIN::MirrorVertical( const wxPoint& aCenter )
} }
void LIB_PIN::Rotate( const wxPoint& aCenter, bool aRotateCCW ) void LIB_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
{ {
int rot_angle = aRotateCCW ? -900 : 900; int rot_angle = aRotateCCW ? -900 : 900;
RotatePoint( &m_position, aCenter, rot_angle ); RotatePoint( m_position, aCenter, rot_angle );
if( aRotateCCW ) if( aRotateCCW )
{ {
@ -1020,14 +1024,14 @@ void LIB_PIN::Rotate( const wxPoint& aCenter, bool aRotateCCW )
} }
void LIB_PIN::Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill, void LIB_PIN::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const const TRANSFORM& aTransform ) const
{ {
if( !IsVisible() ) if( !IsVisible() )
return; return;
int orient = PinDrawOrient( aTransform ); int orient = PinDrawOrient( aTransform );
wxPoint pos = aTransform.TransformCoordinate( m_position ) + aPffset; VECTOR2I pos = aTransform.TransformCoordinate( m_position ) + aOffset;
PlotSymbol( aPlotter, pos, orient ); PlotSymbol( aPlotter, pos, orient );
PlotPinTexts( aPlotter, pos, orient, GetParent()->GetPinNameOffset(), PlotPinTexts( aPlotter, pos, orient, GetParent()->GetPinNameOffset(),
@ -1054,7 +1058,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
int i = PinOrientationIndex( m_orientation ); int i = PinOrientationIndex( m_orientation );
aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) ); aList.emplace_back( _( "Orientation" ), PinOrientationName( (unsigned) i ) );
wxPoint pinpos = GetPosition(); VECTOR2I pinpos = GetPosition();
pinpos.y = -pinpos.y; // Display coords are top to bottom; lib item coords are bottom to top pinpos.y = -pinpos.y; // Display coords are top to bottom; lib item coords are bottom to top
aList.emplace_back( _( "Pos X" ), MessageTextFromValue( units, pinpos.x, true ) ); aList.emplace_back( _( "Pos X" ), MessageTextFromValue( units, pinpos.x, true ) );
@ -1067,8 +1071,8 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
const KIGFX::STROKE_FONT& font = basic_gal.GetStrokeFont(); const KIGFX::STROKE_FONT& font = basic_gal.GetStrokeFont();
EDA_RECT bbox; EDA_RECT bbox;
wxPoint begin; VECTOR2I begin;
wxPoint end; VECTOR2I end;
int nameTextOffset = 0; int nameTextOffset = 0;
int nameTextLength = 0; int nameTextLength = 0;
int nameTextHeight = 0; int nameTextHeight = 0;
@ -1150,13 +1154,13 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles, bool aPinOnly )
{ {
case PIN_UP: case PIN_UP:
// Pin is rotated and texts positions are mirrored // Pin is rotated and texts positions are mirrored
RotatePoint( &begin, wxPoint( 0, 0 ), -900 ); RotatePoint( begin, VECTOR2I( 0, 0 ), -900 );
RotatePoint( &end, wxPoint( 0, 0 ), -900 ); RotatePoint( end, VECTOR2I( 0, 0 ), -900 );
break; break;
case PIN_DOWN: case PIN_DOWN:
RotatePoint( &begin, wxPoint( 0, 0 ), 900 ); RotatePoint( begin, VECTOR2I( 0, 0 ), 900 );
RotatePoint( &end, wxPoint( 0, 0 ), 900 ); RotatePoint( end, VECTOR2I( 0, 0 ), 900 );
begin.x = -begin.x; begin.x = -begin.x;
end.x = -end.x; end.x = -end.x;
break; break;
@ -1224,7 +1228,7 @@ void LIB_PIN::Show( int nestLevel, std::ostream& os ) const
#endif #endif
void LIB_PIN::CalcEdit( const wxPoint& aPosition ) void LIB_PIN::CalcEdit( const VECTOR2I& aPosition )
{ {
if( IsMoving() ) if( IsMoving() )
MoveTo( aPosition ); MoveTo( aPosition );

View File

@ -141,7 +141,7 @@ public:
* electrical types * electrical types
* @param aTransform Transform Matrix (rotation, mirror ..) * @param aTransform Transform Matrix (rotation, mirror ..)
*/ */
void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
/** /**
@ -156,7 +156,7 @@ public:
LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber, int aOrientation, LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber, int aOrientation,
ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aNumTextSize, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aNumTextSize,
int aConvert, const wxPoint& aPos, int aUnit ); int aConvert, const VECTOR2I& aPos, int aUnit );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -164,7 +164,7 @@ public:
void Show( int nestLevel, std::ostream& os ) const override; void Show( int nestLevel, std::ostream& os ) const override;
#endif #endif
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
@ -198,25 +198,25 @@ public:
* If TextInside then the text is been put inside (moving from x1, y1 in * If TextInside then the text is been put inside (moving from x1, y1 in
* the opposite direction to x2,y2), otherwise all is drawn outside. * the opposite direction to x2,y2), otherwise all is drawn outside.
*/ */
void PlotPinTexts( PLOTTER *aPlotter, const wxPoint& aPinPos, int aPinOrient, void PlotPinTexts( PLOTTER* aPlotter, const VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const; int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const;
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) const; void PlotSymbol( PLOTTER* aPlotter, const VECTOR2I& aPosition, int aOrientation ) const;
void Offset( const wxPoint& aOffset ) override; void Offset( const VECTOR2I& aOffset ) override;
void MoveTo( const wxPoint& aNewPosition ) override; void MoveTo( const VECTOR2I& aNewPosition ) override;
wxPoint GetPosition() const override { return m_position; } VECTOR2I GetPosition() const override { return m_position; }
void SetPosition( const wxPoint& aPos ) override { m_position = aPos; } void SetPosition( const VECTOR2I& aPos ) override { m_position = aPos; }
wxPoint GetPinRoot() const; VECTOR2I GetPinRoot() const;
void MirrorHorizontal( const wxPoint& aCenter ) override; void MirrorHorizontal( const VECTOR2I& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override; void MirrorVertical( const VECTOR2I& aCenter ) override;
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill, void Plot( PLOTTER* aPlotter, const VECTOR2I& aPffset, bool aFill,
const TRANSFORM& aTransform ) const override; const TRANSFORM& aTransform ) const override;
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
@ -225,7 +225,7 @@ public:
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const VECTOR2I& aPosition ) override;
/** /**
* Return a string giving the electrical type of a pin. * Return a string giving the electrical type of a pin.
@ -242,7 +242,7 @@ protected:
* Print the pin symbol without text. * Print the pin symbol without text.
* If \a aColor != 0, draw with \a aColor, else with the normal pin color. * If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/ */
void printPinSymbol( const RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrientation ); void printPinSymbol( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPos, int aOrientation );
/** /**
* Put the pin number and pin text info, given the pin line coordinates. * Put the pin number and pin text info, given the pin line coordinates.
@ -252,13 +252,13 @@ protected:
* If aTextInside then the text is been put inside,otherwise all is drawn outside. * If aTextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring between '~' is negated * Pin Name: substring between '~' is negated
*/ */
void printPinTexts( const RENDER_SETTINGS* aSettings, wxPoint& aPinPos, int aPinOrient, void printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ); int aTextInside, bool aDrawPinNum, bool aDrawPinName );
/** /**
* Draw the electrical type text of the pin (only for the footprint editor) * Draw the electrical type text of the pin (only for the footprint editor)
*/ */
void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPoint& aPosition, void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECTOR2I& aPosition,
int aOrientation ); int aOrientation );
private: private:
@ -275,7 +275,7 @@ private:
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override; LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
protected: protected:
wxPoint m_position; // Position of the pin. VECTOR2I m_position; // Position of the pin.
int m_length; // Length of the pin. int m_length; // Length of the pin.
int m_orientation; // Pin orientation (Up, Down, Left, Right) int m_orientation; // Pin orientation (Up, Down, Left, Right)
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin

View File

@ -41,7 +41,7 @@ LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth, FILL_
} }
bool LIB_SHAPE::HitTest( const wxPoint& aPosRef, int aAccuracy ) const bool LIB_SHAPE::HitTest( const VECTOR2I& aPosRef, int aAccuracy ) const
{ {
if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) ) if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) )
aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE ); aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE );
@ -76,31 +76,31 @@ int LIB_SHAPE::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompare
} }
void LIB_SHAPE::Offset( const wxPoint& aOffset ) void LIB_SHAPE::Offset( const VECTOR2I& aOffset )
{ {
move( aOffset ); move( aOffset );
} }
void LIB_SHAPE::MoveTo( const wxPoint& aPosition ) void LIB_SHAPE::MoveTo( const VECTOR2I& aPosition )
{ {
setPosition( aPosition ); setPosition( aPosition );
} }
void LIB_SHAPE::MirrorHorizontal( const wxPoint& aCenter ) void LIB_SHAPE::MirrorHorizontal( const VECTOR2I& aCenter )
{ {
flip( aCenter, true ); flip( aCenter, true );
} }
void LIB_SHAPE::MirrorVertical( const wxPoint& aCenter ) void LIB_SHAPE::MirrorVertical( const VECTOR2I& aCenter )
{ {
flip( aCenter, false ); flip( aCenter, false );
} }
void LIB_SHAPE::Rotate( const wxPoint& aCenter, bool aRotateCCW ) void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
{ {
int rot_angle = aRotateCCW ? -900 : 900; int rot_angle = aRotateCCW ? -900 : 900;
@ -108,18 +108,18 @@ void LIB_SHAPE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
} }
void LIB_SHAPE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const const TRANSFORM& aTransform ) const
{ {
wxPoint start = aTransform.TransformCoordinate( m_start ) + aOffset; VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
wxPoint end = aTransform.TransformCoordinate( m_end ) + aOffset; VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
wxPoint center; VECTOR2I center;
int startAngle = 0; int startAngle = 0;
int endAngle = 0; int endAngle = 0;
int pen_size = GetEffectivePenWidth( aPlotter->RenderSettings() ); int pen_size = GetEffectivePenWidth( aPlotter->RenderSettings() );
FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL; FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
static std::vector<wxPoint> cornerList; static std::vector<VECTOR2I> cornerList;
if( GetShape() == SHAPE_T::POLY ) if( GetShape() == SHAPE_T::POLY )
{ {
@ -127,13 +127,13 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
cornerList.clear(); cornerList.clear();
for( const VECTOR2I& pt : poly.CPoints() ) for( const VECTOR2I& pt : poly.CPoints() )
cornerList.push_back( aTransform.TransformCoordinate( (wxPoint) pt ) + aOffset ); cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
} }
else if( GetShape() == SHAPE_T::BEZIER ) else if( GetShape() == SHAPE_T::BEZIER )
{ {
cornerList.clear(); cornerList.clear();
for( const wxPoint& pt : m_bezierPoints ) for( const VECTOR2I& pt : m_bezierPoints )
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset ); cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
} }
else if( GetShape() == SHAPE_T::ARC ) else if( GetShape() == SHAPE_T::ARC )
@ -210,8 +210,8 @@ int LIB_SHAPE::GetPenWidth() const
} }
void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
void* aData, const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
bool forceNoFill = static_cast<bool>( aData ); bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetEffectivePenWidth( aSettings ); int penWidth = GetEffectivePenWidth( aSettings );
@ -220,29 +220,29 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
return; return;
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
wxPoint pt1 = aTransform.TransformCoordinate( m_start ) + aOffset; VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
wxPoint pt2 = aTransform.TransformCoordinate( m_end ) + aOffset; VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
wxPoint c; VECTOR2I c;
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE ); COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D fillColor = color; COLOR4D fillColor = color;
unsigned ptCount = 0; unsigned ptCount = 0;
wxPoint* buffer = nullptr; VECTOR2I* buffer = nullptr;
if( GetShape() == SHAPE_T::POLY ) if( GetShape() == SHAPE_T::POLY )
{ {
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 ); const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
ptCount = poly.GetPointCount(); ptCount = poly.GetPointCount();
buffer = new wxPoint[ ptCount ]; buffer = new VECTOR2I[ptCount];
for( unsigned ii = 0; ii < ptCount; ++ii ) for( unsigned ii = 0; ii < ptCount; ++ii )
buffer[ii] = aTransform.TransformCoordinate( (wxPoint) poly.CPoint( ii ) ) + aOffset; buffer[ii] = aTransform.TransformCoordinate( poly.CPoint( ii ) ) + aOffset;
} }
else if( GetShape() == SHAPE_T::BEZIER ) else if( GetShape() == SHAPE_T::BEZIER )
{ {
ptCount = m_bezierPoints.size(); ptCount = m_bezierPoints.size();
buffer = new wxPoint[ ptCount ]; buffer = new VECTOR2I[ptCount];
for( size_t ii = 0; ii < ptCount; ++ii ) for( size_t ii = 0; ii < ptCount; ++ii )
buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset; buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset;
@ -403,7 +403,7 @@ BITMAPS LIB_SHAPE::GetMenuImage() const
} }
void LIB_SHAPE::AddPoint( const wxPoint& aPosition ) void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition )
{ {
if( GetShape() == SHAPE_T::POLY ) if( GetShape() == SHAPE_T::POLY )
{ {

View File

@ -52,7 +52,7 @@ public:
STROKE_PARAMS GetStroke() const { return m_stroke; } STROKE_PARAMS GetStroke() const { return m_stroke; }
void SetStroke( const STROKE_PARAMS& aStroke ) { m_stroke = aStroke; } void SetStroke( const STROKE_PARAMS& aStroke ) { m_stroke = aStroke; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
int GetPenWidth() const override; int GetPenWidth() const override;
@ -74,30 +74,30 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
void BeginEdit( const wxPoint& aStartPoint ) override { beginEdit( aStartPoint ); } void BeginEdit( const VECTOR2I& aStartPoint ) override { beginEdit( aStartPoint ); }
bool ContinueEdit( const wxPoint& aPosition ) override { return continueEdit( aPosition ); } bool ContinueEdit( const VECTOR2I& aPosition ) override { return continueEdit( aPosition ); }
void CalcEdit( const wxPoint& aPosition ) override { calcEdit( aPosition ); } void CalcEdit( const VECTOR2I& aPosition ) override { calcEdit( aPosition ); }
void EndEdit() override { endEdit(); } void EndEdit() override { endEdit(); }
void SetEditState( int aState ) { setEditState( aState ); } void SetEditState( int aState ) { setEditState( aState ); }
void AddPoint( const wxPoint& aPosition ); void AddPoint( const VECTOR2I& aPosition );
void Offset( const wxPoint& aOffset ) override; void Offset( const VECTOR2I& aOffset ) override;
void MoveTo( const wxPoint& aPosition ) override; void MoveTo( const VECTOR2I& aPosition ) override;
wxPoint GetPosition() const override { return getPosition(); } VECTOR2I GetPosition() const override { return getPosition(); }
void SetPosition( const wxPoint& aPosition ) override { setPosition( aPosition ); } void SetPosition( const VECTOR2I& aPosition ) override { setPosition( aPosition ); }
wxPoint GetCenter() const { return getCenter(); } VECTOR2I GetCenter() const { return getCenter(); }
void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const; void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const;
void MirrorHorizontal( const wxPoint& aCenter ) override; void MirrorHorizontal( const VECTOR2I& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override; void MirrorVertical( const VECTOR2I& aCenter ) override;
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const override; const TRANSFORM& aTransform ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -118,11 +118,11 @@ private:
int compare( const LIB_ITEM& aOther, int compare( const LIB_ITEM& aOther,
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override; LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
double getParentOrientation() const override { return 0.0; } double getParentOrientation() const override { return 0.0; }
wxPoint getParentPosition() const override { return wxPoint(); } VECTOR2I getParentPosition() const override { return VECTOR2I(); }
}; };

View File

@ -509,8 +509,8 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
} }
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aUnit,
int aUnit, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts ) int aConvert, const LIB_SYMBOL_OPTIONS& aOpts )
{ {
/* draw background for filled items using background option /* draw background for filled items using background option
* Solid lines will be drawn after the background * Solid lines will be drawn after the background
@ -580,7 +580,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
} }
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset, void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const const TRANSFORM& aTransform ) const
{ {
wxASSERT( aPlotter != nullptr ); wxASSERT( aPlotter != nullptr );
@ -635,8 +635,8 @@ void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint
} }
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
const wxPoint& aOffset, const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
wxASSERT( aPlotter != nullptr ); wxASSERT( aPlotter != nullptr );
@ -1107,7 +1107,7 @@ int LIB_SYMBOL::GetNextAvailableFieldId() const
} }
void LIB_SYMBOL::SetOffset( const wxPoint& aOffset ) void LIB_SYMBOL::SetOffset( const VECTOR2I& aOffset )
{ {
for( LIB_ITEM& item : m_drawings ) for( LIB_ITEM& item : m_drawings )
item.Offset( aOffset ); item.Offset( aOffset );
@ -1155,8 +1155,8 @@ void LIB_SYMBOL::ClearEditFlags()
} }
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
KICAD_T aType, const wxPoint& aPoint ) const VECTOR2I& aPoint )
{ {
for( LIB_ITEM& item : m_drawings ) for( LIB_ITEM& item : m_drawings )
{ {
@ -1176,10 +1176,10 @@ LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert,
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
const wxPoint& aPoint, const TRANSFORM& aTransform ) const VECTOR2I& aPoint, const TRANSFORM& aTransform )
{ {
/* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const /* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
* wxPoint& pt ) to search items. * VECTOR2I& pt ) to search items.
* because this function uses DefaultTransform as orient/mirror matrix * because this function uses DefaultTransform as orient/mirror matrix
* we temporary copy aTransform in DefaultTransform * we temporary copy aTransform in DefaultTransform
*/ */

View File

@ -311,8 +311,8 @@ public:
* @param aConvert - Symbol conversion (DeMorgan) if available. * @param aConvert - Symbol conversion (DeMorgan) if available.
* @param aOpts - Drawing options * @param aOpts - Drawing options
*/ */
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti, int aConvert,
int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts ); const LIB_SYMBOL_OPTIONS& aOpts );
/** /**
* Plot lib symbol to plotter. * Plot lib symbol to plotter.
@ -325,7 +325,7 @@ public:
* @param aOffset - Distance to shift the plot coordinates. * @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix. * @param aTransform - Symbol plot transform matrix.
*/ */
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset, void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ) const; const TRANSFORM& aTransform ) const;
/** /**
@ -338,7 +338,7 @@ public:
* @param aOffset - Distance to shift the plot coordinates. * @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix. * @param aTransform - Symbol plot transform matrix.
*/ */
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset, void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const VECTOR2I& aOffset,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** /**
@ -432,7 +432,7 @@ public:
* *
* @param aOffset - Offset displacement. * @param aOffset - Offset displacement.
*/ */
void SetOffset( const wxPoint& aOffset ); void SetOffset( const VECTOR2I& aOffset );
/** /**
* Remove duplicate draw items from list. * Remove duplicate draw items from list.
@ -461,7 +461,7 @@ public:
* @param aPoint - Coordinate for hit testing. * @param aPoint - Coordinate for hit testing.
* @return The draw object if found. Otherwise NULL. * @return The draw object if found. Otherwise NULL.
*/ */
LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint ); LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint );
/** /**
* Locate a draw object (overlaid) * Locate a draw object (overlaid)
@ -473,7 +473,7 @@ public:
* @param aTransform = the transform matrix * @param aTransform = the transform matrix
* @return The draw object if found. Otherwise NULL. * @return The draw object if found. Otherwise NULL.
*/ */
LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint, LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** /**

View File

@ -53,7 +53,7 @@ void LIB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
} }
bool LIB_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool LIB_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_TEXT tmp_text( *this ); EDA_TEXT tmp_text( *this );
tmp_text.SetTextPos( DefaultTransform.TransformCoordinate( GetTextPos() ) ); tmp_text.SetTextPos( DefaultTransform.TransformCoordinate( GetTextPos() ) );
@ -116,13 +116,13 @@ int LIB_TEXT::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareF
} }
void LIB_TEXT::Offset( const wxPoint& aOffset ) void LIB_TEXT::Offset( const VECTOR2I& aOffset )
{ {
EDA_TEXT::Offset( aOffset ); EDA_TEXT::Offset( aOffset );
} }
void LIB_TEXT::MoveTo( const wxPoint& newPosition ) void LIB_TEXT::MoveTo( const VECTOR2I& newPosition )
{ {
SetTextPos( newPosition ); SetTextPos( newPosition );
} }
@ -130,7 +130,7 @@ void LIB_TEXT::MoveTo( const wxPoint& newPosition )
void LIB_TEXT::NormalizeJustification( bool inverse ) void LIB_TEXT::NormalizeJustification( bool inverse )
{ {
wxPoint delta( 0, 0 ); VECTOR2I delta( 0, 0 );
EDA_RECT bbox = GetTextBox(); EDA_RECT bbox = GetTextBox();
if( GetTextAngle().IsHorizontal() ) if( GetTextAngle().IsHorizontal() )
@ -165,7 +165,7 @@ void LIB_TEXT::NormalizeJustification( bool inverse )
} }
void LIB_TEXT::MirrorHorizontal( const wxPoint& center ) void LIB_TEXT::MirrorHorizontal( const VECTOR2I& center )
{ {
NormalizeJustification( false ); NormalizeJustification( false );
int x = GetTextPos().x; int x = GetTextPos().x;
@ -194,7 +194,7 @@ void LIB_TEXT::MirrorHorizontal( const wxPoint& center )
} }
void LIB_TEXT::MirrorVertical( const wxPoint& center ) void LIB_TEXT::MirrorVertical( const VECTOR2I& center )
{ {
NormalizeJustification( false ); NormalizeJustification( false );
int y = GetTextPos().y; int y = GetTextPos().y;
@ -223,7 +223,7 @@ void LIB_TEXT::MirrorVertical( const wxPoint& center )
} }
void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW ) void LIB_TEXT::Rotate( const VECTOR2I& center, bool aRotateCCW )
{ {
NormalizeJustification( false ); NormalizeJustification( false );
int rot_angle = aRotateCCW ? -900 : 900; int rot_angle = aRotateCCW ? -900 : 900;
@ -257,7 +257,7 @@ void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW )
} }
void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_TEXT::Plot( PLOTTER* plotter, const VECTOR2I& offset, bool fill,
const TRANSFORM& aTransform ) const const TRANSFORM& aTransform ) const
{ {
wxASSERT( plotter != nullptr ); wxASSERT( plotter != nullptr );
@ -296,7 +296,7 @@ int LIB_TEXT::GetPenWidth() const
} }
void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void LIB_TEXT::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) const TRANSFORM& aTransform )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
@ -410,13 +410,13 @@ BITMAPS LIB_TEXT::GetMenuImage() const
} }
void LIB_TEXT::BeginEdit( const wxPoint& aPosition ) void LIB_TEXT::BeginEdit( const VECTOR2I& aPosition )
{ {
SetTextPos( aPosition ); SetTextPos( aPosition );
} }
void LIB_TEXT::CalcEdit( const wxPoint& aPosition ) void LIB_TEXT::CalcEdit( const VECTOR2I& aPosition )
{ {
SetTextPos( aPosition ); SetTextPos( aPosition );
} }

View File

@ -57,7 +57,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override
{ {
@ -81,22 +81,22 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void BeginEdit( const wxPoint& aStartPoint ) override; void BeginEdit( const VECTOR2I& aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override; void CalcEdit( const VECTOR2I& aPosition ) override;
void Offset( const wxPoint& aOffset ) override; void Offset( const VECTOR2I& aOffset ) override;
void MoveTo( const wxPoint& aPosition ) override; void MoveTo( const VECTOR2I& aPosition ) override;
wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); }
void MirrorHorizontal( const wxPoint& aCenter ) override; void MirrorHorizontal( const VECTOR2I& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override; void MirrorVertical( const VECTOR2I& aCenter ) override;
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override; void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void NormalizeJustification( bool inverse ); void NormalizeJustification( bool inverse );
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, void Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const override; const TRANSFORM& aTransform ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -120,7 +120,7 @@ private:
int compare( const LIB_ITEM& aOther, int compare( const LIB_ITEM& aOther,
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override; LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData, void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform ) override; const TRANSFORM& aTransform ) override;
}; };

View File

@ -240,7 +240,7 @@ bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject )
} }
void SCH_BASE_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ) void SCH_BASE_FRAME::RedrawScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer )
{ {
GetCanvas()->GetView()->SetCenter( aCenterPoint ); GetCanvas()->GetView()->SetCenter( aCenterPoint );
@ -251,7 +251,7 @@ void SCH_BASE_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
} }
void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointer ) void SCH_BASE_FRAME::CenterScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer )
{ {
GetCanvas()->GetView()->SetCenter( aCenterPoint ); GetCanvas()->GetView()->SetCenter( aCenterPoint );

View File

@ -192,9 +192,9 @@ public:
const LIB_ID& aPreselectedLibId, const LIB_ID& aPreselectedLibId,
int aUnit, int aConvert ); int aUnit, int aConvert );
virtual void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); virtual void RedrawScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer );
virtual void CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); virtual void CenterScreen( const VECTOR2I& aCenterPoint, bool aWarpPointer );
void HardRedraw() override; void HardRedraw() override;

View File

@ -40,7 +40,7 @@
#include <wx/mstream.h> #include <wx/mstream.h>
SCH_BITMAP::SCH_BITMAP( const wxPoint& pos ) : SCH_BITMAP::SCH_BITMAP( const VECTOR2I& pos ) :
SCH_ITEM( nullptr, SCH_BITMAP_T ) SCH_ITEM( nullptr, SCH_BITMAP_T )
{ {
m_pos = pos; m_pos = pos;
@ -114,9 +114,9 @@ const EDA_RECT SCH_BITMAP::GetBoundingBox() const
} }
void SCH_BITMAP::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_BITMAP::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxPoint pos = m_pos + aOffset; VECTOR2I pos = m_pos + aOffset;
m_image->DrawBitmap( aSettings->GetPrintDC(), pos ); m_image->DrawBitmap( aSettings->GetPrintDC(), pos );
} }
@ -142,9 +142,9 @@ void SCH_BITMAP::MirrorHorizontally( int aCenter )
} }
void SCH_BITMAP::Rotate( const wxPoint& aCenter ) void SCH_BITMAP::Rotate( const VECTOR2I& aCenter )
{ {
RotatePoint( &m_pos, aCenter, 900 ); RotatePoint( m_pos, aCenter, 900 );
m_image->Rotate( false ); m_image->Rotate( false );
} }
@ -160,7 +160,7 @@ void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const
#endif #endif
bool SCH_BITMAP::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();

View File

@ -40,7 +40,7 @@
class SCH_BITMAP : public SCH_ITEM class SCH_BITMAP : public SCH_ITEM
{ {
public: public:
SCH_BITMAP( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_BITMAP( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
SCH_BITMAP( const SCH_BITMAP& aSchBitmap ); SCH_BITMAP( const SCH_BITMAP& aSchBitmap );
@ -92,7 +92,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
/// @copydoc VIEW_ITEM::ViewGetLayers() /// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override; virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
@ -107,7 +107,7 @@ public:
*/ */
bool ReadImageFile( const wxString& aFullFilename ); bool ReadImageFile( const wxString& aFullFilename );
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
@ -122,7 +122,7 @@ public:
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{ {
@ -133,10 +133,10 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
wxPoint GetPosition() const override { return m_pos; } VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -148,7 +148,7 @@ public:
#endif #endif
private: private:
wxPoint m_pos; // XY coordinates of center of the bitmap VECTOR2I m_pos; // XY coordinates of center of the bitmap
BITMAP_BASE* m_image; // the BITMAP_BASE item BITMAP_BASE* m_image; // the BITMAP_BASE item
}; };

View File

@ -43,7 +43,7 @@
#include "sch_painter.h" #include "sch_painter.h"
SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, bool aFlipY ) : SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool aFlipY ) :
SCH_ITEM( nullptr, aType ) SCH_ITEM( nullptr, aType )
{ {
m_pos = pos; m_pos = pos;
@ -65,7 +65,7 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, bool
} }
SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, bool aFlipY ) : SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, bool aFlipY ) :
SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, aFlipY ) SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, aFlipY )
{ {
m_layer = LAYER_WIRE; m_layer = LAYER_WIRE;
@ -77,7 +77,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, bool aFlipY ) :
} }
SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, int aQuadrant ) : SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant ) :
SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, false ) SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, false )
{ {
switch( aQuadrant ) switch( aQuadrant )
@ -123,15 +123,15 @@ EDA_ITEM* SCH_BUS_BUS_ENTRY::Clone() const
} }
bool SCH_BUS_ENTRY_BASE::doIsConnected( const wxPoint& aPosition ) const bool SCH_BUS_ENTRY_BASE::doIsConnected( const VECTOR2I& aPosition ) const
{ {
return ( m_pos == aPosition || GetEnd() == aPosition ); return ( m_pos == aPosition || GetEnd() == aPosition );
} }
wxPoint SCH_BUS_ENTRY_BASE::GetEnd() const VECTOR2I SCH_BUS_ENTRY_BASE::GetEnd() const
{ {
return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y ); return VECTOR2I( m_pos.x + m_size.x, m_pos.y + m_size.y );
} }
@ -265,13 +265,13 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
} }
void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED ) ? COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED ) ?
aSettings->GetLayerColor( m_layer ) : GetBusEntryColor(); aSettings->GetLayerColor( m_layer ) : GetBusEntryColor();
wxPoint start = m_pos + aOffset; VECTOR2I start = m_pos + aOffset;
wxPoint end = GetEnd() + aOffset; VECTOR2I end = GetEnd() + aOffset;
int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth(); int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
if( GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE ) if( GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
@ -305,9 +305,9 @@ void SCH_BUS_ENTRY_BASE::MirrorHorizontally( int aCenter )
} }
void SCH_BUS_ENTRY_BASE::Rotate( const wxPoint& aCenter ) void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter )
{ {
RotatePoint( &m_pos, aCenter, 900 ); RotatePoint( m_pos, aCenter, 900 );
RotatePoint( &m_size.x, &m_size.y, 900 ); RotatePoint( &m_size.x, &m_size.y, 900 );
} }
@ -415,7 +415,7 @@ bool SCH_BUS_ENTRY_BASE::IsDangling() const
} }
std::vector<wxPoint> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const std::vector<VECTOR2I> SCH_BUS_ENTRY_BASE::GetConnectionPoints() const
{ {
return { m_pos, GetEnd() }; return { m_pos, GetEnd() };
} }
@ -445,7 +445,7 @@ BITMAPS SCH_BUS_BUS_ENTRY::GetMenuImage() const
} }
bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_BUS_ENTRY_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
// Insure minimum accuracy // Insure minimum accuracy
if( aAccuracy == 0 ) if( aAccuracy == 0 )

View File

@ -37,7 +37,8 @@
class SCH_BUS_ENTRY_BASE : public SCH_ITEM class SCH_BUS_ENTRY_BASE : public SCH_ITEM
{ {
public: public:
SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos = wxPoint( 0, 0 ), bool aFlipY = false ); SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos = VECTOR2I( 0, 0 ),
bool aFlipY = false );
bool IsDanglingStart() const { return m_isDanglingStart; } bool IsDanglingStart() const { return m_isDanglingStart; }
bool IsDanglingEnd() const { return m_isDanglingEnd; } bool IsDanglingEnd() const { return m_isDanglingEnd; }
@ -65,7 +66,7 @@ public:
*/ */
bool IsMovableFromAnchorPoint() const override { return false; } bool IsMovableFromAnchorPoint() const override { return false; }
wxPoint GetEnd() const; VECTOR2I GetEnd() const;
wxSize GetSize() const { return m_size; } wxSize GetSize() const { return m_size; }
void SetSize( const wxSize& aSize ) { m_size = aSize; } void SetSize( const wxSize& aSize ) { m_size = aSize; }
@ -84,29 +85,29 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
bool IsDangling() const override; bool IsDangling() const override;
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
wxPoint GetPosition() const override { return m_pos; } VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -120,10 +121,10 @@ public:
#endif #endif
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override; bool doIsConnected( const VECTOR2I& aPosition ) const override;
protected: protected:
wxPoint m_pos; VECTOR2I m_pos;
wxSize m_size; wxSize m_size;
bool m_isDanglingStart; bool m_isDanglingStart;
bool m_isDanglingEnd; bool m_isDanglingEnd;
@ -143,9 +144,9 @@ protected:
class SCH_BUS_WIRE_ENTRY : public SCH_BUS_ENTRY_BASE class SCH_BUS_WIRE_ENTRY : public SCH_BUS_ENTRY_BASE
{ {
public: public:
SCH_BUS_WIRE_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), bool aFlipY = false ); SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos = VECTOR2I( 0, 0 ), bool aFlipY = false );
SCH_BUS_WIRE_ENTRY( const wxPoint& pos, int aQuadrant ); SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant );
~SCH_BUS_WIRE_ENTRY() { } ~SCH_BUS_WIRE_ENTRY() { }

View File

@ -1288,7 +1288,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
if( !aItem->IsMoving() && aItem->IsConnectable() ) if( !aItem->IsMoving() && aItem->IsConnectable() )
{ {
std::vector< wxPoint > pts = aItem->GetConnectionPoints(); std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
for( auto i = pts.begin(); i != pts.end(); i++ ) for( auto i = pts.begin(); i != pts.end(); i++ )
{ {

View File

@ -262,7 +262,7 @@ public:
* @param aScreen is the screen to examine, or nullptr to examine the current screen. * @param aScreen is the screen to examine, or nullptr to examine the current screen.
* @return True if any wires or buses were broken. * @return True if any wires or buses were broken.
*/ */
bool BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, bool BreakSegment( SCH_LINE* aSegment, const VECTOR2I& aPoint,
SCH_LINE** aNewSegment = nullptr, SCH_SCREEN* aScreen = nullptr ); SCH_LINE** aNewSegment = nullptr, SCH_SCREEN* aScreen = nullptr );
/** /**
@ -275,7 +275,7 @@ public:
* @param aScreen is the screen to examine, or nullptr to examine the current screen. * @param aScreen is the screen to examine, or nullptr to examine the current screen.
* @return True if any wires or buses were broken. * @return True if any wires or buses were broken.
*/ */
bool BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen = nullptr ); bool BreakSegments( const VECTOR2I& aPoint, SCH_SCREEN* aScreen = nullptr );
/** /**
* Test all junctions and bus entries in the schematic for intersections with wires and * Test all junctions and bus entries in the schematic for intersections with wires and
@ -502,7 +502,7 @@ public:
*/ */
bool AskToSaveChanges(); bool AskToSaveChanges();
SCH_JUNCTION* AddJunction( SCH_SCREEN* aScreen, const wxPoint& aPos, bool aAppendToUndo, SCH_JUNCTION* AddJunction( SCH_SCREEN* aScreen, const VECTOR2I& aPos, bool aAppendToUndo,
bool aFinal = true ); bool aFinal = true );
/** /**
@ -526,14 +526,14 @@ public:
* @param aEnd The ending point for trimming * @param aEnd The ending point for trimming
* @return True if any wires were changed by this operation * @return True if any wires were changed by this operation
*/ */
bool TrimWire( const wxPoint& aStart, const wxPoint& aEnd ); bool TrimWire( const VECTOR2I& aStart, const VECTOR2I& aEnd );
/** /**
* Collect a unique list of all possible connection points in the schematic. * Collect a unique list of all possible connection points in the schematic.
* *
* @return vector of connections * @return vector of connections
*/ */
std::vector<wxPoint> GetSchematicConnections(); std::vector<VECTOR2I> GetSchematicConnections();
void OnOpenPcbnew( wxCommandEvent& event ); void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event ); void OnOpenCvpcb( wxCommandEvent& event );

View File

@ -53,7 +53,7 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/ee_actions.h> #include <tools/ee_actions.h>
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, SCH_FIELD::SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent,
const wxString& aName ) : const wxString& aName ) :
SCH_ITEM( aParent, SCH_FIELD_T ), SCH_ITEM( aParent, SCH_FIELD_T ),
EDA_TEXT( wxEmptyString ), EDA_TEXT( wxEmptyString ),
@ -213,7 +213,7 @@ int SCH_FIELD::GetPenWidth() const
} }
void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer ); COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer );
@ -297,9 +297,9 @@ EDA_ANGLE SCH_FIELD::GetDrawRotation() const
} }
wxPoint SCH_FIELD::GetDrawPos() const VECTOR2I SCH_FIELD::GetDrawPos() const
{ {
return (wxPoint)GetBoundingBox().Centre(); return GetBoundingBox().Centre();
} }
@ -360,7 +360,7 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
bool SCH_FIELD::IsHorizJustifyFlipped() const bool SCH_FIELD::IsHorizJustifyFlipped() const
{ {
VECTOR2I render_center = GetBoundingBox().Centre(); VECTOR2I render_center = GetBoundingBox().Centre();
wxPoint pos = GetPosition(); VECTOR2I pos = GetPosition();
switch( GetHorizJustify() ) switch( GetHorizJustify() )
{ {
@ -397,7 +397,7 @@ GR_TEXT_H_ALIGN_T SCH_FIELD::GetEffectiveHorizJustify() const
bool SCH_FIELD::IsVertJustifyFlipped() const bool SCH_FIELD::IsVertJustifyFlipped() const
{ {
VECTOR2I render_center = GetBoundingBox().Centre(); VECTOR2I render_center = GetBoundingBox().Centre();
wxPoint pos = GetPosition(); VECTOR2I pos = GetPosition();
switch( GetVertJustify() ) switch( GetVertJustify() )
{ {
@ -577,10 +577,10 @@ bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
} }
void SCH_FIELD::Rotate( const wxPoint& aCenter ) void SCH_FIELD::Rotate( const VECTOR2I& aCenter )
{ {
wxPoint pt = GetPosition(); VECTOR2I pt = GetPosition();
RotatePoint( &pt, aCenter, 900 ); RotatePoint( pt, aCenter, 900 );
SetPosition( pt ); SetPosition( pt );
} }
@ -786,7 +786,7 @@ BITMAPS SCH_FIELD::GetMenuImage() const
} }
bool SCH_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_FIELD::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
// Do not hit test hidden or empty fields. // Do not hit test hidden or empty fields.
if( !IsVisible() || IsVoid() ) if( !IsVisible() || IsVoid() )
@ -866,7 +866,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
} }
void SCH_FIELD::SetPosition( const wxPoint& aPosition ) void SCH_FIELD::SetPosition( const VECTOR2I& aPosition )
{ {
// Actual positions are calculated by the rotation/mirror transform of the parent symbol // Actual positions are calculated by the rotation/mirror transform of the parent symbol
// of the field. The inverse transform is used to calculate the position relative to the // of the field. The inverse transform is used to calculate the position relative to the
@ -874,7 +874,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T ) if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{ {
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent ); SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
wxPoint relPos = aPosition - parentSymbol->GetPosition(); VECTOR2I relPos = aPosition - parentSymbol->GetPosition();
relPos = parentSymbol->GetTransform().InverseTransform().TransformCoordinate( relPos ); relPos = parentSymbol->GetTransform().InverseTransform().TransformCoordinate( relPos );
@ -886,7 +886,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
} }
wxPoint SCH_FIELD::GetPosition() const VECTOR2I SCH_FIELD::GetPosition() const
{ {
if( m_parent && m_parent->Type() == SCH_SYMBOL_T ) if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{ {
@ -895,14 +895,14 @@ wxPoint SCH_FIELD::GetPosition() const
relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos ); relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos );
return (wxPoint)relativePos + parentSymbol->GetPosition(); return relativePos + parentSymbol->GetPosition();
} }
return (wxPoint)GetTextPos(); return GetTextPos();
} }
wxPoint SCH_FIELD::GetParentPosition() const VECTOR2I SCH_FIELD::GetParentPosition() const
{ {
return m_parent ? m_parent->GetPosition() : wxPoint( 0, 0 ); return m_parent ? m_parent->GetPosition() : wxPoint( 0, 0 );
} }

View File

@ -49,7 +49,7 @@ class LIB_FIELD;
class SCH_FIELD : public SCH_ITEM, public EDA_TEXT class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
{ {
public: public:
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent,
const wxString& aName = wxEmptyString ); const wxString& aName = wxEmptyString );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -119,8 +119,8 @@ public:
/** /**
* Adjusters to allow EDA_TEXT to draw/print/etc. text in absolute coords. * Adjusters to allow EDA_TEXT to draw/print/etc. text in absolute coords.
*/ */
EDA_ANGLE GetDrawRotation() const override; EDA_ANGLE GetDrawRotation() const override;
wxPoint GetDrawPos() const override; VECTOR2I GetDrawPos() const override;
GR_TEXT_H_ALIGN_T GetDrawHorizJustify() const override; GR_TEXT_H_ALIGN_T GetDrawHorizJustify() const override;
GR_TEXT_V_ALIGN_T GetDrawVertJustify() const override; GR_TEXT_V_ALIGN_T GetDrawVertJustify() const override;
@ -154,14 +154,14 @@ public:
int GetPenWidth() const override; int GetPenWidth() const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
Offset( aMoveVector ); Offset( aMoveVector );
} }
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
/** /**
* @copydoc SCH_ITEM::MirrorVertically() * @copydoc SCH_ITEM::MirrorVertically()
@ -198,12 +198,12 @@ public:
wxPoint GetLibPosition() const { return (wxPoint)EDA_TEXT::GetTextPos(); } wxPoint GetLibPosition() const { return (wxPoint)EDA_TEXT::GetTextPos(); }
wxPoint GetPosition() const override; VECTOR2I GetPosition() const override;
void SetPosition( const wxPoint& aPosition ) override; void SetPosition( const VECTOR2I& aPosition ) override;
wxPoint GetParentPosition() const; VECTOR2I GetParentPosition() const;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;

View File

@ -126,7 +126,7 @@ void SCH_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
} }
bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const bool SCH_ITEM::IsConnected( const VECTOR2I& aPosition ) const
{ {
if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) ) if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
return false; return false;

View File

@ -78,7 +78,7 @@ enum DANGLING_END_T
class DANGLING_END_ITEM class DANGLING_END_ITEM
{ {
public: public:
DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const wxPoint& aPosition ) DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition )
{ {
m_item = aItem; m_item = aItem;
m_type = aType; m_type = aType;
@ -86,7 +86,7 @@ public:
m_parent = aItem; m_parent = aItem;
} }
DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const wxPoint& aPosition, DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
const EDA_ITEM* aParent ) const EDA_ITEM* aParent )
{ {
m_item = aItem; m_item = aItem;
@ -117,14 +117,14 @@ public:
|| ( m_pos == rhs.m_pos && m_item < rhs.m_item ) ); || ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
} }
wxPoint GetPosition() const { return m_pos; } VECTOR2I GetPosition() const { return m_pos; }
EDA_ITEM* GetItem() const { return m_item; } EDA_ITEM* GetItem() const { return m_item; }
const EDA_ITEM* GetParent() const { return m_parent; } const EDA_ITEM* GetParent() const { return m_parent; }
DANGLING_END_T GetType() const { return m_type; } DANGLING_END_T GetType() const { return m_type; }
private: private:
EDA_ITEM* m_item; /// A pointer to the connectable object. EDA_ITEM* m_item; /// A pointer to the connectable object.
wxPoint m_pos; /// The position of the connection point. VECTOR2I m_pos; /// The position of the connection point.
DANGLING_END_T m_type; /// The type of connection of #m_item. DANGLING_END_T m_type; /// The type of connection of #m_item.
const EDA_ITEM* m_parent; /// A pointer to the parent object (in the case of pins) const EDA_ITEM* m_parent; /// A pointer to the parent object (in the case of pins)
}; };
@ -203,8 +203,8 @@ public:
*/ */
virtual bool IsMovableFromAnchorPoint() const { return true; } virtual bool IsMovableFromAnchorPoint() const { return true; }
wxPoint& GetStoredPos() { return m_storedPos; } VECTOR2I& GetStoredPos() { return m_storedPos; }
void SetStoredPos( const wxPoint& aPos ) { m_storedPos = aPos; } void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
/** /**
* Searches the item hierarchy to find a SCHEMATIC. * Searches the item hierarchy to find a SCHEMATIC.
@ -267,12 +267,12 @@ public:
* @param aOffset is the drawing offset (usually {0,0} but can be different when moving an * @param aOffset is the drawing offset (usually {0,0} but can be different when moving an
* object). * object).
*/ */
virtual void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0; virtual void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) = 0;
/** /**
* Move the item by \a aMoveVector to a new position. * Move the item by \a aMoveVector to a new position.
*/ */
virtual void Move( const wxPoint& aMoveVector ) = 0; virtual void Move( const VECTOR2I& aMoveVector ) = 0;
/** /**
* Mirror item horizontally about \a aCenter. * Mirror item horizontally about \a aCenter.
@ -287,7 +287,7 @@ public:
/** /**
* Rotate the item around \a aCenter 90 degrees in the clockwise direction. * Rotate the item around \a aCenter 90 degrees in the clockwise direction.
*/ */
virtual void Rotate( const wxPoint& aCenter ) = 0; virtual void Rotate( const VECTOR2I& aCenter ) = 0;
/** /**
* Add the schematic item end points to \a aItemList if the item has end points. * Add the schematic item end points to \a aItemList if the item has end points.
@ -336,7 +336,7 @@ public:
* @return true if the given point can start drawing (usually means the anchor is * @return true if the given point can start drawing (usually means the anchor is
* unused/free/dangling). * unused/free/dangling).
*/ */
virtual bool IsPointClickableAnchor( const wxPoint& aPos ) const { return false; } virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
/** /**
* Add all the connection points for this item to \a aPoints. * Add all the connection points for this item to \a aPoints.
@ -345,7 +345,7 @@ public:
* *
* @param aPoints is the list of connection points to add to. * @param aPoints is the list of connection points to add to.
*/ */
virtual std::vector<wxPoint> GetConnectionPoints() const { return {}; } virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
/** /**
* Clears all of the connection items from the list. * Clears all of the connection items from the list.
@ -358,10 +358,10 @@ public:
/** /**
* Test the item to see if it is connected to \a aPoint. * Test the item to see if it is connected to \a aPoint.
* *
* @param aPoint is a reference to a wxPoint object containing the coordinates to test. * @param aPoint is a reference to a VECTOR2I object containing the coordinates to test.
* @return True if connection to \a aPoint exists. * @return True if connection to \a aPoint exists.
*/ */
bool IsConnected( const wxPoint& aPoint ) const; bool IsConnected( const VECTOR2I& aPoint ) const;
/** /**
* Retrieve the connection associated with this object in the given sheet. * Retrieve the connection associated with this object in the given sheet.
@ -462,16 +462,16 @@ private:
* which performs tests common to all schematic items before calling the * which performs tests common to all schematic items before calling the
* item specific connection testing. * item specific connection testing.
* *
* @param aPosition is a reference to a wxPoint object containing the test position. * @param aPosition is a reference to a VECTOR2I object containing the test position.
* @return True if connection to \a aPosition exists. * @return True if connection to \a aPosition exists.
*/ */
virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; } virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
protected: protected:
SCH_LAYER_ID m_layer; SCH_LAYER_ID m_layer;
EDA_ITEMS m_connections; // List of items connected to this item. EDA_ITEMS m_connections; // List of items connected to this item.
FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement
wxPoint m_storedPos; // a temporary variable used in some move commands VECTOR2I m_storedPos; // a temporary variable used in some move commands
// to store a initial pos of the item or mouse cursor // to store a initial pos of the item or mouse cursor
/// Store pointers to other items that are connected to this one, per sheet. /// Store pointers to other items that are connected to this one, per sheet.

View File

@ -42,7 +42,7 @@
#include <connection_graph.h> #include <connection_graph.h>
SCH_JUNCTION::SCH_JUNCTION( const wxPoint& aPosition, int aDiameter, SCH_LAYER_ID aLayer ) : SCH_JUNCTION::SCH_JUNCTION( const VECTOR2I& aPosition, int aDiameter, SCH_LAYER_ID aLayer ) :
SCH_ITEM( nullptr, SCH_JUNCTION_T ) SCH_ITEM( nullptr, SCH_JUNCTION_T )
{ {
m_pos = aPosition; m_pos = aPosition;
@ -116,7 +116,7 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
} }
void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = GetJunctionColor(); COLOR4D color = GetJunctionColor();
@ -126,7 +126,7 @@ void SCH_JUNCTION::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffs
SHAPE_CIRCLE circle = getEffectiveShape(); SHAPE_CIRCLE circle = getEffectiveShape();
GRFilledCircle( nullptr, DC, (wxPoint) circle.GetCenter() + aOffset, circle.GetRadius(), GRFilledCircle( nullptr, DC, circle.GetCenter() + aOffset, circle.GetRadius(),
color ); color );
} }
@ -143,9 +143,9 @@ void SCH_JUNCTION::MirrorHorizontally( int aCenter )
} }
void SCH_JUNCTION::Rotate( const wxPoint& aCenter ) void SCH_JUNCTION::Rotate( const VECTOR2I& aCenter )
{ {
RotatePoint( &m_pos, aCenter, 900 ); RotatePoint( m_pos, aCenter, 900 );
} }
@ -156,7 +156,7 @@ void SCH_JUNCTION::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
} }
std::vector<wxPoint> SCH_JUNCTION::GetConnectionPoints() const std::vector<VECTOR2I> SCH_JUNCTION::GetConnectionPoints() const
{ {
return { m_pos }; return { m_pos };
} }
@ -198,7 +198,7 @@ int SCH_JUNCTION::GetEffectiveDiameter() const
} }
bool SCH_JUNCTION::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_JUNCTION::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
if( aAccuracy >= 0 ) if( aAccuracy >= 0 )
return getEffectiveShape().Collide( SEG( aPosition, aPosition ), aAccuracy ); return getEffectiveShape().Collide( SEG( aPosition, aPosition ), aAccuracy );
@ -230,7 +230,7 @@ bool SCH_JUNCTION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
} }
bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const bool SCH_JUNCTION::doIsConnected( const VECTOR2I& aPosition ) const
{ {
return m_pos == aPosition; return m_pos == aPosition;
} }

View File

@ -35,7 +35,7 @@ class NETLIST_OBJECT_LIST;
class SCH_JUNCTION : public SCH_ITEM class SCH_JUNCTION : public SCH_ITEM
{ {
public: public:
SCH_JUNCTION( const wxPoint& aPosition = wxPoint( 0, 0 ), int aDiameter = 0, SCH_JUNCTION( const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), int aDiameter = 0,
SCH_LAYER_ID aLayer = LAYER_JUNCTION ); SCH_LAYER_ID aLayer = LAYER_JUNCTION );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -69,22 +69,22 @@ public:
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override; void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
bool CanConnect( const SCH_ITEM* aItem ) const override bool CanConnect( const SCH_ITEM* aItem ) const override
{ {
@ -100,10 +100,10 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
wxPoint GetPosition() const override { return m_pos; } VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return false; } bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return false; }
int GetEffectiveDiameter() const; int GetEffectiveDiameter() const;
@ -115,7 +115,7 @@ public:
COLOR4D GetColor() const { return m_color; } COLOR4D GetColor() const { return m_color; }
void SetColor( const COLOR4D& aColor ) { m_color = aColor; } void SetColor( const COLOR4D& aColor ) { m_color = aColor; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -129,11 +129,11 @@ public:
#endif #endif
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override; bool doIsConnected( const VECTOR2I& aPosition ) const override;
SHAPE_CIRCLE getEffectiveShape() const; SHAPE_CIRCLE getEffectiveShape() const;
wxPoint m_pos; ///< Position of the junction. VECTOR2I m_pos; ///< Position of the junction.
int m_diameter; ///< Diameter of the junction. Zero is user default. int m_diameter; ///< Diameter of the junction. Zero is user default.
COLOR4D m_color; ///< Color of the junction. #COLOR4D::UNSPECIFIED is user default. COLOR4D m_color; ///< Color of the junction. #COLOR4D::UNSPECIFIED is user default.

View File

@ -132,9 +132,9 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyleByName( const wxString& aStyleName )
} }
void SCH_LINE::Move( const wxPoint& aOffset ) void SCH_LINE::Move( const VECTOR2I& aOffset )
{ {
if( aOffset != wxPoint( 0, 0 ) ) if( aOffset != VECTOR2I( 0, 0 ) )
{ {
m_start += aOffset; m_start += aOffset;
m_end += aOffset; m_end += aOffset;
@ -143,9 +143,9 @@ void SCH_LINE::Move( const wxPoint& aOffset )
} }
void SCH_LINE::MoveStart( const wxPoint& aOffset ) void SCH_LINE::MoveStart( const VECTOR2I& aOffset )
{ {
if( aOffset != wxPoint( 0, 0 ) ) if( aOffset != VECTOR2I( 0, 0 ) )
{ {
m_start += aOffset; m_start += aOffset;
SetModified(); SetModified();
@ -153,9 +153,9 @@ void SCH_LINE::MoveStart( const wxPoint& aOffset )
} }
void SCH_LINE::MoveEnd( const wxPoint& aOffset ) void SCH_LINE::MoveEnd( const VECTOR2I& aOffset )
{ {
if( aOffset != wxPoint( 0, 0 ) ) if( aOffset != VECTOR2I( 0, 0 ) )
{ {
m_end += aOffset; m_end += aOffset;
SetModified(); SetModified();
@ -365,7 +365,7 @@ int SCH_LINE::GetPenWidth() const
} }
void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = GetLineColor(); COLOR4D color = GetLineColor();
@ -373,8 +373,8 @@ void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset )
if( color == COLOR4D::UNSPECIFIED ) if( color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( GetLayer() ); color = aSettings->GetLayerColor( GetLayer() );
wxPoint start = m_start; VECTOR2I start = m_start;
wxPoint end = m_end; VECTOR2I end = m_end;
PLOT_DASH_TYPE lineStyle = GetEffectiveLineStyle(); PLOT_DASH_TYPE lineStyle = GetEffectiveLineStyle();
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
@ -415,31 +415,31 @@ void SCH_LINE::MirrorHorizontally( int aCenter )
} }
void SCH_LINE::Rotate( const wxPoint& aCenter ) void SCH_LINE::Rotate( const VECTOR2I& aCenter )
{ {
if( m_flags & STARTPOINT ) if( m_flags & STARTPOINT )
RotatePoint( &m_start, aCenter, 900 ); RotatePoint( m_start, aCenter, 900 );
if( m_flags & ENDPOINT ) if( m_flags & ENDPOINT )
RotatePoint( &m_end, aCenter, 900 ); RotatePoint( m_end, aCenter, 900 );
} }
void SCH_LINE::RotateStart( const wxPoint& aCenter ) void SCH_LINE::RotateStart( const VECTOR2I& aCenter )
{ {
RotatePoint( &m_start, aCenter, 900 ); RotatePoint( m_start, aCenter, 900 );
} }
void SCH_LINE::RotateEnd( const wxPoint& aCenter ) void SCH_LINE::RotateEnd( const VECTOR2I& aCenter )
{ {
RotatePoint( &m_end, aCenter, 900 ); RotatePoint( m_end, aCenter, 900 );
} }
int SCH_LINE::GetAngleFrom( const wxPoint& aPoint ) const int SCH_LINE::GetAngleFrom( const VECTOR2I& aPoint ) const
{ {
wxPoint vec; VECTOR2I vec;
if( aPoint == m_start ) if( aPoint == m_start )
vec = m_end - aPoint; vec = m_end - aPoint;
@ -450,9 +450,9 @@ int SCH_LINE::GetAngleFrom( const wxPoint& aPoint ) const
} }
int SCH_LINE::GetReverseAngleFrom( const wxPoint& aPoint ) const int SCH_LINE::GetReverseAngleFrom( const VECTOR2I& aPoint ) const
{ {
wxPoint vec; VECTOR2I vec;
if( aPoint == m_end ) if( aPoint == m_end )
vec = m_start - aPoint; vec = m_start - aPoint;
@ -468,8 +468,8 @@ bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const
wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false, wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false,
wxT( "Cannot test line segment for overlap." ) ); wxT( "Cannot test line segment for overlap." ) );
wxPoint firstSeg = m_end - m_start; VECTOR2I firstSeg = m_end - m_start;
wxPoint secondSeg = aLine->m_end - aLine->m_start; VECTOR2I secondSeg = aLine->m_end - aLine->m_start;
// Use long long here to avoid overflow in calculations // Use long long here to avoid overflow in calculations
return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x ); return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x );
@ -479,7 +479,7 @@ bool SCH_LINE::IsParallel( const SCH_LINE* aLine ) const
SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCheckJunctions ) SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCheckJunctions )
{ {
auto less = auto less =
[]( const wxPoint& lhs, const wxPoint& rhs ) -> bool []( const VECTOR2I& lhs, const VECTOR2I& rhs ) -> bool
{ {
if( lhs.x == rhs.x ) if( lhs.x == rhs.x )
return lhs.y < rhs.y; return lhs.y < rhs.y;
@ -493,11 +493,11 @@ SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCh
if( this == aLine || GetLayer() != aLine->GetLayer() ) if( this == aLine || GetLayer() != aLine->GetLayer() )
return nullptr; return nullptr;
wxPoint leftmost_start = aLine->m_start; VECTOR2I leftmost_start = aLine->m_start;
wxPoint leftmost_end = aLine->m_end; VECTOR2I leftmost_end = aLine->m_end;
wxPoint rightmost_start = m_start; VECTOR2I rightmost_start = m_start;
wxPoint rightmost_end = m_end; VECTOR2I rightmost_end = m_end;
// We place the start to the left and below the end of both lines // We place the start to the left and below the end of both lines
if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) ) if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) )
@ -515,8 +515,8 @@ SCH_LINE* SCH_LINE::MergeOverlap( SCH_SCREEN* aScreen, SCH_LINE* aLine, bool aCh
std::swap( leftmost_end, rightmost_end ); std::swap( leftmost_end, rightmost_end );
} }
wxPoint other_start = rightmost_start; VECTOR2I other_start = rightmost_start;
wxPoint other_end = rightmost_end; VECTOR2I other_end = rightmost_end;
if( less( rightmost_end, leftmost_end ) ) if( less( rightmost_end, leftmost_end ) )
{ {
@ -700,7 +700,7 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
} }
std::vector<wxPoint> SCH_LINE::GetConnectionPoints() const std::vector<VECTOR2I> SCH_LINE::GetConnectionPoints() const
{ {
return { m_start, m_end }; return { m_start, m_end };
} }
@ -719,7 +719,7 @@ bool SCH_LINE::ConnectionPropagatesTo( const EDA_ITEM* aItem ) const
} }
void SCH_LINE::GetSelectedPoints( std::vector< wxPoint >& aPoints ) const void SCH_LINE::GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const
{ {
if( m_flags & STARTPOINT ) if( m_flags & STARTPOINT )
aPoints.push_back( m_start ); aPoints.push_back( m_start );
@ -800,7 +800,7 @@ bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
} }
bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
// Performance enhancement for connection-building // Performance enhancement for connection-building
if( aPosition == m_start || aPosition == m_end ) if( aPosition == m_start || aPosition == m_end )
@ -852,7 +852,7 @@ void SCH_LINE::SwapData( SCH_ITEM* aItem )
} }
bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const bool SCH_LINE::doIsConnected( const VECTOR2I& aPosition ) const
{ {
if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS ) if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS )
return false; return false;
@ -882,7 +882,7 @@ void SCH_LINE::Plot( PLOTTER* aPlotter ) const
} }
void SCH_LINE::SetPosition( const wxPoint& aPosition ) void SCH_LINE::SetPosition( const VECTOR2I& aPosition )
{ {
m_end = m_end - ( m_start - aPosition ); m_end = m_end - ( m_start - aPosition );
m_start = aPosition; m_start = aPosition;

View File

@ -79,21 +79,21 @@ public:
return false; return false;
} }
bool IsEndPoint( const wxPoint& aPoint ) const bool IsEndPoint( const VECTOR2I& aPoint ) const
{ {
return aPoint == m_start || aPoint == m_end; return aPoint == m_start || aPoint == m_end;
} }
int GetAngleFrom( const wxPoint& aPoint ) const; int GetAngleFrom( const VECTOR2I& aPoint ) const;
int GetReverseAngleFrom( const wxPoint& aPoint ) const; int GetReverseAngleFrom( const VECTOR2I& aPoint ) const;
bool IsNull() const { return m_start == m_end; } bool IsNull() const { return m_start == m_end; }
wxPoint GetStartPoint() const { return m_start; } VECTOR2I GetStartPoint() const { return m_start; }
void SetStartPoint( const wxPoint& aPosition ) { m_start = aPosition; } void SetStartPoint( const VECTOR2I& aPosition ) { m_start = aPosition; }
wxPoint GetEndPoint() const { return m_end; } VECTOR2I GetEndPoint() const { return m_end; }
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; } void SetEndPoint( const VECTOR2I& aPosition ) { m_end = aPosition; }
void SetLastResolvedState( const SCH_ITEM* aItem ) override void SetLastResolvedState( const SCH_ITEM* aItem ) override
{ {
@ -174,19 +174,19 @@ public:
*/ */
double GetLength() const; double GetLength() const;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
int GetPenWidth() const override; int GetPenWidth() const override;
void Move( const wxPoint& aMoveVector ) override; void Move( const VECTOR2I& aMoveVector ) override;
void MoveStart( const wxPoint& aMoveVector ); void MoveStart( const VECTOR2I& aMoveVector );
void MoveEnd( const wxPoint& aMoveVector ); void MoveEnd( const VECTOR2I& aMoveVector );
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
void RotateStart( const wxPoint& aCenter ); void RotateStart( const VECTOR2I& aCenter );
void RotateEnd( const wxPoint& aCenter ); void RotateEnd( const VECTOR2I& aCenter );
/** /**
* Check line against \a aLine to see if it overlaps and merge if it does. * Check line against \a aLine to see if it overlaps and merge if it does.
@ -216,11 +216,11 @@ public:
bool IsConnectable() const override; bool IsConnectable() const override;
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const override; bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const override;
void GetSelectedPoints( std::vector< wxPoint >& aPoints ) const; void GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const;
bool CanConnect( const SCH_ITEM* aItem ) const override; bool CanConnect( const SCH_ITEM* aItem ) const override;
@ -230,16 +230,16 @@ public:
bool operator <( const SCH_ITEM& aItem ) const override; bool operator <( const SCH_ITEM& aItem ) const override;
wxPoint GetPosition() const override { return m_start; } VECTOR2I GetPosition() const override { return m_start; }
void SetPosition( const wxPoint& aPosition ) override; void SetPosition( const VECTOR2I& aPosition ) override;
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{ {
return ( GetStartPoint() == aPos && IsStartDangling() ) return ( GetStartPoint() == aPos && IsStartDangling() )
|| ( GetEndPoint() == aPos && IsEndDangling() ); || ( GetEndPoint() == aPos && IsEndDangling() );
} }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -276,12 +276,12 @@ public:
bool IsBus() const; bool IsBus() const;
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override; bool doIsConnected( const VECTOR2I& aPosition ) const override;
bool m_startIsDangling; ///< True if start point is not connected. bool m_startIsDangling; ///< True if start point is not connected.
bool m_endIsDangling; ///< True if end point is not connected. bool m_endIsDangling; ///< True if end point is not connected.
wxPoint m_start; ///< Line start point VECTOR2I m_start; ///< Line start point
wxPoint m_end; ///< Line end point VECTOR2I m_end; ///< Line end point
STROKE_PARAMS m_stroke; ///< Line stroke properties. STROKE_PARAMS m_stroke; ///< Line stroke properties.
// If real-time connectivity gets disabled (due to being too slow on a particular // If real-time connectivity gets disabled (due to being too slow on a particular

View File

@ -40,7 +40,7 @@
#define SCALING_FACTOR Millimeter2iu( 0.15 ) #define SCALING_FACTOR Millimeter2iu( 0.15 )
SCH_MARKER::SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const wxPoint& aPos ) : SCH_MARKER::SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos ) :
SCH_ITEM( nullptr, SCH_MARKER_T ), SCH_ITEM( nullptr, SCH_MARKER_T ),
MARKER_BASE( SCALING_FACTOR, aItem, MARKER_BASE::MARKER_ERC ) MARKER_BASE( SCALING_FACTOR, aItem, MARKER_BASE::MARKER_ERC )
{ {
@ -149,7 +149,7 @@ KIGFX::COLOR4D SCH_MARKER::getColor() const
} }
void SCH_MARKER::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_MARKER::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
PrintMarker( aSettings, aOffset ); PrintMarker( aSettings, aOffset );
} }
@ -179,7 +179,7 @@ BITMAPS SCH_MARKER::GetMenuImage() const
} }
void SCH_MARKER::Rotate( const wxPoint& aCenter ) void SCH_MARKER::Rotate( const VECTOR2I& aCenter )
{ {
// Marker geometry isn't user-editable // Marker geometry isn't user-editable
} }
@ -197,7 +197,7 @@ void SCH_MARKER::MirrorHorizontally( int aCenter )
} }
bool SCH_MARKER::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_MARKER::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
return HitTestMarker( aPosition, aAccuracy ); return HitTestMarker( aPosition, aAccuracy );
} }

View File

@ -33,7 +33,7 @@
class SCH_MARKER : public SCH_ITEM, public MARKER_BASE class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
{ {
public: public:
SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const wxPoint& aPos ); SCH_MARKER( std::shared_ptr<ERC_ITEM> aItem, const VECTOR2I& aPos );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -58,7 +58,7 @@ public:
SCH_LAYER_ID GetColorLayer() const; SCH_LAYER_ID GetColorLayer() const;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void Plot( PLOTTER* /* aPlotter */ ) const override void Plot( PLOTTER* /* aPlotter */ ) const override
{ {
@ -71,14 +71,14 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
/** /**
* Compare DRC marker main and auxiliary text against search string. * Compare DRC marker main and auxiliary text against search string.
@ -98,10 +98,10 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
wxPoint GetPosition() const override { return m_Pos; } VECTOR2I GetPosition() const override { return m_Pos; }
void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; } void SetPosition( const VECTOR2I& aPosition ) override { m_Pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;

View File

@ -38,7 +38,7 @@
#include <trigo.h> #include <trigo.h>
SCH_NO_CONNECT::SCH_NO_CONNECT( const wxPoint& pos ) : SCH_NO_CONNECT::SCH_NO_CONNECT( const VECTOR2I& pos ) :
SCH_ITEM( nullptr, SCH_NO_CONNECT_T ) SCH_ITEM( nullptr, SCH_NO_CONNECT_T )
{ {
m_pos = pos; m_pos = pos;
@ -101,7 +101,7 @@ int SCH_NO_CONNECT::GetPenWidth() const
} }
void SCH_NO_CONNECT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_NO_CONNECT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
int half = GetSize() / 2; int half = GetSize() / 2;
@ -127,29 +127,29 @@ void SCH_NO_CONNECT::MirrorHorizontally( int aCenter )
} }
void SCH_NO_CONNECT::Rotate( const wxPoint& aCenter ) void SCH_NO_CONNECT::Rotate( const VECTOR2I& aCenter )
{ {
RotatePoint( &m_pos, aCenter, 900 ); RotatePoint( m_pos, aCenter, 900 );
} }
std::vector<wxPoint> SCH_NO_CONNECT::GetConnectionPoints() const std::vector<VECTOR2I> SCH_NO_CONNECT::GetConnectionPoints() const
{ {
return { m_pos }; return { m_pos };
} }
bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const bool SCH_NO_CONNECT::doIsConnected( const VECTOR2I& aPosition ) const
{ {
return m_pos == aPosition; return m_pos == aPosition;
} }
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_NO_CONNECT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
int delta = ( GetPenWidth() + GetSize() ) / 2 + aAccuracy; int delta = ( GetPenWidth() + GetSize() ) / 2 + aAccuracy;
wxPoint dist = aPosition - m_pos; VECTOR2I dist = aPosition - m_pos;
if( ( std::abs( dist.x ) <= delta ) && ( std::abs( dist.y ) <= delta ) ) if( ( std::abs( dist.x ) <= delta ) && ( std::abs( dist.y ) <= delta ) )
return true; return true;

View File

@ -38,7 +38,7 @@ class NETLIST_OBJECT_LIST;
class SCH_NO_CONNECT : public SCH_ITEM class SCH_NO_CONNECT : public SCH_ITEM
{ {
public: public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_NO_CONNECT( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -65,7 +65,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override; void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
@ -73,14 +73,14 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
@ -90,7 +90,7 @@ public:
aItem->Type() == SCH_SYMBOL_T; aItem->Type() == SCH_SYMBOL_T;
} }
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{ {
@ -99,10 +99,10 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
wxPoint GetPosition() const override { return m_pos; } VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -114,10 +114,10 @@ public:
#endif #endif
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override; bool doIsConnected( const VECTOR2I& aPosition ) const override;
wxPoint m_pos; ///< Position of the no connect object. VECTOR2I m_pos; ///< Position of the no connect object.
int m_size; ///< Size of the no connect object. int m_size; ///< Size of the no connect object.
}; };

View File

@ -144,8 +144,8 @@ static LIB_SYMBOL* dummy()
LIB_SHAPE* square = new LIB_SHAPE( symbol, SHAPE_T::RECT ); LIB_SHAPE* square = new LIB_SHAPE( symbol, SHAPE_T::RECT );
square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) ); square->MoveTo( VECTOR2I( Mils2iu( -200 ), Mils2iu( 200 ) ) );
square->SetEnd( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) ); square->SetEnd( VECTOR2I( Mils2iu( 200 ), Mils2iu( -200 ) ) );
LIB_TEXT* text = new LIB_TEXT( symbol ); LIB_TEXT* text = new LIB_TEXT( symbol );
@ -446,7 +446,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition, dou
const STROKE_FONT& font = m_gal->GetStrokeFont(); const STROKE_FONT& font = m_gal->GetStrokeFont();
VECTOR2D extents = font.ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(), VECTOR2D extents = font.ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(),
m_gal->GetLineWidth() ); m_gal->GetLineWidth() );
EDA_RECT box( (wxPoint) aPosition, wxSize( extents.x, extents.y ) ); EDA_RECT box( (VECTOR2I) aPosition, wxSize( extents.x, extents.y ) );
if( m_gal->GetHorizontalJustify() == GR_TEXT_H_ALIGN_CENTER ) if( m_gal->GetHorizontalJustify() == GR_TEXT_H_ALIGN_CENTER )
box.SetX( box.GetX() - ( box.GetWidth() / 2) ); box.SetX( box.GetX() - ( box.GetWidth() / 2) );
@ -459,7 +459,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition, dou
box.SetY( box.GetY() - box.GetHeight() ); box.SetY( box.GetY() - box.GetHeight() );
box.Normalize(); // Make h and v sizes always >= 0 box.Normalize(); // Make h and v sizes always >= 0
box = box.GetBoundingBoxRotated((wxPoint) aPosition, RAD2DECIDEG( aAngle ) ); box = box.GetBoundingBoxRotated((VECTOR2I) aPosition, RAD2DECIDEG( aAngle ) );
box.RevertYAxis(); box.RevertYAxis();
m_gal->DrawRectangle( mapCoords( box.GetOrigin() ), mapCoords( box.GetEnd() ) ); m_gal->DrawRectangle( mapCoords( box.GetOrigin() ), mapCoords( box.GetEnd() ) );
} }
@ -617,7 +617,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
std::deque<VECTOR2D> mappedPts; std::deque<VECTOR2D> mappedPts;
for( const VECTOR2I& pt : poly.CPoints() ) for( const VECTOR2I& pt : poly.CPoints() )
mappedPts.push_back( mapCoords( (wxPoint) pt ) ); mappedPts.push_back( mapCoords( pt ) );
m_gal->DrawPolygon( mappedPts ); m_gal->DrawPolygon( mappedPts );
} }
@ -627,7 +627,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
{ {
std::deque<VECTOR2D> mappedPts; std::deque<VECTOR2D> mappedPts;
for( const wxPoint& p : aShape->GetBezierPoints() ) for( const VECTOR2I& p : aShape->GetBezierPoints() )
mappedPts.push_back( mapCoords( p ) ); mappedPts.push_back( mapCoords( p ) );
m_gal->DrawPolygon( mappedPts ); m_gal->DrawPolygon( mappedPts );
@ -709,7 +709,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
{ {
m_gal->SetLineWidth( m_schSettings.m_outlineWidth ); m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) ); m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
m_gal->DrawLine( textpos, wxPoint( 0, 0 ) ); m_gal->DrawLine( textpos, VECTOR2I( 0, 0 ) );
} }
} }
@ -1238,8 +1238,8 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth, void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDrawingShadows, bool aBrightened ) bool aDrawingShadows, bool aBrightened )
{ {
wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ), VECTOR2I radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) ); aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) );
// Dangling symbols must be drawn in a slightly different colour so they can be seen when // Dangling symbols must be drawn in a slightly different colour so they can be seen when
// they overlap with a junction dot. // they overlap with a junction dot.
@ -1319,7 +1319,7 @@ void SCH_PAINTER::draw( const SCH_LINE *aLine, int aLayer )
SHAPE_SEGMENT line( aLine->GetStartPoint(), aLine->GetEndPoint() ); SHAPE_SEGMENT line( aLine->GetStartPoint(), aLine->GetEndPoint() );
STROKE_PARAMS::Stroke( &line, lineStyle, width, &m_schSettings, STROKE_PARAMS::Stroke( &line, lineStyle, width, &m_schSettings,
[&]( const wxPoint& a, const wxPoint& b ) [&]( const VECTOR2I& a, const VECTOR2I& b )
{ {
m_gal->DrawLine( a, b ); m_gal->DrawLine( a, b );
} ); } );
@ -1422,7 +1422,7 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
for( SHAPE* shape : shapes ) for( SHAPE* shape : shapes )
{ {
STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings, STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings,
[&]( const wxPoint& a, const wxPoint& b ) [&]( const VECTOR2I& a, const VECTOR2I& b )
{ {
m_gal->DrawLine( a, b ); m_gal->DrawLine( a, b );
} ); } );
@ -1564,13 +1564,13 @@ static void orientSymbol( LIB_SYMBOL* symbol, int orientation )
for( auto& item : symbol->GetDrawItems() ) for( auto& item : symbol->GetDrawItems() )
{ {
for( int i = 0; i < o.n_rots; i++ ) for( int i = 0; i < o.n_rots; i++ )
item.Rotate( wxPoint(0, 0 ), true ); item.Rotate( VECTOR2I(0, 0 ), true );
if( o.mirror_x ) if( o.mirror_x )
item.MirrorVertical( wxPoint( 0, 0 ) ); item.MirrorVertical( VECTOR2I( 0, 0 ) );
if( o.mirror_y ) if( o.mirror_y )
item.MirrorHorizontal( wxPoint( 0, 0 ) ); item.MirrorHorizontal( VECTOR2I( 0, 0 ) );
} }
} }
@ -1612,7 +1612,7 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
for( auto& tempItem : tempSymbol.GetDrawItems() ) for( auto& tempItem : tempSymbol.GetDrawItems() )
{ {
tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) ); tempItem.MoveTo( tempItem.GetPosition() + (VECTOR2I) mapCoords( aSymbol->GetPosition() ) );
} }
// Copy the pin info from the symbol to the temp pins // Copy the pin info from the symbol to the temp pins
@ -1737,7 +1737,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
// Draw the umbilical line // Draw the umbilical line
if( aField->IsMoving() ) if( aField->IsMoving() )
{ {
wxPoint parentPos = aField->GetParentPosition(); VECTOR2I parentPos = aField->GetParentPosition();
m_gal->SetLineWidth( m_schSettings.m_outlineWidth ); m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) ); m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
@ -1764,12 +1764,12 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer )
COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows ); COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows );
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
std::deque<VECTOR2D> pts2; std::deque<VECTOR2D> pts2;
aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() ); aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
for( const wxPoint& p : pts ) for( const VECTOR2I& p : pts )
pts2.emplace_back( VECTOR2D( p.x, p.y ) ); pts2.emplace_back( VECTOR2D( p.x, p.y ) );
// The text is drawn inside the graphic shape. // The text is drawn inside the graphic shape.
@ -1838,12 +1838,12 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer )
color = getRenderColor( aLabel, LAYER_BUS, drawingShadows ); color = getRenderColor( aLabel, LAYER_BUS, drawingShadows );
} }
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
std::deque<VECTOR2D> pts2; std::deque<VECTOR2D> pts2;
aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint)aLabel->GetTextPos() ); aLabel->CreateGraphicShape( &m_schSettings, pts, (VECTOR2I)aLabel->GetTextPos() );
for( const wxPoint& p : pts ) for( const VECTOR2I& p : pts )
pts2.emplace_back( VECTOR2D( p.x, p.y ) ); pts2.emplace_back( VECTOR2D( p.x, p.y ) );
m_gal->SetIsFill( true ); m_gal->SetIsFill( true );
@ -1886,12 +1886,12 @@ void SCH_PAINTER::draw( const SCH_NETCLASS_FLAG *aLabel, int aLayer )
return; return;
} }
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
std::deque<VECTOR2D> pts2; std::deque<VECTOR2D> pts2;
aLabel->CreateGraphicShape( &m_schSettings, pts, (wxPoint) aLabel->GetTextPos() ); aLabel->CreateGraphicShape( &m_schSettings, pts, aLabel->GetTextPos() );
for( const wxPoint& p : pts ) for( const VECTOR2I& p : pts )
pts2.emplace_back( VECTOR2D( p.x, p.y ) ); pts2.emplace_back( VECTOR2D( p.x, p.y ) );
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
@ -2017,7 +2017,7 @@ void SCH_PAINTER::draw( const SCH_NO_CONNECT *aNC, int aLayer )
void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer ) void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
{ {
SCH_LAYER_ID layer = aEntry->Type() == SCH_BUS_WIRE_ENTRY_T ? LAYER_WIRE : LAYER_BUS; SCH_LAYER_ID layer = aEntry->Type() == SCH_BUS_WIRE_ENTRY_T ? LAYER_WIRE : LAYER_BUS;
SCH_LINE line( wxPoint(), layer ); SCH_LINE line( VECTOR2I(), layer );
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool drawingDangling = aLayer == LAYER_DANGLING; bool drawingDangling = aLayer == LAYER_DANGLING;

View File

@ -302,7 +302,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoC
} }
wxPoint SCH_PIN::GetTransformedPosition() const VECTOR2I SCH_PIN::GetTransformedPosition() const
{ {
TRANSFORM t = GetParentSymbol()->GetTransform(); TRANSFORM t = GetParentSymbol()->GetTransform();
return t.TransformCoordinate( GetLocalPosition() ) + GetParentSymbol()->GetPosition(); return t.TransformCoordinate( GetLocalPosition() ) + GetParentSymbol()->GetPosition();
@ -323,7 +323,7 @@ const EDA_RECT SCH_PIN::GetBoundingBox() const
} }
bool SCH_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
// When looking for an "exact" hit aAccuracy will be 0 which works poorly if the pin has // When looking for an "exact" hit aAccuracy will be 0 which works poorly if the pin has
// no pin number or name. Give it a floor. // no pin number or name. Give it a floor.

View File

@ -69,20 +69,20 @@ public:
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {} void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override {}
void Move( const wxPoint& aMoveVector ) override {} void Move( const VECTOR2I& aMoveVector ) override {}
void MirrorHorizontally( int aCenter ) override {} void MirrorHorizontally( int aCenter ) override {}
void MirrorVertically( int aCenter ) override {} void MirrorVertically( int aCenter ) override {}
void Rotate( const wxPoint& aCenter ) override {} void Rotate( const VECTOR2I& aCenter ) override {}
wxPoint GetPosition() const override { return GetTransformedPosition(); } VECTOR2I GetPosition() const override { return GetTransformedPosition(); }
const wxPoint GetLocalPosition() const { return m_position; } const VECTOR2I GetLocalPosition() const { return m_position; }
void SetPosition( const wxPoint& aPosition ) override { m_position = aPosition; } void SetPosition( const VECTOR2I& aPosition ) override { m_position = aPosition; }
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
@ -98,13 +98,13 @@ public:
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; } void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{ {
return m_isDangling && GetPosition() == aPos; return m_isDangling && GetPosition() == aPos;
} }
/// @return the pin's position in global coordinates. /// @return the pin's position in global coordinates.
wxPoint GetTransformedPosition() const; VECTOR2I GetTransformedPosition() const;
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
@ -151,7 +151,7 @@ private:
wxString m_number; wxString m_number;
wxString m_alt; wxString m_alt;
wxPoint m_position; VECTOR2I m_position;
bool m_isDangling; bool m_isDangling;
/// The name that this pin connection will drive onto a net. /// The name that this pin connection will drive onto a net.

View File

@ -600,7 +600,7 @@ ASCH_SHEET_FONT::ASCH_SHEET_FONT( const std::map<wxString, wxString>& aProps, in
underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false ); underline = ALTIUM_PARSER::ReadBool( aProps, "UNDERLINE" + sid, false );
} }
wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ) VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )
{ {
// From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet // From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet
switch( aSheetSize ) switch( aSheetSize )

View File

@ -30,6 +30,8 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <math/vector2d.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/string.h> #include <wx/string.h>
@ -128,9 +130,9 @@ struct ASCH_SYMBOL
wxString sourcelibraryname; wxString sourcelibraryname;
wxString componentdescription; wxString componentdescription;
int orientation; int orientation;
bool isMirrored; bool isMirrored;
wxPoint location; VECTOR2I location;
int partcount; int partcount;
int displaymodecount; int displaymodecount;
@ -223,10 +225,10 @@ struct ASCH_PIN
ASCH_PIN_ELECTRICAL electrical; ASCH_PIN_ELECTRICAL electrical;
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;
wxPoint location; VECTOR2I location;
int pinlength; int pinlength;
wxPoint kicadLocation; // location of pin in KiCad without rounding error VECTOR2I kicadLocation; // location of pin in KiCad without rounding error
bool showPinName; bool showPinName;
bool showDesignator; bool showDesignator;
@ -264,7 +266,7 @@ struct ASCH_LABEL
int ownerindex; int ownerindex;
int ownerpartid; int ownerpartid;
wxPoint location; VECTOR2I location;
wxString text; wxString text;
@ -280,8 +282,8 @@ struct ASCH_LABEL
struct ASCH_TEXT_FRAME struct ASCH_TEXT_FRAME
{ {
wxPoint location; VECTOR2I location;
wxSize size; wxSize size;
wxString text; wxString text;
@ -311,7 +313,7 @@ struct ASCH_BEZIER
int ownerpartid; int ownerpartid;
int ownerpartdisplaymode; int ownerpartdisplaymode;
std::vector<wxPoint> points; std::vector<VECTOR2I> points;
int lineWidth; int lineWidth;
@ -334,7 +336,7 @@ struct ASCH_POLYLINE
int ownerpartid; int ownerpartid;
int ownerpartdisplaymode; int ownerpartdisplaymode;
std::vector<wxPoint> points; std::vector<VECTOR2I> points;
int lineWidth; int lineWidth;
@ -346,7 +348,7 @@ struct ASCH_POLYLINE
struct ASCH_POLYGON : ASCH_SHAPE_INTERFACE struct ASCH_POLYGON : ASCH_SHAPE_INTERFACE
{ {
std::vector<wxPoint> points; std::vector<VECTOR2I> points;
explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps ); explicit ASCH_POLYGON( const std::map<wxString, wxString>& aProps );
}; };
@ -354,8 +356,8 @@ struct ASCH_POLYGON : ASCH_SHAPE_INTERFACE
struct ASCH_ROUND_RECTANGLE : ASCH_SHAPE_INTERFACE struct ASCH_ROUND_RECTANGLE : ASCH_SHAPE_INTERFACE
{ {
wxPoint bottomLeft; VECTOR2I bottomLeft;
wxPoint topRight; VECTOR2I topRight;
wxSize cornerradius; wxSize cornerradius;
@ -371,10 +373,10 @@ struct ASCH_ARC
int ownerpartid; int ownerpartid;
int ownerpartdisplaymode; int ownerpartdisplaymode;
wxPoint center; VECTOR2I center;
int radius; int radius;
double startAngle; double startAngle;
double endAngle; double endAngle;
int lineWidth; int lineWidth;
@ -388,8 +390,8 @@ struct ASCH_LINE
int ownerpartid; int ownerpartid;
int ownerpartdisplaymode; int ownerpartdisplaymode;
wxPoint point1; VECTOR2I point1;
wxPoint point2; VECTOR2I point2;
int lineWidth; int lineWidth;
@ -399,8 +401,8 @@ struct ASCH_LINE
struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE
{ {
wxPoint bottomLeft; VECTOR2I bottomLeft;
wxPoint topRight; VECTOR2I topRight;
bool isTransparent; bool isTransparent;
@ -410,7 +412,7 @@ struct ASCH_RECTANGLE : ASCH_SHAPE_INTERFACE
struct ASCH_SHEET_SYMBOL struct ASCH_SHEET_SYMBOL
{ {
wxPoint location; VECTOR2I location;
wxSize size; wxSize size;
bool isSolid; bool isSolid;
@ -495,7 +497,7 @@ struct ASCH_POWER_PORT
wxString text; wxString text;
bool showNetName; bool showNetName;
wxPoint location; VECTOR2I location;
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;
ASCH_POWER_PORT_STYLE style; ASCH_POWER_PORT_STYLE style;
@ -510,9 +512,9 @@ struct ASCH_PORT
wxString name; wxString name;
wxString harnessType; wxString harnessType;
wxPoint location; VECTOR2I location;
int width; int width;
int height; int height;
ASCH_PORT_IOTYPE iotype; ASCH_PORT_IOTYPE iotype;
ASCH_PORT_STYLE style; ASCH_PORT_STYLE style;
@ -523,7 +525,7 @@ struct ASCH_PORT
struct ASCH_NO_ERC struct ASCH_NO_ERC
{ {
wxPoint location; VECTOR2I location;
bool isActive; bool isActive;
bool supressAll; bool supressAll;
@ -536,7 +538,7 @@ struct ASCH_NET_LABEL
{ {
wxString text; wxString text;
wxPoint location; VECTOR2I location;
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;
@ -549,7 +551,7 @@ struct ASCH_BUS
int indexinsheet; int indexinsheet;
int lineWidth; int lineWidth;
std::vector<wxPoint> points; std::vector<VECTOR2I> points;
explicit ASCH_BUS( const std::map<wxString, wxString>& aProps ); explicit ASCH_BUS( const std::map<wxString, wxString>& aProps );
}; };
@ -560,7 +562,7 @@ struct ASCH_WIRE
int indexinsheet; int indexinsheet;
int lineWidth; int lineWidth;
std::vector<wxPoint> points; std::vector<VECTOR2I> points;
explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps ); explicit ASCH_WIRE( const std::map<wxString, wxString>& aProps );
}; };
@ -570,7 +572,7 @@ struct ASCH_JUNCTION
{ {
int ownerpartid; int ownerpartid;
wxPoint location; VECTOR2I location;
explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps ); explicit ASCH_JUNCTION( const std::map<wxString, wxString>& aProps );
}; };
@ -582,8 +584,8 @@ struct ASCH_IMAGE
int ownerpartid; int ownerpartid;
wxString filename; wxString filename;
wxPoint location; VECTOR2I location;
wxPoint corner; VECTOR2I corner;
bool embedimage; bool embedimage;
bool keepaspect; bool keepaspect;
@ -631,7 +633,7 @@ enum class ASCH_SHEET_SIZE
ORCAD_E = 17 // 4280 × 3280 ORCAD_E = 17 // 4280 × 3280
}; };
wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize ); VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize );
enum class ASCH_SHEET_WORKSPACEORIENTATION enum class ASCH_SHEET_WORKSPACEORIENTATION
@ -660,7 +662,7 @@ struct ASCH_SHEET_NAME
wxString text; wxString text;
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;
wxPoint location; VECTOR2I location;
bool isHidden; bool isHidden;
@ -676,7 +678,7 @@ struct ASCH_FILE_NAME
wxString text; wxString text;
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;
wxPoint location; VECTOR2I location;
bool isHidden; bool isHidden;
@ -694,7 +696,7 @@ struct ASCH_DESIGNATOR
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;
ASCH_LABEL_JUSTIFICATION justification; ASCH_LABEL_JUSTIFICATION justification;
wxPoint location; VECTOR2I location;
explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps ); explicit ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps );
}; };
@ -723,8 +725,8 @@ struct ASCH_IMPLEMENTATION_LIST
struct ASCH_BUS_ENTRY struct ASCH_BUS_ENTRY
{ {
wxPoint location; VECTOR2I location;
wxPoint corner; VECTOR2I corner;
explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps ); explicit ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps );
}; };
@ -735,7 +737,7 @@ struct ASCH_PARAMETER
int ownerindex; int ownerindex;
int ownerpartid; int ownerpartid;
wxPoint location; VECTOR2I location;
ASCH_LABEL_JUSTIFICATION justification; ASCH_LABEL_JUSTIFICATION justification;
ASCH_RECORD_ORIENTATION orientation; ASCH_RECORD_ORIENTATION orientation;

View File

@ -61,7 +61,7 @@
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <trigo.h> #include <trigo.h>
static const wxPoint GetRelativePosition( const wxPoint& aPosition, const SCH_SYMBOL* aSymbol ) static const VECTOR2I GetRelativePosition( const VECTOR2I& aPosition, const SCH_SYMBOL* aSymbol )
{ {
TRANSFORM t = aSymbol->GetTransform().InverseTransform(); TRANSFORM t = aSymbol->GetTransform().InverseTransform();
return t.TransformCoordinate( aPosition - aSymbol->GetPosition() ); return t.TransformCoordinate( aPosition - aSymbol->GetPosition() );
@ -675,7 +675,7 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map<wxString, wxString>& aPropertie
if( !elem.showPinName ) if( !elem.showPinName )
pin->SetNameTextSize( 0 ); pin->SetNameTextSize( 0 );
wxPoint pinLocation = elem.location; // the location given is not the connection point! VECTOR2I pinLocation = elem.location; // the location given is not the connection point!
switch( elem.orientation ) switch( elem.orientation )
{ {
@ -1049,8 +1049,8 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
else else
{ {
// simulate Bezier using line segments // simulate Bezier using line segments
std::vector<wxPoint> bezierPoints; std::vector<VECTOR2I> bezierPoints;
std::vector<wxPoint> polyPoints; std::vector<VECTOR2I> polyPoints;
for( size_t j = i; j < elem.points.size() && j < i + 4; j++ ) for( size_t j = i; j < elem.points.size() && j < i + 4; j++ )
bezierPoints.push_back( elem.points.at( j ) ); bezierPoints.push_back( elem.points.at( j ) );
@ -1137,7 +1137,8 @@ void SCH_ALTIUM_PLUGIN::ParseBezier( const std::map<wxString, wxString>& aProper
for( size_t j = i; j < elem.points.size() && j < i + 4; j++ ) for( size_t j = i; j < elem.points.size() && j < i + 4; j++ )
{ {
wxPoint pos = GetRelativePosition( elem.points.at( j ) + m_sheetOffset, symbol ); VECTOR2I pos =
GetRelativePosition( elem.points.at( j ) + m_sheetOffset, symbol );
switch( j - i ) switch( j - i )
{ {
@ -1164,7 +1165,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map<wxString, wxString>& aProp
{ {
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES ); SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES );
for( wxPoint& point : elem.points ) for( VECTOR2I& point : elem.points )
poly->AddPoint( point + m_sheetOffset ); poly->AddPoint( point + m_sheetOffset );
poly->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) ); poly->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) );
@ -1194,7 +1195,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map<wxString, wxString>& aProp
line->SetUnit( elem.ownerpartid ); line->SetUnit( elem.ownerpartid );
for( wxPoint& point : elem.points ) for( VECTOR2I& point : elem.points )
line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) ); line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) );
line->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) ); line->SetStroke( STROKE_PARAMS( elem.lineWidth, GetPlotDashType( elem.linestyle ) ) );
@ -1210,7 +1211,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
{ {
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES ); SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES );
for( wxPoint& point : elem.points ) for( VECTOR2I& point : elem.points )
poly->AddPoint( point + m_sheetOffset ); poly->AddPoint( point + m_sheetOffset );
poly->AddPoint( elem.points.front() + m_sheetOffset ); poly->AddPoint( elem.points.front() + m_sheetOffset );
@ -1241,7 +1242,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
line->SetUnit( elem.ownerpartid ); line->SetUnit( elem.ownerpartid );
for( wxPoint& point : elem.points ) for( VECTOR2I& point : elem.points )
line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) ); line->AddPoint( GetRelativePosition( point + m_sheetOffset, symbol ) );
line->AddPoint( GetRelativePosition( elem.points.front() + m_sheetOffset, symbol ) ); line->AddPoint( GetRelativePosition( elem.points.front() + m_sheetOffset, symbol ) );
@ -1254,13 +1255,13 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
{ {
ASCH_ROUND_RECTANGLE elem( aProperties ); ASCH_ROUND_RECTANGLE elem( aProperties );
wxPoint sheetTopRight = elem.topRight + m_sheetOffset; VECTOR2I sheetTopRight = elem.topRight + m_sheetOffset;
wxPoint sheetBottomLeft = elem.bottomLeft + m_sheetOffset; VECTOR2I sheetBottomLeft = elem.bottomLeft + m_sheetOffset;
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
{ {
const wxPoint topLeft = { sheetBottomLeft.x, sheetTopRight.y }; const VECTOR2I topLeft = { sheetBottomLeft.x, sheetTopRight.y };
const wxPoint bottomRight = { sheetTopRight.x, sheetBottomLeft.y }; const VECTOR2I bottomRight = { sheetTopRight.x, sheetBottomLeft.y };
// TODO: misses rounded edges // TODO: misses rounded edges
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES ); SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES );
@ -1313,7 +1314,7 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, SCH_LAYER_ID::LAYER_NOTES ); SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, SCH_LAYER_ID::LAYER_NOTES );
circle->SetPosition( elem.center + m_sheetOffset ); circle->SetPosition( elem.center + m_sheetOffset );
circle->SetEnd( circle->GetPosition() + wxPoint( elem.radius, 0 ) ); circle->SetEnd( circle->GetPosition() + VECTOR2I( elem.radius, 0 ) );
circle->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) ); circle->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) );
m_currentSheet->GetScreen()->Append( circle ); m_currentSheet->GetScreen()->Append( circle );
@ -1325,8 +1326,8 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
double includedAngle = elem.endAngle - elem.startAngle; double includedAngle = elem.endAngle - elem.startAngle;
double startAngle = DEG2RAD( elem.endAngle ); double startAngle = DEG2RAD( elem.endAngle );
wxPoint startOffset = wxPoint( KiROUND( std::cos( startAngle ) * elem.radius ), VECTOR2I startOffset = VECTOR2I( KiROUND( std::cos( startAngle ) * elem.radius ),
-KiROUND( std::sin( startAngle ) * elem.radius ) ); -KiROUND( std::sin( startAngle ) * elem.radius ) );
arc->SetCenter( elem.center + m_sheetOffset ); arc->SetCenter( elem.center + m_sheetOffset );
arc->SetStart( elem.center + startOffset + m_sheetOffset ); arc->SetStart( elem.center + startOffset + m_sheetOffset );
@ -1363,7 +1364,7 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
circle->SetUnit( elem.ownerpartid ); circle->SetUnit( elem.ownerpartid );
circle->SetPosition( GetRelativePosition( elem.center + m_sheetOffset, symbol ) ); circle->SetPosition( GetRelativePosition( elem.center + m_sheetOffset, symbol ) );
circle->SetEnd( circle->GetPosition() + wxPoint( elem.radius, 0 ) ); circle->SetEnd( circle->GetPosition() + VECTOR2I( elem.radius, 0 ) );
circle->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) ); circle->SetStroke( STROKE_PARAMS( elem.lineWidth, PLOT_DASH_TYPE::SOLID ) );
} }
else else
@ -1374,12 +1375,12 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
arc->SetCenter( GetRelativePosition( elem.center + m_sheetOffset, symbol ) ); arc->SetCenter( GetRelativePosition( elem.center + m_sheetOffset, symbol ) );
wxPoint arcStart( elem.radius, 0 ); VECTOR2I arcStart( elem.radius, 0 );
RotatePoint( &arcStart.x, &arcStart.y, -elem.startAngle * 10.0 ); RotatePoint( &arcStart.x, &arcStart.y, -elem.startAngle * 10.0 );
arcStart += arc->GetCenter(); arcStart += arc->GetCenter();
arc->SetStart( arcStart ); arc->SetStart( arcStart );
wxPoint arcEnd( elem.radius, 0 ); VECTOR2I arcEnd( elem.radius, 0 );
RotatePoint( &arcEnd.x, &arcEnd.y, -elem.endAngle * 10.0 ); RotatePoint( &arcEnd.x, &arcEnd.y, -elem.endAngle * 10.0 );
arcEnd += arc->GetCenter(); arcEnd += arc->GetCenter();
arc->SetEnd( arcEnd ); arc->SetEnd( arcEnd );
@ -1438,13 +1439,13 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aPro
{ {
ASCH_RECTANGLE elem( aProperties ); ASCH_RECTANGLE elem( aProperties );
wxPoint sheetTopRight = elem.topRight + m_sheetOffset; VECTOR2I sheetTopRight = elem.topRight + m_sheetOffset;
wxPoint sheetBottomLeft = elem.bottomLeft + m_sheetOffset; VECTOR2I sheetBottomLeft = elem.bottomLeft + m_sheetOffset;
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE ) if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
{ {
const wxPoint topLeft = { sheetBottomLeft.x, sheetTopRight.y }; const VECTOR2I topLeft = { sheetBottomLeft.x, sheetTopRight.y };
const wxPoint bottomRight = { sheetTopRight.x, sheetBottomLeft.y }; const VECTOR2I bottomRight = { sheetTopRight.x, sheetBottomLeft.y };
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES ); SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES );
@ -1537,7 +1538,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
//sheetPin->SetLabelSpinStyle( getSpinStyle( term.OrientAngle, false ) ); //sheetPin->SetLabelSpinStyle( getSpinStyle( term.OrientAngle, false ) );
//sheetPin->SetPosition( getKiCadPoint( term.Position ) ); //sheetPin->SetPosition( getKiCadPoint( term.Position ) );
wxPoint pos = sheetIt->second->GetPosition(); VECTOR2I pos = sheetIt->second->GetPosition();
wxSize size = sheetIt->second->GetSize(); wxSize size = sheetIt->second->GetSize();
switch( elem.side ) switch( elem.side )
@ -1584,7 +1585,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
} }
wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_STYLE aStyle, VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_STYLE aStyle,
REPORTER* aReporter ) REPORTER* aReporter )
{ {
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW ) if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW )
@ -1601,7 +1602,7 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_S
aKsymbol->AddDrawItem( circle ); aKsymbol->AddDrawItem( circle );
circle->SetStroke( STROKE_PARAMS( Mils2iu( 5 ), PLOT_DASH_TYPE::SOLID ) ); circle->SetStroke( STROKE_PARAMS( Mils2iu( 5 ), PLOT_DASH_TYPE::SOLID ) );
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -75 ) } ); circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -75 ) } );
circle->SetEnd( circle->GetPosition() + wxPoint( Mils2iu( 25 ), 0 ) ); circle->SetEnd( circle->GetPosition() + VECTOR2I( Mils2iu( 25 ), 0 ) );
} }
else else
{ {
@ -1745,7 +1746,7 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_S
aKsymbol->AddDrawItem( circle ); aKsymbol->AddDrawItem( circle );
circle->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) ); circle->SetStroke( STROKE_PARAMS( Mils2iu( 10 ), PLOT_DASH_TYPE::SOLID ) );
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -160 ) } ); circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -160 ) } );
circle->SetEnd( circle->GetPosition() + wxPoint( Mils2iu( 120 ), 0 ) ); circle->SetEnd( circle->GetPosition() + VECTOR2I( Mils2iu( 120 ), 0 ) );
return { 0, Mils2iu( 350 ) }; return { 0, Mils2iu( 350 ) };
} }
@ -1827,7 +1828,8 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN ); pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
pin->SetVisible( false ); pin->SetVisible( false );
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( libSymbol, elem.style, m_reporter ); VECTOR2I valueFieldPos =
HelperGeneratePowerPortGraphics( libSymbol, elem.style, m_reporter );
libSymbol->GetValueField().SetPosition( valueFieldPos ); libSymbol->GetValueField().SetPosition( valueFieldPos );
@ -1888,8 +1890,8 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem ) void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
{ {
bool isHarness = !aElem.harnessType.IsEmpty(); bool isHarness = !aElem.harnessType.IsEmpty();
wxPoint start = aElem.location + m_sheetOffset; VECTOR2I start = aElem.location + m_sheetOffset;
wxPoint end = start; VECTOR2I end = start;
switch( aElem.style ) switch( aElem.style )
{ {
@ -1931,7 +1933,7 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
} }
// Select label position. In case both match, we will add a line later. // Select label position. In case both match, we will add a line later.
wxPoint position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end; VECTOR2I position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end;
SCH_TEXT* label; SCH_TEXT* label;
if( isHarness ) if( isHarness )
@ -2108,7 +2110,7 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map<wxString, wxString>& aPropert
{ {
ASCH_IMAGE elem( aProperties ); ASCH_IMAGE elem( aProperties );
wxPoint center = ( elem.location + elem.corner ) / 2 + m_sheetOffset; VECTOR2I center = ( elem.location + elem.corner ) / 2 + m_sheetOffset;
std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>( center ); std::unique_ptr<SCH_BITMAP> bitmap = std::make_unique<SCH_BITMAP>( center );
if( elem.embedimage ) if( elem.embedimage )
@ -2161,7 +2163,7 @@ void SCH_ALTIUM_PLUGIN::ParseImage( const std::map<wxString, wxString>& aPropert
// we only support one scale, thus we need to select one in case it does not keep aspect ratio // we only support one scale, thus we need to select one in case it does not keep aspect ratio
wxSize currentImageSize = bitmap->GetSize(); wxSize currentImageSize = bitmap->GetSize();
wxPoint expectedImageSize = elem.location - elem.corner; VECTOR2I expectedImageSize = elem.location - elem.corner;
double scaleX = std::abs( static_cast<double>( expectedImageSize.x ) / currentImageSize.x ); double scaleX = std::abs( static_cast<double>( expectedImageSize.x ) / currentImageSize.x );
double scaleY = std::abs( static_cast<double>( expectedImageSize.y ) / currentImageSize.y ); double scaleY = std::abs( static_cast<double>( expectedImageSize.y ) / currentImageSize.y );
bitmap->SetImageScale( std::min( scaleX, scaleY ) ); bitmap->SetImageScale( std::min( scaleX, scaleY ) );
@ -2299,7 +2301,7 @@ void SCH_ALTIUM_PLUGIN::ParseBusEntry( const std::map<wxString, wxString>& aProp
SCH_BUS_WIRE_ENTRY* busWireEntry = new SCH_BUS_WIRE_ENTRY( elem.location + m_sheetOffset ); SCH_BUS_WIRE_ENTRY* busWireEntry = new SCH_BUS_WIRE_ENTRY( elem.location + m_sheetOffset );
wxPoint vector = elem.corner - elem.location; VECTOR2I vector = elem.corner - elem.location;
busWireEntry->SetSize( { vector.x, vector.y } ); busWireEntry->SetSize( { vector.x, vector.y } );
busWireEntry->SetFlags( IS_NEW ); busWireEntry->SetFlags( IS_NEW );
@ -2376,7 +2378,7 @@ void SCH_ALTIUM_PLUGIN::ParseParameter( const std::map<wxString, wxString>& aPro
if( fieldName == "VALUE" ) if( fieldName == "VALUE" )
fieldName = "ALTIUM_VALUE"; fieldName = "ALTIUM_VALUE";
field = symbol->AddField( SCH_FIELD( wxPoint(), fieldIdx, symbol, fieldName ) ); field = symbol->AddField( SCH_FIELD( VECTOR2I(), fieldIdx, symbol, fieldName ) );
} }
wxString kicadText = AltiumSpecialStringsToKiCadVariables( elem.text, variableMap ); wxString kicadText = AltiumSpecialStringsToKiCadVariables( elem.text, variableMap );

View File

@ -157,7 +157,7 @@ private:
std::unique_ptr<TITLE_BLOCK> m_currentTitleBlock; // Will be assigned at the end of parsing std::unique_ptr<TITLE_BLOCK> m_currentTitleBlock; // Will be assigned at the end of parsing
// a sheet // a sheet
wxPoint m_sheetOffset; VECTOR2I m_sheetOffset;
std::unique_ptr<ASCH_SHEET> m_altiumSheet; std::unique_ptr<ASCH_SHEET> m_altiumSheet;
std::map<int, SCH_SYMBOL*> m_symbols; std::map<int, SCH_SYMBOL*> m_symbols;
std::map<int, SCH_SHEET*> m_sheets; std::map<int, SCH_SHEET*> m_sheets;

View File

@ -62,11 +62,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
LONGPOINT designLimit = Assignments.Settings.DesignLimit; LONGPOINT designLimit = Assignments.Settings.DesignLimit;
//Note: can't use getKiCadPoint() due wxPoint being int - need long long to make the check //Note: can't use getKiCadPoint() due VECTOR2I being int - need long long to make the check
long long designSizeXkicad = (long long) designLimit.x / KiCadUnitDivider; long long designSizeXkicad = (long long) designLimit.x / KiCadUnitDivider;
long long designSizeYkicad = (long long) designLimit.y / KiCadUnitDivider; long long designSizeYkicad = (long long) designLimit.y / KiCadUnitDivider;
// Max size limited by the positive dimension of wxPoint (which is an int) // Max size limited by the positive dimension of VECTOR2I (which is an int)
constexpr long long maxDesignSizekicad = std::numeric_limits<int>::max(); constexpr long long maxDesignSizekicad = std::numeric_limits<int>::max();
if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad ) if( designSizeXkicad > maxDesignSizekicad || designSizeYkicad > maxDesignSizekicad )
@ -248,7 +248,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
for( SCH_ITEM* item : allItems ) for( SCH_ITEM* item : allItems )
{ {
item->Move( (wxPoint)translation ); item->Move( translation );
item->ClearFlags(); item->ClearFlags();
sheet->GetScreen()->Update( item ); sheet->GetScreen()->Update( item );
} }
@ -276,8 +276,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
for( LAYER_ID sheetID : orphanSheets ) for( LAYER_ID sheetID : orphanSheets )
{ {
wxPoint pos( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); VECTOR2I pos( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
wxSize siz( Mils2iu( 1000 ), Mils2iu( 1000 ) ); wxSize siz( Mils2iu( 1000 ), Mils2iu( 1000 ) );
loadSheetAndChildSheets( sheetID, pos, siz, rootPath ); loadSheetAndChildSheets( sheetID, pos, siz, rootPath );
@ -495,8 +495,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
if( !partField ) if( !partField )
{ {
int fieldID = symbol->GetFieldCount(); int fieldID = symbol->GetFieldCount();
partField = symbol->AddField( SCH_FIELD( wxPoint(), fieldID, symbol, partField = symbol->AddField(
PartNameFieldName ) ); SCH_FIELD( VECTOR2I(), fieldID, symbol, PartNameFieldName ) );
} }
wxASSERT( partField->GetName() == PartNameFieldName ); wxASSERT( partField->GetName() == PartNameFieldName );
@ -525,8 +525,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
if( !attrField ) if( !attrField )
{ {
int fieldID = symbol->GetFieldCount(); int fieldID = symbol->GetFieldCount();
attrField = symbol->AddField( SCH_FIELD( wxPoint(), fieldID, attrField = symbol->AddField(
symbol, attrName ) ); SCH_FIELD( VECTOR2I(), fieldID, symbol, attrName ) );
} }
wxASSERT( attrField->GetName() == attrName ); wxASSERT( attrField->GetName() == attrName );
@ -607,7 +607,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
TEXT_LOCATION txtLoc = TEXT_LOCATION txtLoc =
symbolDef.TextLocations.at( SIGNALNAME_ORIGIN_ATTRID ); symbolDef.TextLocations.at( SIGNALNAME_ORIGIN_ATTRID );
wxPoint valPos = getKiCadLibraryPoint( txtLoc.Position, symbolDef.Origin ); VECTOR2I valPos = getKiCadLibraryPoint( txtLoc.Position, symbolDef.Origin );
kiPart->GetValueField().SetPosition( valPos ); kiPart->GetValueField().SetPosition( valPos );
kiPart->GetValueField().SetVisible( true ); kiPart->GetValueField().SetVisible( true );
@ -641,16 +641,16 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
{ {
// There should only be one pin and we'll use that to set the position // There should only be one pin and we'll use that to set the position
TERMINAL& symbolTerminal = libSymDef.Terminals.begin()->second; TERMINAL& symbolTerminal = libSymDef.Terminals.begin()->second;
wxPoint terminalPosOffset = symbolTerminal.Position - libSymDef.Origin; VECTOR2I terminalPosOffset = symbolTerminal.Position - libSymDef.Origin;
double rotateDeciDegree = getAngleTenthDegree( sym.OrientAngle ); double rotateDeciDegree = getAngleTenthDegree( sym.OrientAngle );
if( sym.Mirror ) if( sym.Mirror )
rotateDeciDegree += 1800.0; rotateDeciDegree += 1800.0;
RotatePoint( &terminalPosOffset, -rotateDeciDegree ); RotatePoint( terminalPosOffset, -rotateDeciDegree );
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL; SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
netLabel->SetPosition( getKiCadPoint( sym.Origin + terminalPosOffset ) ); netLabel->SetPosition( getKiCadPoint( (VECTOR2I)sym.Origin + terminalPosOffset ) );
netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist netLabel->SetText( "***UNKNOWN NET****" ); // This should be later updated when we load the netlist
netLabel->SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) ); netLabel->SetTextSize( wxSize( Mils2iu( 50 ), Mils2iu( 50 ) ) );
@ -781,7 +781,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadBusses()
{ {
//lets find the closest point in the busline to the label //lets find the closest point in the busline to the label
VECTOR2I busLabelLoc = getKiCadPoint( bus.BusLabel.Position ); VECTOR2I busLabelLoc = getKiCadPoint( bus.BusLabel.Position );
wxPoint nearestPt = (wxPoint) busLineChain.NearestPoint( busLabelLoc ); VECTOR2I nearestPt = busLineChain.NearestPoint( busLabelLoc );
label->SetPosition( nearestPt ); label->SetPosition( nearestPt );
@ -910,7 +910,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
SCH_BUS_WIRE_ENTRY* busEntry = SCH_BUS_WIRE_ENTRY* busEntry =
new SCH_BUS_WIRE_ENTRY( getKiCadPoint( busTerm.FirstPoint ), false ); new SCH_BUS_WIRE_ENTRY( getKiCadPoint( busTerm.FirstPoint ), false );
wxPoint size = VECTOR2I size =
getKiCadPoint( busTerm.SecondPoint ) - getKiCadPoint( busTerm.FirstPoint ); getKiCadPoint( busTerm.SecondPoint ) - getKiCadPoint( busTerm.FirstPoint );
busEntry->SetSize( wxSize( size.x, size.y ) ); busEntry->SetSize( wxSize( size.x, size.y ) );
@ -984,7 +984,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
bool firstPt = true; bool firstPt = true;
bool secondPt = false; bool secondPt = false;
wxPoint last; VECTOR2I last;
SCH_LINE* wire = nullptr; SCH_LINE* wire = nullptr;
SHAPE_LINE_CHAIN wireChain; // Create a temp. line chain representing the connection SHAPE_LINE_CHAIN wireChain; // Create a temp. line chain representing the connection
@ -1014,7 +1014,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
{ {
SCH_SHEET* parentSheet = static_cast<SCH_SHEET*>( sheetPin->GetParent() ); SCH_SHEET* parentSheet = static_cast<SCH_SHEET*>( sheetPin->GetParent() );
wxSize sheetSize = parentSheet->GetSize(); wxSize sheetSize = parentSheet->GetSize();
wxPoint sheetPosition = parentSheet->GetPosition(); VECTOR2I sheetPosition = parentSheet->GetPosition();
int leftSide = sheetPosition.x; int leftSide = sheetPosition.x;
int rightSide = sheetPosition.x + sheetSize.x; int rightSide = sheetPosition.x + sheetSize.x;
@ -1057,7 +1057,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
else else
wireChain.Replace( intsctIndx + 1, /*end index*/ -1, intsctPt ); wireChain.Replace( intsctIndx + 1, /*end index*/ -1, intsctPt );
sheetPin->SetPosition( (wxPoint) intsctPt ); sheetPin->SetPosition( intsctPt );
} }
} }
} }
@ -1082,7 +1082,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
{ {
if( firstPt ) if( firstPt )
{ {
last = (wxPoint) pt; last = pt;
firstPt = false; firstPt = false;
secondPt = true; secondPt = true;
continue; continue;
@ -1093,8 +1093,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
secondPt = false; secondPt = false;
wxPoint kiLast = last; VECTOR2I kiLast = last;
wxPoint kiCurrent = (wxPoint) pt; VECTOR2I kiCurrent = pt;
double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent ); double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent );
fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.StartNode ); fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.StartNode );
} }
@ -1102,13 +1102,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
wire = new SCH_LINE(); wire = new SCH_LINE();
wire->SetStartPoint( last ); wire->SetStartPoint( last );
wire->SetEndPoint( (wxPoint) pt ); wire->SetEndPoint( pt );
wire->SetLayer( LAYER_WIRE ); wire->SetLayer( LAYER_WIRE );
if( !conn.ConnectionLineCode.IsEmpty() ) if( !conn.ConnectionLineCode.IsEmpty() )
wire->SetLineWidth( getLineThickness( conn.ConnectionLineCode ) ); wire->SetLineWidth( getLineThickness( conn.ConnectionLineCode ) );
last = (wxPoint) pt; last = pt;
m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire ); m_sheetMap.at( conn.LayerID )->GetScreen()->Append( wire );
} }
@ -1116,8 +1116,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
//Fix labels on the end wire //Fix labels on the end wire
if( wire ) if( wire )
{ {
wxPoint kiLast = wire->GetEndPoint(); VECTOR2I kiLast = wire->GetEndPoint();
wxPoint kiCurrent = wire->GetStartPoint(); VECTOR2I kiCurrent = wire->GetStartPoint();
double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent ); double wireangleDeciDeg = getPolarAngle( kiLast - kiCurrent );
fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.EndNode ); fixNetLabelsAndSheetPins( wireangleDeciDeg, conn.EndNode );
} }
@ -1194,11 +1194,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols()
} }
SYMDEF_SCM docSymDef = Library.SymbolDefinitions.at( docSym.SymdefID ); SYMDEF_SCM docSymDef = Library.SymbolDefinitions.at( docSym.SymdefID );
wxPoint moveVector = getKiCadPoint( docSym.Origin ) - getKiCadPoint( docSymDef.Origin ); VECTOR2I moveVector = getKiCadPoint( docSym.Origin ) - getKiCadPoint( docSymDef.Origin );
double rotationAngle = getAngleTenthDegree( docSym.OrientAngle ); double rotationAngle = getAngleTenthDegree( docSym.OrientAngle );
double scalingFactor = (double) docSym.ScaleRatioNumerator double scalingFactor = (double) docSym.ScaleRatioNumerator
/ (double) docSym.ScaleRatioDenominator; / (double) docSym.ScaleRatioDenominator;
wxPoint centreOfTransform = getKiCadPoint( docSymDef.Origin ); VECTOR2I centreOfTransform = getKiCadPoint( docSymDef.Origin );
bool mirrorInvert = docSym.Mirror; bool mirrorInvert = docSym.Mirror;
for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDef.Figures ) for( std::pair<FIGURE_ID, FIGURE> figPair : docSymDef.Figures )
@ -1218,8 +1218,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadDocumentationSymbols()
SCH_TEXT* kiTxt = getKiCadSchText( txt ); SCH_TEXT* kiTxt = getKiCadSchText( txt );
wxPoint newPosition = applyTransform( kiTxt->GetPosition(), moveVector, rotationAngle, VECTOR2I newPosition = applyTransform( kiTxt->GetPosition(), moveVector, rotationAngle,
scalingFactor, centreOfTransform, mirrorInvert ); scalingFactor, centreOfTransform, mirrorInvert );
int newTxtWidth = KiROUND( kiTxt->GetTextWidth() * scalingFactor ); int newTxtWidth = KiROUND( kiTxt->GetTextWidth() * scalingFactor );
int newTxtHeight = KiROUND( kiTxt->GetTextHeight() * scalingFactor ); int newTxtHeight = KiROUND( kiTxt->GetTextHeight() * scalingFactor );
@ -1997,11 +1997,12 @@ wxString CADSTAR_SCH_ARCHIVE_LOADER::getNetName( const NET_SCH& aNet )
} }
void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStartPoint, void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment(
const wxPoint& aEndPoint, const LINECODE_ID& aCadstarLineCodeID, const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint,
const LAYER_ID& aCadstarSheetID, const SCH_LAYER_ID& aKiCadSchLayerID, const LINECODE_ID& aCadstarLineCodeID, const LAYER_ID& aCadstarSheetID,
const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, const SCH_LAYER_ID& aKiCadSchLayerID, const VECTOR2I& aMoveVector,
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) const double& aRotationAngleDeciDeg, const double& aScalingFactor,
const VECTOR2I& aTransformCentre, const bool& aMirrorInvert )
{ {
SCH_LINE* segment = new SCH_LINE(); SCH_LINE* segment = new SCH_LINE();
@ -2010,9 +2011,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStar
segment->SetLineStyle( getLineStyle( aCadstarLineCodeID ) ); segment->SetLineStyle( getLineStyle( aCadstarLineCodeID ) );
//Apply transforms //Apply transforms
wxPoint startPoint = applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg, VECTOR2I startPoint = applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg,
aScalingFactor, aTransformCentre, aMirrorInvert ); aScalingFactor, aTransformCentre, aMirrorInvert );
wxPoint endPoint = applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg, VECTOR2I endPoint = applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg,
aScalingFactor, aTransformCentre, aMirrorInvert ); aScalingFactor, aTransformCentre, aMirrorInvert );
segment->SetStartPoint( startPoint ); segment->SetStartPoint( startPoint );
@ -2022,10 +2023,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStar
} }
void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& aCadstarVertices, void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices(
LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, const std::vector<VERTEX>& aCadstarVertices, LINECODE_ID aCadstarLineCodeID,
const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector,
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) const double& aRotationAngleDeciDeg, const double& aScalingFactor,
const VECTOR2I& aTransformCentre, const bool& aMirrorInvert )
{ {
const VERTEX* prev = &aCadstarVertices.at( 0 ); const VERTEX* prev = &aCadstarVertices.at( 0 );
const VERTEX* cur; const VERTEX* cur;
@ -2037,9 +2039,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
{ {
cur = &aCadstarVertices.at( ii ); cur = &aCadstarVertices.at( ii );
wxPoint startPoint = getKiCadPoint( prev->End ); VECTOR2I startPoint = getKiCadPoint( prev->End );
wxPoint endPoint = getKiCadPoint( cur->End ); VECTOR2I endPoint = getKiCadPoint( cur->End );
wxPoint centerPoint = getKiCadPoint( cur->Center ); VECTOR2I centerPoint = getKiCadPoint( cur->Center );
bool cw = false; bool cw = false;
if( cur->Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE if( cur->Type == VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE
@ -2075,8 +2077,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
for( int jj = 0; jj < arcSegments.SegmentCount(); jj++ ) for( int jj = 0; jj < arcSegments.SegmentCount(); jj++ )
{ {
wxPoint segStart = (wxPoint) arcSegments.Segment( jj ).A; VECTOR2I segStart = (wxPoint) arcSegments.Segment( jj ).A;
wxPoint segEnd = (wxPoint) arcSegments.Segment( jj ).B; VECTOR2I segEnd = (wxPoint) arcSegments.Segment( jj ).B;
loadGraphicStaightSegment( segStart, segEnd, aCadstarLineCodeID, aCadstarSheetID, loadGraphicStaightSegment( segStart, segEnd, aCadstarLineCodeID, aCadstarSheetID,
aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg, aKiCadSchLayerID, aMoveVector, aRotationAngleDeciDeg,
@ -2101,10 +2103,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices( const std::vector<VERTEX>& a
} }
void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure, void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure(
const LAYER_ID& aCadstarSheetIDOverride, SCH_LAYER_ID aKiCadSchLayerID, const FIGURE& aCadstarFigure, const LAYER_ID& aCadstarSheetIDOverride,
const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector,
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) const double& aRotationAngleDeciDeg, const double& aScalingFactor,
const VECTOR2I& aTransformCentre, const bool& aMirrorInvert )
{ {
loadShapeVertices( aCadstarFigure.Shape.Vertices, aCadstarFigure.LineCodeID, loadShapeVertices( aCadstarFigure.Shape.Vertices, aCadstarFigure.LineCodeID,
aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector, aCadstarSheetIDOverride, aKiCadSchLayerID, aMoveVector,
@ -2119,9 +2122,10 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure,
} }
void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( LAYER_ID aCadstarSheetID,
LAYER_ID aCadstarSheetID, const wxPoint& aPosition, wxSize aSheetSize, const VECTOR2I& aPosition,
const SCH_SHEET_PATH& aParentSheet ) VECTOR2I aSheetSize,
const SCH_SHEET_PATH& aParentSheet )
{ {
wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), , wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), ,
"Sheet already loaded!" ); "Sheet already loaded!" );
@ -2130,7 +2134,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
SCH_SHEET_PATH instance( aParentSheet ); SCH_SHEET_PATH instance( aParentSheet );
sheet->SetSize( aSheetSize ); sheet->SetSize( (wxSize) aSheetSize );
sheet->SetScreen( screen ); sheet->SetScreen( screen );
wxString name = Sheets.SheetNames.at( aCadstarSheetID ); wxString name = Sheets.SheetNames.at( aCadstarSheetID );
@ -2199,7 +2203,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets( LAYER_ID aCadstarSheetID,
// In KiCad you can only draw rectangular shapes whereas in Cadstar arbitrary shapes // In KiCad you can only draw rectangular shapes whereas in Cadstar arbitrary shapes
// are allowed. We will calculate the extents of the Cadstar shape and draw a rectangle // are allowed. We will calculate the extents of the Cadstar shape and draw a rectangle
std::pair<wxPoint, wxSize> blockExtents; std::pair<VECTOR2I, wxSize> blockExtents;
if( block.Figures.size() > 0 ) if( block.Figures.size() > 0 )
{ {
@ -2802,9 +2806,9 @@ LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_SYMBOL* aSym
}; };
auto scalePt = auto scalePt =
[&]( wxPoint aCoord ) -> wxPoint [&]( VECTOR2I aCoord ) -> VECTOR2I
{ {
return wxPoint( scaleLen( aCoord.x ), scaleLen( aCoord.y ) ); return VECTOR2I( scaleLen( aCoord.x ), scaleLen( aCoord.y ) );
}; };
auto scaleSize = auto scaleSize =
@ -2947,11 +2951,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int
} }
std::pair<wxPoint, wxSize> std::pair<VECTOR2I, wxSize>
CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure ) CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure )
{ {
wxPoint upperLeft( Assignments.Settings.DesignLimit.x, 0 ); VECTOR2I upperLeft( Assignments.Settings.DesignLimit.x, 0 );
wxPoint lowerRight( 0, Assignments.Settings.DesignLimit.y ); VECTOR2I lowerRight( 0, Assignments.Settings.DesignLimit.y );
for( const VERTEX& v : aCadstarFigure.Shape.Vertices ) for( const VERTEX& v : aCadstarFigure.Shape.Vertices )
{ {
@ -2986,18 +2990,18 @@ CADSTAR_SCH_ARCHIVE_LOADER::getFigureExtentsKiCad( const FIGURE& aCadstarFigure
} }
} }
wxPoint upperLeftKiCad = getKiCadPoint( upperLeft ); VECTOR2I upperLeftKiCad = getKiCadPoint( upperLeft );
wxPoint lowerRightKiCad = getKiCadPoint( lowerRight ); VECTOR2I lowerRightKiCad = getKiCadPoint( lowerRight );
wxPoint size = lowerRightKiCad - upperLeftKiCad; VECTOR2I size = lowerRightKiCad - upperLeftKiCad;
return { upperLeftKiCad, wxSize( abs( size.x ), abs( size.y ) ) }; return { upperLeftKiCad, wxSize( abs( size.x ), abs( size.y ) ) };
} }
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( const wxPoint& aCadstarPoint ) VECTOR2I CADSTAR_SCH_ARCHIVE_LOADER::getKiCadPoint( const VECTOR2I& aCadstarPoint )
{ {
wxPoint retval; VECTOR2I retval;
retval.x = getKiCadLength( aCadstarPoint.x - m_designCenter.x ); retval.x = getKiCadLength( aCadstarPoint.x - m_designCenter.x );
retval.y = -getKiCadLength( aCadstarPoint.y - m_designCenter.y ); retval.y = -getKiCadLength( aCadstarPoint.y - m_designCenter.y );
@ -3018,11 +3022,11 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::getKiCadLibraryPoint( const wxPoint& aCadsta
} }
wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint, VECTOR2I CADSTAR_SCH_ARCHIVE_LOADER::applyTransform(
const wxPoint& aMoveVector, const double& aRotationAngleDeciDeg, const VECTOR2I& aPoint, const VECTOR2I& aMoveVector, const double& aRotationAngleDeciDeg,
const double& aScalingFactor, const wxPoint& aTransformCentre, const bool& aMirrorInvert ) const double& aScalingFactor, const VECTOR2I& aTransformCentre, const bool& aMirrorInvert )
{ {
wxPoint retVal = aPoint; VECTOR2I retVal = aPoint;
if( aScalingFactor != 1.0 ) if( aScalingFactor != 1.0 )
{ {
@ -3040,7 +3044,7 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint,
if( aRotationAngleDeciDeg != 0.0 ) if( aRotationAngleDeciDeg != 0.0 )
{ {
RotatePoint( &retVal, aTransformCentre, aRotationAngleDeciDeg ); RotatePoint( retVal, aTransformCentre, aRotationAngleDeciDeg );
} }
if( aMoveVector != wxPoint{ 0, 0 } ) if( aMoveVector != wxPoint{ 0, 0 } )
@ -3052,13 +3056,13 @@ wxPoint CADSTAR_SCH_ARCHIVE_LOADER::applyTransform( const wxPoint& aPoint,
} }
double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( const wxPoint& aPoint ) double CADSTAR_SCH_ARCHIVE_LOADER::getPolarAngle( const VECTOR2I& aPoint )
{ {
return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) ); return NormalizeAnglePos( ArcTangente( aPoint.y, aPoint.x ) );
} }
double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( const wxPoint& aPoint ) double CADSTAR_SCH_ARCHIVE_LOADER::getPolarRadius( const VECTOR2I& aPoint )
{ {
return sqrt( ( (double) aPoint.x * (double) aPoint.x ) return sqrt( ( (double) aPoint.x * (double) aPoint.x )
+ ( (double) aPoint.y * (double) aPoint.y ) ); + ( (double) aPoint.y * (double) aPoint.y ) );

View File

@ -126,8 +126,8 @@ private:
void loadTextVariables(); void loadTextVariables();
//Helper Functions for loading sheets //Helper Functions for loading sheets
void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const wxPoint& aPosition, void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const VECTOR2I& aPosition,
wxSize aSheetSize, const SCH_SHEET_PATH& aParentSheet ); VECTOR2I aSheetSize, const SCH_SHEET_PATH& aParentSheet );
void loadChildSheets( LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet ); void loadChildSheets( LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet );
@ -164,22 +164,26 @@ private:
wxString getNetName( const NET_SCH& aNet ); wxString getNetName( const NET_SCH& aNet );
//Helper functions for loading figures / graphical items //Helper functions for loading figures / graphical items
void loadGraphicStaightSegment( const wxPoint& aStartPoint, const wxPoint& aEndPoint, void loadGraphicStaightSegment(
const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint,
const LINECODE_ID& aCadstarLineCodeID, const LAYER_ID& aCadstarSheetID, const LINECODE_ID& aCadstarLineCodeID, const LAYER_ID& aCadstarSheetID,
const SCH_LAYER_ID& aKiCadSchLayerID, const wxPoint& aMoveVector = { 0, 0 }, const SCH_LAYER_ID& aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 },
const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0,
const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); const VECTOR2I& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false );
void loadShapeVertices( const std::vector<VERTEX>& aCadstarVertices, void loadShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID, SCH_LAYER_ID aKiCadSchLayerID, LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID,
const wxPoint& aMoveVector = { 0, 0 }, const double& aRotationAngleDeciDeg = 0.0, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 },
const double& aScalingFactor = 1.0, const wxPoint& aTransformCentre = { 0, 0 }, const double& aRotationAngleDeciDeg = 0.0,
const bool& aMirrorInvert = false ); const double& aScalingFactor = 1.0,
const VECTOR2I& aTransformCentre = { 0, 0 },
const bool& aMirrorInvert = false );
void loadFigure( const FIGURE& aCadstarFigure, const LAYER_ID& aCadstarSheetIDOverride, void loadFigure( const FIGURE& aCadstarFigure, const LAYER_ID& aCadstarSheetIDOverride,
SCH_LAYER_ID aKiCadSchLayerID, const wxPoint& aMoveVector = { 0, 0 }, SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 },
const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0,
const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); const VECTOR2I& aTransformCentre = { 0, 0 },
const bool& aMirrorInvert = false );
//Helper functions for loading text elements //Helper functions for loading text elements
void applyTextSettings( EDA_TEXT* aKiCadTextItem, void applyTextSettings( EDA_TEXT* aKiCadTextItem,
@ -223,15 +227,17 @@ private:
void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber ); void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber );
std::pair<wxPoint, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure ); std::pair<VECTOR2I, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure );
wxPoint getKiCadPoint( const wxPoint& aCadstarPoint ); VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );
wxPoint getKiCadLibraryPoint( const wxPoint& aCadstarPoint, const wxPoint& aCadstarCentre ); wxPoint getKiCadLibraryPoint( const wxPoint& aCadstarPoint, const wxPoint& aCadstarCentre );
wxPoint applyTransform( const wxPoint& aPoint, const wxPoint& aMoveVector = { 0, 0 }, VECTOR2I applyTransform( const VECTOR2I& aPoint, const VECTOR2I& aMoveVector = { 0, 0 },
const double& aRotationAngleDeciDeg = 0.0, const double& aScalingFactor = 1.0, const double& aRotationAngleDeciDeg = 0.0,
const wxPoint& aTransformCentre = { 0, 0 }, const bool& aMirrorInvert = false ); const double& aScalingFactor = 1.0,
const VECTOR2I& aTransformCentre = { 0, 0 },
const bool& aMirrorInvert = false );
int getKiCadLength( long long aCadstarLength ) int getKiCadLength( long long aCadstarLength )
{ {
@ -288,14 +294,14 @@ private:
* @param aPoint * @param aPoint
* @return Angle in decidegrees of the polar representation of the point, scaled 0..360 * @return Angle in decidegrees of the polar representation of the point, scaled 0..360
*/ */
double getPolarAngle( const wxPoint& aPoint ); double getPolarAngle( const VECTOR2I& aPoint );
/** /**
* @brief * @brief
* @param aPoint * @param aPoint
* @return Radius of polar representation of the point * @return Radius of polar representation of the point
*/ */
double getPolarRadius( const wxPoint& aPoint ); double getPolarRadius( const VECTOR2I& aPoint );
}; // CADSTAR_SCH_ARCHIVE_LOADER }; // CADSTAR_SCH_ARCHIVE_LOADER

View File

@ -698,7 +698,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
while( sheetNode ) while( sheetNode )
{ {
wxPoint pos = wxPoint( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); VECTOR2I pos = VECTOR2I( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) );
std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>( m_rootSheet, pos ); std::unique_ptr<SCH_SHEET> sheet = std::make_unique<SCH_SHEET>( m_rootSheet, pos );
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
@ -750,7 +750,7 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
// placement for the new symbols // placement for the new symbols
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU(); wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU();
EDA_RECT sheetBbox = getSheetBbox( m_rootSheet ); EDA_RECT sheetBbox = getSheetBbox( m_rootSheet );
wxPoint newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() ); VECTOR2I newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() );
int maxY = sheetBbox.GetY(); int maxY = sheetBbox.GetY();
SCH_SHEET_PATH sheetpath; SCH_SHEET_PATH sheetpath;
@ -778,12 +778,12 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
// Calculate the placement position // Calculate the placement position
EDA_RECT cmpBbox = symbol->GetBoundingBox(); EDA_RECT cmpBbox = symbol->GetBoundingBox();
int posY = newCmpPosition.y + cmpBbox.GetHeight(); int posY = newCmpPosition.y + cmpBbox.GetHeight();
symbol->SetPosition( wxPoint( newCmpPosition.x, posY ) ); symbol->SetPosition( VECTOR2I( newCmpPosition.x, posY ) );
newCmpPosition.x += cmpBbox.GetWidth(); newCmpPosition.x += cmpBbox.GetWidth();
maxY = std::max( maxY, posY ); maxY = std::max( maxY, posY );
if( newCmpPosition.x >= pageSizeIU.GetWidth() ) // reached the page boundary? if( newCmpPosition.x >= pageSizeIU.GetWidth() ) // reached the page boundary?
newCmpPosition = wxPoint( sheetBbox.GetLeft(), maxY ); // then start a new row newCmpPosition = VECTOR2I( sheetBbox.GetLeft(), maxY ); // then start a new row
// Add the global net labels to recreate the implicit connections // Add the global net labels to recreate the implicit connections
addImplicitConnections( symbol.get(), m_rootSheet->GetScreen(), false ); addImplicitConnections( symbol.get(), m_rootSheet->GetScreen(), false );
@ -972,7 +972,7 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
for( SCH_ITEM* item : allItems ) for( SCH_ITEM* item : allItems )
{ {
item->SetPosition( item->GetPosition() + (wxPoint)translation ); item->SetPosition( item->GetPosition() + translation );
item->ClearFlags(); item->ClearFlags();
m_currentSheet->GetScreen()->Update( item ); m_currentSheet->GetScreen()->Update( item );
@ -984,10 +984,10 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_LINE*>&
{ {
EFRAME eframe( aFrameNode ); EFRAME eframe( aFrameNode );
wxPoint corner1( eframe.x1.ToSchUnits(), -eframe.y1.ToSchUnits() ); VECTOR2I corner1( eframe.x1.ToSchUnits(), -eframe.y1.ToSchUnits() );
wxPoint corner3( eframe.x2.ToSchUnits(), -eframe.y2.ToSchUnits() ); VECTOR2I corner3( eframe.x2.ToSchUnits(), -eframe.y2.ToSchUnits() );
wxPoint corner2( corner3.x, corner1.y ); VECTOR2I corner2( corner3.x, corner1.y );
wxPoint corner4( corner1.x, corner3.y ); VECTOR2I corner4( corner1.x, corner3.y );
SCH_LINE* line = new SCH_LINE(); SCH_LINE* line = new SCH_LINE();
line->SetLineStyle( PLOT_DASH_TYPE::SOLID ); line->SetLineStyle( PLOT_DASH_TYPE::SOLID );
@ -1156,7 +1156,7 @@ SCH_LINE* SCH_EAGLE_PLUGIN::loadWire( wxXmlNode* aWireNode )
wire->SetLayer( kiCadLayer( ewire.layer ) ); wire->SetLayer( kiCadLayer( ewire.layer ) );
wxPoint begin, end; VECTOR2I begin, end;
begin.x = ewire.x1.ToSchUnits(); begin.x = ewire.x1.ToSchUnits();
begin.y = -ewire.y1.ToSchUnits(); begin.y = -ewire.y1.ToSchUnits();
@ -1178,7 +1178,7 @@ SCH_JUNCTION* SCH_EAGLE_PLUGIN::loadJunction( wxXmlNode* aJunction )
std::unique_ptr<SCH_JUNCTION> junction = std::make_unique<SCH_JUNCTION>(); std::unique_ptr<SCH_JUNCTION> junction = std::make_unique<SCH_JUNCTION>();
EJUNCTION ejunction = EJUNCTION( aJunction ); EJUNCTION ejunction = EJUNCTION( aJunction );
wxPoint pos( ejunction.x.ToSchUnits(), -ejunction.y.ToSchUnits() ); VECTOR2I pos( ejunction.x.ToSchUnits(), -ejunction.y.ToSchUnits() );
junction->SetPosition( pos ); junction->SetPosition( pos );
@ -1189,7 +1189,7 @@ SCH_JUNCTION* SCH_EAGLE_PLUGIN::loadJunction( wxXmlNode* aJunction )
SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aNetName ) SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aNetName )
{ {
ELABEL elabel = ELABEL( aLabelNode, aNetName ); ELABEL elabel = ELABEL( aLabelNode, aNetName );
wxPoint elabelpos( elabel.x.ToSchUnits(), -elabel.y.ToSchUnits() ); VECTOR2I elabelpos( elabel.x.ToSchUnits(), -elabel.y.ToSchUnits() );
// Determine if the label is local or global depending on // Determine if the label is local or global depending on
// the number of sheets the net appears in // the number of sheets the net appears in
@ -1223,7 +1223,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN
std::pair<VECTOR2I, const SEG*> std::pair<VECTOR2I, const SEG*>
SCH_EAGLE_PLUGIN::findNearestLinePoint( const wxPoint& aPoint, SCH_EAGLE_PLUGIN::findNearestLinePoint( const VECTOR2I& aPoint,
const std::vector<SEG>& aLines ) const const std::vector<SEG>& aLines ) const
{ {
VECTOR2I nearestPoint; VECTOR2I nearestPoint;
@ -1324,7 +1324,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>(); std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
symbol->SetLibId( libId ); symbol->SetLibId( libId );
symbol->SetUnit( unit ); symbol->SetUnit( unit );
symbol->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) ); symbol->SetPosition( VECTOR2I( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) );
symbol->GetField( FOOTPRINT_FIELD )->SetText( package ); symbol->GetField( FOOTPRINT_FIELD )->SetText( package );
if( einstance.rot ) if( einstance.rot )
@ -1422,7 +1422,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
if( field ) if( field )
{ {
field->SetPosition( wxPoint( attr.x->ToSchUnits(), -attr.y->ToSchUnits() ) ); field->SetPosition( VECTOR2I( attr.x->ToSchUnits(), -attr.y->ToSchUnits() ) );
int align = attr.align ? *attr.align : ETEXT::BOTTOM_LEFT; int align = attr.align ? *attr.align : ETEXT::BOTTOM_LEFT;
int absdegrees = attr.rot ? attr.rot->degrees : 0; int absdegrees = attr.rot ? attr.rot->degrees : 0;
bool mirror = attr.rot ? attr.rot->mirror : false; bool mirror = attr.rot ? attr.rot->mirror : false;
@ -1751,10 +1751,10 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolCircle( std::unique_ptr<LIB_SYMBOL>& aSym
// Parse the circle properties // Parse the circle properties
ECIRCLE c( aCircleNode ); ECIRCLE c( aCircleNode );
LIB_SHAPE* circle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::CIRCLE ); LIB_SHAPE* circle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::CIRCLE );
wxPoint center( c.x.ToSchUnits(), c.y.ToSchUnits() ); VECTOR2I center( c.x.ToSchUnits(), c.y.ToSchUnits() );
circle->SetPosition( center ); circle->SetPosition( center );
circle->SetEnd( wxPoint( center.x + c.radius.ToSchUnits(), center.y ) ); circle->SetEnd( VECTOR2I( center.x + c.radius.ToSchUnits(), center.y ) );
circle->SetStroke( STROKE_PARAMS( c.width.ToSchUnits(), PLOT_DASH_TYPE::SOLID ) ); circle->SetStroke( STROKE_PARAMS( c.width.ToSchUnits(), PLOT_DASH_TYPE::SOLID ) );
circle->SetUnit( aGateNumber ); circle->SetUnit( aGateNumber );
@ -1768,8 +1768,8 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( std::unique_ptr<LIB_SYMBOL>& a
ERECT rect( aRectNode ); ERECT rect( aRectNode );
LIB_SHAPE* rectangle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::RECT ); LIB_SHAPE* rectangle = new LIB_SHAPE( aSymbol.get(), SHAPE_T::RECT );
rectangle->SetPosition( wxPoint( rect.x1.ToSchUnits(), rect.y1.ToSchUnits() ) ); rectangle->SetPosition( VECTOR2I( rect.x1.ToSchUnits(), rect.y1.ToSchUnits() ) );
rectangle->SetEnd( wxPoint( rect.x2.ToSchUnits(), rect.y2.ToSchUnits() ) ); rectangle->SetEnd( VECTOR2I( rect.x2.ToSchUnits(), rect.y2.ToSchUnits() ) );
rectangle->SetUnit( aGateNumber ); rectangle->SetUnit( aGateNumber );
@ -1785,7 +1785,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_SYMBOL>& aSymbol
{ {
EWIRE ewire = EWIRE( aWireNode ); EWIRE ewire = EWIRE( aWireNode );
wxPoint begin, end; VECTOR2I begin, end;
begin.x = ewire.x1.ToSchUnits(); begin.x = ewire.x1.ToSchUnits();
begin.y = ewire.y1.ToSchUnits(); begin.y = ewire.y1.ToSchUnits();
@ -1799,7 +1799,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_SYMBOL>& aSymbol
if( ewire.curve ) if( ewire.curve )
{ {
LIB_SHAPE* arc = new LIB_SHAPE( aSymbol.get(), SHAPE_T::ARC ); LIB_SHAPE* arc = new LIB_SHAPE( aSymbol.get(), SHAPE_T::ARC );
wxPoint center = ConvertArcCenter( begin, end, *ewire.curve * -1 ); VECTOR2I center = ConvertArcCenter( begin, end, *ewire.curve * -1 );
double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) ) double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) )
+ ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) ) + ( ( center.y - begin.y ) * ( center.y - begin.y ) ) ) )
* 2; * 2;
@ -1807,8 +1807,8 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_SYMBOL>& aSymbol
// this emulates the filled semicircles created by a thick arc with flat ends caps. // this emulates the filled semicircles created by a thick arc with flat ends caps.
if( ewire.width.ToSchUnits() * 2 > radius ) if( ewire.width.ToSchUnits() * 2 > radius )
{ {
wxPoint centerStartVector = begin - center; VECTOR2I centerStartVector = begin - center;
wxPoint centerEndVector = end - center; VECTOR2I centerEndVector = end - center;
centerStartVector.x = centerStartVector.x * ewire.width.ToSchUnits() * 2 / radius; centerStartVector.x = centerStartVector.x * ewire.width.ToSchUnits() * 2 / radius;
centerStartVector.y = centerStartVector.y * ewire.width.ToSchUnits() * 2 / radius; centerStartVector.y = centerStartVector.y * ewire.width.ToSchUnits() * 2 / radius;
@ -1831,7 +1831,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr<LIB_SYMBOL>& aSymbol
arc->SetStroke( STROKE_PARAMS( ewire.width.ToSchUnits(), PLOT_DASH_TYPE::SOLID ) ); arc->SetStroke( STROKE_PARAMS( ewire.width.ToSchUnits(), PLOT_DASH_TYPE::SOLID ) );
} }
arc->SetArcGeometry( begin, (wxPoint) CalcArcMid( begin, end, center ), end ); arc->SetArcGeometry( begin, CalcArcMid( begin, end, center ), end );
arc->SetUnit( aGateNumber ); arc->SetUnit( aGateNumber );
return arc; return arc;
@ -1856,14 +1856,14 @@ LIB_SHAPE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr<LIB_SYMBOL>& aS
LIB_SHAPE* poly = new LIB_SHAPE( aSymbol.get(), SHAPE_T::POLY ); LIB_SHAPE* poly = new LIB_SHAPE( aSymbol.get(), SHAPE_T::POLY );
EPOLYGON epoly( aPolygonNode ); EPOLYGON epoly( aPolygonNode );
wxXmlNode* vertex = aPolygonNode->GetChildren(); wxXmlNode* vertex = aPolygonNode->GetChildren();
wxPoint pt; VECTOR2I pt;
while( vertex ) while( vertex )
{ {
if( vertex->GetName() == "vertex" ) // skip <xmlattr> node if( vertex->GetName() == "vertex" ) // skip <xmlattr> node
{ {
EVERTEX evertex( vertex ); EVERTEX evertex( vertex );
pt = wxPoint( evertex.x.ToSchUnits(), evertex.y.ToSchUnits() ); pt = VECTOR2I( evertex.x.ToSchUnits(), evertex.y.ToSchUnits() );
poly->AddPoint( pt ); poly->AddPoint( pt );
} }
@ -1881,7 +1881,7 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlN
EPIN* aEPin, int aGateNumber ) EPIN* aEPin, int aGateNumber )
{ {
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aSymbol.get() ); std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aSymbol.get() );
pin->SetPosition( wxPoint( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) ); pin->SetPosition( VECTOR2I( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) );
pin->SetName( aEPin->name ); pin->SetName( aEPin->name );
pin->SetUnit( aGateNumber ); pin->SetUnit( aGateNumber );
@ -1961,7 +1961,7 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText( std::unique_ptr<LIB_SYMBOL>& aSymbol
ETEXT etext( aLibText ); ETEXT etext( aLibText );
libtext->SetUnit( aGateNumber ); libtext->SetUnit( aGateNumber );
libtext->SetPosition( wxPoint( etext.x.ToSchUnits(), etext.y.ToSchUnits() ) ); libtext->SetPosition( VECTOR2I( etext.x.ToSchUnits(), etext.y.ToSchUnits() ) );
// Eagle supports multiple line text in library symbols. Legacy library symbol text cannot // Eagle supports multiple line text in library symbols. Legacy library symbol text cannot
// contain CRs or LFs. // contain CRs or LFs.
@ -1995,18 +1995,18 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
std::swap( yMin, yMax ); std::swap( yMin, yMax );
LIB_SHAPE* lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); LIB_SHAPE* lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( xMin, yMin ) ); lines->AddPoint( VECTOR2I( xMin, yMin ) );
lines->AddPoint( wxPoint( xMax, yMin ) ); lines->AddPoint( VECTOR2I( xMax, yMin ) );
lines->AddPoint( wxPoint( xMax, yMax ) ); lines->AddPoint( VECTOR2I( xMax, yMax ) );
lines->AddPoint( wxPoint( xMin, yMax ) ); lines->AddPoint( VECTOR2I( xMin, yMax ) );
lines->AddPoint( wxPoint( xMin, yMin ) ); lines->AddPoint( VECTOR2I( xMin, yMin ) );
aItems.push_back( lines ); aItems.push_back( lines );
if( !eframe.border_left ) if( !eframe.border_left )
{ {
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
aItems.push_back( lines ); aItems.push_back( lines );
int i; int i;
@ -2021,8 +2021,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
{ {
int newY = KiROUND( yMin + ( rowSpacing * (double) i ) ); int newY = KiROUND( yMin + ( rowSpacing * (double) i ) );
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( x1, newY ) ); lines->AddPoint( VECTOR2I( x1, newY ) );
lines->AddPoint( wxPoint( x2, newY ) ); lines->AddPoint( VECTOR2I( x2, newY ) );
aItems.push_back( lines ); aItems.push_back( lines );
} }
@ -2031,7 +2031,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
for( i = 0; i < eframe.rows; i++ ) for( i = 0; i < eframe.rows; i++ )
{ {
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( wxPoint( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
@ -2043,8 +2043,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_right ) if( !eframe.border_right )
{ {
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
aItems.push_back( lines ); aItems.push_back( lines );
int i; int i;
@ -2059,8 +2059,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
{ {
int newY = KiROUND( yMin + ( rowSpacing * (double) i ) ); int newY = KiROUND( yMin + ( rowSpacing * (double) i ) );
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( x1, newY ) ); lines->AddPoint( VECTOR2I( x1, newY ) );
lines->AddPoint( wxPoint( x2, newY ) ); lines->AddPoint( VECTOR2I( x2, newY ) );
aItems.push_back( lines ); aItems.push_back( lines );
} }
@ -2069,7 +2069,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
for( i = 0; i < eframe.rows; i++ ) for( i = 0; i < eframe.rows; i++ )
{ {
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( wxPoint( legendPosX, KiROUND( legendPosY ) ) ); legendText->SetPosition( VECTOR2I( legendPosX, KiROUND( legendPosY ) ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
@ -2081,8 +2081,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_top ) if( !eframe.border_top )
{ {
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMax - Mils2iu( 150 ) ) );
aItems.push_back( lines ); aItems.push_back( lines );
int i; int i;
@ -2097,8 +2097,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
{ {
int newX = KiROUND( xMin + ( columnSpacing * (double) i ) ); int newX = KiROUND( xMin + ( columnSpacing * (double) i ) );
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( newX, y1 ) ); lines->AddPoint( VECTOR2I( newX, y1 ) );
lines->AddPoint( wxPoint( newX, y2 ) ); lines->AddPoint( VECTOR2I( newX, y2 ) );
aItems.push_back( lines ); aItems.push_back( lines );
} }
@ -2107,7 +2107,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
for( i = 0; i < eframe.columns; i++ ) for( i = 0; i < eframe.columns; i++ )
{ {
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( wxPoint( KiROUND( legendPosX ), legendPosY ) ); legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
@ -2119,8 +2119,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
if( !eframe.border_bottom ) if( !eframe.border_bottom )
{ {
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMax - Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
lines->AddPoint( wxPoint( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) ); lines->AddPoint( VECTOR2I( xMin + Mils2iu( 150 ), yMin + Mils2iu( 150 ) ) );
aItems.push_back( lines ); aItems.push_back( lines );
int i; int i;
@ -2135,8 +2135,8 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
{ {
int newX = KiROUND( xMin + ( columnSpacing * (double) i ) ); int newX = KiROUND( xMin + ( columnSpacing * (double) i ) );
lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY ); lines = new LIB_SHAPE( nullptr, SHAPE_T::POLY );
lines->AddPoint( wxPoint( newX, y1 ) ); lines->AddPoint( VECTOR2I( newX, y1 ) );
lines->AddPoint( wxPoint( newX, y2 ) ); lines->AddPoint( VECTOR2I( newX, y2 ) );
aItems.push_back( lines ); aItems.push_back( lines );
} }
@ -2145,7 +2145,7 @@ void SCH_EAGLE_PLUGIN::loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>&
for( i = 0; i < eframe.columns; i++ ) for( i = 0; i < eframe.columns; i++ )
{ {
LIB_TEXT* legendText = new LIB_TEXT( nullptr ); LIB_TEXT* legendText = new LIB_TEXT( nullptr );
legendText->SetPosition( wxPoint( KiROUND( legendPosX ), legendPosY ) ); legendText->SetPosition( VECTOR2I( KiROUND( legendPosX ), legendPosY ) );
legendText->SetText( wxString( legendChar ) ); legendText->SetText( wxString( legendChar ) );
legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) ); legendText->SetTextSize( wxSize( Mils2iu( 90 ), Mils2iu( 100 ) ) );
aItems.push_back( legendText ); aItems.push_back( legendText );
@ -2180,7 +2180,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadPlainText( wxXmlNode* aSchText )
} }
schtext->SetText( adjustedText.IsEmpty() ? "\" \"" : escapeName( adjustedText ) ); schtext->SetText( adjustedText.IsEmpty() ? "\" \"" : escapeName( adjustedText ) );
schtext->SetPosition( wxPoint( etext.x.ToSchUnits(), -etext.y.ToSchUnits() ) ); schtext->SetPosition( VECTOR2I( etext.x.ToSchUnits(), -etext.y.ToSchUnits() ) );
loadTextAttributes( schtext.get(), etext ); loadTextAttributes( schtext.get(), etext );
schtext->SetItalic( false ); schtext->SetItalic( false );
@ -2275,12 +2275,12 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
// Move along the attached wire to find the new label position // Move along the attached wire to find the new label position
if( trial % 2 == 1 ) if( trial % 2 == 1 )
{ {
labelPos = wxPoint( origPos + wireDirection * trial / 2 ); labelPos = VECTOR2I( origPos + wireDirection * trial / 2 );
move = checkPositive = segAttached->Contains( labelPos ); move = checkPositive = segAttached->Contains( labelPos );
} }
else else
{ {
labelPos = wxPoint( origPos - wireDirection * trial / 2 ); labelPos = VECTOR2I( origPos - wireDirection * trial / 2 );
move = checkNegative = segAttached->Contains( labelPos ); move = checkNegative = segAttached->Contains( labelPos );
} }
@ -2288,7 +2288,7 @@ void SCH_EAGLE_PLUGIN::adjustNetLabels()
} }
if( move ) if( move )
label->SetPosition( wxPoint( labelPos ) ); label->SetPosition( VECTOR2I( labelPos ) );
} }
} }
@ -2316,7 +2316,7 @@ bool SCH_EAGLE_PLUGIN::CheckHeader( const wxString& aFileName )
} }
void SCH_EAGLE_PLUGIN::moveLabels( SCH_LINE* aWire, const wxPoint& aNewEndPoint ) void SCH_EAGLE_PLUGIN::moveLabels( SCH_LINE* aWire, const VECTOR2I& aNewEndPoint )
{ {
static KICAD_T labelTypes[] = { SCH_LABEL_LOCATE_ANY_T, EOT }; static KICAD_T labelTypes[] = { SCH_LABEL_LOCATE_ANY_T, EOT };
SCH_SCREEN* screen = m_currentSheet->GetScreen(); SCH_SCREEN* screen = m_currentSheet->GetScreen();
@ -2355,23 +2355,23 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
for( SCH_LINE* wire : wires ) for( SCH_LINE* wire : wires )
{ {
wxPoint wireStart = wire->GetStartPoint(); VECTOR2I wireStart = wire->GetStartPoint();
wxPoint wireEnd = wire->GetEndPoint(); VECTOR2I wireEnd = wire->GetEndPoint();
for( SCH_LINE* bus : buses ) for( SCH_LINE* bus : buses )
{ {
wxPoint busStart = bus->GetStartPoint(); VECTOR2I busStart = bus->GetStartPoint();
wxPoint busEnd = bus->GetEndPoint(); VECTOR2I busEnd = bus->GetEndPoint();
auto entrySize = auto entrySize =
[]( int signX, int signY ) -> wxPoint []( int signX, int signY ) -> VECTOR2I
{ {
return wxPoint( Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signX, return VECTOR2I( Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signX,
Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signY ); Mils2iu( DEFAULT_SCH_ENTRY_SIZE ) * signY );
}; };
auto testBusHit = auto testBusHit =
[&]( const wxPoint& aPt ) -> bool [&]( const VECTOR2I& aPt ) -> bool
{ {
return TestSegmentHit( aPt, busStart, busEnd, 0 ); return TestSegmentHit( aPt, busStart, busEnd, 0 );
}; };
@ -2391,7 +2391,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* *
* *
*/ */
wxPoint p = wireStart + entrySize( -1, 0 ); VECTOR2I p = wireStart + entrySize( -1, 0 );
if( testBusHit( wireStart + entrySize( 0, -1 ) ) ) if( testBusHit( wireStart + entrySize( 0, -1 ) ) )
{ {
@ -2433,7 +2433,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* *
* *
*/ */
wxPoint p = wireStart + entrySize( 1, 0 ); VECTOR2I p = wireStart + entrySize( 1, 0 );
if( testBusHit( wireStart + entrySize( 0, -1 ) ) ) if( testBusHit( wireStart + entrySize( 0, -1 ) ) )
{ {
@ -2482,7 +2482,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* *
* *
*/ */
wxPoint p = wireEnd + entrySize( -1, 0 ); VECTOR2I p = wireEnd + entrySize( -1, 0 );
if( testBusHit( wireEnd + entrySize( 0, -1 ) ) ) if( testBusHit( wireEnd + entrySize( 0, -1 ) ) )
{ {
@ -2524,7 +2524,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* *
* *
*/ */
wxPoint p = wireEnd + entrySize( 1, 0 ); VECTOR2I p = wireEnd + entrySize( 1, 0 );
if( testBusHit( wireEnd + entrySize( 0, -1 ) ) ) if( testBusHit( wireEnd + entrySize( 0, -1 ) ) )
{ {
@ -2579,7 +2579,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* | * |
* ======= * =======
*/ */
wxPoint p = wireStart + entrySize( 0, -1 ); VECTOR2I p = wireStart + entrySize( 0, -1 );
if( testBusHit( wireStart + entrySize( -1, 0 ) ) ) if( testBusHit( wireStart + entrySize( -1, 0 ) ) )
{ {
@ -2624,7 +2624,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* | * |
* | * |
*/ */
wxPoint p = wireStart + entrySize( 0, 1 ); VECTOR2I p = wireStart + entrySize( 0, 1 );
if( testBusHit( wireStart + entrySize( -1, 0 ) ) ) if( testBusHit( wireStart + entrySize( -1, 0 ) ) )
{ {
@ -2676,7 +2676,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* | * |
* ======= * =======
*/ */
wxPoint p = wireEnd + entrySize( 0, -1 ); VECTOR2I p = wireEnd + entrySize( 0, -1 );
if( testBusHit( wireEnd + entrySize( -1, 0 ) ) ) if( testBusHit( wireEnd + entrySize( -1, 0 ) ) )
{ {
@ -2721,7 +2721,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
* | * |
* | * |
*/ */
wxPoint p = wireEnd + entrySize( 0, 1 ); VECTOR2I p = wireEnd + entrySize( 0, 1 );
if( testBusHit( wireEnd + entrySize( -1, 0 ) ) ) if( testBusHit( wireEnd + entrySize( -1, 0 ) ) )
{ {
@ -2768,13 +2768,13 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
if( testBusHit( wireStart ) ) if( testBusHit( wireStart ) )
{ {
wxPoint wirevector = wireStart - wireEnd; VECTOR2I wirevector = wireStart - wireEnd;
if( wirevector.x > 0 ) if( wirevector.x > 0 )
{ {
if( wirevector.y > 0 ) if( wirevector.y > 0 )
{ {
wxPoint p = wireStart + entrySize( -1, -1 ); VECTOR2I p = wireStart + entrySize( -1, -1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 2 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 2 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2784,7 +2784,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} }
else else
{ {
wxPoint p = wireStart + entrySize( -1, 1 ); VECTOR2I p = wireStart + entrySize( -1, 1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 1 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2797,7 +2797,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
{ {
if( wirevector.y > 0 ) if( wirevector.y > 0 )
{ {
wxPoint p = wireStart + entrySize( 1, -1 ); VECTOR2I p = wireStart + entrySize( 1, -1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 3 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 3 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2807,7 +2807,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} }
else else
{ {
wxPoint p = wireStart + entrySize( 1, 1 ); VECTOR2I p = wireStart + entrySize( 1, 1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 4 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 4 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2821,13 +2821,13 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} }
else if( testBusHit( wireEnd ) ) else if( testBusHit( wireEnd ) )
{ {
wxPoint wirevector = wireStart - wireEnd; VECTOR2I wirevector = wireStart - wireEnd;
if( wirevector.x > 0 ) if( wirevector.x > 0 )
{ {
if( wirevector.y > 0 ) if( wirevector.y > 0 )
{ {
wxPoint p = wireEnd + entrySize( 1, 1 ); VECTOR2I p = wireEnd + entrySize( 1, 1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 4 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 4 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2837,7 +2837,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} }
else else
{ {
wxPoint p = wireEnd + entrySize( 1, -1 ); VECTOR2I p = wireEnd + entrySize( 1, -1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 3 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 3 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2850,7 +2850,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
{ {
if( wirevector.y > 0 ) if( wirevector.y > 0 )
{ {
wxPoint p = wireEnd + entrySize( -1, 1 ); VECTOR2I p = wireEnd + entrySize( -1, 1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 1 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 1 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2860,7 +2860,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
} }
else else
{ {
wxPoint p = wireEnd + entrySize( -1, -1 ); VECTOR2I p = wireEnd + entrySize( -1, -1 );
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 2 ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( p, 2 );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
m_currentSheet->GetScreen()->Append( busEntry ); m_currentSheet->GetScreen()->Append( busEntry );
@ -2896,8 +2896,8 @@ const SEG* SCH_EAGLE_PLUGIN::SEG_DESC::LabelAttached( const SCH_TEXT* aLabel ) c
// (see SCH_EDIT_FRAME::importFile()) // (see SCH_EDIT_FRAME::importFile())
bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const
{ {
wxPoint pinPosition = aSymbol->GetPinPhysicalPosition( aPin ); VECTOR2I pinPosition = aSymbol->GetPinPhysicalPosition( aPin );
auto pointIt = m_connPoints.find( pinPosition ); auto pointIt = m_connPoints.find( pinPosition );
if( pointIt == m_connPoints.end() ) if( pointIt == m_connPoints.end() )
return false; return false;

View File

@ -116,7 +116,7 @@ private:
void countNets( wxXmlNode* aSchematicNode ); void countNets( wxXmlNode* aSchematicNode );
/// Move any labels on the wire to the new end point of the wire. /// Move any labels on the wire to the new end point of the wire.
void moveLabels( SCH_LINE* aWire, const wxPoint& aNewEndPoint ); void moveLabels( SCH_LINE* aWire, const VECTOR2I& aNewEndPoint );
/// This function finds best way to place a bus entry symbol for when an Eagle wire segment /// This function finds best way to place a bus entry symbol for when an Eagle wire segment
/// ends on an Eagle bus segment. /// ends on an Eagle bus segment.
@ -125,7 +125,7 @@ private:
/// Return the matching layer or return LAYER_NOTES /// Return the matching layer or return LAYER_NOTES
SCH_LAYER_ID kiCadLayer( int aEagleLayer ); SCH_LAYER_ID kiCadLayer( int aEagleLayer );
std::pair<VECTOR2I, const SEG*> findNearestLinePoint( const wxPoint& aPoint, std::pair<VECTOR2I, const SEG*> findNearestLinePoint( const VECTOR2I& aPoint,
const std::vector<SEG>& aLines ) const; const std::vector<SEG>& aLines ) const;
void loadSegments( wxXmlNode* aSegmentsNode, const wxString& aNetName, void loadSegments( wxXmlNode* aSegmentsNode, const wxString& aNetName,
@ -258,7 +258,7 @@ private:
std::map<wxString, ENET> m_nets; std::map<wxString, ENET> m_nets;
///< Positions of pins and wire endings mapped to its parent ///< Positions of pins and wire endings mapped to its parent
std::map<wxPoint, std::set<const EDA_ITEM*>> m_connPoints; std::map<VECTOR2I, std::set<const EDA_ITEM*>> m_connPoints;
}; };
#endif // _SCH_EAGLE_PLUGIN_H_ #endif // _SCH_EAGLE_PLUGIN_H_

View File

@ -985,7 +985,7 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
*/ */
if( !TRANSFORM().MapAngles( &startAngle, &endAngle ) ) if( !TRANSFORM().MapAngles( &startAngle, &endAngle ) )
{ {
wxPoint temp = arc->GetStart(); VECTOR2I temp = arc->GetStart();
arc->SetStart( arc->GetEnd() ); arc->SetStart( arc->GetEnd() );
arc->SetEnd( temp ); arc->SetEnd( temp );
} }
@ -2928,7 +2928,7 @@ SCH_SHAPE* SCH_SEXPR_PARSER::parseSchArc()
*/ */
if( !TRANSFORM().MapAngles( &startAngle, &endAngle ) ) if( !TRANSFORM().MapAngles( &startAngle, &endAngle ) )
{ {
wxPoint temp = arc->GetStart(); VECTOR2I temp = arc->GetStart();
arc->SetStart( arc->GetEnd() ); arc->SetStart( arc->GetEnd() );
arc->SetEnd( temp ); arc->SetEnd( temp );
} }

View File

@ -329,8 +329,8 @@ static void formatBezier( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE
{ {
aFormatter->Print( aNestLevel, "(bezier (pts " ); aFormatter->Print( aNestLevel, "(bezier (pts " );
for( const wxPoint& pt : { aBezier->GetStart(), aBezier->GetBezierC1(), for( const VECTOR2I& pt : { aBezier->GetStart(), aBezier->GetBezierC1(),
aBezier->GetBezierC2(), aBezier->GetEnd() } ) aBezier->GetBezierC2(), aBezier->GetEnd() } )
{ {
aFormatter->Print( 0, " (xy %s %s)", aFormatter->Print( 0, " (xy %s %s)",
FormatInternalUnits( pt.x ).c_str(), FormatInternalUnits( pt.x ).c_str(),

View File

@ -3271,7 +3271,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
LIB_SHAPE* arc = new LIB_SHAPE( aSymbol.get(), SHAPE_T::ARC ); LIB_SHAPE* arc = new LIB_SHAPE( aSymbol.get(), SHAPE_T::ARC );
wxPoint center; VECTOR2I center;
center.x = Mils2Iu( parseInt( aReader, line, &line ) ); center.x = Mils2Iu( parseInt( aReader, line, &line ) );
center.y = Mils2Iu( parseInt( aReader, line, &line ) ); center.y = Mils2Iu( parseInt( aReader, line, &line ) );
@ -3298,7 +3298,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
// Actual Coordinates of arc ends are read from file // Actual Coordinates of arc ends are read from file
if( *line != 0 ) if( *line != 0 )
{ {
wxPoint arcStart, arcEnd; VECTOR2I arcStart, arcEnd;
arcStart.x = Mils2Iu( parseInt( aReader, line, &line ) ); arcStart.x = Mils2Iu( parseInt( aReader, line, &line ) );
arcStart.y = Mils2Iu( parseInt( aReader, line, &line ) ); arcStart.y = Mils2Iu( parseInt( aReader, line, &line ) );
@ -3312,8 +3312,8 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
{ {
// Actual Coordinates of arc ends are not read from file // Actual Coordinates of arc ends are not read from file
// (old library), calculate them // (old library), calculate them
wxPoint arcStart( radius, 0 ); VECTOR2I arcStart( radius, 0 );
wxPoint arcEnd( radius, 0 ); VECTOR2I arcEnd( radius, 0 );
RotatePoint( &arcStart.x, &arcStart.y, -angle1 ); RotatePoint( &arcStart.x, &arcStart.y, -angle1 );
arcStart += arc->GetCenter(); arcStart += arc->GetCenter();
@ -3332,7 +3332,7 @@ LIB_SHAPE* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbo
*/ */
if( !TRANSFORM().MapAngles( &angle1, &angle2 ) ) if( !TRANSFORM().MapAngles( &angle1, &angle2 ) )
{ {
wxPoint temp = arc->GetStart(); VECTOR2I temp = arc->GetStart();
arc->SetStart( arc->GetEnd() ); arc->SetStart( arc->GetEnd() );
arc->SetEnd( temp ); arc->SetEnd( temp );
} }
@ -4026,7 +4026,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveBezier( LIB_SHAPE* aBezier, OUTPUTFORMATTER& a
aBezier->GetConvert(), aBezier->GetConvert(),
Iu2Mils( aBezier->GetWidth() ) ); Iu2Mils( aBezier->GetWidth() ) );
for( const wxPoint& pt : aBezier->GetBezierPoints() ) for( const VECTOR2I& pt : aBezier->GetBezierPoints() )
aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) ); aFormatter.Print( 0, " %d %d", Iu2Mils( pt.x ), Iu2Mils( pt.y ) );
aFormatter.Print( 0, " %c\n", fill_tab[ static_cast<int>( aBezier->GetFillMode() ) - 1 ] ); aFormatter.Print( 0, " %c\n", fill_tab[ static_cast<int>( aBezier->GetFillMode() ) - 1 ] );

View File

@ -171,7 +171,7 @@ private:
UTF8 m_ref; // it's private, use the accessors please UTF8 m_ref; // it's private, use the accessors please
SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object. SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object.
LIB_SYMBOL* m_libPart; ///< The source symbol from a library. LIB_SYMBOL* m_libPart; ///< The source symbol from a library.
wxPoint m_symbolPos; ///< The physical position of the symbol in schematic VECTOR2I m_symbolPos; ///< The physical position of the symbol in schematic
///< used to annotate by X or Y position ///< used to annotate by X or Y position
int m_unit; ///< The unit number for symbol with multiple parts int m_unit; ///< The unit number for symbol with multiple parts
///< per package. ///< per package.

View File

@ -237,14 +237,14 @@ public:
return EE_TYPE( m_tree, SCH_LOCATE_ANY_T, aRect ); return EE_TYPE( m_tree, SCH_LOCATE_ANY_T, aRect );
} }
EE_TYPE Overlapping( const wxPoint& aPoint, int aAccuracy = 0 ) const EE_TYPE Overlapping( const VECTOR2I& aPoint, int aAccuracy = 0 ) const
{ {
EDA_RECT rect( aPoint, wxSize( 0, 0 ) ); EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );
return EE_TYPE( m_tree, SCH_LOCATE_ANY_T, rect ); return EE_TYPE( m_tree, SCH_LOCATE_ANY_T, rect );
} }
EE_TYPE Overlapping( KICAD_T aType, const wxPoint& aPoint, int aAccuracy = 0 ) const EE_TYPE Overlapping( KICAD_T aType, const VECTOR2I& aPoint, int aAccuracy = 0 ) const
{ {
EDA_RECT rect( aPoint, wxSize( 0, 0 ) ); EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
rect.Inflate( aAccuracy ); rect.Inflate( aAccuracy );

View File

@ -339,7 +339,7 @@ bool SCH_SCREEN::CheckIfOnDrawList( const SCH_ITEM* aItem ) const
} }
SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T aType ) const SCH_ITEM* SCH_SCREEN::GetItem( const VECTOR2I& aPosition, int aAccuracy, KICAD_T aType ) const
{ {
EDA_RECT bbox; EDA_RECT bbox;
bbox.SetOrigin( aPosition ); bbox.SetOrigin( aPosition );
@ -400,7 +400,7 @@ std::set<SCH_ITEM*> SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
} }
bool SCH_SCREEN::IsJunction( const wxPoint& aPosition ) const bool SCH_SCREEN::IsJunction( const VECTOR2I& aPosition ) const
{ {
bool hasExplicitJunction; bool hasExplicitJunction;
bool hasBusEntry; bool hasBusEntry;
@ -410,7 +410,7 @@ bool SCH_SCREEN::IsJunction( const wxPoint& aPosition ) const
} }
bool SCH_SCREEN::IsExplicitJunction( const wxPoint& aPosition ) const bool SCH_SCREEN::IsExplicitJunction( const VECTOR2I& aPosition ) const
{ {
bool hasExplicitJunction; bool hasExplicitJunction;
bool hasBusEntry; bool hasBusEntry;
@ -420,7 +420,7 @@ bool SCH_SCREEN::IsExplicitJunction( const wxPoint& aPosition ) const
} }
bool SCH_SCREEN::IsExplicitJunctionNeeded( const wxPoint& aPosition ) const bool SCH_SCREEN::IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const
{ {
bool hasExplicitJunction; bool hasExplicitJunction;
bool hasBusEntry; bool hasBusEntry;
@ -430,7 +430,7 @@ bool SCH_SCREEN::IsExplicitJunctionNeeded( const wxPoint& aPosition ) const
} }
bool SCH_SCREEN::IsExplicitJunctionAllowed( const wxPoint& aPosition ) const bool SCH_SCREEN::IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const
{ {
bool hasExplicitJunction; bool hasExplicitJunction;
bool hasBusEntry; bool hasBusEntry;
@ -441,7 +441,7 @@ bool SCH_SCREEN::IsExplicitJunctionAllowed( const wxPoint& aPosition ) const
bool SCH_SCREEN::doIsJunction( const wxPoint& aPosition, bool aBreakCrossings, bool SCH_SCREEN::doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings,
bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const
{ {
enum layers { WIRES = 0, BUSES }; enum layers { WIRES = 0, BUSES };
@ -542,7 +542,7 @@ bool SCH_SCREEN::doIsJunction( const wxPoint& aPosition, bool aBreakCrossings,
} }
bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const bool SCH_SCREEN::IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const
{ {
wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false, wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false,
wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) ); wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
@ -825,13 +825,13 @@ void SCH_SCREEN::Print( const RENDER_SETTINGS* aSettings )
} ); } );
for( SCH_ITEM* item : bitmaps ) for( SCH_ITEM* item : bitmaps )
item->Print( aSettings, wxPoint( 0, 0 ) ); item->Print( aSettings, VECTOR2I( 0, 0 ) );
for( SCH_ITEM* item : other ) for( SCH_ITEM* item : other )
item->Print( aSettings, wxPoint( 0, 0 ) ); item->Print( aSettings, VECTOR2I( 0, 0 ) );
for( SCH_ITEM* item : junctions ) for( SCH_ITEM* item : junctions )
item->Print( aSettings, wxPoint( 0, 0 ) ); item->Print( aSettings, VECTOR2I( 0, 0 ) );
} }
@ -897,7 +897,7 @@ void SCH_SCREEN::ClearDrawingState()
} }
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol, LIB_PIN* SCH_SCREEN::GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol,
bool aEndPointOnly ) const bool aEndPointOnly ) const
{ {
SCH_SYMBOL* candidate = nullptr; SCH_SYMBOL* candidate = nullptr;
@ -949,7 +949,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol,
} }
SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition ) const SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const VECTOR2I& aPosition ) const
{ {
SCH_SHEET_PIN* sheetPin = nullptr; SCH_SHEET_PIN* sheetPin = nullptr;
@ -967,7 +967,7 @@ SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition ) const
} }
size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const size_t SCH_SCREEN::CountConnectedItems( const VECTOR2I& aPos, bool aTestJunctions ) const
{ {
size_t count = 0; size_t count = 0;
@ -1073,7 +1073,7 @@ void SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath,
} }
SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLayer, SCH_LINE* SCH_SCREEN::GetLine( const VECTOR2I& aPosition, int aAccuracy, int aLayer,
SCH_LINE_TEST_T aSearchType ) const SCH_LINE_TEST_T aSearchType ) const
{ {
// an accuracy of 0 had problems with rounding errors; use at least 1 // an accuracy of 0 had problems with rounding errors; use at least 1
@ -1110,7 +1110,7 @@ SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLay
} }
SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy ) const SCH_TEXT* SCH_SCREEN::GetLabel( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) ) for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) )
{ {

View File

@ -215,7 +215,7 @@ public:
* @param aType The type of item to find. * @param aType The type of item to find.
* @return The item found that meets the search criteria or NULL if none found. * @return The item found that meets the search criteria or NULL if none found.
*/ */
SCH_ITEM* GetItem( const wxPoint& aPosition, int aAccuracy = 0, SCH_ITEM* GetItem( const VECTOR2I& aPosition, int aAccuracy = 0,
KICAD_T aType = SCH_LOCATE_ANY_T ) const; KICAD_T aType = SCH_LOCATE_ANY_T ) const;
/** /**
@ -309,7 +309,7 @@ public:
*/ */
void ClearDrawingState(); void ClearDrawingState();
size_t CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const; size_t CountConnectedItems( const VECTOR2I& aPos, bool aTestJunctions ) const;
/** /**
* Test if a junction is required for the items at \a aPosition on the screen. Note that * Test if a junction is required for the items at \a aPosition on the screen. Note that
@ -325,25 +325,25 @@ public:
* @param[in] aPosition The position to test. * @param[in] aPosition The position to test.
* @return True if a junction is required at \a aPosition. * @return True if a junction is required at \a aPosition.
*/ */
bool IsJunction( const wxPoint& aPosition ) const; bool IsJunction( const VECTOR2I& aPosition ) const;
/** /**
* Indicates that a junction dot is necessary at the given location. See IsJunctionNeeded * Indicates that a junction dot is necessary at the given location. See IsJunctionNeeded
* for more info. * for more info.
*/ */
bool IsExplicitJunction( const wxPoint& aPosition ) const; bool IsExplicitJunction( const VECTOR2I& aPosition ) const;
/** /**
* Indicates that a junction dot is necessary at the given location, and does not yet exist. * Indicates that a junction dot is necessary at the given location, and does not yet exist.
* See IsJunctionNeeded for more info. * See IsJunctionNeeded for more info.
*/ */
bool IsExplicitJunctionNeeded( const wxPoint& aPosition ) const; bool IsExplicitJunctionNeeded( const VECTOR2I& aPosition ) const;
/** /**
* Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded * Indicates that a juction dot may be placed at the given location. See IsJunctionNeeded
* for more info. * for more info.
*/ */
bool IsExplicitJunctionAllowed( const wxPoint& aPosition ) const; bool IsExplicitJunctionAllowed( const VECTOR2I& aPosition ) const;
/** /**
* Test if \a aPosition is a connection point on \a aLayer. * Test if \a aPosition is a connection point on \a aLayer.
@ -353,7 +353,7 @@ public:
* #LAYER_BUS, and #LAYER_WIRE. * #LAYER_BUS, and #LAYER_WIRE.
* @return True if \a Position is a connection point on \a aLayer. * @return True if \a Position is a connection point on \a aLayer.
*/ */
bool IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const; bool IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const;
/** /**
* Test the screen for a symbol pin item at \a aPosition. * Test the screen for a symbol pin item at \a aPosition.
@ -364,7 +364,7 @@ public:
* point of the pin. * point of the pin.
* @return The pin item if found, otherwise NULL. * @return The pin item if found, otherwise NULL.
*/ */
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol = nullptr, LIB_PIN* GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol = nullptr,
bool aEndPointOnly = false ) const; bool aEndPointOnly = false ) const;
/** /**
@ -373,7 +373,7 @@ public:
* @param[in] aPosition The position to test. * @param[in] aPosition The position to test.
* @return The sheet label object if found otherwise NULL. * @return The sheet label object if found otherwise NULL.
*/ */
SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition ) const; SCH_SHEET_PIN* GetSheetPin( const VECTOR2I& aPosition ) const;
/** /**
* Clear the annotation for the symbols in \a aSheetPath on the screen. * Clear the annotation for the symbols in \a aSheetPath on the screen.
@ -417,25 +417,19 @@ public:
* @return The SCH_LINE* of the wire item found at \a aPosition or NULL if item not * @return The SCH_LINE* of the wire item found at \a aPosition or NULL if item not
* found. * found.
*/ */
SCH_LINE* GetLine( const wxPoint& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES, SCH_LINE* GetLine( const VECTOR2I& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const; SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const;
SCH_LINE* GetWire( const wxPoint& aPosition, int aAccuracy = 0, SCH_LINE* GetWire( const VECTOR2I& aPosition, int aAccuracy = 0,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
{ {
return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType ); return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType );
} }
SCH_LINE* GetBus( const wxPoint& aPosition, int aAccuracy = 0,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
{
return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
}
SCH_LINE* GetBus( const VECTOR2I& aPosition, int aAccuracy = 0, SCH_LINE* GetBus( const VECTOR2I& aPosition, int aAccuracy = 0,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
{ {
return GetLine( (wxPoint)aPosition, aAccuracy, LAYER_BUS, aSearchType ); return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
} }
/** /**
@ -446,7 +440,7 @@ public:
* @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not * @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not
* found. * found.
*/ */
SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 ) const; SCH_TEXT* GetLabel( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
/** /**
* Fetch a list of unique #LIB_SYMBOL object pointers required to properly render each * Fetch a list of unique #LIB_SYMBOL object pointers required to properly render each
@ -514,7 +508,7 @@ public:
double m_LastZoomLevel; double m_LastZoomLevel;
private: private:
bool doIsJunction( const wxPoint& aPosition, bool aBreakCrossings, bool doIsJunction( const VECTOR2I& aPosition, bool aBreakCrossings,
bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const; bool* aHasExplicitJunctionDot, bool* aHasBusEntry ) const;
private: private:

View File

@ -53,7 +53,7 @@ void SCH_SHAPE::SetStroke( const STROKE_PARAMS& aStroke )
} }
void SCH_SHAPE::Move( const wxPoint& aOffset ) void SCH_SHAPE::Move( const VECTOR2I& aOffset )
{ {
move( aOffset ); move( aOffset );
} }
@ -71,7 +71,7 @@ void SCH_SHAPE::MirrorVertically( int aCenter )
} }
void SCH_SHAPE::Rotate( const wxPoint& aCenter ) void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
{ {
rotate( aCenter, 900 ); rotate( aCenter, 900 );
} }
@ -80,7 +80,7 @@ void SCH_SHAPE::Rotate( const wxPoint& aCenter )
void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
{ {
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() ); int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
wxPoint center; VECTOR2I center;
int radius = 0; int radius = 0;
int startAngle = 0; int startAngle = 0;
int endAngle = 0; int endAngle = 0;
@ -123,7 +123,7 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
case SHAPE_T::RECT: case SHAPE_T::RECT:
{ {
std::vector<wxPoint> pts = GetRectCorners(); std::vector<VECTOR2I> pts = GetRectCorners();
aPlotter->MoveTo( pts[0] ); aPlotter->MoveTo( pts[0] );
aPlotter->LineTo( pts[1] ); aPlotter->LineTo( pts[1] );
@ -198,26 +198,26 @@ int SCH_SHAPE::GetPenWidth() const
} }
void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
int penWidth = GetPenWidth(); int penWidth = GetPenWidth();
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
wxPoint pt1 = GetStart(); VECTOR2I pt1 = GetStart();
wxPoint pt2 = GetEnd(); VECTOR2I pt2 = GetEnd();
wxPoint c; VECTOR2I c;
COLOR4D color; COLOR4D color;
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() ); penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
unsigned ptCount = 0; unsigned ptCount = 0;
wxPoint* buffer = nullptr; VECTOR2I* buffer = nullptr;
if( GetShape() == SHAPE_T::POLY ) if( GetShape() == SHAPE_T::POLY )
{ {
SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 ); SHAPE_LINE_CHAIN poly = m_poly.Outline( 0 );
ptCount = poly.GetPointCount(); ptCount = poly.GetPointCount();
buffer = new wxPoint[ ptCount ]; buffer = new VECTOR2I[ptCount];
for( unsigned ii = 0; ii < ptCount; ++ii ) for( unsigned ii = 0; ii < ptCount; ++ii )
buffer[ii] = (wxPoint) poly.CPoint( ii ); buffer[ii] = (wxPoint) poly.CPoint( ii );
@ -225,7 +225,7 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
else if( GetShape() == SHAPE_T::BEZIER ) else if( GetShape() == SHAPE_T::BEZIER )
{ {
ptCount = m_bezierPoints.size(); ptCount = m_bezierPoints.size();
buffer = new wxPoint[ ptCount ]; buffer = new VECTOR2I[ptCount];
for( size_t ii = 0; ii < ptCount; ++ii ) for( size_t ii = 0; ii < ptCount; ++ii )
buffer[ii] = m_bezierPoints[ii]; buffer[ii] = m_bezierPoints[ii];
@ -392,7 +392,7 @@ void SCH_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
} }
void SCH_SHAPE::AddPoint( const wxPoint& aPosition ) void SCH_SHAPE::AddPoint( const VECTOR2I& aPosition )
{ {
if( GetShape() == SHAPE_T::POLY ) if( GetShape() == SHAPE_T::POLY )
{ {

View File

@ -43,7 +43,7 @@ public:
return wxT( "SCH_SHAPE" ); return wxT( "SCH_SHAPE" );
} }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
{ {
return hitTest( aPosition, aAccuracy ); return hitTest( aPosition, aAccuracy );
} }
@ -71,10 +71,10 @@ public:
const EDA_RECT GetBoundingBox() const override { return getBoundingBox(); } const EDA_RECT GetBoundingBox() const override { return getBoundingBox(); }
wxPoint GetPosition() const override { return getPosition(); } VECTOR2I GetPosition() const override { return getPosition(); }
void SetPosition( const wxPoint& aPos ) override { setPosition( aPos ); } void SetPosition( const VECTOR2I& aPos ) override { setPosition( aPos ); }
wxPoint GetCenter() const { return getCenter(); } VECTOR2I GetCenter() const { return getCenter(); }
void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const; void CalcArcAngles( int& aStartAngle, int& aEndAngle ) const;
@ -84,13 +84,13 @@ public:
void EndEdit() { endEdit(); } void EndEdit() { endEdit(); }
void SetEditState( int aState ) { setEditState( aState ); } void SetEditState( int aState ) { setEditState( aState ); }
void Move( const wxPoint& aOffset ) override; void Move( const VECTOR2I& aOffset ) override;
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
void AddPoint( const wxPoint& aPosition ); void AddPoint( const VECTOR2I& aPosition );
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -109,10 +109,10 @@ public:
#endif #endif
private: private:
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
double getParentOrientation() const override { return 0.0; } double getParentOrientation() const override { return 0.0; }
wxPoint getParentPosition() const override { return wxPoint(); } VECTOR2I getParentPosition() const override { return VECTOR2I(); }
}; };

View File

@ -84,7 +84,7 @@ const wxString SCH_SHEET::GetDefaultFieldName( int aFieldNdx, bool aTranslated )
} }
SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const wxPoint& aPos, wxSize aSize, SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, wxSize aSize,
FIELDS_AUTOPLACED aAutoplaceFields ) : FIELDS_AUTOPLACED aAutoplaceFields ) :
SCH_ITEM( aParent, SCH_SHEET_T ) SCH_ITEM( aParent, SCH_SHEET_T )
{ {
@ -352,7 +352,7 @@ bool SCH_SHEET::HasPin( const wxString& aName ) const
} }
bool SCH_SHEET::doIsConnected( const wxPoint& aPosition ) const bool SCH_SHEET::doIsConnected( const VECTOR2I& aPosition ) const
{ {
for( SCH_SHEET_PIN* sheetPin : m_pins ) for( SCH_SHEET_PIN* sheetPin : m_pins )
{ {
@ -525,7 +525,7 @@ void SCH_SHEET::CleanupSheet()
} }
SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition ) SCH_SHEET_PIN* SCH_SHEET::GetPin( const VECTOR2I& aPosition )
{ {
for( SCH_SHEET_PIN* pin : m_pins ) for( SCH_SHEET_PIN* pin : m_pins )
{ {
@ -557,14 +557,14 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
if( IsVerticalOrientation() ) if( IsVerticalOrientation() )
{ {
m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( -margin, m_size.y ) ); m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( -margin, m_size.y ) );
m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::VERTICAL ); m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::VERTICAL );
} }
else else
{ {
m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( 0, -margin ) ); m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( 0, -margin ) );
m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL ); m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL );
@ -575,14 +575,14 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
if( IsVerticalOrientation() ) if( IsVerticalOrientation() )
{ {
m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( m_size.x + margin, m_size.y ) ); m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( m_size.x + margin, m_size.y ) );
m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP ); m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::VERTICAL ); m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::VERTICAL );
} }
else else
{ {
m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( 0, m_size.y + margin ) ); m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( 0, m_size.y + margin ) );
m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP ); m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL ); m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL );
@ -607,7 +607,7 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
{ {
wxPoint end; VECTOR2I end;
EDA_RECT box( m_pos, m_size ); EDA_RECT box( m_pos, m_size );
int lineWidth = GetPenWidth(); int lineWidth = GetPenWidth();
int textLength = 0; int textLength = 0;
@ -637,10 +637,10 @@ const EDA_RECT SCH_SHEET::GetBoundingBox() const
} }
wxPoint SCH_SHEET::GetRotationCenter() const VECTOR2I SCH_SHEET::GetRotationCenter() const
{ {
EDA_RECT box( m_pos, m_size ); EDA_RECT box( m_pos, m_size );
return (wxPoint)box.GetCenter(); return box.GetCenter();
} }
@ -758,7 +758,7 @@ void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
} }
void SCH_SHEET::Move( const wxPoint& aMoveVector ) void SCH_SHEET::Move( const VECTOR2I& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
@ -770,11 +770,11 @@ void SCH_SHEET::Move( const wxPoint& aMoveVector )
} }
void SCH_SHEET::Rotate( const wxPoint& aCenter ) void SCH_SHEET::Rotate( const VECTOR2I& aCenter )
{ {
wxPoint prev = m_pos; VECTOR2I prev = m_pos;
RotatePoint( &m_pos, aCenter, 900 ); RotatePoint( m_pos, aCenter, 900 );
RotatePoint( &m_size.x, &m_size.y, 900 ); RotatePoint( &m_size.x, &m_size.y, 900 );
if( m_size.x < 0 ) if( m_size.x < 0 )
@ -852,7 +852,7 @@ void SCH_SHEET::MirrorHorizontally( int aCenter )
} }
void SCH_SHEET::SetPosition( const wxPoint& aPosition ) void SCH_SHEET::SetPosition( const VECTOR2I& aPosition )
{ {
// Remember the sheet and all pin sheet positions must be // Remember the sheet and all pin sheet positions must be
// modified. So use Move function to do that. // modified. So use Move function to do that.
@ -922,9 +922,9 @@ bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
} }
std::vector<wxPoint> SCH_SHEET::GetConnectionPoints() const std::vector<VECTOR2I> SCH_SHEET::GetConnectionPoints() const
{ {
std::vector<wxPoint> retval; std::vector<VECTOR2I> retval;
for( SCH_SHEET_PIN* sheetPin : m_pins ) for( SCH_SHEET_PIN* sheetPin : m_pins )
retval.push_back( sheetPin->GetPosition() ); retval.push_back( sheetPin->GetPosition() );
@ -994,7 +994,7 @@ BITMAPS SCH_SHEET::GetMenuImage() const
} }
bool SCH_SHEET::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT rect = GetBodyBoundingBox(); EDA_RECT rect = GetBodyBoundingBox();
@ -1020,7 +1020,7 @@ bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_SHEET::Plot( PLOTTER* aPlotter ) const void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
{ {
wxString msg; wxString msg;
wxPoint pos; VECTOR2I pos;
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() ); auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
bool override = settings ? settings->m_OverrideItemColors : false; bool override = settings ? settings->m_OverrideItemColors : false;
COLOR4D borderColor = GetBorderColor(); COLOR4D borderColor = GetBorderColor();
@ -1056,10 +1056,10 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
} }
void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
wxPoint pos = m_pos + aOffset; VECTOR2I pos = m_pos + aOffset;
int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
const auto* settings = dynamic_cast<const KIGFX::SCH_RENDER_SETTINGS*>( aSettings ); const auto* settings = dynamic_cast<const KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
bool override = settings && settings->m_OverrideItemColors; bool override = settings && settings->m_OverrideItemColors;

View File

@ -54,7 +54,7 @@ enum SHEET_FIELD_TYPE
class SCH_SHEET : public SCH_ITEM class SCH_SHEET : public SCH_ITEM
{ {
public: public:
SCH_SHEET( EDA_ITEM* aParent = nullptr, const wxPoint& aPos = wxPoint( 0, 0 ), SCH_SHEET( EDA_ITEM* aParent = nullptr, const VECTOR2I& aPos = VECTOR2I( 0, 0 ),
wxSize aSize = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) ), wxSize aSize = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) ),
FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO ); FIELDS_AUTOPLACED aAutoplaceFields = FIELDS_AUTOPLACED_AUTO );
@ -212,7 +212,7 @@ public:
* *
* @return The sheet pin found at \a aPosition or NULL if no sheet pin is found. * @return The sheet pin found at \a aPosition or NULL if no sheet pin is found.
*/ */
SCH_SHEET_PIN* GetPin( const wxPoint& aPosition ); SCH_SHEET_PIN* GetPin( const VECTOR2I& aPosition );
/** /**
* Checks if the sheet already has a sheet pin named \a aName. * Checks if the sheet already has a sheet pin named \a aName.
@ -258,7 +258,7 @@ public:
int GetPenWidth() const override; int GetPenWidth() const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
/** /**
* Return a bounding box for the sheet body but not the fields. * Return a bounding box for the sheet body but not the fields.
@ -272,7 +272,7 @@ public:
* filename is longer than the edge it's on. Use this instead, which always returns * filename is longer than the edge it's on. Use this instead, which always returns
* the center of the sheet itself. * the center of the sheet itself.
*/ */
wxPoint GetRotationCenter() const; VECTOR2I GetRotationCenter() const;
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
@ -330,10 +330,10 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override; void Move( const VECTOR2I& aMoveVector ) override;
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
@ -363,7 +363,7 @@ public:
|| ( aItem->Type() == SCH_SYMBOL_T ); || ( aItem->Type() == SCH_SYMBOL_T );
} }
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
@ -379,10 +379,10 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
wxPoint GetPosition() const override { return m_pos; } VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override; void SetPosition( const VECTOR2I& aPosition ) override;
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -465,7 +465,7 @@ protected:
void renumberPins(); void renumberPins();
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override; bool doIsConnected( const VECTOR2I& aPosition ) const override;
friend class SCH_SHEET_PIN; friend class SCH_SHEET_PIN;
@ -475,7 +475,7 @@ private:
std::vector<SCH_SHEET_PIN*> m_pins; // The list of sheet connection points. std::vector<SCH_SHEET_PIN*> m_pins; // The list of sheet connection points.
std::vector<SCH_FIELD> m_fields; std::vector<SCH_FIELD> m_fields;
wxPoint m_pos; // The position of the sheet. VECTOR2I m_pos; // The position of the sheet.
wxSize m_size; // The size of the sheet. wxSize m_size; // The size of the sheet.
int m_borderWidth; int m_borderWidth;
KIGFX::COLOR4D m_borderColor; KIGFX::COLOR4D m_borderColor;

View File

@ -73,12 +73,12 @@ public:
} }
// pure virtuals: // pure virtuals:
void SetPosition( const wxPoint& ) override {} void SetPosition( const VECTOR2I& ) override {}
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {} void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override {}
void Move( const wxPoint& aMoveVector ) override {} void Move( const VECTOR2I& aMoveVector ) override {}
void MirrorHorizontally( int aCenter ) override {} void MirrorHorizontally( int aCenter ) override {}
void MirrorVertically( int aCenter ) override {} void MirrorVertically( int aCenter ) override {}
void Rotate( const wxPoint& aCenter ) override {} void Rotate( const VECTOR2I& aCenter ) override {}
#if defined(DEBUG) #if defined(DEBUG)
void Show( int , std::ostream& ) const override {} void Show( int , std::ostream& ) const override {}

View File

@ -38,7 +38,7 @@
#include <trigo.h> #include <trigo.h>
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxString& text ) : SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const VECTOR2I& pos, const wxString& text ) :
SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ), SCH_HIERLABEL( pos, text, SCH_SHEET_PIN_T ),
m_edge( SHEET_SIDE::UNDEFINED ) m_edge( SHEET_SIDE::UNDEFINED )
{ {
@ -65,7 +65,7 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
} }
void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print // The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
SCH_HIERLABEL::Print( aSettings, aOffset ); SCH_HIERLABEL::Print( aSettings, aOffset );
@ -156,7 +156,7 @@ enum SHEET_SIDE SCH_SHEET_PIN::GetSide() const
} }
void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos ) void SCH_SHEET_PIN::ConstrainOnEdge( VECTOR2I Pos )
{ {
SCH_SHEET* sheet = GetParent(); SCH_SHEET* sheet = GetParent();
@ -247,7 +247,7 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
} }
void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter ) void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
{ {
VECTOR2I pt = GetTextPos(); VECTOR2I pt = GetTextPos();
VECTOR2I delta = pt - aCenter; VECTOR2I delta = pt - aCenter;
@ -300,7 +300,7 @@ void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings, void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) const std::vector<VECTOR2I>& aPoints, const VECTOR2I& aPos ) const
{ {
/* /*
* These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly * These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly
@ -340,7 +340,7 @@ BITMAPS SCH_SHEET_PIN::GetMenuImage() const
} }
bool SCH_SHEET_PIN::HitTest( const wxPoint& aPoint, int aAccuracy ) const bool SCH_SHEET_PIN::HitTest( const VECTOR2I& aPoint, int aAccuracy ) const
{ {
EDA_RECT rect = GetBoundingBox(); EDA_RECT rect = GetBoundingBox();

View File

@ -65,7 +65,7 @@ enum class SHEET_SIDE
class SCH_SHEET_PIN : public SCH_HIERLABEL class SCH_SHEET_PIN : public SCH_HIERLABEL
{ {
public: public:
SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos = wxPoint( 0, 0 ), SCH_SHEET_PIN( SCH_SHEET* parent, const VECTOR2I& pos = VECTOR2I( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -104,7 +104,7 @@ public:
*/ */
bool IsMovableFromAnchorPoint() const override { return true; } bool IsMovableFromAnchorPoint() const override { return true; }
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
/** /**
* Calculate the graphic shape (a polygon) associated to the text. * Calculate the graphic shape (a polygon) associated to the text.
@ -112,8 +112,8 @@ public:
* @param aPoints is a buffer to fill with polygon corners coordinates. * @param aPoints is a buffer to fill with polygon corners coordinates.
* @param aPos is the position of the shape. * @param aPos is the position of the shape.
*/ */
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
std::vector <wxPoint>& aPoints, const wxPoint& aPos ) const override; const VECTOR2I& aPos ) const override;
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
@ -141,7 +141,7 @@ public:
* Adjust label position to edge based on proximity to vertical or horizontal edge * Adjust label position to edge based on proximity to vertical or horizontal edge
* of the parent sheet. * of the parent sheet.
*/ */
void ConstrainOnEdge( wxPoint Pos ); void ConstrainOnEdge( VECTOR2I Pos );
/** /**
* Get the parent sheet object of this sheet pin. * Get the parent sheet object of this sheet pin.
@ -157,14 +157,14 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
Offset( aMoveVector ); Offset( aMoveVector );
} }
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
{ {
@ -186,14 +186,14 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
void SetPosition( const wxPoint& aPosition ) override { ConstrainOnEdge( aPosition ); } void SetPosition( const VECTOR2I& aPosition ) override { ConstrainOnEdge( aPosition ); }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{ {
return m_isDangling && GetPosition() == aPos; return m_isDangling && GetPosition() == aPos;
} }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;

View File

@ -191,7 +191,7 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
} }
void SCH_SYMBOL::Init( const wxPoint& pos ) void SCH_SYMBOL::Init( const VECTOR2I& pos )
{ {
m_pos = pos; m_pos = pos;
m_unit = 1; // In multi unit chip - which unit to draw. m_unit = 1; // In multi unit chip - which unit to draw.
@ -381,7 +381,7 @@ int SCH_SYMBOL::GetUnitCount() const
} }
void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
LIB_SYMBOL_OPTIONS opts; LIB_SYMBOL_OPTIONS opts;
opts.transform = m_transform; opts.transform = m_transform;
@ -1484,11 +1484,11 @@ void SCH_SYMBOL::MirrorVertically( int aCenter )
} }
void SCH_SYMBOL::Rotate( const wxPoint& aCenter ) void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter )
{ {
wxPoint prev = m_pos; VECTOR2I prev = m_pos;
RotatePoint( &m_pos, aCenter, 900 ); RotatePoint( m_pos, aCenter, 900 );
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE ); SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
@ -1537,7 +1537,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
bool previousState = pin->IsDangling(); bool previousState = pin->IsDangling();
pin->SetIsDangling( true ); pin->SetIsDangling( true );
wxPoint pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos; VECTOR2I pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos;
for( DANGLING_END_ITEM& each_item : aItemList ) for( DANGLING_END_ITEM& each_item : aItemList )
{ {
@ -1577,7 +1577,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
} }
wxPoint SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
{ {
wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ), wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
wxT( "Cannot get physical position of pin." ) ); wxT( "Cannot get physical position of pin." ) );
@ -1586,9 +1586,9 @@ wxPoint SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
} }
std::vector<wxPoint> SCH_SYMBOL::GetConnectionPoints() const std::vector<VECTOR2I> SCH_SYMBOL::GetConnectionPoints() const
{ {
std::vector<wxPoint> retval; std::vector<VECTOR2I> retval;
for( const std::unique_ptr<SCH_PIN>& pin : m_pins ) for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{ {
@ -1610,12 +1610,12 @@ std::vector<wxPoint> SCH_SYMBOL::GetConnectionPoints() const
} }
LIB_ITEM* SCH_SYMBOL::GetDrawItem( const wxPoint& aPosition, KICAD_T aType ) LIB_ITEM* SCH_SYMBOL::GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType )
{ {
if( m_part ) if( m_part )
{ {
// Calculate the position relative to the symbol. // Calculate the position relative to the symbol.
wxPoint libPosition = aPosition - m_pos; VECTOR2I libPosition = aPosition - m_pos;
return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform ); return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
} }
@ -1786,7 +1786,7 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
} }
bool SCH_SYMBOL::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_SYMBOL::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT bBox = GetBodyBoundingBox(); EDA_RECT bBox = GetBodyBoundingBox();
bBox.Inflate( aAccuracy / 2 ); bBox.Inflate( aAccuracy / 2 );
@ -1814,9 +1814,9 @@ bool SCH_SYMBOL::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
} }
bool SCH_SYMBOL::doIsConnected( const wxPoint& aPosition ) const bool SCH_SYMBOL::doIsConnected( const VECTOR2I& aPosition ) const
{ {
wxPoint new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos ); VECTOR2I new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos );
for( const auto& pin : m_pins ) for( const auto& pin : m_pins )
{ {
@ -1884,7 +1884,7 @@ void SCH_SYMBOL::ClearBrightenedPins()
} }
bool SCH_SYMBOL::IsPointClickableAnchor( const wxPoint& aPos ) const bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const
{ {
for( const std::unique_ptr<SCH_PIN>& pin : m_pins ) for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{ {

View File

@ -476,7 +476,7 @@ public:
* @param aOffset is the drawing offset (usually wxPoint(0,0), but can be different when * @param aOffset is the drawing offset (usually wxPoint(0,0), but can be different when
* moving an object) * moving an object)
*/ */
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
@ -561,7 +561,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
if( aMoveVector == wxPoint( 0, 0 ) ) if( aMoveVector == wxPoint( 0, 0 ) )
return; return;
@ -576,7 +576,7 @@ public:
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override; bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
@ -595,7 +595,7 @@ public:
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList, bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
const SCH_SHEET_PATH* aPath = nullptr ) override; const SCH_SHEET_PATH* aPath = nullptr ) override;
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const; VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
bool IsConnectable() const override { return true; } bool IsConnectable() const override { return true; }
@ -616,7 +616,7 @@ public:
*/ */
bool IsInNetlist() const; bool IsInNetlist() const;
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
@ -627,7 +627,7 @@ public:
* @param aType is the type of symbol library object to find or any if set to TYPE_NOT_INIT. * @param aType is the type of symbol library object to find or any if set to TYPE_NOT_INIT.
* @return is the symbol library object if found otherwise NULL. * @return is the symbol library object if found otherwise NULL.
*/ */
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT ); LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -642,10 +642,10 @@ public:
bool IsReplaceable() const override { return true; } bool IsReplaceable() const override { return true; }
wxPoint GetPosition() const override { return m_pos; } VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); } void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -666,16 +666,16 @@ public:
bool GetIncludeOnBoard() const { return m_onBoard; } bool GetIncludeOnBoard() const { return m_onBoard; }
void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; } void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override; bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
private: private:
EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const; EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
bool doIsConnected( const wxPoint& aPosition ) const override; bool doIsConnected( const VECTOR2I& aPosition ) const override;
void Init( const wxPoint& pos = wxPoint( 0, 0 ) ); void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
wxPoint m_pos; VECTOR2I m_pos;
LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00. LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00.
int m_unit; ///< The unit for multiple part per package symbols. int m_unit; ///< The unit for multiple part per package symbols.
int m_convert; ///< The alternate body style for symbols that have more than int m_convert; ///< The alternate body style for symbols that have more than

View File

@ -212,7 +212,7 @@ LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorY()
} }
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : SCH_TEXT::SCH_TEXT( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) :
SCH_ITEM( nullptr, aType ), SCH_ITEM( nullptr, aType ),
EDA_TEXT( text ) EDA_TEXT( text )
{ {
@ -243,9 +243,9 @@ bool SCH_TEXT::IncrementLabel( int aIncrement )
} }
wxPoint SCH_TEXT::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const VECTOR2I SCH_TEXT::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const
{ {
wxPoint text_offset; VECTOR2I text_offset;
// add an offset to x (or y) position to aid readability of text on a wire or line // add an offset to x (or y) position to aid readability of text on a wire or line
int dist = GetTextOffset( aSettings ) + GetPenWidth(); int dist = GetTextOffset( aSettings ) + GetPenWidth();
@ -281,7 +281,7 @@ void SCH_TEXT::MirrorVertically( int aCenter )
} }
void SCH_TEXT::Rotate( const wxPoint& aCenter ) void SCH_TEXT::Rotate( const VECTOR2I& aCenter )
{ {
VECTOR2I pt = GetTextPos(); VECTOR2I pt = GetTextPos();
RotatePoint( pt, aCenter, 900 ); RotatePoint( pt, aCenter, 900 );
@ -404,10 +404,10 @@ int SCH_TEXT::GetPenWidth() const
} }
void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
COLOR4D color = aSettings->GetLayerColor( m_layer ); COLOR4D color = aSettings->GetLayerColor( m_layer );
wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings ); VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
EDA_TEXT::Print( aSettings, text_offset, color ); EDA_TEXT::Print( aSettings, text_offset, color );
} }
@ -509,7 +509,7 @@ BITMAPS SCH_TEXT::GetMenuImage() const
} }
bool SCH_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_TEXT::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT bBox = GetBoundingBox(); EDA_RECT bBox = GetBoundingBox();
bBox.Inflate( aAccuracy ); bBox.Inflate( aAccuracy );
@ -539,7 +539,7 @@ void SCH_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
void SCH_TEXT::Plot( PLOTTER* aPlotter ) const void SCH_TEXT::Plot( PLOTTER* aPlotter ) const
{ {
static std::vector<wxPoint> s_poly; static std::vector<VECTOR2I> s_poly;
RENDER_SETTINGS* settings = aPlotter->RenderSettings(); RENDER_SETTINGS* settings = aPlotter->RenderSettings();
SCH_CONNECTION* connection = Connection(); SCH_CONNECTION* connection = Connection();
@ -550,7 +550,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) const
penWidth = std::max( penWidth, settings->GetMinPenWidth() ); penWidth = std::max( penWidth, settings->GetMinPenWidth() );
aPlotter->SetCurrentLineWidth( penWidth ); aPlotter->SetCurrentLineWidth( penWidth );
std::vector<wxPoint> positions; std::vector<VECTOR2I> positions;
wxArrayString strings_list; wxArrayString strings_list;
wxStringSplit( GetShownText(), strings_list, '\n' ); wxStringSplit( GetShownText(), strings_list, '\n' );
positions.reserve( strings_list.Count() ); positions.reserve( strings_list.Count() );
@ -559,7 +559,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) const
for( unsigned ii = 0; ii < strings_list.Count(); ii++ ) for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{ {
wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() ); VECTOR2I textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() );
wxString& txt = strings_list.Item( ii ); wxString& txt = strings_list.Item( ii );
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(), aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), IsBold() ); GetVertJustify(), penWidth, IsItalic(), IsBold() );
@ -611,7 +611,7 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
#endif #endif
SCH_LABEL_BASE::SCH_LABEL_BASE( const wxPoint& aPos, const wxString& aText, KICAD_T aType ) : SCH_LABEL_BASE::SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType ) :
SCH_TEXT( aPos, aText, aType ), SCH_TEXT( aPos, aText, aType ),
m_shape( L_UNSPECIFIED ), m_shape( L_UNSPECIFIED ),
m_connectionType( CONNECTION_TYPE::NONE ), m_connectionType( CONNECTION_TYPE::NONE ),
@ -726,7 +726,7 @@ void SCH_LABEL_BASE::SwapData( SCH_ITEM* aItem )
} }
void SCH_LABEL_BASE::Rotate( const wxPoint& aCenter ) void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter )
{ {
VECTOR2I pt = GetTextPos(); VECTOR2I pt = GetTextPos();
RotatePoint( pt, aCenter, 900 ); RotatePoint( pt, aCenter, 900 );
@ -805,7 +805,7 @@ void SCH_LABEL_BASE::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
for( SCH_FIELD& field : m_fields ) for( SCH_FIELD& field : m_fields )
{ {
wxPoint offset( 0, 0 ); VECTOR2I offset( 0, 0 );
switch( GetLabelSpinStyle() ) switch( GetLabelSpinStyle() )
{ {
@ -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 ) void SCH_LABEL_BASE::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
{ {
DANGLING_END_ITEM item( LABEL_END, this, (wxPoint)GetTextPos() ); DANGLING_END_ITEM item( LABEL_END, this, GetTextPos() );
aItemList.push_back( item ); aItemList.push_back( item );
} }
std::vector<wxPoint> SCH_LABEL_BASE::GetConnectionPoints() const std::vector<VECTOR2I> SCH_LABEL_BASE::GetConnectionPoints() const
{ {
return { (wxPoint)GetTextPos() }; return { GetTextPos() };
} }
@ -1011,11 +1011,11 @@ const EDA_RECT SCH_LABEL_BASE::GetBodyBoundingBox() const
// build the bounding box of the label only, without taking into account its fields // build the bounding box of the label only, without taking into account its fields
EDA_RECT box; EDA_RECT box;
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
CreateGraphicShape( nullptr, pts, (wxPoint)GetTextPos() ); CreateGraphicShape( nullptr, pts, GetTextPos() );
for( const wxPoint& pt : pts ) for( const VECTOR2I& pt : pts )
box.Merge( pt ); box.Merge( pt );
box.Inflate( GetEffectiveTextPenWidth() / 2 ); box.Inflate( GetEffectiveTextPenWidth() / 2 );
@ -1040,7 +1040,7 @@ const EDA_RECT SCH_LABEL_BASE::GetBoundingBox() const
} }
bool SCH_LABEL_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const bool SCH_LABEL_BASE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{ {
EDA_RECT bbox = GetBodyBoundingBox(); EDA_RECT bbox = GetBodyBoundingBox();
bbox.Inflate( aAccuracy ); bbox.Inflate( aAccuracy );
@ -1230,7 +1230,7 @@ void SCH_LABEL_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
{ {
static std::vector<wxPoint> s_poly; static std::vector<VECTOR2I> s_poly;
RENDER_SETTINGS* settings = aPlotter->RenderSettings(); RENDER_SETTINGS* settings = aPlotter->RenderSettings();
SCH_CONNECTION* connection = Connection(); SCH_CONNECTION* connection = Connection();
@ -1246,27 +1246,27 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter ) const
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(), aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() ); GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
CreateGraphicShape( aPlotter->RenderSettings(), s_poly, (wxPoint)GetTextPos() ); CreateGraphicShape( aPlotter->RenderSettings(), s_poly, GetTextPos() );
if( s_poly.size() ) if( s_poly.size() )
aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth ); aPlotter->PlotPoly( s_poly, FILL_T::NO_FILL, penWidth );
} }
void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{ {
static std::vector<wxPoint> s_poly; static std::vector<VECTOR2I> s_poly;
SCH_CONNECTION* connection = Connection(); SCH_CONNECTION* connection = Connection();
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer; int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
wxDC* DC = aSettings->GetPrintDC(); wxDC* DC = aSettings->GetPrintDC();
COLOR4D color = aSettings->GetLayerColor( layer ); COLOR4D color = aSettings->GetLayerColor( layer );
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() ); int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings ); VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
EDA_TEXT::Print( aSettings, text_offset, color ); EDA_TEXT::Print( aSettings, text_offset, color );
CreateGraphicShape( aSettings, s_poly, (wxPoint)GetTextPos() + aOffset ); CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
if( !s_poly.empty() ) if( !s_poly.empty() )
GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color ); GRPoly( nullptr, DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
@ -1276,7 +1276,7 @@ void SCH_LABEL_BASE::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOf
} }
SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) : SCH_LABEL::SCH_LABEL( const VECTOR2I& pos, const wxString& text ) :
SCH_LABEL_BASE( pos, text, SCH_LABEL_T ) SCH_LABEL_BASE( pos, text, SCH_LABEL_T )
{ {
m_layer = LAYER_LOCLABEL; m_layer = LAYER_LOCLABEL;
@ -1325,7 +1325,7 @@ BITMAPS SCH_LABEL::GetMenuImage() const
} }
SCH_NETCLASS_FLAG::SCH_NETCLASS_FLAG( const wxPoint& pos ) : SCH_NETCLASS_FLAG::SCH_NETCLASS_FLAG( const VECTOR2I& pos ) :
SCH_LABEL_BASE( pos, wxEmptyString, SCH_NETCLASS_FLAG_T ) SCH_LABEL_BASE( pos, wxEmptyString, SCH_NETCLASS_FLAG_T )
{ {
m_layer = LAYER_NETCLASS_REFS; m_layer = LAYER_NETCLASS_REFS;
@ -1351,8 +1351,8 @@ SCH_NETCLASS_FLAG::SCH_NETCLASS_FLAG( const SCH_NETCLASS_FLAG& aClassLabel ) :
void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<wxPoint>& aPoints, std::vector<VECTOR2I>& aPoints,
const wxPoint& aPos ) const const VECTOR2I& aPos ) const
{ {
int symbolSize = m_symbolSize; int symbolSize = m_symbolSize;
@ -1366,36 +1366,36 @@ void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettin
case LABEL_FLAG_SHAPE::F_ROUND: case LABEL_FLAG_SHAPE::F_ROUND:
// First 3 points are used for generating shape // First 3 points are used for generating shape
aPoints.emplace_back( wxPoint( 0, 0 ) ); aPoints.emplace_back( VECTOR2I( 0, 0 ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength ) );
// These points are just used to bulk out the bounding box // These points are just used to bulk out the bounding box
aPoints.emplace_back( wxPoint( -m_symbolSize, m_pinLength ) ); aPoints.emplace_back( VECTOR2I( -m_symbolSize, m_pinLength ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength ) );
aPoints.emplace_back( wxPoint( m_symbolSize, m_pinLength + symbolSize ) ); aPoints.emplace_back( VECTOR2I( m_symbolSize, m_pinLength + symbolSize ) );
break; break;
case LABEL_FLAG_SHAPE::F_DIAMOND: case LABEL_FLAG_SHAPE::F_DIAMOND:
aPoints.emplace_back( wxPoint( 0, 0 ) ); aPoints.emplace_back( VECTOR2I( 0, 0 ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( -2 * m_symbolSize, m_pinLength ) ); aPoints.emplace_back( VECTOR2I( -2 * m_symbolSize, m_pinLength ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength + symbolSize ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength + symbolSize ) );
aPoints.emplace_back( wxPoint( 2 * m_symbolSize, m_pinLength ) ); aPoints.emplace_back( VECTOR2I( 2 * m_symbolSize, m_pinLength ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( 0, 0 ) ); aPoints.emplace_back( VECTOR2I( 0, 0 ) );
break; break;
case LABEL_FLAG_SHAPE::F_RECTANGLE: case LABEL_FLAG_SHAPE::F_RECTANGLE:
symbolSize = KiROUND( symbolSize * 0.8 ); symbolSize = KiROUND( symbolSize * 0.8 );
aPoints.emplace_back( wxPoint( 0, 0 ) ); aPoints.emplace_back( VECTOR2I( 0, 0 ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( -2 * symbolSize, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( -2 * symbolSize, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( -2 * symbolSize, m_pinLength + symbolSize ) ); aPoints.emplace_back( VECTOR2I( -2 * symbolSize, m_pinLength + symbolSize ) );
aPoints.emplace_back( wxPoint( 2 * symbolSize, m_pinLength + symbolSize ) ); aPoints.emplace_back( VECTOR2I( 2 * symbolSize, m_pinLength + symbolSize ) );
aPoints.emplace_back( wxPoint( 2 * symbolSize, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( 2 * symbolSize, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( 0, m_pinLength - symbolSize ) ); aPoints.emplace_back( VECTOR2I( 0, m_pinLength - symbolSize ) );
aPoints.emplace_back( wxPoint( 0, 0 ) ); aPoints.emplace_back( VECTOR2I( 0, 0 ) );
break; break;
default: default:
@ -1403,15 +1403,15 @@ void SCH_NETCLASS_FLAG::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettin
} }
// Rotate outlines and move corners to real position // Rotate outlines and move corners to real position
for( wxPoint& aPoint : aPoints ) for( VECTOR2I& aPoint : aPoints )
{ {
switch( GetLabelSpinStyle() ) switch( GetLabelSpinStyle() )
{ {
default: default:
case LABEL_SPIN_STYLE::LEFT: break; case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::UP: RotatePoint( &aPoint, -900 ); break; case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -900 ); break;
case LABEL_SPIN_STYLE::RIGHT: RotatePoint( &aPoint, 1800 ); break; case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, 1800 ); break;
case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( &aPoint, 900 ); break; case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, 900 ); break;
} }
aPoint += aPos; aPoint += aPos;
@ -1431,7 +1431,7 @@ void SCH_NETCLASS_FLAG::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
if( IsItalic() ) if( IsItalic() )
margin = KiROUND( margin * 1.5 ); margin = KiROUND( margin * 1.5 );
wxPoint offset; VECTOR2I offset;
for( SCH_FIELD& field : m_fields ) for( SCH_FIELD& field : m_fields )
{ {
@ -1475,7 +1475,7 @@ wxString SCH_NETCLASS_FLAG::GetSelectMenuText( EDA_UNITS aUnits ) const
} }
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : SCH_GLOBALLABEL::SCH_GLOBALLABEL( const VECTOR2I& pos, const wxString& text ) :
SCH_LABEL_BASE( pos, text, SCH_GLOBAL_LABEL_T ) SCH_LABEL_BASE( pos, text, SCH_GLOBAL_LABEL_T )
{ {
m_layer = LAYER_GLOBLABEL; m_layer = LAYER_GLOBLABEL;
@ -1498,7 +1498,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel ) :
} }
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const VECTOR2I SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const
{ {
int horiz = GetLabelBoxExpansion( aSettings ); int horiz = GetLabelBoxExpansion( aSettings );
@ -1522,10 +1522,10 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSetting
switch( GetLabelSpinStyle() ) switch( GetLabelSpinStyle() )
{ {
default: default:
case LABEL_SPIN_STYLE::LEFT: return wxPoint( -horiz, vert ); case LABEL_SPIN_STYLE::LEFT: return VECTOR2I( -horiz, vert );
case LABEL_SPIN_STYLE::UP: return wxPoint( vert, -horiz ); case LABEL_SPIN_STYLE::UP: return VECTOR2I( vert, -horiz );
case LABEL_SPIN_STYLE::RIGHT: return wxPoint( horiz, vert ); case LABEL_SPIN_STYLE::RIGHT: return VECTOR2I( horiz, vert );
case LABEL_SPIN_STYLE::BOTTOM: return wxPoint( vert, horiz ); case LABEL_SPIN_STYLE::BOTTOM: return VECTOR2I( vert, horiz );
} }
} }
@ -1581,7 +1581,7 @@ void SCH_GLOBALLABEL::MirrorHorizontally( int aCenter )
VECTOR2I delta = old_pos - pos; VECTOR2I delta = old_pos - pos;
pos.x = GetPosition().x + delta.x; pos.x = GetPosition().x + delta.x;
field.SetPosition( (wxPoint)pos ); field.SetPosition( pos );
} }
} }
@ -1597,7 +1597,7 @@ void SCH_GLOBALLABEL::MirrorVertically( int aCenter )
VECTOR2I delta = old_pos - pos; VECTOR2I delta = old_pos - pos;
pos.y = GetPosition().y + delta.y; pos.y = GetPosition().y + delta.y;
field.SetPosition( (wxPoint)pos ); field.SetPosition( pos );
} }
} }
@ -1667,8 +1667,8 @@ void SCH_GLOBALLABEL::ViewGetLayers( int aLayers[], int& aCount ) const
void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<wxPoint>& aPoints, std::vector<VECTOR2I>& aPoints,
const wxPoint& aPos ) const const VECTOR2I& aPos ) const
{ {
int margin = GetLabelBoxExpansion( aRenderSettings ); int margin = GetLabelBoxExpansion( aRenderSettings );
int halfSize = ( GetTextHeight() / 2 ) + margin; int halfSize = ( GetTextHeight() / 2 ) + margin;
@ -1681,12 +1681,12 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
aPoints.clear(); aPoints.clear();
// Create outline shape : 6 points // Create outline shape : 6 points
aPoints.emplace_back( wxPoint( 0, 0 ) ); aPoints.emplace_back( VECTOR2I( 0, 0 ) );
aPoints.emplace_back( wxPoint( 0, -y ) ); // Up aPoints.emplace_back( VECTOR2I( 0, -y ) ); // Up
aPoints.emplace_back( wxPoint( -x, -y ) ); // left aPoints.emplace_back( VECTOR2I( -x, -y ) ); // left
aPoints.emplace_back( wxPoint( -x, 0 ) ); // Up left aPoints.emplace_back( VECTOR2I( -x, 0 ) ); // Up left
aPoints.emplace_back( wxPoint( -x, y ) ); // left down aPoints.emplace_back( VECTOR2I( -x, y ) ); // left down
aPoints.emplace_back( wxPoint( 0, y ) ); // down aPoints.emplace_back( VECTOR2I( 0, y ) ); // down
int x_offset = 0; int x_offset = 0;
@ -1714,7 +1714,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
} }
// Rotate outlines and move corners in real position // Rotate outlines and move corners in real position
for( wxPoint& aPoint : aPoints ) for( VECTOR2I& aPoint : aPoints )
{ {
aPoint.x += x_offset; aPoint.x += x_offset;
@ -1722,9 +1722,9 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
{ {
default: default:
case LABEL_SPIN_STYLE::LEFT: break; case LABEL_SPIN_STYLE::LEFT: break;
case LABEL_SPIN_STYLE::UP: RotatePoint( &aPoint, -900 ); break; case LABEL_SPIN_STYLE::UP: RotatePoint( aPoint, -900 ); break;
case LABEL_SPIN_STYLE::RIGHT: RotatePoint( &aPoint, 1800 ); break; case LABEL_SPIN_STYLE::RIGHT: RotatePoint( aPoint, 1800 ); break;
case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( &aPoint, 900 ); break; case LABEL_SPIN_STYLE::BOTTOM: RotatePoint( aPoint, 900 ); break;
} }
aPoint += aPos; aPoint += aPos;
@ -1746,7 +1746,7 @@ BITMAPS SCH_GLOBALLABEL::GetMenuImage() const
} }
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType ) : SCH_HIERLABEL::SCH_HIERLABEL( const VECTOR2I& pos, const wxString& text, KICAD_T aType ) :
SCH_LABEL_BASE( pos, text, aType ) SCH_LABEL_BASE( pos, text, aType )
{ {
m_layer = LAYER_HIERLABEL; m_layer = LAYER_HIERLABEL;
@ -1763,14 +1763,14 @@ void SCH_HIERLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) const std::vector<VECTOR2I>& aPoints, const VECTOR2I& aPos ) const
{ {
CreateGraphicShape( aSettings, aPoints, aPos, m_shape ); CreateGraphicShape( aSettings, aPoints, aPos, m_shape );
} }
void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos, std::vector<VECTOR2I>& aPoints, const VECTOR2I& aPos,
LABEL_FLAG_SHAPE aShape ) const LABEL_FLAG_SHAPE aShape ) const
{ {
int* Template = TemplateShape[static_cast<int>( aShape )][static_cast<int>( m_spin_style )]; int* Template = TemplateShape[static_cast<int>( aShape )][static_cast<int>( m_spin_style )];
@ -1782,7 +1782,7 @@ void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
for( int ii = 0; ii < imax; ii++ ) for( int ii = 0; ii < imax; ii++ )
{ {
wxPoint corner; VECTOR2I corner;
corner.x = ( halfSize * (*Template) ) + aPos.x; corner.x = ( halfSize * (*Template) ) + aPos.x;
Template++; Template++;
@ -1840,15 +1840,15 @@ const EDA_RECT SCH_HIERLABEL::GetBodyBoundingBox() const
break; break;
} }
EDA_RECT box( wxPoint( x, y ), wxSize( dx, dy ) ); EDA_RECT box( VECTOR2I( x, y ), VECTOR2I( dx, dy ) );
box.Normalize(); box.Normalize();
return box; return box;
} }
wxPoint SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const VECTOR2I SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const
{ {
wxPoint text_offset; VECTOR2I text_offset;
int dist = GetTextOffset( aSettings ); int dist = GetTextOffset( aSettings );
dist += GetTextWidth(); dist += GetTextWidth();

View File

@ -114,7 +114,7 @@ extern const char* SheetLabelType[]; /* names of types of labels */
class SCH_TEXT : public SCH_ITEM, public EDA_TEXT class SCH_TEXT : public SCH_ITEM, public EDA_TEXT
{ {
public: public:
SCH_TEXT( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, SCH_TEXT( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
KICAD_T aType = SCH_TEXT_T ); KICAD_T aType = SCH_TEXT_T );
SCH_TEXT( const SCH_TEXT& aText ); SCH_TEXT( const SCH_TEXT& aText );
@ -159,9 +159,9 @@ public:
* *
* @return the offset between the SCH_TEXT position and the text itself position * @return the offset between the SCH_TEXT position and the text itself position
*/ */
virtual wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const; virtual VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
void SwapData( SCH_ITEM* aItem ) override; void SwapData( SCH_ITEM* aItem ) override;
@ -173,14 +173,14 @@ public:
int GetPenWidth() const override; int GetPenWidth() const override;
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
EDA_TEXT::Offset( aMoveVector ); EDA_TEXT::Offset( aMoveVector );
} }
void MirrorHorizontally( int aCenter ) override; void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override; void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
virtual void Rotate90( bool aClockwise ); virtual void Rotate90( bool aClockwise );
virtual void MirrorSpinStyle( bool aLeftRight ); virtual void MirrorSpinStyle( bool aLeftRight );
@ -203,10 +203,10 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
wxPoint GetPosition() const override { return (wxPoint)EDA_TEXT::GetTextPos(); } VECTOR2I GetPosition() const override { return EDA_TEXT::GetTextPos(); }
void SetPosition( const wxPoint& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); } void SetPosition( const VECTOR2I& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
@ -242,7 +242,7 @@ protected:
class SCH_LABEL_BASE : public SCH_TEXT class SCH_LABEL_BASE : public SCH_TEXT
{ {
public: public:
SCH_LABEL_BASE( const wxPoint& aPos, const wxString& aText, KICAD_T aType ); SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType );
SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel ); SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel );
@ -273,7 +273,7 @@ public:
m_fields = aFields; // vector copying, length is changed possibly m_fields = aFields; // vector copying, length is changed possibly
} }
void Move( const wxPoint& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
SCH_TEXT::Move( aMoveVector ); SCH_TEXT::Move( aMoveVector );
@ -281,7 +281,7 @@ public:
field.Offset( aMoveVector ); field.Offset( aMoveVector );
} }
void Rotate( const wxPoint& aCenter ) override; void Rotate( const VECTOR2I& aCenter ) override;
void Rotate90( bool aClockwise ) override; void Rotate90( bool aClockwise ) override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override; void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
@ -301,7 +301,7 @@ public:
* @param Pos Position of the shape, for texts and labels: do nothing * @param Pos Position of the shape, for texts and labels: do nothing
*/ */
virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings, virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& Pos ) const std::vector<VECTOR2I>& aPoints, const VECTOR2I& Pos ) const
{ {
aPoints.clear(); aPoints.clear();
} }
@ -318,10 +318,10 @@ public:
*/ */
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
std::vector<wxPoint> GetConnectionPoints() const override; std::vector<VECTOR2I> GetConnectionPoints() const override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override; void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
@ -337,7 +337,7 @@ public:
void Plot( PLOTTER* aPlotter ) const override; void Plot( PLOTTER* aPlotter ) const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) override; void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
protected: protected:
std::vector<SCH_FIELD> m_fields; std::vector<SCH_FIELD> m_fields;
@ -352,7 +352,7 @@ protected:
class SCH_LABEL : public SCH_LABEL_BASE class SCH_LABEL : public SCH_LABEL_BASE
{ {
public: public:
SCH_LABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString ); SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -389,13 +389,13 @@ public:
return new SCH_LABEL( *this ); return new SCH_LABEL( *this );
} }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{ {
return m_isDangling && GetPosition() == aPos; return m_isDangling && GetPosition() == aPos;
} }
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override bool doIsConnected( const VECTOR2I& aPosition ) const override
{ {
return EDA_TEXT::GetTextPos() == aPosition; return EDA_TEXT::GetTextPos() == aPosition;
} }
@ -405,7 +405,7 @@ private:
class SCH_NETCLASS_FLAG : public SCH_LABEL_BASE class SCH_NETCLASS_FLAG : public SCH_LABEL_BASE
{ {
public: public:
SCH_NETCLASS_FLAG( const wxPoint& aPos = wxPoint( 0, 0 ) ); SCH_NETCLASS_FLAG( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
SCH_NETCLASS_FLAG( const SCH_NETCLASS_FLAG& aClassLabel ); SCH_NETCLASS_FLAG( const SCH_NETCLASS_FLAG& aClassLabel );
@ -429,8 +429,8 @@ public:
int GetPinLength() const { return m_pinLength; } int GetPinLength() const { return m_pinLength; }
void SetPinLength( int aLength ) { m_pinLength = aLength; } void SetPinLength( int aLength ) { m_pinLength = aLength; }
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<wxPoint>& aPoints, void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
const wxPoint& aPos ) const override; const VECTOR2I& aPos ) const override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override; void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
@ -453,7 +453,7 @@ private:
class SCH_GLOBALLABEL : public SCH_LABEL_BASE class SCH_GLOBALLABEL : public SCH_LABEL_BASE
{ {
public: public:
SCH_GLOBALLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString ); SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel ); SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
@ -483,10 +483,10 @@ public:
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override; void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) const override; const VECTOR2I& aPos ) const override;
bool ResolveTextVar( wxString* token, int aDepth ) const override; bool ResolveTextVar( wxString* token, int aDepth ) const override;
@ -504,13 +504,13 @@ public:
BITMAPS GetMenuImage() const override; BITMAPS GetMenuImage() const override;
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{ {
return m_isDangling && GetPosition() == aPos; return m_isDangling && GetPosition() == aPos;
} }
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override bool doIsConnected( const VECTOR2I& aPosition ) const override
{ {
return EDA_TEXT::GetTextPos() == aPosition; return EDA_TEXT::GetTextPos() == aPosition;
} }
@ -520,7 +520,7 @@ private:
class SCH_HIERLABEL : public SCH_LABEL_BASE class SCH_HIERLABEL : public SCH_LABEL_BASE
{ {
public: public:
SCH_HIERLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString, SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
KICAD_T aType = SCH_HIER_LABEL_T ); KICAD_T aType = SCH_HIER_LABEL_T );
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
@ -539,12 +539,12 @@ public:
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override; void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override; VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<wxPoint>& aPoints, void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
const wxPoint& aPos ) const override; const VECTOR2I& aPos ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<wxPoint>& aPoints, void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
const wxPoint& aPos, LABEL_FLAG_SHAPE aShape ) const; const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
const EDA_RECT GetBodyBoundingBox() const override; const EDA_RECT GetBodyBoundingBox() const override;
@ -565,13 +565,13 @@ public:
return new SCH_HIERLABEL( *this ); return new SCH_HIERLABEL( *this );
} }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{ {
return m_isDangling && GetPosition() == aPos; return m_isDangling && GetPosition() == aPos;
} }
private: private:
bool doIsConnected( const wxPoint& aPosition ) const override bool doIsConnected( const VECTOR2I& aPosition ) const override
{ {
return EDA_TEXT::GetTextPos() == aPosition; return EDA_TEXT::GetTextPos() == aPosition;
} }

View File

@ -1313,7 +1313,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
for( int i = 0; i < (int) aSymbol->GetFields().size(); ++i ) for( int i = 0; i < (int) aSymbol->GetFields().size(); ++i )
{ {
const SCH_FIELD& field = aSymbol->GetFields()[i]; const SCH_FIELD& field = aSymbol->GetFields()[i];
wxPoint pos = field.GetPosition() - aSymbol->GetPosition(); VECTOR2I pos = field.GetPosition() - aSymbol->GetPosition();
LIB_FIELD libField( symbol.get(), field.GetId() ); LIB_FIELD libField( symbol.get(), field.GetId() );
if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() ) if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() )

View File

@ -296,9 +296,9 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
case SCH_NETCLASS_FLAG_T: case SCH_NETCLASS_FLAG_T:
case SCH_BUS_WIRE_ENTRY_T: case SCH_BUS_WIRE_ENTRY_T:
{ {
std::vector<wxPoint> pts = aItem->GetConnectionPoints(); std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
for( const wxPoint& pt : pts ) for( const VECTOR2I& pt : pts )
addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem ); addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem );
break; break;

View File

@ -184,8 +184,8 @@ public:
case SCH_SHEET_T: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = (SCH_SHEET*) aItem; SCH_SHEET* sheet = (SCH_SHEET*) aItem;
wxPoint topLeft = sheet->GetPosition(); VECTOR2I topLeft = sheet->GetPosition();
wxPoint botRight = sheet->GetPosition() + sheet->GetSize(); VECTOR2I botRight = sheet->GetPosition() + sheet->GetSize();
points->AddPoint( (wxPoint) topLeft ); points->AddPoint( (wxPoint) topLeft );
points->AddPoint( wxPoint( botRight.x, topLeft.y ) ); points->AddPoint( wxPoint( botRight.x, topLeft.y ) );
@ -197,8 +197,8 @@ public:
case SCH_BITMAP_T: case SCH_BITMAP_T:
{ {
SCH_BITMAP* bitmap = (SCH_BITMAP*) aItem; SCH_BITMAP* bitmap = (SCH_BITMAP*) aItem;
wxPoint topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
wxPoint botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
points->AddPoint( (wxPoint) topLeft ); points->AddPoint( (wxPoint) topLeft );
points->AddPoint( wxPoint( botRight.x, topLeft.y ) ); points->AddPoint( wxPoint( botRight.x, topLeft.y ) );
@ -703,7 +703,7 @@ void EE_POINT_EDITOR::updateParentItem() const
// Pin positions are relative to origin. Attempt to leave them where they // Pin positions are relative to origin. Attempt to leave them where they
// are if the origin moves. // are if the origin moves.
wxPoint originDelta = sheet->GetPosition() - (wxPoint) topLeft; VECTOR2I originDelta = sheet->GetPosition() - (wxPoint) topLeft;
sheet->SetPosition( (wxPoint) topLeft ); sheet->SetPosition( (wxPoint) topLeft );
sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) ); sheet->SetSize( wxSize( botRight.x - topLeft.x, botRight.y - topLeft.y ) );
@ -715,7 +715,7 @@ void EE_POINT_EDITOR::updateParentItem() const
// Keep sheet pins attached to edges: // Keep sheet pins attached to edges:
for( SCH_SHEET_PIN* pin : sheet->GetPins() ) for( SCH_SHEET_PIN* pin : sheet->GetPins() )
{ {
wxPoint pos = pin->GetPosition(); VECTOR2I pos = pin->GetPosition();
pos += originDelta; pos += originDelta;
@ -922,8 +922,8 @@ void EE_POINT_EDITOR::updatePoints()
case SCH_BITMAP_T: case SCH_BITMAP_T:
{ {
SCH_BITMAP* bitmap = (SCH_BITMAP*) item; SCH_BITMAP* bitmap = (SCH_BITMAP*) item;
wxPoint topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
wxPoint botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft ); m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y ); m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );
@ -935,8 +935,8 @@ void EE_POINT_EDITOR::updatePoints()
case SCH_SHEET_T: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = (SCH_SHEET*) item; SCH_SHEET* sheet = (SCH_SHEET*) item;
wxPoint topLeft = sheet->GetPosition(); VECTOR2I topLeft = sheet->GetPosition();
wxPoint botRight = sheet->GetPosition() + sheet->GetSize(); VECTOR2I botRight = sheet->GetPosition() + sheet->GetSize();
m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft ); m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y ); m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );

View File

@ -40,13 +40,13 @@ EE_SELECTION::EE_SELECTION( SCH_SCREEN* aScreen ) :
EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
{ {
EDA_ITEM* topLeftItem = nullptr; EDA_ITEM* topLeftItem = nullptr;
wxPoint topLeftPos; VECTOR2I topLeftPos;
// find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item // find the leftmost (smallest x coord) and highest (smallest y with the smallest x) item
// in the selection // in the selection
for( EDA_ITEM* item : m_items ) for( EDA_ITEM* item : m_items )
{ {
wxPoint pos = item->GetPosition(); VECTOR2I pos = item->GetPosition();
if( ( topLeftItem == nullptr ) if( ( topLeftItem == nullptr )
|| ( pos.x < topLeftPos.x ) || ( pos.x < topLeftPos.x )

View File

@ -1628,13 +1628,13 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos ) void SCH_DRAWING_TOOLS::sizeSheet( SCH_SHEET* aSheet, const VECTOR2I& aPos )
{ {
wxPoint pos = aSheet->GetPosition(); VECTOR2I pos = aSheet->GetPosition();
wxPoint size = (wxPoint) aPos - pos; VECTOR2I size = aPos - pos;
size.x = std::max( size.x, MIN_SHEET_WIDTH ); size.x = std::max( size.x, MIN_SHEET_WIDTH );
size.y = std::max( size.y, MIN_SHEET_HEIGHT ); size.y = std::max( size.y, MIN_SHEET_HEIGHT );
wxPoint grid = m_frame->GetNearestGridPosition( pos + size ); VECTOR2I grid = m_frame->GetNearestGridPosition( pos + size );
aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) ); aSheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
} }

View File

@ -231,7 +231,7 @@ bool SCH_EDIT_TOOL::Init()
DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet(); DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet();
VECTOR2D cursor = getViewControls()->GetCursorPosition( false ); VECTOR2D cursor = getViewControls()->GetCursorPosition( false );
if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursor ) ) if( ds && ds->HitTestDrawingSheetItems( getView(), cursor ) )
return true; return true;
} }
@ -457,7 +457,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
SCH_ITEM* head = nullptr; SCH_ITEM* head = nullptr;
int principalItemCount = 0; // User-selected items (as opposed to connected wires) int principalItemCount = 0; // User-selected items (as opposed to connected wires)
wxPoint rotPoint; VECTOR2I rotPoint;
bool moving = false; bool moving = false;
bool connections = false; bool connections = false;
@ -480,7 +480,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
if( principalItemCount == 1 ) if( principalItemCount == 1 )
{ {
if( moving && selection.HasReferencePoint() ) if( moving && selection.HasReferencePoint() )
rotPoint = (wxPoint) selection.GetReferencePoint(); rotPoint = selection.GetReferencePoint();
else else
rotPoint = head->GetPosition(); rotPoint = head->GetPosition();
@ -520,7 +520,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
SCH_SHEET* sheet = pin->GetParent(); SCH_SHEET* sheet = pin->GetParent();
for( int i = 0; clockwise ? i < 3 : i < 1; ++i ) for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() ); pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
break; break;
} }
@ -585,9 +585,9 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
else else
{ {
if( moving && selection.HasReferencePoint() ) if( moving && selection.HasReferencePoint() )
rotPoint = (wxPoint) selection.GetReferencePoint(); rotPoint = selection.GetReferencePoint();
else else
rotPoint = m_frame->GetNearestHalfGridPosition( (wxPoint) selection.GetCenter() ); rotPoint = m_frame->GetNearestHalfGridPosition( selection.GetCenter() );
} }
for( unsigned ii = 0; ii < selection.GetSize(); ii++ ) for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
@ -628,7 +628,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item ); SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
SCH_SHEET* sheet = pin->GetParent(); SCH_SHEET* sheet = pin->GetParent();
pin->Rotate( (wxPoint)sheet->GetBodyBoundingBox().GetCenter() ); pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
} }
} }
else if( item->Type() == SCH_FIELD_T ) else if( item->Type() == SCH_FIELD_T )
@ -691,7 +691,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
if( selection.GetSize() == 0 ) if( selection.GetSize() == 0 )
return 0; return 0;
wxPoint mirrorPoint; VECTOR2I mirrorPoint;
bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) ); bool vertical = ( aEvent.Matches( EE_ACTIONS::mirrorV.MakeEvent() ) );
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() ); SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
bool connections = false; bool connections = false;
@ -787,7 +787,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
case SCH_SHEET_T: case SCH_SHEET_T:
// Mirror the sheet on itself. Sheets do not have a anchor point. // Mirror the sheet on itself. Sheets do not have a anchor point.
mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)item->GetBoundingBox().Centre() ); mirrorPoint = m_frame->GetNearestHalfGridPosition( item->GetBoundingBox().Centre() );
if( vertical ) if( vertical )
item->MirrorVertically( mirrorPoint.y ); item->MirrorVertically( mirrorPoint.y );
@ -805,7 +805,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
} }
else if( selection.GetSize() > 1 ) else if( selection.GetSize() > 1 )
{ {
mirrorPoint = m_frame->GetNearestHalfGridPosition( (wxPoint)selection.GetCenter() ); mirrorPoint = m_frame->GetNearestHalfGridPosition( selection.GetCenter() );
for( unsigned ii = 0; ii < selection.GetSize(); ii++ ) for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
{ {
@ -885,7 +885,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
// If cloning a symbol then put into 'move' mode. // If cloning a symbol then put into 'move' mode.
if( newItem->Type() == SCH_SYMBOL_T ) if( newItem->Type() == SCH_SYMBOL_T )
{ {
wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true ); VECTOR2I cursorPos = getViewControls()->GetCursorPosition( true );
newItem->Move( cursorPos - newItem->GetPosition() ); newItem->Move( cursorPos - newItem->GetPosition() );
performDrag = true; performDrag = true;
} }
@ -903,8 +903,8 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true ); m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
} }
newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ), newItem->Move( VECTOR2I( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) ); Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
} }
newItem->SetFlags( IS_NEW ); newItem->SetFlags( IS_NEW );
@ -966,7 +966,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
SCH_SCREEN* screen = m_frame->GetScreen(); SCH_SCREEN* screen = m_frame->GetScreen();
auto items = m_selectionTool->RequestSelection( deletableItems ).GetItems(); auto items = m_selectionTool->RequestSelection( deletableItems ).GetItems();
bool appendToUndo = false; bool appendToUndo = false;
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
if( items.empty() ) if( items.empty() )
return 0; return 0;
@ -986,7 +986,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
if( sch_item->IsConnectable() ) if( sch_item->IsConnectable() )
{ {
std::vector<wxPoint> tmp_pts = sch_item->GetConnectionPoints(); std::vector<VECTOR2I> tmp_pts = sch_item->GetConnectionPoints();
pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() ); pts.insert( pts.end(), tmp_pts.begin(), tmp_pts.end() );
} }
@ -1026,7 +1026,7 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
} }
} }
for( const wxPoint& point : pts ) for( const VECTOR2I& point : pts )
{ {
SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T ); SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
@ -1083,7 +1083,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
{ {
EE_COLLECTOR collector; EE_COLLECTOR collector;
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
collector.Collect( m_frame->GetScreen(), deletableItems, (wxPoint) aPos ); collector.Collect( m_frame->GetScreen(), deletableItems, aPos );
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
selectionTool->GuessSelectionCandidates( collector, aPos ); selectionTool->GuessSelectionCandidates( collector, aPos );
@ -1319,7 +1319,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet(); DS_PROXY_VIEW_ITEM* ds = m_frame->GetCanvas()->GetView()->GetDrawingSheet();
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false ); VECTOR2D cursorPos = getViewControls()->GetCursorPosition( false );
if( ds && ds->HitTestDrawingSheetItems( getView(), (wxPoint) cursorPos ) ) if( ds && ds->HitTestDrawingSheetItems( getView(), cursorPos ) )
m_toolMgr->RunAction( ACTIONS::pageSettings ); m_toolMgr->RunAction( ACTIONS::pageSettings );
} }
@ -1613,7 +1613,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
{ {
bool selected = text->IsSelected(); bool selected = text->IsSelected();
SCH_TEXT* newtext = nullptr; SCH_TEXT* newtext = nullptr;
const wxPoint& position = text->GetPosition(); const VECTOR2I& position = text->GetPosition();
LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle(); LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle();
wxString txt = UnescapeString( text->GetText() ); wxString txt = UnescapeString( text->GetText() );

View File

@ -359,14 +359,14 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
} }
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const wxPoint& aPos ) SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const VECTOR2I& aPos )
{ {
SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings(); SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
wxPoint pos = aPos; VECTOR2I pos = aPos;
if( aPos == wxDefaultPosition ) if( aPos == VECTOR2I( 0, 0 ) )
pos = static_cast<wxPoint>( getViewControls()->GetCursorPosition() ); pos = static_cast<VECTOR2I>( getViewControls()->GetCursorPosition() );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
@ -390,7 +390,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const wxPoi
} }
const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const wxPoint& aPosition ) const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const VECTOR2I& aPosition )
{ {
SCH_SCREEN* screen = m_frame->GetScreen(); SCH_SCREEN* screen = m_frame->GetScreen();
@ -410,7 +410,7 @@ const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const wxPoint& aPositi
void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair<SCH_LINE*, SCH_LINE*>& aSegments, void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair<SCH_LINE*, SCH_LINE*>& aSegments,
wxPoint& aPosition ) VECTOR2I& aPosition )
{ {
wxCHECK_RET( aSegments.first && aSegments.second, wxCHECK_RET( aSegments.first && aSegments.second,
wxT( "Cannot compute break point of NULL line segment." ) ); wxT( "Cannot compute break point of NULL line segment." ) );
@ -418,7 +418,7 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair<SCH_LINE*, SCH_L
SCH_LINE* segment = aSegments.first; SCH_LINE* segment = aSegments.first;
SCH_LINE* next_segment = aSegments.second; SCH_LINE* next_segment = aSegments.second;
wxPoint midPoint; VECTOR2I midPoint;
int iDx = segment->GetEndPoint().x - segment->GetStartPoint().x; int iDx = segment->GetEndPoint().x - segment->GetStartPoint().x;
int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y; int iDy = segment->GetEndPoint().y - segment->GetStartPoint().y;
@ -548,11 +548,11 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
grid.ClearMaskFlag( GRID_HELPER::HORIZONTAL ); grid.ClearMaskFlag( GRID_HELPER::HORIZONTAL );
} }
wxPoint cursorPos = static_cast<wxPoint>( evt->HasPosition() ? wxPoint eventPosition = static_cast<wxPoint>( evt->HasPosition() ?
evt->Position() : evt->Position() :
controls->GetMousePosition() ); controls->GetMousePosition() );
cursorPos = (wxPoint) grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, segment ); VECTOR2I cursorPos = grid.BestSnapAnchor( eventPosition, LAYER_CONNECTABLE, segment );
controls->ForceCursorPosition( true, cursorPos ); controls->ForceCursorPosition( true, cursorPos );
bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only; bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only;
@ -686,7 +686,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
// Update the bus unfold posture based on the mouse movement // Update the bus unfold posture based on the mouse movement
if( m_busUnfold.in_progress && !m_busUnfold.label_placed ) if( m_busUnfold.in_progress && !m_busUnfold.label_placed )
{ {
wxPoint cursor_delta = cursorPos - m_busUnfold.origin; VECTOR2I cursor_delta = cursorPos - m_busUnfold.origin;
SCH_BUS_WIRE_ENTRY* entry = m_busUnfold.entry; SCH_BUS_WIRE_ENTRY* entry = m_busUnfold.entry;
bool flipX = ( cursor_delta.x < 0 ); bool flipX = ( cursor_delta.x < 0 );
@ -743,7 +743,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
if( !segment ) if( !segment )
m_toolMgr->VetoContextMenuMouseWarp(); m_toolMgr->VetoContextMenuMouseWarp();
contextMenuPos = cursorPos; contextMenuPos = (wxPoint)cursorPos;
m_menu.ShowContextMenu( m_selectionTool->GetSelection() ); m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
} }
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE ) else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
@ -886,8 +886,8 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
simplifyWireList(); simplifyWireList();
// Collect the possible connection points for the new lines // Collect the possible connection points for the new lines
std::vector< wxPoint > connections = m_frame->GetSchematicConnections(); std::vector<VECTOR2I> connections = m_frame->GetSchematicConnections();
std::vector< wxPoint > new_ends; std::vector<VECTOR2I> new_ends;
// Check each new segment for possible junctions and add/split if needed // Check each new segment for possible junctions and add/split if needed
for( SCH_LINE* wire : m_wires ) for( SCH_LINE* wire : m_wires )
@ -895,11 +895,11 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
if( wire->HasFlag( SKIP_STRUCT ) ) if( wire->HasFlag( SKIP_STRUCT ) )
continue; continue;
std::vector<wxPoint> tmpends = wire->GetConnectionPoints(); std::vector<VECTOR2I> tmpends = wire->GetConnectionPoints();
new_ends.insert( new_ends.end(), tmpends.begin(), tmpends.end() ); new_ends.insert( new_ends.end(), tmpends.begin(), tmpends.end() );
for( const wxPoint& pt : connections ) for( const VECTOR2I& pt : connections )
{ {
if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), pt ) ) if( IsPointOnSegment( wire->GetStartPoint(), wire->GetEndPoint(), pt ) )
new_ends.push_back( pt ); new_ends.push_back( pt );
@ -946,7 +946,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
for( SCH_ITEM* symbol : symbols ) for( SCH_ITEM* symbol : symbols )
{ {
std::vector<wxPoint> pts = symbol->GetConnectionPoints(); std::vector<VECTOR2I> pts = symbol->GetConnectionPoints();
if( pts.size() > 2 ) if( pts.size() > 2 )
continue; continue;
@ -958,7 +958,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
} }
} }
for( const wxPoint& pt : new_ends ) for( const VECTOR2I& pt : new_ends )
{ {
if( m_frame->GetScreen()->IsExplicitJunctionNeeded( pt ) ) if( m_frame->GetScreen()->IsExplicitJunctionNeeded( pt ) )
m_frame->AddJunction( m_frame->GetScreen(), pt, true, false ); m_frame->AddJunction( m_frame->GetScreen(), pt, true, false );
@ -978,8 +978,8 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
{ {
EE_SELECTION* aSelection = aEvent.Parameter<EE_SELECTION*>(); EE_SELECTION* aSelection = aEvent.Parameter<EE_SELECTION*>();
std::vector<wxPoint> pts; std::vector<VECTOR2I> pts;
std::vector<wxPoint> connections = m_frame->GetSchematicConnections(); std::vector<VECTOR2I> connections = m_frame->GetSchematicConnections();
for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ ) for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ )
{ {
@ -988,7 +988,7 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
if( !item || !item->IsConnectable() ) if( !item || !item->IsConnectable() )
continue; continue;
std::vector<wxPoint> new_pts = item->GetConnectionPoints(); std::vector<VECTOR2I> new_pts = item->GetConnectionPoints();
pts.insert( pts.end(), new_pts.begin(), new_pts.end() ); pts.insert( pts.end(), new_pts.begin(), new_pts.end() );
// If the item is a line, we also add any connection points from the rest of the schematic // If the item is a line, we also add any connection points from the rest of the schematic
@ -997,7 +997,7 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
{ {
SCH_LINE* line = (SCH_LINE*) item; SCH_LINE* line = (SCH_LINE*) item;
for( const wxPoint& pt : connections ) for( const VECTOR2I& pt : connections )
{ {
if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), pt ) ) if( IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), pt ) )
pts.push_back( pt ); pts.push_back( pt );
@ -1016,14 +1016,14 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
// We always have some overlapping connection points. Drop duplicates here // We always have some overlapping connection points. Drop duplicates here
std::sort( pts.begin(), pts.end(), std::sort( pts.begin(), pts.end(),
[]( const wxPoint& a, const wxPoint& b ) -> bool []( const VECTOR2I& a, const VECTOR2I& b ) -> bool
{ {
return a.x < b.x || ( a.x == b.x && a.y < b.y ); return a.x < b.x || ( a.x == b.x && a.y < b.y );
} ); } );
pts.erase( unique( pts.begin(), pts.end() ), pts.end() ); pts.erase( unique( pts.begin(), pts.end() ), pts.end() );
for( const wxPoint& point : pts ) for( const VECTOR2I& point : pts )
{ {
if( m_frame->GetScreen()->IsExplicitJunctionNeeded( point ) ) if( m_frame->GetScreen()->IsExplicitJunctionNeeded( point ) )
m_frame->AddJunction( m_frame->GetScreen(), point, true, false ); m_frame->AddJunction( m_frame->GetScreen(), point, true, false );

Some files were not shown because too many files have changed in this diff Show More