Commit 370356b6 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

preparing Gerbview enhancements.Add comments

parent 6396c2eb
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -61,6 +61,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
    }
    }
}
}



/**
/**
 * Function ReadParam
 * Function ReadParam
 * Read one aperture macro parameter
 * Read one aperture macro parameter
@@ -76,6 +77,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
bool AM_PARAM::ReadParam( char*& aText  )
bool AM_PARAM::ReadParam( char*& aText  )
{
{
    bool found = false;
    bool found = false;

    if( *aText == '$' ) // value defined later, in aperture description
    if( *aText == '$' ) // value defined later, in aperture description
    {
    {
        ++aText;
        ++aText;
@@ -91,6 +93,7 @@ bool AM_PARAM::ReadParam( char*& aText )
    // Skip extra characters and separator
    // Skip extra characters and separator
    while( *aText && (*aText != ',') && (*aText != '*') )
    while( *aText && (*aText != ',') && (*aText != '*') )
        aText++;
        aText++;

    if( *aText == ',' )
    if( *aText == ',' )
        aText++;
        aText++;


+70 −70
Original line number Original line Diff line number Diff line
@@ -31,73 +31,73 @@
#define _AM_PARAM_H_
#define _AM_PARAM_H_


/*
/*
An aperture macro defines a complex shape and is a list of aperture primitives.
 *  An aperture macro defines a complex shape and is a list of aperture primitives.
Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
 *  Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
Inside a given aperture primitive, a fixed list of parameters defines info
 *  Inside a given aperture primitive, a fixed list of parameters defines info
about the shape: size, thickness, number of vertex ...
 *  about the shape: size, thickness, number of vertex ...

 *
Each parameter can be an immediate value or a defered value.
 *  Each parameter can be an immediate value or a defered value.
When value is defered, it is defined when the aperture macro is instancied by
 *  When value is defered, it is defined when the aperture macro is instancied by
an ADD macro command
 *  an ADD macro command

 *
Actual values of a parmeter can also be the result of an arithmetic operation.
 *  Actual values of a parameter can also be the result of an arithmetic operation.

 *
Here is some examples:
 *  Here is some examples:
An immediate value:
 *  An immediate value:
3.5
 *  3.5
A deferend value:
 *  A deferend value:
$2  means: replace me by the second value given in the ADD command
 *  $2  means: replace me by the second value given in the ADD command
Actual value as arithmetic calculation:
 *  Actual value as arithmetic calculation:
$2/2+1
 *  $2/2+1

 *
Note also a defered parameter can be defined in aperture macro,
 *  Note also a defered parameter can be defined in aperture macro,
but outside aperture primitives. Example
 *  but outside aperture primitives. Example
%AMRECTHERM*
 *  %AMRECTHERM*
$4=$3/2*    parameter $4 is half value of parameter $3
 *  $4=$3/2*    parameter $4 is half value of parameter $3
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
 *  21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
 *  For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
and $4 is defined inside the macro
 *  and $4 is defined inside the macro

 *
Some examples of aperture macro definition
 *  Some examples of aperture macro definition
A simple definition, no parameters:
 *  A simple definition, no parameters:
%AMMOIRE10*
 *  %AMMOIRE10*
6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
 *  6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
Example of instanciation:
 *  Example of instanciation:
%ADD19THERM19*%
 *  %ADD19THERM19*%

 *
A simple definition, one parameter:
 *  A simple definition, one parameter:
%AMCIRCLE*
 *  %AMCIRCLE*
1,1,$1,0,0*
 *  1,1,$1,0,0*
Example of instanciation:
 *  Example of instanciation:
%ADD11CIRCLE,.5*%
 *  %ADD11CIRCLE,.5*%

 *
A definition, with parameters and arithmetic operations:
 *  A definition, with parameters and arithmetic operations:
%AMVECTOR*
 *  %AMVECTOR*
2,1,$1,0,0,$2+1,$3,-135*%
 *  2,1,$1,0,0,$2+1,$3,-135*%
Example of instanciation:
 *  Example of instanciation:
%ADD12VECTOR,0.05X0X0*%
 *  %ADD12VECTOR,0.05X0X0*%

 *
A more complicated aperture macro definition, with parameters and arihmetic operations:
 *  A more complicated aperture macro definition, with parameters and arihmetic operations:
%AMRNDREC*
 *  %AMRNDREC*
0 this is a comment*
 *  0 this is a comment*
21,1,$1+$1,$2+$2-$3-$3,0,0,0*
 *  21,1,$1+$1,$2+$2-$3-$3,0,0,0*
21,1,$1+$1-$3-$3,$2+$2,0,0,0*
 *  21,1,$1+$1-$3-$3,$2+$2,0,0,0*
1,1,$3+$3,$1-$3,$2-$3*
 *  1,1,$3+$3,$1-$3,$2-$3*
1,1,$3+$3,$3-$1,$2-$3*
 *  1,1,$3+$3,$3-$1,$2-$3*
1,1,$3+$3,$1-$3,$3-$2*
 *  1,1,$3+$3,$1-$3,$3-$2*
1,1,$3+$3,$3-$1,$3-$2*%
 *  1,1,$3+$3,$3-$1,$3-$2*%
Example of instanciation:
 *  Example of instanciation:

 *
A more complicated sample of aperture macro definition:
 *  A more complicated sample of aperture macro definition:
G04 Rectangular Thermal Macro, params: W/2, H/2, T/2 *
 *  G04 Rectangular Thermal Macro, params: W/2, H/2, T/2 *
%AMRECTHERM*
 *  %AMRECTHERM*
$4=$3/2*
 *  $4=$3/2*
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
 *  21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
21,1,$1-$3,$2-$3,0-$1/2-$4,$2/2+$4,0*
 *  21,1,$1-$3,$2-$3,0-$1/2-$4,$2/2+$4,0*
21,1,$1-$3,$2-$3,$1/2+$4,0-$2/2-$4,0*
 *  21,1,$1-$3,$2-$3,$1/2+$4,0-$2/2-$4,0*
21,1,$1-$3,$2-$3,$1/2+$4,$2/2+$4,0*%
 *  21,1,$1-$3,$2-$3,$1/2+$4,$2/2+$4,0*%
Example of instanciation:
 *  Example of instanciation:
%ADD28RECTHERM,0.035591X0.041496X0.005000*%
 *  %ADD28RECTHERM,0.035591X0.041496X0.005000*%
 */
 */


#include <vector>
#include <vector>
@@ -114,8 +114,7 @@ Example of instanciation:
 */
 */
class AM_PARAM
class AM_PARAM
{
{
public:
public: AM_PARAM() :
    AM_PARAM() :
        index( -1 ),
        index( -1 ),
        value( 0.0 )
        value( 0.0 )
    {}
    {}
@@ -147,6 +146,7 @@ public:
        index = aIndex;
        index = aIndex;
    }
    }



    /**
    /**
     * Function ReadParam
     * Function ReadParam
     * Read one aperture macro parameter
     * Read one aperture macro parameter
+14 −5
Original line number Original line Diff line number Diff line
@@ -36,6 +36,16 @@
#include "base_struct.h"
#include "base_struct.h"
#include "class_am_param.h"
#include "class_am_param.h"


/*
 *  An aperture macro defines a complex shape and is a list of aperture primitives.
 *  Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
 *  Inside a given aperture primitive, a fixed list of parameters defines info
 *  about the shape: size, thickness, number of vertex ...
 *
 *  Each parameter can be an immediate value or a defered value.
 *  When value is defered, it is defined when the aperture macro is instancied by
 *  an ADD macro command
 */


/**
/**
 * Enum AM_PRIMITIVE_ID
 * Enum AM_PRIMITIVE_ID
@@ -74,8 +84,7 @@ public:
    bool            m_GerbMetric;       // units for this primitive:
    bool            m_GerbMetric;       // units for this primitive:
                                        // false = Inches, true = metric
                                        // false = Inches, true = metric


public:
public: AM_PRIMITIVE( bool aGerbMetric, AM_PRIMITIVE_ID aId = AMP_UNKNOWN )
    AM_PRIMITIVE( bool aGerbMetric, AM_PRIMITIVE_ID aId = AMP_UNKNOWN )
    {
    {
        primitive_id = aId;
        primitive_id = aId;
        m_GerbMetric = aGerbMetric;
        m_GerbMetric = aGerbMetric;