Commit 555ce68e authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Gerbview: Add support for recent File Format Attribute metadata, both for X2...

Gerbview: Add support for recent File Format Attribute metadata, both for X2 Gerber file format and X1 (R274X) format.
Pcbnew already uses this attribute when creating Gerber files.
Because Gerber files using this attribute identify the board layers stackup, Gerbview (if this attribute is defined) can sort gerber images stach up like the board.
(in layer manager, just right click to access to the sort menu)
parent 0c1a87ca
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ set( GERBVIEW_SRCS
    class_gerber_draw_item.cpp
    class_gerbview_layer_widget.cpp
    class_gbr_layer_box_selector.cpp
    class_X2_gerber_attributes.cpp
    controle.cpp
    dcode.cpp
    draw_gerber_screen.cpp
+180 −3
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@
#include <gerbview.h>
#include <gerbview_frame.h>
#include <class_GERBER.h>
#include <class_X2_gerber_attributes.h>

#include <algorithm>


/**
@@ -91,6 +94,7 @@ GERBER_IMAGE::GERBER_IMAGE( GERBVIEW_FRAME* aParent, int aLayer )
    m_GraphicLayer = aLayer;        // Graphic layer Number

    m_Selected_Tool = FIRST_DCODE;
    m_FileFunction = NULL;          // file function parameters

    ResetDefaultValues();

@@ -104,9 +108,9 @@ GERBER_IMAGE::~GERBER_IMAGE()
    for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
    {
        delete m_Aperture_List[ii];

        // m_Aperture_List[ii] = NULL;
    }

    delete m_FileFunction;
}

/*
@@ -158,6 +162,11 @@ void GERBER_IMAGE::ResetDefaultValues()
    m_FileName.Empty();
    m_ImageName     = wxT( "no name" );             // Image name from the IN command
    m_ImageNegative = false;                        // true = Negative image
    m_IsX2_file     = false;                        // true only if a %TF, %TA or %TD command
    delete m_FileFunction;                          // file function parameters
    m_FileFunction = NULL;
    m_MD5_value.Empty();                            // MD5 value found in a %TF.MD5 command
    m_PartString.Empty();                           // string found in a %TF.Part command
    m_hasNegativeItems    = -1;                     // set to uninitialized
    m_ImageJustifyOffset  = wxPoint(0,0);           // Image justify Offset
    m_ImageJustifyXCenter = false;                  // Image Justify Center on X axis (default = false)
@@ -361,3 +370,171 @@ void GERBER_IMAGE::DisplayImageInfo( void )
    m_Parent->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
}

// GERBER_IMAGE_LIST is a helper class to handle a list of GERBER_IMAGE files
GERBER_IMAGE_LIST::GERBER_IMAGE_LIST()
{
    m_GERBER_List.reserve( GERBER_DRAWLAYERS_COUNT );

    for( unsigned layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
        m_GERBER_List.push_back( NULL );
}

GERBER_IMAGE_LIST::~GERBER_IMAGE_LIST()
{
    ClearList();

    for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
    {
        delete m_GERBER_List[layer];
        m_GERBER_List[layer] = NULL;
    }
}

GERBER_IMAGE* GERBER_IMAGE_LIST::GetGbrImage( int aIdx )
{
    if( (unsigned)aIdx < m_GERBER_List.size() )
        return m_GERBER_List[aIdx];

    return NULL;
}

/**
 * creates a new, empty GERBER_IMAGE* at index aIdx
 * or at the first free location if aIdx < 0
 * @param aIdx = the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
 * @return true if the index used, or -1 if no room to add image
 */
int GERBER_IMAGE_LIST::AddGbrImage( GERBER_IMAGE* aGbrImage, int aIdx )
{
    int idx = aIdx;

    if( idx < 0 )
    {
        for( idx = 0; idx < (int)m_GERBER_List.size(); idx++ )
        {
            if( !IsUsed( idx ) )
                break;
        }
    }

    if( idx >= (int)m_GERBER_List.size() )
        return -1;  // No room

    m_GERBER_List[idx] = aGbrImage;

    return idx;
}


// remove all loaded data in list, but do not delete empty images
// (can be reused)
void GERBER_IMAGE_LIST::ClearList()
{
    for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
        ClearImage( layer );
}

// remove the loaded data of image aIdx, but do not delete it
void GERBER_IMAGE_LIST::ClearImage( int aIdx )
{
    if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() && m_GERBER_List[aIdx] )
    {
        m_GERBER_List[aIdx]->InitToolTable();
        m_GERBER_List[aIdx]->ResetDefaultValues();
        m_GERBER_List[aIdx]->m_InUse = false;
    }
}

