Commit 7b4b3297 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio
Browse files

- Better way to iterate on vias in the track list (GetFirstVia)

- Converted the Next/Prev C casts to static casts and removed the type
  unsafe ones
- Splitted as virtual the VIA::Flip member instead of using RTTI
- Heavily refactored the 'unconnected track' cleanup routine
- Misc constification
parent 7b843eca
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    bool            hightQualityMode = false;

    for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
         layer++ )
         ++layer )
    {
        if( layer != LAST_COPPER_LAYER
            && layer >= g_Parm_3D_Visu.m_CopperLayersCount )
@@ -528,12 +528,11 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    }

    int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
    for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
    {
       // Add via hole
        if( track->Type() == PCB_VIA_T )

    // Add via holes
    for( VIA* via = GetFirstVia( pcb->m_Track ); via != NULL;
            via = GetFirstVia( via->Next() ) )
    {
            const VIA *via = static_cast<const VIA*>( track );
        VIATYPE_T viatype = via->GetViaType();
        int holediameter = via->GetDrillValue();
        int hole_outer_radius = (holediameter + thickness) / 2;
@@ -543,7 +542,6 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
                    via->GetStart(), hole_outer_radius,
                    segcountLowQuality );
    }
    }

    // draw pads holes
    for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
@@ -562,7 +560,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    allLayerHoles.ExportTo( brdpolysetHoles );

    for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
         layer++ )
         ++layer )
    {
        // Skip user layers, which are not drawn here
        if( IsUserLayer( layer) )
@@ -713,7 +711,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
    bufferPolys.reserve( 5000 );    // Reserve for items not on board

    for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
         layer++ )
         ++layer )
    {
        if( !Is3DLayerEnabled( layer ) )
            continue;
+1 −1
Original line number Diff line number Diff line
@@ -1345,7 +1345,7 @@ SCH_SCREEN* SCH_SCREENS::GetNext()
}


SCH_SCREEN* SCH_SCREENS::GetScreen( unsigned int aIndex )
SCH_SCREEN* SCH_SCREENS::GetScreen( unsigned int aIndex ) const
{
    if( aIndex < m_screens.size() )
        return m_screens[ aIndex ];
+6 −6
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
}


SCH_SHEET* SCH_SHEET_PATH::Last()
SCH_SHEET* SCH_SHEET_PATH::Last() const
{
    if( m_numSheets )
        return m_sheets[m_numSheets - 1];
@@ -121,7 +121,7 @@ SCH_SHEET* SCH_SHEET_PATH::Last()
}


SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
SCH_SCREEN* SCH_SHEET_PATH::LastScreen() const
{
    SCH_SHEET* lastSheet = Last();

@@ -132,7 +132,7 @@ SCH_SCREEN* SCH_SHEET_PATH::LastScreen()
}


SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
SCH_ITEM* SCH_SHEET_PATH::LastDrawList() const
{
    SCH_SHEET* lastSheet = Last();

@@ -143,7 +143,7 @@ SCH_ITEM* SCH_SHEET_PATH::LastDrawList()
}


SCH_ITEM* SCH_SHEET_PATH::FirstDrawList()
SCH_ITEM* SCH_SHEET_PATH::FirstDrawList() const
{
    SCH_ITEM* item = NULL;

@@ -316,7 +316,7 @@ void SCH_SHEET_PATH::GetComponents( SCH_REFERENCE_LIST& aReferences, bool aInclu
}


SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
{
    bool hasWrapped = false;
    bool firstItemFound = false;
@@ -349,7 +349,7 @@ SCH_ITEM* SCH_SHEET_PATH::FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem, bool
}


SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap )
SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, bool aWrap ) const
{
    bool hasWrapped = false;
    bool firstItemFound = false;
+7 −7
Original line number Diff line number Diff line
@@ -129,20 +129,20 @@ public:
     * returns a pointer to the last sheet of the list
     * One can see the others sheet as the "path" to reach this last sheet
     */
    SCH_SHEET* Last();
    SCH_SHEET* Last() const;

    /**
     * Function LastScreen
     * @return the SCH_SCREEN relative to the last sheet in list
     */
    SCH_SCREEN* LastScreen();
    SCH_SCREEN* LastScreen() const;

    /**
     * Function LastDrawList
     * @return a pointer to the first schematic item handled by the
     * SCH_SCREEN relative to the last sheet in list
     */
    SCH_ITEM* LastDrawList();
    SCH_ITEM* LastDrawList() const;

    /**
     * Get the last schematic item relative to the first sheet in the list.
@@ -150,7 +150,7 @@ public:
     * @return Last schematic item relative to the first sheet in the list if list
     *         is not empty.  Otherwise NULL.
     */
    SCH_ITEM* FirstDrawList();
    SCH_ITEM* FirstDrawList() const;

    /**
     * Function Push
@@ -248,7 +248,7 @@ public:
     *                is defined.
     * @return - The next schematic item if found.  Otherwise, NULL is returned.
     */
    SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false );
    SCH_ITEM* FindNextItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const;

    /**
     * Find the previous schematic item in this sheet path object.
@@ -260,7 +260,7 @@ public:
     *                is defined.
     * @return - The previous schematic item if found.  Otherwise, NULL is returned.
     */
    SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false );
    SCH_ITEM* FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem = NULL, bool aWrap = false ) const;

    SCH_SHEET_PATH& operator=( const SCH_SHEET_PATH& d1 );

@@ -318,7 +318,7 @@ public:
     * @return the number of sheets in list:
     * usually the number of sheets found in the whole hierarchy
     */
    int GetCount() { return m_count; }
    int GetCount() const { return m_count; }

    /**
     * Function GetFirst
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ public:

    ~GBR_SCREEN();

    GBR_SCREEN* Next() { return (GBR_SCREEN*) Pnext; }
    GBR_SCREEN* Next() const { return static_cast<GBR_SCREEN*>( Pnext ); }

//    void        SetNextZoom();
//    void        SetPreviousZoom();
Loading