Continue the war on wxPoint

This commit is contained in:
Marek Roszko 2022-01-10 19:49:49 -05:00
parent e67b6bc402
commit fcfe42d67c
25 changed files with 118 additions and 132 deletions

View File

@ -128,7 +128,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
{
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
std::vector<wxPoint> points;
std::vector<VECTOR2I> points;
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
{

View File

@ -162,19 +162,6 @@ public:
SHAPE_LINE_CHAIN( const std::vector<int>& aV );
SHAPE_LINE_CHAIN( const std::vector<wxPoint>& aV, bool aClosed = false ) :
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
m_closed( aClosed ),
m_width( 0 )
{
m_points.reserve( aV.size() );
for( auto pt : aV )
m_points.emplace_back( pt.x, pt.y );
m_shapes = std::vector<std::pair<ssize_t, ssize_t>>( aV.size(), SHAPES_ARE_PT );
}
SHAPE_LINE_CHAIN( const std::vector<VECTOR2I>& aV, bool aClosed = false ) :
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
m_closed( aClosed ),

View File

@ -482,9 +482,9 @@ public:
return DRC_LAYER( m_tree[int( aLayer )] );
}
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const wxPoint& aPoint, int aAccuracy = 0 ) const
DRC_LAYER Overlapping( PCB_LAYER_ID aLayer, const VECTOR2I& aPoint, int aAccuracy = 0 ) const
{
EDA_RECT rect( aPoint, wxSize( 0, 0 ) );
EDA_RECT rect( aPoint, VECTOR2I( 0, 0 ) );
rect.Inflate( aAccuracy );
return DRC_LAYER( m_tree[int( aLayer )], rect );
}

View File