// Build a name for image aIdx which can be used in layers manager
const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
{
    wxString name;

    GERBER_IMAGE* gerber = NULL;

    if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
        gerber = m_GERBER_List[aIdx];

    if( gerber && gerber->m_InUse)
    {
        if( gerber->m_FileFunction )
            name.Printf( _( "Layer %d (%s, %s)" ), aIdx + 1,
                         GetChars( gerber->m_FileFunction->GetFileType() ),
                         GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
        else
            name.Printf( _( "Layer %d *" ), aIdx + 1 );
    }
    else
        name.Printf( _( "Layer %d" ), aIdx + 1 );

    return name;
}

// return true if image is used (loaded and not cleared)
bool GERBER_IMAGE_LIST::IsUsed( int aIdx )
{
    if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
        return m_GERBER_List[aIdx] != NULL && m_GERBER_List[aIdx]->m_InUse;

    return false;
}

// Helper function, for std::sort.
// Sort loaded images by Z order priority, if they have the X2 FileFormat info
// returns true if the first argument (ref) is ordered before the second (test).
static bool sortZorder( const GERBER_IMAGE* const& ref, const GERBER_IMAGE* const& test )
{
    if( !ref && !test )
        return false;        // do not change order: no criteria to sort items

    if( !ref || !ref->m_InUse )
        return false;       // Not used: ref ordered after

    if( !test || !test->m_InUse )
        return true;        // Not used: ref ordered before

    if( !ref->m_FileFunction && !test->m_FileFunction )
        return false;        // do not change order: no criteria to sort items

    if( !ref->m_FileFunction )
        return false;

    if( !test->m_FileFunction )
        return true;

    if( ref->m_FileFunction->GetZOrder() != test->m_FileFunction->GetZOrder() )
        return ref->m_FileFunction->GetZOrder() > test->m_FileFunction->GetZOrder();

    return ref->m_FileFunction->GetZSubOrder() > test->m_FileFunction->GetZSubOrder();
}

void GERBER_IMAGE_LIST::SortImagesByZOrder( GERBER_DRAW_ITEM* aDrawList )
{
    std::sort( m_GERBER_List.begin(), m_GERBER_List.end(), sortZorder );

    // The image order has changed.
    // Graphic layer numbering must be updated to match the widgets layer order

    // Store the old/new graphic layer info:
    std::map <int, int> tab_lyr;

    for( unsigned layer = 0; layer < m_GERBER_List.size(); ++layer )
    {
        if( m_GERBER_List[layer] )
        {
            tab_lyr[m_GERBER_List[layer]->m_GraphicLayer] = layer;
            m_GERBER_List[layer]->m_GraphicLayer = layer ;
        }
    }

    // update the graphic layer in items to draw
    for( GERBER_DRAW_ITEM* item = aDrawList; item; item = item->Next() )
    {
        int layer = item->GetLayer();
        item->SetLayer( tab_lyr[layer] );
    }
}


// The global image list:
GERBER_IMAGE_LIST g_GERBER_List;
+68 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ class D_CODE;
 */

class GERBER_IMAGE;
class X2_ATTRIBUTE_FILEFUNCTION;

class GERBER_LAYER
{
@@ -104,6 +105,11 @@ public:
                                                                // (a file is loaded in it)
    wxString           m_FileName;                              // Full File Name for this layer
    wxString           m_ImageName;                             // Image name, from IN <name>* command
    bool               m_IsX2_file;                             // true if a X2 gerber attribute was found in file
    X2_ATTRIBUTE_FILEFUNCTION* m_FileFunction;                  // file function parameters, found in a %TF command
                                                                // or a G04
    wxString           m_MD5_value;                             // MD5 value found in a %TF.MD5 command
    wxString           m_PartString;                            // string found in a %TF.Part command
    int                m_GraphicLayer;                          // Graphic layer Number
    bool               m_ImageNegative;                         // true = Negative image
    bool               m_ImageJustifyXCenter;                   // Image Justify Center on X axis (default = false)
@@ -306,5 +312,67 @@ public:
    void DisplayImageInfo( void );
};

/**
 * @brief GERBER_IMAGE_LIST is a helper class to handle a list of GERBER_IMAGE files
 * which are loaded and can be displayed
 * there are 32 images max which can be loaded
 */
class GERBER_IMAGE_LIST
{
    // the list of loaded images (1 image = 1 gerber file)
    std::vector<GERBER_IMAGE*> m_GERBER_List;

public:
    GERBER_IMAGE_LIST();
    ~GERBER_IMAGE_LIST();

    //Accessor
    GERBER_IMAGE* GetGbrImage( int aIdx );

    /**
     * Add a GERBER_IMAGE* at index aIdx
     * or at the first free location if aIdx < 0
     * @param aGbrImage = the image to add
     * @param aIdx = the location to use ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
     * @return true if the index used, or -1 if no room to add image
     */
    int AddGbrImage( GERBER_IMAGE* aGbrImage, int aIdx );


    /**
     * remove all loaded data in list
     */
    void ClearList();

    /**
     * remove the loaded data of image aIdx
     * @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
     */
    void ClearImage( int aIdx );

    /**
     * @return a name for image aIdx which can be used in layers manager
     * and layer selector
     * is is "Layer n" (n = aIdx+1), followed by file attribute info (if X2 format)
     * @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
     */
    const wxString GetDisplayName( int aIdx );

    /**
     * @return true if image is used (loaded and with items)
     * @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
     */
    bool IsUsed( int aIdx );

    /**
     * Sort loaded images by Z order priority, if they have the X2 FileFormat info
     * @param aDrawList: the draw list associated to the gerber images
     * (SortImagesByZOrder updates the graphic layer of these items)
     */
    void SortImagesByZOrder( GERBER_DRAW_ITEM* aDrawList );
};


extern GERBER_IMAGE_LIST g_GERBER_List;

#endif  // ifndef _CLASS_GERBER_H_
+253 −0
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2010-2014 Jean-Pierre Charras  jp.charras at wanadoo.fr
 * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/**
 * @file class_X2_gerber_attributes.cpp
 */

/*
 * Manage the gerber extensions (attributes) in the new X2 version
 * only few extensions are handled
 * See http://www.ucamco.com/files/downloads/file/81/the_gerber_file_format_specification.pdf
 *
 * gerber attributes in the new X2 version look like:
 * %TF.FileFunction,Copper,L1,Top*%
 *
 * Currently:
 *  .FileFunction .FileFunction Identifies the file’s function in the PCB.
 * Other Standard Attributes, not yet used in Gerbview:
 *  .Part Identifies the part the file represents, e.g. a single PCB
 *  .MD5 Sets the MD5 file signature or checksum.
 */

#include <wx/log.h>
#include <class_X2_gerber_attributes.h>

/*
 * class X2_ATTRIBUTE
 * The attribute value consists of a number of substrings separated by a “,”
*/

X2_ATTRIBUTE::X2_ATTRIBUTE()
{
}

X2_ATTRIBUTE::~X2_ATTRIBUTE()
{
}

/* return the attribute name (for instance .FileFunction)
 * which is given by TF command.
 */
const wxString& X2_ATTRIBUTE::GetAttribute()
{
    return m_Prms.Item( 0 );
}

/* return a parameter
 * aIdx = the index of the parameter
 * aIdx = 0 is the parameter read after the TF function
 * (the same as GetAttribute())
 */
const wxString& X2_ATTRIBUTE::GetPrm( int aIdx)
{
    static const wxString dummy;

    if( GetPrmCount() < aIdx && aIdx >= 0 )
        return m_Prms.Item( aIdx );

    return dummy;
}

// Debug function: pring using wxLogMessage le list of parameters
void X2_ATTRIBUTE::DbgListPrms()
{
    wxLogMessage( wxT("prms count %d"), GetPrmCount() );

    for( int ii = 0; ii < GetPrmCount(); ii++ )
        wxLogMessage( m_Prms.Item( ii ) );
}

/*
 * parse a TF command and fill m_Prms by the parameters found.
 * aFile = a FILE* ptr to the current Gerber file.
 * buff = the buffer containing current Gerber data (GERBER_BUFZ size)
 * text = a pointer to the first char to read in Gerber data
 */
bool X2_ATTRIBUTE::ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char*& aText )
{
    bool ok = true;
    wxString data;

    for( ; ; )
    {
        while( *aText )
        {
            switch( *aText )
            {
            case '%':       // end of command
                return ok;  // success completion

            case ' ':
            case '\r':
            case '\n':
                aText++;
                break;

            case '*':       // End of block
                m_Prms.Add( data );
                data.Empty();
                aText++;
                break;

            case ',':       // End of parameter
                aText++;
                m_Prms.Add( data );
                data.Empty();
                break;

            default:
                data.Append( *aText );
                aText++;
                break;
            }
        }

        // end of current line, read another one.
        if( aBuffer )
        {
            if( fgets( aBuffer, aBuffSize, aFile ) == NULL )
            {
                // end of file
                ok = false;
                break;
            }

            aText = aBuffer;
        }
        else
            return ok;
    }

    return ok;
}

