Commit 30ad817d authored by dickelbeck's avatar dickelbeck
Browse files

started class COLLECTORS_GUIDE

parent 077a570b
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with 
Please add newer entries at the top, list the date and your name with 
email address.
email address.



2007-Aug-29 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
    Started abstract class COLLECTORS_GUIDE.
    Renamed classtrc.cpp to classtrc.cpp.notused
    Changed some comments in class BOARD's header to english, starting clarify
    linked list contents.

    
2007-aug-27 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-aug-27 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+ all
+ all
+8 −7
Original line number Original line Diff line number Diff line
@@ -167,8 +167,9 @@ public:
    int    m_ModuleTextCUColor;                 // Text module color for modules on the COPPER layer
    int    m_ModuleTextCUColor;                 // Text module color for modules on the COPPER layer
    int    m_ModuleTextNOVColor;                // Text module color for "invisible" texts (must be BLACK if really not displayed)
    int    m_ModuleTextNOVColor;                // Text module color for "invisible" texts (must be BLACK if really not displayed)
    int    m_AnchorColor;                       // Anchor color for modules and texts
    int    m_AnchorColor;                       // Anchor color for modules and texts
    int    m_PadCUColor;                        // Pad color for the COMPONENT side of the pad
    
    int    m_PadCMPColor;                       // Pad color for the COPPER side of the pad
    int    m_PadCUColor;                        // Pad color for the COPPER side of the pad
    int    m_PadCMPColor;                       // Pad color for the COMPONENT side of the pad
    // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
    // Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
    
    
    int    m_RatsnestColor;                     // Ratsnest color
    int    m_RatsnestColor;                     // Ratsnest color
@@ -211,11 +212,11 @@ public:
    int             m_NbSegmTrack;              // nombre d'elements de type segments de piste
    int             m_NbSegmTrack;              // nombre d'elements de type segments de piste
    int             m_NbSegmZone;               // nombre d'elements de type segments de zone
    int             m_NbSegmZone;               // nombre d'elements de type segments de zone


    BOARD_ITEM*     m_Drawings;                 // pointeur sur liste drawings
    BOARD_ITEM*     m_Drawings;                 // linked list of lines & texts
    MODULE*         m_Modules;                  // pointeur sur liste zone modules
    MODULE*         m_Modules;                  // linked list of MODULEs
    EQUIPOT*        m_Equipots;                 // pointeur liste zone equipot
    EQUIPOT*        m_Equipots;                 // linked list of nets
    TRACK*          m_Track;                    // pointeur relatif zone piste
    TRACK*          m_Track;                    // linked list of TRACKs and SEGVIAs
    TRACK*          m_Zone;                     // pointeur tableau zone zones de cuivre
    TRACK*          m_Zone;                     // linked list of SEGZONEs
    D_PAD**         m_Pads;                     // pointeur liste d'acces aux pads
    D_PAD**         m_Pads;                     // pointeur liste d'acces aux pads
    int             m_NbPads;                   // nombre total de pads
    int             m_NbPads;                   // nombre total de pads
    CHEVELU*        m_Ratsnest;                 // pointeur liste des chevelus
    CHEVELU*        m_Ratsnest;                 // pointeur liste des chevelus
+8 −11
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@
#endif
#endif





/**************************************/
/**************************************/
/* Classes pour Pistes, Vias et Zones */
/* Classes pour Pistes, Vias et Zones */
/**************************************/
/**************************************/
@@ -110,14 +111,6 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer )
}
}




/************************/
TRACK* TRACK::Next( void )
/************************/
{
    return (TRACK*) Pnext;
}


/* supprime du chainage la structure Struct
/* supprime du chainage la structure Struct
 *  les structures arrieres et avant sont chainees directement
 *  les structures arrieres et avant sont chainees directement
 */
 */
