Scoop up some more wxPoint instances

This commit is contained in:
Marek Roszko 2022-01-03 20:00:40 -05:00
parent 8e4a4306c7
commit ac715d2e51
29 changed files with 109 additions and 149 deletions

View File

@ -43,7 +43,7 @@ VECTOR2I ARRAY_GRID_OPTIONS::getGridCoords( int n ) const
if( m_reverseNumberingAlternate && ( y % 2 ) )
x = axisSize - x - 1;
wxPoint coords( x, y );
VECTOR2I coords( x, y );
return coords;
}

View File

@ -76,7 +76,7 @@ const EDA_RECT EDA_ITEM::GetBoundingBox() const
{
// return a zero-sized box per default. derived classes should override
// this
return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
return EDA_RECT( VECTOR2I( 0, 0 ), VECTOR2I( 0, 0 ) );
}

View File

@ -65,8 +65,8 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem, TY
m_scalingFactor( aScalingFactor )
{
const VECTOR2I* point_shape = MarkerShapeCorners;
wxPoint start( point_shape->x, point_shape->y );
wxPoint end = start;
VECTOR2I start( point_shape->x, point_shape->y );
VECTOR2I end = start;
for( unsigned ii = 1; ii < CORNERS_COUNT; ii++ )
{

View File

@ -104,7 +104,7 @@ void ORIGIN_VIEWITEM::ViewDraw( int, VIEW* aView ) const
VECTOR2D start( m_position );
VECTOR2D end( m_end );
EDA_RECT clip( wxPoint( start ), wxSize( end.x - start.x, end.y - start.y ) );
EDA_RECT clip( VECTOR2I( start ), VECTOR2I( end.x - start.x, end.y - start.y ) );
clip.Normalize();
double theta = atan2( end.y - start.y, end.x - start.x );
@ -116,8 +116,8 @@ void ORIGIN_VIEWITEM::ViewDraw( int, VIEW* aView ) const
start.y + strokes[ i % 2 ] * sin( theta ) );
// Drawing each segment can be done rounded to ints.
wxPoint segStart( KiROUND( start.x ), KiROUND( start.y ) );
wxPoint segEnd( KiROUND( next.x ), KiROUND( next.y ) );
VECTOR2I segStart( KiROUND( start.x ), KiROUND( start.y ) );
VECTOR2I segEnd( KiROUND( next.x ), KiROUND( next.y ) );
if( ClipLine( &clip, segStart.x, segStart.y, segEnd.x, segEnd.y ) )
break;

View File

@ -98,7 +98,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant ) :
}
SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, bool aFlipY ) :
SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const VECTOR2I& pos, bool aFlipY ) :
SCH_BUS_ENTRY_BASE( SCH_BUS_BUS_ENTRY_T, pos, aFlipY )
{
m_layer = LAYER_BUS;

View File

@ -194,7 +194,7 @@ public:
class SCH_BUS_BUS_ENTRY : public SCH_BUS_ENTRY_BASE
{
public:
SCH_BUS_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), bool aFlipY = false );
SCH_BUS_BUS_ENTRY( const VECTOR2I& pos = VECTOR2I( 0, 0 ), bool aFlipY = false );
~SCH_BUS_BUS_ENTRY() { }

View File

@ -911,7 +911,7 @@ VECTOR2I SCH_FIELD::GetPosition() const
VECTOR2I SCH_FIELD::GetParentPosition() const
{
return m_parent ? m_parent->GetPosition() : wxPoint( 0, 0 );
return m_parent ? m_parent->GetPosition() : VECTOR2I( 0, 0 );
}

View File

@ -196,7 +196,7 @@ public:
bool IsReplaceable() const override;
wxPoint GetLibPosition() const { return (wxPoint)EDA_TEXT::GetTextPos(); }
VECTOR2I GetLibPosition() const { return EDA_TEXT::GetTextPos(); }
VECTOR2I GetPosition() const override;
void SetPosition( const VECTOR2I& aPosition ) override;

View File