/*
 * class X2_ATTRIBUTE_FILEFUNCTION ( from %TF.FileFunction in Gerber file)
 *  Example file function:
 *  %TF.FileFunction,Copper,L1,Top*%
 * - Type. Such as copper, solder mask etc.
 * - Position. Specifies where the file appears in the PCB layer structure.
 *      Corresponding position substring:
 *      Copper layer:   L1, L2, L3...to indicate the layer position followed by Top, Inr or
 *                      Bot. L1 is always the top copper layer. E.g. L2,Inr.
 *      Extra layer, e.g. solder mask: Top or Bot – defines the attachment of the layer.
 *      Drill/rout layer: E.g. 1,4 – where 1 is the start and 4 is the end copper layer. The
 *                        pair 1,4 defines the span of the drill/rout file
 * Optional index. This can be used in instances where for example there are two solder
 *                 masks on the same side. The index counts from the PCB surface outwards.
 */
X2_ATTRIBUTE_FILEFUNCTION::X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase )
    : X2_ATTRIBUTE()
{
    m_Prms = aAttributeBase.GetPrms();
    m_z_order = 0;

    //ensure at least 5 parameters
    while( GetPrmCount() < 5 )
        m_Prms.Add( wxEmptyString );

    set_Z_Order();
}

const wxString& X2_ATTRIBUTE_FILEFUNCTION::GetFileType()
{
    // the type of layer (Copper ,  Soldermask ... )
    return m_Prms.Item( 1 );
}

