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

View File

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

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

View File

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

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
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();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
@ -842,11 +842,11 @@ wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition ) const
double yOffset = fmod( gridOrigin.y, gridSize.y );
int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
return VECTOR2I( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
}
wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) const
VECTOR2I EDA_DRAW_FRAME::GetNearestHalfGridPosition( const VECTOR2I& aPosition ) const
{
const VECTOR2I& gridOrigin = GetGridOrigin();
VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
@ -856,7 +856,7 @@ wxPoint EDA_DRAW_FRAME::GetNearestHalfGridPosition( const wxPoint& aPosition ) c
double yOffset = fmod( gridOrigin.y, gridSize.y );
int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
return wxPoint( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
return VECTOR2I( KiROUND( x * gridSize.x + xOffset ), KiROUND( y * gridSize.y + yOffset ) );
}
@ -893,7 +893,7 @@ std::vector<wxWindow*> EDA_DRAW_FRAME::findDialogs()
}
void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos )
void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos )
{
bool centerView = false;
BOX2D r = GetCanvas()->GetView()->GetViewport();

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

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() );
}
wxPoint EDA_SHAPE::getPosition() const
VECTOR2I EDA_SHAPE::getPosition() const
{
if( m_shape == SHAPE_T::ARC )
return getCenter();
else if( m_shape == SHAPE_T::POLY )
return (wxPoint) m_poly.CVertex( 0 );
return m_poly.CVertex( 0 );
else
return m_start;
}
@ -135,7 +135,7 @@ double EDA_SHAPE::GetLength() const
}
void EDA_SHAPE::move( const wxPoint& aMoveVector )
void EDA_SHAPE::move( const VECTOR2I& aMoveVector )
{
switch ( m_shape )
{
@ -158,7 +158,7 @@ void EDA_SHAPE::move( const wxPoint& aMoveVector )
m_bezierC1 += aMoveVector;
m_bezierC2 += aMoveVector;
for( wxPoint& pt : m_bezierPoints)
for( VECTOR2I& pt : m_bezierPoints )
pt += aMoveVector;
break;
@ -172,7 +172,7 @@ void EDA_SHAPE::move( const wxPoint& aMoveVector )
void EDA_SHAPE::scale( double aScale )
{
auto scalePt = [&]( wxPoint& pt )
auto scalePt = [&]( VECTOR2I& pt )
{
pt.x = KiROUND( pt.x * aScale );
pt.y = KiROUND( pt.y * aScale );
@ -196,7 +196,7 @@ void EDA_SHAPE::scale( double aScale )
case SHAPE_T::POLY: // polygon
{
std::vector<wxPoint> pts;
std::vector<VECTOR2I> pts;
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
{
@ -222,27 +222,27 @@ void EDA_SHAPE::scale( double aScale )
}
void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle )
void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, double aAngle )
{
switch( m_shape )
{
case SHAPE_T::SEGMENT:
case SHAPE_T::CIRCLE:
RotatePoint( &m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle );
RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( m_end, aRotCentre, aAngle );
break;
case SHAPE_T::ARC:
RotatePoint( &m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle );
RotatePoint( &m_arcCenter, aRotCentre, aAngle );
RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( m_end, aRotCentre, aAngle );
RotatePoint( m_arcCenter, aRotCentre, aAngle );
break;
case SHAPE_T::RECT:
if( KiROUND( aAngle ) % 900 == 0 )
{
RotatePoint( &m_start, aRotCentre, aAngle );
RotatePoint( &m_end, aRotCentre, aAngle );
RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( m_end, aRotCentre, aAngle );
break;
}
@ -262,13 +262,13 @@ void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle )
break;
case SHAPE_T::BEZIER:
RotatePoint( &m_start, aRotCentre, aAngle);
RotatePoint( &m_end, aRotCentre, aAngle);
RotatePoint( &m_bezierC1, aRotCentre, aAngle);
RotatePoint( &m_bezierC2, aRotCentre, aAngle);
RotatePoint( m_start, aRotCentre, aAngle );
RotatePoint( m_end, aRotCentre, aAngle );
RotatePoint( m_bezierC1, aRotCentre, aAngle );
RotatePoint( m_bezierC2, aRotCentre, aAngle );
for( wxPoint& pt : m_bezierPoints )
RotatePoint( &pt, aRotCentre, aAngle);
for( VECTOR2I& pt : m_bezierPoints )
RotatePoint( pt, aRotCentre, aAngle);
break;
@ -279,7 +279,7 @@ void EDA_SHAPE::rotate( const wxPoint& aRotCentre, double aAngle )
}
void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
void EDA_SHAPE::flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
{
switch ( m_shape )
{
@ -330,7 +330,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
break;
case SHAPE_T::POLY:
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, VECTOR2I( aCentre ) );
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight, aCentre );
break;
case SHAPE_T::BEZIER:
@ -351,7 +351,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
// Rebuild the poly points shape
{
std::vector<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 );
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
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 );
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 )
{
@ -408,16 +408,16 @@ wxPoint EDA_SHAPE::getCenter() const
case SHAPE_T::POLY:
case SHAPE_T::RECT:
case SHAPE_T::BEZIER:
return (wxPoint)getBoundingBox().Centre();
return getBoundingBox().Centre();
default:
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
return wxPoint();
return VECTOR2I();
}
}
void EDA_SHAPE::SetCenter( const wxPoint& aCenter )
void EDA_SHAPE::SetCenter( const VECTOR2I& aCenter )
{
switch( m_shape )
{
@ -435,10 +435,10 @@ void EDA_SHAPE::SetCenter( const wxPoint& aCenter )
}
wxPoint EDA_SHAPE::GetArcMid() const
VECTOR2I EDA_SHAPE::GetArcMid() const
{
wxPoint mid = m_start;
RotatePoint( &mid, m_arcCenter, -GetArcAngle() / 2.0 );
VECTOR2I mid = m_start;
RotatePoint( mid, m_arcCenter, -GetArcAngle() / 2.0 );
return mid;
}
@ -487,7 +487,7 @@ int EDA_SHAPE::GetRadius() const
}
void EDA_SHAPE::SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, const wxPoint& aEnd )
void EDA_SHAPE::SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd )
{
m_start = aStart;
m_end = aEnd;
@ -499,7 +499,7 @@ void EDA_SHAPE::SetArcGeometry( const wxPoint& aStart, const wxPoint& aMid, cons
* on the other side of the arc. In this case, we need to flip the start/end points and flag this
* change for the system
*/
wxPoint new_mid = GetArcMid();
VECTOR2I new_mid = GetArcMid();
VECTOR2D dist( new_mid - aMid );
VECTOR2D dist2( new_mid - m_arcCenter );
@ -526,7 +526,7 @@ double EDA_SHAPE::GetArcAngle() const
void EDA_SHAPE::SetArcAngleAndEnd( double aAngle, bool aCheckNegativeAngle )
{
m_end = m_start;
RotatePoint( &m_end, m_arcCenter, -NormalizeAngle360Max( aAngle ) );
RotatePoint( m_end, m_arcCenter, -NormalizeAngle360Max( aAngle ) );
if( aCheckNegativeAngle && aAngle < 0 )
{
@ -617,7 +617,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
switch( m_shape )
{
case SHAPE_T::RECT:
for( wxPoint& pt : GetRectCorners() )
for( VECTOR2I& pt : GetRectCorners() )
bbox.Merge( pt );
break;
@ -642,9 +642,9 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
for( auto iter = m_poly.CIterate(); iter; iter++ )
{
wxPoint pt( iter->x, iter->y );
VECTOR2I pt( iter->x, iter->y );
RotatePoint( &pt, getParentOrientation() );
RotatePoint( pt, getParentOrientation() );
pt += getParentPosition();
bbox.Merge( pt );
@ -671,7 +671,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
}
bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
int maxdist = aAccuracy;
@ -699,7 +699,7 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
if( EuclideanNorm( aPosition - m_end ) <= maxdist )
return true;
wxPoint relPos = aPosition - getCenter();
VECTOR2I relPos = aPosition - getCenter();
int radius = GetRadius();
int dist = KiROUND( EuclideanNorm( relPos ) );
@ -747,14 +747,14 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
SHAPE_POLY_SET poly;
poly.NewOutline();
for( const wxPoint& pt : GetRectCorners() )
for( const VECTOR2I& pt : GetRectCorners() )
poly.Append( pt );
return poly.Collide( VECTOR2I( aPosition ), maxdist );
}
else // Open rect hit-test
{
std::vector<wxPoint> pts = GetRectCorners();
std::vector<VECTOR2I> pts = GetRectCorners();
return TestSegmentHit( aPosition, pts[0], pts[1], maxdist )
|| TestSegmentHit( aPosition, pts[1], pts[2], maxdist )
@ -836,7 +836,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
else
{
std::vector<wxPoint> pts = GetRectCorners();
std::vector<VECTOR2I> pts = GetRectCorners();
// Account for the width of the lines
arect.Inflate( GetWidth() / 2 );
@ -877,7 +877,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
// Therefore, instead of using m_poly, we make a copy which is translated
// to the actual location in the board.
double orientation = 0.0;
wxPoint offset = getParentPosition();
VECTOR2I offset = getParentPosition();
if( getParentOrientation() )
orientation = -DECIDEG2RAD( getParentOrientation() );
@ -893,7 +893,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I vertex = poly.GetPoint( ii );
// Test if the point is within aRect
if( arect.Contains( ( wxPoint ) vertex ) )
if( arect.Contains( vertex ) )
return true;
if( ii + 1 < count )
@ -901,7 +901,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I vertexNext = poly.GetPoint( ii + 1 );
// Test if this edge intersects aRect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
if( arect.Intersects( vertex, vertexNext ) )
return true;
}
else if( poly.IsClosed() )
@ -909,7 +909,7 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
VECTOR2I vertexNext = poly.GetPoint( 0 );
// Test if this edge intersects aRect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
if( arect.Intersects( vertex, vertexNext ) )
return true;
}
}
@ -935,11 +935,11 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
for( unsigned ii = 1; ii < count; ii++ )
{
wxPoint vertex = m_bezierPoints[ ii - 1];
wxPoint vertexNext = m_bezierPoints[ii];
VECTOR2I vertex = m_bezierPoints[ii - 1];
VECTOR2I vertexNext = m_bezierPoints[ii];
// Test if the point is within aRect
if( arect.Contains( ( wxPoint ) vertex ) )
if( arect.Contains( vertex ) )
return true;
// Test if this edge intersects aRect
@ -957,20 +957,20 @@ bool EDA_SHAPE::hitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
std::vector<wxPoint> EDA_SHAPE::GetRectCorners() const
std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
{
std::vector<wxPoint> pts;
wxPoint topLeft = GetStart();
wxPoint botRight = GetEnd();
std::vector<VECTOR2I> pts;
VECTOR2I topLeft = GetStart();
VECTOR2I botRight = GetEnd();
// Un-rotate rect topLeft and botRight
if( KiROUND( getParentOrientation() ) % 900 != 0 )
{
topLeft -= getParentPosition();
RotatePoint( &topLeft, -getParentOrientation() );
RotatePoint( topLeft, -getParentOrientation() );
botRight -= getParentPosition();
RotatePoint( &botRight, -getParentOrientation() );
RotatePoint( botRight, -getParentOrientation() );
}
// Set up the un-rotated 4 corners
@ -982,9 +982,9 @@ std::vector<wxPoint> EDA_SHAPE::GetRectCorners() const
// Now re-rotate the 4 corners to get a diamond
if( KiROUND( getParentOrientation() ) % 900 != 0 )
{
for( wxPoint& pt : pts )
for( VECTOR2I& pt : pts )
{
RotatePoint( &pt, getParentOrientation() );
RotatePoint( pt, getParentOrientation() );
pt += getParentPosition();
}
}
@ -995,8 +995,8 @@ std::vector<wxPoint> EDA_SHAPE::GetRectCorners() const
void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
{
wxPoint start = m_start;
wxPoint end = m_end;
VECTOR2I start = m_start;
VECTOR2I end = m_end;
double t1, t2;
CalcArcAngles( t1, t2 );
@ -1049,10 +1049,10 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
{
switch( quarter )
{
case 0: aBBox.Merge( wxPoint( m_arcCenter.x, m_arcCenter.y + radius ) ); break; // down
case 1: aBBox.Merge( wxPoint( m_arcCenter.x - radius, m_arcCenter.y ) ); break; // left
case 2: aBBox.Merge( wxPoint( m_arcCenter.x, m_arcCenter.y - radius ) ); break; // up
case 3: aBBox.Merge( wxPoint( m_arcCenter.x + radius, m_arcCenter.y ) ); break; // right
case 0: aBBox.Merge( VECTOR2I( m_arcCenter.x, m_arcCenter.y + radius ) ); break; // down
case 1: aBBox.Merge( VECTOR2I( m_arcCenter.x - radius, m_arcCenter.y ) ); break; // left
case 2: aBBox.Merge( VECTOR2I( m_arcCenter.x, m_arcCenter.y - radius ) ); break; // up
case 3: aBBox.Merge( VECTOR2I( m_arcCenter.x + radius, m_arcCenter.y ) ); break; // right
}
++quarter %= 4;
@ -1061,12 +1061,12 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
}
void EDA_SHAPE::SetPolyPoints( const std::vector<wxPoint>& aPoints )
void EDA_SHAPE::SetPolyPoints( const std::vector<VECTOR2I>& aPoints )
{
m_poly.RemoveAllContours();
m_poly.NewOutline();
for ( const wxPoint& p : aPoints )
for( const VECTOR2I& p : aPoints )
m_poly.Append( p.x, p.y );
}
@ -1088,7 +1088,7 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
case SHAPE_T::RECT:
{
std::vector<wxPoint> pts = GetRectCorners();
std::vector<VECTOR2I> pts = GetRectCorners();
if( IsFilled() && !aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) );
@ -1116,12 +1116,12 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
case SHAPE_T::BEZIER:
{
std::vector<wxPoint> bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
wxPoint start_pt = bezierPoints[0];
std::vector<VECTOR2I> bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
VECTOR2I start_pt = bezierPoints[0];
for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ )
{
wxPoint end_pt = bezierPoints[jj];
VECTOR2I end_pt = bezierPoints[jj];
effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, GetWidth() ) );
start_pt = end_pt;
}
@ -1156,7 +1156,7 @@ std::vector<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() )
{
@ -1196,7 +1196,7 @@ int EDA_SHAPE::GetPointCount() const
}
void EDA_SHAPE::beginEdit( const wxPoint& aPosition )
void EDA_SHAPE::beginEdit( const VECTOR2I& aPosition )
{
switch( GetShape() )
{
@ -1227,7 +1227,7 @@ void EDA_SHAPE::beginEdit( const wxPoint& aPosition )
}
bool EDA_SHAPE::continueEdit( const wxPoint& aPosition )
bool EDA_SHAPE::continueEdit( const VECTOR2I& aPosition )
{
switch( GetShape() )
{
@ -1254,7 +1254,7 @@ bool EDA_SHAPE::continueEdit( const wxPoint& aPosition )
}
void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
void EDA_SHAPE::calcEdit( const VECTOR2I& aPosition )
{
#define sq( x ) pow( x, 2 )
@ -1291,7 +1291,7 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
case 2:
case 3:
{
wxPoint v = m_start - m_end;
VECTOR2I v = m_start - m_end;
double chordBefore = sq( v.x ) + sq( v.y );
if( m_editState == 2 )
@ -1328,15 +1328,15 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
//
// Let 'l' be the length of the chord and 'm' the middle point of the chord
double l = GetLineLength( m_start, m_end );
wxPoint m = ( m_start + m_end ) / 2;
VECTOR2I m = ( m_start + m_end ) / 2;
// Calculate 'd', the vector from the chord midpoint to the center
wxPoint d;
VECTOR2I d;
d.x = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_start.y - m_end.y ) / l );
d.y = KiROUND( sqrt( sq( radius ) - sq( l/2 ) ) * ( m_end.x - m_start.x ) / l );
wxPoint c1 = m + d;
wxPoint c2 = m - d;
VECTOR2I c1 = m + d;
VECTOR2I c2 = m - d;
// Solution gives us 2 centers; we need to pick one:
switch( m_editState )
@ -1344,12 +1344,12 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
case 1:
{
// Keep center clockwise from chord while drawing
wxPoint chordVector = m_end - m_start;
VECTOR2I chordVector = m_end - m_start;
double chordAngle = ArcTangente( chordVector.y, chordVector.x );
NORMALIZE_ANGLE_POS( chordAngle );
wxPoint c1Test = c1;
RotatePoint( &c1Test, m_start, -chordAngle );
VECTOR2I c1Test = c1;
RotatePoint( c1Test, m_start, -chordAngle );
m_arcCenter = c1Test.x > 0 ? c2 : c1;
}
@ -1500,13 +1500,13 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
case SHAPE_T::RECT:
{
std::vector<wxPoint> pts = GetRectCorners();
std::vector<VECTOR2I> pts = GetRectCorners();
if( IsFilled() )
{
aCornerBuffer.NewOutline();
for( const wxPoint& pt : pts )
for( const VECTOR2I& pt : pts )
aCornerBuffer.Append( pt );
}
@ -1538,15 +1538,15 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
// The polygon is expected to be a simple polygon; not self intersecting, no hole.
double orientation = getParentOrientation();
wxPoint offset = getParentPosition();
VECTOR2I offset = getParentPosition();
// Build the polygon with the actual position and orientation:
std::vector<wxPoint> poly;
std::vector<VECTOR2I> poly;
DupPolyPointsList( poly );
for( wxPoint& point : poly )
for( VECTOR2I& point : poly )
{
RotatePoint( &point, orientation );
RotatePoint( point, orientation );
point += offset;
}
@ -1554,15 +1554,15 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
{
aCornerBuffer.NewOutline();
for( const wxPoint& point : poly )
for( const VECTOR2I& point : poly )
aCornerBuffer.Append( point.x, point.y );
}
if( width > 0 || !IsFilled() )
{
wxPoint pt1( poly[ poly.size() - 1] );
VECTOR2I pt1( poly[poly.size() - 1] );
for( const wxPoint& pt2 : poly )
for( const VECTOR2I& pt2 : poly )
{
if( pt2 != pt1 )
TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc );
@ -1576,9 +1576,9 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
case SHAPE_T::BEZIER:
{
std::vector<wxPoint> ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() };
std::vector<VECTOR2I> ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() };
BEZIER_POLY converter( ctrlPts );
std::vector< wxPoint> poly;
std::vector<VECTOR2I> poly;
converter.GetPoly( poly, GetWidth() );
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 )
{
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 );
}
@ -304,7 +304,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
extra_height += thickness / 2;
textsize.y += extra_height;
rect.Move( wxPoint( 0, -extra_height ) );
rect.Move( VECTOR2I( 0, -extra_height ) );
}
// for multiline texts and aLine < 0, merge all rectangles
@ -391,7 +391,7 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
}
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
bool EDA_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
{
EDA_RECT rect = GetTextBox();
VECTOR2I location = aPoint;
@ -416,12 +416,12 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
}
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
const COLOR4D& aColor, OUTLINE_MODE aFillMode )
{
if( IsMultilineAllowed() )
{
std::vector<wxPoint> positions;
std::vector<VECTOR2I> positions;
wxArrayString strings;
wxStringSplit( GetShownText(), strings, '\n' );
@ -439,12 +439,12 @@ void EDA_TEXT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
}
void EDA_TEXT::GetLinePositions( std::vector<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
// to the center of the multiline text block
wxPoint offset; // Offset to next line.
VECTOR2I offset; // Offset to next line.
offset.y = GetInterline();
@ -469,11 +469,11 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
RotatePoint( pos, GetTextPos(), GetTextAngle() );
// Rotate the offset lines to increase happened in the right direction
RotatePoint( &offset, GetTextAngle() );
RotatePoint( offset, GetTextAngle() );
for( int ii = 0; ii < aLineCount; ii++ )
{
aPositions.push_back( (wxPoint) pos );
aPositions.push_back( (VECTOR2I) pos );
pos += offset;
}
}
@ -599,21 +599,21 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
}
// Convert the text shape to a list of segment
// each segment is stored as 2 wxPoints: its starting point and its ending point
// each segment is stored as 2 VECTOR2Is: its starting point and its ending point
// we are using GRText to create the segments and therefore a call-back function is needed
// This is a call back function, used by GRText to put each segment in buffer
static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData )
{
std::vector<wxPoint>* cornerBuffer = static_cast<std::vector<wxPoint>*>( aData );
cornerBuffer->push_back( wxPoint( x0, y0 ) );
cornerBuffer->push_back( wxPoint( xf, yf ) );
std::vector<VECTOR2I>* cornerBuffer = static_cast<std::vector<VECTOR2I>*>( aData );
cornerBuffer->push_back( VECTOR2I( x0, y0 ) );
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();
if( IsMirrored() )
@ -628,7 +628,7 @@ std::vector<wxPoint> EDA_TEXT::TransformToSegmentList() const
{
wxArrayString strings_list;
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
std::vector<wxPoint> positions;
std::vector<VECTOR2I> positions;
positions.reserve( strings_list.Count() );
GetLinePositions( positions, strings_list.Count() );
@ -655,7 +655,7 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const
{
std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
int penWidth = GetEffectiveTextPenWidth();
std::vector<wxPoint> pts = TransformToSegmentList();
std::vector<VECTOR2I> pts = TransformToSegmentList();
for( unsigned jj = 0; jj < pts.size(); jj += 2 )
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;
static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const wxPoint* Points, int n );
static void ClipAndDrawPoly( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I* Points, int n );
/* These functions are used by corresponding functions
* ( GRSCircle is called by GRCircle for instance) after mapping coordinates
@ -204,8 +204,8 @@ void GRLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi
}
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
const COLOR4D& aColor, wxPenStyle aStyle )
void GRLine( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aWidth, const COLOR4D& aColor, wxPenStyle aStyle )
{
GRLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, aColor, aStyle );
}
@ -315,8 +315,8 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int w
}
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd, int aWidth,
const COLOR4D& aColor )
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aWidth, const COLOR4D& aColor )
{
GRCSegm( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth, 0, aColor );
}
@ -330,14 +330,14 @@ void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, i
}
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
int aWidth, const COLOR4D& aColor )
{
GRSetColorPen( aDC, aColor, aWidth );
WinClipAndDrawLine( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aWidth );
}
static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points )
static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const VECTOR2I* Points )
{
if( !ClipBox )
return true;
@ -379,7 +379,7 @@ static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, const wxPoint* Points )
/**
* Draw a new polyline and fill it if Fill, in screen space.
*/
static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill,
static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill,
int width, const COLOR4D& Color, const COLOR4D& BgColor )
{
if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
@ -412,7 +412,7 @@ static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points,
/**
* Draw a new closed polyline and fill it if Fill, in screen space.
*/
static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const wxPoint* aPoints,
static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const VECTOR2I* aPoints,
bool aFill, int aWidth, const COLOR4D& aColor, const COLOR4D& aBgColor )
{
if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) )
@ -450,7 +450,7 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC, int aPointCount, const
/**
* Draw a new polyline and fill it if Fill, in drawing space.
*/
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width,
const COLOR4D& Color, const COLOR4D& BgColor )
{
GRSPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
@ -460,14 +460,14 @@ void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fil
/**
* Draw a closed polyline and fill it if Fill, in object space.
*/
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill,
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill,
const COLOR4D& Color, const COLOR4D& BgColor )
{
GRClosedPoly( ClipBox, DC, n, Points, Fill, 0, Color, BgColor );
}
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const wxPoint* Points, bool Fill, int width,
void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, const VECTOR2I* Points, bool Fill, int width,
const COLOR4D& Color, const COLOR4D& BgColor )
{
GRSClosedPoly( ClipBox, DC, n, Points, Fill, width, Color, BgColor );
@ -515,7 +515,7 @@ void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int r, int width, co
}
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius, int aWidth,
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, int aWidth,
const COLOR4D& aColor )
{
GRCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, aWidth, aColor );
@ -534,7 +534,7 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width
}
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aPos, int aRadius,
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius,
const COLOR4D& aColor )
{
GRFilledCircle( aClipBox, aDC, aPos.x, aPos.y, aRadius, 0, aColor, aColor );
@ -573,16 +573,17 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc
}
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aCenter, int aWidth, const COLOR4D& aColor )
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const VECTOR2I& aCenter, int aWidth, const COLOR4D& aColor )
{
GRArc1( aClipBox, aDC, aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y,
aWidth, aColor );
}
void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const wxPoint& aStart, const wxPoint& aEnd,
const wxPoint& aCenter, int width, const COLOR4D& Color, const COLOR4D& BgColor )
void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I& aStart, const VECTOR2I& aEnd,
const VECTOR2I& aCenter, int width, const COLOR4D& Color,
const COLOR4D& BgColor )
{
/* Clip arcs off screen. */
if( ClipBox )
@ -722,11 +723,11 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth,
const COLOR4D& aColor )
{
wxPoint points[5];
points[0] = wxPoint( x1, y1 );
points[1] = wxPoint( x1, y2 );
points[2] = wxPoint( x2, y2 );
points[3] = wxPoint( x2, y1 );
VECTOR2I points[5];
points[0] = VECTOR2I( x1, y1 );
points[1] = VECTOR2I( x1, y2 );
points[2] = VECTOR2I( x2, y2 );
points[3] = VECTOR2I( x2, y1 );
points[4] = points[0];
GRSClosedPoly( aClipBox, aDC, 5, points, NOT_FILLED, aWidth, aColor, aColor );
}
@ -735,11 +736,11 @@ void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2, int aWidth,
const COLOR4D& aColor, const COLOR4D& aBgColor )
{
wxPoint points[5];
points[0] = wxPoint( x1, y1 );
points[1] = wxPoint( x1, y2 );
points[2] = wxPoint( x2, y2 );
points[3] = wxPoint( x2, y1 );
VECTOR2I points[5];
points[0] = VECTOR2I( x1, y1 );
points[1] = VECTOR2I( x1, y2 );
points[2] = VECTOR2I( x2, y2 );
points[3] = VECTOR2I( x2, y1 );
points[4] = points[0];
GRSetBrush( aDC, aBgColor, FILLED );
@ -768,16 +769,29 @@ void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y
#include <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 )
{
aDC->DrawPolygon( n, Points );
vector2IwxDrawPolygon( aDC, Points, n );
return;
}
// A clip box exists: clip and draw the polygon.
static std::vector<wxPoint> clippedPolygon;
static std::vector<VECTOR2I> clippedPolygon;
static pointVector inputPolygon, outputPolygon;
inputPolygon.clear();
@ -799,7 +813,7 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint* Points, int
}
if( clippedPolygon.size() )
aDC->DrawPolygon( clippedPolygon.size(), &clippedPolygon[0] );
vector2IwxDrawPolygon( aDC, &clippedPolygon[0], clippedPolygon.size() );
}

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();
bbox.Inflate( aAccuracy );
@ -134,12 +134,12 @@ EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
}
void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{
wxDC* DC = aSettings->GetPrintDC();
// Build the marker shape polygon in internal units:
std::vector<wxPoint> shape;
std::vector<VECTOR2I> shape;
shape.reserve( CORNERS_COUNT );
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.
// S_ARC wants start to give the center, and end to give the start.
double dx = aEnd.x - aStart.x, dy = aEnd.y - aStart.y;
wxPoint mid = ( aStart + aEnd ) / 2;
VECTOR2I mid = ( aStart + aEnd ) / 2;
double dlen = sqrt( dx*dx + dy*dy );
@ -285,7 +285,7 @@ wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAn
double dist = dlen / ( 2 * tan( DEG2RAD( aAngle ) / 2 ) );
wxPoint center(
VECTOR2I center(
mid.x + dist * ( dy / dlen ),
mid.y - dist * ( dx / dlen )
);

View File

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

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)",
MessageTextFromValue( aUnits, aPos.x ),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 );
bool positioningModified = false;
if( aField->GetPosition() != (wxPoint)m_position )
if( aField->GetPosition() != m_position )
positioningModified = true;
if( aField->GetTextAngle().IsVertical() != m_isVertical )
@ -617,7 +617,7 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
aField->SetText( m_text );
updateText( aField );
aField->SetPosition( (wxPoint)m_position );
aField->SetPosition( m_position );
// Note that we must set justifications before we can ask if they're flipped. If the old
// justification is center then it won't know (whereas if the new justification is center

