Added a lot of consts and refactored a few lines

This commit is contained in:
Dominik Wernberger 2021-03-06 10:27:41 +01:00 committed by Seth Hillbrand
parent c16199c3f9
commit e2aa7be4b3
102 changed files with 673 additions and 689 deletions

View File

@ -168,7 +168,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
const SFVEC2F& rightStart = aSeg->GetRightStar();
const SFVEC2F& rightEnd = aSeg->GetRightEnd();
const SFVEC2F& rightDir = aSeg->GetRightDir();
const float radius = aSeg->GetRadius();
const float radius = aSeg->GetRadius();
const SFVEC2F& start = aSeg->GetStart();
const SFVEC2F& end = aSeg->GetEnd();
@ -176,7 +176,7 @@ void RENDER_3D_LEGACY::addObjectTriangles( const ROUND_SEGMENT_2D* aSeg,
const float texture_factor = ( 12.0f / (float) SIZE_OF_CIRCLE_TEXTURE ) + 1.0f;
const float texture_factorF = ( 6.0f / (float) SIZE_OF_CIRCLE_TEXTURE ) + 1.0f;
const float radius_of_the_square = sqrtf( aSeg->GetRadiusSquared() * 2.0f );
const float radius_of_the_square = sqrtf( aSeg->GetRadiusSquared() * 2.0f );
const float radius_triangle_factor = ( radius_of_the_square - radius ) / radius;
const SFVEC2F factorS = SFVEC2F( -rightDir.y * radius * radius_triangle_factor,
@ -255,11 +255,9 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateHoles( const LIST_OBJECT2D& aListH
new TRIANGLE_DISPLAY_LIST( aListHolesObject2d.size() * 2 );
// Convert the list of objects(filled circles) to triangle layer structure
for( LIST_OBJECT2D::const_iterator itemOnLayer = aListHolesObject2d.begin();
itemOnLayer != aListHolesObject2d.end();
++itemOnLayer )
for( const OBJECT_2D* itemOnLayer : aListHolesObject2d )
{
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
const OBJECT_2D* object2d_A = itemOnLayer;
wxASSERT( ( object2d_A->GetObjectType() == OBJECT_2D_TYPE::FILLED_CIRCLE )
|| ( object2d_A->GetObjectType() == OBJECT_2D_TYPE::ROUNDSEG ) );
@ -327,37 +325,35 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D*
m_triangles.push_back( layerTriangles );
// Load the 2D (X,Y axis) component of shapes
for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin();
itemOnLayer != listObject2d.end();
++itemOnLayer )
for( const OBJECT_2D* itemOnLayer : listObject2d )
{
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
const OBJECT_2D* object2d_A = itemOnLayer;
switch( object2d_A->GetObjectType() )
{
case OBJECT_2D_TYPE::FILLED_CIRCLE:
addObjectTriangles( (const FILLED_CIRCLE_2D *)object2d_A, layerTriangles,
layer_z_top, layer_z_bot );
addObjectTriangles( static_cast<const FILLED_CIRCLE_2D*>( object2d_A ),
layerTriangles, layer_z_top, layer_z_bot );
break;
case OBJECT_2D_TYPE::POLYGON4PT:
addObjectTriangles( (const POLYGON_4PT_2D*)object2d_A, layerTriangles,
layer_z_top, layer_z_bot );
addObjectTriangles( static_cast<const POLYGON_4PT_2D*>( object2d_A ),
layerTriangles, layer_z_top, layer_z_bot );
break;
case OBJECT_2D_TYPE::RING:
addObjectTriangles( (const RING_2D*)object2d_A, layerTriangles, layer_z_top,
layer_z_bot );
addObjectTriangles( static_cast<const RING_2D*>( object2d_A ),
layerTriangles, layer_z_top, layer_z_bot );
break;
case OBJECT_2D_TYPE::TRIANGLE:
addObjectTriangles( (const TRIANGLE_2D*)object2d_A, layerTriangles, layer_z_top,
layer_z_bot );
addObjectTriangles( static_cast<const TRIANGLE_2D*>( object2d_A ),
layerTriangles, layer_z_top, layer_z_bot );
break;
case OBJECT_2D_TYPE::ROUNDSEG:
addObjectTriangles( (const ROUND_SEGMENT_2D*) object2d_A, layerTriangles,
layer_z_top, layer_z_bot );
addObjectTriangles( static_cast<const ROUND_SEGMENT_2D*>( object2d_A ),
layerTriangles, layer_z_top, layer_z_bot );
break;
default:
@ -366,7 +362,7 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::generateLayerList( const BVH_CONTAINER_2D*
}
}
if( aPolyList &&aPolyList->OutlineCount() > 0 )
if( aPolyList && aPolyList->OutlineCount() > 0 )
{
layerTriangles->AddToMiddleContourns( *aPolyList, layer_z_bot, layer_z_top,
m_boardAdapter.BiuTo3dUnits(), false, aThroughHoles );
@ -401,15 +397,13 @@ OPENGL_RENDER_LIST* RENDER_3D_LEGACY::createBoard( const SHAPE_POLY_SET& aBoardP
new TRIANGLE_DISPLAY_LIST( listBoardObject2d.size() );
// Convert the list of objects(triangles) to triangle layer structure
for( LIST_OBJECT2D::const_iterator itemOnLayer = listBoardObject2d.begin();
itemOnLayer != listBoardObject2d.end();
++itemOnLayer )
for( const OBJECT_2D* itemOnLayer : listBoardObject2d )
{
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
const OBJECT_2D* object2d_A = itemOnLayer;
wxASSERT( object2d_A->GetObjectType() == OBJECT_2D_TYPE::TRIANGLE );
const TRIANGLE_2D* tri = (const TRIANGLE_2D *)object2d_A;
const TRIANGLE_2D* tri = static_cast<const TRIANGLE_2D*>( object2d_A );
const SFVEC2F& v1 = tri->GetP1();
const SFVEC2F& v2 = tri->GetP2();
@ -520,10 +514,10 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
float layer_z_bot = 0.0f;
float layer_z_top = 0.0f;
for( MAP_POLY::const_iterator ii = outerMapHoles.begin(); ii != outerMapHoles.end(); ++ii )
for( const auto ii : outerMapHoles )
{
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
const SHAPE_POLY_SET* poly = static_cast<const SHAPE_POLY_SET*>( ii->second );
const PCB_LAYER_ID layer_id = ii.first;
const SHAPE_POLY_SET* poly = ii.second;
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
@ -532,10 +526,10 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
layer_z_top, layer_z_bot, false );
}
for( MAP_POLY::const_iterator ii = innerMapHoles.begin(); ii != innerMapHoles.end(); ++ii )
for( const auto ii : innerMapHoles )
{
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>( ii->first );
const SHAPE_POLY_SET* poly = static_cast<const SHAPE_POLY_SET*>( ii->second );
const PCB_LAYER_ID layer_id = ii.first;
const SHAPE_POLY_SET* poly = ii.second;
const BVH_CONTAINER_2D* container = map_holes.at( layer_id );
getLayerZPos( layer_id, layer_z_top, layer_z_bot );
@ -554,16 +548,14 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
const MAP_POLY& map_poly = m_boardAdapter.GetPolyMap();
for( MAP_CONTAINER_2D_BASE::const_iterator ii = m_boardAdapter.GetLayerMap().begin();
ii != m_boardAdapter.GetLayerMap().end();
++ii )
for( const auto ii : m_boardAdapter.GetLayerMap() )
{
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>( ii->first );
const PCB_LAYER_ID layer_id = ii.first;
if( !m_boardAdapter.Is3dLayerEnabled( layer_id ) )
continue;
const BVH_CONTAINER_2D* container2d = static_cast<const BVH_CONTAINER_2D*>( ii->second );
const BVH_CONTAINER_2D* container2d = ii.second;
SHAPE_POLY_SET polyListSubtracted;
SHAPE_POLY_SET* aPolyList = nullptr;
@ -601,7 +593,6 @@ void RENDER_3D_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
polyListSubtracted.BooleanSubtract( *map_poly.at( F_Mask ),
SHAPE_POLY_SET::PM_FAST );
}
}
}
@ -730,7 +721,7 @@ void RENDER_3D_LEGACY::generateCylinder( const SFVEC2F& aCenter, float aInnerRad
void RENDER_3D_LEGACY::generateViasAndPads()
{
if( m_boardAdapter.GetViaCount() )
if( m_boardAdapter.GetViaCount() > 0 )
{
const unsigned int reserve_nr_triangles_estimation =
m_boardAdapter.GetCircleSegmentCount(
@ -743,11 +734,11 @@ void RENDER_3D_LEGACY::generateViasAndPads()
// Insert plated vertical holes inside the board
// Insert vias holes (vertical cylinders)
for( auto track : m_boardAdapter.GetBoard()->Tracks() )
for( const TRACK* track : m_boardAdapter.GetBoard()->Tracks() )
{
if( track->Type() == PCB_VIA_T )
{
const VIA* via = static_cast<const VIA*>(track);
const VIA* via = static_cast<const VIA*>( track );
const float holediameter = via->GetDrillValue() * m_boardAdapter.BiuTo3dUnits();
const float thickness = m_boardAdapter.GetCopperThickness();
@ -789,7 +780,7 @@ void RENDER_3D_LEGACY::generateViasAndPads()
// Insert pads holes (vertical cylinders)
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{
for( PAD* pad : footprint->Pads() )
for( const PAD* pad : footprint->Pads() )
{
if( pad->GetAttribute() != PAD_ATTRIB_NPTH )
{
@ -835,15 +826,13 @@ void RENDER_3D_LEGACY::generateViasAndPads()
new TRIANGLE_DISPLAY_LIST( listHolesObject2d.size() );
// Convert the list of objects(triangles) to triangle layer structure
for( LIST_OBJECT2D::const_iterator itemOnLayer = listHolesObject2d.begin();
itemOnLayer != listHolesObject2d.end();
++itemOnLayer )
for( const OBJECT_2D* itemOnLayer : listHolesObject2d )
{
const OBJECT_2D* object2d_A = static_cast<const OBJECT_2D*>( *itemOnLayer );
const OBJECT_2D* object2d_A = itemOnLayer;
wxASSERT( object2d_A->GetObjectType() == OBJECT_2D_TYPE::TRIANGLE );
const TRIANGLE_2D* tri = (const TRIANGLE_2D *)object2d_A;
const TRIANGLE_2D* tri = static_cast<const TRIANGLE_2D*>( object2d_A );
const SFVEC2F& v1 = tri->GetP1();
const SFVEC2F& v2 = tri->GetP2();
@ -880,7 +869,7 @@ void RENDER_3D_LEGACY::load3dModels( REPORTER* aStatusReporter )
}
// Go for all footprints
for( FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
{
for( const FP_3DMODEL& model : footprint->Models() )
{

View File

@ -340,7 +340,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
const wxPoint& aPos,
COLOR4D aDefaultColor,
int aDefaultPensize )
int aDefaultPensize ) const
{
if( m_image == NULL )
return;

View File

@ -70,7 +70,7 @@ EDA_TEXT_HJUSTIFY_T EDA_TEXT::MapHorizJustify( int aHorizJustify )
if( aHorizJustify < GR_TEXT_HJUSTIFY_LEFT )
return GR_TEXT_HJUSTIFY_LEFT;
return (EDA_TEXT_HJUSTIFY_T) aHorizJustify;
return static_cast<EDA_TEXT_HJUSTIFY_T>( aHorizJustify );
}
@ -84,13 +84,13 @@ EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
if( aVertJustify < GR_TEXT_VJUSTIFY_TOP )
return GR_TEXT_VJUSTIFY_TOP;
return (EDA_TEXT_VJUSTIFY_T) aVertJustify;
return static_cast<EDA_TEXT_VJUSTIFY_T>( aVertJustify );
}
EDA_TEXT::EDA_TEXT( const wxString& text ) :
m_text( text ),
m_e( 1<<TE_VISIBLE )
m_e( 1 << TE_VISIBLE )
{
int sz = Mils2iu( DEFAULT_SIZE_TEXT );
SetTextSize( wxSize( sz, sz ) );
@ -510,9 +510,9 @@ bool EDA_TEXT::IsDefaultFormatting() const
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
&& GetTextThickness() == 0
&& !IsItalic()
&& !IsBold()
&& !IsMultilineAllowed()
&& !IsItalic()
&& !IsBold()
&& !IsMultilineAllowed()
);
}

View File

@ -136,7 +136,7 @@ bool FILENAME_RESOLVER::SetProject( PROJECT* aProject, bool* flgChanged )
}
wxString FILENAME_RESOLVER::GetProjectDir()
wxString FILENAME_RESOLVER::GetProjectDir() const
{
return m_curProjDir;
}
@ -192,7 +192,7 @@ bool FILENAME_RESOLVER::createPathList()
lpath.m_Pathexp = fndummy.GetFullPath();
}
lpath.m_Alias = curr_path;
lpath.m_Alias = curr_path;
lpath.m_Pathvar = curr_path;
if( !lpath.m_Pathexp.empty() && psep == *lpath.m_Pathexp.rbegin() )
@ -224,17 +224,15 @@ bool FILENAME_RESOLVER::createPathList()
}
bool FILENAME_RESOLVER::UpdatePathList( std::vector< SEARCH_PATH >& aPathList )
bool FILENAME_RESOLVER::UpdatePathList( const std::vector< SEARCH_PATH >& aPathList )
{
wxUniChar envMarker( '$' );
while( !m_paths.empty() && envMarker != *m_paths.back().m_Alias.rbegin() )
m_paths.pop_back();
size_t nI = aPathList.size();
for( size_t i = 0; i < nI; ++i )
addPath( aPathList[i] );
for( const SEARCH_PATH& path : aPathList )
addPath( path );
return writePathList();
}
@ -471,7 +469,6 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
#endif
}
wxString pname = path.GetPath();
std::list< SEARCH_PATH >::iterator sPL = m_paths.begin();
std::list< SEARCH_PATH >::iterator ePL = m_paths.end();
@ -822,14 +819,14 @@ wxString FILENAME_RESOLVER::ShortenPath( const wxString& aFullPathName )
const std::list< SEARCH_PATH >* FILENAME_RESOLVER::GetPaths()
const std::list< SEARCH_PATH >* FILENAME_RESOLVER::GetPaths() const
{
return &m_paths;
}
bool FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
wxString& anAlias, wxString& aRelPath )
wxString& anAlias, wxString& aRelPath ) const
{
anAlias.clear();
aRelPath.clear();
@ -839,7 +836,7 @@ bool FILENAME_RESOLVER::SplitAlias( const wxString& aFileName,
size_t tagpos = aFileName.find( wxT( ":" ), 1 );
if( wxString::npos == tagpos || 1 == tagpos )
if( wxString::npos == tagpos || 1 == tagpos )
return false;
if( tagpos + 1 >= aFileName.length() )
@ -947,7 +944,7 @@ static bool getHollerith( const std::string& aString, size_t& aIndex, wxString&
}
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias )
bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAlias ) const
{
// Rules:
// 1. The generic form of an aliased 3D relative path is:
@ -1005,7 +1002,7 @@ bool FILENAME_RESOLVER::ValidateFileName( const wxString& aFileName, bool& hasAl
}
bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths )
bool FILENAME_RESOLVER::GetKicadPaths( std::list< wxString >& paths ) const
{
paths.clear();

View File

@ -111,8 +111,8 @@ private:
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
{
for( auto b = m_bitmaps.begin(); b != m_bitmaps.end(); ++b )
glDeleteTextures( 1, &b->second.id );
for( auto& bitmap : m_bitmaps )
glDeleteTextures( 1, &bitmap.second.id );
}

View File

@ -412,7 +412,7 @@ bool RC_TREE_MODEL::GetAttr( wxDataViewItem const& aItem,
}
void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode )
void RC_TREE_MODEL::ValueChanged( const RC_TREE_NODE* aNode )
{
if( aNode->m_Type == RC_TREE_NODE::MAIN_ITEM || aNode->m_Type == RC_TREE_NODE::AUX_ITEM )
{
@ -423,7 +423,7 @@ void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode )
{
wxDataViewModel::ValueChanged( ToItem( aNode ), 0 );
for( RC_TREE_NODE* child : aNode->m_Children )
for( const RC_TREE_NODE* child : aNode->m_Children )
wxDataViewModel::ValueChanged( ToItem( child ), 0 );
}
}
@ -437,7 +437,7 @@ void RC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep )
{
RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
const std::shared_ptr<RC_ITEM> current_item = current_node ? current_node->m_RcItem : nullptr;
/// Keep a vector of elements to free after wxWidgets is definitely done accessing them

View File

@ -293,7 +293,7 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
}
VECTOR2D TOOL_MANAGER::GetMousePosition()
VECTOR2D TOOL_MANAGER::GetMousePosition() const
{
if( m_viewControls )
return m_viewControls->GetMousePosition();
@ -302,7 +302,7 @@ VECTOR2D TOOL_MANAGER::GetMousePosition()
}
VECTOR2D TOOL_MANAGER::GetCursorPosition()
VECTOR2D TOOL_MANAGER::GetCursorPosition() const
{
if( m_viewControls )
return m_viewControls->GetCursorPosition();
@ -361,13 +361,13 @@ void TOOL_MANAGER::PrimeTool( const VECTOR2D& aPosition )
}
const std::map<std::string, TOOL_ACTION*>& TOOL_MANAGER::GetActions()
const std::map<std::string, TOOL_ACTION*>& TOOL_MANAGER::GetActions() const
{
return m_actionMgr->GetActions();
}
int TOOL_MANAGER::GetHotKey( const TOOL_ACTION& aAction )
int TOOL_MANAGER::GetHotKey( const TOOL_ACTION& aAction ) const
{
return m_actionMgr->GetHotKey( aAction );
}
@ -475,7 +475,7 @@ void TOOL_MANAGER::ShutdownTool( TOOL_BASE* aTool )
if( isActive( aTool ) )
{
auto it = std::find( m_activeTools.begin(), m_activeTools.end(), id );
TOOL_MANAGER::ID_LIST::iterator it = std::find( m_activeTools.begin(), m_activeTools.end(), id );
TOOL_STATE* st = m_toolIdIndex[*it];
@ -644,7 +644,7 @@ TOOL_EVENT* TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool, const TOOL_EVENT_LIST&
}
bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
bool TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
{
bool handled = false;
@ -676,7 +676,7 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
if( st && st->cofunc && st->pendingWait && st->waitEvents.Matches( aEvent ) )
{
if( !aEvent.FirstResponder() )
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
aEvent.SetFirstResponder( st->theTool );
// got matching event? clear wait list and wake up the coroutine
st->wakeupEvent = aEvent;
@ -711,7 +711,7 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
++it;
}
for( auto& state : m_toolState )
for( const auto& state : m_toolState )
{
TOOL_STATE* st = state.second;
bool finished = false;
@ -720,14 +720,14 @@ bool TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
// Go() method that match the event.
if( !st->transitions.empty() )
{
for( TRANSITION& tr : st->transitions )
for( const TRANSITION& tr : st->transitions )
{
if( tr.first.Matches( aEvent ) )
{
auto func_copy = tr.second;
if( !aEvent.FirstResponder() )
const_cast<TOOL_EVENT*>( &aEvent )->SetFirstResponder( st->theTool );
aEvent.SetFirstResponder( st->theTool );
// if there is already a context, then push it on the stack
// and transfer the previous view control settings to the new context
@ -1040,7 +1040,7 @@ void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KIGFX::VIEW* aView,
}
bool TOOL_MANAGER::isActive( TOOL_BASE* aTool )
bool TOOL_MANAGER::isActive( TOOL_BASE* aTool ) const
{
if( !isRegistered( aTool ) )
return false;
@ -1090,7 +1090,7 @@ void TOOL_MANAGER::saveViewControls( TOOL_STATE* aState )
}
void TOOL_MANAGER::applyViewControls( TOOL_STATE* aState )
void TOOL_MANAGER::applyViewControls( const TOOL_STATE* aState )
{
m_viewControls->ApplySettings( aState->vcSettings );
}

View File

@ -89,9 +89,9 @@ ITEM_PICKER PICKED_ITEMS_LIST::PopItem()
bool PICKED_ITEMS_LIST::ContainsItem( const EDA_ITEM* aItem ) const
{
for( size_t i = 0; i < m_ItemsList.size(); i++ )
for( const ITEM_PICKER& picker : m_ItemsList )
{
if( m_ItemsList[ i ].GetItem() == aItem )
if( picker.GetItem() == aItem )
return true;
}

View File

@ -80,7 +80,7 @@ mpLayer::mpLayer() : m_type( mpLAYER_UNDEF )
}
wxBitmap mpLayer::GetColourSquare( int side )
wxBitmap mpLayer::GetColourSquare( int side ) const
{
wxBitmap square( side, side, -1 );
wxColour filler = m_pen.GetColour();
@ -193,13 +193,13 @@ void mpInfoLayer::Plot( wxDC& dc, mpWindow& w )
}
wxPoint mpInfoLayer::GetPosition()
wxPoint mpInfoLayer::GetPosition() const
{
return m_dim.GetPosition();
}
wxSize mpInfoLayer::GetSize()
wxSize mpInfoLayer::GetSize() const
{
return m_dim.GetSize();
}
@ -963,11 +963,11 @@ mpScaleBase::mpScaleBase()
}
#if 0
int mpScaleBase::getLabelDecimalDigits( int maxDigits )
int mpScaleBase::getLabelDecimalDigits( int maxDigits ) const
{
int m = 0;
for( auto l : m_tickLabels )
for( const TickLabel& l : m_tickLabels )
{
int k = countDecimalDigits( l.pos );
m = std::max( k, m );
@ -975,9 +975,7 @@ int mpScaleBase::getLabelDecimalDigits( int maxDigits )
return std::min( m, maxDigits );
}
#endif
#endif // 0
void mpScaleBase::computeLabelExtents( wxDC& dc, mpWindow& w )
{
@ -1069,9 +1067,8 @@ double mpScaleX::getLabelPos( int n )
{
return 0; // return m_labeledTicks[n];
}
#endif // 0
#endif
void mpScaleY::getVisibleDataRange( mpWindow& w, double& minV, double& maxV )
{
wxCoord minYpx = m_drawOutsideMargins ? 0 : w.GetMarginTop();
@ -2035,7 +2032,7 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
yMin -= yExtra;
yMax += yExtra;
if( printSizeX!=NULL && printSizeY!=NULL )
if( printSizeX != NULL && printSizeY != NULL )
{
// Printer:
m_scrX = *printSizeX;
@ -2052,8 +2049,8 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
Ax = xMax - xMin;
Ay = yMax - yMin;
m_scaleX = (Ax!=0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax!=0) ? m_scrX/Ax : 1;
m_scaleY = (Ay!=0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay!=0) ? m_scrY/Ay : 1;
m_scaleX = (Ax != 0) ? (m_scrX - m_marginLeft - m_marginRight) / Ax : 1; // m_scaleX = (Ax != 0) ? m_scrX / Ax : 1;
m_scaleY = (Ay != 0) ? (m_scrY - m_marginTop - m_marginBottom) / Ay : 1; // m_scaleY = (Ay != 0) ? m_scrY / Ay : 1;
if( m_lockaspect )
{
@ -2076,7 +2073,7 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
// It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!!
// Otherwise, the DC dimensions will be those of the window instead of the printer device
if( printSizeX==NULL || printSizeY==NULL )
if( printSizeX == NULL || printSizeY == NULL )
UpdateAll();
}
@ -2495,7 +2492,7 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
// J.L.Blanco @ Aug 2007: Added double buffer support
if( m_enableDoubleBuffer )
{
if( m_last_lx!=m_scrX || m_last_ly!=m_scrY )
if( m_last_lx != m_scrX || m_last_ly != m_scrY )
{
if( m_buff_bmp )
delete m_buff_bmp;
@ -2921,7 +2918,7 @@ void mpWindow::OnScrollBottom( wxScrollWinEvent& event )
void mpWindow::SetScaleX( double scaleX )
{
if( scaleX!=0 )
if( scaleX != 0 )
m_scaleX = scaleX;
UpdateAll();
@ -2930,25 +2927,21 @@ void mpWindow::SetScaleX( double scaleX )
// New methods implemented by Davide Rondini
unsigned int mpWindow::CountLayers()
unsigned int mpWindow::CountLayers() const
{
// wxNode *node = m_layers.GetFirst();
unsigned int layerNo = 0;
for( wxLayerList::iterator li = m_layers.begin(); li != m_layers.end(); li++ ) // while(node)
for( const mpLayer* layer : m_layers )
{
if( (*li)->HasBBox() )
if( layer->HasBBox() )
layerNo++;
// node = node->GetNext();
}
;
return layerNo;
}
mpLayer* mpWindow::GetLayer( int position )
mpLayer* mpWindow::GetLayer( int position ) const
{
if( ( position >= (int) m_layers.size() ) || position < 0 )
return NULL;
@ -2957,18 +2950,17 @@ mpLayer* mpWindow::GetLayer( int position )
}
mpLayer* mpWindow::GetLayerByName( const wxString& name )
const mpLayer* mpWindow::GetLayerByName( const wxString& name ) const
{
for( wxLayerList::iterator it = m_layers.begin(); it!=m_layers.end(); it++ )
if( !(*it)->GetName().Cmp( name ) )
return *it;
for( const mpLayer* layer : m_layers )
if( !layer->GetName().Cmp( name ) )
return layer;
return NULL; // Not found
}
void mpWindow::GetBoundingBox( double* bbox )
void mpWindow::GetBoundingBox( double* bbox ) const
{
bbox[0] = m_minX;
bbox[1] = m_maxX;
@ -3016,10 +3008,8 @@ bool mpWindow::SaveScreenshot( const wxString& filename, wxBitmapType type,
}
// Draw all the layers:
wxLayerList::iterator li;
for( li = m_layers.begin(); li != m_layers.end(); li++ )
(*li)->Plot( screenDC, *this );
for( mpLayer* layer : m_layers )
layer->Plot( screenDC, *this );
if( imageSize != wxDefaultSize )
{
@ -3037,22 +3027,20 @@ bool mpWindow::SaveScreenshot( const wxString& filename, wxBitmapType type,
void mpWindow::SetMargins( int top, int right, int bottom, int left )
{
m_marginTop = top;
m_marginRight = right;
m_marginBottom = bottom;
m_marginLeft = left;
m_marginTop = top;
m_marginRight = right;
m_marginBottom = bottom;
m_marginLeft = left;
}
mpInfoLayer* mpWindow::IsInsideInfoLayer( wxPoint& point )
{
wxLayerList::iterator li;
for( li = m_layers.begin(); li != m_layers.end(); li++ )
for( mpLayer* layer : m_layers )
{
if( (*li)->IsInfo() )
if( layer->IsInfo() )
{
mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
mpInfoLayer* tmpLyr = static_cast<mpInfoLayer*>( layer );
if( tmpLyr->Inside( point ) )
{
@ -3077,11 +3065,11 @@ void mpWindow::SetLayerVisible( const wxString& name, bool viewable )
}
bool mpWindow::IsLayerVisible( const wxString& name )
bool mpWindow::IsLayerVisible( const wxString& name ) const
{
mpLayer* lx = GetLayerByName( name );
const mpLayer* lx = GetLayerByName( name );
return (lx) ? lx->IsVisible() : false;
return lx ? lx->IsVisible() : false;
}
@ -3097,7 +3085,7 @@ void mpWindow::SetLayerVisible( const unsigned int position, bool viewable )
}
bool mpWindow::IsLayerVisible( const unsigned int position )
bool mpWindow::IsLayerVisible( unsigned int position ) const
{
mpLayer* lx = GetLayer( position );
@ -3114,23 +3102,22 @@ void mpWindow::SetColourTheme( const wxColour& bgColour,
m_bgColour = bgColour;
m_fgColour = drawColour;
m_axColour = axesColour;
// cycle between layers to set colours and properties to them
wxLayerList::iterator li;
for( li = m_layers.begin(); li != m_layers.end(); li++ )
// Cycle between layers to set colours and properties to them
for( mpLayer* layer : m_layers )
{
if( (*li)->GetLayerType() == mpLAYER_AXIS )
if( layer->GetLayerType() == mpLAYER_AXIS )
{
wxPen axisPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
wxPen axisPen = layer->GetPen(); // Get the old pen to modify only colour, not style or width
axisPen.SetColour( axesColour );
(*li)->SetPen( axisPen );
layer->SetPen( axisPen );
}
if( (*li)->GetLayerType() == mpLAYER_INFO )
if( layer->GetLayerType() == mpLAYER_INFO )
{
wxPen infoPen = (*li)->GetPen(); // Get the old pen to modify only colour, not style or width
wxPen infoPen = layer->GetPen(); // Get the old pen to modify only colour, not style or width
infoPen.SetColour( drawColour );
(*li)->SetPen( infoPen );
layer->SetPen( infoPen );
}
}
}
@ -3203,31 +3190,31 @@ mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags
}
double mpScaleX::TransformToPlot( double x )
double mpScaleX::TransformToPlot( double x ) const
{
return (x + m_offset) * m_scale;
}
double mpScaleX::TransformFromPlot( double xplot )
double mpScaleX::TransformFromPlot( double xplot ) const
{
return xplot / m_scale - m_offset;
}
double mpScaleY::TransformToPlot( double x )
double mpScaleY::TransformToPlot( double x ) const
{
return (x + m_offset) * m_scale;
}
double mpScaleY::TransformFromPlot( double xplot )
double mpScaleY::TransformFromPlot( double xplot ) const
{
return xplot / m_scale - m_offset;
}
double mpScaleXLog::TransformToPlot( double x )
double mpScaleXLog::TransformToPlot( double x ) const
{
double xlogmin = log10( m_minV );
double xlogmax = log10( m_maxV );
@ -3236,7 +3223,7 @@ double mpScaleXLog::TransformToPlot( double x )
}
double mpScaleXLog::TransformFromPlot( double xplot )
double mpScaleXLog::TransformFromPlot( double xplot ) const
{
double xlogmin = log10( m_minV );
double xlogmax = log10( m_maxV );
@ -3253,14 +3240,14 @@ mpFSemiLogXVector::mpFSemiLogXVector( wxString name, int flags ) :
IMPLEMENT_DYNAMIC_CLASS( mpFSemiLogXVector, mpFXYVector )
#endif
#endif // 0
void mpFXYVector::Rewind()
{
m_index = 0;
}
size_t mpFXYVector::GetCount()
size_t mpFXYVector::GetCount() const
{
return m_xs.size();
}
@ -3299,31 +3286,29 @@ void mpFXYVector::SetData( const std::vector<double>& xs, const std::vector<doub
m_ys = ys;
// Update internal variables for the bounding box.
if( xs.size()>0 )
if( xs.size() > 0 )
{
m_minX = xs[0];
m_maxX = xs[0];
m_minY = ys[0];
m_maxY = ys[0];
std::vector<double>::const_iterator it;
for( it = xs.begin(); it!=xs.end(); it++ )
for( const double x : xs )
{
if( *it<m_minX )
m_minX = *it;
if( x < m_minX )
m_minX = x;
if( *it>m_maxX )
m_maxX = *it;
if( x > m_maxX )
m_maxX = x;
}
for( it = ys.begin(); it!=ys.end(); it++ )
for( const double y : ys )
{
if( *it<m_minY )
m_minY = *it;
if( y < m_minY )
m_minY = y;
if( *it>m_maxY )
m_maxY = *it;
if( y > m_maxY )
m_maxY = y;
}
}
else
@ -3490,7 +3475,7 @@ void mpMovableObject::TranslatePoint( double x, double y, double& out_x, double&
void mpMovableObject::ShapeUpdated()
{
// Just in case...
if( m_shape_xs.size()!=m_shape_ys.size() )
if( m_shape_xs.size() != m_shape_ys.size() )
{
}
else
@ -3569,7 +3554,7 @@ void mpMovableObject::Plot( wxDC& dc, mpWindow& w )
wxCoord cx0 = 0, cy0 = 0;
bool first = true;
while( itX!=m_trans_shape_xs.end() )
while( itX != m_trans_shape_xs.end() )
{
wxCoord cx = w.x2p( *(itX++) );
wxCoord cy = w.y2p( *(itY++) );
@ -3644,13 +3629,13 @@ void mpCovarianceEllipse::RecalculateShape()
m_shape_ys.clear();
// Preliminary checks:
if( m_quantiles<0 )
if( m_quantiles < 0 )
return;
if( m_cov_00<0 )
if( m_cov_00 < 0 )
return;
if( m_cov_11<0 )
if( m_cov_11 < 0 )
return;
m_shape_xs.resize( m_segments, 0 );
@ -3659,11 +3644,11 @@ void mpCovarianceEllipse::RecalculateShape()
// Compute the two eigenvalues of the covariance:
// -------------------------------------------------
double b = -m_cov_00 - m_cov_11;
double c = m_cov_00 * m_cov_11 - m_cov_01 * m_cov_01;
double c = m_cov_00 * m_cov_11 - m_cov_01 * m_cov_01;
double D = b * b - 4 * c;
if( D<0 )
if( D < 0 )
return;
double eigenVal0 = 0.5 * ( -b + sqrt( D ) );
@ -3674,7 +3659,7 @@ void mpCovarianceEllipse::RecalculateShape()
double eigenVec0_x, eigenVec0_y;
double eigenVec1_x, eigenVec1_y;
if( fabs( eigenVal0 - m_cov_00 )>1e-6 )
if( fabs( eigenVal0 - m_cov_00 ) > 1e-6 )
{
double k1x = m_cov_01 / ( eigenVal0 - m_cov_00 );
eigenVec0_y = 1;
@ -3687,7 +3672,7 @@ void mpCovarianceEllipse::RecalculateShape()
eigenVec0_y = eigenVec0_x * k1y;
}
if( fabs( eigenVal1 - m_cov_00 )>1e-6 )
if( fabs( eigenVal1 - m_cov_00 ) > 1e-6 )
{
double k2x = m_cov_01 / ( eigenVal1 - m_cov_00 );
eigenVec1_y = 1;
@ -3726,7 +3711,7 @@ void mpCovarianceEllipse::RecalculateShape()
double Aang = 6.283185308 / (m_segments - 1);
int i;
for( i = 0, ang = 0; i<m_segments; i++, ang += Aang )
for( i = 0, ang = 0; i < m_segments; i++, ang += Aang )
{
double ccos = cos( ang );
double csin = sin( ang );
@ -3746,12 +3731,12 @@ void mpPolygon::setPoints( const std::vector<double>& points_xs,
const std::vector<double>& points_ys,
bool closedShape )
{
if( points_xs.size()==points_ys.size() )
if( points_xs.size() == points_ys.size() )
{
m_shape_xs = points_xs;
m_shape_ys = points_ys;
if( closedShape && points_xs.size() )
if( closedShape && !points_xs.empty() )
{
m_shape_xs.push_back( points_xs[0] );
m_shape_ys.push_back( points_ys[0] );
@ -3825,16 +3810,16 @@ void mpBitmapLayer::Plot( wxDC& dc, mpWindow& w )
// The actual drawn rectangle (dx0,dy0)-(dx1,dy1) is (x0,y0)-(x1,y1) clipped:
wxCoord dx0 = x0, dx1 = x1, dy0 = y0, dy1 = y1;
if( dx0<0 )
if( dx0 < 0 )
dx0 = -borderMarginX;
if( dy0<0 )
if( dy0 < 0 )
dy0 = -borderMarginY;
if( dx1>w.GetScrX() )
if( dx1 > w.GetScrX() )
dx1 = w.GetScrX() + borderMarginX;
if( dy1>w.GetScrY() )
if( dy1 > w.GetScrY() )
dy1 = w.GetScrY() + borderMarginY;
// For convenience, compute the width/height of the rectangle to be actually drawn:
@ -3861,10 +3846,10 @@ void mpBitmapLayer::Plot( wxDC& dc, mpWindow& w )
wxRect r( wxRect( offset_x, offset_y, b_width, b_height ) );
// Just for the case....
if( r.x<0 )
if( r.x < 0 )
r.x = 0;
if( r.y<0 )
if( r.y < 0 )
r.y = 0;
if( r.width>m_bitmap.GetWidth() )

View File

@ -1058,7 +1058,7 @@ wxWindow* CVPCB_MAINFRAME::GetToolCanvas() const
}
CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl()
CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl() const
{
if( m_libListBox->HasFocus() )
return CVPCB_MAINFRAME::CONTROL_LIBRARY;
@ -1071,7 +1071,7 @@ CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl()
}
wxControl* CVPCB_MAINFRAME::GetFocusedControlObject()
wxControl* CVPCB_MAINFRAME::GetFocusedControlObject() const
{
if( m_libListBox->HasFocus() )
return m_libListBox;

View File

@ -156,14 +156,14 @@ public:
*
* @return the contorl that currently has focus
*/
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl();
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const;
/**
* Get a pointer to the currently focused control
*
* @return the control that currently has focus
*/
wxControl* GetFocusedControlObject();
wxControl* GetFocusedControlObject() const;
/**
* Set the focus to a specific control.

View File

@ -142,11 +142,9 @@ bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
}
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit )
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit ) const
{
int NumRef;
NumRef = flatList[aIndex].m_numRef;
int NumRef = flatList[aIndex].m_numRef;
for( size_t ii = 0; ii < flatList.size(); ii++ )
{
@ -188,11 +186,11 @@ int SCH_REFERENCE_LIST::FindRef( const wxString& aRef ) const
}
void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId )
void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId ) const
{
aIdList.clear();
for( SCH_REFERENCE& ref : flatList )
for( const SCH_REFERENCE& ref : flatList )
{
if( flatList[aIndex].CompareRef( ref ) == 0 && ref.m_numRef >= aMinRefId )
aIdList.push_back( ref.m_numRef );
@ -210,11 +208,11 @@ void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList,
}
int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue )
int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue ) const
{
int lastNumber = aMinValue;
for( SCH_REFERENCE& ref : flatList )
for( const SCH_REFERENCE& ref : flatList )
{
// search only for the current reference prefix:
if( flatList[aIndex].CompareRef( ref ) != 0 )

View File

@ -112,12 +112,8 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines(wxGrid& grid,
return logicalLines;
wxArrayString physicalLines;
for ( wxArrayString::const_iterator it = logicalLines.begin();
it != logicalLines.end();
++it )
for ( const wxString& line : logicalLines )
{
const wxString& line = *it;
if ( dc.GetTextExtent(line).x > maxWidth )
{
// Line does not fit, break it up.

View File

@ -266,7 +266,7 @@ void ERC_SETTINGS::ResetPinMap()
}
void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER* )> aVisitor )
void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER* )> aVisitor ) const
{
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
@ -279,16 +279,16 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::visitMarkers( std::function<void( SCH_MARKER*
if( firstTime )
seenScreens.insert( sheetList[i].LastScreen() );
for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
{
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
SCH_MARKER* marker = static_cast<SCH_MARKER*>( item );
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
// Don't show non-specific markers more than once
if( !firstTime &&
!static_cast<ERC_ITEM*>( marker->GetRCItem().get() )->IsSheetSpecific() )
!static_cast<const ERC_ITEM*>( marker->GetRCItem().get() )->IsSheetSpecific() )
{
continue;
}
@ -323,14 +323,14 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::SetSeverities( int aSeverities )
}
int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity )
int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity ) const
{
if( aSeverity < 0 )
return m_filteredMarkers.size();
int count = 0;
ERC_SETTINGS& settings = m_schematic->ErcSettings();
const ERC_SETTINGS& settings = m_schematic->ErcSettings();
visitMarkers(
[&]( SCH_MARKER* aMarker )
@ -350,7 +350,7 @@ int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity )
}
std::shared_ptr<ERC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetERCItem( int aIndex )
std::shared_ptr<ERC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetERCItem( int aIndex ) const
{
SCH_MARKER* marker = m_filteredMarkers[ aIndex ];
@ -358,7 +358,7 @@ std::shared_ptr<ERC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetERCItem( int aIndex )
}
std::shared_ptr<RC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetItem( int aIndex )
std::shared_ptr<RC_ITEM> SHEETLIST_ERC_ITEMS_PROVIDER::GetItem( int aIndex ) const
{
return GetERCItem( aIndex );
}

View File

@ -194,11 +194,11 @@ public:
void SetSeverities( int aSeverities ) override;
int GetCount( int aSeverity = -1 ) override;
int GetCount( int aSeverity = -1 ) const override;
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) override;
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override;
std::shared_ptr<ERC_ITEM> GetERCItem( int aIndex );
std::shared_ptr<ERC_ITEM> GetERCItem( int aIndex ) const;
void DeleteItem( int aIndex, bool aDeep ) override;
@ -206,8 +206,8 @@ public:
private:
void visitMarkers( std::function<void( SCH_MARKER* )> aVisitor );
void visitMarkers( std::function<void( SCH_MARKER* )> aVisitor ) const;
};
#endif
#endif // _ERC_SETTINGS_H

View File

@ -251,7 +251,7 @@ void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW )
void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxASSERT( aPlotter != NULL );

View File

@ -94,7 +94,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; }

View File

@ -160,7 +160,7 @@ void LIB_BEZIER::Rotate( const wxPoint& aCenter, bool aRotateCCW )
void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxASSERT( aPlotter != NULL );

View File

@ -81,7 +81,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; }

View File

@ -163,7 +163,7 @@ void LIB_CIRCLE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;

View File

@ -79,7 +79,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; }

View File

@ -256,7 +256,7 @@ void LIB_FIELD::Rotate( const wxPoint& center, bool aRotateCCW )
void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
if( GetText().IsEmpty() )
return;
@ -350,7 +350,7 @@ void LIB_FIELD::ViewGetLayers( int aLayers[], int& aCount ) const
}
SCH_LAYER_ID LIB_FIELD::GetDefaultLayer()
SCH_LAYER_ID LIB_FIELD::GetDefaultLayer() const
{
switch( m_id )
{

View File

@ -169,7 +169,7 @@ public:
*/
wxString GetFullText( int unit = 1 ) const;
SCH_LAYER_ID GetDefaultLayer();
SCH_LAYER_ID GetDefaultLayer() const;
void BeginEdit( const wxPoint aStartPoint ) override;
@ -184,7 +184,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return GetTextThickness(); }
void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }

View File

@ -245,7 +245,7 @@ public:
* @param aTransform The plot transform.
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) = 0;
const TRANSFORM& aTransform ) const = 0;
virtual int GetWidth() const = 0;
virtual void SetWidth( int aWidth ) = 0;

View File

@ -510,7 +510,7 @@ void LIB_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, wxPo
}
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) const
{
int MapX1, MapY1, x1, y1;
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
@ -639,8 +639,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
}
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, wxPoint& aPinPos, int aPinOrient, int aTextInside,
bool aDrawPinNum, bool aDrawPinName )
void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, const wxPoint& aPinPos, int aPinOrient, int aTextInside,
bool aDrawPinNum, bool aDrawPinName ) const
{
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
aDrawPinName = false;
@ -657,11 +657,11 @@ void LIB_PIN::PlotPinTexts( PLOTTER* aPlotter, wxPoint& aPinPos, int aPinOrient,
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
aPlotter->RenderSettings()->GetDefaultPenWidth() );
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
aPlotter->RenderSettings()->GetDefaultPenWidth() );
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
/* Get the num and name colors */
COLOR4D nameColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
@ -978,9 +978,9 @@ void LIB_PIN::Rotate( const wxPoint& aCenter, bool aRotateCCW )
void LIB_PIN::Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
if( ! IsVisible() )
if( !IsVisible() )
return;
int orient = PinDrawOrient( aTransform );

View File

@ -246,10 +246,10 @@ public:
* If TextInside then the text is been put inside (moving from x1, y1 in
* the opposite direction to x2,y2), otherwise all is drawn outside.
*/
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName );
void PlotPinTexts( PLOTTER *aPlotter, const wxPoint& aPinPos, int aPinOrient,
int aTextInside, bool aDrawPinNum, bool aDrawPinName ) const;
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) const;
void Offset( const wxPoint& aOffset ) override;
@ -263,7 +263,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aPffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
// Get/SetWidth() not used for pins. Use GetPenWidth() for drawing.
int GetWidth() const override { return 1; }

View File

@ -119,7 +119,7 @@ void LIB_POLYLINE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxASSERT( aPlotter != NULL );

View File

@ -97,7 +97,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; }

View File

@ -122,7 +122,7 @@ void LIB_RECTANGLE::Rotate( const wxPoint& aCenter, bool aRotateCCW )
void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxASSERT( aPlotter != NULL );

View File

@ -80,7 +80,7 @@ public:
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; }

View File

@ -544,7 +544,7 @@ void LIB_PART::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxASSERT( aPlotter != NULL );
@ -553,7 +553,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint&
// draw background for filled items using background option
// Solid lines will be drawn after the background
for( LIB_ITEM& item : m_drawings )
for( const LIB_ITEM& item : m_drawings )
{
// Lib Fields are not plotted here, because this plot function
// is used to plot schematic items, which have they own fields
@ -572,7 +572,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint&
// Not filled items and filled shapes are now plotted
// Items that have BG fills only get re-stroked to ensure the edges are in the foreground
for( LIB_ITEM& item : m_drawings )
for( const LIB_ITEM& item : m_drawings )
{
if( item.Type() == LIB_FIELD_T )
continue;
@ -692,7 +692,7 @@ LIB_ITEM* LIB_PART::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
}
void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert )
void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
{
/* Notes:
* when aUnit == 0: no unit filtering
@ -700,7 +700,7 @@ void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert )
* when m_unit == 0, the body item is common to units
* when m_convert == 0, the body item is common to shapes
*/
for( LIB_ITEM& item : m_drawings[ LIB_PIN_T ] )
for( const LIB_ITEM& item : m_drawings[ LIB_PIN_T ] )
{
// Unit filtering:
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
@ -715,7 +715,7 @@ void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert )
}
LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert )
LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert ) const
{
LIB_PINS pinList;
@ -733,20 +733,20 @@ LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert )
}
bool LIB_PART::PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
bool aTestType, bool aTestOrientation, bool aTestLength )
bool LIB_PART::PinsConflictWith( const LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
bool aTestType, bool aTestOrientation, bool aTestLength ) const
{
LIB_PINS thisPinList;
GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
for( LIB_PIN* eachThisPin : thisPinList )
for( const LIB_PIN* eachThisPin : thisPinList )
{
wxASSERT( eachThisPin );
LIB_PINS otherPinList;
aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
bool foundMatch = false;
for( LIB_PIN* eachOtherPin : otherPinList )
for( const LIB_PIN* eachOtherPin : otherPinList )
{
wxASSERT( eachOtherPin );

View File

@ -100,7 +100,7 @@ public:
virtual ~LIB_PART();
///< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
PART_SPTR SharedPtr() { return m_me; }
PART_SPTR SharedPtr() const { return m_me; }
/**
* Create a copy of a LIB_PART and assigns unique KIIDs to the copy and its children.
@ -169,7 +169,7 @@ public:
const wxString GetLibraryName() const;
PART_LIB* GetLib() { return m_library; }
PART_LIB* GetLib() const { return m_library; }
void SetLib( PART_LIB* aLibrary ) { m_library = aLibrary; }
timestamp_t GetLastModDate() const { return m_lastModDate; }
@ -311,7 +311,7 @@ public:
* @param aTransform - Component plot transform matrix.
*/
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
const TRANSFORM& aTransform );
const TRANSFORM& aTransform ) const;
/**
* Plot Lib Fields only of the part to plotter.
@ -381,7 +381,7 @@ public:
* @param aConvert - Convert number of pin to add to list. Set to 0 to
* get pins from any convert of part.
*/
void GetPins( LIB_PINS& aList, int aUnit = 0, int aConvert = 0 );
void GetPins( LIB_PINS& aList, int aUnit = 0, int aConvert = 0 ) const;
/**
* Return pin object with the requested pin \a aNumber.
@ -393,7 +393,7 @@ public:
* no alternate body style is required.
* @return The pin object if found. Otherwise NULL.
*/
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 );
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 ) const;
/**
* Return true if this part's pins do not match another part's pins. This
@ -407,8 +407,8 @@ public:
* @param aTestOrientation - Whether two pins at the same point must have the same orientation.
* @param aTestLength - Whether two pins at the same point must have the same length.
*/
bool PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
bool aTestType, bool aTestOrientation, bool aTestLength );
bool PinsConflictWith( const LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
bool aTestType, bool aTestOrientation, bool aTestLength ) const;
/**
* Move the part \a aOffset.
@ -552,7 +552,7 @@ public:
* @param aOffset - The offset in mils.
*/
void SetPinNameOffset( int aOffset ) { m_pinNameOffset = aOffset; }
int GetPinNameOffset() { return m_pinNameOffset; }
int GetPinNameOffset() const { return m_pinNameOffset; }
/**
* Set or clear the pin name visibility flag.
@ -560,7 +560,7 @@ public:
* @param aShow - True to make the part pin names visible.
*/
void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
bool ShowPinNames() { return m_showPinNames; }
bool ShowPinNames() const { return m_showPinNames; }
/**
* Set or clear the pin number visibility flag.
@ -568,7 +568,7 @@ public:
* @param aShow - True to make the part pin numbers visible.
*/
void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
bool ShowPinNumbers() { return m_showPinNumbers; }
bool ShowPinNumbers() const { return m_showPinNumbers; }
/**
* Set or clear the include in schematic bill of materials flag.

View File

@ -263,7 +263,7 @@ void LIB_TEXT::Rotate( const wxPoint& center, bool aRotateCCW )
void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const TRANSFORM& aTransform )
const TRANSFORM& aTransform ) const
{
wxASSERT( plotter != NULL );

View File

@ -103,7 +103,7 @@ public:
void NormalizeJustification( bool inverse );
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
const TRANSFORM& aTransform ) const override;
int GetWidth() const override { return GetTextThickness(); }
void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }

View File

@ -183,7 +183,7 @@ bool SCH_BITMAP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
}
void SCH_BITMAP::Plot( PLOTTER* aPlotter )
void SCH_BITMAP::Plot( PLOTTER* aPlotter ) const
{
m_image->PlotImage( aPlotter, m_pos, aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
aPlotter->RenderSettings()->GetDefaultPenWidth() );

View File

@ -143,7 +143,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -292,7 +292,7 @@ bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aI
bool has_wire[2] = { false };
bool has_bus[2] = { false };
for( DANGLING_END_ITEM& each_item : aItemList )
for( const DANGLING_END_ITEM& each_item : aItemList )
{
if( each_item.GetItem() == this )
continue;
@ -351,7 +351,7 @@ bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aIt
// when the end position is found.
wxPoint seg_start;
for( DANGLING_END_ITEM& each_item : aItemList )
for( const DANGLING_END_ITEM& each_item : aItemList )
{
if( each_item.GetItem() == this )
continue;
@ -435,7 +435,7 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA
}
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter )
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) const
{
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );

View File

@ -104,7 +104,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;

View File

@ -462,7 +462,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
}
void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
void SCH_EDIT_FRAME::SaveCopyForRepeatItem( const SCH_ITEM* aItem )
{
// we cannot store a pointer to an item in the display list here since
// that item may be deleted, such as part of a line concatenation or other.
@ -479,7 +479,7 @@ void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
}
EDA_ITEM* SCH_EDIT_FRAME::GetItem( const KIID& aId )
EDA_ITEM* SCH_EDIT_FRAME::GetItem( const KIID& aId ) const
{
return Schematic().GetSheets().GetItem( aId );
}

View File

@ -816,16 +816,16 @@ public:
/**
* Clone \a aItem and owns that clone in this container.
*/
void SaveCopyForRepeatItem( SCH_ITEM* aItem );
void SaveCopyForRepeatItem( const SCH_ITEM* aItem );
/**
* Return the item which is to be repeated with the insert key.
*
* Such object is owned by this container, and must be cloned.
*/
SCH_ITEM* GetRepeatItem() const { return m_item_to_repeat; }
SCH_ITEM* GetRepeatItem() const { return m_item_to_repeat; }
EDA_ITEM* GetItem( const KIID& aId ) override;
EDA_ITEM* GetItem( const KIID& aId ) const override;
/**
* Performs an undo of the last edit WITHOUT logging a corresponding redo. Used to cancel

View File

@ -608,7 +608,7 @@ bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
void SCH_FIELD::Plot( PLOTTER* aPlotter )
void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
{
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
COLOR4D color = settings->GetLayerColor( GetLayer() );

View File

@ -201,7 +201,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -215,7 +215,7 @@ bool SCH_ITEM::operator < ( const SCH_ITEM& aItem ) const
}
void SCH_ITEM::Plot( PLOTTER* aPlotter )
void SCH_ITEM::Plot( PLOTTER* aPlotter ) const
{
wxFAIL_MSG( wxT( "Plot() method not implemented for class " ) + GetClass() );
}

View File

@ -117,7 +117,7 @@ public:
m_parent = aParent;
}
bool operator==( const DANGLING_END_ITEM& aB )
bool operator==( const DANGLING_END_ITEM& aB ) const
{
return GetItem() == aB.GetItem()
&& GetPosition() == aB.GetPosition()
@ -125,7 +125,7 @@ public:
&& GetParent() == aB.GetParent();
}
bool operator!=( const DANGLING_END_ITEM& aB )
bool operator!=( const DANGLING_END_ITEM& aB ) const
{
return GetItem() != aB.GetItem()
|| GetPosition() != aB.GetPosition()
@ -485,7 +485,7 @@ public:
*
* @param aPlotter A pointer to a #PLOTTER object.
*/
virtual void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter ) const;
virtual bool operator <( const SCH_ITEM& aItem ) const;

View File

@ -221,7 +221,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
}
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
void SCH_JUNCTION::Plot( PLOTTER* aPlotter ) const
{
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
COLOR4D color = GetJunctionColor();

View File

@ -109,7 +109,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -826,7 +826,7 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
}
void SCH_LINE::Plot( PLOTTER* aPlotter )
void SCH_LINE::Plot( PLOTTER* aPlotter ) const
{
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
int penWidth;

View File

@ -240,7 +240,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -60,12 +60,11 @@ public:
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Plot( PLOTTER* aPlotter ) override
void Plot( PLOTTER* /* aPlotter */ ) const override
{
// SCH_MARKERs should not be plotted. However, SCH_ITEM will fail an
// assertion if we do not confirm this by locally implementing a no-op
// Plot().
(void) aPlotter;
}
EDA_RECT const GetBoundingBox() const override;

View File

@ -170,7 +170,7 @@ bool SCH_NO_CONNECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
}
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter ) const
{
int delta = GetSize() / 2;
int pX = m_pos.x;

View File

@ -109,7 +109,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -2411,11 +2411,9 @@ SCH_LEGACY_PLUGIN_CACHE::SCH_LEGACY_PLUGIN_CACHE( const wxString& aFullPathAndFi
SCH_LEGACY_PLUGIN_CACHE::~SCH_LEGACY_PLUGIN_CACHE()
{
std::vector< LIB_PART* > rootParts;
// When the cache is destroyed, all of the alias objects on the heap should be deleted.
for( LIB_PART_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); ++it )
delete it->second;
for( auto& symbol : m_symbols )
delete symbol.second;
m_symbols.clear();
}

View File

@ -209,6 +209,11 @@ public:
return flatList[ aIndex ];
}
const SCH_REFERENCE& operator[]( int aIndex ) const
{
return flatList[ aIndex ];
}
void Clear()
{
flatList.clear();
@ -217,8 +222,9 @@ public:
unsigned GetCount() const { return flatList.size(); }
SCH_REFERENCE& GetItem( int aIdx ) { return flatList[aIdx]; }
const SCH_REFERENCE& GetItem( int aIdx ) const { return flatList[aIdx]; }
void AddItem( SCH_REFERENCE& aItem ) { flatList.push_back( aItem ); }
void AddItem( const SCH_REFERENCE& aItem ) { flatList.push_back( aItem ); }
/**
* Remove an item from the list of references.
@ -393,7 +399,7 @@ public:
* @param aUnit = the given unit number to search
* @return index in aSymbolsList if found or -1 if not found
*/
int FindUnit( size_t aIndex, int aUnit );
int FindUnit( size_t aIndex, int aUnit ) const;
/**
* Search the list for a symbol with the given KIID path.
@ -411,7 +417,7 @@ public:
* @param aIdList = the buffer to fill
* @param aMinRefId = the min id value to store. all values < aMinRefId are ignored
*/
void GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId );
void GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId ) const;
/**
* Return the last used (greatest) reference number in the reference list for the prefix
@ -420,7 +426,7 @@ public:
* @param aIndex The index of the reference item used for the search pattern.
* @param aMinValue The minimum value for the current search.
*/
int GetLastReference( int aIndex, int aMinValue );
int GetLastReference( int aIndex, int aMinValue ) const;
#if defined(DEBUG)
void Show( const char* aPrefix = "" )

View File

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

View File

@ -303,19 +303,19 @@ void SCH_SCREEN::DeleteItem( SCH_ITEM* aItem )
}
bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* aItem )
bool SCH_SCREEN::CheckIfOnDrawList( const SCH_ITEM* aItem ) const
{
return m_rtree.contains( aItem, true );
}
SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T aType )
SCH_ITEM* SCH_SCREEN::GetItem( const wxPoint& aPosition, int aAccuracy, KICAD_T aType ) const
{
EDA_RECT bbox;
bbox.SetOrigin( aPosition );
bbox.Inflate( aAccuracy );
for( auto item : Items().Overlapping( aType, bbox ) )
for( SCH_ITEM* item : Items().Overlapping( aType, bbox ) )
{
if( item->HitTest( aPosition, aAccuracy ) )
return item;
@ -370,7 +370,7 @@ std::set<SCH_ITEM*> SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
}
bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew ) const
{
enum { WIRES, BUSES } layers;
@ -381,7 +381,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
std::vector<SCH_LINE*> lines[ sizeof( layers ) ];
for( SCH_ITEM* item : Items().Overlapping( aPosition ) )
for( const SCH_ITEM* item : Items().Overlapping( aPosition ) )
{
if( item->GetEditFlags() & STRUCT_DELETED )
continue;
@ -427,7 +427,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
{
bool removed_overlapping = false;
for( auto line = lines[i].begin(); line < lines[i].end(); line++ )
for( auto line = lines[i].begin(); line < lines[i].end(); ++line )
{
/// A line with a midpoint should be counted as two endpoints for this calculation
/// because the junction will split the line into two if there is another item
@ -437,7 +437,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
else
end_count[i]++;
for( auto second_line = lines[i].end() - 1; second_line > line; second_line-- )
for( auto second_line = lines[i].end() - 1; second_line > line; --second_line )
{
if( !(*line)->IsParallel( *second_line ) )
has_nonparallel[i] = true;
@ -480,7 +480,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
}
bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const
{
wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false,
wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
@ -790,7 +790,7 @@ void SCH_SCREEN::Print( const RENDER_SETTINGS* aSettings )
}
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
void SCH_SCREEN::Plot( PLOTTER* aPlotter ) const
{
// Ensure links are up to date, even if a library was reloaded for some reason:
std::vector< SCH_ITEM* > junctions;
@ -825,19 +825,19 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
// Bitmaps are drawn first to ensure they are in the background
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
// the bitmap PS command clears the screen
for( SCH_ITEM* item : bitmaps )
for( const SCH_ITEM* item : bitmaps )
{
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter );
}
for( SCH_ITEM* item : other )
for( const SCH_ITEM* item : other )
{
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter );
}
for( SCH_ITEM* item : junctions )
for( const SCH_ITEM* item : junctions )
{
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter );
@ -853,7 +853,7 @@ void SCH_SCREEN::ClearDrawingState()
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol,
bool aEndPointOnly )
bool aEndPointOnly ) const
{
SCH_COMPONENT* candidate = NULL;
LIB_PIN* pin = NULL;
@ -904,7 +904,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol,
}
SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition )
SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition ) const
{
SCH_SHEET_PIN* sheetPin = nullptr;
@ -922,11 +922,11 @@ SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition )
}
size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions )
size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const
{
size_t count = 0;
for( SCH_ITEM* item : Items() )
for( const SCH_ITEM* item : Items() )
{
if( ( item->Type() != SCH_JUNCTION_T || aTestJunctions ) && item->IsConnected( aPos ) )
count++;
@ -964,7 +964,7 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
}
void SCH_SCREEN::GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems )
void SCH_SCREEN::GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ) const
{
static KICAD_T hierarchicalTypes[] = { SCH_COMPONENT_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
@ -976,7 +976,7 @@ void SCH_SCREEN::GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems )
}
void SCH_SCREEN::GetSheets( std::vector<SCH_ITEM*>* aItems )
void SCH_SCREEN::GetSheets( std::vector<SCH_ITEM*>* aItems ) const
{
for( SCH_ITEM* item : Items().OfType( SCH_SHEET_T ) )
aItems->push_back( item );
@ -993,7 +993,7 @@ void SCH_SCREEN::GetSheets( std::vector<SCH_ITEM*>* aItems )
void SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath,
std::function<void( SCH_ITEM* )>* aChangedHandler )
std::function<void( SCH_ITEM* )>* aChangedHandler ) const
{
std::vector<DANGLING_END_ITEM> endPoints;
@ -1012,7 +1012,7 @@ void SCH_SCREEN::TestDanglingEnds( const SCH_SHEET_PATH* aPath,
SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLayer,
SCH_LINE_TEST_T aSearchType )
SCH_LINE_TEST_T aSearchType ) const
{
// an accuracy of 0 had problems with rounding errors; use at least 1
aAccuracy = std::max( aAccuracy, 1 );
@ -1048,7 +1048,7 @@ SCH_LINE* SCH_SCREEN::GetLine( const wxPoint& aPosition, int aAccuracy, int aLay
}
SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy )
SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy ) const
{
for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) )
{
@ -1058,7 +1058,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy )
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
if( item->HitTest( aPosition, aAccuracy ) )
return (SCH_TEXT*) item;
return static_cast<SCH_TEXT*>( item );
break;