@ -39,7 +39,7 @@
#include <advanced_config.h>
SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
SCH_LINE::SCH_LINE( const VECTOR2I& pos, int layer ) :
SCH_ITEM( nullptr, SCH_LINE_T )
{
m_start = pos;
@ -200,7 +200,7 @@ const EDA_RECT SCH_LINE::GetBoundingBox() const
int xmax = std::max( m_start.x, m_end.x ) + width + extra;
int ymax = std::max( m_start.y, m_end.y ) + width + extra;
EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin, ymax - ymin ) );
EDA_RECT ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
return ret;
}

View File

@ -39,10 +39,10 @@ class SCH_LINE : public SCH_ITEM
public:
static const enum wxPenStyle PenStyle[];
SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
SCH_LINE( const VECTOR2I& pos = VECTOR2I( 0, 0 ), int layer = LAYER_NOTES );
SCH_LINE( const VECTOR2D& pos, int layer = LAYER_NOTES ) :
SCH_LINE( wxPoint( pos.x, pos.y ), layer )
SCH_LINE( VECTOR2I( pos.x, pos.y ), layer )
{}
SCH_LINE( const SCH_LINE& aLine );

View File

@ -77,7 +77,7 @@ wxString SCH_MARKER::Serialize() const
SCH_MARKER* SCH_MARKER::Deserialize( const wxString& data )
{
wxArrayString props = wxSplit( data, '|' );
wxPoint markerPos( (int) strtol( props[1].c_str(), nullptr, 10 ),
VECTOR2I markerPos( (int) strtol( props[1].c_str(), nullptr, 10 ),
(int) strtol( props[2].c_str(), nullptr, 10 ) );
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( props[0] );

View File

@ -113,9 +113,9 @@ ASCH_SYMBOL::ASCH_SYMBOL( const std::map<wxString, wxString>& aProps )
componentdescription = ALTIUM_PARSER::ReadString( aProps, "COMPONENTDESCRIPTION", "" );
orientation = ALTIUM_PARSER::ReadInt( aProps, "ORIENTATION", 0 );
isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
isMirrored = ALTIUM_PARSER::ReadBool( aProps, "ISMIRRORED", false );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
partcount = ALTIUM_PARSER::ReadInt( aProps, "PARTCOUNT", 0 );
displaymodecount = ALTIUM_PARSER::ReadInt( aProps, "DISPLAYMODECOUNT", 0 );
@ -164,7 +164,7 @@ ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProps )
int xfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.X_FRAC", 0 );
int y = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y", 0 );
int yfrac = ALTIUM_PARSER::ReadInt( aProps, "LOCATION.Y_FRAC", 0 );
location = wxPoint( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
location = VECTOR2I( Altium2KiCadUnit( x, xfrac ), -Altium2KiCadUnit( y, yfrac ) );
int p = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH", 0 );
int pfrac = ALTIUM_PARSER::ReadInt( aProps, "PINLENGTH_FRAC", 0 );
@ -199,8 +199,8 @@ ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProps )
break;
}
kicadLocation = wxPoint( Altium2KiCadUnit( kicadX, kicadXfrac ),
-Altium2KiCadUnit( kicadY, kicadYfrac ) );
kicadLocation = VECTOR2I( Altium2KiCadUnit( kicadX, kicadXfrac ),
-Altium2KiCadUnit( kicadY, kicadYfrac ) );
}
@ -211,8 +211,8 @@ ASCH_LABEL::ASCH_LABEL( const std::map<wxString, wxString>& aProps )
ownerindex = ReadOwnerIndex( aProps );
ownerpartid = ReadOwnerPartId( aProps );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
@ -232,8 +232,8 @@ ASCH_TEXT_FRAME::ASCH_TEXT_FRAME( const std::map<wxString, wxString>& aProps )
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NOTE
|| ReadRecord( aProps ) == ALTIUM_SCH_RECORD::TEXT_FRAME );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
size = wxSize( ReadKiCadUnitFrac( aProps, "CORNER.X" ) - location.x,
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) - location.y );
@ -341,10 +341,10 @@ ASCH_ROUND_RECTANGLE::ASCH_ROUND_RECTANGLE( const std::map<wxString, wxString>&
ownerpartid = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
bottomLeft = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
topRight = wxPoint( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
bottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
topRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
cornerradius = wxSize( ReadKiCadUnitFrac( aProps, "CORNERXRADIUS" ),
-ReadKiCadUnitFrac( aProps, "CORNERYRADIUS" ) );
@ -366,8 +366,8 @@ ASCH_ARC::ASCH_ARC( const std::map<wxString, wxString>& aProps )
ownerpartid = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
center = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
center = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
radius = ReadKiCadUnitFrac( aProps, "RADIUS" );
startAngle = ALTIUM_PARSER::ReadDouble( aProps, "STARTANGLE", 0 );
@ -385,10 +385,10 @@ ASCH_LINE::ASCH_LINE( const std::map<wxString, wxString>& aProps )
ownerpartid = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
point1 = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
point2 = wxPoint( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
point1 = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
point2 = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
}
@ -402,10 +402,10 @@ ASCH_RECTANGLE::ASCH_RECTANGLE( const std::map<wxString, wxString>& aProps )
ownerpartid = ReadOwnerPartId( aProps );
ownerpartdisplaymode = ALTIUM_PARSER::ReadInt( aProps, "OWNERPARTDISPLAYMODE", 0 );
bottomLeft = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
topRight = wxPoint( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
bottomLeft = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
topRight = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
lineWidth = ReadKiCadUnitFrac( aProps, "LINEWIDTH" );
isSolid = ALTIUM_PARSER::ReadBool( aProps, "ISSOLID", false );
@ -420,8 +420,8 @@ ASCH_SHEET_SYMBOL::ASCH_SHEET_SYMBOL( const std::map<wxString, wxString>& aProps
{
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::SHEET_SYMBOL );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
size = wxSize( ReadKiCadUnitFrac( aProps, "XSIZE" ),
ReadKiCadUnitFrac( aProps, "YSIZE" ) );
@ -457,8 +457,8 @@ ASCH_POWER_PORT::ASCH_POWER_PORT( const std::map<wxString, wxString>& aProps )
ownerpartid = ReadOwnerPartId( aProps );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
@ -476,8 +476,8 @@ ASCH_PORT::ASCH_PORT( const std::map<wxString, wxString>& aProps )
ownerpartid = ReadOwnerPartId( aProps );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
name = ALTIUM_PARSER::ReadString( aProps, "NAME", "" );
harnessType = ALTIUM_PARSER::ReadString( aProps, "HARNESSTYPE", "" );
@ -494,8 +494,8 @@ ASCH_NO_ERC::ASCH_NO_ERC( const std::map<wxString, wxString>& aProps )
{
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::NO_ERC );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
isActive = ALTIUM_PARSER::ReadBool( aProps, "ISACTIVE", true );
supressAll = ALTIUM_PARSER::ReadInt( aProps, "SUPPRESSALL", true );
@ -508,8 +508,8 @@ ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps )
text = ALTIUM_PARSER::ReadString( aProps, "TEXT", "" );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
@ -560,8 +560,8 @@ ASCH_JUNCTION::ASCH_JUNCTION( const std::map<wxString, wxString>& aProps )
ownerpartid = ReadOwnerPartId( aProps );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
}
@ -574,10 +574,10 @@ ASCH_IMAGE::ASCH_IMAGE( const std::map<wxString, wxString>& aProps )
filename = ALTIUM_PARSER::ReadString( aProps, "FILENAME", "" );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
corner = wxPoint( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
embedimage = ALTIUM_PARSER::ReadBool( aProps, "EMBEDIMAGE", false );
keepaspect = ALTIUM_PARSER::ReadBool( aProps, "KEEPASPECT", false );
@ -655,8 +655,8 @@ ASCH_SHEET_NAME::ASCH_SHEET_NAME( const std::map<wxString, wxString>& aProps )
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
}
@ -674,8 +674,8 @@ ASCH_FILE_NAME::ASCH_FILE_NAME( const std::map<wxString, wxString>& aProps )
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
isHidden = ALTIUM_PARSER::ReadBool( aProps, "ISHIDDEN", false );
}
@ -697,8 +697,8 @@ ASCH_DESIGNATOR::ASCH_DESIGNATOR( const std::map<wxString, wxString>& aProps )
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
}
@ -725,10 +725,10 @@ ASCH_BUS_ENTRY::ASCH_BUS_ENTRY( const std::map<wxString, wxString>& aProps )
{
wxASSERT( ReadRecord( aProps ) == ALTIUM_SCH_RECORD::BUS_ENTRY );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
corner = wxPoint( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
corner = VECTOR2I( ReadKiCadUnitFrac( aProps, "CORNER.X" ),
-ReadKiCadUnitFrac( aProps, "CORNER.Y" ) );
}
@ -739,8 +739,8 @@ ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProps )
ownerindex = ReadOwnerIndex( aProps );
ownerpartid = ReadOwnerPartId( aProps );
location = wxPoint( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );

View File

@ -255,7 +255,7 @@ void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
RotatePoint( pt, aCenter, 900 );
SHEET_SIDE oldSide = GetSide();
ConstrainOnEdge( (wxPoint)pt );
ConstrainOnEdge( pt );
// If the new side is the same as the old side, instead mirror across the center of that side.
if( GetSide() == oldSide )
@ -264,12 +264,12 @@ void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
{
case SHEET_SIDE::TOP:
case SHEET_SIDE::BOTTOM:
SetTextPos( wxPoint( aCenter.x - delta.x, GetTextPos().y ) );
SetTextPos( VECTOR2I( aCenter.x - delta.x, GetTextPos().y ) );
break;
case SHEET_SIDE::LEFT:
case SHEET_SIDE::RIGHT:
SetTextPos( wxPoint( GetTextPos().x, aCenter.y - delta.y ) );
SetTextPos( VECTOR2I( GetTextPos().x, aCenter.y - delta.y ) );
break;
default:
@ -284,12 +284,12 @@ void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
{
case SHEET_SIDE::TOP:
case SHEET_SIDE::BOTTOM:
SetTextPos( wxPoint( aCenter.x + delta.x, GetTextPos().y ) );
SetTextPos( VECTOR2I( aCenter.x + delta.x, GetTextPos().y ) );
break;
case SHEET_SIDE::LEFT:
case SHEET_SIDE::RIGHT:
SetTextPos( wxPoint( GetTextPos().x, aCenter.y + delta.y ) );
SetTextPos( VECTOR2I( GetTextPos().x, aCenter.y + delta.y ) );
break;
default:
@ -323,7 +323,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
{
DANGLING_END_ITEM item( SHEET_LABEL_END, this, (wxPoint)GetTextPos() );
DANGLING_END_ITEM item( SHEET_LABEL_END, this, GetTextPos() );
aItemList.push_back( item );
}

View File

@ -79,8 +79,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 );
@ -98,7 +98,7 @@ static LIB_SYMBOL* dummy()
SCH_SYMBOL::SCH_SYMBOL() :
SCH_ITEM( nullptr, SCH_SYMBOL_T )
{
Init( wxPoint( 0, 0 ) );
Init( VECTOR2I( 0, 0 ) );
}
@ -785,7 +785,7 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b
if( !schField )
{
wxString fieldName = libField->GetCanonicalName();
SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName );
SCH_FIELD newField( VECTOR2I( 0, 0 ), GetFieldCount(), this, fieldName );
schField = AddField( newField );
}
}
@ -793,7 +793,7 @@ void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, b
if( aUpdateStyle )
{
schField->ImportValues( *libField );
schField->SetTextPos( (VECTOR2I)m_pos + libField->GetTextPos() );
schField->SetTextPos( m_pos + libField->GetTextPos() );
}
if( id == REFERENCE_FIELD && aPath )
@ -1579,7 +1579,7 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
{
wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, VECTOR2I( 0, 0 ),
wxT( "Cannot get physical position of pin." ) );
return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_pos;