@@ -170,7 +163,8 @@ void TRACK::Insert( BOARD* Pcb, EDA_BaseStruct* InsertPoint )
 *  Si InsertPoint == NULL, insertion en tete de liste
 *  Si InsertPoint == NULL, insertion en tete de liste
 */
 */
{
{
    TRACK* track, * NextS;
    TRACK*  track;
    TRACK*  NextS;


    /* Insertion du debut de la chaine a greffer */
    /* Insertion du debut de la chaine a greffer */
    if( InsertPoint == NULL )
    if( InsertPoint == NULL )
@@ -257,9 +251,11 @@ TRACK* TRACK::GetStartNetCode( int NetCode )
    {
    {
        if( Track->m_NetCode > NetCode )
        if( Track->m_NetCode > NetCode )
            break;
            break;
        
        if( Track->m_NetCode == NetCode )
        if( Track->m_NetCode == NetCode )
        {
        {
            ii++; break;
            ii++; 
            break;
        }
        }
        Track = (TRACK*) Track->Pnext;
        Track = (TRACK*) Track->Pnext;
    }
    }
@@ -276,7 +272,8 @@ TRACK* TRACK::GetStartNetCode( int NetCode )
 */
 */
TRACK* TRACK::GetEndNetCode( int NetCode )
TRACK* TRACK::GetEndNetCode( int NetCode )
{
{
    TRACK* NextS, * Track = this;
    TRACK* NextS;
    TRACK* Track = this;
    int    ii = 0;
    int    ii = 0;


    if( Track == NULL )
    if( Track == NULL )
+32 −0
Original line number Original line Diff line number Diff line
@@ -175,6 +175,38 @@ void GENERALCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos,
}
}




// see collectors.h 
void GENERALCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos, 
                            const COLLECTORS_GUIDE& guide )
{
    Empty();        // empty the collection, primary criteria list
    Empty2nd();     // empty the collection, secondary criteria list

    
    // @todo: remember the guide here, pass it to Inspect()
        
    
    /*  remember where the snapshot was taken from and pass refPos to
        the Inspect() function.
    */        
    SetRefPos( refPos );

    
    // visit the board with the INSPECTOR (me).
    board->Visit(   this,       // INSPECTOR* inspector
                    NULL,       // const void* testData, not used here 
                    m_ScanTypes);
    
    SetTimeNow();               // when snapshot was taken
    
    // append 2nd list onto end of the first "list" 
    for( unsigned i=0;  i<list2nd.size();  ++i )
        Append( list2nd[i] );
    
    Empty2nd();
}


#endif  // DEBUG
#endif  // DEBUG


//EOF
//EOF
+74 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,70 @@


#include "class_collector.h"
#include "class_collector.h"



/**
 * Class COLLECTORS_GUIDE
 * is an abstract base class that may be passed to a GENERALCOLLECTOR, telling
 * it what should be collected (aside from HitTest()ing and KICAD_T scanTypes[], 
 * information which are provided to the GENERALCOLLECTOR through attributes or
 * arguments separately). 
 * <p>
 * This class introduces the notion of layer locking.
 */
class COLLECTORS_GUIDE 
{
    
public:
    virtual     ~COLLECTORS_GUIDE() {}

    /**
     * Function IsLayerLocked
     * @return bool - true if the given layer is locked, else false.
     */
    virtual     bool IsLayerLocked( int layer ) const = 0;
    
    /**
     * Function IsCopperLayerVisible
     * @return bool - true if the copper layer is visible.
     */
    virtual     bool IsCopperLayerVisible() const = 0;
 
    /**
     * Function IsComponentLayerVisible
     * @return bool - true if the component layer is visible, else false.
     */
    virtual     bool IsComponentLayerVisible() const = 0;
    
    /**
     * Function IsLayerVisible
     * @return bool - true if the given layer is visible, else false.
     */
    virtual     bool IsLayerVisible( int layer ) const = 0;
    
    /**
     * Function IgnoreLockedLayers
     * @return bool - true if should ignored locked layers, else false.
     */
    virtual     bool IgnoreLockedLayers() const = 0;
    
    /**
     * Function IgnoredNonVisibleLayers
     * @return bool - true if should ignore non-visible layers, else false.
     */
    virtual     bool IgnoreNonVisibleLayers() const = 0;
    
    /**
     * Function GetPreferredLayer
     * @return int - the preferred layer for HitTest()ing.
     */
    virtual     int GetPreferredLayer() const = 0;
    
    
    // more soon
};



/**
/**
 * Class GENERALCOLLECTOR
 * Class GENERALCOLLECTOR
 * is intended for use when the right click button is pressed, or when the 
 * is intended for use when the right click button is pressed, or when the 
@@ -144,6 +208,16 @@ public:
     * @param aLayerMask The layers, in bit-mapped form, meeting the secondary search criterion.
     * @param aLayerMask The layers, in bit-mapped form, meeting the secondary search criterion.
     */
     */
    void Scan( BOARD* board, const wxPoint& refPos, int aPreferredLayer, int aLayerMask );
    void Scan( BOARD* board, const wxPoint& refPos, int aPreferredLayer, int aLayerMask );

    
    /**
     * Function Scan
     * scans a BOARD using this class's Inspector method, which does the collection.
     * @param board A BOARD to scan.
     * @param refPos A wxPoint to use in hit-testing.
     * @param guide The COLLECTORS_GUIDE to use in collecting items.
     */
    void Scan( BOARD* board, const wxPoint& refPos, const COLLECTORS_GUIDE& guide ); 
};
};