Cleanup: Replace push_back with emplace_back

In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
This commit is contained in:
Seth Hillbrand 2019-12-05 07:41:21 -08:00
parent 6f8b399c5f
commit b5f021ff9f
68 changed files with 294 additions and 294 deletions

View File

@ -185,7 +185,7 @@ void SGCOLORS::SetColorList( size_t aListSize, const SGCOLOR* aColorList )
void SGCOLORS::AddColor( double aRedValue, double aGreenValue, double aBlueValue )
{
colors.push_back( SGCOLOR( aRedValue, aGreenValue, aBlueValue ) );
colors.emplace_back( aRedValue, aGreenValue, aBlueValue );
return;
}

View File

@ -188,7 +188,7 @@ void SGCOORDS::SetCoordsList( size_t aListSize, const SGPOINT* aCoordsList )
void SGCOORDS::AddCoord( double aXValue, double aYValue, double aZValue )
{
coords.push_back( SGPOINT( aXValue, aYValue, aZValue ) );
coords.emplace_back( aXValue, aYValue, aZValue );
return;
}

View File

@ -503,7 +503,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
// assign any skipped coordinates a normal of (0,0,1)
while( item > idx )
{
norms.push_back( SGVECTOR( 0, 0, 1 ) );
norms.emplace_back( 0, 0, 1 );
++idx;
}
@ -517,7 +517,7 @@ bool S3D::CalcTriangleNormals( std::vector< SGPOINT > coords,
++sT;
}
norms.push_back( SGVECTOR( norm.x, norm.y, norm.z ) );
norms.emplace_back( norm.x, norm.y, norm.z );
++idx;
++sM;

View File

@ -186,7 +186,7 @@ void SGNORMALS::SetNormalList( size_t aListSize, const SGVECTOR* aNormalList )
void SGNORMALS::AddNormal( double aXValue, double aYValue, double aZValue )
{
norms.push_back( SGVECTOR( aXValue, aYValue, aZValue ) );
norms.emplace_back( aXValue, aYValue, aZValue );
return;
}

View File

@ -112,11 +112,11 @@ void C3D_RENDER_OGL_LEGACY::generate_ring_contour( const SFVEC2F &aCenter,
* 2.0f * glm::pi<float>() / 3600.0f;
const SFVEC2F rotatedDir = SFVEC2F( cos( angle ), sin( angle ) );
aInnerContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aInnerRadius,
aCenter.y + rotatedDir.y * aInnerRadius ) );
aInnerContourResult.emplace_back( aCenter.x + rotatedDir.x * aInnerRadius,
aCenter.y + rotatedDir.y * aInnerRadius );
aOuterContourResult.push_back( SFVEC2F( aCenter.x + rotatedDir.x * aOuterRadius,
aCenter.y + rotatedDir.y * aOuterRadius ) );
aOuterContourResult.emplace_back( aCenter.x + rotatedDir.x * aOuterRadius,
aCenter.y + rotatedDir.y * aOuterRadius );
}
aInnerContourResult.push_back( aInnerContourResult[0] );

View File

@ -2141,7 +2141,7 @@ void C3D_RENDER_RAYTRACING::initialize_block_positions()
for( int x = 0; x < blocks_x; ++x )
for( int y = 0; y < blocks_y; ++y )
m_blockPositions.push_back( SFVEC2UI( x * RAYPACKET_DIM, y * RAYPACKET_DIM ) );
m_blockPositions.emplace_back( x * RAYPACKET_DIM, y * RAYPACKET_DIM );
const SFVEC2UI center( m_realBufferSize.x / 2, m_realBufferSize.y / 2 );
std::sort( m_blockPositions.begin(), m_blockPositions.end(),

View File

@ -62,7 +62,7 @@ void BASIC_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
for( ; it != aPointList.end(); ++it )
{
VECTOR2D corner = transform(*it);
polyline_corners.push_back( wxPoint( corner.x, corner.y ) );
polyline_corners.emplace_back( corner.x, corner.y );
}
if( m_DC )

View File

@ -1035,7 +1035,7 @@ EDEVICE::EDEVICE( wxXmlNode* aDevice )
while( connectNode )
{
connects.push_back( ECONNECT( connectNode ) );
connects.emplace_back( connectNode );
connectNode = connectNode->GetNext();
}
}

View File

@ -1071,7 +1071,7 @@ bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
}
if( !hasKisys3D )
paths.push_back( "${KISYS3DMOD}" );
paths.emplace_back("${KISYS3DMOD}" );
return true;
}

View File

@ -329,7 +329,7 @@ void CACHED_CONTAINER::mergeFreeChunks()
for( it = m_freeChunks.begin(), it_end = m_freeChunks.end(); it != it_end; ++it )
{
freeChunks.push_back( std::make_pair( it->second, it->first ) );
freeChunks.emplace_back( it->second, it->first );
}
m_freeChunks.clear();

View File

@ -2065,7 +2065,7 @@ void CALLBACK CombineCallback( GLdouble coords[3],
OPENGL_GAL::TessParams* param = static_cast<OPENGL_GAL::TessParams*>( aData );
// Save the pointer so we can delete it later
param->intersectPoints.push_back( boost::shared_array<GLdouble>( vertex ) );
param->intersectPoints.emplace_back( vertex );
memcpy( vertex, coords, 3 * sizeof(GLdouble) );

View File

@ -151,7 +151,7 @@ void BuildConvexHull( std::vector<wxPoint>& aResult,
for( int ii = 0; ii < poly.PointCount(); ++ii )
{
buf.push_back( wxPoint( poly.CPoint( ii ).x, poly.CPoint( ii ).y ) );
buf.emplace_back( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
}
}

View File

@ -675,7 +675,7 @@ bool SHAPE_LINE_CHAIN::Parse( std::stringstream& aStream )
int x, y;
aStream >> x;
aStream >> y;
m_points.push_back( VECTOR2I( x, y ) );
m_points.emplace_back( x, y );
}
return true;

View File

@ -985,7 +985,7 @@ void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n )
for( cpointIterator cit = outputPolygon.begin(); cit != outputPolygon.end(); ++cit )
{
clippedPolygon.push_back( wxPoint( KiROUND( cit->X ), KiROUND( cit->Y ) ) );
clippedPolygon.emplace_back( KiROUND( cit->X ), KiROUND( cit->Y ) );
}
if( clippedPolygon.size() )

View File

@ -246,8 +246,8 @@ void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
for( int ii = 0; ii < ccount; ii++ )
{
shape.push_back( wxPoint( GetShapePolygonCorner( ii ).x * MarkerScale(),
GetShapePolygonCorner( ii ).y * MarkerScale() ) );
shape.emplace_back( GetShapePolygonCorner( ii ).x * MarkerScale(),
GetShapePolygonCorner( ii ).y * MarkerScale() );
}
for( int ii = 0; ii < ccount; ii++ )

View File

@ -200,8 +200,8 @@ void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( wxDC* aDC, const wxPoint& aOffset,
SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx );
for( int ii = 0; ii < outline.PointCount(); ii++ )
points_moved.push_back( wxPoint( outline.Point( ii ).x + aOffset.x,
outline.Point( ii ).y + aOffset.y ) );
points_moved.emplace_back( outline.Point( ii ).x + aOffset.x,
outline.Point( ii ).y + aOffset.y );
GRPoly( nullptr, aDC, points_moved.size(), &points_moved[0], FILLED_SHAPE,
GetPenWidth(), aColor, aColor );

View File

@ -619,7 +619,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline(0 );
for( int jj = 0; jj < path.PointCount(); jj++ )
cornerList.push_back( wxPoint( path.CPoint( jj ).x , path.CPoint( jj ).y ) );
cornerList.emplace_back( path.CPoint( jj ).x , path.CPoint( jj ).y );
// Ensure the polygon is closed
if( cornerList[0] != cornerList[cornerList.size() - 1] )

View File