View File

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

View File

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

View File

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

View File

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

View File

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

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()
bool visible = field.IsVisible();
wxPoint pos = field.GetPosition();
VECTOR2I pos = field.GetPosition();
field.SetAttributes( *parentField );

View File

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

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 )
{
Empty(); // empty the collection just in case
@ -160,7 +160,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[],
const wxPoint& aPos, int aUnit, int aConvert )
const VECTOR2I& aPos, int aUnit, int aConvert )
{
Empty(); // empty the collection just in case

View File

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

View File

@ -201,7 +201,7 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
if( unresolved( field.GetShownText() ) )
{
wxPoint pos = field.GetPosition() - symbol->GetPosition();
VECTOR2I pos = field.GetPosition() - symbol->GetPosition();
pos = symbol->GetTransform().TransformCoordinate( pos );
pos += symbol->GetPosition();
@ -392,7 +392,7 @@ int ERC_TESTER::TestNoConnectPins()
for( const SCH_SHEET_PATH& sheet : m_schematic->GetSheets() )
{
std::map<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 ) )
{

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

View File

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

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* aData, const TRANSFORM& aTransform )
void LIB_ITEM::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
{
print( aSettings, aOffset, aData, aTransform );
}

View File

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

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

View File

@ -141,7 +141,7 @@ public:
* electrical types
* @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;
/**
@ -156,7 +156,7 @@ public:
LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber, int aOrientation,
ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aNumTextSize,
int aConvert, const wxPoint& aPos, int aUnit );
int aConvert, const VECTOR2I& aPos, int aUnit );
// 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;
#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;
@ -198,25 +198,25 @@ public:
* 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.
*/
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;
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; }
void SetPosition( const wxPoint& aPos ) override { m_position = aPos; }
VECTOR2I GetPosition() const override { return m_position; }
void SetPosition( const VECTOR2I& aPos ) override { m_position = aPos; }
wxPoint GetPinRoot() const;
VECTOR2I GetPinRoot() const;
void MirrorHorizontal( const wxPoint& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override;
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void MirrorHorizontal( const VECTOR2I& aCenter ) override;
void MirrorVertical( const VECTOR2I& aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill,
void Plot( PLOTTER* aPlotter, const VECTOR2I& aPffset, bool aFill,
const TRANSFORM& aTransform ) const override;
BITMAPS GetMenuImage() const override;
@ -225,7 +225,7 @@ public:
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.
@ -242,7 +242,7 @@ protected:
* Print the pin symbol without text.
* 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.
@ -252,13 +252,13 @@ protected:
* If aTextInside then the text is been put inside,otherwise all is drawn outside.
* 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 );
/**
* 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 );
private:
@ -275,7 +275,7 @@ private:
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
protected:
wxPoint m_position; // Position of the pin.
VECTOR2I m_position; // Position of the pin.
int m_length; // Length of the pin.
int m_orientation; // Pin orientation (Up, Down, Left, Right)
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 ) )
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 );
}
void LIB_SHAPE::MoveTo( const wxPoint& aPosition )
void LIB_SHAPE::MoveTo( const VECTOR2I& aPosition )
{
setPosition( aPosition );
}
void LIB_SHAPE::MirrorHorizontal( const wxPoint& aCenter )
void LIB_SHAPE::MirrorHorizontal( const VECTOR2I& aCenter )
{
flip( aCenter, true );
}
void LIB_SHAPE::MirrorVertical( const wxPoint& aCenter )
void LIB_SHAPE::MirrorVertical( const VECTOR2I& aCenter )
{
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;
@ -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
{
wxPoint start = aTransform.TransformCoordinate( m_start ) + aOffset;
wxPoint end = aTransform.TransformCoordinate( m_end ) + aOffset;
wxPoint center;
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
VECTOR2I center;
int startAngle = 0;
int endAngle = 0;
int pen_size = GetEffectivePenWidth( aPlotter->RenderSettings() );
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 )
{
@ -127,13 +127,13 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
cornerList.clear();
for( const VECTOR2I& pt : poly.CPoints() )
cornerList.push_back( aTransform.TransformCoordinate( (wxPoint) pt ) + aOffset );
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
}
else if( GetShape() == SHAPE_T::BEZIER )
{
cornerList.clear();
for( const wxPoint& pt : m_bezierPoints )
for( const VECTOR2I& pt : m_bezierPoints )
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
}
else if( GetShape() == SHAPE_T::ARC )
@ -210,8 +210,8 @@ int LIB_SHAPE::GetPenWidth() const
}
void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
{
bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetEffectivePenWidth( aSettings );
@ -220,29 +220,29 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
return;
wxDC* DC = aSettings->GetPrintDC();
wxPoint pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
wxPoint pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
wxPoint c;
VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
VECTOR2I c;
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
COLOR4D fillColor = color;
unsigned ptCount = 0;
wxPoint* buffer = nullptr;
VECTOR2I* buffer = nullptr;
if( GetShape() == SHAPE_T::POLY )
{
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
ptCount = poly.GetPointCount();
buffer = new wxPoint[ ptCount ];
buffer = new VECTOR2I[ptCount];
for( unsigned ii = 0; ii < ptCount; ++ii )
buffer[ii] = aTransform.TransformCoordinate( (wxPoint) poly.CPoint( ii ) ) + aOffset;
buffer[ii] = aTransform.TransformCoordinate( poly.CPoint( ii ) ) + aOffset;
}
else if( GetShape() == SHAPE_T::BEZIER )
{
ptCount = m_bezierPoints.size();
buffer = new wxPoint[ ptCount ];
buffer = new VECTOR2I[ptCount];
for( size_t ii = 0; ii < ptCount; ++ii )
buffer[ii] = aTransform.TransformCoordinate( m_bezierPoints[ii] ) + aOffset;
@ -403,7 +403,7 @@ BITMAPS LIB_SHAPE::GetMenuImage() const
}
void LIB_SHAPE::AddPoint( const wxPoint& aPosition )
void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition )
{
if( GetShape() == SHAPE_T::POLY )
{

View File

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

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

View File

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

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

View File

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

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 );
@ -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 );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 ) )
return false;

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@
class SCH_MARKER : public SCH_ITEM, public MARKER_BASE
{
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.
@ -58,7 +58,7 @@ public:
SCH_LAYER_ID GetColorLayer() const;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void Plot( PLOTTER* /* aPlotter */ ) const override
{
@ -71,14 +71,14 @@ public:
// Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override
void Move( const VECTOR2I& aMoveVector ) override
{
m_Pos += aMoveVector;
}
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override;
void Rotate( const VECTOR2I& aCenter ) override;
/**
* Compare DRC marker main and auxiliary text against search string.
@ -98,10 +98,10 @@ public:
BITMAPS GetMenuImage() const override;
wxPoint GetPosition() const override { return m_Pos; }
void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
VECTOR2I GetPosition() const override { return m_Pos; }
void SetPosition( const VECTOR2I& aPosition ) override { m_Pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
EDA_ITEM* Clone() const override;

View File

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

View File

@ -38,7 +38,7 @@ class NETLIST_OBJECT_LIST;
class SCH_NO_CONNECT : public SCH_ITEM
{
public:
SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_NO_CONNECT( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@ -65,7 +65,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
@ -73,14 +73,14 @@ public:
// Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override
void Move( const VECTOR2I& aMoveVector ) override
{
m_pos += aMoveVector;
}
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override;
void Rotate( const VECTOR2I& aCenter ) override;
bool IsConnectable() const override { return true; }
@ -90,7 +90,7 @@ public:
aItem->Type() == SCH_SYMBOL_T;
}
std::vector<wxPoint> GetConnectionPoints() const override;
std::vector<VECTOR2I> GetConnectionPoints() const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
{
@ -99,10 +99,10 @@ public:
BITMAPS GetMenuImage() const override;
wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override;
@ -114,9 +114,9 @@ public:
#endif
private:
bool doIsConnected( const wxPoint& aPosition ) const override;
bool doIsConnected( const VECTOR2I& aPosition ) const override;
wxPoint m_pos; ///< Position of the no connect object.
VECTOR2I m_pos; ///< Position 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 );
square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
square->SetEnd( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
square->MoveTo( VECTOR2I( Mils2iu( -200 ), Mils2iu( 200 ) ) );
square->SetEnd( VECTOR2I( Mils2iu( 200 ), Mils2iu( -200 ) ) );
LIB_TEXT* text = new LIB_TEXT( symbol );
@ -446,7 +446,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition, dou
const STROKE_FONT& font = m_gal->GetStrokeFont();
VECTOR2D extents = font.ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(),
m_gal->GetLineWidth() );
EDA_RECT box( (wxPoint) aPosition, wxSize( extents.x, extents.y ) );
EDA_RECT box( (VECTOR2I) aPosition, wxSize( extents.x, extents.y ) );
if( m_gal->GetHorizontalJustify() == GR_TEXT_H_ALIGN_CENTER )
box.SetX( box.GetX() - ( box.GetWidth() / 2) );
@ -459,7 +459,7 @@ void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition, dou
box.SetY( box.GetY() - box.GetHeight() );
box.Normalize(); // Make h and v sizes always >= 0
box = box.GetBoundingBoxRotated((wxPoint) aPosition, RAD2DECIDEG( aAngle ) );
box = box.GetBoundingBoxRotated((VECTOR2I) aPosition, RAD2DECIDEG( aAngle ) );
box.RevertYAxis();
m_gal->DrawRectangle( mapCoords( box.GetOrigin() ), mapCoords( box.GetEnd() ) );
}
@ -617,7 +617,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
std::deque<VECTOR2D> mappedPts;
for( const VECTOR2I& pt : poly.CPoints() )
mappedPts.push_back( mapCoords( (wxPoint) pt ) );
mappedPts.push_back( mapCoords( pt ) );
m_gal->DrawPolygon( mappedPts );
}
@ -627,7 +627,7 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
{
std::deque<VECTOR2D> mappedPts;
for( const wxPoint& p : aShape->GetBezierPoints() )
for( const VECTOR2I& p : aShape->GetBezierPoints() )
mappedPts.push_back( mapCoords( p ) );
m_gal->DrawPolygon( mappedPts );
@ -709,7 +709,7 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
{
m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
m_gal->DrawLine( textpos, wxPoint( 0, 0 ) );
m_gal->DrawLine( textpos, VECTOR2I( 0, 0 ) );
}
}
@ -1238,7 +1238,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
void SCH_PAINTER::drawDanglingSymbol( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
bool aDrawingShadows, bool aBrightened )
{
wxPoint radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
VECTOR2I radius( aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
aWidth + Mils2iu( DANGLING_SYMBOL_SIZE / 2 ) );
// Dangling symbols must be drawn in a slightly different colour so they can be seen when
@ -1319,7 +1319,7 @@ void SCH_PAINTER::draw( const SCH_LINE *aLine, int aLayer )
SHAPE_SEGMENT line( aLine->GetStartPoint(), aLine->GetEndPoint() );
STROKE_PARAMS::Stroke( &line, lineStyle, width, &m_schSettings,
[&]( const wxPoint& a, const wxPoint& b )
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_gal->DrawLine( a, b );
} );
@ -1422,7 +1422,7 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
for( SHAPE* shape : shapes )
{
STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings,
[&]( const wxPoint& a, const wxPoint& b )
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
m_gal->DrawLine( a, b );
} );
@ -1564,13 +1564,13 @@ static void orientSymbol( LIB_SYMBOL* symbol, int orientation )
for( auto& item : symbol->GetDrawItems() )
{
for( int i = 0; i < o.n_rots; i++ )
item.Rotate( wxPoint(0, 0 ), true );
item.Rotate( VECTOR2I(0, 0 ), true );
if( o.mirror_x )
item.MirrorVertical( wxPoint( 0, 0 ) );
item.MirrorVertical( VECTOR2I( 0, 0 ) );
if( o.mirror_y )
item.MirrorHorizontal( wxPoint( 0, 0 ) );
item.MirrorHorizontal( VECTOR2I( 0, 0 ) );
}
}
@ -1612,7 +1612,7 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
for( auto& tempItem : tempSymbol.GetDrawItems() )
{
tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) );
tempItem.MoveTo( tempItem.GetPosition() + (VECTOR2I) mapCoords( aSymbol->GetPosition() ) );
}
// Copy the pin info from the symbol to the temp pins
@ -1737,7 +1737,7 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
// Draw the umbilical line
if( aField->IsMoving() )
{
wxPoint parentPos = aField->GetParentPosition();
VECTOR2I parentPos = aField->GetParentPosition();
m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
m_gal->SetStrokeColor( getRenderColor( aField, LAYER_SCHEMATIC_ANCHOR, drawingShadows ) );
@ -1764,12 +1764,12 @@ void SCH_PAINTER::draw( const SCH_GLOBALLABEL *aLabel, int aLayer )
COLOR4D color = getRenderColor( aLabel, LAYER_GLOBLABEL, drawingShadows );
std::vector<wxPoint> pts;
std::vector<VECTOR2I> pts;
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 ) );
// The text is drawn inside the graphic shape.
@ -1838,12 +1838,12 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer )
color = getRenderColor( aLabel, LAYER_BUS, drawingShadows );
}
std::vector<wxPoint> pts;
std::vector<VECTOR2I> pts;
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 ) );
m_gal->SetIsFill( true );
@ -1886,12 +1886,12 @@ void SCH_PAINTER::draw( const SCH_NETCLASS_FLAG *aLabel, int aLayer )
return;
}
std::vector<wxPoint> pts;
std::vector<VECTOR2I> pts;
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 ) );
m_gal->SetIsFill( false );
@ -2017,7 +2017,7 @@ void SCH_PAINTER::draw( const SCH_NO_CONNECT *aNC, int aLayer )
void SCH_PAINTER::draw( const SCH_BUS_ENTRY_BASE *aEntry, int aLayer )
{
SCH_LAYER_ID layer = aEntry->Type() == SCH_BUS_WIRE_ENTRY_T ? LAYER_WIRE : LAYER_BUS;
SCH_LINE line( wxPoint(), layer );
SCH_LINE line( VECTOR2I(), layer );
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
bool drawingDangling = aLayer == LAYER_DANGLING;

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();
return t.TransformCoordinate( GetLocalPosition() ) + GetParentSymbol()->GetPosition();
@ -323,7 +323,7 @@ const EDA_RECT SCH_PIN::GetBoundingBox() const
}
bool SCH_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool SCH_PIN::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
// When looking for an "exact" hit aAccuracy will be 0 which works poorly if the pin has
// no pin number or name. Give it a floor.

View File

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

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 );
}
wxPoint ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )
VECTOR2I ASchSheetGetSize( ASCH_SHEET_SIZE aSheetSize )
{
// From: https://github.com/vadmium/python-altium/blob/master/format.md#sheet
switch( aSheetSize )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -329,7 +329,7 @@ static void formatBezier( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE
{
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() } )
{
aFormatter->Print( 0, " (xy %s %s)",

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

View File

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

View File

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

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

View File

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

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

View File

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

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 ) :
SCH_ITEM( aParent, SCH_SHEET_T )
{
@ -352,7 +352,7 @@ bool SCH_SHEET::HasPin( const wxString& aName ) const
}
bool SCH_SHEET::doIsConnected( const wxPoint& aPosition ) const
bool SCH_SHEET::doIsConnected( const VECTOR2I& aPosition ) const
{
for( SCH_SHEET_PIN* sheetPin : m_pins )
{
@ -525,7 +525,7 @@ void SCH_SHEET::CleanupSheet()
}
SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
SCH_SHEET_PIN* SCH_SHEET::GetPin( const VECTOR2I& aPosition )
{
for( SCH_SHEET_PIN* pin : m_pins )
{
@ -557,14 +557,14 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
if( IsVerticalOrientation() )
{
m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( -margin, m_size.y ) );
m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( -margin, m_size.y ) );
m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::VERTICAL );
}
else
{
m_fields[ SHEETNAME ].SetTextPos( m_pos + wxPoint( 0, -margin ) );
m_fields[SHEETNAME].SetTextPos( m_pos + VECTOR2I( 0, -margin ) );
m_fields[ SHEETNAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETNAME ].SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
m_fields[ SHEETNAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL );
@ -575,14 +575,14 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
if( IsVerticalOrientation() )
{
m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( m_size.x + margin, m_size.y ) );
m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( m_size.x + margin, m_size.y ) );
m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::VERTICAL );
}
else
{
m_fields[ SHEETFILENAME ].SetTextPos( m_pos + wxPoint( 0, m_size.y + margin ) );
m_fields[SHEETFILENAME].SetTextPos( m_pos + VECTOR2I( 0, m_size.y + margin ) );
m_fields[ SHEETFILENAME ].SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_fields[ SHEETFILENAME ].SetVertJustify( GR_TEXT_V_ALIGN_TOP );
m_fields[ SHEETFILENAME ].SetTextAngle( EDA_ANGLE::HORIZONTAL );
@ -607,7 +607,7 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
{
wxPoint end;
VECTOR2I end;
EDA_RECT box( m_pos, m_size );
int lineWidth = GetPenWidth();
int textLength = 0;
@ -637,10 +637,10 @@ const EDA_RECT SCH_SHEET::GetBoundingBox() const
}
wxPoint SCH_SHEET::GetRotationCenter() const
VECTOR2I SCH_SHEET::GetRotationCenter() const
{
EDA_RECT box( m_pos, m_size );
return (wxPoint)box.GetCenter();
return box.GetCenter();
}
@ -758,7 +758,7 @@ void SCH_SHEET::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
}
void SCH_SHEET::Move( const wxPoint& aMoveVector )
void SCH_SHEET::Move( const VECTOR2I& 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 );
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
// 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 )
retval.push_back( sheetPin->GetPosition() );
@ -994,7 +994,7 @@ BITMAPS SCH_SHEET::GetMenuImage() const
}
bool SCH_SHEET::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool SCH_SHEET::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT rect = GetBodyBoundingBox();
@ -1020,7 +1020,7 @@ bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
{
wxString msg;
wxPoint pos;
VECTOR2I pos;
auto* settings = dynamic_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
bool override = settings ? settings->m_OverrideItemColors : false;
COLOR4D borderColor = GetBorderColor();
@ -1056,10 +1056,10 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
}
void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void SCH_SHEET::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{
wxDC* DC = aSettings->GetPrintDC();
wxPoint pos = m_pos + aOffset;
VECTOR2I pos = m_pos + aOffset;
int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
const auto* settings = dynamic_cast<const KIGFX::SCH_RENDER_SETTINGS*>( aSettings );
bool override = settings && settings->m_OverrideItemColors;

View File

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

View File

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

View File

@ -38,7 +38,7 @@
#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 ),
m_edge( SHEET_SIDE::UNDEFINED )
{
@ -65,7 +65,7 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
}
void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
SCH_HIERLABEL::Print( aSettings, aOffset );
@ -156,7 +156,7 @@ enum SHEET_SIDE SCH_SHEET_PIN::GetSide() const
}
void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
void SCH_SHEET_PIN::ConstrainOnEdge( VECTOR2I Pos )
{
SCH_SHEET* sheet = GetParent();
@ -247,7 +247,7 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
}
void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
{
VECTOR2I pt = GetTextPos();
VECTOR2I delta = pt - aCenter;
@ -300,7 +300,7 @@ void SCH_SHEET_PIN::Rotate( const wxPoint& aCenter )
void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<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
@ -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();

View File

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

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_unit = 1; // In multi unit chip - which unit to draw.
@ -381,7 +381,7 @@ int SCH_SYMBOL::GetUnitCount() const
}
void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{
LIB_SYMBOL_OPTIONS opts;
opts.transform = m_transform;
@ -1484,11 +1484,11 @@ void SCH_SYMBOL::MirrorVertically( int aCenter )
}
void SCH_SYMBOL::Rotate( const wxPoint& aCenter )
void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter )
{
wxPoint prev = m_pos;
VECTOR2I prev = m_pos;
RotatePoint( &m_pos, aCenter, 900 );
RotatePoint( m_pos, aCenter, 900 );
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
@ -1537,7 +1537,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
bool previousState = pin->IsDangling();
pin->SetIsDangling( true );
wxPoint pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos;
VECTOR2I pos = m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos;
for( DANGLING_END_ITEM& each_item : aItemList )
{
@ -1577,7 +1577,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<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 ),
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 )
{
@ -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 )
{
// Calculate the position relative to the symbol.
wxPoint libPosition = aPosition - m_pos;
VECTOR2I libPosition = aPosition - m_pos;
return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
}
@ -1786,7 +1786,7 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
}
bool SCH_SYMBOL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool SCH_SYMBOL::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
{
EDA_RECT bBox = GetBodyBoundingBox();
bBox.Inflate( aAccuracy / 2 );
@ -1814,9 +1814,9 @@ bool SCH_SYMBOL::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
}
bool SCH_SYMBOL::doIsConnected( const wxPoint& aPosition ) const
bool SCH_SYMBOL::doIsConnected( const VECTOR2I& aPosition ) const
{
wxPoint new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos );
VECTOR2I new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos );
for( const auto& pin : m_pins )
{
@ -1884,7 +1884,7 @@ void SCH_SYMBOL::ClearBrightenedPins()
}
bool SCH_SYMBOL::IsPointClickableAnchor( const wxPoint& aPos ) const
bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const
{
for( const std::unique_ptr<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
* moving an object)
*/
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
void SwapData( SCH_ITEM* aItem ) override;
@ -561,7 +561,7 @@ public:
// Geometric transforms (used in block operations):
void Move( const wxPoint& aMoveVector ) override
void Move( const VECTOR2I& aMoveVector ) override
{
if( aMoveVector == wxPoint( 0, 0 ) )
return;
@ -576,7 +576,7 @@ public:
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void Rotate( const wxPoint& aCenter ) override;
void Rotate( const VECTOR2I& aCenter ) override;
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override;
@ -595,7 +595,7 @@ public:
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
const SCH_SHEET_PATH* aPath = nullptr ) override;
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
bool IsConnectable() const override { return true; }
@ -616,7 +616,7 @@ public:
*/
bool IsInNetlist() const;
std::vector<wxPoint> GetConnectionPoints() const override;
std::vector<VECTOR2I> GetConnectionPoints() const override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
@ -627,7 +627,7 @@ public:
* @param aType is the type of symbol library object to find or any if set to TYPE_NOT_INIT.
* @return is the symbol library object if found otherwise NULL.
*/
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
LIB_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT );
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
@ -642,10 +642,10 @@ public:
bool IsReplaceable() const override { return true; }
wxPoint GetPosition() const override { return m_pos; }
void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_pos ); }
VECTOR2I GetPosition() const override { return m_pos; }
void SetPosition( const VECTOR2I& aPosition ) override { Move( aPosition - m_pos ); }
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) const override;
@ -666,16 +666,16 @@ public:
bool GetIncludeOnBoard() const { return m_onBoard; }
void SetIncludeOnBoard( bool aIncludeOnBoard ) { m_onBoard = aIncludeOnBoard; }
bool IsPointClickableAnchor( const wxPoint& aPos ) const override;
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
private:
EDA_RECT doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
bool doIsConnected( const wxPoint& aPosition ) const override;
bool doIsConnected( const VECTOR2I& aPosition ) const override;
void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
wxPoint m_pos;
VECTOR2I m_pos;
LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00.
int m_unit; ///< The unit for multiple part per package symbols.
int m_convert; ///< The alternate body style for symbols that have more than

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

View File

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