View File

@ -162,7 +162,7 @@ public:
EE_RTREE& Items() { return m_rtree; }
const EE_RTREE& Items() const { return m_rtree; }
bool IsEmpty()
bool IsEmpty() const
{
return m_rtree.empty();
}
@ -249,7 +249,7 @@ public:
* @return The item found that meets the search criteria or NULL if none found.
*/
SCH_ITEM* GetItem( const wxPoint& aPosition, int aAccuracy = 0,
KICAD_T aType = SCH_LOCATE_ANY_T );
KICAD_T aType = SCH_LOCATE_ANY_T ) const;
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
@ -294,7 +294,7 @@ public:
*
* @param aPlotter The plotter object to plot to.
*/
void Plot( PLOTTER* aPlotter );
void Plot( PLOTTER* aPlotter ) const;
/**
* Remove \a aItem from the schematic associated with this screen.
@ -322,7 +322,7 @@ public:
*/
void DeleteItem( SCH_ITEM* aItem );
bool CheckIfOnDrawList( SCH_ITEM* st );
bool CheckIfOnDrawList( const SCH_ITEM* aItem ) const;
/**
* Test all of the connectable objects in the schematic for unused connection points.
@ -330,7 +330,7 @@ public:
* @param aChangedHandler an optional callback to make on each changed item
*/
void TestDanglingEnds( const SCH_SHEET_PATH* aPath = nullptr,
std::function<void( SCH_ITEM* )>* aChangedHandler = nullptr );
std::function<void( SCH_ITEM* )>* aChangedHandler = nullptr ) const;
/**
* Return all wires and junctions connected to \a aSegment which are not connected any
@ -345,7 +345,7 @@ public:
*/
void ClearDrawingState();
size_t CountConnectedItems( const wxPoint& aPos, bool aTestJunctions );
size_t CountConnectedItems( const wxPoint& aPos, bool aTestJunctions ) const;
/**
* Test if a junction is required for the items at \a aPosition on the screen.
@ -362,7 +362,7 @@ public:
* @param aNew Checks if a _new_ junction is needed, i.e. there isn't one already
* @return True if a junction is required at \a aPosition.
*/
bool IsJunctionNeeded( const wxPoint& aPosition, bool aNew = false );
bool IsJunctionNeeded( const wxPoint& aPosition, bool aNew = false ) const;
/**
* Test if \a aPosition is a connection point on \a aLayer.
@ -372,7 +372,7 @@ public:
* #LAYER_BUS, and #LAYER_WIRE.
* @return True if \a Position is a connection point on \a aLayer.
*/
bool IsTerminalPoint( const wxPoint& aPosition, int aLayer );
bool IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const;
/**
* Test the screen for a component pin item at \a aPosition.
@ -384,7 +384,7 @@ public:
* @return The pin item if found, otherwise NULL.
*/
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol = NULL,
bool aEndPointOnly = false );
bool aEndPointOnly = false ) const;
/**
* Test the screen if \a aPosition is a sheet label object.
@ -392,7 +392,7 @@ public:
* @param aPosition The position to test.
* @return The sheet label object if found otherwise NULL.
*/
SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition );
SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition ) const;
/**
* Clear the annotation for the components in \a aSheetPath on the screen.
@ -418,14 +418,14 @@ public:
*
* @param aItems Hierarchical item list to fill.
*/
void GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems );
void GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ) const;
/**
* Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a
* deterministic order (L-R, T-B) for sheet numbering.
* @param aItems
*/
void GetSheets( std::vector<SCH_ITEM*>* aItems );
void GetSheets( std::vector<SCH_ITEM*>* aItems ) const;
/**
* Return a line item located at \a aPosition.
@ -438,16 +438,16 @@ public:
* found.
*/
SCH_LINE* GetLine( const wxPoint& aPosition, int aAccuracy = 0, int aLayer = LAYER_NOTES,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T );
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const;
SCH_LINE* GetWire( const wxPoint& aPosition, int aAccuracy = 0,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T )
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
{
return GetLine( aPosition, aAccuracy, LAYER_WIRE, aSearchType );
}
SCH_LINE* GetBus( const wxPoint& aPosition, int aAccuracy = 0,
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T )
SCH_LINE_TEST_T aSearchType = ENTIRE_LENGTH_T ) const
{
return GetLine( aPosition, aAccuracy, LAYER_BUS, aSearchType );
}
@ -460,7 +460,7 @@ public:
* @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not
* found.
*/
SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 );
SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 ) const;
/**
* Fetch a list of unique #LIB_PART object pointers required to properly render each
@ -469,6 +469,7 @@ public:
* @return The list of unique #LIB_PART object pointers.
*/
std::map<wxString, LIB_PART*>& GetLibSymbols() { return m_libSymbols; }
const std::map<wxString, LIB_PART*>& GetLibSymbols() const { return m_libSymbols; }
/**
* Add \a aLibSymbol to the the library symbol map.
@ -497,7 +498,7 @@ public:
/**
* Returns a list of bus aliases defined in this screen
*/
std::unordered_set< std::shared_ptr<BUS_ALIAS> > GetBusAliases()
std::unordered_set< std::shared_ptr<BUS_ALIAS> > GetBusAliases() const
{
return m_aliases;
}