View File

@ -39,13 +39,6 @@ bool TRANSFORM::operator==( const TRANSFORM& aTransform ) const
}
wxPoint TRANSFORM::TransformCoordinate( const wxPoint& aPoint ) const
{
return wxPoint( ( x1 * aPoint.x ) + ( y1 * aPoint.y ),
( x2 * aPoint.x ) + ( y2 * aPoint.y ) );
}
VECTOR2I TRANSFORM::TransformCoordinate( const VECTOR2I& aPoint ) const
{
return VECTOR2I( ( x1 * aPoint.x ) + ( y1 * aPoint.y ), ( x2 * aPoint.x ) + ( y2 * aPoint.y ) );

View File

@ -61,16 +61,6 @@ public:
bool operator!=( const TRANSFORM& aTransform ) const { return !( *this == aTransform ); }
/**
* Calculate a new coordinate according to the mirror/rotation transform.
* Useful to calculate actual coordinates of a point
* from coordinates relative to a symbol.
* which are given for a non rotated, non mirrored item
* @param aPoint = The position to transform
* @return The transformed coordinate.
*/
wxPoint TransformCoordinate( const wxPoint& aPoint ) const;
/**
* Calculate a new coordinate according to the mirror/rotation transform.
* Useful to calculate actual coordinates of a point

View File

@ -44,7 +44,7 @@ SEARCH_RESULT GERBER_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
void GERBER_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
const wxPoint& aRefPos/*, const COLLECTORS_GUIDE& aGuide*/ )
const VECTOR2I& aRefPos /*, const COLLECTORS_GUIDE& aGuide*/ )
{
Empty(); // empty the collection, primary criteria list

View File

@ -79,11 +79,11 @@ public:
* @param aScanList A list of KICAD_Ts with a terminating EOT, that specs
* what is to be collected and the priority order of the resultant
* collection in "m_list".
* @param aRefPos A wxPoint to use in hit-testing.
* @param aRefPos A VECTOR2I to use in hit-testing.
* @param aGuide The COLLECTORS_GUIDE to use in collecting items.
*/
void Collect( EDA_ITEM* aItem, const KICAD_T aScanList[],
const wxPoint& aRefPos /*, const COLLECTORS_GUIDE& aGuide */ );
const VECTOR2I& aRefPos /*, const COLLECTORS_GUIDE& aGuide */ );
protected:
/**

View File

@ -170,7 +170,7 @@ void GERBER_FILE_IMAGE::ResetDefaultValues()
m_MD5_value.Empty(); // MD5 value found in a %TF.MD5 command
m_PartString.Empty(); // string found in a %TF.Part command
m_hasNegativeItems = -1; // set to uninitialized
m_ImageJustifyOffset = wxPoint(0,0); // Image justify Offset
m_ImageJustifyOffset = VECTOR2I( 0, 0 ); // Image justify Offset
m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
m_GerbMetric = false; // false = Inches (default), true = metric
@ -308,7 +308,7 @@ void GERBER_FILE_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
continue;
GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem );
wxPoint move_vector;
VECTOR2I move_vector;
move_vector.x = scaletoIU( ii * GetLayerParams().m_StepForRepeat.x,
GetLayerParams().m_StepForRepeatMetric );
move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,

View File

@ -582,9 +582,9 @@ bool GERBER_FILE_IMAGE::ExecuteRS274XCommand( int aCommand, char* aBuff,
break;
case IMAGE_JUSTIFY: // Command IJAnBn*
m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
m_ImageJustifyOffset = wxPoint(0,0); // Image Justify Offset on XY axis (default = 0,0)
m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
m_ImageJustifyOffset = VECTOR2I( 0, 0 ); // Image Justify Offset on XY axis (default = 0,0)
while( *aText && *aText != '*' )
{
// IJ command is (for A or B axis) AC or AL or A<coordinate>

View File

@ -39,8 +39,6 @@ public:
BEZIER_POLY( const VECTOR2I& aStart, const VECTOR2I& aCtrl1,
const VECTOR2I& aCtrl2, const VECTOR2I& aEnd );
BEZIER_POLY( const std::vector<wxPoint>& aControlPoints );
BEZIER_POLY( const std::vector<VECTOR2I>& aControlPoints );
BEZIER_POLY( const std::vector<VECTOR2D>& aControlPoints )
@ -58,7 +56,6 @@ public:
* (the last point is always generated)
* aMaxSegCount is the max number of segments created
*/
void GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen = 0, int aMaxSegCount = 32 );
void GetPoly( std::vector<VECTOR2I>& aOutput, int aMinSegLen = 0, int aMaxSegCount = 32 );
void GetPoly( std::vector<VECTOR2D>& aOutput, double aMinSegLen = 0.0, int aMaxSegCount = 32 );