const wxString& X2_ATTRIBUTE_FILEFUNCTION::GetBrdLayerId()
{
    // the brd layer identifier: Top, Bot, Ln
    return m_Prms.Item( 2 );
}


const wxString& X2_ATTRIBUTE_FILEFUNCTION::GetLabel()
{
    // the filefunction label, if any
    return m_Prms.Item( 3 );
}


// Initialize the z order priority of the current file, from its attributes
// this priority is the order of layers from top to bottom to draw/display gerber images
// Stack up is(  from external copper layer to external)
// copper, then solder paste, then solder mask, then silk screen.
// and global stackup is Front (top) layers then internal copper layers then Back (bottom) layers
void X2_ATTRIBUTE_FILEFUNCTION::set_Z_Order()
{
    m_z_order = -100;     // low level
    m_z_sub_order = 0;

    if( GetFileType().IsSameAs( wxT( "Copper" ), false ) )
    {
        // Copper layer: the priority is the layer Id
        m_z_order = 0;
        wxString num = GetBrdLayerId().Mid( 1 );
        long lnum;
        if( num.ToLong( &lnum ) )
            m_z_sub_order = -lnum;
    }

    if( GetFileType().IsSameAs( wxT( "Paste" ), false ) )
    {
        // solder paste layer: the priority is top then bottom
        m_z_order = 1;       // for top

        if( GetBrdLayerId().IsSameAs( wxT( "Bot" ), false ) )
            m_z_order = -m_z_order;
    }

    if( GetFileType().IsSameAs( wxT( "Soldermask" ), false ) )
    {
        // solder mask layer: the priority is top then bottom
        m_z_order = 2;       // for top

        if( GetBrdLayerId().IsSameAs( wxT( "Bot" ), false ) )
            m_z_order = -m_z_order;
    }

    if( GetFileType().IsSameAs( wxT( "Legend" ), false ) )
    {
        // Silk screen layer: the priority is top then bottom
        m_z_order = 3;       // for top

        if( GetFileType().IsSameAs( wxT( "Legend" ), false ) )

        if( GetBrdLayerId().IsSameAs( wxT( "Bot" ), false ) )
            m_z_order = -m_z_order;
    }
}
+171 −0
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2010-2014 Jean-Pierre Charras  jp.charras at wanadoo.fr
 * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/**
 * @file class_X2_gerber_attributes.h
 */

#ifndef _CLASS_X2_GERBER_ATTRIBUTE_H_
#define _CLASS_X2_GERBER_ATTRIBUTE_H_

/*
 * Manage the gerber extensions (attributes) in the new X2 version
 * only few extensions are handled
 * See http://www.ucamco.com/files/downloads/file/81/the_gerber_file_format_specification.pdf
 *
 * gerber attributes in the new X2 version look like:
 * %TF.FileFunction,Copper,L1,Top*%
 *
 * Currently:
 *  .FileFunction .FileFunction Identifies the file’s function in the PCB.
 * Other Standard Attributes, not yet used in Gerbview:
 *  .Part Identifies the part the file represents, e.g. a single PCB
 *  .MD5 Sets the MD5 file signature or checksum.
 */

