DLIST_ITERATOR improvements

This commit is contained in:
Tomasz Włostowski 2017-03-22 14:11:08 +01:00
parent 08314082db
commit 94a80acb36
5 changed files with 22 additions and 10 deletions

View File

@ -1686,9 +1686,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
CBVHCONTAINER2D *layerContainer = m_layers_container2D[curr_layer_id];
// ADD GRAPHIC ITEMS ON COPPER LAYERS (texts)
for( const BOARD_ITEM* item = m_board->m_Drawings;
item;
item = item->Next() )
for( auto item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
continue;
@ -1746,9 +1744,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
SHAPE_POLY_SET *layerPoly = m_layers_poly[curr_layer_id];
// ADD GRAPHIC ITEMS ON COPPER LAYERS (texts)
for( const BOARD_ITEM* item = m_board->m_Drawings;
item;
item = item->Next() )
for( auto item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
continue;
@ -1988,7 +1984,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add drawing objects
// /////////////////////////////////////////////////////////////////////
for( BOARD_ITEM* item = m_board->m_Drawings; item; item = item->Next() )
for( auto item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
continue;
@ -2024,7 +2020,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// Add drawing contours
// /////////////////////////////////////////////////////////////////////
for( BOARD_ITEM* item = m_board->m_Drawings; item; item = item->Next() )
for( auto item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
continue;

View File

@ -53,7 +53,7 @@ template<class T> class DLIST_ITERATOR_WRAPPER
explicit DLIST_ITERATOR_WRAPPER<T> ( DLIST<T>& list ) : m_list(list) {};
DLIST_ITERATOR<T*> begin() { return DLIST_ITERATOR<T*> ( m_list.GetFirst()); }
DLIST_ITERATOR<T*> end() { return DLIST_ITERATOR<T*> ( m_list.GetLast()); }
DLIST_ITERATOR<T*> end() { return DLIST_ITERATOR<T*> ( nullptr ); }
unsigned int Size() const {
return m_list.GetCount();

View File

@ -629,6 +629,18 @@ set_target_properties( pcbnew_kiface PROPERTIES
SUFFIX ${KIFACE_SUFFIX}
)
if ( KICAD_BUILD_TESTS )
if ( UNIX )
add_custom_command(TARGET pcbnew_kiface POST_BUILD
COMMAND ln -sf _pcbnew.kiface lib_pcbnew_kiface.so )
else()
add_custom_command(TARGET pcbnew_kiface POST_BUILD
COMMAND copy _pcbnew.kiface lib_pcbnew_kiface.dll )
endif()
endif ()
if( ${OPENMP_FOUND} )
set_target_properties( pcbnew_kiface PROPERTIES
COMPILE_FLAGS ${OpenMP_CXX_FLAGS}

View File

@ -44,6 +44,8 @@
#include "zones.h"
#include <3d_cache/3d_info.h>
#include <core/iterators.h>
#include <functional>
class LINE_READER;
@ -136,6 +138,8 @@ public:
DLIST<BOARD_ITEM>& GraphicalItems() { return m_Drawings; }
const DLIST<BOARD_ITEM>& GraphicalItems() const { return m_Drawings; }
DLIST_ITERATOR_WRAPPER<D_PAD> PadsIter() { return DLIST_ITERATOR_WRAPPER<D_PAD>(m_Pads); }
std::list<S3D_INFO>& Models() { return m_3D_Drawings; }
const std::list<S3D_INFO>& Models() const { return m_3D_Drawings; }

View File

@ -135,7 +135,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
m_view->Add( (KIGFX::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
// Load drawings
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
for( auto drawing : const_cast<BOARD*>(aBoard)->Drawings() )
m_view->Add( drawing );
// Load tracks