class_track.h 4.18 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*******************************************************************/
/*	class_track.h: definition des structures de donnees type track */
/*******************************************************************/

#ifndef CLASS_TRACK_H
#define CLASS_TRACK_H

#include "base_struct.h"

/* Type des Vias (shape)*/

/* Forme des Vias ( parametre .shape ) */
dickelbeck's avatar
dickelbeck committed
13 14 15 16 17
#define VIA_NORMALE     3           /* type via : traversante (throught via) */
#define VIA_ENTERREE    2           /* type via : enterree ou aveugle (blind via) */
#define VIA_BORGNE      1           /* type via : borgne ou demi-traversante (buried via) */
#define VIA_NOT_DEFINED 0           /* reserved */
#define SQUARE_VIA      0x80000000  /* Flag pour forme carree */
18 19 20 21


/***/

dickelbeck's avatar
dickelbeck committed
22
class TRACK : public EDA_BaseLineStruct
23 24
{
public:
dickelbeck's avatar
dickelbeck committed
25 26 27 28 29 30
    int             m_Shape;        // vias: shape and type, Track = shape..
    int             m_Drill;        // for vias: via drill (- 1 for default value)
    EDA_BaseStruct* start, * end;   // pointers on a connected item (pad or track)
    int             m_NetCode;      // Net number
    int             m_Sous_Netcode; /* In rastnest routines : for the current net,
                                     *  block number (number common to the current connected items found) */
31

dickelbeck's avatar
dickelbeck committed
32 33
    // chain = 0 indique une connexion non encore traitee
    int             m_Param;        // Auxiliary variable ( used in some computations )
34

dickelbeck's avatar
dickelbeck committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
public:
    TRACK( EDA_BaseStruct* StructFather, DrawStructureType idtype = TYPETRACK );
    TRACK( const TRACK& track );

    TRACK* Next( void );    // Retourne le chainage avant

    TRACK* Back( void )     // Retourne le chainage avant
    {
        return (TRACK*) Pback;
    }


    /* supprime du chainage la structure Struct */
    void    UnLink( void );

    // Read/write data
    bool    WriteTrackDescr( FILE* File );

    /* Ajoute un element a la liste */
    void    Insert( BOARD* Pcb, EDA_BaseStruct* InsertPoint );

    /* Recherche du meilleur point d'insertion */
    TRACK*  GetBestInsertPoint( BOARD* Pcb );

    /* Copie d'un Element d'une chaine de n elements */
    TRACK*  Copy( int NbSegm = 1 );

    /* Recherche du debut du net
     *  ( les elements sont classes par net_code croissant ) */
    TRACK*  GetStartNetCode( int NetCode );

    /* Recherche de la fin du net */
    TRACK*  GetEndNetCode( int NetCode );

    /* Display on screen: */
    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode );

    /* divers */
    int Shape( void ) { return m_Shape & 0xFF; }

    int     ReturnMaskLayer( void );
    int     IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
    bool    IsNull( void ); // return TRUE if segment lenght = 0

    /**
     * Function HitTest
     * tests if the given wxPoint is within the bounds of this object.
     * @param refPos A wxPoint to test
     * @return bool - true if a hit, else false
     */
    bool    HitTest( const wxPoint& refPos );

#if defined(DEBUG)
    /**
     * Function GetClass
     * returns the class name.
     * @return wxString
     */
    wxString GetClass() const
    {
        return wxT("TRACK");
    }
    
dickelbeck's avatar
dickelbeck committed
98 99 100 101 102 103 104 105 106
    /**
     * Function Show
     * is used to output the object tree, currently for debugging only.
     * @param nestLevel An aid to prettier tree indenting, and is the level 
     *          of nesting of this object within the overall tree.
     * @param os The ostream& to output to.
     */
    void Show( int nestLevel, std::ostream& os );
    
dickelbeck's avatar
dickelbeck committed
107 108
#endif
    
109 110
};

dickelbeck's avatar
dickelbeck committed
111
class SEGZONE : public TRACK
112 113
{
public:
dickelbeck's avatar
dickelbeck committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127
    SEGZONE( EDA_BaseStruct* StructFather );
    
#if defined(DEBUG)
    /**
     * Function GetClass
     * returns the class name.
     * @return wxString
     */
    wxString GetClass() const
    {
        return wxT("ZONE");
    }
#endif
    
128 129
};

dickelbeck's avatar
dickelbeck committed
130
class SEGVIA : public TRACK
131 132
{
public:
dickelbeck's avatar
dickelbeck committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    SEGVIA( EDA_BaseStruct* StructFather );
    bool    IsViaOnLayer( int layer );
    void    SetLayerPair( int top_layer, int bottom_layer );
    void    ReturnLayerPair( int* top_layer, int* bottom_layer );
    
#if defined(DEBUG)
    /**
     * Function GetClass
     * returns the class name.
     * @return wxString
     */
    wxString GetClass() const
    {
        return wxT("VIA");
    }
#endif
    
150 151 152 153
};


#endif /* CLASS_TRACK_H */