#include <wx/arrstr.h>

/**
 * class X2_ATTRIBUTE
 * The attribute value consists of a number of substrings separated by a “,”
*/

class X2_ATTRIBUTE
{
protected:
    wxArrayString m_Prms;   ///< the list of parameters (after TF) in gbr file
                            ///< the first one is the attribute name,
                            ///< if starting by '.'

public:
    X2_ATTRIBUTE();
    ~X2_ATTRIBUTE();

    /**
     * @return the parameters list read in TF command.
     */
    wxArrayString& GetPrms() { return m_Prms; }

    /**
     * @return a parameter read in TF command.
     * @param aIdx = the index of the parameter
     * aIdx = 0 is the parameter read after the TF function
     * (the same as GetAttribute())
     */
    const wxString& GetPrm( int aIdx );

    /**
     * @return the attribute name (for instance .FileFunction)
     * which is given by TF command (i.e. the first parameter read).
     */
    const wxString& GetAttribute();

    /**
     * @return the number of parameters read in TF command.
     */
    int GetPrmCount() { return int( m_Prms.GetCount() ); }

    /**
     * parse a TF command terminated with a % and fill m_Prms
     * by the parameters found.
     * @param aFile = a FILE* ptr to the current Gerber file.
     * @param aBuffer = the buffer containing current Gerber data (can be null)
     * @param aBuffSize = the size of the buffer
     * @param aText = a pointer to the first char to read from Gerber data stored in aBuffer
     *  After parsing, text points the last char of the command line ('%') (X2 mode)
     *  or the end of line if the line does not contain '%' or aBuffer == NULL (X1 mode)
     * @return true if no error.
     */
    bool ParseAttribCmd( FILE* aFile, char *aBuffer, int aBuffSize, char*& aText );

    /**
     * Debug function: pring using wxLogMessage le list of parameters
     */
    void DbgListPrms();

    /**
     * return true if the attribute is .FileFunction
     */
    bool IsFileFunction()
    {
        return GetAttribute().IsSameAs( wxT(".FileFunction"), false );
    }

    /**
     * return true if the attribute is .MD5
     */
    bool IsFileMD5()
    {
        return GetAttribute().IsSameAs( wxT(".MD5"), false );
    }

    /**
     * return true if the attribute is .Part
     */
    bool IsFilePart()
    {
        return GetAttribute().IsSameAs( wxT(".Part"), false );
    }
};

/**
 * class X2_ATTRIBUTE_FILEFUNCTION ( from %TF.FileFunction in Gerber file)
 *  Example file function:
 *  %TF.FileFunction,Copper,L1,Top*%
 * - Type. Such as copper, solder mask etc.
 * - Position. Specifies where the file appears in the PCB layer structure.
 *      Corresponding position substring:
 *      Copper layer:   L1, L2, L3...to indicate the layer position followed by Top, Inr or
 *                      Bot. L1 is always the top copper layer. E.g. L2,Inr.
 *      Extra layer, e.g. solder mask: Top or Bot – defines the attachment of the layer.
 *      Drill/rout layer: E.g. 1,4 – where 1 is the start and 4 is the end copper layer. The
 *                        pair 1,4 defines the span of the drill/rout file
 * Optional index. This can be used in instances where for example there are two solder
 *                 masks on the same side. The index counts from the PCB surface outwards.
 */

class X2_ATTRIBUTE_FILEFUNCTION : public X2_ATTRIBUTE
{
    int m_z_order;              // the z order of the layer for a board
    int m_z_sub_order;          // the z sub_order of the copper layer for a board

public:
    X2_ATTRIBUTE_FILEFUNCTION( X2_ATTRIBUTE& aAttributeBase );

    const wxString& GetFileType();    ///< the type of layer (Copper ,  Soldermask ... )
    const wxString& GetBrdLayerId();  ///< the brd layer identifier: Top, Bot, Ln
    const wxString& GetLabel();       ///< the filefunction label, if any

    int GetZOrder() { return m_z_order; }   ///< the Order of the bdr layer, from front (Top side) to back side
    int GetZSubOrder() { return m_z_sub_order; }   ///< the Order of the bdr copper layer, from front (Top side) to back side

private:

    /**
     * Initialize the z order priority of the current file, from its attributes
     */
    void set_Z_Order();
};

#endif      // _CLASS_X2_GERBER_ATTRIBUTE_H_
Loading