@ -902,7 +902,7 @@ void GERBER_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
cornerList.reserve( poly.PointCount() + 1 );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );
// Close polygon
cornerList.push_back( cornerList[0] );
@ -942,7 +942,7 @@ void GERBER_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
cornerList.clear();
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );
// Close polygon
cornerList.push_back( cornerList[0] );

View File

@ -603,12 +603,12 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
}
corners.push_back( wxPoint( - dx, - dy ) );
corners.push_back( wxPoint( - dx, + dy ) );
corners.push_back( wxPoint( + dx, + dy ) );
corners.push_back( wxPoint( + dx, - dy ) );
corners.emplace_back( - dx, - dy );
corners.emplace_back( - dx, + dy );
corners.emplace_back( + dx, + dy );
corners.emplace_back( + dx, - dy );
// Close polygon
corners.push_back( wxPoint( - dx, - dy ) );
corners.emplace_back( - dx, - dy );
for( unsigned ii = 0; ii < corners.size(); ii++ )
{
@ -649,7 +649,7 @@ void HPGL_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aSiz
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );
if( cornerList.back() != cornerList.front() )
cornerList.push_back( cornerList.front() );
@ -671,7 +671,7 @@ void HPGL_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize,
cornerList.reserve( poly.PointCount() );
for( int ii = 1; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );
if( cornerList.back() != cornerList.front() )
cornerList.push_back( cornerList.front() );

View File

@ -208,7 +208,7 @@ void PSLIKE_PLOTTER::FlashPadRoundRect( const wxPoint& aPadPos, const wxSize& aS
SHAPE_LINE_CHAIN& poly = outline.Outline( 0 );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );
// Close polygon
cornerList.push_back( cornerList[0] );
@ -241,7 +241,7 @@ void PSLIKE_PLOTTER::FlashPadCustom( const wxPoint& aPadPos, const wxSize& aSize
cornerList.clear();
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxPoint( poly.Point( ii ).x, poly.Point( ii ).y ) );
cornerList.emplace_back( poly.Point( ii ).x, poly.Point( ii ).y );
// Close polygon
cornerList.push_back( cornerList[0] );

View File

@ -126,8 +126,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
SHAPE_LINE_CHAIN& outline = poly->GetPolygons().Outline( idx );
for( int ii = 0; ii < outline.PointCount(); ii++ )
points.push_back( wxPoint( outline.Point( ii ).x ,
outline.Point( ii ).y ) );
points.emplace_back( outline.Point( ii ).x ,
outline.Point( ii ).y );
plotter->PlotPoly( points, FILLED_SHAPE, poly->GetPenWidth() );
}

View File

@ -577,10 +577,10 @@ void PLOTTER::PlotPoly( const SHAPE_LINE_CHAIN& aCornerList, FILL_T aFill,
std::vector< wxPoint > cornerList;
for( int ii = 0; ii < aCornerList.PointCount(); ii++ )
cornerList.push_back( wxPoint( aCornerList.CPoint( ii ) ) );
cornerList.emplace_back( aCornerList.CPoint( ii ) );
if( aCornerList.IsClosed() && cornerList.front() != cornerList.back() )
cornerList.push_back( wxPoint( aCornerList.CPoint( 0 ) ) );
cornerList.emplace_back( aCornerList.CPoint( 0 ) );
PlotPoly( cornerList , aFill, aWidth, aData );
}

View File

@ -908,7 +908,7 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w )
for( double t : m_tickValues )
{
m_tickLabels.push_back( TickLabel( t ) );
m_tickLabels.emplace_back( t );
}
updateTickLabels( dc, w );
@ -1103,7 +1103,7 @@ void mpScaleY::computeSlaveTicks( mpWindow& w )
{
m = TransformFromPlot( m_masterScale->TransformToPlot( m_masterScale->m_tickValues[i] ) );
m_tickValues.push_back( m );
m_tickLabels.push_back( TickLabel( m ) );
m_tickLabels.emplace_back( m );
m_absVisibleMaxV = std::max( m_absVisibleMaxV, fabs( m ) );
}
}
@ -1190,7 +1190,7 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
}
for( double t : m_tickValues )
m_tickLabels.push_back( TickLabel( t ) );
m_tickLabels.emplace_back( t );
// n0 = floor(minVvis / bestStep) * bestStep;
@ -1246,12 +1246,12 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w )
for( d = minDecade; d<=maxDecade; d *= 10.0 )
{
// printf("d %.1f\n",d );
m_tickLabels.push_back( TickLabel( d ) );
m_tickLabels.emplace_back( d );
for( double dd = d; dd < d * 10; dd += d )
{
if( visibleDecades < 2 )
m_tickLabels.push_back( TickLabel( dd ) );
m_tickLabels.emplace_back( dd );
m_tickValues.push_back( dd );
}

View File

@ -2310,7 +2310,7 @@ void DL_Dxf::addHatch( DL_CreationInterface* creationInterface )
void DL_Dxf::addHatchLoop()
{
addHatchEdge();
hatchEdges.push_back( std::vector<DL_HatchEdgeData>() );
hatchEdges.emplace_back( );
}
@ -2384,7 +2384,7 @@ bool DL_Dxf::handleHatchData( DL_CreationInterface* creationInterface )
{
case 10:
hatchEdge.type = 0;
hatchEdge.vertices.push_back( std::vector<double>() );
hatchEdge.vertices.emplace_back( );
hatchEdge.vertices.back().push_back( toReal( groupValue ) );
return true;

View File

@ -397,12 +397,12 @@ void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
aList.emplace_back( _( "Line Width" ), msg, BLUE );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
aList.emplace_back( _( "Bounding Box" ), msg, BROWN );
}

View File

@ -100,7 +100,7 @@ bool LIB_BEZIER::Inside( EDA_RECT& aRect ) const
void LIB_BEZIER::MoveTo( const wxPoint& aPosition )
{
if ( !m_PolyPoints.size() )
m_PolyPoints.push_back( wxPoint(0, 0) );
m_PolyPoints.emplace_back(0, 0 );
Offset( aPosition - m_PolyPoints[ 0 ] );
}
@ -341,7 +341,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITE
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
aList.emplace_back( _( "Line Width" ), msg, BLUE );
msg.Printf( wxT( "(%d, %d, %d, %d)" ),
bBox.GetOrigin().x,
@ -349,7 +349,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITE
bBox.GetEnd().x,
bBox.GetEnd().y );
aList.push_back( MSG_PANEL_ITEM( _( "Bounding Box" ), msg, BROWN ) );
aList.emplace_back( _( "Bounding Box" ), msg, BROWN );
}
wxPoint LIB_BEZIER::GetPosition() const

View File

@ -1426,13 +1426,13 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >
+ aComponent->GetPosition();
text = MessageTextFromValue( aUnits, pinpos.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) );
aList.emplace_back( _( "Pos X" ), text, DARKMAGENTA );
text = MessageTextFromValue( aUnits, pinpos.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
aList.emplace_back( _( "Pos Y" ), text, DARKMAGENTA );
aList.push_back( MSG_PANEL_ITEM( aComponent->GetField( REFERENCE )->GetShownText(),
aComponent->GetField( VALUE )->GetShownText(), DARKCYAN ) );
aList.emplace_back( aComponent->GetField( REFERENCE )->GetShownText(),
aComponent->GetField( VALUE )->GetShownText(), DARKCYAN );
#if defined(DEBUG)

View File

@ -87,7 +87,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
{
if( part->GetFootprints().GetCount() != 0 ) // Put in list
{
cmpList.push_back( SCH_REFERENCE( comp, part.get(), sheetList[i] ) );
cmpList.emplace_back( comp, part.get(), sheetList[i] );
}
}

View File

@ -72,12 +72,12 @@ vector<COMPLEX> NGSPICE::GetPlot( const string& aName, int aMaxLen )
if( vi->v_realdata )
{
for( int i = 0; i < length; i++ )
data.push_back( COMPLEX( vi->v_realdata[i], 0.0 ) );
data.emplace_back( vi->v_realdata[i], 0.0 );
}
else if( vi->v_compdata )
{
for( int i = 0; i < length; i++ )
data.push_back( COMPLEX( vi->v_compdata[i].cx_real, vi->v_compdata[i].cx_imag ) );
data.emplace_back( vi->v_compdata[i].cx_real, vi->v_compdata[i].cx_imag );
}
}