View File

@ -947,7 +947,7 @@ bool SCH_SHEET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
void SCH_SHEET::Plot( PLOTTER* aPlotter )
void SCH_SHEET::Plot( PLOTTER* aPlotter ) const
{
wxString msg;
wxPoint pos;

View File

@ -130,7 +130,7 @@ public:
* @param aPos = Position of the shape
*/
void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector <wxPoint>& aPoints, const wxPoint& aPos ) override;
std::vector <wxPoint>& aPoints, const wxPoint& aPos ) const override;
void SwapData( SCH_ITEM* aItem ) override;
@ -575,7 +575,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -503,7 +503,7 @@ void SCH_SHEET_LIST::SortByPageNumbers( bool aUpdateVirtualPageNums )
}
bool SCH_SHEET_LIST::NameExists( const wxString& aSheetName )
bool SCH_SHEET_LIST::NameExists( const wxString& aSheetName ) const
{
for( const SCH_SHEET_PATH& sheet : *this )
{
@ -515,7 +515,7 @@ bool SCH_SHEET_LIST::NameExists( const wxString& aSheetName )
}
bool SCH_SHEET_LIST::IsModified()
bool SCH_SHEET_LIST::IsModified() const
{
for( const SCH_SHEET_PATH& sheet : *this )
{
@ -537,7 +537,7 @@ void SCH_SHEET_LIST::ClearModifyStatus()
}
SCH_ITEM* SCH_SHEET_LIST::GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut )
SCH_ITEM* SCH_SHEET_LIST::GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut ) const
{
for( const SCH_SHEET_PATH& sheet : *this )
{
@ -738,7 +738,7 @@ bool SCH_SHEET_LIST::TestForRecursion( const SCH_SHEET_LIST& aSrcSheetHierarchy,
}
SCH_SHEET_PATH* SCH_SHEET_LIST::FindSheetForScreen( SCH_SCREEN* aScreen )
SCH_SHEET_PATH* SCH_SHEET_LIST::FindSheetForScreen( const SCH_SCREEN* aScreen )
{
for( SCH_SHEET_PATH& sheetpath : *this )
{

View File

@ -368,14 +368,14 @@ public:
*
* @return True if the hierarchy is modified otherwise false.
*/
bool IsModified();
bool IsModified() const;
void ClearModifyStatus();
/**
* Fetch a SCH_ITEM by ID. Also returns the sheet the item was found on in \a aPathOut.
*/
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr );
SCH_ITEM* GetItem( const KIID& aID, SCH_SHEET_PATH* aPathOut = nullptr ) const;
/**
* Fill an item cache for temporary use when many items need to be fetched.
@ -432,7 +432,7 @@ public:
* Return a pointer to the first #SCH_SHEET_PATH object (not necessarily the only one) using
* a particular screen.
*/
SCH_SHEET_PATH* FindSheetForScreen( SCH_SCREEN* aScreen );
SCH_SHEET_PATH* FindSheetForScreen( const SCH_SCREEN* aScreen );
/**
* Build the list of sheets and their sheet path from \a aSheet.
@ -458,7 +458,7 @@ public:
*/
void SortByPageNumbers( bool aUpdateVirtualPageNums = true );
bool NameExists( const wxString& aSheetName );
bool NameExists( const wxString& aSheetName ) const;
/**
* Update all of the symbol instance information using \a aSymbolInstances.

View File

@ -64,7 +64,7 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
}
void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
SCH_HIERLABEL::Print( aSettings, aOffset );
@ -251,8 +251,8 @@ void SCH_SHEET_PIN::Rotate( wxPoint aPosition )
}
void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos )
void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) const
{
/*
* These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly
@ -260,21 +260,20 @@ void SCH_SHEET_PIN::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
* for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
* for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
*/
PINSHEETLABEL_SHAPE tmp = m_shape;
PINSHEETLABEL_SHAPE shape = m_shape;
switch( m_shape )
switch( shape )
{
case PINSHEETLABEL_SHAPE::PS_INPUT: m_shape = PINSHEETLABEL_SHAPE::PS_OUTPUT; break;
case PINSHEETLABEL_SHAPE::PS_OUTPUT: m_shape = PINSHEETLABEL_SHAPE::PS_INPUT; break;
default: break;
case PINSHEETLABEL_SHAPE::PS_INPUT: shape = PINSHEETLABEL_SHAPE::PS_OUTPUT; break;
case PINSHEETLABEL_SHAPE::PS_OUTPUT: shape = PINSHEETLABEL_SHAPE::PS_INPUT; break;
default: break;
}
SCH_HIERLABEL::CreateGraphicShape( aRenderSettings, aPoints, aPos );
m_shape = tmp;
SCH_HIERLABEL::CreateGraphicShape( aSettings, aPoints, aPos, shape );
}
void SCH_SHEET_PIN::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
void SCH_SHEET_PIN::GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList )
{
DANGLING_END_ITEM item( SHEET_LABEL_END, this, GetTextPos() );
aItemList.push_back( item );

View File

@ -1848,7 +1848,7 @@ bool SCH_COMPONENT::IsInNetlist() const
}
void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
void SCH_COMPONENT::Plot( PLOTTER* aPlotter ) const
{
if( m_part )
{

View File

@ -683,7 +683,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;

View File

@ -599,7 +599,7 @@ bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
void SCH_TEXT::Plot( PLOTTER* aPlotter )
void SCH_TEXT::Plot( PLOTTER* aPlotter ) const
{
static std::vector<wxPoint> s_poly;
@ -1214,7 +1214,7 @@ void SCH_GLOBALLABEL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aO
m_intersheetRefsField.Print( aSettings, aOffset );
}
void SCH_GLOBALLABEL::Plot( PLOTTER* aPlotter )
void SCH_GLOBALLABEL::Plot( PLOTTER* aPlotter ) const
{
SCH_TEXT::Plot( aPlotter );
@ -1225,7 +1225,7 @@ void SCH_GLOBALLABEL::Plot( PLOTTER* aPlotter )
}
void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<wxPoint>& aPoints, const wxPoint& Pos )
std::vector<wxPoint>& aPoints, const wxPoint& Pos ) const
{
int margin = GetTextOffset( aRenderSettings );
int halfSize = ( GetTextHeight() / 2 ) + margin;
@ -1432,10 +1432,17 @@ void SCH_HIERLABEL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& offs
}
void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<wxPoint>& aPoints, const wxPoint& Pos )
void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) const
{
int* Template = TemplateShape[static_cast<int>( m_shape )][static_cast<int>( m_spin_style )];
CreateGraphicShape( aSettings, aPoints, aPos, m_shape );
}
void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos, PINSHEETLABEL_SHAPE aShape ) const
{
int* Template = TemplateShape[static_cast<int>( aShape )][static_cast<int>( m_spin_style )];
int halfSize = GetTextHeight() / 2;
int imax = *Template;
Template++;
@ -1445,10 +1452,10 @@ void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
for( int ii = 0; ii < imax; ii++ )
{
wxPoint corner;
corner.x = ( halfSize * (*Template) ) + Pos.x;
corner.x = ( halfSize * (*Template) ) + aPos.x;
Template++;
corner.y = ( halfSize * (*Template) ) + Pos.y;
corner.y = ( halfSize * (*Template) ) + aPos.y;
Template++;
aPoints.push_back( corner );

View File

@ -254,7 +254,7 @@ public:
* Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels)
*/
virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector <wxPoint>& aPoints, const wxPoint& Pos )
std::vector<wxPoint>& aPoints, const wxPoint& Pos ) const
{
aPoints.clear();
}
@ -315,7 +315,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
EDA_ITEM* Clone() const override;
@ -416,7 +416,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) override;
std::vector<wxPoint>& aPoints, const wxPoint& aPos ) const override;
void UpdateIntersheetRefProps();
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
@ -437,7 +437,7 @@ public:
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& offset ) override;
void Plot( PLOTTER* aPlotter ) override;
void Plot( PLOTTER* aPlotter ) const override;
SCH_FIELD* GetIntersheetRefs() { return &m_intersheetRefsField; }
void SetIntersheetRefs( const SCH_FIELD& aField ) { m_intersheetRefsField = aField; }
@ -490,7 +490,9 @@ public:
wxPoint GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<wxPoint>& aPoints,
const wxPoint& Pos ) override;
const wxPoint& aPos ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<wxPoint>& aPoints,
const wxPoint& aPos, PINSHEETLABEL_SHAPE aShape ) const;
const EDA_RECT GetBoundingBox() const override;

View File

@ -231,7 +231,7 @@ public:
* @param aDefaultPensize the pen size used to plot the rectangle when bitmap is not supported.
*/
void PlotImage( PLOTTER* aPlotter, const wxPoint& aPos,
KIGFX::COLOR4D aDefaultColor, int aDefaultPensize );
KIGFX::COLOR4D aDefaultColor, int aDefaultPensize ) const;
private:
double m_scale; // The scaling factor of the bitmap

View File

@ -197,7 +197,7 @@ public:
}
/**
* Create a copy of a of this #BOARD_ITEM.
* Create a copy of this #BOARD_ITEM.
*/
virtual BOARD_ITEM* Duplicate() const
{
@ -406,7 +406,7 @@ public:
}
#if defined(DEBUG)
void Show( int , std::ostream& ) const override {}
void Show( int , std::ostream& ) const override {}
#endif
};

View File

@ -391,7 +391,7 @@ public:
/**
* Fetch an item by KIID. Frame-type-specific implementation.
*/
virtual EDA_ITEM* GetItem( const KIID& aId ) { return nullptr; }
virtual EDA_ITEM* GetItem( const KIID& aId ) const { return nullptr; }
/**
* Print the page pointed by current screen, set by the calling print function.

View File

@ -75,7 +75,7 @@ public:
*/
bool SetProject( PROJECT* aProject, bool* flgChanged = nullptr );
wxString GetProjectDir( void );
wxString GetProjectDir() const;
/**
* Set a pointer to the application's #PGM_BASE instance used to extract the local env vars.
@ -87,7 +87,7 @@ public:
* Clear the current path list and substitutes the given path list and update the path
* configuration file on success.
*/
bool UpdatePathList( std::vector< SEARCH_PATH >& aPathList );
bool UpdatePathList( const std::vector< SEARCH_PATH >& aPathList );
/**
* Determines the full path of the given file name.
@ -114,27 +114,27 @@ public:
*
* @return pointer to the internal path list.
*/
const std::list< SEARCH_PATH >* GetPaths( void );
const std::list< SEARCH_PATH >* GetPaths() const;
/**
* Return true if the given name contains an alias and populates the string \a anAlias
* with the alias and \a aRelPath with the relative path.
*/
bool SplitAlias( const wxString& aFileName, wxString& anAlias, wxString& aRelPath );
bool SplitAlias( const wxString& aFileName, wxString& anAlias, wxString& aRelPath ) const;
/**
* Returns true if the given path is a valid aliased relative path.
*
* If the path contains an alias then hasAlias is set true.
*/
bool ValidateFileName( const wxString& aFileName, bool& hasAlias );
bool ValidateFileName( const wxString& aFileName, bool& hasAlias ) const;
/**
* Return a list of path environment variables local to KiCad.
*
* This list always includes KICAD6_3DMODEL_DIR even if it is not defined locally.
*/
bool GetKicadPaths( std::list< wxString >& paths );
bool GetKicadPaths( std::list< wxString >& paths ) const;
private:
/**

View File

@ -132,9 +132,6 @@ public:
*/
friend bool operator<( const FOOTPRINT_INFO& lhs, const FOOTPRINT_INFO& rhs );
private:
friend bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 );
protected:
void ensure_loaded()
{
@ -222,7 +219,7 @@ public:
* @param aIdx index of the given item.
* @return the aIdx item in list.
*/
FOOTPRINT_INFO& GetItem( unsigned aIdx )
FOOTPRINT_INFO& GetItem( unsigned aIdx ) const
{
return *m_list[aIdx];
}

View File

@ -67,7 +67,7 @@ struct fnv_1a
{
std::size_t hash = 2166136261u;
for( ; *it; ++it )
for( ; *it; ++it )
{
hash ^= (unsigned char) *it;
hash *= 16777619;
@ -84,9 +84,9 @@ struct WXSTRING_HASH : std::unary_function<wxString, std::size_t>
{
std::size_t hash = 2166136261u;
for( wxString::const_iterator it = aString.begin(); it != aString.end(); ++it )
for( const auto& c : aString )
{
unsigned ch = static_cast<unsigned>( *it );
unsigned ch = static_cast<unsigned>( c );
hash ^= ch;
hash *= 16777619;
}

View File

@ -239,7 +239,7 @@ public:
}
}
bool empty( int aType = UNDEFINED_TYPE )
bool empty( int aType = UNDEFINED_TYPE ) const
{
return ( size( aType ) == 0 );
}

View File

@ -206,7 +206,7 @@ public:
*/
virtual BOARD_ITEM_CONTAINER* GetModel() const = 0;
EDA_ITEM* GetItem( const KIID& aId ) override;
EDA_ITEM* GetItem( const KIID& aId ) const override;
void FocusOnItem( BOARD_ITEM* aItem );

View File

@ -45,12 +45,12 @@ class RC_ITEMS_PROVIDER
public:
virtual void SetSeverities( int aSeverities ) = 0;
virtual int GetCount( int aSeverity = -1 ) = 0;
virtual int GetCount( int aSeverity = -1 ) const = 0;
/**
* Retrieve a RC_ITEM by index.
*/
virtual std::shared_ptr<RC_ITEM> GetItem( int aIndex ) = 0;
virtual std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const = 0;
/**
* Remove (and optionally deletes) the indexed item from the list.
@ -276,7 +276,7 @@ public:
unsigned int aCol,
wxDataViewItemAttr& aAttr ) const override;
void ValueChanged( RC_TREE_NODE* aNode );
void ValueChanged( const RC_TREE_NODE* aNode );
void DeleteCurrentItem( bool aDeep );

View File

@ -176,7 +176,7 @@ public:
return RunAction( aAction, aNow, (void*) NULL );
}
const std::map<std::string, TOOL_ACTION*>& GetActions();
const std::map<std::string, TOOL_ACTION*>& GetActions() const;
/**
* Send a cancel event to the tool currently at the top of the tool stack.
@ -192,9 +192,9 @@ public:
void PrimeTool( const VECTOR2D& aPosition );
///< @copydoc ACTION_MANAGER::GetHotKey()
int GetHotKey( const TOOL_ACTION& aAction );
int GetHotKey( const TOOL_ACTION& aAction ) const;
ACTION_MANAGER* GetActionManager() { return m_actionMgr; }
ACTION_MANAGER* GetActionManager() const { return m_actionMgr; }
/**
* Search for a tool with given ID.
@ -213,7 +213,7 @@ public:
TOOL_BASE* FindTool( const std::string& aName ) const;
/*
* Return the tool of given type or NULL if there is no such tool registered.
* Return the tool of given type or nullptr if there is no such tool registered.
*/
template<typename T>
T* GetTool()
@ -223,7 +223,7 @@ public:
if( tool != m_toolTypes.end() )
return static_cast<T*>( tool->second );
return NULL;
return nullptr;
}
/**
@ -290,8 +290,8 @@ public:
KIGFX::VIEW_CONTROLS* GetViewControls() const { return m_viewControls; }
VECTOR2D GetMousePosition();
VECTOR2D GetCursorPosition();
VECTOR2D GetMousePosition() const;
VECTOR2D GetCursorPosition() const;
EDA_ITEM* GetModel() const { return m_model; }
@ -414,7 +414,7 @@ public:
/**
* True while processing a context menu.
*/
bool IsContextMenuActive()
bool IsContextMenuActive() const
{
return m_menuActive;
}
@ -443,7 +443,7 @@ public:
*/
bool DispatchHotKey( const TOOL_EVENT& aEvent );
VECTOR2D GetMenuCursorPos()
VECTOR2D GetMenuCursorPos() const
{
return m_menuCursor;
}
@ -452,9 +452,9 @@ private:
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
/**
* Passe an event at first to the active tools, then to all others.
* Pass an event at first to the active tools, then to all others.
*/
bool dispatchInternal( const TOOL_EVENT& aEvent );
bool dispatchInternal( TOOL_EVENT& aEvent );
/**
* Check if it is a valid activation event and invokes a proper tool.
@ -509,7 +509,7 @@ private:
* @param aTool is the tool to be checked.
* @return True if the tool is on the active tools stack, false otherwise.
*/
bool isActive( TOOL_BASE* aTool );
bool isActive( TOOL_BASE* aTool ) const;
/**
* Save the #VIEW_CONTROLS settings to the tool state object.
@ -521,7 +521,7 @@ private:
/**
* Apply #VIEW_CONTROLS settings stored in a #TOOL_STATE object.
*/
void applyViewControls( TOOL_STATE* aState );
void applyViewControls( const TOOL_STATE* aState );
/**
* Main function for event processing.
@ -586,4 +586,4 @@ private:
TOOL_STATE* m_activeState;
};
#endif
#endif // __TOOL_MANAGER_H

View File

@ -153,42 +153,42 @@ public:
virtual ~mpLayer() {};
/** Check whether this layer has a bounding box.
* The default implementation returns \a TRUE. Override and return
* FALSE if your mpLayer implementation should be ignored by the calculation
* The default implementation returns \a true. Override and return
* false if your mpLayer implementation should be ignored by the calculation
* of the global bounding box for all layers in a mpWindow.
* @retval TRUE Has bounding box
* @retval FALSE Has not bounding box
* @retval true Has bounding box
* @retval false Has not bounding box
*/
virtual bool HasBBox() { return TRUE; }
virtual bool HasBBox() const { return true; }
/** Check whether the layer is an info box.
* The default implementation returns \a FALSE. It is overrided to \a TRUE for mpInfoLayer
* The default implementation returns \a false. It is overrided to \a true for mpInfoLayer
* class and its derivative. It is necessary to define mouse actions behaviour over
* info boxes.
* @return whether the layer is an info boxes
* @sa mpInfoLayer::IsInfo
*/
virtual bool IsInfo() { return false; };
virtual bool IsInfo() const { return false; };
/** Get inclusive left border of bounding box.
* @return Value
*/
virtual double GetMinX() { return -1.0; }
virtual double GetMinX() const { return -1.0; }
/** Get inclusive right border of bounding box.
* @return Value
*/
virtual double GetMaxX() { return 1.0; }
virtual double GetMaxX() const { return 1.0; }
/** Get inclusive bottom border of bounding box.
* @return Value
*/
virtual double GetMinY() { return -1.0; }
virtual double GetMinY() const { return -1.0; }
/** Get inclusive top border of bounding box.
* @return Value
*/
virtual double GetMaxY() { return 1.0; }
virtual double GetMaxY() const { return 1.0; }
/** Plot given view of layer to the given device context.
* An implementation of this function has to transform layer coordinates to
@ -246,7 +246,7 @@ public:
/** Get pen set for this layer.
* @return Pen
*/
const wxPen& GetPen() const { return m_pen; }
const wxPen& GetPen() const { return m_pen; }
/** Set the 'continuity' property of the layer (true:draws a continuous line, false:draws separate points).
* @sa GetContinuity
@ -288,15 +288,15 @@ public:
/** Get a small square bitmap filled with the colour of the pen used in the layer. Useful to create legends or similar reference to the layers.
* @param side side length in pixels
* @return a wxBitmap filled with layer's colour */
wxBitmap GetColourSquare( int side = 16 );
wxBitmap GetColourSquare( int side = 16 ) const;
/** Get layer type: a Layer can be of different types: plot lines, axis, info boxes, etc, this method returns the right value.
* @return An integer indicating layer type */
mpLayerType GetLayerType() { return m_type; };
mpLayerType GetLayerType() const { return m_type; };
/** Checks whether the layer is visible or not.
* @return \a true if visible */
bool IsVisible() { return m_visible; };
bool IsVisible() const { return m_visible; };
/** Sets layer visibility.
* @param show visibility bool. */
@ -354,8 +354,8 @@ public:
virtual void UpdateInfo( mpWindow& w, wxEvent& event );
/** mpInfoLayer has not bounding box. @sa mpLayer::HasBBox
* @return always \a FALSE */
virtual bool HasBBox() override { return false; }
* @return always \a false */
virtual bool HasBBox() const override { return false; }
/** Plot method. Can be overidden by derived classes.
* @param dc the device content where to plot
@ -364,9 +364,9 @@ public:
virtual void Plot( wxDC& dc, mpWindow& w ) override;
/** Specifies that this is an Info box layer.
* @return always \a TRUE
* @return always \a true
* @sa mpLayer::IsInfo */
virtual bool IsInfo() override { return true; }
virtual bool IsInfo() const override { return true; }
/** Checks whether a point is inside the info box rectangle.
* @param point The point to be checked
@ -382,15 +382,15 @@ public:
/** Returns the position of the upper left corner of the box (in pixels)
* @return The rectangle position */
wxPoint GetPosition();
wxPoint GetPosition() const;
/** Returns the size of the box (in pixels)
* @return The rectangle size */
wxSize GetSize();
wxSize GetSize() const;
/** Returns the current rectangle coordinates.
* @return The info layer rectangle */
const wxRect& GetRectangle() { return m_dim; };
const wxRect& GetRectangle() const { return m_dim; };
protected:
wxRect m_dim; // !< The bounding rectangle of the box. It may be resized dynamically by the Plot method.
@ -534,7 +534,7 @@ public:
* @param x Argument
* @return Function value
*/
virtual double GetY( double x ) = 0;
virtual double GetY( double x ) const = 0;
/** Layer plot handler.
* This implementation will plot the function in the visible area and
@ -566,7 +566,7 @@ public:
* @param y Argument
* @return Function value
*/
virtual double GetX( double y ) = 0;
virtual double GetX( double y ) const = 0;
/** Layer plot handler.
* This implementation will plot the function in the visible area and
@ -607,7 +607,7 @@ public:
*/
virtual bool GetNextXY( double& x, double& y ) = 0;
virtual size_t GetCount() = 0;
virtual size_t GetCount() const = 0;
/** Layer plot handler.
* This implementation will plot the locus in the visible area and
@ -661,7 +661,7 @@ public:
* @param x Argument
* @return Function value
*/
virtual double GetY( double x ) = 0;
virtual double GetY( double x ) const = 0;
/** Layer plot handler.
* This implementation will plot the function in the visible area and
@ -697,9 +697,9 @@ public:
mpScaleBase();
virtual ~mpScaleBase() {};
virtual bool IsHorizontal() = 0;
virtual bool IsHorizontal() const = 0;
bool HasBBox() override { return FALSE; }
bool HasBBox() const override { return false; }
/** Set X axis alignment.
* @param align alignment (choose between mpALIGN_BORDER_BOTTOM, mpALIGN_BOTTOM, mpALIGN_CENTER,
@ -715,9 +715,9 @@ public:
void SetTicks( bool enable ) { m_ticks = enable; };
/** Get X axis ticks or grid
* @return TRUE if plot is drawing axis ticks, FALSE if the grid is active.
* @return true if plot is drawing axis ticks, false if the grid is active.
*/
bool GetTicks() { return m_ticks; };
bool GetTicks() const { return m_ticks; };
// virtual double X2p( mpWindow &w, double x ) = 0;
@ -730,7 +730,7 @@ public:
m_maxV = maxV;
}
void GetDataRange( double& minV, double& maxV )
void GetDataRange( double& minV, double& maxV ) const
{
minV = m_minV;
maxV = m_maxV;
@ -772,8 +772,8 @@ public:
return m_absVisibleMaxV;
}
virtual double TransformToPlot( double x ) { return 0.0; };
virtual double TransformFromPlot( double xplot ) { return 0.0; };
virtual double TransformToPlot( double x ) const { return 0.0; };
virtual double TransformFromPlot( double xplot ) const { return 0.0; };
struct TickLabel
{
@ -794,7 +794,7 @@ protected:
void updateTickLabels( wxDC& dc, mpWindow& w );
void computeLabelExtents( wxDC& dc, mpWindow& w );
// virtual int getLabelDecimalDigits(int maxDigits);
// virtual int getLabelDecimalDigits(int maxDigits) const;
virtual void getVisibleDataRange( mpWindow& w, double& minV, double& maxV ) {};
virtual void recalculateTicks( wxDC& dc, mpWindow& w ) {};
@ -811,17 +811,17 @@ protected:
virtual const wxString formatLabel( double value, int nDigits ) { return wxT( "" ); }
virtual void formatLabels() {};
virtual double getTickPos( int n )
virtual double getTickPos( int n ) const
{
return m_tickValues[n];
}
virtual double getLabelPos( int n )
virtual double getLabelPos( int n ) const
{
return m_tickLabels[n].pos;
}
virtual const wxString getLabel( int n )
virtual wxString getLabel( int n ) const
{
return m_tickLabels[n].label;
}
@ -846,14 +846,14 @@ public:
/** Full constructor.
* @param name Label to plot by the ruler
* @param flags Set the position of the scale with respect to the window.
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid.
* @param ticks Select ticks or grid. Give true (default) for drawing axis ticks, false for drawing the grid.
* @param type mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
*/
mpScaleXBase( const wxString& name = wxT("X"), int flags = mpALIGN_CENTER,
bool ticks = true, unsigned int type = mpX_NORMAL );
virtual ~mpScaleXBase() {};
virtual bool IsHorizontal() override { return true; }
virtual bool IsHorizontal() const override { return true; }
/** Layer plot handler.
* This implementation will plot the ruler adjusted to the visible area. */
virtual void Plot( wxDC& dc, mpWindow& w ) override;
@ -873,7 +873,7 @@ public:
/** Full constructor.
* @param name Label to plot by the ruler
* @param flags Set the position of the scale with respect to the window.
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid.
* @param ticks Select ticks or grid. Give true (default) for drawing axis ticks, false for drawing the grid.
* @param type mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds. */
mpScaleX( const wxString& name = wxT("X"), int flags = mpALIGN_CENTER,
bool ticks = true, unsigned int type = mpX_NORMAL );
@ -884,8 +884,8 @@ public:
// virtual double X2p( mpWindow &w, double x );
// virtual double P2x( mpWindow &w, double x );
virtual double TransformToPlot( double x ) override;
virtual double TransformFromPlot( double xplot ) override;
virtual double TransformToPlot( double x ) const override;
virtual double TransformFromPlot( double xplot ) const override;
protected:
virtual void recalculateTicks( wxDC& dc, mpWindow& w ) override;
@ -901,14 +901,14 @@ public:
/** Full constructor.
* @param name Label to plot by the ruler
* @param flags Set the position of the scale with respect to the window.
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid.
* @param ticks Select ticks or grid. Give true (default) for drawing axis ticks, false for drawing the grid.
* @param type mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
*/
mpScaleXLog( const wxString& name = wxT("log(X)"), int flags = mpALIGN_CENTER,
bool ticks = true, unsigned int type = mpX_NORMAL );
virtual double TransformToPlot( double x ) override;
virtual double TransformFromPlot( double xplot ) override;
virtual double TransformToPlot( double x ) const override;
virtual double TransformFromPlot( double xplot ) const override;
/** Layer plot handler.
* This implementation will plot the ruler adjusted to the visible area.
@ -944,11 +944,11 @@ class WXDLLIMPEXP_MATHPLOT mpScaleY : public mpScaleBase
public:
/** @param name Label to plot by the ruler
* @param flags Set position of the scale respect to the window.
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid
* @param ticks Select ticks or grid. Give true (default) for drawing axis ticks, false for drawing the grid
*/
mpScaleY( const wxString& name = wxT("Y"), int flags = mpALIGN_CENTER, bool ticks = true );
mpScaleY( const wxString& name = wxT( "Y" ), int flags = mpALIGN_CENTER, bool ticks = true );
virtual bool IsHorizontal() override { return false; }
virtual bool IsHorizontal() const override { return false; }
/** Layer plot handler.
* This implementation will plot the ruler adjusted to the visible area.
@ -956,25 +956,25 @@ public:
virtual void Plot( wxDC& dc, mpWindow& w ) override;
/** Check whether this layer has a bounding box.
* This implementation returns \a FALSE thus making the ruler invisible
* This implementation returns \a false thus making the ruler invisible
* to the plot layer bounding box calculation by mpWindow.
*/
virtual bool HasBBox() override { return FALSE; }
virtual bool HasBBox() const override { return false; }
/** Set Y axis alignment.
* @param align alignment (choose between mpALIGN_BORDER_LEFT, mpALIGN_LEFT, mpALIGN_CENTER, mpALIGN_RIGHT, mpALIGN_BORDER_RIGHT) */
void SetAlign( int align ) { m_flags = align; };
/** Set Y axis ticks or grid
* @param ticks TRUE to plot axis ticks, FALSE to plot grid. */
* @param ticks true to plot axis ticks, false to plot grid. */
void SetTicks( bool ticks ) { m_ticks = ticks; };
/** Get Y axis ticks or grid
* @return TRUE if plot is drawing axis ticks, FALSE if the grid is active. */
bool GetTicks() { return m_ticks; };
* @return true if plot is drawing axis ticks, false if the grid is active. */
bool GetTicks() const { return m_ticks; };
virtual double TransformToPlot( double x ) override;
virtual double TransformFromPlot( double xplot ) override;
virtual double TransformToPlot( double x ) const override;
virtual double TransformFromPlot( double xplot ) const override;
void SetMasterScale( mpScaleY* masterScale )
@ -1063,8 +1063,8 @@ public:
* @param layer Pointer to layer. The mpLayer object will get under control of mpWindow,
* i.e. it will be delete'd on mpWindow destruction
* @param refreshDisplay States whether to refresh the display (UpdateAll) after adding the layer.
* @retval TRUE Success
* @retval FALSE Failure due to out of memory.
* @retval true Success
* @retval false Failure due to out of memory.
*/
bool AddLayer( mpLayer* layer, bool refreshDisplay = true );
@ -1090,19 +1090,23 @@ public:
* @param position position of the layer in the layers list
* @return pointer to mpLayer
*/
mpLayer* GetLayer( int position );
mpLayer* GetLayer( int position ) const;
/*! Get the layer by its name (case sensitive).
* @param name The name of the layer to retrieve
* @return A pointer to the mpLayer object, or NULL if not found.
*/
mpLayer* GetLayerByName( const wxString& name );
const mpLayer* GetLayerByName( const wxString& name ) const;
mpLayer* GetLayerByName( const wxString& name )
{
return const_cast<mpLayer*>( static_cast<const mpWindow*>( this )->GetLayerByName( name ) );
}
/** Get current view's X scale.
* See @ref mpLayer::Plot "rules for coordinate transformation"
* @return Scale
*/
double GetXscl() { return m_scaleX; }
double GetXscl() const { return m_scaleX; }
double GetScaleX( void ) const { return m_scaleX; }; // Schaling's method: maybe another method esists with the same name
/** Get current view's Y scale.
@ -1154,7 +1158,7 @@ public:
*/
void SetScaleY( double scaleY )
{
if( scaleY!=0 )
if( scaleY != 0 )
m_scaleY = scaleY;
UpdateAll();
@ -1221,13 +1225,13 @@ public:
* an unlocked aspect, but any other action changing the view scale will
* lock the aspect again.
*/
void LockAspect( bool enable = TRUE );
void LockAspect( bool enable = true );
/** Checks whether the X/Y scale aspect is locked.
* @retval TRUE Locked
* @retval FALSE Unlocked
* @retval true Locked
* @retval false Unlocked
*/
inline bool IsAspectLocked() { return m_lockaspect; }
inline bool IsAspectLocked() const { return m_lockaspect; }
/** Set view to fit global bounding box of all plot layers and refresh display.
* Scale and position will be set to show all attached mpLayers.
@ -1283,11 +1287,11 @@ public:
* which have a bounding box.
* \return The number of profiles plotted.
*/
unsigned int CountLayers();
unsigned int CountLayers() const;
/** Counts the number of plot layers, whether or not they have a bounding box.
* \return The number of layers in the mpWindow. */
unsigned int CountAllLayers() { return m_layers.size(); };
unsigned int CountAllLayers() const { return m_layers.size(); };
#if 0
/** Draws the mpWindow on a page for printing
@ -1300,30 +1304,30 @@ public:
* (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
* @sa Fit
*/
double GetDesiredXmin() { return m_desiredXmin; }
double GetDesiredXmin() const { return m_desiredXmin; }
/** Returns the right-border layer coordinate that the user wants the mpWindow to show
* (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
* @sa Fit
*/
double GetDesiredXmax() { return m_desiredXmax; }
double GetDesiredXmax() const { return m_desiredXmax; }
/** Returns the bottom-border layer coordinate that the user wants the mpWindow to show
* (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
* @sa Fit
*/
double GetDesiredYmin() { return m_desiredYmin; }
double GetDesiredYmin() const { return m_desiredYmin; }
/** Returns the top layer-border coordinate that the user wants the mpWindow to show
* (it may be not exactly the actual shown coordinate in the case of locked aspect ratio).
* @sa Fit
*/
double GetDesiredYmax() { return m_desiredYmax; }
double GetDesiredYmax() const { return m_desiredYmax; }
/** Returns the bounding box coordinates
* @param bbox Pointer to a 6-element double array where to store bounding box coordinates.
*/
void GetBoundingBox( double* bbox );
void GetBoundingBox( double* bbox ) const;
/** Enable/disable scrollbars
* @param status Set to true to show scrollbars */
@ -1331,7 +1335,7 @@ public:
/** Get scrollbars status.
* @return true if scrollbars are visible */
bool GetMPScrollbars() { return m_enableScrollBars; };
bool GetMPScrollbars() const { return m_enableScrollBars; };
/** Draw the window on a wxBitmap, then save it to a file.
* @param filename File name where to save the screenshot
@ -1365,13 +1369,13 @@ public:
void SetMarginLeft( int left ) { m_marginLeft = left; };
/** @return the top margin. */
int GetMarginTop() { return m_marginTop; };
int GetMarginTop() const { return m_marginTop; };
/** @return the right margin. */
int GetMarginRight() { return m_marginRight; };
int GetMarginRight() const { return m_marginRight; };
/** @return the bottom margin. */
int GetMarginBottom() { return m_marginBottom; };
int GetMarginBottom() const { return m_marginBottom; };
/** @return the left margin. */
int GetMarginLeft() { return m_marginLeft; };
int GetMarginLeft() const { return m_marginLeft; };
#if 0
/** Sets whether to show coordinate tooltip when mouse passes over the plot.
@ -1398,7 +1402,7 @@ public:
/** Check whether a layer with given name is visible
* @param name The layer name
* @return layer visibility status */
bool IsLayerVisible( const wxString& name );
bool IsLayerVisible( const wxString& name ) const;
/** Sets the visibility of a layer by its position in layer list.
* @param position The layer position in layer list
@ -1408,7 +1412,7 @@ public:
/** Check whether the layer at given position is visible
* @param position The layer position in layer list
* @return layer visibility status */
bool IsLayerVisible( const unsigned int position );
bool IsLayerVisible( unsigned int position ) const;
/** Set Color theme. Provide colours to set a new colour theme.
* @param bgColour Background colour
@ -1609,24 +1613,24 @@ protected:
*/
bool GetNextXY( double& x, double& y ) override;
size_t GetCount() override;
size_t GetCount() const override;
public:
/** Returns the actual minimum X data (loaded in SetData).
*/
double GetMinX() override { return m_minX; }
double GetMinX() const override { return m_minX; }
/** Returns the actual minimum Y data (loaded in SetData).
*/
double GetMinY() override { return m_minY; }
double GetMinY() const override { return m_minY; }
/** Returns the actual maximum X data (loaded in SetData).
*/
double GetMaxX() override { return m_maxX; }
double GetMaxX() const override { return m_maxX; }
/** Returns the actual maximum Y data (loaded in SetData).
*/
double GetMaxY() override { return m_maxY; }
double GetMaxY() const override { return m_maxY; }
protected:
@ -1678,7 +1682,7 @@ public:
virtual void Plot( wxDC& dc, mpWindow& w ) override;
/** mpText should not be used for scaling decisions. */
virtual bool HasBBox() override { return FALSE; }
virtual bool HasBBox() const override { return false; }
protected:
int m_offsetx; // !< Holds offset for X in percentage
@ -1758,23 +1762,23 @@ public:
ShapeUpdated();
}
virtual bool HasBBox() override { return m_trans_shape_xs.size()!=0; }
virtual bool HasBBox() const override { return m_trans_shape_xs.size()!=0; }
/** Get inclusive left border of bounding box.
*/
virtual double GetMinX() override { return m_bbox_min_x; }
virtual double GetMinX() const override { return m_bbox_min_x; }
/** Get inclusive right border of bounding box.
*/
virtual double GetMaxX() override { return m_bbox_max_x; }
virtual double GetMaxX() const override { return m_bbox_max_x; }
/** Get inclusive bottom border of bounding box.
*/
virtual double GetMinY() override { return m_bbox_min_y; }
virtual double GetMinY() const override { return m_bbox_min_y; }
/** Get inclusive top border of bounding box.
*/
virtual double GetMaxY() override { return m_bbox_max_y; }
virtual double GetMaxY() const override { return m_bbox_max_y; }
virtual void Plot( wxDC& dc, mpWindow& w ) override;
@ -1972,23 +1976,23 @@ public:
*/
void SetBitmap( const wxImage& inBmp, double x, double y, double lx, double ly );
virtual bool HasBBox() override { return true; }
virtual bool HasBBox() const override { return true; }
/** Get inclusive left border of bounding box.
*/
virtual double GetMinX() override { return m_min_x; }
virtual double GetMinX() const override { return m_min_x; }
/** Get inclusive right border of bounding box.
*/
virtual double GetMaxX() override { return m_max_x; }
virtual double GetMaxX() const override { return m_max_x; }
/** Get inclusive bottom border of bounding box.
*/
virtual double GetMinY() override { return m_min_y; }
virtual double GetMinY() const override { return m_min_y; }
/** Get inclusive top border of bounding box.
*/
virtual double GetMaxY() override { return m_max_y; }
virtual double GetMaxY() const override { return m_max_y; }
virtual void Plot( wxDC& dc, mpWindow& w ) override;

View File

@ -418,7 +418,7 @@ public:
/**
* @return the indices of the current polygon, contour and vertex.
*/
VERTEX_INDEX GetIndex()
VERTEX_INDEX GetIndex() const
{
VERTEX_INDEX index;
@ -434,7 +434,7 @@ public:
* @return true if both iterators point to the same segment of the same contour of
* the same polygon of the same polygon set; false otherwise.
*/
bool IsAdjacent( SEGMENT_ITERATOR_TEMPLATE<T> aOther )
bool IsAdjacent( SEGMENT_ITERATOR_TEMPLATE<T> aOther ) const
{
// Check that both iterators point to the same contour of the same polygon of the
// same polygon set.
@ -449,7 +449,7 @@ public:
// are adjacent. The only missing case where they also are adjacent is when
// the segments are the first and last one, in which case the difference
// always equals the total number of segments minus one.
int indexDiff = abs( m_currentSegment - aOther.m_currentSegment );
int indexDiff = std::abs( m_currentSegment - aOther.m_currentSegment );
return ( indexDiff == 1 ) || ( indexDiff == (numSeg - 1) );
}
@ -495,7 +495,7 @@ public:
~SHAPE_POLY_SET();
SHAPE_POLY_SET& operator=( const SHAPE_POLY_SET& );
SHAPE_POLY_SET& operator=( const SHAPE_POLY_SET& aOther );
void CacheTriangulation( bool aPartition = true );
bool IsTriangulationUpToDate() const;
@ -530,7 +530,7 @@ public:
* @return true if the relative indices are correct; false otherwise. The computed
* global index is returned in the \p aGlobalIdx reference.
*/
bool GetGlobalIndex( VERTEX_INDEX aRelativeIndices, int& aGlobalIdx );
bool GetGlobalIndex( VERTEX_INDEX aRelativeIndices, int& aGlobalIdx ) const;
/// @copydoc SHAPE::Clone()
SHAPE* Clone() const override;
@ -871,7 +871,13 @@ public:
return IterateSegments( 0, OutlineCount() - 1 );
}
///< Return an iterator object, for all outlines in the set (with holes).
///< Returns an iterator object, for all outlines in the set (no holes)
CONST_SEGMENT_ITERATOR CIterateSegments() const
{
return CIterateSegments( 0, OutlineCount() - 1 );
}
///< Returns an iterator object, for all outlines in the set (with holes)
SEGMENT_ITERATOR IterateSegmentsWithHoles()
{
return IterateSegments( 0, OutlineCount() - 1, true );
@ -1161,7 +1167,7 @@ public:
///< Return true if the set is empty (no polygons at all)
bool IsEmpty() const
{
return m_polys.size() == 0;
return m_polys.empty();
}
/**
@ -1402,4 +1408,4 @@ private:
MD5_HASH m_hash;
};
#endif
#endif // __SHAPE_POLY_SET_H

View File

@ -51,7 +51,7 @@ SHAPE_COMPOUND::SHAPE_COMPOUND( const std::vector<SHAPE*>& aShapes ) :
SHAPE_COMPOUND::SHAPE_COMPOUND( const SHAPE_COMPOUND& aOther )
: SHAPE( SH_COMPOUND )
{
for ( auto shape : aOther.Shapes() )
for ( const SHAPE* shape : aOther.Shapes() )
m_shapes.push_back( shape->Clone() );
m_dirty = true;

View File

@ -143,7 +143,7 @@ bool SHAPE_POLY_SET::GetRelativeIndices( int aGlobalIdx,
bool SHAPE_POLY_SET::GetGlobalIndex( SHAPE_POLY_SET::VERTEX_INDEX aRelativeIndices,
int& aGlobalIdx )
int& aGlobalIdx ) const
{
int selectedVertex = aRelativeIndices.m_vertex;
unsigned int selectedContour = aRelativeIndices.m_contour;
@ -1334,9 +1334,9 @@ bool SHAPE_POLY_SET::Collide( const SHAPE* aShape, int aClearance, int* aActual,
int actual = INT_MAX;
VECTOR2I location;
for( auto& tpoly : m_triangulatedPolys )
for( const auto& tpoly : m_triangulatedPolys )
{
for ( auto& tri : tpoly->Triangles() )
for ( const auto& tri : tpoly->Triangles() )
{
int triActual;
VECTOR2I triLocation;

View File

@ -136,7 +136,7 @@ bool IsSelectedInDialog( enum PRMS_ID aPrmId )
* @param aPrmId = param id to write
* @return the value always in normalized unit (meter, Hz, Ohm, radian)
*/
double PCB_CALCULATOR_FRAME::GetPrmValue( enum PRMS_ID aPrmId )
double PCB_CALCULATOR_FRAME::GetPrmValue( enum PRMS_ID aPrmId ) const
{
TRANSLINE_IDENT* tr_ident = m_transline_list[m_currTransLineType];
for( unsigned ii = 0; ii < tr_ident->GetPrmsCount(); ii++ )
@ -238,7 +238,7 @@ void PCB_CALCULATOR_FRAME::SetResult( int aLineNumber, const wxString& aText )
* @return true if the param aPrmId is selected
* Has meaning only for params that have a radio button
*/
bool PCB_CALCULATOR_FRAME::IsPrmSelected( enum PRMS_ID aPrmId )
bool PCB_CALCULATOR_FRAME::IsPrmSelected( enum PRMS_ID aPrmId ) const
{
switch( aPrmId )
{

View File

@ -344,14 +344,14 @@ public:
* @param aPrmId = param id to write
* @return the value always in normalized unit (meter, Hz, Ohm, radian)
*/
double GetPrmValue( enum PRMS_ID aPrmId );
double GetPrmValue( enum PRMS_ID aPrmId ) const;
/**
* Function IsPrmSelected
* @return true if the param aPrmId is selected
* Has meaning only for params that have a radio button
*/
bool IsPrmSelected( enum PRMS_ID aPrmId );
bool IsPrmSelected( enum PRMS_ID aPrmId ) const;
// Board classes panel:
void OnBoardClassesUnitsSelection( wxCommandEvent& event ) override;

View File

@ -114,16 +114,16 @@ public:
}
TRANSLINE_PRM* GetPrm( unsigned aIdx )
TRANSLINE_PRM* GetPrm( unsigned aIdx ) const
{
if( aIdx < m_prms_List.size() )
if( aIdx < m_prms_List.size() )
return m_prms_List[aIdx];
else
return NULL;
}
unsigned GetPrmsCount()
unsigned GetPrmsCount() const
{
return m_prms_List.size();
}

View File

@ -289,7 +289,7 @@ TRACKS BOARD::TracksInNet( int aNetCode )
INSPECTOR_FUNC inspector = [aNetCode, &ret]( EDA_ITEM* item, void* testData )
{
TRACK* t = (TRACK*) item;
TRACK* t = static_cast<TRACK*>( item );
if( t->GetNetCode() == aNetCode )
ret.push_back( t );
@ -543,7 +543,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
}
bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer )
bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const
{
switch( aLayer )
{
@ -904,7 +904,7 @@ void BOARD::FillItemMap( std::map<KIID, EDA_ITEM*>& aMap )
}
wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource )
wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource ) const
{
wxString newbuf;
size_t sourceLen = aSource.length();
@ -932,7 +932,7 @@ wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource )
wxString remainder;
wxString ref = token.BeforeFirst( ':', &remainder );
for( FOOTPRINT* footprint : Footprints() )
for( const FOOTPRINT* footprint : Footprints() )
{
if( footprint->GetReference().CmpNoCase( ref ) == 0 )
{
@ -958,7 +958,7 @@ wxString BOARD::ConvertCrossReferencesToKIIDs( const wxString& aSource )
}
wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource )
wxString BOARD::ConvertKIIDsToCrossReferences( const wxString& aSource ) const
{
wxString newbuf;
size_t sourceLen = aSource.length();
@ -1389,11 +1389,11 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
}
std::vector<wxString> BOARD::GetNetClassAssignmentCandidates()
std::vector<wxString> BOARD::GetNetClassAssignmentCandidates() const
{
std::vector<wxString> names;
for( NETINFO_ITEM* net : m_NetInfo )
for( const NETINFO_ITEM* net : m_NetInfo )
{
if( !net->GetNetname().IsEmpty() )
names.emplace_back( net->GetNetname() );
@ -1477,7 +1477,7 @@ int BOARD::SetAreasNetCodesFromNetNames()
}
PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet )
PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) const
{
if( !aLayerSet.any() )
aLayerSet = LSET::AllCuMask();
@ -1497,7 +1497,7 @@ PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet )
}
PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
PAD* BOARD::GetPad( const TRACK* aTrace, ENDPOINT_T aEndPoint ) const
{
const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint );
@ -1507,7 +1507,7 @@ PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint )
}
PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet )
PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet ) const
{
for( FOOTPRINT* footprint : Footprints() )
{
@ -1526,11 +1526,11 @@ PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet )
}
PAD* BOARD::GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerSet )
PAD* BOARD::GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerSet ) const
{
// Search aPadList for aPosition
// aPadList is sorted by X then Y values, and a fast binary search is used
int idxmax = aPadList.size()-1;
int idxmax = aPadList.size() - 1;
int delta = aPadList.size();
@ -1568,7 +1568,7 @@ PAD* BOARD::GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET
return pad;
}
// search previous
for( int ii = idx-1 ;ii >=0; ii-- )
for( int ii = idx - 1 ;ii >=0; ii-- )
{
pad = aPadList[ii];
@ -1634,13 +1634,13 @@ bool sortPadsByXthenYCoord( PAD* const & aLH, PAD* const & aRH )
}
void BOARD::GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode )
void BOARD::GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode ) const
{
for( FOOTPRINT* footprint : Footprints() )
{
for( PAD* pad : footprint->Pads( ) )
{
if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
if( aNetCode < 0 || pad->GetNetCode() == aNetCode )
aVector.push_back( pad );
}
}
@ -1703,7 +1703,7 @@ std::tuple<int, double, double> BOARD::GetTrackLength( const TRACK& aTrack ) con
FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked )
bool aVisibleOnly, bool aIgnoreLocked ) const
{
FOOTPRINT* footprint = NULL;
FOOTPRINT* alt_footprint = NULL;
@ -1740,7 +1740,7 @@ FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLa
if( dist <= min_dim )
{
// better footprint shown on the active side
footprint = candidate;
footprint = candidate;
min_dim = dist;
}
}
@ -1749,7 +1749,7 @@ FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLa
if( dist <= alt_min_dim )
{
// better footprint shown on the other side
alt_footprint = candidate;
alt_footprint = candidate;
alt_min_dim = dist;
}
}
@ -1766,7 +1766,7 @@ FOOTPRINT* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLa
}
std::list<ZONE*> BOARD::GetZoneList( bool aIncludeZonesInFootprints )
std::list<ZONE*> BOARD::GetZoneList( bool aIncludeZonesInFootprints ) const
{
std::list<ZONE*> zones;

View File

@ -404,8 +404,8 @@ public:
/**
* Convert cross-references back and forth between ${refDes:field} and ${kiid:field}
*/
wxString ConvertCrossReferencesToKIIDs( const wxString& aSource );
wxString ConvertKIIDsToCrossReferences( const wxString& aSource );
wxString ConvertCrossReferencesToKIIDs( const wxString& aSource ) const;
wxString ConvertKIIDsToCrossReferences( const wxString& aSource ) const;
/**
* Return a list of missing connections between components/tracks.
@ -583,7 +583,7 @@ public:
* @param aLayer One of the two allowed layers for footprints: F_Cu or B_Cu
* @return bool - true if the layer is visible, else false.
*/
bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer );
bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer ) const;
/**
* @return the BOARD_DESIGN_SETTINGS for this BOARD
@ -635,7 +635,7 @@ public:
* @param aLayer = A copper layer, like B_Cu, etc.
* @param aOutlines The SHAPE_POLY_SET to fill in with items outline.
*/
void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines );
void ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) const;
/**
* Return the ID of a layer.
@ -861,7 +861,7 @@ public:
* Tokens may appear more than once if they were harvested from hierarchical nets
* (ie: /CLK, /sheet1/CLK).
*/
std::vector<wxString> GetNetClassAssignmentCandidates();
std::vector<wxString> GetNetClassAssignmentCandidates() const;
/**
* Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
@ -919,7 +919,7 @@ public:
/**
* @return a std::list of pointers to all board zones (possibly including zones in footprints)
*/
std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false );
std::list<ZONE*> GetZoneList( bool aIncludeZonesInFootprints = false ) const;
/**
* @return The number of copper pour areas or ZONEs.
@ -981,8 +981,8 @@ public:
* @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.
*/
PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask );
PAD* GetPad( const wxPoint& aPosition )
PAD* GetPad( const wxPoint& aPosition, LSET aLayerMask ) const;
PAD* GetPad( const wxPoint& aPosition ) const
{
return GetPad( aPosition, LSET().set() );
}
@ -994,7 +994,7 @@ public:
* @param aEndPoint The end point of \a aTrace the hit test against.
* @return A pointer to a PAD object if found or NULL if not found.
*/
PAD* GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint );
PAD* GetPad( const TRACK* aTrace, ENDPOINT_T aEndPoint ) const;
/**
* Return pad found at \a aPosition on \a aLayerMask using the fast search method.
@ -1005,7 +1005,7 @@ public:
* @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.
*/
PAD* GetPadFast( const wxPoint& aPosition, LSET aLayerMask );
PAD* GetPadFast( const wxPoint& aPosition, LSET aLayerMask ) const;
/**
* Locate the pad connected at \a aPosition on \a aLayer starting at list position
@ -1021,7 +1021,7 @@ public:
* @param aLayerMask A layer or layers to mask the hit test.
* @return a PAD object pointer to the connected pad.
*/
PAD* GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask );
PAD* GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask ) const;
/**
* Delete a given pad from the BOARD by removing it from its footprint and from the
@ -1040,7 +1040,7 @@ public:
* = -1 to build the full pad list.
* = a given netcode to build the pad list relative to the given net
*/
void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 );
void GetSortedPadListByXthenYCoord( std::vector<PAD*>& aVector, int aNetCode = -1 ) const;
/**
* Returns data on the length and number of track segments connected to a given track.
@ -1072,7 +1072,7 @@ public:
* @param aIgnoreLocked Ignore locked footprints when true.
*/
FOOTPRINT* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false );
bool aVisibleOnly, bool aIgnoreLocked = false ) const;
/**
* Reset all items' netcodes to 0 (no net).

View File

@ -66,12 +66,12 @@ static void addTextSegmToPoly( int x0, int y0, int xf, int yf, void* aData )
}
void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines )
void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines ) const
{
int maxError = GetDesignSettings().m_MaxError;
// convert tracks and vias:
for( TRACK* track : m_tracks )
for( const TRACK* track : m_tracks )
{
if( !track->IsOnLayer( aLayer ) )
continue;
@ -81,7 +81,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
}
// convert pads and other copper items in footprints
for( FOOTPRINT* footprint : m_footprints )
for( const FOOTPRINT* footprint : m_footprints )
{
footprint->TransformPadsWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
@ -92,7 +92,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
true, /* include text */
true /* include shapes */ );
for( ZONE* zone : footprint->Zones() )
for( const ZONE* zone : footprint->Zones() )
{
if( zone->GetLayerSet().test( aLayer ) )
zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
@ -100,14 +100,14 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
}
// convert copper zones
for( ZONE* zone : Zones() )
for( const ZONE* zone : Zones() )
{
if( zone->GetLayerSet().test( aLayer ) )
zone->TransformSolidAreasShapesToPolygon( aLayer, aOutlines );
}
// convert graphic items on copper layers (texts)
for( BOARD_ITEM* item : m_drawings )
for( const BOARD_ITEM* item : m_drawings )
{
if( !item->IsOnLayer( aLayer ) )
continue;
@ -116,7 +116,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
{
case PCB_SHAPE_T:
{
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
shape->TransformShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
}
@ -124,7 +124,7 @@ void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_
case PCB_TEXT_T:
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
const PCB_TEXT* text = static_cast<const PCB_TEXT*>( item );
text->TransformTextShapeWithClearanceToPolygon( aOutlines, aLayer, 0, maxError,
ERROR_INSIDE );
}
@ -144,7 +144,7 @@ void FOOTPRINT::TransformPadsWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuff
bool aSkipPlatedPads,
bool aSkipNonPlatedPads ) const
{
for( PAD* pad : m_pads )
for( const PAD* pad : m_pads )
{
if( aLayer != UNDEFINED_LAYER && !pad->IsOnLayer(aLayer) )
continue;
@ -255,7 +255,7 @@ void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
if( item->Type() == PCB_FP_SHAPE_T && aIncludeShapes )
{
FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
const FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
{
@ -274,7 +274,7 @@ void FOOTPRINT::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCorner
texts.push_back( &Value() );
}
for( FP_TEXT* text : texts )
for( const FP_TEXT* text : texts )
{
text->TransformTextShapeWithClearanceToPolygon( aCornerBuffer, aLayer, aClearance,
aError, aErrorLoc );
@ -506,7 +506,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
offset = footprint->GetPosition();
// Build the polygon with the actual position and orientation:
std::vector< wxPoint> poly;
std::vector<wxPoint> poly;
poly = BuildPolyPointsList();
for( wxPoint& point : poly )
@ -519,7 +519,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
{
aCornerBuffer.NewOutline();
for( wxPoint& point : poly )
for( const wxPoint& point : poly )
aCornerBuffer.Append( point.x, point.y );
}
@ -527,7 +527,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
{
wxPoint pt1( poly[ poly.size() - 1] );
for( wxPoint pt2 : poly )
for( const wxPoint& pt2 : poly )
{
if( pt2 != pt1 )
TransformOvalToPolygon( aCornerBuffer, pt1, pt2, width, aError, aErrorLoc );
@ -547,7 +547,7 @@ void PCB_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
for( unsigned ii = 1; ii < poly.size(); ii++ )
{
TransformOvalToPolygon( aCornerBuffer, poly[ii-1], poly[ii], width, aError, aErrorLoc );
TransformOvalToPolygon( aCornerBuffer, poly[ii - 1], poly[ii], width, aError, aErrorLoc );
}
}
break;
@ -582,8 +582,8 @@ void TRACK::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
const ARC* arc = static_cast<const ARC*>( this );
int width = m_Width + ( 2 * aClearanceValue );
TransformArcToPolygon( aCornerBuffer, (wxPoint) arc->GetStart(), (wxPoint) arc->GetMid(),
(wxPoint) arc->GetEnd(), width, aError, aErrorLoc );
TransformArcToPolygon( aCornerBuffer, arc->GetStart(), arc->GetMid(),
arc->GetEnd(), width, aError, aErrorLoc );
}
break;

View File

@ -83,12 +83,12 @@ public:
{
}
int GetCount( int aSeverity = -1 ) override
int GetCount( int aSeverity = -1 ) const override
{
return m_sourceVector->size();
}
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) override
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override
{
return m_sourceVector->at( aIndex );
}

View File

@ -156,12 +156,12 @@ int FROM_TO_CACHE::cacheFromToPaths( const wxString& aFrom, const wxString& aTo
if( pitem->Type() != PCB_PAD_T )
continue;
PAD *pad = static_cast<PAD*>( pitem );
const PAD *pad = static_cast<const PAD*>( pitem );
wxString toName = pad->GetParent()->GetReference() + "-" + pad->GetName();
for ( auto& endpoint : m_ftEndpoints )
for ( const auto& endpoint : m_ftEndpoints )
{
if( pad == endpoint.parent )
{
@ -213,7 +213,7 @@ int FROM_TO_CACHE::cacheFromToPaths( const wxString& aFrom, const wxString& aTo
if( result == PS_NO_PATH )
continue;
for( auto item : upath )
for( const auto item : upath )
{
path.pathItems.insert( item->Parent() );
}
@ -222,7 +222,7 @@ int FROM_TO_CACHE::cacheFromToPaths( const wxString& aFrom, const wxString& aTo
newPaths++;
}
//reportAux( _("Cached %d paths\n"), newPaths );
// reportAux( _("Cached %d paths\n"), newPaths );
return newPaths;
}

View File

@ -234,7 +234,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
auto it = m_drillTypes.begin();
for( ; it != m_drillTypes.end(); it++ )
for( ; it != m_drillTypes.end(); ++it )
{
if( *it == drill )
{
@ -272,7 +272,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
auto it = m_drillTypes.begin();
for( ; it != m_drillTypes.end(); it++ )
for( ; it != m_drillTypes.end(); ++it )
{
if( *it == drill )
{
@ -348,10 +348,10 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
void DIALOG_BOARD_STATISTICS::updateWidets()
{
int totalPads = 0;
int totalPads = 0;
int currentRow = 0;
for( auto& type : m_padsTypes )
for( const auto& type : m_padsTypes )
{
m_gridPads->SetCellValue( currentRow, COL_LABEL, type.title );
m_gridPads->SetCellValue(
@ -366,7 +366,7 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
int totalVias = 0;
currentRow = 0;
for( auto& type : m_viasTypes )
for( const auto& type : m_viasTypes )
{
m_gridVias->SetCellValue( currentRow, COL_LABEL, type.title );
m_gridVias->SetCellValue(
@ -380,12 +380,12 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
int totalFront = 0;
int totalBack = 0;
int totalBack = 0;
// We don't use row 0, as there labels are
currentRow = 1;
for( auto& type : m_componentsTypes )
for( const auto& type : m_componentsTypes )
{
m_gridComponents->SetCellValue( currentRow, COL_LABEL, type.title );
m_gridComponents->SetCellValue(
@ -395,7 +395,7 @@ void DIALOG_BOARD_STATISTICS::updateWidets()
m_gridComponents->SetCellValue( currentRow, 3,
wxString::Format( wxT( "%i " ), type.frontSideQty + type.backSideQty ) );
totalFront += type.frontSideQty;
totalBack += type.backSideQty;
totalBack += type.backSideQty;
currentRow++;
}
@ -439,7 +439,7 @@ void DIALOG_BOARD_STATISTICS::updateDrillGrid()
BOARD* board = m_parentFrame->GetBoard();
int currentRow = 0;
for( auto& type : m_drillTypes )
for( const auto& type : m_drillTypes )
{
wxString shapeStr;
wxString startLayerStr;

View File

@ -452,7 +452,7 @@ const BOX2I DIMENSION_BASE::ViewBBox() const
}
OPT_VECTOR2I DIMENSION_BASE::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart )
OPT_VECTOR2I DIMENSION_BASE::segPolyIntersection( const SHAPE_POLY_SET& aPoly, const SEG& aSeg, bool aStart )
{
VECTOR2I start( aStart ? aSeg.A : aSeg.B );
VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A );
@ -460,7 +460,7 @@ OPT_VECTOR2I DIMENSION_BASE::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aS
if( aPoly.Contains( start ) )
return NULLOPT;
for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = aPoly.IterateSegments(); seg; seg++ )
for( SHAPE_POLY_SET::CONST_SEGMENT_ITERATOR seg = aPoly.CIterateSegments(); seg; ++seg )
{
if( OPT_VECTOR2I intersection = ( *seg ).Intersect( aSeg ) )
{

View File

@ -206,8 +206,8 @@ public:
*/
const wxString GetText() const;
PCB_TEXT& Text() { return m_text; }
PCB_TEXT& Text() const { return *( const_cast<PCB_TEXT*> ( &m_text ) ); }
PCB_TEXT& Text() { return m_text; }
const PCB_TEXT& Text() const { return m_text; }
/**
* @return a list of line segments that make up this dimension (for drawing, plotting, etc)
@ -271,7 +271,7 @@ protected:
* @param aStart if true will start from aSeg.A, otherwise aSeg.B
* @return a point on aSeg that collides with aPoly closest to the start, if one exists
*/
static OPT_VECTOR2I segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart = true );
static OPT_VECTOR2I segPolyIntersection( const SHAPE_POLY_SET& aPoly, const SEG& aSeg, bool aStart = true );
static OPT_VECTOR2I segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, bool aStart = true );
// Value format

View File

@ -75,7 +75,7 @@ public:
}
}
int GetCount( int aSeverity = -1 ) override
int GetCount( int aSeverity = -1 ) const override
{
if( aSeverity < 0 )
return m_filteredMarkers.size();
@ -100,7 +100,7 @@ public:
return count;
}
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) override
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override
{
PCB_MARKER* marker = m_filteredMarkers[ aIndex ];
@ -167,7 +167,7 @@ public:
}
}
int GetCount( int aSeverity = -1 ) override
int GetCount( int aSeverity = -1 ) const override
{
if( aSeverity < 0 )
return m_filteredVector.size();
@ -187,7 +187,7 @@ public:
return count;
}
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) override
std::shared_ptr<RC_ITEM> GetItem( int aIndex ) const override
{
return (m_filteredVector)[aIndex];
}

View File

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

View File

@ -398,7 +398,7 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
for( PCB_GROUP* group : aOther.Groups() )
{
PCB_GROUP* newGroup = static_cast<PCB_GROUP*>( group->Clone() );
const_cast<std::unordered_set<BOARD_ITEM*>*>( &newGroup->GetItems() )->clear();
newGroup->GetItems().clear();
for( BOARD_ITEM* member : group->GetItems() )
newGroup->AddItem( ptrMap[ member ] );
@ -410,7 +410,7 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
m_3D_Drawings.clear();
m_3D_Drawings = aOther.m_3D_Drawings;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
m_initial_comments = aOther.m_initial_comments ?

View File

@ -175,7 +175,7 @@ void PCB_BASE_FRAME::AddFootprintToBoard( FOOTPRINT* aFootprint )
}
EDA_ITEM* PCB_BASE_FRAME::GetItem( const KIID& aId )
EDA_ITEM* PCB_BASE_FRAME::GetItem( const KIID& aId ) const
{
return GetBoard()->GetItem( aId );
}

View File

@ -147,27 +147,27 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS& aOption
switch( aOptions.m_DisplayNetNamesMode )
{
case 0:
m_netNamesOnPads = false;
m_netNamesOnPads = false;
m_netNamesOnTracks = false;
m_netNamesOnVias = false;
m_netNamesOnVias = false;
break;
case 1:
m_netNamesOnPads = true;
m_netNamesOnPads = true;
m_netNamesOnTracks = false;
m_netNamesOnVias = true; // Follow pads or tracks? For now we chose pads....
m_netNamesOnVias = true; // Follow pads or tracks? For now we chose pads....
break;
case 2:
m_netNamesOnPads = false;
m_netNamesOnPads = false;
m_netNamesOnTracks = true;
m_netNamesOnVias = false; // Follow pads or tracks? For now we chose pads....
m_netNamesOnVias = false; // Follow pads or tracks? For now we chose pads....
break;
case 3:
m_netNamesOnPads = true;
m_netNamesOnPads = true;
m_netNamesOnTracks = true;
m_netNamesOnVias = true;
m_netNamesOnVias = true;
break;
}
@ -982,7 +982,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
}
for( SHAPE* shape : shapes->Shapes() )
for( const SHAPE* shape : shapes->Shapes() )
{
// Drawing components of compound shapes in outline mode produces a mess.
if( m_pcbSettings.m_sketchMode[LAYER_PADS_TH] )
@ -1009,13 +1009,13 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
if( simpleShapes )
{
for( SHAPE* shape : shapes->Shapes() )
for( const SHAPE* shape : shapes->Shapes() )
{
switch( shape->Type() )
{
case SH_SEGMENT:
{
const SHAPE_SEGMENT* seg = (SHAPE_SEGMENT*) shape;
const SHAPE_SEGMENT* seg = (const SHAPE_SEGMENT*) shape;
int effectiveWidth = seg->GetWidth() + 2 * margin.x;
if( effectiveWidth > 0 )
@ -1025,7 +1025,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
case SH_CIRCLE:
{
const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape;
const SHAPE_CIRCLE* circle = (const SHAPE_CIRCLE*) shape;
int effectiveRadius = circle->GetRadius() + margin.x;
if( effectiveRadius > 0 )
@ -1035,7 +1035,7 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
case SH_RECT:
{
const SHAPE_RECT* r = (SHAPE_RECT*) shape;
const SHAPE_RECT* r = (const SHAPE_RECT*) shape;
VECTOR2I position = r->GetPosition();
VECTOR2I effectiveSize = r->GetSize() + margin;
@ -1277,8 +1277,8 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
case S_POLYGON:
{
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
const FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
if( shape.OutlineCount() == 0 )
break;
@ -1657,8 +1657,8 @@ void PCB_PAINTER::draw( const DIMENSION_BASE* aDimension, int aLayer )
}
}
// Draw text
PCB_TEXT& text = aDimension->Text();
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
const PCB_TEXT& text = aDimension->Text();
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
if( m_pcbSettings.m_sketchText )
{

View File

@ -83,7 +83,7 @@ const wxString GetGerberProtelExtension( LAYER_NUM aLayer )
}
const wxString GetGerberFileFunctionAttribute( const BOARD *aBoard, LAYER_NUM aLayer )
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aLayer )
{
wxString attrib;
@ -276,7 +276,7 @@ static wxString& makeStringCompatX1( wxString& aText, bool aUseX1CompatibilityMo
}
void AddGerberX2Header( PLOTTER * aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode )
void AddGerberX2Header( PLOTTER* aPlotter, const BOARD* aBoard, bool aUseX1CompatibilityMode )
{
wxString text;
@ -347,8 +347,8 @@ void AddGerberX2Header( PLOTTER * aPlotter, const BOARD *aBoard, bool aUseX1Comp
}
void AddGerberX2Attribute( PLOTTER * aPlotter,
const BOARD *aBoard, LAYER_NUM aLayer, bool aUseX1CompatibilityMode )
void AddGerberX2Attribute( PLOTTER* aPlotter,
const BOARD* aBoard, LAYER_NUM aLayer, bool aUseX1CompatibilityMode )
{
AddGerberX2Header( aPlotter, aBoard, aUseX1CompatibilityMode );
@ -398,7 +398,7 @@ void BuildPlotFileName( wxFileName* aFilename, const wxString& aOutputDir,
}
PLOT_CONTROLLER::PLOT_CONTROLLER( BOARD *aBoard )
PLOT_CONTROLLER::PLOT_CONTROLLER( BOARD* aBoard )
{
m_plotter = NULL;
m_board = aBoard;

View File

@ -78,7 +78,7 @@ public:
* (useful for controlling toner bleeding during direct transfer)
* added to track width and via/pads size
*/
int getFineWidthAdj()
int getFineWidthAdj() const
{
if( GetFormat() == PLOT_FORMAT::POST )
return GetWidthAdjust();
@ -87,22 +87,22 @@ public:
}
// Basic functions to plot a board item
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
void PlotFootprintGraphicItems( FOOTPRINT* aFootprint );
void PlotFootprintGraphicItem( FP_SHAPE* aShape );
void PlotFootprintTextItem( FP_TEXT* aText, COLOR4D aColor );
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
void PlotFootprintGraphicItems( const FOOTPRINT* aFootprint );
void PlotFootprintGraphicItem( const FP_SHAPE* aShape );
void PlotFootprintTextItem( const FP_TEXT* aText, COLOR4D aColor );
/*
* Reference, Value, and other fields are plotted only if the corresponding option is enabled.
* Invisible text fields are plotted only if PlotInvisibleText option is set.
*/
void PlotFootprintTextItems( FOOTPRINT* aFootprint );
void PlotFootprintTextItems( const FOOTPRINT* aFootprint );
void PlotDimension( DIMENSION_BASE* Dimension );
void PlotPcbTarget( PCB_TARGET* PtMire );
void PlotFilledAreas( ZONE* aZone, SHAPE_POLY_SET& aPolysList );
void PlotPcbText( PCB_TEXT* aText );
void PlotPcbShape( PCB_SHAPE* aShape );
void PlotDimension( const DIMENSION_BASE* aDim );
void PlotPcbTarget( const PCB_TARGET* aMire );
void PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET& aPolysList );
void PlotPcbText( const PCB_TEXT* aText );
void PlotPcbShape( const PCB_SHAPE* aShape );
/**
* Plot a pad.
@ -110,7 +110,7 @@ public:
* and be drawn as a non filled item although the plot mode is filled
* color and plot mode are needed by this function
*/
void PlotPad( PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode );
void PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode );
/**
* plot items like text and graphics,
@ -134,7 +134,7 @@ public:
* and in B&W mode, is plotted as white but other colors are plotted in BLACK
* so the returned color is LIGHTGRAY when the layer color is WHITE
*/
COLOR4D getColor( LAYER_NUM aLayer );
COLOR4D getColor( LAYER_NUM aLayer ) const;
private:
/** Helper function to plot a single drill mark. It compensate and clamp
@ -148,7 +148,7 @@ private:
};
PLOTTER* StartPlotBoard( BOARD* aBoard,
PCB_PLOT_PARAMS* aPlotOpts,
const PCB_PLOT_PARAMS* aPlotOpts,
int aLayer,
const wxString& aFullFileName,
const wxString& aSheetDesc );
@ -163,7 +163,7 @@ PLOTTER* StartPlotBoard( BOARD* aBoard,
* @param aLayer = the layer id to plot
* @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only
*/
void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, PCB_LAYER_ID aLayer,
const PCB_PLOT_PARAMS& aPlotOpt );
/**
@ -198,7 +198,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
* @param aLayerMask = the mask to define the layers to plot
* @param aPlotOpt = the plot options. Has meaning for some formats only
*/
void PlotLayerOutlines( BOARD *aBoard, PLOTTER* aPlotter,
void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
LSET aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt );
/**
@ -236,7 +236,7 @@ const wxString GetGerberProtelExtension( LAYER_NUM aLayer );
* @param aLayer = the layer number to create the attribute for
* @return The attribute, as a text string
*/
const wxString GetGerberFileFunctionAttribute( const BOARD *aBoard, LAYER_NUM aLayer );
const wxString GetGerberFileFunctionAttribute( const BOARD* aBoard, LAYER_NUM aLayer );
/**
* Calculates some X2 attributes, as defined in the
@ -252,8 +252,8 @@ const wxString GetGerberFileFunctionAttribute( const BOARD *aBoard, LAYER_NUM aL
* use X1 compatibility (X2 attributes added as structured comments,
* starting by "G04 #@! " followed by the X2 attribute
*/
void AddGerberX2Header( PLOTTER * aPlotter,
const BOARD *aBoard, bool aUseX1CompatibilityMode = false );
void AddGerberX2Header( PLOTTER* aPlotter,
const BOARD* aBoard, bool aUseX1CompatibilityMode = false );
/**
* Calculates some X2 attributes, as defined in the Gerber file format
@ -271,7 +271,7 @@ void AddGerberX2Header( PLOTTER * aPlotter,
* use X1 compatibility (X2 attributes added as structured comments,
* starting by "G04 #@! " followed by the X2 attribute
*/
void AddGerberX2Attribute( PLOTTER * aPlotter, const BOARD *aBoard,
void AddGerberX2Attribute( PLOTTER* aPlotter, const BOARD* aBoard,
LAYER_NUM aLayer, bool aUseX1CompatibilityMode );
#endif // PCBPLOT_H_

View File

@ -222,11 +222,11 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
itemplotter.PlotBoardGraphicItems();
// Draw footprint texts:
for( FOOTPRINT* footprint : aBoard->Footprints() )
for( const FOOTPRINT* footprint : aBoard->Footprints() )
itemplotter.PlotFootprintTextItems( footprint );
// Draw footprint other graphic items:
for( FOOTPRINT* footprint : aBoard->Footprints() )
for( const FOOTPRINT* footprint : aBoard->Footprints() )
itemplotter.PlotFootprintGraphicItems( footprint );
// Plot footprint pads
@ -269,7 +269,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int width_adj = 0;
if( onCopperLayer )
width_adj = itemplotter.getFineWidthAdj();
width_adj = itemplotter.getFineWidthAdj();
if( onSolderMaskLayer )
margin.x = margin.y = pad->GetSolderMaskMargin();
@ -288,7 +288,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// Store these parameters that can be modified to plot inflated/deflated pads shape
PAD_SHAPE_T padShape = pad->GetShape();
wxSize padSize = pad->GetSize();
wxSize padSize = pad->GetSize();
wxSize padDelta = pad->GetDelta(); // has meaning only for trapezoidal pads
double padCornerRadius = pad->GetRoundRectCornerRadius();
@ -424,7 +424,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
aPlotter->StartBlock( NULL );
for( TRACK* track : aBoard->Tracks() )
for( const TRACK* track : aBoard->Tracks() )
{
const VIA* via = dyn_cast<const VIA*>( track );
@ -487,7 +487,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR );
// Plot tracks (not vias) :
for( TRACK* track : aBoard->Tracks() )
for( const TRACK* track : aBoard->Tracks() )
{
if( track->Type() == PCB_VIA_T )
continue;
@ -505,7 +505,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( track->Type() == PCB_ARC_T )
{
ARC* arc = static_cast<ARC*>( track );
const ARC* arc = static_cast<const ARC*>( track );
VECTOR2D center( arc->GetCenter() );
int radius = arc->GetRadius();
double start_angle = arc->GetArcAngleStart();
@ -529,7 +529,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
NETINFO_ITEM nonet( aBoard );
for( ZONE* zone : aBoard->Zones() )
for( const ZONE* zone : aBoard->Zones() )
{
for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
{
@ -652,7 +652,7 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// Now we have one or more basic polygons: plot each polygon
for( int ii = 0; ii < outlines.OutlineCount(); ii++ )
{
for(int kk = 0; kk <= outlines.HoleCount (ii); kk++ )
for( int kk = 0; kk <= outlines.HoleCount(ii); kk++ )
{
cornerList.clear();
const SHAPE_LINE_CHAIN& path = (kk == 0) ? outlines.COutline( ii ) : outlines.CHole( ii, kk - 1 );
@ -943,8 +943,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
* page size is the 'drawing' page size,
* paper size is the physical page size
*/
static void initializePlotter( PLOTTER *aPlotter, BOARD * aBoard,
PCB_PLOT_PARAMS *aPlotOpts )
static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
const PCB_PLOT_PARAMS* aPlotOpts )
{
PAGE_INFO pageA4( wxT( "A4" ) );
const PAGE_INFO& pageInfo = aBoard->GetPageSettings();
@ -1042,7 +1042,7 @@ static void FillNegativeKnockout( PLOTTER *aPlotter, const EDA_RECT &aBbbox )
/**
* Calculate the effective size of HPGL pens and set them in the plotter object
*/
static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts )
static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, const PCB_PLOT_PARAMS *aPlotOpts )
{
// Compute penDiam (the value is given in mils) in pcb units, with plot scale (if Scale is 2,
// penDiam value is always m_HPGLPenDiam so apparent penDiam is actually penDiam / Scale
@ -1060,7 +1060,7 @@ static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlo
* and prepare the page for plotting.
* Return the plotter object if OK, NULL if the file is not created (or has a problem)
*/
PLOTTER* StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
const wxString& aFullFileName, const wxString& aSheetDesc )
{
// Create the plotter driver and set the few plotter specific options

View File

@ -73,7 +73,7 @@
* and a group of board items
*/
COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) const
{
COLOR4D color = ColorSettings()->GetColor( aLayer );
@ -86,7 +86,7 @@ COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
}
void BRDITEMS_PLOTTER::PlotPad( PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode )
void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode )
{
wxPoint shape_pos = aPad->ShapePos();
GBR_METADATA gbr_metadata;
@ -286,9 +286,9 @@ void BRDITEMS_PLOTTER::PlotPad( PAD* aPad, COLOR4D aColor, OUTLINE_MODE aPlotMod
}
void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint )
void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
{
FP_TEXT* textItem = &aFootprint->Reference();
const FP_TEXT* textItem = &aFootprint->Reference();
LAYER_NUM textLayer = textItem->GetLayer();
// Reference and value are specfic items, not in graphic items list
@ -298,7 +298,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint )
PlotFootprintTextItem( textItem, getColor( textLayer ) );
}
textItem = &aFootprint->Value();
textItem = &aFootprint->Value();
textLayer = textItem->GetLayer();
if( GetPlotValue() && m_layerMask[textLayer]
@ -307,9 +307,9 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( FOOTPRINT* aFootprint )
PlotFootprintTextItem( textItem, getColor( textLayer ) );
}
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
textItem = dyn_cast<FP_TEXT*>( item );
textItem = dyn_cast<const FP_TEXT*>( item );
if( !textItem )
continue;
@ -372,7 +372,7 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
}
}
void BRDITEMS_PLOTTER::PlotFootprintTextItem( FP_TEXT* aTextMod, COLOR4D aColor )
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, COLOR4D aColor )
{
if( aColor == COLOR4D::WHITE )
aColor = COLOR4D( LIGHTGRAY );
@ -380,9 +380,9 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( FP_TEXT* aTextMod, COLOR4D aColor
m_plotter->SetColor( aColor );
// calculate some text parameters :
wxSize size = aTextMod->GetTextSize();
wxPoint pos = aTextMod->GetTextPos();
double orient = aTextMod->GetDrawRotation();
wxSize size = aTextMod->GetTextSize();
wxPoint pos = aTextMod->GetTextPos();
double orient = aTextMod->GetDrawRotation();
int thickness = aTextMod->GetEffectiveTextPenWidth();
if( aTextMod->IsMirrored() )
@ -396,7 +396,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( FP_TEXT* aTextMod, COLOR4D aColor
GBR_METADATA gbr_metadata;
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
FOOTPRINT* parent = static_cast<FOOTPRINT*> ( aTextMod->GetParent() );
const FOOTPRINT* parent = static_cast<const FOOTPRINT*> ( aTextMod->GetParent() );
gbr_metadata.SetCmpReference( parent->GetReference() );
m_plotter->SetCurrentLineWidth( thickness );
@ -407,7 +407,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( FP_TEXT* aTextMod, COLOR4D aColor
}
void BRDITEMS_PLOTTER::PlotDimension( DIMENSION_BASE* aDim )
void BRDITEMS_PLOTTER::PlotDimension( const DIMENSION_BASE* aDim )
{
if( !m_layerMask[aDim->GetLayer()] )
return;
@ -462,16 +462,16 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION_BASE* aDim )
}
void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire )
void BRDITEMS_PLOTTER::PlotPcbTarget( const PCB_TARGET* aMire )
{
int dx1, dx2, dy1, dy2, radius;
int dx1, dx2, dy1, dy2, radius;
if( !m_layerMask[aMire->GetLayer()] )
return;
m_plotter->SetColor( getColor( aMire->GetLayer() ) );
PCB_SHAPE draw;
PCB_SHAPE draw;
draw.SetShape( S_CIRCLE );
draw.SetFilled( false );
@ -517,11 +517,11 @@ void BRDITEMS_PLOTTER::PlotPcbTarget( PCB_TARGET* aMire )
// Plot footprints graphic items (outlines)
void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( FOOTPRINT* aFootprint )
void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
{
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
FP_SHAPE* shape = dynamic_cast<FP_SHAPE*>( item );
const FP_SHAPE* shape = dynamic_cast<const FP_SHAPE*>( item );
if( shape && m_layerMask[ shape->GetLayer() ] )
PlotFootprintGraphicItem( shape );
@ -530,7 +530,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( FOOTPRINT* aFootprint )
//* Plot a graphic item (outline) relative to a footprint
void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( const FP_SHAPE* aShape )
{
if( aShape->Type() != PCB_FP_SHAPE_T )
return;
@ -544,7 +544,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
GBR_METADATA gbr_metadata;
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
FOOTPRINT* parent = static_cast<FOOTPRINT*> ( aShape->GetParent() );
const FOOTPRINT* parent = static_cast<const FOOTPRINT*> ( aShape->GetParent() );
gbr_metadata.SetCmpReference( parent->GetReference() );
bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
@ -627,7 +627,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
// We must compute board coordinates from m_PolyList which are relative to the parent
// position at orientation 0
FOOTPRINT *parentFootprint = aShape->GetParentFootprint();
const FOOTPRINT *parentFootprint = aShape->GetParentFootprint();
std::vector<wxPoint> cornerList;
@ -691,7 +691,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
// Plot a PCB Text, i.e. a text found on a copper or technical layer
void BRDITEMS_PLOTTER::PlotPcbText( PCB_TEXT* aText )
void BRDITEMS_PLOTTER::PlotPcbText( const PCB_TEXT* aText )
{
wxString shownText( aText->GetShownText() );
@ -734,7 +734,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( PCB_TEXT* aText )
aText->GetLinePositions( positions, strings_list.Count() );
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{
wxString& txt = strings_list.Item( ii );
m_plotter->Text( positions[ii], color, txt, orient, size, aText->GetHorizJustify(),
@ -751,7 +751,7 @@ void BRDITEMS_PLOTTER::PlotPcbText( PCB_TEXT* aText )
}
void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE* aZone, SHAPE_POLY_SET& polysList )
void BRDITEMS_PLOTTER::PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET& polysList )
{
if( polysList.IsEmpty() )
return;
@ -796,7 +796,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE* aZone, SHAPE_POLY_SET& polysList )
for( int idx = 0; idx < polysList.OutlineCount(); ++idx )
{
SHAPE_LINE_CHAIN& outline = polysList.Outline( idx );
const SHAPE_LINE_CHAIN& outline = polysList.Outline( idx );
cornerList.clear();
cornerList.reserve( outline.PointCount() );
@ -855,7 +855,7 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE* aZone, SHAPE_POLY_SET& polysList )
/* Plot items type PCB_SHAPE on layers allowed by aLayerMask
*/
void BRDITEMS_PLOTTER::PlotPcbShape( PCB_SHAPE* aShape )
void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
{
if( !m_layerMask[aShape->GetLayer()] )
return;

View File

@ -702,7 +702,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
bool restore_state = false;
VECTOR2I totalMovement;
PCB_GRID_HELPER grid( m_toolMgr, editFrame->GetMagneticItemsSettings() );
TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
TOOL_EVENT* evt = &aEvent;
VECTOR2I prevPos;
// Prime the pump

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