@ -252,7 +252,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
// Plot title "Info"
wxString Text = wxT( "Drill Map:" );
plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, EDA_ANGLE::HORIZONTAL,
plotter->Text( VECTOR2I( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, EDA_ANGLE::HORIZONTAL,
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
@ -286,7 +286,7 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
int y = KiROUND( plotY + charSize * charScale );
plotter->SetCurrentLineWidth( getMarkerBestPenSize( plot_diam ) );
plotter->Marker( wxPoint( x, y ), plot_diam, ii );
plotter->Marker( VECTOR2I( x, y ), plot_diam, ii );
plotter->SetCurrentLineWidth( -1 );
// List the diameter of each drill in mm and inches.
@ -313,8 +313,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
if( tool.m_Hole_NotPlated )
msg += wxT( " (not plated)" );
plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, EDA_ANGLE::HORIZONTAL,
wxSize( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
plotter->Text( VECTOR2I( plotX, y ), COLOR4D::UNSPECIFIED, msg, EDA_ANGLE::HORIZONTAL,
VECTOR2I( KiROUND( charSize * charScale ), KiROUND( charSize * charScale ) ),
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, TextWidth, false, false );
intervalle = KiROUND( ( ( charSize * charScale ) + TextWidth ) * 1.2 );

View File

@ -127,7 +127,7 @@ void GERBER_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, b
#if !FLASH_OVAL_HOLE
// A helper class to transform an oblong hole to a segment
static void convertOblong2Segment( wxSize aSize, double aOrient, wxPoint& aStart, wxPoint& aEnd );
static void convertOblong2Segment( wxSize aSize, double aOrient, VECTOR2I& aStart, VECTOR2I& aEnd );
#endif
@ -235,7 +235,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
hole_descr.m_Hole_Orient, FILLED, &gbr_metadata );
#else
// Use routing for oblong hole (Slots)
wxPoint start, end;
VECTOR2I start, end;
convertOblong2Segment( hole_descr.m_Hole_Size, hole_descr.m_Hole_Orient, start, end );
int width = std::min( hole_descr.m_Hole_Size.x, hole_descr.m_Hole_Size.y );
@ -261,7 +261,7 @@ int GERBER_WRITER::createDrillFile( wxString& aFullFilename, bool aIsNpth,
#if !FLASH_OVAL_HOLE
void convertOblong2Segment( wxSize aSize, double aOrient, wxPoint& aStart, wxPoint& aEnd )
void convertOblong2Segment( wxSize aSize, double aOrient, VECTOR2I& aStart, VECTOR2I& aEnd )
{
wxSize size( aSize );
double orient = aOrient;
@ -280,10 +280,10 @@ void convertOblong2Segment( wxSize aSize, double aOrient, wxPoint& aStart, wxPoi
int cx = 0;
int cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
aStart = wxPoint( cx, cy );
aStart = VECTOR2I( cx, cy );
cx = 0; cy = -deltaxy / 2;
RotatePoint( &cx, &cy, orient );
aEnd = wxPoint( cx, cy );
aEnd = VECTOR2I( cx, cy );
}
#endif

View File

@ -713,10 +713,10 @@ EDA_RECT FOOTPRINT::GetFpPadsLocalBbox() const
// Create such a image:
FOOTPRINT dummy( *this );
dummy.SetPosition( wxPoint( 0, 0 ) );
dummy.SetPosition( VECTOR2I( 0, 0 ) );
if( dummy.IsFlipped() )
dummy.Flip( wxPoint( 0, 0 ) , false );
dummy.Flip( VECTOR2I( 0, 0 ), false );
if( dummy.GetOrientation() )
dummy.SetOrientation( 0 );
@ -2310,7 +2310,7 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
// as their hole:
if( aSkipNPTHPadsWihNoCopper && pad->GetAttribute() == PAD_ATTRIB::NPTH )
{
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == wxPoint( 0, 0 ) )
if( pad->GetDrillSize() == pad->GetSize() && pad->GetOffset() == VECTOR2I( 0, 0 ) )
{
switch( pad->GetShape() )
{

View File

@ -525,7 +525,7 @@ public:
/**
* Get a pad at \a aPosition on \a aLayerMask in the footprint.
*
* @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 otherwise NULL.
*/

View File

@ -88,7 +88,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
newFootprint.SetLocked( false );
// locate the reference point at (0, 0) in the copied items
newFootprint.Move( wxPoint( -refPoint.x, -refPoint.y ) );
newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
}
@ -221,7 +221,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
PAD* pad = (PAD*) item->Clone();
footprint->SetPosition( pad->GetPosition() );
pad->SetPos0( wxPoint() );
pad->SetPos0( VECTOR2I() );
footprint->Add( pad );
copy = footprint;
}

View File

@ -37,7 +37,6 @@
class wxDC;
class wxPoint;
class LINE_READER;
class EDA_DRAW_FRAME;
class PAD;

View File

@ -392,7 +392,7 @@ public:
*/
double GetAngle() const
{
wxPoint delta( m_end - m_start );
VECTOR2I delta( m_end - m_start );
return atan2( (double)delta.y, (double)delta.x );
}

View File

@ -97,7 +97,7 @@ wxString PCB_MARKER::Serialize() const
PCB_MARKER* PCB_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<DRC_ITEM> drcItem = DRC_ITEM::Create( props[0] );

View File

@ -1716,8 +1716,8 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer )
// Scale by zoom a bit, but not too much
int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
int penWidth = textSize / 10;
wxPoint textOffset = wxPoint( width.x / 2, - KiROUND( textSize * 0.5 ) );
wxPoint titleHeight = wxPoint( 0, KiROUND( textSize * 2.0 ) );
VECTOR2I textOffset = VECTOR2I( width.x / 2, -KiROUND( textSize * 0.5 ) );
VECTOR2I titleHeight = VECTOR2I( 0, KiROUND( textSize * 2.0 ) );
if( PrintableCharCount( name ) * textSize < bbox.GetWidth() )
{

View File

@ -143,7 +143,7 @@ VECTOR2I PCB_SHAPE::getParentPosition() const
if( GetParentFootprint() )
return GetParentFootprint()->GetPosition();
else
return wxPoint( 0, 0 );
return VECTOR2I( 0, 0 );
}

View File

@ -417,7 +417,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// Build the dummy pad outline with coordinates relative to the pad position
// and orientation 0. The actual pos and rotation will be taken in account
// later by the plot function
dummy.SetPosition( wxPoint( 0, 0 ) );
dummy.SetPosition( VECTOR2I( 0, 0 ) );
dummy.SetOrientation( 0 );
SHAPE_POLY_SET outline;
int maxError = aBoard->GetDesignSettings().m_MaxError;
@ -584,7 +584,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
double start_angle = arc->GetArcAngleStart();
double end_angle = start_angle + arc->GetAngle();
aPlotter->ThickArc( wxPoint( center.x, center.y ), -end_angle, -start_angle,
aPlotter->ThickArc( VECTOR2I( center.x, center.y ), -end_angle, -start_angle,
radius, width, plotMode, &gbr_metadata );
}
else
@ -719,7 +719,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
outlines.Simplify( SHAPE_POLY_SET::PM_FAST );
// Plot outlines
std::vector<wxPoint> cornerList;
std::vector<VECTOR2I> cornerList;
// Now we have one or more basic polygons: plot each polygon
for( int ii = 0; ii < outlines.OutlineCount(); ii++ )
@ -758,8 +758,8 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
{
// Note: small drill marks have no significance when applied to slots
const SHAPE_SEGMENT* seg = pad->GetEffectiveHoleShape();
aPlotter->ThickSegment( (wxPoint) seg->GetSeg().A,
(wxPoint) seg->GetSeg().B,
aPlotter->ThickSegment( seg->GetSeg().A,
seg->GetSeg().B,
seg->GetWidth(), SKETCH, nullptr );
}
}

View File

@ -977,7 +977,7 @@ AREGION6::AREGION6( ALTIUM_PARSER& aReader, bool aExtendedVertices )
{
int32_t x = ALTIUM_PARSER::ConvertToKicadUnit( aReader.Read<double>() );
int32_t y = ALTIUM_PARSER::ConvertToKicadUnit( -aReader.Read<double>() );
holes.at( k ).emplace_back( wxPoint( x, y ) );
holes.at( k ).emplace_back( VECTOR2I( x, y ) );
}
}
}

View File

@ -2380,7 +2380,7 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
shape->SetFilled( true );
shape->SetLayer( klayer );
shape->SetStart( aElem.position );
shape->SetEnd( aElem.position - wxPoint( 0, aElem.topsize.x / 4 ) );
shape->SetEnd( aElem.position - VECTOR2I( 0, aElem.topsize.x / 4 ) );
shape->SetStroke( STROKE_PARAMS( aElem.topsize.x / 2, PLOT_DASH_TYPE::SOLID ) );
HelperShapeSetLocalCoord( shape, aElem.component );
}
@ -2422,10 +2422,10 @@ void ALTIUM_PCB::HelperParsePad6NonCopper( const APAD6& aElem )
shape->SetLayer( klayer );
shape->SetStroke( STROKE_PARAMS( 0 ) );
VECTOR2I p11 = aElem.position + wxPoint( aElem.topsize.x / 2, aElem.topsize.y / 2 );
VECTOR2I p12 = aElem.position + wxPoint( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
VECTOR2I p22 = aElem.position + wxPoint( -aElem.topsize.x / 2, -aElem.topsize.y / 2 );
VECTOR2I p21 = aElem.position + wxPoint( -aElem.topsize.x / 2, aElem.topsize.y / 2 );
VECTOR2I p11 = aElem.position + VECTOR2I( aElem.topsize.x / 2, aElem.topsize.y / 2 );
VECTOR2I p12 = aElem.position + VECTOR2I( aElem.topsize.x / 2, -aElem.topsize.y / 2 );
VECTOR2I p22 = aElem.position + VECTOR2I( -aElem.topsize.x / 2, -aElem.topsize.y / 2 );
VECTOR2I p21 = aElem.position + VECTOR2I( -aElem.topsize.x / 2, aElem.topsize.y / 2 );
int chamfer = std::min( aElem.topsize.x, aElem.topsize.y ) / 4;
VECTOR2I chamferX( chamfer, 0 );

View File

@ -121,7 +121,7 @@ private:
std::vector<LAYER_ID> m_powerPlaneLayers; ///< List of layers that are marked as
///< power plane in CADSTAR. This is used
///< by "loadtemplates"
wxPoint m_designCenter; ///< Used for calculating the required
VECTOR2I m_designCenter; ///< Used for calculating the required
///< offset to apply to the Cadstar design
///< so that it fits in KiCad canvas
std::set<HATCHCODE_ID> m_hatchcodesTested; ///< Used by checkAndLogHatchCode() to

View File

@ -134,7 +134,7 @@ BOARD* CADSTAR_PCB_ARCHIVE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppe
int desired_x = ( w - bbbox.GetWidth() ) / 2;
int desired_y = ( h - bbbox.GetHeight() ) / 2;
m_board->Move( wxPoint( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
m_board->Move( VECTOR2I( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
}
}

View File

@ -699,8 +699,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
EWIRE w( gr );
PCB_LAYER_ID layer = kicad_layer( w.layer );
wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
VECTOR2I start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
VECTOR2I end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
if( layer != UNDEFINED_LAYER )
{
@ -750,7 +750,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
pcbtxt->SetLayer( layer );
wxString kicadText = interpret_text( t.text );
pcbtxt->SetText( FROM_UTF8( kicadText.c_str() ) );
pcbtxt->SetTextPos( wxPoint( kicad_x( t.x ), kicad_y( t.y ) ) );
pcbtxt->SetTextPos( VECTOR2I( kicad_x( t.x ), kicad_y( t.y ) ) );
double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default
int textThickness = KiROUND( t.size.ToPcbUnits() * ratio / 100 );
@ -910,8 +910,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
m_board->Add( shape, ADD_MODE::APPEND );
shape->SetFilled( false );
shape->SetLayer( layer );
shape->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) );
shape->SetEnd( wxPoint( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
shape->SetStart( VECTOR2I( kicad_x( c.x ), kicad_y( c.y ) ) );
shape->SetEnd( VECTOR2I( kicad_x( c.x ) + radius, kicad_y( c.y ) ) );
shape->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
}
}
@ -939,10 +939,10 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
ZONE_BORDER_DISPLAY_STYLE outline_hatch = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE;
const int outlineIdx = -1; // this is the id of the copper zone main outline
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
if( r.rot )
zone->Rotate( zone->GetPosition(), r.rot->degrees * 10 );
@ -1014,8 +1014,8 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
dimension->SetPrecision( DIMENSION_PRECISION );
// The origin and end are assumed to always be in this order from eagle
dimension->SetStart( wxPoint( kicad_x( d.x1 ), kicad_y( d.y1 ) ) );
dimension->SetEnd( wxPoint( kicad_x( d.x2 ), kicad_y( d.y2 ) ) );
dimension->SetStart( VECTOR2I( kicad_x( d.x1 ), kicad_y( d.y1 ) ) );
dimension->SetEnd( VECTOR2I( kicad_x( d.x2 ), kicad_y( d.y2 ) ) );
dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) );
dimension->Text().SetTextThickness( designSettings.GetTextThickness( layer ) );
dimension->SetLineThickness( designSettings.GetLineThickness( layer ) );
@ -1186,7 +1186,7 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
refanceNamePresetInPackageLayout = true;
valueNamePresetInPackageLayout = true;
footprint->SetPosition( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) );
footprint->SetPosition( VECTOR2I( kicad_x( e.x ), kicad_y( e.y ) ) );
// Is >NAME field set in package layout ?
if( footprint->GetReference().size() == 0 )
@ -1561,7 +1561,7 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
if( a.x && a.y ) // OPT
{
wxPoint pos( kicad_x( *a.x ), kicad_y( *a.y ) );
VECTOR2I pos( kicad_x( *a.x ), kicad_y( *a.y ) );
aFPText->SetTextPos( pos );
}
@ -1742,8 +1742,8 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
{
EWIRE w( aTree );
PCB_LAYER_ID layer = kicad_layer( w.layer );
wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
VECTOR2I start( kicad_x( w.x1 ), kicad_y( w.y1 ) );
VECTOR2I end( kicad_x( w.x2 ), kicad_y( w.y2 ) );
int width = w.width.ToPcbUnits();
if( layer == UNDEFINED_LAYER )
@ -1902,7 +1902,7 @@ void EAGLE_PLUGIN::packagePad( FOOTPRINT* aFootprint, wxXmlNode* aTree )
if( e.shape && *e.shape == EPAD::OFFSET )
{
int offset = KiROUND( ( sz.x - sz.y ) / 2.0 );
pad->SetOffset( wxPoint( offset, 0 ) );
pad->SetOffset( VECTOR2I( offset, 0 ) );
}
}
@ -2044,10 +2044,10 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
setKeepoutSettingsToZone( zone, r.layer );
const int outlineIdx = -1; // this is the id of the copper zone main outline
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y1 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x2 ), kicad_y( r.y2 ) ), outlineIdx );
zone->AppendCorner( VECTOR2I( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
if( r.rot )
{
@ -2282,8 +2282,8 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
}
gr->SetLayer( layer );
gr->SetStart0( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) );
gr->SetEnd0( wxPoint( kicad_x( e.x ) + radius, kicad_y( e.y ) ) );
gr->SetStart0( VECTOR2I( kicad_x( e.x ), kicad_y( e.y ) ) );
gr->SetEnd0( VECTOR2I( kicad_x( e.x ) + radius, kicad_y( e.y ) ) );
gr->SetDrawCoord();
}
}
@ -2305,14 +2305,14 @@ void EAGLE_PLUGIN::packageHole( FOOTPRINT* aFootprint, wxXmlNode* aTree, bool aC
// Mechanical purpose only:
// no offset, no net name, no pad name allowed
// pad->SetOffset( wxPoint( 0, 0 ) );
// pad->SetOffset( VECTOR2I( 0, 0 ) );
// pad->SetNumber( wxEmptyString );
VECTOR2I padpos( kicad_x( e.x ), kicad_y( e.y ) );
if( aCenter )
{
pad->SetPos0( wxPoint( 0, 0 ) );
pad->SetPos0( VECTOR2I( 0, 0 ) );
aFootprint->SetPosition( padpos );
pad->SetPosition( padpos );
}
@ -2573,8 +2573,8 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
if( w.curve )
{
center = ConvertArcCenter( wxPoint( kicad_x( w.x1 ), kicad_y( w.y1 ) ),
wxPoint( kicad_x( w.x2 ), kicad_y( w.y2 ) ),
center = ConvertArcCenter( VECTOR2I( kicad_x( w.x1 ), kicad_y( w.y1 ) ),
VECTOR2I( kicad_x( w.x2 ), kicad_y( w.y2 ) ),
*w.curve );
angle = DEG2RAD( *w.curve );
@ -2593,7 +2593,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
while( fabs( angle ) > fabs( delta_angle ) )
{
wxASSERT( radius > 0.0 );
wxPoint end( KiROUND( radius * cos( end_angle + angle ) + center.x ),
VECTOR2I end( KiROUND( radius * cos( end_angle + angle ) + center.x ),
KiROUND( radius * sin( end_angle + angle ) + center.y ) );
PCB_TRACK* t = new PCB_TRACK( m_board );
@ -2613,7 +2613,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
PCB_TRACK* t = new PCB_TRACK( m_board );
t->SetPosition( start );
t->SetEnd( wxPoint( kicad_x( w.x2 ), kicad_y( w.y2 ) ) );
t->SetEnd( VECTOR2I( kicad_x( w.x2 ), kicad_y( w.y2 ) ) );
t->SetWidth( width );
t->SetLayer( layer );
t->SetNetCode( netCode );
@ -2704,7 +2704,7 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
via->SetViaType( VIATYPE::BLIND_BURIED );
}
wxPoint pos( kicad_x( v.x ), kicad_y( v.y ) );
VECTOR2I pos( kicad_x( v.x ), kicad_y( v.y ) );
via->SetLayerPair( layer_front_most, layer_back_most );
via->SetPosition( pos );
@ -2988,7 +2988,7 @@ void EAGLE_PLUGIN::centerBoard()
int desired_x = ( w - bbbox.GetWidth() ) / 2;
int desired_y = ( h - bbbox.GetHeight() ) / 2;
m_board->Move( wxPoint( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
m_board->Move( VECTOR2I( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
}
}
}

View File

@ -267,12 +267,12 @@ wxString PCB_PARSER::GetRequiredVersion()
}
wxPoint PCB_PARSER::parseXY()
VECTOR2I PCB_PARSER::parseXY()
{
if( CurTok() != T_LEFT )
NeedLEFT();
wxPoint pt;
VECTOR2I pt;
T token = NextTok();
if( token != T_xy )
@ -374,7 +374,7 @@ void PCB_PARSER::parseOutlinePoints( SHAPE_LINE_CHAIN& aPoly )
void PCB_PARSER::parseXY( int* aX, int* aY )
{
wxPoint pt = parseXY();
VECTOR2I pt = parseXY();
if( aX )
*aX = pt.x;
@ -2117,7 +2117,7 @@ void PCB_PARSER::parseSetup()
{
int x = parseBoardUnits( "auxiliary origin X" );
int y = parseBoardUnits( "auxiliary origin Y" );
designSettings.SetAuxOrigin( wxPoint( x, y ) );
designSettings.SetAuxOrigin( VECTOR2I( x, y ) );
// Aux origin still stored in board for the moment
//m_board->m_LegacyDesignSettingsLoaded = true;
@ -2129,7 +2129,7 @@ void PCB_PARSER::parseSetup()
{
int x = parseBoardUnits( "grid origin X" );
int y = parseBoardUnits( "grid origin Y" );
designSettings.SetGridOrigin( wxPoint( x, y ) );
designSettings.SetGridOrigin( VECTOR2I( x, y ) );
// Grid origin still stored in board for the moment
//m_board->m_LegacyDesignSettingsLoaded = true;
NeedRIGHT();
@ -2435,7 +2435,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_SHAPE." ) );
T token;
wxPoint pt;
VECTOR2I pt;
STROKE_PARAMS stroke( 0, PLOT_DASH_TYPE::SOLID );
std::unique_ptr<PCB_SHAPE> shape = std::make_unique<PCB_SHAPE>( nullptr );
@ -2480,7 +2480,7 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE()
}
else
{
wxPoint arc_start, arc_mid, arc_end;
VECTOR2I arc_start, arc_mid, arc_end;
if( token != T_start )
Expecting( T_start );
@ -2821,7 +2821,7 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT()
if( token != T_at )
Expecting( T_at );
wxPoint pt;
VECTOR2I pt;
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
@ -2991,7 +2991,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
// New format: feature points
case T_pts:
{
wxPoint point;
VECTOR2I point;
parseXY( &point.x, &point.y );
dim->SetStart( point );
@ -3189,7 +3189,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
if( token != T_pts )
Expecting( T_pts );
wxPoint point;
VECTOR2I point;
parseXY( &point.x, &point.y );
dim->SetStart( point );
@ -3209,7 +3209,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
if( token != T_pts )
Expecting( T_pts );
wxPoint point;
VECTOR2I point;
parseXY( &point.x, &point.y );
dim->SetEnd( point );
@ -3232,7 +3232,7 @@ PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION( BOARD_ITEM* aParent, bool aInFP
PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dim.get() );
// Old style: calculate height from crossbar
wxPoint point1, point2;
VECTOR2I point1, point2;
parseXY( &point1.x, &point1.y );
parseXY( &point2.x, &point2.y );
aligned->UpdateHeight( point2, point1 ); // Yes, backwards intentionally
@ -3726,7 +3726,7 @@ FP_TEXT* PCB_PARSER::parseFP_TEXT()
if( token != T_at )
Expecting( T_at );
wxPoint pt;
VECTOR2I pt;
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
@ -3796,7 +3796,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
CurTok() == T_fp_rect || CurTok() == T_fp_line || CurTok() == T_fp_poly, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FP_SHAPE." ) );
wxPoint pt;
VECTOR2I pt;
STROKE_PARAMS stroke( 0, PLOT_DASH_TYPE::SOLID );
T token;
@ -3851,7 +3851,7 @@ FP_SHAPE* PCB_PARSER::parseFP_SHAPE()
}
else
{
wxPoint arc_start, arc_mid, arc_end;
VECTOR2I arc_start, arc_mid, arc_end;
if( token != T_start )
Expecting( T_start );
@ -4160,8 +4160,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
wxCHECK_MSG( CurTok() == T_pad, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PAD." ) );
wxSize sz;
wxPoint pt;
VECTOR2I sz;
VECTOR2I pt;
std::unique_ptr<PAD> pad = std::make_unique<PAD>( aParent );
@ -4184,7 +4184,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
// Default PAD object is thru hole with drill.
// SMD pads have no hole
pad->SetDrillSize( wxSize( 0, 0 ) );
pad->SetDrillSize( VECTOR2I( 0, 0 ) );
break;
case T_connect:
@ -4192,7 +4192,7 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
// Default PAD object is thru hole with drill.
// CONN pads have no hole
pad->SetDrillSize( wxSize( 0, 0 ) );
pad->SetDrillSize( VECTOR2I( 0, 0 ) );
break;
case T_np_thru_hole:
@ -4260,8 +4260,8 @@ PAD* PCB_PARSER::parsePAD( FOOTPRINT* aParent )
switch( token )
{
case T_size:
sz.SetWidth( parseBoardUnits( "width value" ) );
sz.SetHeight( parseBoardUnits( "height value" ) );
sz.x = parseBoardUnits( "width value" );
sz.y = parseBoardUnits( "height value" );
pad->SetSize( sz );
NeedRIGHT();
break;
@ -4741,7 +4741,7 @@ void PCB_PARSER::parseGROUP( BOARD_ITEM* aParent )
wxCHECK_RET( CurTok() == T_group,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_GROUP." ) );
wxPoint pt;
VECTOR2I pt;
T token;
m_groupInfos.push_back( GROUP_INFO() );
@ -4791,7 +4791,7 @@ PCB_ARC* PCB_PARSER::parseARC()
wxCHECK_MSG( CurTok() == T_arc, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ARC." ) );
wxPoint pt;
VECTOR2I pt;
T token;
std::unique_ptr<PCB_ARC> arc = std::make_unique<PCB_ARC>( m_board );
@ -4875,7 +4875,7 @@ PCB_TRACK* PCB_PARSER::parsePCB_TRACK()
wxCHECK_MSG( CurTok() == T_segment, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TRACK." ) );
wxPoint pt;
VECTOR2I pt;
T token;
std::unique_ptr<PCB_TRACK> track = std::make_unique<PCB_TRACK>( m_board );
@ -4953,7 +4953,7 @@ PCB_VIA* PCB_PARSER::parsePCB_VIA()
wxCHECK_MSG( CurTok() == T_via, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_VIA." ) );
wxPoint pt;
VECTOR2I pt;
T token;
std::unique_ptr<PCB_VIA> via = std::make_unique<PCB_VIA>( m_board );
@ -5075,7 +5075,7 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
ZONE_BORDER_DISPLAY_STYLE hatchStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH;
int hatchPitch = ZONE::GetDefaultHatchPitch();
wxPoint pt;
VECTOR2I pt;
T token;
int tmp;
wxString netnameFromfile; // the zone net name find in file
@ -5653,7 +5653,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET()
wxCHECK_MSG( CurTok() == T_target, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as PCB_TARGET." ) );
wxPoint pt;
VECTOR2I pt;
T token;
std::unique_ptr<PCB_TARGET> target = std::make_unique<PCB_TARGET>( nullptr );

View File

@ -236,7 +236,7 @@ private:
* @return A wxPoint object containing the coordinate pair.
* @throw PARSE_ERROR if the coordinate pair syntax is incorrect.
*/
wxPoint parseXY();
VECTOR2I parseXY();
void parseXY( int* aX, int* aY );

View File

@ -595,7 +595,7 @@ void PCB_PLUGIN::formatSetup( const BOARD* aBoard, int aNestLevel ) const
origin = dsnSettings.GetGridOrigin();
if( origin != wxPoint( 0, 0 ) )
if( origin != VECTOR2I( 0, 0 ) )
{
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
FormatInternalUnits( origin.x ).c_str(),
@ -2139,8 +2139,8 @@ void PCB_PLUGIN::format( const ZONE* aZone, int aNestLevel ) const
for( const SEG& seg : segs )
{
m_out->Print( aNestLevel + 2, "(pts (xy %s) (xy %s))\n",
FormatInternalUnits( wxPoint( seg.A ) ).c_str(),
FormatInternalUnits( wxPoint( seg.B ) ).c_str() );
FormatInternalUnits( seg.A ).c_str(),
FormatInternalUnits( seg.B ).c_str() );
}
m_out->Print( aNestLevel + 1, ")\n" );

View File

@ -122,8 +122,8 @@ void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint )
FP_SHAPE* segment = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
aFootprint->Add( segment );
segment->SetStart0( wxPoint( m_positionX, m_positionY ) );
segment->SetEnd0( wxPoint( m_ToX, m_ToY ) );
segment->SetStart0( VECTOR2I( m_positionX, m_positionY ) );
segment->SetEnd0( VECTOR2I( m_ToX, m_ToY ) );
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
segment->SetLayer( m_KiCadLayer );
@ -140,8 +140,8 @@ void PCB_LINE::AddToBoard()
PCB_TRACK* track = new PCB_TRACK( m_board );
m_board->Add( track );
track->SetPosition( wxPoint( m_positionX, m_positionY ) );
track->SetEnd( wxPoint( m_ToX, m_ToY ) );
track->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
track->SetEnd( VECTOR2I( m_ToX, m_ToY ) );
track->SetWidth( m_Width );
@ -154,8 +154,8 @@ void PCB_LINE::AddToBoard()
m_board->Add( segment, ADD_MODE::APPEND );
segment->SetLayer( m_KiCadLayer );
segment->SetStart( wxPoint( m_positionX, m_positionY ) );
segment->SetEnd( wxPoint( m_ToX, m_ToY ) );
segment->SetStart( VECTOR2I( m_positionX, m_positionY ) );
segment->SetEnd( VECTOR2I( m_ToX, m_ToY ) );
segment->SetStroke( STROKE_PARAMS( m_Width, PLOT_DASH_TYPE::SOLID ) );
}
}

View File

@ -358,8 +358,8 @@ void PCB_PAD::AddToBoard()
PCB_VIA* via = new PCB_VIA( m_board );
m_board->Add( via );
via->SetPosition( wxPoint( m_positionX, m_positionY ) );
via->SetEnd( wxPoint( m_positionX, m_positionY ) );
via->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
via->SetEnd( VECTOR2I( m_positionX, m_positionY ) );
via->SetWidth( height );
via->SetViaType( VIATYPE::THROUGH );
@ -377,7 +377,7 @@ void PCB_PAD::AddToBoard()
m_name.text = m_defaultPinDes;
footprint->SetPosition( wxPoint( m_positionX, m_positionY ) );
footprint->SetPosition( VECTOR2I( m_positionX, m_positionY ) );
AddToFootprint( footprint, 0, true );
}
}

View File

@ -454,11 +454,11 @@ bool ZONE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) cons
auto vertexNext = m_Poly->CVertex( ( ii + 1 ) % count );
// Test if the point is within the rect
if( arect.Contains( ( wxPoint ) vertex ) )
if( arect.Contains( vertex ) )
return true;
// Test if this edge intersects the rect
if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
if( arect.Intersects( vertex, vertexNext ) )
return true;
}
@ -881,7 +881,7 @@ void ZONE::UnHatchBorder()
// Creates hatch lines inside the outline of the complex polygon
// sort function used in ::HatchBorder to sort points by descending wxPoint.x values
// sort function used in ::HatchBorder to sort points by descending VECTOR2I.x values
bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst )
{
return tst.x < ref.x;