View File

@ -141,7 +141,7 @@ double Evaluate( AM_PARAM_EVAL_STACK& aExp )
}
else
{
optype.push_back( OP_CODE( prm ) );
optype.emplace_back( prm );
optype.back().m_Priority += extra_priority;
}
}

View File

@ -779,7 +779,7 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
m_LastArcDataType = ARC_INFO_TYPE_NONE;
ReadXYCoord( text, true );
// This is the first point (starting point) of routing
m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos ) );
m_RoutePositions.emplace_back( m_CurrentPos );
break;
case DRILL_G_DRILL:
@ -801,7 +801,7 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
m_LastArcDataType = ARC_INFO_TYPE_NONE;
m_Iterpolation = GERB_INTERPOL_LINEAR_1X;
ReadXYCoord( text, true );
m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos ) );
m_RoutePositions.emplace_back( m_CurrentPos );
break;
case DRILL_G_CWMOVE:
@ -812,9 +812,9 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
ReadIJCoord( text );
if( m_LastArcDataType == ARC_INFO_TYPE_CENTER )
m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_IJPos, ROUTE_CW ) );
m_RoutePositions.emplace_back( m_CurrentPos, m_IJPos, ROUTE_CW );
else
m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_ArcRadius, ROUTE_CW ) );
m_RoutePositions.emplace_back( m_CurrentPos, m_ArcRadius, ROUTE_CW );
break;
case DRILL_G_CCWMOVE:
@ -825,9 +825,9 @@ bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command( char*& text )
ReadIJCoord( text );
if( m_LastArcDataType == ARC_INFO_TYPE_CENTER )
m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_IJPos, ROUTE_CCW ) );
m_RoutePositions.emplace_back( m_CurrentPos, m_IJPos, ROUTE_CCW );
else
m_RoutePositions.push_back( EXCELLON_ROUTE_COORD( m_CurrentPos, m_ArcRadius, ROUTE_CCW ) );
m_RoutePositions.emplace_back( m_CurrentPos, m_ArcRadius, ROUTE_CCW );
break;
case DRILL_G_ABSOLUTE:

View File

@ -660,7 +660,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
wxString text;
msg = ShowGBRShape();
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
// Display D_Code value with its attributes for items using a DCode:
if( m_Shape == GBR_POLYGON ) // Has no DCode, but can have an attribute
@ -683,32 +683,32 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
text = apertDescr->m_AperFunction;
}
aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );
aList.emplace_back( msg, text, RED );
// Display graphic layer name
msg = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Graphic Layer" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Graphic Layer" ), msg, DARKGREEN );
// Display item rotation
// The full rotation is Image rotation + m_lyrRotation
// but m_lyrRotation is specific to this object
// so we display only this parameter
msg.Printf( wxT( "%f" ), m_lyrRotation );
aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BLUE ) );
aList.emplace_back( _( "Rotation" ), msg, BLUE );
// Display item polarity (item specific)
msg = m_LayerNegative ? _("Clear") : _("Dark");
aList.push_back( MSG_PANEL_ITEM( _( "Polarity" ), msg, BLUE ) );
aList.emplace_back( _( "Polarity" ), msg, BLUE );
// Display mirroring (item specific)
msg.Printf( wxT( "A:%s B:%s" ),
m_mirrorA ? _("Yes") : _("No"),
m_mirrorB ? _("Yes") : _("No"));
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKRED ) );
aList.emplace_back( _( "Mirror" ), msg, DARKRED );
// Display AB axis swap (item specific)
msg = m_swapAxis ? wxT( "A=Y B=X" ) : wxT( "A=X B=Y" );
aList.push_back( MSG_PANEL_ITEM( _( "AB axis" ), msg, DARKRED ) );
aList.emplace_back( _( "AB axis" ), msg, DARKRED );
// Display net info, if exists
if( m_netAttributes.m_NetAttribType == GBR_NETLIST_METADATA::GBR_NETINFO_UNSPECIFIED )
@ -748,7 +748,7 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
cmp_pad_msg << " " << m_netAttributes.m_Cmpref;
}
aList.push_back( MSG_PANEL_ITEM( net_msg, cmp_pad_msg, DARKCYAN ) );
aList.emplace_back( net_msg, cmp_pad_msg, DARKCYAN );
}

View File

@ -116,7 +116,7 @@ class XPATH
public:
void push( const char* aPathSegment, const char* aAttribute="" )
{
p.push_back( TRIPLET( aPathSegment, aAttribute ) );
p.emplace_back( aPathSegment, aAttribute );
}
void clear() { p.clear(); }

View File

@ -164,7 +164,7 @@ enum HASH_FLAG
{
for( int x = 0; x < gridSize; x++ )
{
m_grid.push_back( EDGE_LIST() );
m_grid.emplace_back( );
}
}

View File

@ -390,7 +390,7 @@ public:
*/
void AddLine( EDIT_POINT& aOrigin, EDIT_POINT& aEnd )
{
m_lines.push_back( EDIT_LINE( aOrigin, aEnd ) );
m_lines.emplace_back( aOrigin, aEnd );
}
/**

View File

@ -86,7 +86,7 @@ std::vector<wxFileName> PROJECT_TEMPLATE::GetFileList()
// Files that are in the meta directory must not be included
if( !p.GetPath().StartsWith( m_metaPath.GetPath() ) )
files.push_back( allfiles[i] );
files.emplace_back(allfiles[i] );
}
return files;

View File

@ -830,22 +830,22 @@ void BOARD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >&
}
txt.Printf( wxT( "%d" ), GetPadCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), viasCount );
aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), trackSegmentsCount );
aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNodesCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) );
aList.emplace_back( _( "Nodes" ), txt, DARKCYAN );
txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() - 1 /* Don't include "No Net" in count */ );
aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) );
aList.emplace_back( _( "Nets" ), txt, RED );
txt.Printf( wxT( "%d" ), GetConnectivity()->GetUnconnectedCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Unrouted" ), txt, BLUE ) );
aList.emplace_back( _( "Unrouted" ), txt, BLUE );
}

View File

@ -464,47 +464,47 @@ void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT
msg = _( "Drawing" );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
wxString shape = _( "Shape" );
switch( m_Shape )
{
case S_CIRCLE:
aList.push_back( MSG_PANEL_ITEM( shape, _( "Circle" ), RED ) );
aList.emplace_back( shape, _( "Circle" ), RED );
msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
aList.emplace_back( _( "Radius" ), msg, RED );
break;
case S_ARC:
aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) );
aList.emplace_back( shape, _( "Arc" ), RED );
msg.Printf( wxT( "%.1f" ), m_Angle / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, RED ) );
aList.emplace_back( _( "Angle" ), msg, RED );
msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) );
aList.emplace_back( _( "Radius" ), msg, RED );
break;
case S_CURVE:
aList.push_back( MSG_PANEL_ITEM( shape, _( "Curve" ), RED ) );
aList.emplace_back( shape, _( "Curve" ), RED );
msg = MessageTextFromValue( aUnits, GetLength() );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Length" ), msg, DARKGREEN );
break;
default:
{
aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) );
aList.emplace_back( shape, _( "Segment" ), RED );
msg = MessageTextFromValue( aUnits, GetLineLength( m_Start, m_End ) );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Length" ), msg, DARKGREEN );
// angle counter-clockwise from 3'o-clock
const double deg = RAD2DEG( atan2( (double)( m_Start.y - m_End.y ),
(double)( m_End.x - m_Start.x ) ) );
msg.Printf( wxT( "%.1f" ), deg );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
}
}
@ -515,11 +515,11 @@ void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT
MessageTextFromValue( aUnits, GetEnd().x ),
MessageTextFromValue( aUnits, GetEnd().y ) );
aList.push_back( MSG_PANEL_ITEM( start, end, DARKGREEN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKBROWN ) );
aList.emplace_back( start, end, DARKGREEN );
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKBROWN );
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Width" ), msg, DARKCYAN );
}
@ -961,7 +961,7 @@ const std::vector<wxPoint> DRAWSEGMENT::BuildPolyPointsList() const
{
for ( auto iter = m_Poly.CIterate(); iter; iter++ )
{
rv.push_back( wxPoint( iter->x, iter->y ) );
rv.emplace_back( iter->x, iter->y );
}
}
}

View File

@ -196,7 +196,7 @@ void EDGE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset
for( auto iter = m_Poly.CIterate(); iter; iter++ )
{
points.push_back( wxPoint( iter->x,iter->y ) );
points.emplace_back( iter->x,iter->y );
}
for( unsigned ii = 0; ii < points.size(); ii++ )
@ -252,7 +252,7 @@ void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT
if( !board )
return;
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
// append the features shared with the base class
DRAWSEGMENT::GetMsgPanelInfo( aUnits, aList );

View File

@ -765,41 +765,41 @@ void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& a
if( module )
{
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), module->GetReference(), DARKCYAN ) );
aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
}
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
aList.emplace_back( _( "Pad" ), m_name, BROWN );
if( !GetPinFunction().IsEmpty() )
aList.push_back( MSG_PANEL_ITEM( _( "Pin fct" ), GetPinFunction(), BROWN ) );
aList.emplace_back( _( "Pin fct" ), GetPinFunction(), BROWN );
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) );
aList.emplace_back( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN );
board = GetBoard();
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ),
LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) );
aList.emplace_back( _( "Layer" ),
LayerMaskDescribe( board, m_layerMask ), DARKGREEN );
aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
aList.emplace_back( ShowPadShape(), ShowPadAttr(), DARKGREEN );
msg = MessageTextFromValue( aUnits, m_Size.x, true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
aList.emplace_back( _( "Width" ), msg, RED );
msg = MessageTextFromValue( aUnits, m_Size.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
aList.emplace_back( _( "Height" ), msg, RED );
msg = MessageTextFromValue( aUnits, m_Drill.x, true );
if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
{
aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), msg, RED ) );
aList.emplace_back( _( "Drill" ), msg, RED );
}
else
{
msg = MessageTextFromValue( aUnits, m_Drill.x, true )
+ wxT( "/" )
+ MessageTextFromValue( aUnits, m_Drill.y, true );
aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), msg, RED ) );
aList.emplace_back( _( "Drill X / Y" ), msg, RED );
}
double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
@ -811,17 +811,17 @@ void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& a
else
msg.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, LIGHTBLUE ) );
aList.emplace_back( _( "Angle" ), msg, LIGHTBLUE );
msg = MessageTextFromValue( aUnits, m_Pos.x )
+ wxT( ", " )
+ MessageTextFromValue( aUnits, m_Pos.y );
aList.push_back( MSG_PANEL_ITEM( _( "Position" ), msg, LIGHTBLUE ) );
aList.emplace_back( _( "Position" ), msg, LIGHTBLUE );
if( GetPadToDieLength() )
{
msg = MessageTextFromValue( aUnits, GetPadToDieLength(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), msg, CYAN ) );
aList.emplace_back( _( "Length in package" ), msg, CYAN );
}
}

View File

@ -89,28 +89,28 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM
wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) );
if( m_Parent->Type() == PCB_DIMENSION_T )
aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), GetShownText(), DARKGREEN ) );
aList.emplace_back( _( "Dimension" ), GetShownText(), DARKGREEN );
else
aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), GetShownText(), DARKGREEN ) );
aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BLUE ) );
aList.emplace_back( _( "Layer" ), GetLayerName(), BLUE );
if( !IsMirrored() )
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "No" ), DARKGREEN ) );
aList.emplace_back( _( "Mirror" ), _( "No" ), DARKGREEN );
else
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) );
aList.emplace_back( _( "Mirror" ), _( "Yes" ), DARKGREEN );
msg.Printf( wxT( "%.1f" ), GetTextAngle() / 10.0 );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
msg = MessageTextFromValue( aUnits, GetThickness() );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) );
aList.emplace_back( _( "Thickness" ), msg, MAGENTA );
msg = MessageTextFromValue( aUnits, GetTextWidth() );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
aList.emplace_back( _( "Width" ), msg, RED );
msg = MessageTextFromValue( aUnits, GetTextHeight() );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
aList.emplace_back( _( "Height" ), msg, RED );
}

View File

@ -350,42 +350,42 @@ void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I
};
Line = module->GetReference();
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), Line, DARKCYAN ) );
aList.emplace_back( _( "Footprint" ), Line, DARKCYAN );
Line = GetShownText();
aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) );
aList.emplace_back( _( "Text" ), Line, BROWN );
wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) );
aList.emplace_back( _( "Type" ), text_type_msg[m_Type], DARKGREEN );
if( !IsVisible() )
msg = _( "No" );
else
msg = _( "Yes" );
aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Display" ), msg, DARKGREEN );
// Display text layer
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) );
aList.emplace_back( _( "Layer" ), GetLayerName(), DARKGREEN );
if( IsMirrored() )
msg = _( "Yes" );
else
msg = _( "No" );
aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), GetTextAngleDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Angle" ), msg, DARKGREEN );
msg = MessageTextFromValue( aUnits, GetThickness(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) );
aList.emplace_back( _( "Thickness" ), msg, DARKGREEN );
msg = MessageTextFromValue( aUnits, GetTextWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, RED ) );
aList.emplace_back( _( "Width" ), msg, RED );
msg = MessageTextFromValue( aUnits, GetTextHeight(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, RED ) );
aList.emplace_back( _( "Height" ), msg, RED );
}

View File

@ -791,15 +791,15 @@ void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >&
std::tie( count, trackLen, lenPadToDie ) = board->GetTrackLength( *this );
msg = MessageTextFromValue( aUnits, trackLen );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Length" ), msg, DARKCYAN );
if( lenPadToDie != 0 )
{
msg = MessageTextFromValue( aUnits, trackLen + lenPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Full Length" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Full Length" ), msg, DARKCYAN );
msg = MessageTextFromValue( aUnits, lenPadToDie, true );
aList.push_back( MSG_PANEL_ITEM( _( "Pad To Die Length" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Pad To Die Length" ), msg, DARKCYAN );
}
}
@ -807,19 +807,19 @@ void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >&
if( netclass )
{
aList.push_back( MSG_PANEL_ITEM( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ) );
aList.emplace_back( _( "NC Name" ), netclass->GetName(), DARKMAGENTA );
msg = MessageTextFromValue( aUnits, netclass->GetClearance(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Clearance" ), msg, DARKMAGENTA ) );
aList.emplace_back( _( "NC Clearance" ), msg, DARKMAGENTA );
msg = MessageTextFromValue( aUnits, netclass->GetTrackWidth(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Width" ), msg, DARKMAGENTA ) );
aList.emplace_back( _( "NC Width" ), msg, DARKMAGENTA );
msg = MessageTextFromValue( aUnits, netclass->GetViaDiameter(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Via Size" ), msg, DARKMAGENTA ) );
aList.emplace_back( _( "NC Via Size" ), msg, DARKMAGENTA );
msg = MessageTextFromValue( aUnits, netclass->GetViaDrill(), true );
aList.push_back( MSG_PANEL_ITEM( _( "NC Via Drill"), msg, DARKMAGENTA ) );
aList.emplace_back( _( "NC Via Drill"), msg, DARKMAGENTA );
}
}
@ -837,18 +837,18 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN
else
msg = wxT( "<no name>" );
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
aList.emplace_back( _( "NetName" ), msg, RED );
// Display net code : (useful in test or debug)
msg.Printf( wxT( "%d" ), GetNetCode() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
aList.emplace_back( _( "NetCode" ), msg, RED );
}
#if defined(DEBUG)
// Display the flags
msg.Printf( wxT( "0x%08X" ), m_Flags );
aList.push_back( MSG_PANEL_ITEM( wxT( "Flags" ), msg, BLUE ) );
aList.emplace_back( wxT( "Flags" ), msg, BLUE );
#if 0
// Display start and end pointers:
@ -880,7 +880,7 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN
if( GetState( TRACK_AR ) )
msg[2] = 'A';
aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
aList.emplace_back( _( "Status" ), msg, MAGENTA );
}
void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
@ -888,7 +888,7 @@ void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM
wxString msg;
BOARD* board = GetBoard();
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Track" ), DARKCYAN ) );
aList.emplace_back( _( "Type" ), _( "Track" ), DARKCYAN );
GetMsgPanelInfoBase_Common( aUnits, aList );
@ -898,16 +898,16 @@ void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM
else
msg.Printf(wxT("%d"), m_Layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
aList.emplace_back( _( "Layer" ), msg, BROWN );
// Display width
msg = MessageTextFromValue( aUnits, m_Width, true );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Width" ), msg, DARKCYAN );
// Display segment length
msg = ::MessageTextFromValue( aUnits, GetLength() );
aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Segment Length" ), msg, DARKCYAN );
}
void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList )
@ -937,7 +937,7 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >
break;
}
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
GetMsgPanelInfoBase_Common( aUnits, aList );
@ -953,13 +953,13 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >
else
msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer );
aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) );
aList.emplace_back( _( "Layers" ), msg, BROWN );
// Display width
msg = MessageTextFromValue( aUnits, m_Width, true );
// Display diameter value:
aList.push_back( MSG_PANEL_ITEM( _( "Diameter" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Diameter" ), msg, DARKCYAN );
// Display drill value
msg = MessageTextFromValue( aUnits, GetDrillValue() );
@ -991,7 +991,7 @@ void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >
else
title += _( "(NetClass)" );
aList.push_back( MSG_PANEL_ITEM( title, msg, RED ) );
aList.emplace_back( title, msg, RED );
}

View File

@ -367,7 +367,7 @@ bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::doValidate( bool aRemoveRedundantCorners )
m_currshape.m_Poly.clear();
for( int ii = 0; ii < polyline.PointCount(); ++ii )
m_currshape.m_Poly.push_back( wxPoint( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y ) );
m_currshape.m_Poly.emplace_back( polyline.CPoint( ii ).x, polyline.CPoint( ii ).y );
m_warningIcon->Show( true );
m_warningText->Show( true );
@ -402,7 +402,7 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::OnButtonAdd( wxCommandEvent& event )
}
if( m_currshape.m_Poly.size() == 0 || row >= (int) m_currshape.m_Poly.size() )
m_currshape.m_Poly.push_back( wxPoint( 0, 0 ) );
m_currshape.m_Poly.emplace_back( 0, 0 );
else
m_currshape.m_Poly.insert( m_currshape.m_Poly.begin() + row, wxPoint( 0, 0 ) );

View File

@ -140,10 +140,10 @@ bool PANEL_PCBNEW_ACTION_PLUGINS::TransferDataFromWindow()
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
{
pluginSettings.push_back( std::make_pair(
pluginSettings.emplace_back(
m_grid->GetCellValue( ii, COLUMN_PATH ),
m_grid->GetCellValue( ii, COLUMN_VISIBLE ) == wxT("1") ? wxT( "Visible" ) : wxT( "Hidden" )
) );
);
}
m_frame->SetActionPluginSettings( pluginSettings );

View File

@ -1155,7 +1155,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
while( vertex )
{
if( vertex->GetName() == "vertex" )
vertices.push_back( EVERTEX( vertex ) );
vertices.emplace_back( vertex );
vertex = vertex->GetNext();
}
@ -1752,8 +1752,8 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, wxXmlNode* aTree ) const
wxPoint end( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) );
pts.push_back( start );
pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) );
pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) );
pts.emplace_back( kicad_x( r.x2 ), kicad_y( r.y1 ) );
pts.emplace_back( kicad_x( r.x2 ), kicad_y( r.y2 ) );
pts.push_back( end );
dwg->SetPolyPoints( pts );
@ -1793,7 +1793,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
while( vertex )
{
if( vertex->GetName() == "vertex" )
vertices.push_back( EVERTEX( vertex ) );
vertices.emplace_back( vertex );
vertex = vertex->GetNext();
}
@ -1805,7 +1805,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, wxXmlNode* aTree ) const
EVERTEX v1 = vertices[i];
// Append the corner
pts.push_back( wxPoint( kicad_x( v1.x ), kicad_y( v1.y ) ) );
pts.emplace_back( kicad_x( v1.x ), kicad_y( v1.y ) );
if( v1.curve )
{

View File

@ -1118,8 +1118,8 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P
SHAPE_LINE_CHAIN poly( polySet.Outline( 0 ) );
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxRealPoint( poly.Point( ii ).x * BOARD_SCALE,
-poly.Point( ii ).y * BOARD_SCALE ) );
cornerList.emplace_back( poly.Point( ii ).x * BOARD_SCALE,
-poly.Point( ii ).y * BOARD_SCALE );
// Close polygon
cornerList.push_back( cornerList[0] );
@ -1141,8 +1141,8 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P
cornerList.clear();
for( int ii = 0; ii < poly.PointCount(); ++ii )
cornerList.push_back( wxRealPoint( poly.Point( ii ).x * BOARD_SCALE,
-poly.Point( ii ).y * BOARD_SCALE ) );
cornerList.emplace_back( poly.Point( ii ).x * BOARD_SCALE,
-poly.Point( ii ).y * BOARD_SCALE );
// Close polygon
cornerList.push_back( cornerList[0] );
@ -1722,7 +1722,7 @@ static void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color
size_t j = 0;
for( size_t i = 0; i < nvert; ++i, j+= 3 )
vlist.push_back( SGPOINT( vertices[j], vertices[j+1], vertices[j+2] ) );
vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
// create the intermediate scenegraph
IFSG_TRANSFORM tx0( PcbOutput.GetRawPtr() ); // tx0 = Transform for this outline
@ -1809,7 +1809,7 @@ static void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color
size_t j = 0;
for( size_t i = 0; i < nvert; ++i, j+= 3 )
vlist.push_back( SGPOINT( vertices[j], vertices[j+1], vertices[j+2] ) );
vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
// create the intermediate scenegraph
IFSG_TRANSFORM tx0( PcbOutput.GetRawPtr() ); // tx0 = Transform for this outline

View File

@ -87,7 +87,7 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
// append a pair representing the NPTH set of holes, for separate drill files.
if( !m_merge_PTH_NPTH )
hole_sets.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) );
hole_sets.emplace_back( F_Cu, B_Cu );
for( std::vector<DRILL_LAYER_PAIR>::const_iterator it = hole_sets.begin();
it != hole_sets.end(); ++it )

View File

@ -226,7 +226,7 @@ std::vector<DRILL_LAYER_PAIR> GENDRILL_WRITER_BASE::getUniqueLayerPairs() const
std::vector<DRILL_LAYER_PAIR> ret;
ret.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) ); // always first in returned list
ret.emplace_back( F_Cu, B_Cu ); // always first in returned list
for( std::set< DRILL_LAYER_PAIR >::const_iterator it = unique.begin(); it != unique.end(); ++it )
ret.push_back( *it );
@ -301,7 +301,7 @@ void GENDRILL_WRITER_BASE::CreateMapFilesSet( const wxString& aPlotDirectory,
// append a pair representing the NPTH set of holes, for separate drill files.
if( !m_merge_PTH_NPTH )
hole_sets.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) );
hole_sets.emplace_back( F_Cu, B_Cu );
for( std::vector<DRILL_LAYER_PAIR>::const_iterator it = hole_sets.begin();
it != hole_sets.end(); ++it )

View File

@ -73,7 +73,7 @@ void GERBER_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
// append a pair representing the NPTH set of holes, for separate drill files.
// (Gerber drill files are separate files for PTH and NPTH)
hole_sets.push_back( DRILL_LAYER_PAIR( F_Cu, B_Cu ) );
hole_sets.emplace_back( F_Cu, B_Cu );
for( std::vector<DRILL_LAYER_PAIR>::const_iterator it = hole_sets.begin();
it != hole_sets.end(); ++it )

View File

@ -199,7 +199,7 @@ void FOOTPRINT_LIST_IMPL::StartWorkers( FP_LIB_TABLE* aTable, wxString const* aN
for( unsigned i = 0; i < aNThreads; ++i )
{
m_threads.push_back( std::thread( &FOOTPRINT_LIST_IMPL::loader_job, this ) );
m_threads.emplace_back( &FOOTPRINT_LIST_IMPL::loader_job, this );
}
}
@ -252,7 +252,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers()
for( size_t ii = 0; ii < std::thread::hardware_concurrency() + 1; ++ii )
{
threads.push_back( std::thread( [this, &queue_parsed]() {
threads.emplace_back( [this, &queue_parsed]() {
wxString nickname;
while( this->m_queue_out.pop( nickname ) && !m_cancelled )
@ -293,7 +293,7 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers()
m_count_finished.fetch_add( 1 );
}
} ) );
} );
}
while( !m_cancelled && (size_t)m_count_finished.load() < total_count )

View File

@ -195,8 +195,8 @@ void DXF_IMPORT_PLUGIN::addControlPoint( const DL_ControlPointData& aData )
return;
// Called for every spline control point, when reading a spline entity
m_curr_entity.m_SplineControlPointList.push_back( SPLINE_CTRL_POINT( aData.x , aData.y,
aData.w ) );
m_curr_entity.m_SplineControlPointList.emplace_back( aData.x , aData.y,
aData.w );
}
@ -207,7 +207,7 @@ void DXF_IMPORT_PLUGIN::addFitPoint( const DL_FitPointData& aData )
// Called for every spline fit point, when reading a spline entity
// we store only the X,Y coord values in a VECTOR2D
m_curr_entity.m_SplineFitPointList.push_back( VECTOR2D( aData.x, aData.y ) );
m_curr_entity.m_SplineFitPointList.emplace_back( aData.x, aData.y );
}

View File

@ -1008,8 +1008,8 @@ void LEGACY_PLUGIN::loadSETUP()
if( data ) // DRILL may not be present ?
drill = biuParse( data );
bds.m_ViasDimensionsList.push_back( VIA_DIMENSION( diameter,
drill ) );
bds.m_ViasDimensionsList.emplace_back( diameter,
drill );
}
else if( TESTLINE( "ViaSize" ) )
@ -1758,7 +1758,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
BIU x = biuParse( line + SZ( "Dl" ), &data );
BIU y = biuParse( data );
pts.push_back( wxPoint( x, y ) );
pts.emplace_back( x, y );
}
dwg->SetPolyPoints( pts );

View File

@ -89,10 +89,10 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I
double lengthnet = 0.0; // This is the length of tracks on pcb
double lengthPadToDie = 0.0; // this is the length of internal ICs connections
aList.push_back( MSG_PANEL_ITEM( _( "Net Name" ), GetNetname(), RED ) );
aList.emplace_back( _( "Net Name" ), GetNetname(), RED );
txt.Printf( wxT( "%d" ), GetNet() );
aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), txt, RED ) );
aList.emplace_back( _( "Net Code" ), txt, RED );
// Warning: for netcode == NETINFO_LIST::ORPHANED, the parent or the board
// can be NULL
@ -115,7 +115,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I
}
txt.Printf( wxT( "%d" ), count );
aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
count = 0;
@ -135,17 +135,17 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I
}
txt.Printf( wxT( "%d" ), count );
aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, BLUE ) );
aList.emplace_back( _( "Vias" ), txt, BLUE );
// Displays the full net length (tracks on pcb + internal ICs connections ):
txt = MessageTextFromValue( aUnits, lengthnet + lengthPadToDie );
aList.push_back( MSG_PANEL_ITEM( _( "Net Length" ), txt, RED ) );
aList.emplace_back( _( "Net Length" ), txt, RED );
// Displays the net length of tracks only:
txt = MessageTextFromValue( aUnits, lengthnet );
aList.push_back( MSG_PANEL_ITEM( _( "On Board" ), txt, RED ) );
aList.emplace_back( _( "On Board" ), txt, RED );
// Displays the net length of internal ICs connections (wires inside ICs):
txt = MessageTextFromValue( aUnits, lengthPadToDie, true );
aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), txt, RED ) );
aList.emplace_back( _( "In Package" ), txt, RED );
}

View File

@ -141,7 +141,7 @@ void D_PAD::AddPrimitive( const SHAPE_POLY_SET& aPoly, int aThickness )
poly_no_hole.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
for( auto iter = poly_no_hole.CIterate(); iter; iter++ )
points.push_back( wxPoint( iter->x, iter->y ) );
points.emplace_back( iter->x, iter->y );
AddPrimitive( points, aThickness );
}

View File

@ -352,22 +352,22 @@ void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector<MSG_PA
}
txt.Printf( wxT( "%d" ), board->GetPadCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Pads" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), viasCount );
aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), trackSegmentsCount );
aList.push_back( MSG_PANEL_ITEM( _( "Track Segments" ), txt, DARKGREEN ) );
aList.emplace_back( _( "Track Segments" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), board->GetNodesCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) );
aList.emplace_back( _( "Nodes" ), txt, DARKCYAN );
txt.Printf( wxT( "%d" ), board->GetNetCount() - 1 /* don't include "No Net" in count */ );
aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) );
aList.emplace_back( _( "Nets" ), txt, RED );
txt.Printf( wxT( "%d" ), board->GetConnectivity()->GetUnconnectedCount() );
aList.push_back( MSG_PANEL_ITEM( _( "Unrouted" ), txt, BLUE ) );
aList.emplace_back( _( "Unrouted" ), txt, BLUE );
}

View File

@ -86,7 +86,7 @@ void PCB_GENERAL_SETTINGS::Load( wxConfigBase* aCfg )
}
plugin = pluginTokenizer.GetNextToken();
m_pluginSettings.push_back( std::make_pair( plugin, pluginTokenizer.GetNextToken() ) );
m_pluginSettings.emplace_back( plugin, pluginTokenizer.GetNextToken() );
}
#endif

View File

@ -232,7 +232,7 @@ public:
for( auto n : m_allNodes )
{
anchorChains.push_back( ANCHOR_LIST() );
anchorChains.emplace_back( );
}
for( auto n : m_allNodes )
@ -310,7 +310,7 @@ public:
const auto& prevNode = chain[j - 1];
const auto& curNode = chain[j];
int weight = prevNode->GetCluster() != curNode->GetCluster() ? 1 : 0;
mstEdges.push_back( CN_EDGE ( prevNode, curNode, weight ) );
mstEdges.emplace_back( prevNode, curNode, weight );
}
}

View File

@ -567,8 +567,8 @@ void DP_GATEWAYS::BuildForCursor( const VECTOR2I& aCursorPos )
if( m_fitVias )
BuildGeneric( aCursorPos + dir, aCursorPos - dir, true, true );
else
m_gateways.push_back( DP_GATEWAY( aCursorPos + dir,
aCursorPos - dir, attempt ? true : false ) );
m_gateways.emplace_back( aCursorPos + dir,
aCursorPos - dir, attempt ? true : false );
}
}
@ -671,13 +671,13 @@ void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool
if( !aViaMode )
{
m_gateways.push_back( DP_GATEWAY( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio ) );
m_gateways.emplace_back( m - dir, m + dir, diagColl, DIRECTION_45::ANG_RIGHT, prio );
dir = makeGapVector( p0_n - p0_p, 2 * m_gap );
m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl ) );
m_gateways.push_back( DP_GATEWAY( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl ) );
m_gateways.push_back( DP_GATEWAY( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl ) );
m_gateways.push_back( DP_GATEWAY( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl ) );
m_gateways.emplace_back( p0_p - dir, p0_p - dir + dir.Perpendicular(), diagColl );
m_gateways.emplace_back( p0_p - dir, p0_p - dir - dir.Perpendicular(), diagColl );
m_gateways.emplace_back( p0_n + dir + dir.Perpendicular(), p0_n + dir, diagColl );
m_gateways.emplace_back( p0_n + dir - dir.Perpendicular(), p0_n + dir, diagColl );
}
}
}
@ -710,7 +710,7 @@ void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool
VECTOR2I g_p( ( p0_p - m ).Resize( ceil( (double) m_gap * M_SQRT1_2 ) ) );
VECTOR2I g_n( ( p0_n - m ).Resize( ceil( (double) m_gap * M_SQRT1_2 ) ) );
m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio ) );
m_gateways.emplace_back( m + g_p, m + g_n, k == 0 ? true : false, DIRECTION_45::ANG_OBTUSE, prio );
}
}
}
@ -733,13 +733,13 @@ void DP_GATEWAYS::BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool
g_n = ( p0_n - m ).Resize( ceil( (double) m_gap ) );
if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE )
m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) );
m_gateways.emplace_back( m + g_p, m + g_n, true );
g_p = ( p0_p - m ).Resize( m_gap );
g_n = ( p0_n - m ).Resize( ceil( (double) m_gap * M_SQRT2 ) );
if( angle( g_p, g_n ) != DIRECTION_45::ANG_ACUTE )
m_gateways.push_back( DP_GATEWAY( m + g_p, m + g_n, true ) );
m_gateways.emplace_back( m + g_p, m + g_n, true );
}
}
}

View File

@ -484,7 +484,7 @@ static SCENEGRAPH* vrmlToSG( VRML_LAYER& vpcb, int idxColor, SGNODE* aParent, do
size_t j = 0;
for( size_t i = 0; i < nvert; ++i, j+= 3 )
vlist.push_back( SGPOINT( vertices[j], vertices[j+1], vertices[j+2] ) );
vlist.emplace_back( vertices[j], vertices[j+1], vertices[j+2] );
// create the intermediate scenegraph
IFSG_TRANSFORM* tx0 = new IFSG_TRANSFORM( aParent ); // tx0 = Transform for this outline

View File

@ -839,7 +839,7 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent,
for(int i = 1; i <= triangulation->NbNodes(); i++)
{
gp_XYZ v( arrPolyNodes(i).Coord() );
vertices.push_back( SGPOINT( v.X(), v.Y(), v.Z() ) );
vertices.emplace_back( v.X(), v.Y(), v.Z() );
}
for(int i = 1; i <= triangulation->NbTriangles(); i++)

View File

@ -302,14 +302,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
std::vector< int > idx;
int base = 0;
// top
vertices.push_back( SGPOINT( -x, -y, z ) );
vertices.push_back( SGPOINT( x, -y, z ) );
vertices.push_back( SGPOINT( x, y, z ) );
vertices.push_back( SGPOINT( -x, y, z ) );
norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) );
norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) );
norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) );
norms.push_back( SGVECTOR( 0.0, 0.0, 1.0 ) );
vertices.emplace_back( -x, -y, z );
vertices.emplace_back( x, -y, z );
vertices.emplace_back( x, y, z );
vertices.emplace_back( -x, y, z );
norms.emplace_back( 0.0, 0.0, 1.0 );
norms.emplace_back( 0.0, 0.0, 1.0 );
norms.emplace_back( 0.0, 0.0, 1.0 );
norms.emplace_back( 0.0, 0.0, 1.0 );
idx.push_back( base );
idx.push_back( base + 1 );
idx.push_back( base + 2 );
@ -318,14 +318,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
idx.push_back( base + 3 );
base += 4;
// bottom
vertices.push_back( SGPOINT( -x, -y, -z ) );
vertices.push_back( SGPOINT( x, -y, -z ) );
vertices.push_back( SGPOINT( x, y, -z ) );
vertices.push_back( SGPOINT( -x, y, -z ) );
norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) );
norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) );
norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) );
norms.push_back( SGVECTOR( 0.0, 0.0, -1.0 ) );
vertices.emplace_back( -x, -y, -z );
vertices.emplace_back( x, -y, -z );
vertices.emplace_back( x, y, -z );
vertices.emplace_back( -x, y, -z );
norms.emplace_back( 0.0, 0.0, -1.0 );
norms.emplace_back( 0.0, 0.0, -1.0 );
norms.emplace_back( 0.0, 0.0, -1.0 );
norms.emplace_back( 0.0, 0.0, -1.0 );
idx.push_back( base );
idx.push_back( base + 2 );
idx.push_back( base + 1 );
@ -334,14 +334,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
idx.push_back( base + 2 );
base += 4;
// front
vertices.push_back( SGPOINT( -x, -y, z ) );
vertices.push_back( SGPOINT( -x, -y, -z ) );
vertices.push_back( SGPOINT( x, -y, -z ) );
vertices.push_back( SGPOINT( x, -y, z ) );
norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) );
norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) );
norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) );
norms.push_back( SGVECTOR( 0.0, -1.0, 0.0 ) );
vertices.emplace_back( -x, -y, z );
vertices.emplace_back( -x, -y, -z );
vertices.emplace_back( x, -y, -z );
vertices.emplace_back( x, -y, z );
norms.emplace_back( 0.0, -1.0, 0.0 );
norms.emplace_back( 0.0, -1.0, 0.0 );
norms.emplace_back( 0.0, -1.0, 0.0 );
norms.emplace_back( 0.0, -1.0, 0.0 );
idx.push_back( base );
idx.push_back( base + 1 );
idx.push_back( base + 2 );
@ -350,14 +350,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
idx.push_back( base + 3 );
base += 4;
// back
vertices.push_back( SGPOINT( -x, y, z ) );
vertices.push_back( SGPOINT( -x, y, -z ) );
vertices.push_back( SGPOINT( x, y, -z ) );
vertices.push_back( SGPOINT( x, y, z ) );
norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) );
norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) );
norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) );
norms.push_back( SGVECTOR( 0.0, 1.0, 0.0 ) );
vertices.emplace_back( -x, y, z );
vertices.emplace_back( -x, y, -z );
vertices.emplace_back( x, y, -z );
vertices.emplace_back( x, y, z );
norms.emplace_back( 0.0, 1.0, 0.0 );
norms.emplace_back( 0.0, 1.0, 0.0 );
norms.emplace_back( 0.0, 1.0, 0.0 );
norms.emplace_back( 0.0, 1.0, 0.0 );
idx.push_back( base );
idx.push_back( base + 2 );
idx.push_back( base + 1 );
@ -366,14 +366,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
idx.push_back( base + 2 );
base += 4;
// left
vertices.push_back( SGPOINT( -x, -y, -z ) );
vertices.push_back( SGPOINT( -x, -y, z ) );
vertices.push_back( SGPOINT( -x, y, z ) );
vertices.push_back( SGPOINT( -x, y, -z ) );
norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) );
norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) );
norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) );
norms.push_back( SGVECTOR( -1.0, 0.0, 0.0 ) );
vertices.emplace_back( -x, -y, -z );
vertices.emplace_back( -x, -y, z );
vertices.emplace_back( -x, y, z );
vertices.emplace_back( -x, y, -z );
norms.emplace_back( -1.0, 0.0, 0.0 );
norms.emplace_back( -1.0, 0.0, 0.0 );
norms.emplace_back( -1.0, 0.0, 0.0 );
norms.emplace_back( -1.0, 0.0, 0.0 );
idx.push_back( base );
idx.push_back( base + 1 );
idx.push_back( base + 2 );
@ -382,14 +382,14 @@ SGNODE* WRL2BOX::TranslateToSG( SGNODE* aParent )
idx.push_back( base + 3 );
base += 4;
// right
vertices.push_back( SGPOINT( x, -y, -z ) );
vertices.push_back( SGPOINT( x, -y, z ) );
vertices.push_back( SGPOINT( x, y, z ) );
vertices.push_back( SGPOINT( x, y, -z ) );
norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) );
norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) );
norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) );
norms.push_back( SGVECTOR( 1.0, 0.0, 0.0 ) );
vertices.emplace_back( x, -y, -z );
vertices.emplace_back( x, -y, z );
vertices.emplace_back( x, y, z );
vertices.emplace_back( x, y, -z );
norms.emplace_back( 1.0, 0.0, 0.0 );
norms.emplace_back( 1.0, 0.0, 0.0 );
norms.emplace_back( 1.0, 0.0, 0.0 );
norms.emplace_back( 1.0, 0.0, 0.0 );
idx.push_back( base );
idx.push_back( base + 2 );
idx.push_back( base + 1 );

View File

@ -818,7 +818,7 @@ SGNODE* SHAPE::CalcShape( SGNODE* aParent, SGNODE* aColor, WRL1_ORDER aVertexOrd
pt.y = vertices[i].y;
pt.z = vertices[i].z;
lCPts.push_back( pt );
lCNorm.push_back( SGVECTOR( normals[i].x, normals[i].y, normals[i].z ) );
lCNorm.emplace_back( normals[i].x, normals[i].y, normals[i].z );
}
vertices.clear();

View File

@ -5222,7 +5222,7 @@ void ClipperOffset::DoOffset( double delta )
if( node.m_endtype == etClosedLine || node.m_endtype == etClosedPolygon )
m_normals.push_back( GetUnitNormal( m_srcPoly[len - 1], m_srcPoly[0] ) );
else
m_normals.push_back( DoublePoint( m_normals[len - 2] ) );
m_normals.emplace_back( m_normals[len - 2] );
if( node.m_endtype == etClosedPolygon )
{

View File

@ -58,45 +58,45 @@ struct CommonTestData
CommonTestData()
{
// UniqueVertexPolySet shall have a unique vertex
uniquePoints.push_back( VECTOR2I( 100, 50 ) );
uniquePoints.emplace_back( 100, 50 );
// Populate the holey polygon set points with 12 points
// Square
holeyPoints.push_back( VECTOR2I( 100, 100 ) );
holeyPoints.push_back( VECTOR2I( 0, 100 ) );
holeyPoints.push_back( VECTOR2I( 0, 0 ) );
holeyPoints.push_back( VECTOR2I( 100, 0 ) );
holeyPoints.emplace_back( 100, 100 );
holeyPoints.emplace_back( 0, 100 );
holeyPoints.emplace_back( 0, 0 );
holeyPoints.emplace_back( 100, 0 );
// Pentagon
holeyPoints.push_back( VECTOR2I( 10, 10 ) );
holeyPoints.push_back( VECTOR2I( 10, 20 ) );
holeyPoints.push_back( VECTOR2I( 15, 15 ) );
holeyPoints.push_back( VECTOR2I( 20, 20 ) );
holeyPoints.push_back( VECTOR2I( 20, 10 ) );
holeyPoints.emplace_back( 10, 10 );
holeyPoints.emplace_back( 10, 20 );
holeyPoints.emplace_back( 15, 15 );
holeyPoints.emplace_back( 20, 20 );
holeyPoints.emplace_back( 20, 10 );
// Triangle
holeyPoints.push_back( VECTOR2I( 40, 10 ) );
holeyPoints.push_back( VECTOR2I( 40, 20 ) );
holeyPoints.push_back( VECTOR2I( 60, 10 ) );
holeyPoints.emplace_back( 40, 10 );
holeyPoints.emplace_back( 40, 20 );
holeyPoints.emplace_back( 60, 10 );
// Save the segments of the holeyPolySet.
holeySegments.push_back( SEG( holeyPoints[0], holeyPoints[1] ) );
holeySegments.push_back( SEG( holeyPoints[1], holeyPoints[2] ) );
holeySegments.push_back( SEG( holeyPoints[2], holeyPoints[3] ) );
holeySegments.push_back( SEG( holeyPoints[3], holeyPoints[0] ) );
holeySegments.emplace_back( holeyPoints[0], holeyPoints[1] );
holeySegments.emplace_back( holeyPoints[1], holeyPoints[2] );
holeySegments.emplace_back( holeyPoints[2], holeyPoints[3] );
holeySegments.emplace_back( holeyPoints[3], holeyPoints[0] );
// Pentagon segments
holeySegments.push_back( SEG( holeyPoints[4], holeyPoints[5] ) );
holeySegments.push_back( SEG( holeyPoints[5], holeyPoints[6] ) );
holeySegments.push_back( SEG( holeyPoints[6], holeyPoints[7] ) );
holeySegments.push_back( SEG( holeyPoints[7], holeyPoints[8] ) );
holeySegments.push_back( SEG( holeyPoints[8], holeyPoints[4] ) );
holeySegments.emplace_back( holeyPoints[4], holeyPoints[5] );
holeySegments.emplace_back( holeyPoints[5], holeyPoints[6] );
holeySegments.emplace_back( holeyPoints[6], holeyPoints[7] );
holeySegments.emplace_back( holeyPoints[7], holeyPoints[8] );
holeySegments.emplace_back( holeyPoints[8], holeyPoints[4] );
// Triangle segments
holeySegments.push_back( SEG( holeyPoints[9], holeyPoints[10] ) );
holeySegments.push_back( SEG( holeyPoints[10], holeyPoints[11] ) );
holeySegments.push_back( SEG( holeyPoints[11], holeyPoints[9] ) );
holeySegments.emplace_back( holeyPoints[9], holeyPoints[10] );
holeySegments.emplace_back( holeyPoints[10], holeyPoints[11] );
holeySegments.emplace_back( holeyPoints[11], holeyPoints[9] );
// Auxiliary variables to store the contours that will be added to the polygons
SHAPE_LINE_CHAIN polyLine, hole;

View File

@ -49,24 +49,24 @@ struct CollisionFixture
// Create points colliding with the poly set.
// Inside the polygon
collidingPoints.push_back( VECTOR2I( 10, 90 ) );
collidingPoints.emplace_back( 10, 90 );
// Inside the polygon, but on a re-entrant angle of a hole
collidingPoints.push_back( VECTOR2I( 15, 16 ) );
collidingPoints.emplace_back( 15, 16 );
// On a hole edge => inside the polygon
collidingPoints.push_back( VECTOR2I( 40, 25 ) );
collidingPoints.emplace_back( 40, 25 );
// Create points not colliding with the poly set.
// On the outline edge => outside the polygon
nonCollidingPoints.push_back( VECTOR2I( 0, 10 ) );
nonCollidingPoints.emplace_back( 0, 10 );
// Completely outside of the polygon
nonCollidingPoints.push_back( VECTOR2I( 200, 200 ) );
nonCollidingPoints.emplace_back( 200, 200 );
// Inside the outline and inside a hole => outside the polygon
nonCollidingPoints.push_back( VECTOR2I( 15, 12 ) );
nonCollidingPoints.emplace_back( 15, 12 );
}
~CollisionFixture()

View File

@ -47,9 +47,9 @@ struct IteratorFixture
IteratorFixture()
{
nullPoints.push_back( VECTOR2I( 100, 100 ) );
nullPoints.push_back( VECTOR2I( 0, 100 ) );
nullPoints.push_back( VECTOR2I( 0, 0 ) );
nullPoints.emplace_back( 100, 100 );
nullPoints.emplace_back( 0, 100 );
nullPoints.emplace_back( 0, 0 );
// Create a polygon with its last segment null
SHAPE_LINE_CHAIN polyLine;

View File

@ -1388,7 +1388,7 @@ bool VRML_LAYER::addTriplet( VERTEX_3D* p0, VERTEX_3D* p1, VERTEX_3D* p2 )
if( ( dx2 + dy2 ) < err )
return false;
triplets.push_back( TRIPLET_3D( p0->o, p1->o, p2->o ) );
triplets.emplace_back( p0->o, p1->o, p2->o );
return true;
}