View File

@ -28,17 +28,8 @@
#include <bezier_curves.h>
#include <math/vector2d.h> // for VECTOR2D, operator*, VECTOR2
#include <wx/debug.h> // for wxASSERT
#include <wx/gdicmn.h> // for wxPoint
BEZIER_POLY::BEZIER_POLY( const std::vector<wxPoint>& aControlPoints )
{
for( unsigned ii = 0; ii < aControlPoints.size(); ++ii )
m_ctrlPts.emplace_back( VECTOR2D( aControlPoints[ii] ) );
m_minSegLen = 0.0;
}
BEZIER_POLY::BEZIER_POLY( const VECTOR2I& aStart, const VECTOR2I& aCtrl1,
const VECTOR2I& aCtrl2, const VECTOR2I& aEnd )
{
@ -51,17 +42,6 @@ BEZIER_POLY::BEZIER_POLY( const VECTOR2I& aStart, const VECTOR2I& aCtrl1,
}
void BEZIER_POLY::GetPoly( std::vector<wxPoint>& aOutput, int aMinSegLen, int aMaxSegCount )
{
aOutput.clear();
std::vector<VECTOR2D> buffer;
GetPoly( buffer, double( aMinSegLen ), aMaxSegCount );
for( unsigned ii = 0; ii < buffer.size(); ++ii )
aOutput.emplace_back( wxPoint( int( buffer[ii].x ), int( buffer[ii].y ) ) );
}
BEZIER_POLY::BEZIER_POLY( const std::vector<VECTOR2I>& aControlPoints )
{
for( unsigned ii = 0; ii < aControlPoints.size(); ++ii )

View File

@ -151,7 +151,7 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
// end point is the coordinate relative to aStart
VECTOR2I endp = aEnd - aStart;
VECTOR2I startp = aStart;
wxPoint corner;
VECTOR2I corner;
SHAPE_POLY_SET polyshape;
polyshape.NewOutline();
@ -176,26 +176,26 @@ void TransformOvalToPolygon( SHAPE_POLY_SET& aCornerBuffer, const VECTOR2I& aSta
for( int angle = 0; angle < 1800; angle += delta )
{
corner = wxPoint( 0, radius );
RotatePoint( &corner, angle );
corner = VECTOR2I( 0, radius );
RotatePoint( corner, angle );
corner.x += seg_len;
polyshape.Append( corner.x, corner.y );
}
// Finish arc:
corner = wxPoint( seg_len, -radius );
corner = VECTOR2I( seg_len, -radius );
polyshape.Append( corner.x, corner.y );
// add left rounded end:
for( int angle = 0; angle < 1800; angle += delta )
{
corner = wxPoint( 0, -radius );
RotatePoint( &corner, angle );
corner = VECTOR2I( 0, -radius );
RotatePoint( corner, angle );
polyshape.Append( corner.x, corner.y );
}
// Finish arc:
corner = wxPoint( 0, radius );
corner = VECTOR2I( 0, radius );
polyshape.Append( corner.x, corner.y );
// Now trim the edges of the polygonal shape which will be slightly outside the

View File

@ -71,9 +71,9 @@ public:
* @return the board coordinate corresponding to the routing matrix origin ( board
* coordinate offset ).
*/
wxPoint GetBrdCoordOrigin()
VECTOR2I GetBrdCoordOrigin()
{
return (wxPoint)m_BrdBox.GetOrigin();
return m_BrdBox.GetOrigin();
}
/**

View File

@ -187,7 +187,7 @@ static bool sortFootprintsbySheetPath( FOOTPRINT* ref, FOOTPRINT* compare );
* @param aSpreadAreaPosition the position of the upper left corner of the
* area allowed to spread footprints
*/
void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadAreaPosition )
void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, VECTOR2I aSpreadAreaPosition )
{
// Build candidate list
// calculate also the area needed by these footprints
@ -315,8 +315,8 @@ void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadArea
for( unsigned it = 0; it < vecSubRects.size(); ++it )
{
TSubRect& srect = vecSubRects[it];
wxPoint pos( srect.x*scale, srect.y*scale );
wxSize size( srect.w*scale, srect.h*scale );
VECTOR2I pos( srect.x * scale, srect.y * scale );
VECTOR2I size( srect.w * scale, srect.h * scale );
// Avoid too large coordinates: Overlapping components
// are better than out of screen components

View File

@ -905,7 +905,7 @@ public:
/**
* Find a pad \a aPosition on \a aLayer.
*
* @param aPosition A wxPoint object containing the position to hit test.
* @param aPosition A VECTOR2I object containing the position to hit test.
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a PAD object if found or NULL if not found.
*/
@ -929,7 +929,7 @@ public:
* <p>
* The fast search method only works if the pad list has already been built.
* </p>
* @param aPosition A wxPoint object containing the position to hit test.
* @param aPosition A VECTOR2I object containing the position to hit test.
* @param aLayerMask A layer or layers to mask the hit test.
* @return A pointer to a PAD object if found or NULL if not found.
*/
@ -945,7 +945,7 @@ public:
* </p>
* @note The normal pad list is sorted by increasing netcodes.
* @param aPadList is the list of pads candidates (a std::vector<PAD*>).
* @param aPosition A wxPoint object containing the position to test.
* @param aPosition A VECTOR2I object containing the position to test.
* @param aLayerMask A layer or layers to mask the hit test.
* @return a PAD object pointer to the connected pad.
*/
@ -997,7 +997,7 @@ public:
* active layer is returned. The distance is calculated via manhattan distance from
* the center of the bounding rectangle to \a aPosition.
*
* @param aPosition A wxPoint object containing the position to test.
* @param aPosition A VECTOR2I object containing the position to test.
* @param aActiveLayer Layer to test.
* @param aVisibleOnly Search only the visible layers if true.
* @param aIgnoreLocked Ignore locked footprints when true.

View File

@ -802,7 +802,7 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
// therefore, we check HitTest both directions A->B & B->A
for( int i = 0; i < aCandidate->AnchorCount(); ++i )
{
if( parentB->HitTest( wxPoint( aCandidate->GetAnchor( i ) ), accuracyA ) )
if( parentB->HitTest( VECTOR2I( aCandidate->GetAnchor( i ) ), accuracyA ) )
{
m_item->Connect( aCandidate );
aCandidate->Connect( m_item );
@ -812,7 +812,7 @@ bool CN_VISITOR::operator()( CN_ITEM* aCandidate )
for( int i = 0; i < m_item->AnchorCount(); ++i )
{
if( parentA->HitTest( wxPoint( m_item->GetAnchor( i ) ), accuracyB ) )
if( parentA->HitTest( VECTOR2I( m_item->GetAnchor( i ) ), accuracyB ) )
{
m_item->Connect( aCandidate );
aCandidate->Connect( m_item );

View File

@ -347,8 +347,8 @@ void CONNECTIVITY_DATA::ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>&
RN_DYNAMIC_LINE l;
// Use the parents' positions
l.a = nodeA->Parent()->GetPosition() + (wxPoint) aInternalOffset;
l.b = nodeB->Parent()->GetPosition() + (wxPoint) aInternalOffset;
l.a = nodeA->Parent()->GetPosition() + aInternalOffset;
l.b = nodeB->Parent()->GetPosition() + aInternalOffset;
l.netCode = 0;
m_dynamicRatsnest.push_back( l );
}

View File

@ -49,7 +49,7 @@ using namespace std::placeholders;
#include <wx/msgdlg.h>
extern void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, wxPoint aSpreadAreaPosition );
extern void SpreadFootprints( std::vector<FOOTPRINT*>* aFootprints, VECTOR2I aSpreadAreaPosition );
bool PCB_EDIT_FRAME::ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist,